Empezando a compilar...Variables no definidas.

Post Reply
csincuir
Posts: 305
Joined: Sat Feb 03, 2007 6:36 am
Location: Guatemala
Contact:

Empezando a compilar...Variables no definidas.

Post by csincuir »

Hola.
Ya estoy haciendo prueba en compilar los fuentes de Visual FW utilizando un archivo .mak para xHarbour y Borland, con FWH 7.12, y he econtrado estos inconvenientes:

Como utilizo la opcion /es2 para compilar con xHarbour, y con esto encontrar variables no definidas, he encontrado estas en:

Programa: Code.prg
Linea 72: No esta definidas las variables : nOption, nOldOption

Code: Select all

   @ 4, 0 TABS ::oTabs OF Self ;
      ON CHANGE ( ::SetOption( nOption, nOldOption ),;
                  ::SetText( "Source editor: " + ::oActiveEdit:cFileName ) )

El siguiente codigo en el programa "project.prg", me da un error de sintaxis en la definición de los tres Gets, empezando en la linea 566.
En el primer Get se ve una coma de mas despues del "oFld:aDialogs[ 1 ] ,", pero igual si se la quito,sigue el error, pero si les quito los "Action" a cada uno pasa sin problemas.

Code: Select all

   REDEFINE GET oGet1 VAR ::cCompiler   ID ID_CLIPPER   OF oFld:aDialogs[ 1 ] ,;
      ACTION Iif( ! Empty( cCompiler := cGetFile( "*.exe", "Compiler location" ) ),;
                 ( ::cCompiler := cCompiler, oGet1:Refresh() ),)

   REDEFINE GET oGet2 VAR ::cChPath    ID ID_CHPATH    OF oFld:aDialogs[ 1 ] ;
      ACTION If( ! Empty( cChpath := cGetDir( "Header files location" ) ),;
                 ( ::cChPath := cChPath, oGet2:Refresh() ),)
      
   REDEFINE GET      ::cObjPath   ID ID_OBJPATH   OF oFld:aDialogs[ 1 ] ACTION nil

En el programa "inspect.prg", hay un error al definir el xBrowse, en la linea 66

Code: Select all

 28, 3 XBROWSE ::oBrw ;
y tambien falta la funcion "nClrToCode", que esta en la linea 343 tambien de "inspect.prg"

Code: Select all

oProp:bOnRead   = { | oProp | cClrToCode( OSend( o, oProp:cName ) ) }
Pero bueno, haciendo algunos arreglos de quitar y poner, ya compile todos los progranas con el archivo .mak y genero el .exe, con el repectivo error, al ejecutarse por la definición del xBrowse de "inspect.prg"

En otro mensaje, coloco el archivo .mak

Saludos.

Carlos Sincuir
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Carlos,

>
Programa: Code.prg
Linea 72: No esta definidas las variables : nOption, nOldOption

Code:

@ 4, 0 TABS ::oTabs OF Self ;
ON CHANGE ( ::SetOption( nOption, nOldOption ),;
::SetText( "Source editor: " + ::oActiveEdit:cFileName ) )
>

La variable nOption si esta definida en folder.ch. La que se ha anadido nueva es nOldOption:

Code: Select all

#xcommand @ <nRow>, <nCol> TABS [<oTabs>] ;
             [ <of: OF, WINDOW, DIALOG> <oWnd> ] ;
             [ <prm: PROMPT, PROMPTS, ITEMS> <cPrompt,...> ] ;
             [ <bmp: BITMAP, BITMAPS, RESOURCE> <cBitMap,...> ] ;
             [ <act: ACTION, EXECUTE, ON CHANGE> <uAction> ] ;
             [ <lPixel: PIXEL> ] ;
             [ <lDesign: DESIGN> ] ;
             [ <color: COLOR, COLORS> <nClrFore> [,<nClrBack>] ] ;
             [ OPTION <nOption> ] ;
             [ SIZE <nWidth>, <nHeight> ] ;
             [ MESSAGE <cMsg> ] ;
       => ;
          [<oTabs> := ] TTabs():New( <nRow>, <nCol>,;
             [\{<cPrompt>\}], [{|nOption,nOldOption|<uAction>}], ;
             <oWnd>, <nOption>, <nClrFore>, <nClrBack>, <.lPixel.>,;
             <.lDesign.>, <nWidth>, <nHeight>, <cMsg>, [\{<cBitMap>\}] ) 
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:

