FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Actualizaci贸n a 64b y c贸digo C
Posts: 1445
Joined: Mon Oct 10, 2005 02:38 PM
Actualizaci贸n a 64b y c贸digo C
Posted: Mon Apr 15, 2019 09: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 (fw): Select all Collapse
//----------------------------------------------------------------------------//
// 聽AUTOR.....: Manuel Exp垄sito Su聽rez 聽 聽Soft 4U '1994-2000 聽 聽 聽 聽 聽 聽 聽 聽 聽//
// 聽e-Mail....: <!-- e --><a href="mailto:expo2001@wanadoo.es">expo2001@wanadoo.es</a><!-- e --> 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 //
// 聽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 25.12 + Harbour 3.2.0dev (r2502110321), BCC 7.7 Windows 11 Home

Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Actualizaci贸n a 64b y c贸digo C
Posted: Tue Apr 16, 2019 01: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
Posts: 817
Joined: Sun Jun 15, 2008 07:47 PM
Re: Actualizaci贸n a 64b y c贸digo C
Posted: Sun Apr 21, 2019 05:01 PM

Dalo por hecho...

S贸lo te falla ese c贸digo o hay m谩s?

______________________________________________________________________________

Sevilla - Andaluc铆a
Posts: 1445
Joined: Mon Oct 10, 2005 02:38 PM
Re: Actualizaci贸n a 64b y c贸digo C
Posted: Sun Apr 21, 2019 05: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 25.12 + Harbour 3.2.0dev (r2502110321), BCC 7.7 Windows 11 Home

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Actualizaci贸n a 64b y c贸digo C
Posted: Mon Apr 22, 2019 07: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 (fw): Select all Collapse
#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

Continue the discussion