Migrar xHarbour a Harbour HBClass

User avatar
Compuin
Posts: 1251
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada
Has thanked: 7 times
Been thanked: 3 times

Migrar xHarbour a Harbour HBClass

Post by Compuin »

Hola

MIgrando de xHarbour a Habrbour 3.2 tengo problemas con la HBClass, al parecer Harbour no la reconoce

__oDatabase := HBClass():New( cClsName, __CLS_PARAM ( cFromClass ) )

Ya que me arroja lo siguiente

Error: Unresolved external '_HB_FUN___CLS_PARAM' referenced from...

Alguna solucion ?
FWH 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code
xmanuel
Posts: 768
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla
Been thanked: 5 times
Contact:

Re: Migrar xHarbour a Harbour HBClass

Post by xmanuel »

Cambia esto:

Code: Select all | Expand

__oDatabase := HBClass():New( cClsName, __CLS_PARAM ( cFromClass ) )

por esto:

Code: Select all | Expand

__oDatabase := HBClass():New( cClsName,{ cFromClass } )
______________________________________________________________________________
Sevilla - Andalucía
User avatar
Compuin
Posts: 1251
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada
Has thanked: 7 times
Been thanked: 3 times

Re: Migrar xHarbour a Harbour HBClass

Post by Compuin »

No funciono

Arroja esto

:SETREADPADALL
FWH 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code
xmanuel
Posts: 768
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla
Been thanked: 5 times
Contact:

Re: Migrar xHarbour a Harbour HBClass

Post by xmanuel »

Pero eso no tiene nada que ver con el error anterior...
Tal vez si pusieras más código podríamos ver a qué se debe el error :oops:
______________________________________________________________________________
Sevilla - Andalucía
User avatar
Compuin
Posts: 1251
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada
Has thanked: 7 times
Been thanked: 3 times

Re: Migrar xHarbour a Harbour HBClass

Post by Compuin »

Aca el codigo

function TMyMSQuery( cCls ) ; return( MyGenClass( cCls, TMSQuery() ) )

The variable __aHCls
AAdd( __aHCls, { cClsName, __nClassH } )

the class and handle
How free

static __aHCls := {}

#include "HbClass.ch"

function MyGenClass( cClsName, FromClass )

local n, __nClassH, __odatabase
local cFromClass := upper( FromClass:ClassName() )

cClsName := "TMY" + Upper( if( empty( cClsName ), ;
PadL( len( __aHCls ), 7, "0" ), Alltrim( cClsName ) ) )

if ( n := AScan( __aHCls, { |aClass| aClass[ 1 ] == cClsName } ) ) == 0
_HB_CLASS cClsName
__oDatabase := HBClass():New( cClsName, { cFromClass } )
__oDatabase:Create()
__nClassH := __oDatabase:hClass
AAdd( __aHCls, { cClsName, __nClassH } )
else
__nClassH := __aHCls[ n, 2 ]
endif

return( __clsInst( __nClassH ) )

//Cretae the function for deleted __aHCls the handling
//the class

Function CloseClass( oClase )
Local n,cClsName

cClsName := "TMY" + Upper( PadL( len( __aHCls ), 7, "0" ) )

if ( n := AScan( __aHCls, { |aClass| aClass[ 1 ] == cClsName } ) ) == 0
// ya se creo la clase
else
__aHCls[ n, 1 ]:=NIL
__aHCls[ n, 2 ]:=NIL
ADEL( __aHCls , n )

endif
oClase:=NIL

return( cClsName )
FWH 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code
xmanuel
Posts: 768
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla
Been thanked: 5 times
Contact:

Re: Migrar xHarbour a Harbour HBClass

Post by xmanuel »

Esto es parte del código de mi librería Eagle1.
Y en esa parte no se hace referencia al método :setReadPadAll()

Code: Select all | Expand


//---------------------------------------------------------------------------//
// Activa la lectura de todos los campos caracter formateados a su tamaño

METHOD SetReadPADAll( lRead ) CLASS TMSDataSet
return( E1SetPadAll( ::hMySQL, lRead ) )

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

 

Y la parte en C

Code: Select all | Expand


//---------------------------------------------------------------------------//
// Activa o desactiva la lectura de cadenas con tamao fijo (PAD) en todas

E1_FUNC( E1SETPADALL )
{
    PE1_DATASET hDS = (PE1_DATASET) hb_parnl( 1 );
    PHB_ITEM iRead = hb_param( 2, HB_IT_LOGICAL );

    if( iRead )
    {
        BOOL bRead = hb_itemGetL( iRead );

        if( !( bRead == hDS->bReadPadAll ) )
        {
            unsigned int uiCol;

            hDS->bReadPadAll = bRead;

            for( uiCol = 0; uiCol < hDS->uiColCount; uiCol++ )
            {
                if( E1_PCOLUMN( hDS, uiCol )->cType == 'C' )
                {
                    E1_PCOLUMN( hDS, uiCol )->GetValue = ( bRead ? E1_GetPADC : E1_GetC );
                }
            }
            hb_retl( !bRead );
        }
    }
    hb_retl( hDS->bReadPadAll );
}

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

 
______________________________________________________________________________
Sevilla - Andalucía
User avatar
Compuin
Posts: 1251
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada
Has thanked: 7 times
Been thanked: 3 times

Re: Migrar xHarbour a Harbour HBClass

Post by Compuin »

El codigo que te puse no usa metodos..pero igual sigue sin funcionar
Last edited by Compuin on Sat Apr 15, 2017 2:46 am, edited 1 time in total.
FWH 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code
User avatar
Compuin
Posts: 1251
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada
Has thanked: 7 times
Been thanked: 3 times

Re: Migrar xHarbour a Harbour HBClass

Post by Compuin »

No funciona...arroja esto

Error description: Error BASE/1004 Message not found: TMY0000000:SETREADPADALL
Args:
[ 1] = O TMY0000000

Stack Calls
===========
Called from: => __ERRRT_SBASE( 0 )
Called from: ../../../tobject.prg => TMY0000000:ERROR( 0 )
Called from: ../../../tobject.prg => (b)HBOBJECT( 0 )
Called from: ../../../tobject.prg => TMY0000000:MSGNOTFOUND( 0 )
Called from: ../../../tobject.prg => TMY0000000:SETREADPADALL( 0 )
FWH 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code
xmanuel
Posts: 768
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla
Been thanked: 5 times
Contact:

Re: Migrar xHarbour a Harbour HBClass

Post by xmanuel »

Si no usas métodos o sea objetos o sea clases no necesitas ese código:
La funcion TMyMSQuery es una meta clase que crea clases especializados en una tabla o SELECT de MySQL.
Y :SetReadPADAll() es un método.
______________________________________________________________________________
Sevilla - Andalucía
User avatar
Compuin
Posts: 1251
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada
Has thanked: 7 times
Been thanked: 3 times

Re: Migrar xHarbour a Harbour HBClass

Post by Compuin »

Y a que se debe que lance el error al cambiar __oDatabase := HBClass():New( cClsName, __CLS_PARAM ( cFromClass ) )por __oDatabase := HBClass():New( cClsName,{ cFromClass } ) ?
FWH 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code
User avatar
Antonio Linares
Site Admin
Posts: 42520
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: Migrar xHarbour a Harbour HBClass

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Compuin
Posts: 1251
Joined: Tue Dec 28, 2010 1:29 pm
Location: Quebec, Canada
Has thanked: 7 times
Been thanked: 3 times

Re: Migrar xHarbour a Harbour HBClass

Post by Compuin »

Segun esto no es posible migrar de xHarbour a Harbour ?
FWH 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code
User avatar
Antonio Linares
Site Admin
Posts: 42520
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 75 times
Contact:

Re: Migrar xHarbour a Harbour HBClass

Post by Antonio Linares »

Lo que debes plantearte es modificar ese código para que no necesite usar esas funciones
regards, saludos

Antonio Linares
www.fivetechsoft.com
Carlos Mora
Posts: 989
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Re: Migrar xHarbour a Harbour HBClass

Post by Carlos Mora »

No creo que sea una cosa 'imposible'. Otra cosa es que si se usan 'internals' del lenguaje, hay que asumir las consecuencias. Como dice Antonio, una de esas consecuencias es por lo que estás pasando: prestaciones que no son de "usuario", como crear clases a bajo nivel, que no son directamente extrapolables de un lenguaje a otro. Para que eso te salga bien tienes que programar a nivel dios (o ser Manu expósito :).

De todas maneras revisando el hilo el problema es que no reconoce el mensaje 'SETREADPADALL', por lo que te recomiendo verifiques en la superclase como está definido ese método. Manu explicó que hace ese método e incluyó el código, por lo que es por donde yo empezaría a buscar.

Un saludo
Saludos
Carlos Mora
http://harbouradvisor.blogspot.com/
StackOverflow http://stackoverflow.com/users/549761/carlos-mora
“If you think education is expensive, try ignorance"
xmanuel
Posts: 768
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla
Been thanked: 5 times
Contact:

Re: Migrar xHarbour a Harbour HBClass

Post by xmanuel »

Carlos me sobrevaloras :D
De cualquier modo Eagle1 funciona tanto con Harbour como con xHarbour...
______________________________________________________________________________
Sevilla - Andalucía
Post Reply