Primera consulta sobre fiveMac

User avatar
mastintin
Posts: 1502
Joined: Thu May 27, 2010 2:06 pm

Primera consulta sobre fiveMac

Post by mastintin »

Al copilar el primer programa test me da error :
Parece como si harbour para mac estuviera copilado sin soporte para Snow Leopard o le faltara un modificador para que gcc lo compile en 32bits .

iMac-de-Manuel-Alvarez-Sanchez:samples manuel$ ./build.sh test

compiling...
Harbour devel build 1.1-1 Intl.
Copyright (c) 1999-2007, http://www.harbour-project.org/
Compiling 'test.prg'...
Lines 866, Functions/Procedures 1
Generating C source output to 'test.c'... Done.
compiling C module...
linking...
ld: warning: in ./../lib/libfive.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in ./../lib/libfivec.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/libdebug.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/libvm.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/librtl.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/liblang.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/librdd.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/libgtstd.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/libgttrm.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/libmacro.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/libpp.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/libdbfntx.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/libdbfcdx.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/libdbffpt.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/libhbsix.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
ld: warning: in /Users/manuel/Desktop/fivemac/harbour/lib/libcommon.a, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols:
"_hb_vmExecute", referenced from:
_HB_FUN_TEST in test.o
"_main", referenced from:
start in crt1.10.6.o
"_hb_vmProcessSymbolsEx", referenced from:
_hb_vm_SymbolInit_TEST in test.o
"_HB_FUN_MSGINFO", referenced from:
_symbols_table in test.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
done!
./build.sh: line 39: ./test.app/Contents/MacOS/test: No such file or directory
Erase is delete.
Interrupt is control-C (^C).
iMac-de-Manuel-Alvarez-Sanchez:samples manuel$
User avatar
mastintin
Posts: 1502
Joined: Thu May 27, 2010 2:06 pm

Re: Primera consulta sobre fiveMac

Post by mastintin »

me contesto a mi mismo .... faltaba el modificador -arch i386 , ya compila tutor01
Gracias.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Primera consulta sobre fiveMac

Post by Antonio Linares »

Manuel,

Bien! :-)

gracias,
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Primera consulta sobre fiveMac

Post by Antonio Linares »

Manuel,

De hecho, como bien dices, el wiki de FiveMac está incompleto y se nos está pasando una nueva idea por la cabeza :-)

La idea sería ofrecer un FWH 64 bits gratuito a quienes ayuden a completar el wiki de FiveMac :-)

Asi, además de usarlo y practicar con él, se estaría ayudando en su documentación y de paso ganando un FWH 64 gratuito

Que más se puede pedir ? :-)

http://wiki.fivetechsoft.com/doku.php
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
mastintin
Posts: 1502
Joined: Thu May 27, 2010 2:06 pm

Re: Primera consulta sobre fiveMac

Post by mastintin »

Al usar el programa Testdbf y pulsar alguno de los botones me da error :

Error BASE/1004 No exported method: EVAL
Called from (b)EVAL(0)
Called from (b)TCONTROL(16)
Called from TSAY:REFRESH(0)
Called from (b)EVAL(27)
Called from AEVAL(0)
Called from (b)MAIN(27)
Called from (b)TBUTTON(10)
Called from TBUTTON:CLICK(0)
Called from TWINDOW:HANDLEEVENT(173)
Called from _FMH(230)
Called from WNDRUN(0)
Called from TWINDOW:ACTIVATE(87)
Erase set to backspace.
Kill set to control-U (^U).
Interrupt set to delete.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Primera consulta sobre fiveMac

Post by Antonio Linares »

Manuel,

Corregido el bug y subida nueva versión con Harbour 2.1 :-)

Por favor descarga nuevamente Harbour y FiveMac, gracias

Construido y probado en Snow Leopard :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
mastintin
Posts: 1502
Joined: Thu May 27, 2010 2:06 pm

Re: Primera consulta sobre fiveMac

Post by mastintin »

me parece que la version de harbour no esta cambiada .Sigue siendo la :

