Actualización a 64b y código C

Actualización a 64b y código C

Postby FiveWiDi » Mon Apr 15, 2019 9:37 pm

Hola a todos,

Hace mucho que no me logono en este foro, pero os voy leyendo con ganas.

El caso es que deseo actualizar mi vieja versión de FWH y en mi aplicación hago uso de la maravillosa clase TDbf de Manu Expósito (una versión antigua en PRG).
Esta clase la tengo en las entrañas y por todos lados de la aplicación y uno de los ficheros que usa tiene este código en C:

Code: Select all  Expand view
//----------------------------------------------------------------------------//
//  AUTOR.....: Manuel Exp¢sito Su rez    Soft 4U '1994-2000                  //
//  e-Mail....: expo2001@wanadoo.es                                           //
//  CLASE.....: HBFORCE.C                                                     //
//  FECHA MOD.: 10/11/2000                                                    //
//  VERSION...: 9.00                                                          //
//  PROPOSITO.: Accesos a bajo nivel a la estructura WorkArea de Harbour      //
//----------------------------------------------------------------------------//

//----------------------------------------------------------------------------//
//Para las RDD nativas de Harbour

#include "hbrdddbf.h"
#include "hbapirdd.h"

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

HB_FUNC( DBFHDL )
{
   LPDBFAREA pArea = hb_rddGetCurrentWorkAreaPointer();
   if( pArea )

   // Con la nueva versión de Harbour (9.02), y el cambio del 'valor' hDataFile
   // por pDataFile en la estructura _DBFAREA de HbRddDbf.h, esta función no es
   // correcta y debe cambiarse por hb_retptr().
   //
   // hb_retni( pArea->hDataFile );
   //else
   //   hb_retni( 0 );

      hb_retptr( pArea->pDataFile );
   else
      hb_retptr( 0 );
}

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

HB_FUNC( ISSHARED )
{
   LPDBFAREA pArea = hb_rddGetCurrentWorkAreaPointer();
   if( pArea )
      hb_retl( pArea->fShared );
   else
      hb_retl( HB_FALSE );
}

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

HB_FUNC( ISREADONLY )
{
   LPDBFAREA pArea = hb_rddGetCurrentWorkAreaPointer();
   if( pArea )
      hb_retl( pArea->fReadonly );
   else
      hb_retl( HB_FALSE );
}

//----------------------------------------------------------------------------//
// Para la RDD ADS de Harbour
// Extraido de rddads.h

typedef unsigned long  ADSHANDLE;

typedef struct _ADSAREA_
{
   struct _RDDFUNCS * lprfsHost; /* Virtual method table for this workarea */
   HB_USHORT uiArea;                /* The number assigned to this workarea */
   void * atomAlias;             /* Pointer to the alias symbol for this workarea */
   HB_USHORT uiFieldExtent;         /* Total number of fields allocated */
   HB_USHORT uiFieldCount;          /* Total number of fields used */
   LPFIELD lpFields;             /* Pointer to an array of fields */
   void * lpFieldExtents;        /* Void ptr for additional field properties */
   PHB_ITEM valResult;           /* All purpose result holder */
   HB_BOOL fTop;                    /* TRUE if "top" */
   HB_BOOL fBottom;                 /* TRUE if "bottom" */
   HB_BOOL fBof;                    /* TRUE if "bof" */
   HB_BOOL fEof;                    /* TRUE if "eof" */
   HB_BOOL fFound;                  /* TRUE if "found" */
   DBSCOPEINFO dbsi;             /* Info regarding last LOCATE */
   DBFILTERINFO dbfi;            /* Filter in effect */
   LPDBORDERCONDINFO lpdbOrdCondInfo;
   LPDBRELINFO lpdbRelations;    /* Parent/Child relationships used */
   HB_USHORT uiParents;             /* Number of parents for this area */
   HB_USHORT heap;
   HB_USHORT heapSize;
   HB_USHORT rddID;

   /*
   *  ADS's additions to the workarea structure
   *
   *  Warning: The above section MUST match WORKAREA exactly!  Any
   *  additions to the structure MUST be added below, as in this
   *  example.
   */


   char * szDataFileName;        /* Name of data file */
   HB_USHORT uiHeaderLen;           /* Size of header */
   HB_USHORT uiRecordLen;           /* Size of record */
   HB_ULONG ulRecCount;             /* Total records */
   HB_ULONG ulRecNo;                /* Current record */
   HB_BYTE bYear;                   /* Last update */
   HB_BYTE bMonth;
   HB_BYTE bDay;
   HB_USHORT * pFieldOffset;        /* Pointer to field offset array */
   HB_BYTE * pRecord;               /* Buffer of record data */
   HB_ULONG maxFieldLen;
   HB_BOOL fValidBuffer;            /* State of buffer */
   HB_BOOL fRecordChanged;          /* Record changed */
   HB_BOOL fShared;                 /* Shared file */
   HB_BOOL fReadonly;               /* Read only file */
   HB_BOOL fFLocked;                /* TRUE if file is locked */
   ADSHANDLE hTable;
   ADSHANDLE hOrdCurrent;
   ADSHANDLE hStatement;
} ADSAREA;