Post by Antonio Linares »

Carlos,

> y tambien falta la funcion "nClrToCode", que esta en la linea 343 tambien de "inspect.prg"

Aqui esta la version mas actualizada de source/function/valblank.prg que include cClrToCode():

source/function/valblank.prg

Code: Select all


#ifndef __XPP__
   #ifndef __HARBOUR__
      #define __CLIPPER__
   #endif
#endif


#define CRLF CHR(13)+CHR(10)
#xcommand DEFAULT <uVar1> := <uVal1> ;
               [, <uVarN> := <uValN> ] => ;
                  If( <uVar1> == nil, <uVar1> := <uVal1>, ) ;;
                [ If( <uVarN> == nil, <uVarN> := <uValN>, ); ]

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

function uValBlank( uValue )

   local cType := ValType( uValue )
   local uResult

   do case
      case cType $ "CM"
       uResult = Space( Len( uValue ) )

      case cType == "N"
       uResult =  uValue - uValue

      case cType == "L"
       uResult = .f.

      case cType == "D"
       uResult = CToD( "  -  -  " )

   endcase

return uResult

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

function ReadVar()

   local nWnd := AScan( GetAllWin(),;
                        { | oWnd | oWnd:lFocused .and. oWnd:ClassName() == "TGET" } )

return If( nWnd != 0, GetAllWin()[ nWnd ], nil )

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

#ifndef __CLIPPER__

function cValToChar( uVal )

   local cType := ValType( uVal )

   do case
      case cType == "C" .or. cType == "M"
           return uVal

      case cType == "D"
           return DToC( uVal )

      case cType == "L"
           return If( uVal, ".T.", ".F." )

      case cType == "N"
           return AllTrim( Str( uVal ) )

      case cType == "B"
           return "{|| ... }"

      case cType == "A"
           return "{ ... }"

      case cType == "O"
           return "Object"

      otherwise
           return ""
   endcase

return nil
#endif

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

function cValToStr( uVal, cPic )

   local cVal

   if uVal == nil
      cVal     := 'nil'
   elseif Empty( cPic )
      cVal     := cValToChar( uVal )
#ifdef __XHARBOUR__
   elseif cPic == '@T'
      cVal     := TTOC( uVal )
#endif
   elseif ValType( uVal ) == 'D' .and. !( cPic = '@' )
      cVal := Lower( cPic )
      cVal    := StrTran( cVal, 'dd', StrZero( Day( uVal ), 2 ) )
      if 'mmmm' $ cVal
         cVal    := StrTran( cVal, 'mmmm', cMonth( uVal ) )
      elseif 'mmm' $ cVal
         cVal    := StrTran( cVal, 'mmm', Left( cMonth( uVal ), 3 ) )
      else
         cVal    := StrTran( cVal, 'mm', StrZero( Month( uVal ), 2 ) )
      endif
      if 'yyyy' $ cVal
         cVal    := StrTran( cVal, 'yyyy', Str( Year( uVal ), 4, 0 ) )
      else
         cVal    := StrTran( cVal, 'yy',   StrZero( Year( uVal ) % 100, 2 ) )
      endif
   else
      cVal     := Transform( uVal, cPic )
   endif

return cVal

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

function WheelScroll()

   #ifndef HKEY_CURRENT_USER
      #define  HKEY_CURRENT_USER       2147483649        // 0x80000001
   #endif

   static nScrLines  := nil

   local oReg

   if nScrLines == nil
      // oReg:= TReg32():New( HKEY_CURRENT_USER, "Control Panel\Desktop" )
      // nScrLines := oReg:Get( "WheelScrollLines" )
      // oReg:Close()

      if Empty( nScrLines )
         nScrLines   := 1
      else
         nScrLines   := Val( nScrLines )
      endif
   endif

return nScrLines

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

function nRGBReSet( nClr, r, g, b )

   DEFAULT r := nRGBRed(   nClr ), ;
           g := nRGBGreen( nClr ), ;
           b := nRGBBlue(  nClr )

   r     := Min( 255, Max( 0, r ) )
   g     := Min( 255, Max( 0, g ) )
   b     := Min( 255, Max( 0, b ) )

return nRGB( r, g, b )

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

function nRGBAdd( nClr, r, g, b )

   DEFAULT r := 0, g := 0, b := 0

   r  += nRGBRed(   nClr )
   g  += nRGBGreen( nClr )
   b  += nRGBBlue(  nClr )

   r     := Min( 255, Max( 0, r ) )
   g     := Min( 255, Max( 0, g ) )
   b     := Min( 255, Max( 0, b ) )