compiling...
Harbour devel build 1.1-1 Intl.
Copyright (c) 1999-2007, http://www.harbour-project.org/
Compiling 'tutor01.prg'...
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Primera consulta sobre fiveMac

Post by Antonio Linares »

Manuel,

Arreglado, el enlace de la página apuntaba a un sitio diferente :-)

gracias!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
mastintin
Posts: 1502
Joined: Thu May 27, 2010 2:06 pm

Re: Primera consulta sobre fiveMac

Post by mastintin »

Antonio , como me doy de alta en el wiki para intentar ayudar en lo que esté en mi mano y conocimiento ? .
Un saludo.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Primera consulta sobre fiveMac

Post by Antonio Linares »

Manuel,

Ya te hemos dado de alta como colaborador en el wiki :-)

http://wiki.fivetechsoft.com

Debes haber recibido un email con los datos de acceso. Muchas gracias por tu ayuda! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
mastintin
Posts: 1502
Joined: Thu May 27, 2010 2:06 pm

Re: Primera consulta sobre fiveMac

Post by mastintin »

Con el nuevo harbour no puedo compilar ninguno de los ejemplos .
el error :
Si compilo con el modificador de ppc dice lo mismo pero para ppc .




compiling...
Harbour 2.1.0beta1 (Rev. 14766)
Copyright (c) 1999-2010, http://harbour-project.org/
Compiling 'tutor01.prg'...
Lines 7, Functions/Procedures 1
Generating C source output to 'tutor01.c'... Done.
compiling C module...
linking...
ld: warning: in ./../lib/libfive.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in ./../lib/libfivec.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/libhbdebug.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/libhbvm.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/libhbrtl.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/libhblang.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/libhbrdd.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/libgtstd.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/libgttrm.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/libhbmacro.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/libhbpp.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/librddntx.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/librddcdx.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/librddfpt.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/libhbsix.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /Users/manuel/Desktop/FWM/harbour/lib/libhbcommon.a, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols:
"_hb_vmExecute", referenced from:
_HB_FUN_MAIN in tutor01.o
"_main", referenced from:
start in crt1.10.6.o
"_hb_vmProcessSymbols", referenced from:
_hb_vm_SymbolInit_TUTOR01 in tutor01.o
"_HB_FUN_MSGINFO", referenced from:
_symbols_table in tutor01.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
done!
./build.sh: line 39: ./tutor01.app/Contents/MacOS/tutor01: No such file or directory
Erase is delete.
Interrupt is control-C (^C).
iMac-de-Manuel-Alvarez-Sanchez:samples manuel$

--------------------- editado para correción ------------------

Si quitamos el modificador compila a la perfección .
Si me confirmas que es que ya no se va a necesitar el modificador se puieden limpiar las lineas de build.sh con comentario sobrante y actualizar el wiki .
Un saludo.
User avatar
mastintin
Posts: 1502
Joined: Thu May 27, 2010 2:06 pm

Re: Primera consulta sobre fiveMac

Post by mastintin »

Otro error al compilar el programa osxpro.prg

compiling...
Harbour 2.1.0beta1 (Rev. 14766)
Copyright (c) 1999-2010, http://harbour-project.org/
Compiling 'osxpro.prg'...
Lines 2007, Functions/Procedures 17
Generating C source output to 'osxpro.c'... Done.
compiling C module...
linking...
Undefined symbols:
"_HB_FUN___HRBDO", referenced from:
_symbols_table in osxpro.o
"_HB_FUN___HRBRUN", referenced from:
_symbols_table in osxpro.o
"_HB_FUN___HRBLOAD", referenced from:
_symbols_table in osxpro.o
"_HB_FUN___HRBUNLOAD", referenced from:
_symbols_table in osxpro.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
done!
Un saludo.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Primera consulta sobre fiveMac

Post by Antonio Linares »

Manuel,
Si quitamos el modificador compila a la perfección .
Si me confirmas que es que ya no se va a necesitar el modificador se puieden limpiar las lineas de build.sh con comentario sobrante y actualizar el wiki
Te refieres a -arch ppc -arch i386 ?

Nosotros aqui estamos probando en Snow Leopard (64 bits) y en Leopard (32 bits) y funciona bien sin necesidad de ningun modificador. Aunque en nuestro caso reconstruimos las librerias en cada uno de ellos con sus respectivos compiladores gcc.

En PowerPC no estamos probando, aunque tenemos a mano un Mac Mini en PowerPC por si hiciese falta.

gracias por todas tus pruebas y ayuda :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Primera consulta sobre fiveMac

Post by Antonio Linares »

Manuel,
"_HB_FUN___HRBDO", referenced from:
_symbols_table in osxpro.o
"_HB_FUN___HRBRUN", referenced from:
_symbols_table in osxpro.o
"_HB_FUN___HRBLOAD", referenced from:
_symbols_table in osxpro.o
"_HB_FUN___HRBUNLOAD", referenced from:
_symbols_table in osxpro.o
Tienes que renombrar esas funciones con el prefijo HB_ y un solo subrayado, por ejemplo HB_HRBRUN().

Estamos terminando de corregir unas cosas y vamos a publicar un nuevo build cuanto antes con todos _ recientes. Tambien hemos detectado _ de la versión 10.5 (Leopard 32) a la 10.6 (Snow Leopard 64) en el API de Cocoa (GUI de OSX).
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
mastintin
Posts: 1502
Joined: Thu May 27, 2010 2:06 pm

Re: Primera consulta sobre fiveMac

Post by mastintin »

Antonio Linares wrote:Manuel,

Te refieres a -arch ppc -arch i386 ?
Exacto , a ese modificador me refería , pero mucho mejor si no tenemos que ponerlo . Seguir con ppc a estas alturas ya no tiene mucho sentido , quizas alguien tenga aún algún macpro , pero vamos , que con la proxima generación del sistema operativo toca cambio si o si.

Respecto al prg osxpro ya compila con _ y va perfecto .
Adjunto todo el codigo para que lo modifiques en las distribuciones.

Code: Select all

#include "FiveMac.ch"
#include "error.ch"
#include "dbinfo.ch"

extern dbfcdx, DBCloseArea, DbUseArea, DbGoTo
extern HB_Run, HB_HRBRun, HB_HRBLoad, HB_HRBDo, HB_HRBUnLoad
extern CurDir, Directory, MemoWrit

static oWndCommand, oWndResult

//----------------------------------------------------------------------------//

function Main()

   local oMemo, cCommand := "", oBar
   
   RddSetDefault( "DBFCDX" )
   
   BuildMenu()
   BuildPreprocessor()
   
   DEFINE WINDOW oWndCommand TITLE "Command" ;
      FROM 90, 255 TO 556, 265
      
   DEFINE TOOLBAR oBar OF oWndCommand     
  
   DEFINE BUTTON OF oBar PROMPT "New" ;
      TOOLTIP "Creates a new file" ;
      IMAGE "./../bitmaps/new.png"
      
   DEFINE BUTTON OF oBar PROMPT "Open" ;
      TOOLTIP "Open a file" ;
      IMAGE "./../bitmaps/folder.png"
      
   DEFINE BUTTON OF oBar PROMPT "Save" ;
      TOOLTIP "Save a file" ;
      IMAGE "" ;
      ACTION ( TxtHighlight( oMemo:hWnd ), oMemo:Refresh() )    
      
   @ 20, 20 GET oMemo VAR cCommand MEMO OF oWndCommand SIZE 516, 225

   oMemo:SetBkColor( nRGB( 160, 160, 160 ) )
   oMemo:SetFont( "Monaco", 13 )

   oMemo:bKeyDown = { | nKey | DoLine( nKey, oMemo ) }

   ButtonBar()
   
   ACTIVATE WINDOW oWndCommand
   
return nil

//----------------------------------------------------------------------------//

function _QOut( cText )

   if oWndResult == nil
      BuildResult()
   endif   

   oWndResult:aControls[ 1 ]:AddLine( cValToChar( cText ) + CRLF )
   oWndResult:aControls[ 1 ]:GoBottom()
   
return nil   

//----------------------------------------------------------------------------//

function _Clear()

   oWndResult:aControls[ 1 ]:SetText( "" )
   
return nil   

//----------------------------------------------------------------------------//

function DoLine( nKey, oMemo )

   local cCommand, cPP, oError
   local bError
   
   if nKey != 13 .and. nKey != 3
      return nil
   endif

   cCommand = MemoLine( oMemo:GetText(),, oMemo:nRow() - 1 )
   if Empty( cCommand )
      return nil
   endif   
   cPP = __PreProcess( cCommand )

   bError = ErrorBlock( { | o | Break( o ) } )
   BEGIN SEQUENCE
      &cPP
   RECOVER USING oError
      ShowError( oError )
   END SEQUENCE   
   ErrorBlock( bError )

return nil   

//----------------------------------------------------------------------------//

function ShowError( oError )

   local n, cMsg := "Error description: " + CRLF + ErrorMessage( oError ) + CRLF

   if ValType( oError:Args ) == "A"
      cMsg += "   Args:" + CRLF
      for n = 1 to Len( oError:Args )
         cMsg += "     [" + Str( n, 4 ) + "] = " + ValType( oError:Args[ n ] ) + ;
                      "   " + cValToChar( oError:Args[ n ] ) + CRLF
      next
   endif   

   MsgAlert( cMsg )

return nil   

//----------------------------------------------------------------------------//

function BuildMenu()

   local oMenu
   
   MENU oMenu
   
     MENUITEM "osxpro"
     MENU
        MENUITEM "Preferences..." ACCELERATOR ","
     ENDMENU
   
      MENUITEM "File"
      MENU
         MENUITEM "New..." ACCELERATOR "n"
         MENUITEM "Open..." ACCELERATOR "o"
         MENUITEM "Close"
         SEPARATOR
         MENUITEM "Save" ACCELERATOR "s"
         MENUITEM "Save As..."
         MENUITEM "Save As HTML..."
         MENUITEM "Revert"
         SEPARATOR
         MENUITEM "Import..."
         MENUITEM "Export..."
         SEPARATOR
         MENUITEM "Page Setup..."
         MENUITEM "Print Preview"
         MENUITEM "Print"
         SEPARATOR
         MENUITEM "Send..."
         MENUITEM "Exit" ACTION oWndCommand:End() ACCELERATOR "e"
      ENDMENU
      
      MENUITEM "Edit"
      MENU
      ENDMENU
      
      MENUITEM "View"
      MENU
      ENDMENU
      
      MENUITEM "Format"
      MENU
      ENDMENU
      
      MENUITEM "Tools"
      MENU
      ENDMENU
      
      MENUITEM "Program"
      MENU
         MENUITEM "Do..."
         MENUITEM "Cancel"
         MENUITEM "Resume"
         MENUITEM "Suspend"
         SEPARATOR
         MENUITEM "Compile"
      ENDMENU
      
      MENUITEM "Window"
      MENU
         MENUITEM "Hide"
         MENUITEM "Clear"
         MENUITEM "Cycle"
         SEPARATOR
         MENUITEM "Command Window"
         MENUITEM "Result Window" ACTION BuildResult()
         MENUITEM "Data Session"
         MENUITEM "Properties Window"
      ENDMENU
      
      MENUITEM "Help"
      MENU
         MENUITEM "About OsxPro..." ;
            ACTION MsgInfo( "Developed with FiveMac" + CRLF + "(c) FiveTech Software 2006-7", "OsxPro" )
      ENDMENU
      
   ENDMENU
   
return nil   

//----------------------------------------------------------------------------//

function New()

   local oWnd, cType := "Program"

   DEFINE WINDOW oWnd TITLE "New" ;
      FROM 0, 62 TO 290, 450
      
   @ 415, 20 SAY "File type" OF oWnd

   @ 385, 32 RADIO oRadMenu VAR cType ;
      ITEMS { "Project", "DataBase", "Table", "Query", "Connection", "View", "Remote view",;
                 "Form", "Report", "Label", "Program", "Class", "Text file", "Menu" } ;
      OF oWnd 
   
   @ 385, 170 BUTTON "New file" OF oWnd ;
      ACTION If( cType == 11, ( oWnd:End(), ModifyCommand( "test.prg" ) ),)    

   @ 355, 170 BUTTON "Wizard" OF oWnd   

   @  50, 170 BUTTON "Cancel" OF oWnd ACTION oWnd:End()  

   @  20, 170 BUTTON "Help" OF oWnd   
   
   ACTIVATE WINDOW oWnd

return nil

//----------------------------------------------------------------------------//

function BuildResult()

   local oMemo, oBar, cResult := ""
   
   if oWndResult != nil
      return nil
   endif   

   DEFINE WINDOW oWndResult TITLE "Result" ;
      FROM 217, 21 TO 556, 265

   DEFINE TOOLBAR oBar OF oWndResult
   
   DEFINE BUTTON OF oBar PROMPT "New"
   DEFINE BUTTON OF oBar PROMPT "Open"
   DEFINE BUTTON OF oBar PROMPT "Save"
      
   @ 20, 20 GET oMemo VAR cResult MEMO OF oWndResult SIZE 516, 225
   
   oMemo:SetEditable( .f. )
   oMemo:SetBkColor( nRGB( 160, 160, 160 ) )
   oMemo:SetFont( "Monaco", 13 )  
   
   ACTIVATE WINDOW oWndResult ;
      VALID ( oWndResult := nil, .t. )
   
   oWndCommand:SetFocus()
   
return nil

//----------------------------------------------------------------------------//

function Browse()

   local oWnd, oBrw 

   if Empty( Alias() )
      return nil
   endif   
   
   DEFINE WINDOW oWnd TITLE Alias() ;
      FROM 213, 109 TO 717, 431

   @ 48, 20 LISTBOX oBrw OF oWnd SIZE 672, 363 ALIAS Alias()
   
   ACTIVATE WINDOW oWnd
   
return nil   

//----------------------------------------------------------------------------//

function DoCommand( cPrgName )

   local cPrg, pCode

   if ! "." $ cPrgName
      cPrgName += ".prg"
   endif   
   
   if ! File( cPrgName )
      MsgAlert( cPrgName + " : file not found" )
      return nil
   endif

   cPrg = MemoRead( cPrgName )
   __Run( "./../../harbour/bin/harbour " + cPrgName + " -gh -n -I./../../harbour/include:./../include > comp.log" )
   // _QOut( MemoRead( "comp.log" ) )
   if At( "error", MemoRead( "comp.log" ) ) != 0
      MsgInfo( MemoRead( "comp.log" ) )
   endif      

   if File( SubStr( cPrgName, 1, At( ".", cPrgName ) ) + "hrb" )
      pCode = HB_HRBLoad( SubStr( cPrgName, 1, At( ".", cPrgName ) ) + "hrb" )
      HB_HRBDo( pCode )
      HB_HRBUnLoad( pCode )
   endif   
   
return nil   
   
//----------------------------------------------------------------------------//

function DoForm( cFileName )

   local oForm, oControl

   if ! "." $ cFileName
      cFileName += ".scx"
   endif   
   
   if ! File( cFileName )
      MsgAlert( cFileName + " : file not found" )
      return nil
   endif

   RddInfo( RDDI_MEMOEXT, ".sct" )
   USE ( cFileName ) NEW
   SKIP 2
   
   if Upper( Class ) == "FORM"
      oForm = TWindow():New()
      SetProps( oForm, properties )

       while ! EoF() .and. ! Empty( Class )
          oControl = nil
          SKIP
          do case
           case Upper( Class ) == "COMMANDBUTTON"
                   oControl = TButton():New()
               
           case Upper( Class ) == "LABEL"
                   oControl = TSay():New()

              case Upper( Class ) == "TEXTBOX"
                   oControl = TGet():New()
               
      endcase
      if oControl != nil
         SetProps( oControl, properties )
      endif   
      end     
       
      oForm:Activate()
   endif   

   USE
   RddInfo( RDDI_MEMOEXT, ".fpt" )
   
return nil

//----------------------------------------------------------------------------//

function SetProps( oControl, cProperties )

   local n, cLine, cProp, cValue

   for n = 1 to MLCount( cProperties )
      cLine = MemoLine( cProperties,, n )
      cProp = Upper( AllTrim( StrToken( cLine, 1, "=" ) ) )
      cValue = AllTrim( StrToken( cLine, 2, "=" ) )

      do case
           case cProp == "TOP"
               if ! oControl:IsDerivedFrom( TControl() )
                  oControl:nTop = Val( cValue )
           else   
                  oControl:nTop = GetWndDefault():nHeight - Val( cValue ) - 40
              if oControl:IsDerivedFrom( TSay() )
                 oControl:nTop += 10
              endif 
           endif   
           
       case cProp == "LEFT"
            oControl:nLeft = Val( cValue )
           
       case cProp == "WIDTH"
            oControl:nWidth = Val( cValue )
           
       case cProp == "HEIGHT"
            oControl:nHeight = Val( cValue )
           
       case cProp == "CAPTION"
            oControl:SetText( &cValue )

       case cProp == "NAME"
            if oControl:IsDerivedFrom( TGet() )
               oControl:SetText( &cValue )
            endif   
       endcase         
    next

return nil

//----------------------------------------------------------------------------//

function Edit()

   local oWnd, oBrw 

   if Empty( Alias() )
      return nil
   endif   
   
   DEFINE WINDOW oWnd TITLE Alias() ;
      FROM 213, 109 TO 717, 431

   @ 48, 20 LISTBOX oBrw FIELDS "", "" HEADERS "FieldName", "Value" ;
      OF oWnd SIZE 672, 363 ALIAS Alias()
   
   oBrw:SetEdit()   
      
   ACTIVATE WINDOW oWnd
   
return nil   

//----------------------------------------------------------------------------//

function ModifyCommand( cPrgName )

   local oWnd, cPrg := "", oMemo, oBar
   
   if ! "." $ cPrgName
      cPrgName += ".prg"
   endif   
   
   if File( cPrgName )
      cPrg = MemoRead( cPrgName )
   else
      cPrg = '#include "FiveMac.ch"' + CRLF + CRLF + ;
             "function Main()" + CRLF + CRLF + CRLF + CRLF + ;
             "return nil"   
   endif   
   
   DEFINE WINDOW oWnd TITLE cPrgName ;
      FROM 22, 120 TO 600, 392
      
   DEFINE TOOLBAR oBar OF oWnd
   
   DEFINE BUTTON OF oBar ;
      PROMPT  "New" ;
      TOOLTIP "Create a new PRG" ;
      IMAGE   "./../bitmaps/new.png" ;
      ACTION MsgInfo( oWnd:nTop )

   DEFINE BUTTON OF oBar ;
      PROMPT  "Run" ;
      TOOLTIP "Build and run the PRG" ;
      IMAGE   "./../bitmaps/run.tiff" ;
      ACTION  ( MemoWrit( "_temp.prg", oMemo:GetText() ), DoCommand( "_temp.prg" ) )
         
   @ 0, 0 GET oMemo VAR cPRG MEMO OF oWnd SIZE 606, 392
      
   oMemo:SetBkColor( nRGB( 160, 160, 160 ) )
   oMemo:SetFont( "Monaco", 13 )      
      
   ACTIVATE WINDOW oWnd ;
      VALID ( If( MsgYesNo( "Do you want to save changes to " + cPrgName + " ?" ),;
                  MemoWrit( cPrgName, oMemo:GetText() ),), .t. ) ;
      ON CLICK MsgInfo( oWnd:nTop )           

return nil

//----------------------------------------------------------------------------//

function BuildPreprocessor()

   __preprocess( "#xcommand ?  [ <list,...> ] => _QOut( <list> )" )
   __preprocess( "#xcommand ?? [ <list,...> ] => _QQOut( <list> )" )
   __preprocess( "#xcommand BROWSE => Browse()" )
   __preprocess( "#xcommand CLEAR => _Clear()" )
   __preprocess( "#xcommand DO COMMAND <x> => DoCommand( <(x)> )" )
   __preprocess( "#xcommand DO FORM <x> => DoForm( <(x)> )" )
   __preprocess( "#xcommand EDIT => Edit()" ) 
   __preprocess( "#xcommand ENDPROC => return" )
   __preprocess( "#xcommand MODIFY COMMAND <x> => ModifyCommand( <(x)> )" )
   __preprocess( "#xcommand PUBLIC <x> => __mvPublic( <(x)> )" )

return nil

//----------------------------------------------------------------------------//

static function ErrorMessage( e )

   // start error message
   local cMessage := if( empty( e:OsCode ), ;
                          if( e:severity > ES_WARNING, "Error ", "Warning " ),;
                          "(DOS Error " + AllTrim( Str( e:osCode ) ) + ") " )

   // add subsystem name if available
   cMessage += if( ValType( e:SubSystem ) == "C",;
                    e:SubSystem()                ,;
                    "???" )

   // add subsystem's error code if available
   cMessage += if( ValType( e:SubCode ) == "N",;
                    "/" + AllTrim( Str( e:SubCode ) )  ,;
                    "/???" )
   // add error description if available
   if ( ValType( e:Description ) == "C" )
        cMessage += "  " + e:Description
   end

   // add either filename or operation
   cMessage += if( ! Empty( e:FileName ),;
                    ": " + e:FileName   ,;
                    if( !Empty( e:Operation ),;
                        ": " + e:Operation   ,;
                        "" ) )
return cMessage

//----------------------------------------------------------------------------//

function ButtonBar()

   local oWnd, oBar
   
   DEFINE WINDOW oWnd TITLE "" FROM 590, 0 TO 832, 0 PANELED TEXTURED

   DEFINE TOOLBAR oBar OF oWnd
   
   DEFINE BUTTON OF oBar PROMPT "New" ;
      TOOLTIP "Create a new file" ;
      IMAGE "./../bitmaps/new.png" ;
      ACTION New()

   DEFINE BUTTON OF oBar PROMPT "Open" ;
      TOOLTIP "Open a file" ;
      IMAGE "./../bitmaps/folder.png" ;
      ACTION MsgInfo( "Open" )

   DEFINE BUTTON OF oBar PROMPT "Save" ;
      TOOLTIP "Save the file" ;
      IMAGE "./../bitmaps/floppy.png" ;
      ACTION MsgInfo( "Save" )

   /*
   @ 5, 5 BTNBMP FILENAME "bitmaps/new.png" ACTION New()
   @ 5, 50 BTNBMP FILENAME "bitmaps/open.png"
   @ 5, 95 BTNBMP FILENAME "bitmaps/save.png"

   @ 5, 147 BTNBMP FILENAME "bitmaps/print.png"
   @ 5, 192 BTNBMP FILENAME "bitmaps/preview.png"

   @ 5, 244 BTNBMP FILENAME "bitmaps/cut.tiff"
   @ 5, 289 BTNBMP FILENAME "bitmaps/copy.tiff"
   @ 5, 334 BTNBMP FILENAME "bitmaps/save.png"

   @ 5, 386 BTNBMP FILENAME "bitmaps/left.png"
   @ 5, 431 BTNBMP FILENAME "bitmaps/right.png"

   @ 5, 483 BTNBMP FILENAME "bitmaps/print.png"
   @ 5, 528 BTNBMP FILENAME "bitmaps/run.png"
   */
   
   ACTIVATE WINDOW oWnd ;
      ON CLICK MsgInfo( oWnd:nTop )
   
return nil   

//----------------------------------------------------------------------------//
 
Post Reply