typedef ADSAREA * ADSAREAP;

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

HB_FUNC( ADSDBFHDL )
{
   ADSAREAP pArea = hb_rddGetCurrentWorkAreaPointer();
   if( pArea )
      hb_retni( pArea->hTable );
   else
      hb_retni( 0 );
}

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

HB_FUNC( ADSISSHARED )
{
   ADSAREAP pArea = hb_rddGetCurrentWorkAreaPointer();
   if( pArea )
      hb_retl( pArea->fShared );
   else
      hb_retl( HB_FALSE );
}

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

HB_FUNC( ADSISREADONLY )
{
   ADSAREAP pArea = hb_rddGetCurrentWorkAreaPointer();
   if( pArea )
      hb_retl( pArea->fReadonly );
   else
      hb_retl( HB_FALSE );
}

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


El caso es que necesito de una alma caritativa que intente compilar este código con BCC a 64b para ver por donde cruje y que solución se le puede dar.

Si salvo este obstáculo podré evolucionar junto a FWH, si no quedaré atrás con los 32b.

Deseo actualizarme. FWH evoluciona sin prisa pero sin pausa. Me gusta.

Muchas gracias,
Un Saludo
Carlos G.

FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
FiveWiDi
 
Posts: 1060
Joined: Mon Oct 10, 2005 2:38 pm

Re: Actualización a 64b y código C

Postby cnavarro » Tue Apr 16, 2019 1:22 am

Carlos, seguramente será necesario tener los ficheros de encabezado también para realizar la migración, pero al margen de eso, y al ser un software propietario, lo normal es que nuestro querido amigo Manu, podrá realizar esa migración.
De todas formas cuando te decidas a actualizar tu versión, si sigues necesitando nuestra ayuda, ya sabes que puedes contar con ella.
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Actualización a 64b y código C

Postby xmanuel » Sun Apr 21, 2019 5:01 pm

Dalo por hecho...

Sólo te falla ese código o hay más?
______________________________________________________________________________
Sevilla - Andalucía
xmanuel
 
Posts: 756
Joined: Sun Jun 15, 2008 7:47 pm
Location: Sevilla

Re: Actualización a 64b y código C

Postby FiveWiDi » Sun Apr 21, 2019 5:38 pm

xmanuel wrote:Dalo por hecho...

Sólo te falla ese código o hay más?


Hola Manuel,

En c sólo tengo ese código; el resto es substituir el uso de Dolphin por las funciones propias de FWH64 para SQL.

Y ya puestos y como todo avanza, también cambiar el el uso de Barlib de Cayetano (otra joya!) por las funciones de FWH64.

Muchas gracias,
Un Saludo
Carlos G.

FiveWin 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
FiveWiDi
 
Posts: 1060
Joined: Mon Oct 10, 2005 2:38 pm

Re: Actualización a 64b y código C

Postby Antonio Linares » Mon Apr 22, 2019 7:54 am

Carlos,

Estas son las funciones de FWH a usar para migrar tu código en Dolphin:

oConnection := Maria_Connect( cServer, cDataBase, cUser, cPassword )

ó puedes usar el comando equivalente:
Code: Select all  Expand view
#xcommand FWCONNECT <oCn> HOST <cHost>  ;
        [<usr:USER,LANGFOLDER> <cUser> ] ;
        [ PASSWORD <cPassword>] ;
        [ <db:DB,DATABASE> <cDB> ] ;
        [ PORT <nPort> ] [ FLAGS <nFlags> ] ;
        [ CHARSET <chrset> ] [ MESSAGES <msglang> ] [ LOCALE <locale> ]


oRs = oConnection:Query( ... ) es igual

Bienvenido a bordo de nuevo :-)
regards, saludos

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


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 86 guests