return nRGB( r, g, b )

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

function cClrToCode( clr )

   local cCode    := ""
   local ctmp1, ctmp2, n
   local r,g,b
   local cType    := ValType( clr )
   local aStdClrs := { ;
      { 'CLR_BLACK',             0 }, ;
      { 'CLR_BLUE',        8388608 }, ;
      { 'CLR_GREEN',         32768 }, ;
      { 'CLR_CYAN',        8421376 }, ;
      { 'CLR_RED',             128 }, ;
      { 'CLR_MAGENTA',     8388736 }, ;
      { 'CLR_BROWN',         32896 }, ;
      { 'CLR_HGRAY',      12632256 }, ;
      { 'CLR_LIGHTGRAY',  12632256 }, ;
      { 'CLR_GRAY',        8421504 }, ;
      { 'CLR_HBLUE',      16711680 }, ;
      { 'CLR_HGREEN',        65280 }, ;
      { 'CLR_HCYAN',      16776960 }, ;
      { 'CLR_HRED',            255 }, ;
      { 'CLR_HMAGENTA',   16711935 }, ;
      { 'CLR_YELLOW',        65535 }, ;
      { 'CLR_WHITE',      16777215 } }

   if ! Empty( clr )
      do case
         case cType == 'N'
//            cCode    += cClrToCode( clr )
            if ( n := AScan( aStdClrs, { |a| a[ 2 ] == clr } ) ) > 0
               cCode    := aStdClrs[ n ][ 1 ]
            else
               r        := nRGBRed(   clr ) // clr % 256; clr := Int( clr / 256 )
               g        := nRGBGreen( clr ) // clr % 256; clr := Int( clr / 256 )
               b        := nRGBBlue(  clr ) // clr % 256
               cCode    := "RGB(" + Str( r, 4 ) + "," + Str( g, 4 ) + "," + Str( b, 4 ) + " )"
            endif
         case cType == 'A'
            if ValType( clr[ 1 ] ) == 'A'
               cCode    := '{ ;' + CRLF
               for n := 1 to Len( clr )
                  cCode    += Space( 3 ) + cClrToCode(  clr[ n ] )
                  if n < Len( clr )
                     cCode += ', ;' + CRLF
                  else
                     cCode += '  ;' + CRLF
                  endif
               next n
               cCode    += '}'
            else
               if Len( clr ) == 1
                  cCode := '{ ' + cClrToCode( clr ) + ' }'
               elseif Len( clr ) == 2
                  cCode := '{ ' + ;
                            PadR( cClrToCode( clr[ 1 ] ) + ',', 23 ) + ;
                            PadR( cClrToCode( clr[ 2 ] ), 22 ) + ' }'

               elseif Len( clr ) == 3
                  cCode := '{ ' + ;
                            PadR( TrimZero( Str( clr[ 1 ], 6, 4 ) ) + ',', 8 ) + ;
                            PadR( cClrToCode( clr[ 2 ] ) + ',', 23 ) + ;
                            PadR( cClrToCode( clr[ 3 ] ), 22 ) + ' }'

               endif
            endif
         case cType == 'B'
            cTmp1    := cClrToCode( Eval( clr, .t. ) )
            cTmp2    := cClrToCode( Eval( clr, .f. ) )
            if cTmp1 == cTmp2
               if CRLF $ cTmp1
                  cTmp1    := Space(3) + StrTran( cTmp1, CRLF, CRLF + Space(3) )
                  cCode    := '{ || ;' + CRLF + cTmp1 + ' ;' + CRLF + '}'
               else
                  cCode    := '{ || ' + cTmp1 + ' }'
               endif
            else
               cTmp1    := Space(3) + StrTran( cTmp1, CRLF, CRLF + Space(3) )
               cTmp2    := Space(3) + StrTran( cTmp2, CRLF, CRLF + Space(3) )
               cCode    := '{ | lInvert | If( ! lInvert, ;' + CRLF + ;
                           cTmp2 + ',;' + CRLF + cTmp1 + ;
                           ' ;' + CRLF + ') }'
            endif
      endcase
   endif

return cCode

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

static function TrimZero( c )

   do while Right( c, 1 ) == '0'
      c  := Left( c, Len( c ) - 1 )
   enddo

return c

//----------------------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply