2005-09-23 15:45 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
* changes to synhronize RDD code with xHarbour (state of 23.09.2005)
Many, many thanks to Przemek Czerpak for his work.
This commit is contained in:
@@ -8,6 +8,68 @@
|
||||
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2005-09-23 15:45 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
|
||||
* config/global.cf
|
||||
* include/dbinfo.ch
|
||||
* include/hbapi.h
|
||||
* include/hbapierr.h
|
||||
* include/hbapifs.h
|
||||
* include/hbapirdd.h
|
||||
* include/hbdbf.h
|
||||
* include/hbdbferr.h
|
||||
* include/hbdefs.h
|
||||
* include/hbrddcdx.h
|
||||
* include/hbrdddbf.h
|
||||
* include/hbrdddbt.h
|
||||
* include/hbrdddel.h
|
||||
* include/hbrddfpt.h
|
||||
* include/hbrddntx.h
|
||||
* include/hbrddsdf.h
|
||||
* include/hbrddwrk.h
|
||||
* include/hbvm.h
|
||||
* source/common/hbstr.c
|
||||
* source/rdd/Makefile
|
||||
* source/rdd/dbcmd.c
|
||||
* source/rdd/dbf1.c
|
||||
* source/rdd/dbtotal.prg
|
||||
* source/rdd/delim0.prg
|
||||
* source/rdd/delim1.c
|
||||
* source/rdd/rddsys.prg
|
||||
* source/rdd/sdf0.prg
|
||||
* source/rdd/sdf1.c
|
||||
* source/rdd/workarea.c
|
||||
* source/rdd/dbfcdx/Makefile
|
||||
* source/rdd/dbfcdx/dbfcdx0.prg
|
||||
* source/rdd/dbfcdx/dbfcdx1.c
|
||||
* source/rdd/dbfdbt/Makefile
|
||||
* source/rdd/dbfdbt/dbfdbt1.c
|
||||
* source/rdd/dbffpt/Makefile
|
||||
* source/rdd/dbffpt/dbffpt0.prg
|
||||
* source/rdd/dbffpt/dbffpt1.c
|
||||
* source/rdd/dbfntx/Makefile
|
||||
* source/rdd/dbfntx/dbfntx0.prg
|
||||
* source/rdd/dbfntx/dbfntx1.c
|
||||
* source/rdd/nulsys/nulsys.prg
|
||||
* source/rtl/errorapi.c
|
||||
* source/rtl/filesys.c
|
||||
* source/vm/dynsym.c
|
||||
* source/vm/extend.c
|
||||
* source/vm/itemapi.c
|
||||
* source/vm/hvm.c
|
||||
+ include/hbsxfunc.h
|
||||
+ source/rdd/dbfcdx/sixcdx0.prg
|
||||
+ source/rdd/dbfcdx/sixcdx1.c
|
||||
+ source/rdd/hbsix/Makefile
|
||||
+ source/rdd/hbsix/sxcompr.c
|
||||
+ source/rdd/hbsix/sxcrypt.c
|
||||
+ source/rdd/hbsix/sxdate.c
|
||||
+ source/rdd/hsx/Makefile
|
||||
+ source/rdd/hsx/cftsfunc.c
|
||||
+ source/rdd/hsx/hsx.c
|
||||
* changes to synhronize RDD code with xHarbour (state of 23.09.2005)
|
||||
Many, many thanks to Przemek Czerpak for his work.
|
||||
|
||||
|
||||
2005-09-20 10:16 UTC+0100 Viktor Szakats <viktor.szakats@syenar.hu>
|
||||
|
||||
* source/rtl/tget.prg
|
||||
|
||||
@@ -11,6 +11,8 @@ HB_DB_DRIVERS=\
|
||||
dbfcdx \
|
||||
dbffpt \
|
||||
dbfdbt \
|
||||
hbsix \
|
||||
hsx \
|
||||
|
||||
ifeq ($(HB_BIN_COMPILE),)
|
||||
HB_BIN_COMPILE := $(TOP)$(ROOT)source/compiler/$(HB_ARCH)
|
||||
|
||||
@@ -53,6 +53,54 @@
|
||||
#ifndef HB_DBINFO_CH_
|
||||
#define HB_DBINFO_CH_
|
||||
|
||||
/*
|
||||
Constants for SELF_RDDINFO ()
|
||||
*/
|
||||
|
||||
#define RDDI_ISDBF 1 /* Does this RDD support DBFs? */
|
||||
#define RDDI_CANPUTREC 2 /* Can this RDD Put Records? */
|
||||
#define RDDI_DELIMITER 3 /* The field delimiter (as a string) */
|
||||
#define RDDI_SEPARATOR 4 /* The record separator (as a string) */
|
||||
|
||||
#define RDDI_TABLEEXT 5 /* Default data file's file extension */
|
||||
#define RDDI_MEMOEXT 6 /* Default memo file's file extension */
|
||||
#define RDDI_ORDBAGEXT 7 /* Default multi tag index's file extension */
|
||||
#define RDDI_ORDEREXT 8 /* default single tag index's file extension */
|
||||
#define RDDI_ORDSTRUCTEXT 9 /* default single tag index's file extension */
|
||||
|
||||
#define RDDI_LOCAL 10 /* Local file access? */
|
||||
#define RDDI_REMOTE 11 /* Remote table access? */
|
||||
#define RDDI_CONNECTION 12 /* Get/Set default connection */
|
||||
#define RDDI_TABLETYPE 13 /* Type of table file */
|
||||
#define RDDI_MEMOTYPE 14 /* Type of MEMO file: DBT, SMT, FPT(FP,SIX3,FLEXIII) */
|
||||
#define RDDI_LARGEFILE 15 /* Is large file size (>=4GB) supported */
|
||||
#define RDDI_LOCKSCHEME 16 /* Locking scheme used by RDD */
|
||||
#define RDDI_RECORDMAP 17 /* Does RDD support record map functionality? */
|
||||
#define RDDI_ENCRYPTION 18 /* Does RDD support encryption */
|
||||
#define RDDI_TRIGGERS 19 /* Get/Set default trigger function */
|
||||
#define RDDI_AUTOLOCK 20 /* automatic locking on update */
|
||||
|
||||
/* index parameters */
|
||||
#define RDDI_STRUCTORD 21 /* Are structural indexes supported */
|
||||
#define RDDI_STRICTREAD 22 /* Flag for avoiding RDD hierarchy and using a bigger buffer when indexing */
|
||||
#define RDDI_STRICTSTRUCT 23 /* Flag for strict structural order checking */
|
||||
#define RDDI_OPTIMIZE 24 /* Flag for whether to use query optimization */
|
||||
#define RDDI_FORCEOPT 25 /* Flag for forcing linear optimization */
|
||||
#define RDDI_AUTOOPEN 26 /* Flag for automatically opening structural indexes */
|
||||
#define RDDI_AUTOORDER 27 /* When a structural index is opened, the order to be set */
|
||||
#define RDDI_AUTOSHARE 28 /* When a network is detected, open the index shared, otherwise open exclusively */
|
||||
#define RDDI_MULTITAG 29 /* Does RDD support multi tag in index file */
|
||||
#define RDDI_SORTRECNO 30 /* Is record number part of key in sorting */
|
||||
#define RDDI_MULTIKEY 31 /* Does custom orders support repeated keys? */
|
||||
|
||||
/* memo parameters */
|
||||
#define RDDI_MEMOBLOCKSIZE 32 /* Memo File's block size */
|
||||
#define RDDI_MEMOVERSION 33 /* sub version of memo file */
|
||||
#define RDDI_MEMOGCTYPE 34 /* type of garbage collector used by GC */
|
||||
#define RDDI_MEMOREADLOCK 35 /* use read lock in memo file access */
|
||||
#define RDDI_MEMOREUSE 36 /* reuse free space on write */
|
||||
|
||||
|
||||
/*
|
||||
Constants for SELF_ORDINFO ()
|
||||
*/
|
||||
@@ -90,13 +138,14 @@
|
||||
#define DBOI_SCOPEBOTTOM 40 /* Get or Set the scope botto */
|
||||
#define DBOI_SCOPETOPCLEAR 41 /* Clear the scope top */
|
||||
#define DBOI_SCOPEBOTTOMCLEAR 42 /* Clear the scope bottom */
|
||||
|
||||
#define DBOI_CUSTOM 45 /* Is this a Custom Index? */
|
||||
#define DBOI_SKIPUNIQUE 46 /* Was a skip to adjacent unique Key successful? */
|
||||
|
||||
#define DBOI_KEYSINCLUDED 50 /* Number of keys in the index order */
|
||||
/* key numbers and counts */
|
||||
#define DBOI_KEYGOTO DBOI_POSITION
|
||||
#define DBOI_KEYGOTORAW DBOI_KEYNORAW
|
||||
#define DBOI_KEYNO DBOI_POSITION
|
||||
#define DBOI_KEYNORAW 51 /* The key number disregarding filters */
|
||||
#define DBOI_KEYCOUNTRAW 52 /* The key count disregarding filter */
|
||||
|
||||
@@ -110,7 +159,7 @@
|
||||
#define DBOI_AUTOORDER 63 /* When a structural index is opened, the order to be set */
|
||||
#define DBOI_AUTOSHARE 64 /* When a network is detected, open the index shared, otherwise open exclusively */
|
||||
|
||||
/* Harbour extensions */
|
||||
/* xHarbour extensions */
|
||||
#define DBOI_SKIPEVAL 100 /* skip while code block doesn't return TRUE */
|
||||
#define DBOI_SKIPEVALBACK 101 /* skip backward while code block doesn't return TRUE */
|
||||
#define DBOI_SKIPREGEX 102 /* skip while regular expression on index key doesn't return TRUE */
|
||||
@@ -118,6 +167,34 @@
|
||||
#define DBOI_SKIPWILD 104 /* skip while while comparison with given pattern with wildcards doesn't return TRUE */
|
||||
#define DBOI_SKIPWILDBACK 105 /* skip backward while comparison with given pattern with wildcards doesn't return TRUE */
|
||||
#define DBOI_SCOPEEVAL 106 /* skip through index evaluating given C function */
|
||||
#define DBOI_FINDREC 107 /* find given record in a Tag beginning from TOP */
|
||||
#define DBOI_FINDRECCONT 108 /* find given record in a Tag beginning from current position */
|
||||
#define DBOI_SCOPESET 109 /* set both scopes */
|
||||
#define DBOI_SCOPECLEAR 110 /* clear both scopes */
|
||||
|
||||
#define DBOI_BAGCOUNT 111 /* number of open order bags */
|
||||
#define DBOI_BAGNUMBER 112 /* bag position in bag list */
|
||||
#define DBOI_BAGORDER 113 /* number of first order in a bag */
|
||||
|
||||
#define DBOI_ISMULTITAG 114 /* does RDD support multi tag in index file */
|
||||
#define DBOI_ISSORTRECNO 115 /* is record number part of key in sorting */
|
||||
#define DBOI_LARGEFILE 116 /* is large file size (>=4GB) supported */
|
||||
#define DBOI_TEMPLATE 117 /* order with free user keys */
|
||||
#define DBOI_MULTIKEY 118 /* custom order with multikeys */
|
||||
#define DBOI_CHGONLY 119 /* update only existing keys */
|
||||
#define DBOI_PARTIAL 120 /* is index partially updated */
|
||||
#define DBOI_SHARED 121 /* is index open in shared mode */
|
||||
#define DBOI_ISREADONLY 122 /* is index open in readonly mode */
|
||||
#define DBOI_READLOCK 123 /* get/set index read lock */
|
||||
#define DBOI_WRITELOCK 124 /* get/set index write lock */
|
||||
#define DBOI_UPDATECOUNTER 125 /* get/set update index counter */
|
||||
|
||||
#define DBOI_EVALSTEP 126 /* eval step (EVERY) used in index command */
|
||||
#define DBOI_ISREINDEX 127 /* Is reindex in process */
|
||||
#define DBOI_I_BAGNAME 128 /* created index name */
|
||||
#define DBOI_I_TAGNAME 129 /* created tag name */
|
||||
|
||||
#define DBOI_RELKEYPOS 130 /* get/set relative key position (in range 0 - 1) */
|
||||
|
||||
/* Return values for DBOI_OPTLEVEL */
|
||||
#define DBOI_OPTIMIZED_NONE 0
|
||||
@@ -130,9 +207,10 @@
|
||||
#define DBRI_RECSIZE 3
|
||||
#define DBRI_RECNO 4
|
||||
#define DBRI_UPDATED 5
|
||||
#define DBRI_RAWRECORD 6
|
||||
#define DBRI_RAWMEMOS 7
|
||||
#define DBRI_RAWDATA 8
|
||||
#define DBRI_ENCRYPTED 6
|
||||
#define DBRI_RAWRECORD 7
|
||||
#define DBRI_RAWMEMOS 8
|
||||
#define DBRI_RAWDATA 9
|
||||
|
||||
/* constants for some SCOPED DBOI_* parameter */
|
||||
#define DBRMI_FUNCTION 1
|
||||
@@ -179,8 +257,24 @@
|
||||
#define DBI_LOCKSCHEME 128 /* Locking scheme used by RDD */
|
||||
#define DBI_ISREADONLY 129 /* Was the file opened readonly? */
|
||||
#define DBI_ROLLBACK 130 /* Rollback changes made to current record */
|
||||
#define DBI_PASSWORD 131 /* Workarea password */
|
||||
#define DBI_ISENCRYPTED 132 /* The database is encrypted */
|
||||
#define DBI_MEMOTYPE 133 /* Type of MEMO file: DBT, SMT, FPT */
|
||||
#define DBI_SEPARATOR 134 /* The record separator (as a string) */
|
||||
#define DBI_MEMOVERSION 135 /* sub version of memo file */
|
||||
#define DBI_TABLETYPE 136 /* Type of table file */
|
||||
|
||||
#define DBI_USER 1000 /* User-defined DBI_ constants */
|
||||
/* RECORD MAP (RM) support */
|
||||
#define DBI_RM_SUPPORTED 150 /* has WA RDD record map support? */
|
||||
#define DBI_RM_CREATE 151 /* create new empty work area record map */
|
||||
#define DBI_RM_REMOVE 152 /* remove active work area record map */
|
||||
#define DBI_RM_CLEAR 153 /* remove all records from WA record map */
|
||||
#define DBI_RM_FILL 154 /* add all records to WA record map */
|
||||
#define DBI_RM_ADD 155 /* add record to work area record map */
|
||||
#define DBI_RM_DROP 156 /* remove record from work area record map */
|
||||
#define DBI_RM_TEST 157 /* test if record is set in WA record map */
|
||||
#define DBI_RM_COUNT 158 /* number of records set in record map */
|
||||
#define DBI_RM_HANDLE 159 /* get/set record map filter handle */
|
||||
|
||||
/* BLOB support - definitions for internal use by BLOB.CH */
|
||||
#define DBI_BLOB_DIRECT_EXPORT 201
|
||||
@@ -199,6 +293,9 @@
|
||||
#define DBI_BLOB_OFFSET 212
|
||||
#define DBI_BLOB_RECOVER 213
|
||||
|
||||
#define DBI_USER 1000 /* User-defined DBI_ constants */
|
||||
|
||||
/* extended dbFieldInfo() actions */
|
||||
#define DBS_BLOB_GET 201 /* This is internal definition */
|
||||
#define DBS_BLOB_LEN 202
|
||||
#define DBS_BLOB_OFFSET 203
|
||||
@@ -208,4 +305,42 @@
|
||||
#define BLOB_EXPORT_APPEND 1
|
||||
#define BLOB_EXPORT_OVERWRITE 0
|
||||
|
||||
#define BLOB_IMPORT_COMPRESS 1
|
||||
#define BLOB_IMPORT_ENCRYPT 2
|
||||
|
||||
#define FILEGET_APPEND BLOB_EXPORT_APPEND
|
||||
#define FILEGET_OVERWRITE BLOB_EXPORT_OVERWRITE
|
||||
|
||||
#define FILEPUT_COMPRESS BLOB_IMPORT_COMPRESS
|
||||
#define FILEPUT_ENCRYPT BLOB_IMPORT_ENCRYPT
|
||||
|
||||
/* DBF TYPES */
|
||||
#define DB_DBF_STD 0
|
||||
#define DB_DBF_VFP 1
|
||||
|
||||
/* MEMO TYPES */
|
||||
#define DB_MEMO_NONE 0
|
||||
#define DB_MEMO_DBT 1
|
||||
#define DB_MEMO_FPT 2
|
||||
#define DB_MEMO_SMT 3
|
||||
|
||||
/* MEMO EXTENDED TYPES */
|
||||
#define DB_MEMOVER_STD 1
|
||||
#define DB_MEMOVER_SIX 2
|
||||
#define DB_MEMOVER_FLEX 3
|
||||
#define DB_MEMOVER_CLIP 4
|
||||
|
||||
/* ENCRYPTION TYPE */
|
||||
#define DB_CRYPT_NONE 0
|
||||
#define DB_CRYPT_SIX 1
|
||||
|
||||
/* LOCK SCHEMES */
|
||||
#define DB_DBFLOCK_DEFAULT 0
|
||||
#define DB_DBFLOCK_CLIP 1
|
||||
#define DB_DBFLOCK_CL53 2
|
||||
#define DB_DBFLOCK_VFP 3
|
||||
#define DB_DBFLOCK_CL53EXT 4
|
||||
#define DB_DBFLOCK_XHB64 5
|
||||
|
||||
|
||||
#endif /* HB_DBINFO_CH_ */
|
||||
|
||||
@@ -104,6 +104,7 @@ HB_EXTERN_BEGIN
|
||||
#define HB_IS_MEMVAR( p ) HB_IS_OF_TYPE( p, HB_IT_MEMVAR )
|
||||
#define HB_IS_POINTER( p ) HB_IS_OF_TYPE( p, HB_IT_POINTER )
|
||||
#define HB_IS_NUMERIC( p ) ( ( p )->type & HB_IT_NUMERIC )
|
||||
#define HB_IS_NUMBER( p ) ( ( p )->type & HB_IT_NUMERIC )
|
||||
#define HB_IS_NUMINT( p ) ( ( p )->type & HB_IT_NUMINT )
|
||||
#define HB_IS_COMPLEX( p ) ( ( p )->type & HB_IT_COMPLEX )
|
||||
#define HB_IS_BADITEM( p ) ( ( p )->type & HB_IT_COMPLEX && ( p )->type & ~( HB_IT_COMPLEX | HB_IT_MEMOFLAG ) )
|
||||
@@ -313,10 +314,12 @@ extern HB_SYMB hb_symEval;
|
||||
|
||||
/* Extend API */
|
||||
extern char HB_EXPORT * hb_parc( int iParam, ... ); /* retrieve a string parameter */
|
||||
extern char HB_EXPORT * hb_parcx( int iParam, ... ); /* retrieve a string parameter */
|
||||
extern ULONG HB_EXPORT hb_parclen( int iParam, ... ); /* retrieve a string parameter length */
|
||||
extern ULONG HB_EXPORT hb_parcsiz( int iParam, ... ); /* retrieve a by-reference string parameter length, including terminator */
|
||||
extern char HB_EXPORT * hb_pards( int iParam, ... ); /* retrieve a date as a string yyyymmdd */
|
||||
extern char HB_EXPORT * hb_pardsbuff( char * szDate, int iParam, ... ); /* retrieve a date as a string yyyymmdd */
|
||||
extern LONG HB_EXPORT hb_pardl( int iParam, ... ); /* retrieve a date as a LONG NUMBER */
|
||||
extern ULONG HB_EXPORT hb_parinfa( int iParamNum, ULONG uiArrayIndex ); /* retrieve length or element type of an array parameter */
|
||||
extern int HB_EXPORT hb_parinfo( int iParam ); /* Determine the param count or data type */
|
||||
extern int HB_EXPORT hb_parl( int iParam, ... ); /* retrieve a logical parameter as an int */
|
||||
@@ -352,6 +355,7 @@ extern LONGLONG HB_EXPORT hb_parnll( int iParam, ... ); /* retrieve a numeric
|
||||
#define hb_retc_const( szText ) hb_itemPutCConst( &hb_stack.Return, szText )
|
||||
#define hb_retclen( szText, ulLen ) hb_itemPutCL( &hb_stack.Return, szText, ulLen )
|
||||
#define hb_retclen_buffer( szText, ulLen ) hb_itemPutCPtr( &hb_stack.Return, szText, ulLen )
|
||||
#define hb_retcAdopt( szText ) hb_itemPutCPtr( &hb_stack.Return, (szText), strlen( szText ) )
|
||||
#define hb_retds( szDate ) hb_itemPutDS( &hb_stack.Return, szDate )
|
||||
#define hb_retd( lYear, lMonth, lDay ) hb_itemPutD( &hb_stack.Return, lYear, lMonth, lDay )
|
||||
#define hb_retdl( lJulian ) hb_itemPutDL( &hb_stack.Return, lJulian )
|
||||
@@ -379,6 +383,7 @@ extern void HB_EXPORT hb_retc_buffer( char * szText ); /* sames as above, but
|
||||
extern void HB_EXPORT hb_retc_const( char * szText ); /* returns a string as a pcode based string */
|
||||
extern void HB_EXPORT hb_retclen( char * szText, ULONG ulLen ); /* returns a string with a specific length */
|
||||
extern void HB_EXPORT hb_retclen_buffer( char * szText, ULONG ulLen ); /* sames as above, but accepts an allocated buffer */
|
||||
extern void HB_EXPORT hb_retcAdopt( char * szText ); /* adopts a pointer to a string as the value of an item */
|
||||
extern void HB_EXPORT hb_retds( char * szDate ); /* returns a date, must use yyyymmdd format */
|
||||
extern void HB_EXPORT hb_retd( int iYear, int iMonth, int iDay ); /* returns a date */
|
||||
extern void HB_EXPORT hb_retdl( long lJulian ); /* returns a long value as a julian date */
|
||||
@@ -444,6 +449,7 @@ extern BOOL HB_EXPORT hb_arrayNew( PHB_ITEM pItem, ULONG ulLen ); /* creat
|
||||
extern ULONG HB_EXPORT hb_arrayLen( PHB_ITEM pArray ); /* retrives the array len */
|
||||
extern BOOL HB_EXPORT hb_arrayIsObject( PHB_ITEM pArray ); /* retrives if the array is an object */
|
||||
extern BOOL HB_EXPORT hb_arrayAdd( PHB_ITEM pArray, PHB_ITEM pItemValue ); /* add a new item to the end of an array item */
|
||||
extern BOOL HB_EXPORT hb_arrayAddForward( PHB_ITEM pArray, PHB_ITEM pValue ); /* add a new item to the end of an array item with no incrementing of reference counters */
|
||||
extern BOOL HB_EXPORT hb_arrayIns( PHB_ITEM pArray, ULONG ulIndex ); /* insert a nil item into an array, without changing the length */
|
||||
extern BOOL HB_EXPORT hb_arrayDel( PHB_ITEM pArray, ULONG ulIndex ); /* delete an array item, without changing length */
|
||||
extern BOOL HB_EXPORT hb_arraySize( PHB_ITEM pArray, ULONG ulLen ); /* sets the array total length */
|
||||
@@ -497,6 +503,7 @@ extern char * hb_strUpper( char * szText, ULONG ulLen ); /* convert an existin
|
||||
extern char * hb_strLower( char * szText, ULONG ulLen ); /* convert an existing string buffer to lower case */
|
||||
extern char * hb_strncpy( char * pDest, const char * pSource, ULONG ulLen ); /* copy at most ulLen bytes from string buffer to another buffer and _always_ set 0 in destin buffer */
|
||||
extern char * hb_strncat( char * pDest, const char * pSource, ULONG ulLen ); /* copy at most ulLen-strlen(pDest) bytes from string buffer to another buffer and _always_ set 0 in destin buffer */
|
||||
extern char * hb_strndup( const char * pszText, ULONG ulLen );
|
||||
extern char * hb_strncpyTrim( char * pDest, const char * pSource, ULONG ulLen );
|
||||
extern char * hb_strncpyUpper( char * pDest, const char * pSource, ULONG ulLen ); /* copy an existing string buffer to another buffer, as upper case */
|
||||
extern char * hb_strncpyUpperTrim( char * pDest, const char * pSource, ULONG ulLen );
|
||||
@@ -507,6 +514,8 @@ extern BOOL hb_compStrToNum( const char* szNum, HB_LONG * plVal, double * pd
|
||||
extern BOOL hb_valStrnToNum( const char* szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal, int * piDec, int * piWidth );
|
||||
extern BOOL hb_strToNum( const char* szNum, HB_LONG * plVal, double * pdVal ); /* converts string to number, returns TRUE if results is double */
|
||||
extern BOOL hb_strnToNum( const char* szNum, ULONG ulLen, HB_LONG * plVal, double * pdVal ); /* converts string to number, returns TRUE if results is double */
|
||||
extern char * hb_xstrcat( char *dest, const char *src, ... ); /* Concatenates multiple strings into a single result */
|
||||
extern char * hb_xstrcpy( char *szDest, const char *szSrc, ...); /* Concatenates multiple strings into a single result */
|
||||
|
||||
extern double hb_numRound( double dResult, int iDec ); /* round a number to a specific number of digits */
|
||||
extern double hb_numInt( double dNum ); /* take the integer part of the number */
|
||||
@@ -526,6 +535,7 @@ extern USHORT hb_objGetClass( PHB_ITEM pItem );
|
||||
|
||||
/* dynamic symbol table management */
|
||||
extern PHB_DYNS hb_dynsymGet( char * szName ); /* finds and creates a dynamic symbol if not found */
|
||||
extern PHB_DYNS hb_dynsymGetCase( char * szName ); /* finds and creates a dynamic symbol if not found - case sensitive */
|
||||
extern PHB_DYNS hb_dynsymNew( PHB_SYMB pSymbol ); /* creates a new dynamic symbol based on a local one */
|
||||
extern PHB_DYNS hb_dynsymFind( char * szName ); /* finds a dynamic symbol */
|
||||
extern PHB_DYNS hb_dynsymFindName( char * szName ); /* converts to uppercase and finds a dynamic symbol */
|
||||
|
||||
@@ -143,12 +143,15 @@ extern PHB_ITEM hb_errRT_New_Subst( USHORT uiSeverity, char * szSubSystem,
|
||||
USHORT uiOsCode,
|
||||
USHORT uiFlags );
|
||||
|
||||
extern PHB_ITEM hb_errRT_SubstParams( char *szSubSystem, ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation );
|
||||
|
||||
extern USHORT hb_errRT_BASE ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, ULONG ulArgCount, ... );
|
||||
extern USHORT hb_errRT_BASE_Ext1 ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOsCode, USHORT uiFlags, ULONG ulArgCount, ... );
|
||||
extern PHB_ITEM hb_errRT_BASE_Subst ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, ULONG ulArgCount, ... );
|
||||
extern void hb_errRT_BASE_SubstR ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, ULONG ulArgCount, ... );
|
||||
extern USHORT hb_errRT_TERM ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOSCode, USHORT uiFlags );
|
||||
extern USHORT hb_errRT_DBCMD ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation );
|
||||
extern USHORT hb_errRT_DBCMD_Ext ( ULONG ulGenCode, ULONG ulSubCode, const char * szDescription, const char * szOperation, USHORT uiFlags );
|
||||
extern USHORT hb_errRT_TOOLS ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation );
|
||||
|
||||
extern void hb_errInternal ( ULONG ulIntCode, char * szText, char * szPar1, char * szPar2 );
|
||||
|
||||
@@ -81,9 +81,14 @@ typedef int FHANDLE;
|
||||
/* Extended file open mode flags */
|
||||
#define FXO_TRUNCATE 0x0100 /* Create (truncate if exists) */
|
||||
#define FXO_APPEND 0x0200 /* Create (append if exists) */
|
||||
#define FXO_UNIQUE 0x0400 /* Create unique file FO_EXCL ??? */
|
||||
#define FXO_FORCEEXT 0x0800 /* Force default extension */
|
||||
#define FXO_DEFAULTS 0x1000 /* Use SET command defaults */
|
||||
#define FXO_DEVICERAW 0x2000 /* Open devices in raw mode */
|
||||
/* xHarbour extension */
|
||||
#define FXO_SHARELOCK 0x4000 /* emulate DOS SH_DENY* mode in POSIX OS */
|
||||
#define FXO_COPYNAME 0x8000 /* copy final szPath into pFilename */
|
||||
|
||||
|
||||
/* File attributes flags */
|
||||
#define HB_FA_ALL 0
|
||||
@@ -145,10 +150,13 @@ extern FHANDLE HB_EXPORT hb_fsPOpen ( BYTE * pFilename, BYTE * pMode );
|
||||
#define hb_fsFLock( h, s, l ) hb_fsLock( h, s, l, FL_LOCK )
|
||||
#define hb_fsFUnlock( h, s, l ) hb_fsLock( h, s, l, FL_UNLOCK )
|
||||
|
||||
#define HB_MAX_DRIVE_LENGTH 10
|
||||
#define HB_MAX_FILE_EXT 10
|
||||
|
||||
/* Filename support */
|
||||
typedef struct
|
||||
{
|
||||
char szBuffer[ _POSIX_PATH_MAX + 3 + 10 ]; /* TOFIX: +10 is for the drive letter support, and should be changed to some manifest constant */
|
||||
char szBuffer[ _POSIX_PATH_MAX + HB_MAX_DRIVE_LENGTH + HB_MAX_FILE_EXT + 1 ]; /* TOFIX: +10 is for the drive letter support, and should be changed to some manifest constant */
|
||||
char * szPath;
|
||||
char * szName;
|
||||
char * szExtension;
|
||||
@@ -167,7 +175,7 @@ typedef struct _HB_PATHNAMES
|
||||
|
||||
extern void hb_fsAddSearchPath( char * szPath, HB_PATHNAMES * * pSearchList );
|
||||
|
||||
extern BOOL hb_spFile( BYTE * pFilename, BYTE RetPath[ _POSIX_PATH_MAX + 3 + 10 ] );
|
||||
extern BOOL hb_spFile( BYTE * pFilename, BYTE RetPath[ _POSIX_PATH_MAX + HB_MAX_DRIVE_LENGTH + HB_MAX_FILE_EXT + 1 ] );
|
||||
extern FHANDLE hb_spOpen( BYTE * pFilename, USHORT uiFlags );
|
||||
extern FHANDLE hb_spCreate( BYTE * pFilename, USHORT uiAttr );
|
||||
extern FHANDLE hb_spCreateEx( BYTE * pFilename, USHORT uiAttr, USHORT uiFlags );
|
||||
|
||||
@@ -115,6 +115,7 @@ extern PHB_ITEM hb_itemPutNLLen ( PHB_ITEM pItem, long lNumber, int iWidth );
|
||||
extern PHB_ITEM hb_itemPutPtr ( PHB_ITEM pItem, void * pValue );
|
||||
extern BOOL hb_itemRelease ( PHB_ITEM pItem );
|
||||
extern PHB_ITEM hb_itemReturn ( PHB_ITEM pItem );
|
||||
extern PHB_ITEM hb_itemReturnForward( PHB_ITEM pItem );
|
||||
extern ULONG hb_itemSize ( PHB_ITEM pItem );
|
||||
extern USHORT hb_itemType ( PHB_ITEM pItem );
|
||||
extern char * hb_itemTypeStr ( PHB_ITEM pItem );
|
||||
@@ -129,6 +130,7 @@ extern PHB_ITEM hb_itemPutNLLLen( PHB_ITEM pItem, LONGLONG lNumber, int iWidth
|
||||
extern PHB_ITEM hb_itemParamPtr ( USHORT uiParam, int iMask );
|
||||
extern int hb_itemStrCmp ( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ); /* our string compare */
|
||||
extern void hb_itemCopy ( PHB_ITEM pDest, PHB_ITEM pSource ); /* copies an item to one place to another respecting its containts */
|
||||
extern void hb_itemForwardValue( PHB_ITEM pDest, PHB_ITEM pSource ); /* copies the value of an item without incrementing of reference counters */
|
||||
extern void hb_itemMove ( PHB_ITEM pDest, PHB_ITEM pSource );
|
||||
extern void hb_itemClear ( PHB_ITEM pItem );
|
||||
extern PHB_ITEM hb_itemUnRef ( PHB_ITEM pItem ); /* de-references passed variable */
|
||||
|
||||
@@ -59,24 +59,33 @@
|
||||
|
||||
HB_EXTERN_BEGIN
|
||||
|
||||
#define HARBOUR_MAX_RDD_DRIVERNAME_LENGTH 32
|
||||
#define HARBOUR_MAX_RDD_ALIAS_LENGTH 32
|
||||
#define HARBOUR_MAX_RDD_DRIVERNAME_LENGTH 32
|
||||
|
||||
#ifndef HARBOUR_MAX_RDD_ALIAS_LENGTH
|
||||
#define HARBOUR_MAX_RDD_ALIAS_LENGTH 32
|
||||
#endif
|
||||
|
||||
/* #define HARBOUR_MAX_RDD_FIELDNAME_LENGTH 32 */
|
||||
#define HARBOUR_MAX_RDD_AREA_NUM 65535
|
||||
|
||||
#define HARBOUR_MAX_RDD_RELTEXT_LENGTH 256
|
||||
|
||||
/* RDD virtual machine integration functions */
|
||||
|
||||
extern USHORT hb_rddInsertAreaNode( char *szDriver );
|
||||
extern USHORT hb_rddGetCurrentFieldPos( char * szName );
|
||||
extern int hb_rddGetCurrentWorkAreaNumber( void );
|
||||
void * hb_rddGetCurrentWorkAreaPointer( void );
|
||||
extern ERRCODE hb_rddSelectWorkAreaAlias( char * szAlias );
|
||||
extern ERRCODE hb_rddSelectWorkAreaNumber( int iArea );
|
||||
extern ERRCODE hb_rddSelectWorkAreaSymbol( PHB_SYMB pSymAlias );
|
||||
extern ERRCODE hb_rddGetFieldValue( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol );
|
||||
extern ERRCODE hb_rddPutFieldValue( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol );
|
||||
extern ERRCODE hb_rddFieldGet( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol );
|
||||
extern ERRCODE hb_rddFieldPut( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol );
|
||||
extern void hb_rddShutDown( void );
|
||||
extern HB_EXPORT USHORT hb_rddInsertAreaNode( char *szDriver );
|
||||
extern HB_EXPORT USHORT hb_rddGetCurrentFieldPos( char * szName );
|
||||
extern HB_EXPORT void * hb_rddAllocWorkAreaAlias( char * szAlias, int iArea );
|
||||
extern HB_EXPORT int hb_rddGetCurrentWorkAreaNumber( void );
|
||||
extern HB_EXPORT void * hb_rddGetCurrentWorkAreaPointer( void );
|
||||
extern HB_EXPORT ERRCODE hb_rddSelectWorkAreaAlias( char * szAlias );
|
||||
extern HB_EXPORT ERRCODE hb_rddSelectWorkAreaNumber( int iArea );
|
||||
extern HB_EXPORT ERRCODE hb_rddSelectWorkAreaSymbol( PHB_SYMB pSymAlias );
|
||||
extern HB_EXPORT ERRCODE hb_rddGetFieldValue( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol );
|
||||
extern HB_EXPORT ERRCODE hb_rddPutFieldValue( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol );
|
||||
extern HB_EXPORT ERRCODE hb_rddFieldGet( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol );
|
||||
extern HB_EXPORT ERRCODE hb_rddFieldPut( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol );
|
||||
extern HB_EXPORT void hb_rddShutDown( void );
|
||||
extern HB_EXPORT void hb_rddReleaseCurrentArea( void );
|
||||
|
||||
|
||||
|
||||
@@ -169,6 +178,7 @@ typedef struct
|
||||
BOOL fShared; /* Share mode of the data store */
|
||||
BOOL fReadonly; /* Readonly mode of the data store */
|
||||
BYTE * cdpId; /* Id of a codepage */
|
||||
ULONG ulConnection; /* connection handler for RDDs which support it */
|
||||
void * lpdbHeader; /* Pointer to a header of the data store */
|
||||
} DBOPENINFO;
|
||||
|
||||
@@ -191,16 +201,21 @@ typedef struct _DBORDERCONDINFO
|
||||
PHB_ITEM itmCobWhile;
|
||||
PHB_ITEM itmCobEval;
|
||||
LONG lStep;
|
||||
LONG lStartRecno;
|
||||
PHB_ITEM itmStartRecID;
|
||||
LONG lNextCount;
|
||||
LONG lRecno;
|
||||
PHB_ITEM itmRecID;
|
||||
BOOL fRest;
|
||||
BOOL fDescending;
|
||||
BOOL fScoped;
|
||||
BOOL fAll;
|
||||
BOOL fAdditive;
|
||||
BOOL fUseCurrent;
|
||||
BOOL fCustom;
|
||||
BOOL fNoOptimize;
|
||||
BOOL fCompound;
|
||||
BOOL fUseFilter;
|
||||
BOOL fTemporary;
|
||||
BOOL fExclusive;
|
||||
void * lpvCargo;
|
||||
} DBORDERCONDINFO;
|
||||
|
||||
@@ -262,18 +277,19 @@ typedef struct
|
||||
PHB_ITEM itmCobWhile; /* Code Block representation of a WHILE clause */
|
||||
PHB_ITEM lpstrWhile; /* String representation of a WHILE clause */
|
||||
PHB_ITEM lNext; /* NEXT record */
|
||||
PHB_ITEM itmRecID;
|
||||
PHB_ITEM itmRecID; /* single record ID */
|
||||
PHB_ITEM fRest; /* TRUE if start from the current record */
|
||||
BOOL fIgnoreFilter;
|
||||
BOOL fIncludeDeleted;
|
||||
BOOL fLast;
|
||||
BOOL fIgnoreDuplicates;
|
||||
BOOL fIgnoreFilter; /* process should ignore any filter condition */
|
||||
BOOL fIncludeDeleted; /* process should include deleted records */
|
||||
BOOL fLast; /* last record of the current scope required */
|
||||
BOOL fIgnoreDuplicates; /* process should ignore duplicate key value */
|
||||
BOOL fBackword; /* skip backword */
|
||||
BOOL fOptimized; /* Is (should be) scope optimized */
|
||||
} DBSCOPEINFO;
|
||||
|
||||
typedef DBSCOPEINFO * LPDBSCOPEINFO;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* DBORDSCOPEINFO
|
||||
* --------------
|
||||
@@ -289,7 +305,6 @@ typedef struct
|
||||
typedef DBORDSCOPEINFO * LPDBORDSCOPEINFO;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* DBFILTERINFO
|
||||
* ------------
|
||||
@@ -300,7 +315,9 @@ typedef struct
|
||||
{
|
||||
PHB_ITEM itmCobExpr; /* Block representation of the FILTER expression */
|
||||
PHB_ITEM abFilterText; /* String representation of FILTER expression */
|
||||
BOOL fFilter;
|
||||
BOOL fFilter; /* flag to indicate that filter is active */
|
||||
BOOL fOptimized; /* Is (should be) filter optimized */
|
||||
void * lpvCargo; /* RDD specific extended filter info */
|
||||
} DBFILTERINFO;
|
||||
|
||||
typedef DBFILTERINFO * LPDBFILTERINFO;
|
||||
@@ -318,6 +335,7 @@ typedef struct _DBRELINFO
|
||||
PHB_ITEM itmCobExpr; /* Block representation of the relational SEEK key */
|
||||
PHB_ITEM abKey; /* String representation of the relational SEEK key */
|
||||
BOOL isScoped; /* Is this relation scoped */
|
||||
BOOL isOptimized; /* Is relation optimized */
|
||||
struct _AREA * lpaParent; /* The parent of this relation */
|
||||
struct _AREA * lpaChild; /* The parents children */
|
||||
struct _DBRELINFO * lpdbriNext; /* Next child or parent */
|
||||
@@ -338,12 +356,17 @@ typedef DBRELINFO * LPDBRELINFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PHB_ITEM itmBlock; /* The block to be evaluated */
|
||||
DBSCOPEINFO dbsci; /* Scope info that limits the evaluation */
|
||||
PHB_ITEM itmBlock; /* The block to be evaluated */
|
||||
PHB_ITEM abBlock; /* String representation of evaluated block */
|
||||
DBSCOPEINFO dbsci; /* Scope info that limits the evaluation */
|
||||
} DBEVALINFO;
|
||||
|
||||
typedef DBEVALINFO * LPDBEVALINFO;
|
||||
|
||||
/*
|
||||
* NOTE: If your redefine EVAL() method then you may use itmBlock as
|
||||
* string ITEM to make some operations on server side of remote RDD.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
@@ -476,6 +499,11 @@ typedef struct _FIELD
|
||||
|
||||
typedef FIELD * LPFIELD;
|
||||
|
||||
/*
|
||||
* prototype for function to evaluate against index keys
|
||||
* only for local RDDs (DBFNTX, DBFCDX, ...)
|
||||
*/
|
||||
typedef void ( * HB_EVALSCOPE_FUNC )( ULONG, BYTE *, ULONG, void * );
|
||||
|
||||
|
||||
/*--------------------* WORKAREA structure *----------------------*/
|
||||
@@ -491,6 +519,10 @@ typedef FIELD * LPFIELD;
|
||||
typedef struct _AREA
|
||||
{
|
||||
struct _RDDFUNCS * lprfsHost; /* Virtual method table for this workarea */
|
||||
#if 0
|
||||
/* I'll add this soon, Druzus */
|
||||
struct _RDDFUNCS * lprfsSuper;/* Virtual super method table for this workarea */
|
||||
#endif
|
||||
USHORT uiArea; /* The number assigned to this workarea */
|
||||
void * atomAlias; /* Pointer to the alias symbol for this workarea */
|
||||
USHORT uiFieldExtent; /* Total number of fields allocated */
|
||||
@@ -551,7 +583,7 @@ typedef USHORT ( * DBENTRYP_S )( AREAP area, USHORT param );
|
||||
typedef USHORT ( * DBENTRYP_LP )( AREAP area, LONG * param );
|
||||
typedef USHORT ( * DBENTRYP_ULP )( AREAP area, ULONG * param );
|
||||
typedef USHORT ( * DBENTRYP_SVP )( AREAP area, USHORT index, void * param );
|
||||
typedef USHORT ( * DBENTRYP_SVPB )( AREAP area, USHORT index, void * param, BOOL p3 );
|
||||
typedef USHORT ( * DBENTRYP_SVPB )( AREAP area, USHORT index, void * param, USHORT p3 );
|
||||
typedef USHORT ( * DBENTRYP_VSP )( AREAP area, USHORT action, ULONG lRecord );
|
||||
typedef USHORT ( * DBENTRYP_SVL )( AREAP area, USHORT index, ULONG * param );
|
||||
typedef USHORT ( * DBENTRYP_SSI )( AREAP area, USHORT p1, USHORT p2, PHB_ITEM p3 );
|
||||
@@ -559,13 +591,13 @@ typedef USHORT ( * DBENTRYP_ISI )( AREAP area, PHB_ITEM p1, USHORT p2, PHB_ITEM
|
||||
typedef USHORT ( * DBENTRYP_BIB )( AREAP area, BOOL p1, PHB_ITEM p2, BOOL p3 );
|
||||
typedef USHORT ( * DBENTRYP_VPL )( AREAP area, void * p1, LONG p2 );
|
||||
typedef USHORT ( * DBENTRYP_VPLP )( AREAP area, void * p1, LONG * p2 );
|
||||
typedef USHORT ( * DBENTRYP_LSP )( AREAP area, LONG p1, USHORT * p2 );
|
||||
typedef USHORT ( * DBENTRYP_LSP )( AREAP area, LONG p1, BOOL * p2 );
|
||||
|
||||
/* this methods DO USE take a Workarea but an RDDNODE */
|
||||
|
||||
typedef USHORT ( * DBENTRYP_I0 )( void );
|
||||
typedef USHORT ( * DBENTRYP_I1 )( PHB_ITEM p1 );
|
||||
typedef USHORT ( * DBENTRYP_I2 )( PHB_ITEM p1, PHB_ITEM p2 );
|
||||
typedef USHORT ( * DBENTRYP_R )( struct _RDDNODE * pRDD );
|
||||
typedef USHORT ( * DBENTRYP_RVV )( struct _RDDNODE * pRDD, PHB_ITEM p1, PHB_ITEM p2 );
|
||||
typedef USHORT ( * DBENTRYP_RSLV )( struct _RDDNODE * pRDD, USHORT index, ULONG p1, PHB_ITEM p2 );
|
||||
/*--------------------* Virtual Method Table *----------------------*/
|
||||
|
||||
typedef struct _RDDFUNCS
|
||||
@@ -607,7 +639,8 @@ typedef struct _RDDFUNCS
|
||||
DBENTRYP_V recall; /* Undelete the current record. */
|
||||
DBENTRYP_ULP reccount; /* Obtain number of records in WorkArea. */
|
||||
DBENTRYP_ISI recInfo; /* */
|
||||
DBENTRYP_I recno; /* Obtain physical row number at current WorkArea cursor position. */
|
||||
DBENTRYP_ULP recno; /* Obtain physical row number at current WorkArea cursor position. */
|
||||
DBENTRYP_I recid; /* Obtain physical row ID at current WorkArea cursor position. */
|
||||
DBENTRYP_S setFieldExtent; /* Establish the extent of the array of fields for a WorkArea. */
|
||||
|
||||
|
||||
@@ -649,7 +682,7 @@ typedef struct _RDDFUNCS
|
||||
|
||||
DBENTRYP_OI orderListAdd; /* */
|
||||
DBENTRYP_V orderListClear; /* */
|
||||
DBENTRYP_VP orderListDelete; /* */
|
||||
DBENTRYP_OI orderListDelete; /* */
|
||||
DBENTRYP_OI orderListFocus; /* */
|
||||
DBENTRYP_V orderListRebuild; /* */
|
||||
DBENTRYP_VOI orderCondition; /* */
|
||||
@@ -670,6 +703,7 @@ typedef struct _RDDFUNCS
|
||||
DBENTRYP_VLO setLocate; /*-Set the locate scope for the specified WorkArea. */
|
||||
DBENTRYP_VOS setScope; /* */
|
||||
DBENTRYP_VPL skipScope; /* */
|
||||
DBENTRYP_B locate; /* reposition cursor to postions set by setLocate */
|
||||
|
||||
|
||||
/* Miscellaneous */
|
||||
@@ -683,7 +717,7 @@ typedef struct _RDDFUNCS
|
||||
|
||||
DBENTRYP_VSP rawlock; /* Perform a lowlevel network lock in the specified WorkArea. */
|
||||
DBENTRYP_VL lock; /* Perform a network lock in the specified WorkArea. */
|
||||
DBENTRYP_UL unlock; /* Release network locks in the specified WorkArea. */
|
||||
DBENTRYP_I unlock; /* Release network locks in the specified WorkArea. */
|
||||
|
||||
|
||||
/* Memofile functions */
|
||||
@@ -692,7 +726,7 @@ typedef struct _RDDFUNCS
|
||||
DBENTRYP_VP createMemFile; /* Create a memo file in the WorkArea. */
|
||||
DBENTRYP_SVPB getValueFile; /* */
|
||||
DBENTRYP_VP openMemFile; /* Open a memo file in the specified WorkArea. */
|
||||
DBENTRYP_SVP putValueFile; /* */
|
||||
DBENTRYP_SVPB putValueFile; /* */
|
||||
|
||||
|
||||
/* Database file header handling */
|
||||
@@ -702,9 +736,11 @@ typedef struct _RDDFUNCS
|
||||
|
||||
|
||||
/* non WorkArea functions */
|
||||
DBENTRYP_I0 exit; /* */
|
||||
DBENTRYP_I1 drop; /* remove table */
|
||||
DBENTRYP_I2 exists; /* check if table exist */
|
||||
DBENTRYP_R init; /* init RDD after registration */
|
||||
DBENTRYP_R exit; /* unregister RDD */
|
||||
DBENTRYP_RVV drop; /* remove table */
|
||||
DBENTRYP_RVV exists; /* check if table exist */
|
||||
DBENTRYP_RSLV rddInfo; /* RDD info */
|
||||
|
||||
/* Special and reserved methods */
|
||||
|
||||
@@ -720,11 +756,13 @@ typedef RDDFUNCS * PRDDFUNCS;
|
||||
typedef struct _RDDNODE
|
||||
{
|
||||
char szName[ HARBOUR_MAX_RDD_DRIVERNAME_LENGTH + 1 ]; /* Name of RDD */
|
||||
USHORT uiType; /* Type of RDD */
|
||||
RDDFUNCS pTable; /* Table of functions */
|
||||
RDDFUNCS pSuperTable; /* Table of super functions */
|
||||
USHORT uiAreaSize; /* Size of the WorkArea */
|
||||
struct _RDDNODE * pNext; /* Next RDD in the list */
|
||||
USHORT uiType; /* Type of RDD */
|
||||
USHORT rddID; /* Type of RDD */
|
||||
RDDFUNCS pTable; /* Table of functions */
|
||||
RDDFUNCS pSuperTable; /* Table of super functions */
|
||||
USHORT uiAreaSize; /* Size of the WorkArea */
|
||||
void *lpvCargo; /* RDD specific extended data, if used then
|
||||
RDD should free it in EXIT() non WA method */
|
||||
} RDDNODE;
|
||||
|
||||
typedef RDDNODE * LPRDDNODE;
|
||||
@@ -750,7 +788,7 @@ typedef RDDNODE * LPRDDNODE;
|
||||
/* Data management */
|
||||
|
||||
#define SELF_ADDFIELD(w, ip) ((*(w)->lprfsHost->addField)(w, ip))
|
||||
#define SELF_APPEND(w,l) ((*(w)->lprfsHost->append)(w,l))
|
||||
#define SELF_APPEND(w, b) ((*(w)->lprfsHost->append)(w, b))
|
||||
#define SELF_CREATEFIELDS(w, v) ((*(w)->lprfsHost->createFields)(w, v))
|
||||
#define SELF_DELETE(w) ((*(w)->lprfsHost->deleterec)(w))
|
||||
#define SELF_DELETED(w, sp) ((*(w)->lprfsHost->deleted)(w, sp))
|
||||
@@ -767,9 +805,10 @@ typedef RDDNODE * LPRDDNODE;
|
||||
#define SELF_PUTVALUE(w, i, v) ((*(w)->lprfsHost->putValue)(w, i, v))
|
||||
#define SELF_PUTREC(w, bp) ((*(w)->lprfsHost->putRec)(w, bp))
|
||||
#define SELF_RECALL(w) ((*(w)->lprfsHost->recall)(w))
|
||||
#define SELF_RECCOUNT(w, sp) ((*(w)->lprfsHost->reccount)(w, sp))
|
||||
#define SELF_RECCOUNT(w, lp) ((*(w)->lprfsHost->reccount)(w, lp))
|
||||
#define SELF_RECINFO(w,v1,i,v2) ((*(w)->lprfsHost->recInfo)(w,v1,i,v2))
|
||||
#define SELF_RECNO(w, i) ((*(w)->lprfsHost->recno)(w, i))
|
||||
#define SELF_RECNO(w, lp) ((*(w)->lprfsHost->recno)(w, lp))
|
||||
#define SELF_RECID(w, i) ((*(w)->lprfsHost->recid)(w, i))
|
||||
#define SELF_SETFIELDEXTENT(w, s) ((*(w)->lprfsHost->setFieldExtent)(w, s))
|
||||
|
||||
|
||||
@@ -840,6 +879,7 @@ typedef RDDNODE * LPRDDNODE;
|
||||
#define SELF_SETLOCATE(w, ip) ((*(w)->lprfsHost->setLocate)(w, ip))
|
||||
#define SELF_SETSCOPE(w, ip) ((*(w)->lprfsHost->setScope)(w, ip))
|
||||
#define SELF_SKIPSCOPE(w, bp, l) ((*(w)->lprfsHost->skipScope)(w, bp, l))
|
||||
#define SELF_LOCATE(w, b) ((*(w)->lprfsHost->locate)(w, b))
|
||||
|
||||
|
||||
/* Miscellaneous */
|
||||
@@ -854,16 +894,16 @@ typedef RDDNODE * LPRDDNODE;
|
||||
#define SELF_GETLOCKS(w, g) ((*(w)->lprfsHost->info)(w, DBI_GETLOCKARRAY, g))
|
||||
#define SELF_RAWLOCK(w, i, l) ((*(w)->lprfsHost->rawlock)(w, i, l))
|
||||
#define SELF_LOCK(w, sp) ((*(w)->lprfsHost->lock)(w, sp))
|
||||
#define SELF_UNLOCK(w, l) ((*(w)->lprfsHost->unlock)(w, l))
|
||||
#define SELF_UNLOCK(w, i) ((*(w)->lprfsHost->unlock)(w, i))
|
||||
|
||||
|
||||
/* Memofile functions */
|
||||
|
||||
#define SELF_CLOSEMEMFILE(w) ((*(w)->lprfsHost->closeMemFile)(w))
|
||||
#define SELF_CREATEMEMFILE(w,bp) ((*(w)->lprfsHost->createMemFile)(w,bp))
|
||||
#define SELF_GETVALUEFILE(w,i,bp,b) ((*(w)->lprfsHost->getValueFile)(w,i,bp,b))
|
||||
#define SELF_GETVALUEFILE(w,i,bp,u) ((*(w)->lprfsHost->getValueFile)(w,i,bp,u))
|
||||
#define SELF_OPENMEMFILE(w,bp) ((*(w)->lprfsHost->openMemFile)(w,bp))
|
||||
#define SELF_PUTVALUEFILE(w,i,bp) ((*(w)->lprfsHost->putValueFile)(w,i,bp))
|
||||
#define SELF_PUTVALUEFILE(w,i,bp,u) ((*(w)->lprfsHost->putValueFile)(w,i,bp,u))
|
||||
|
||||
|
||||
/* Database file header handling */
|
||||
@@ -881,11 +921,14 @@ typedef RDDNODE * LPRDDNODE;
|
||||
#define SELF_GETDELIM(w, fp) ((*(w)->lprfsHost->info)(w, DBI_GETDELIMITER, fp))
|
||||
#define SELF_TABLEEXT(w, fp) ((*(w)->lprfsHost->info)(w, DBI_TABLEEXT, fp))
|
||||
|
||||
#define SELF_RDDNODE(w) hb_rddGetNode((w)->rddID)
|
||||
|
||||
/* non WorkArea functions */
|
||||
#define SELF_EXIT(r) ((*(r)->pTable.exit)())
|
||||
#define SELF_DROP(r, i) ((*(r)->pTable.drop)(i))
|
||||
#define SELF_EXISTS(r, it, ii) ((*(r)->pTable.exists)(it,ii))
|
||||
#define SELF_INIT(r) ((*(r)->pTable.init)(r))
|
||||
#define SELF_EXIT(r) ((*(r)->pTable.exit)(r))
|
||||
#define SELF_DROP(r, it, ii) ((*(r)->pTable.drop)(r, it, ii))
|
||||
#define SELF_EXISTS(r, it, ii) ((*(r)->pTable.exists)(r, it, ii))
|
||||
#define SELF_RDDINFO(r, i, l, g) ((*(r)->pTable.rddInfo)(r, i, l, g))
|
||||
|
||||
|
||||
/*--------------------* SUPER Methods *------------------------*/
|
||||
@@ -909,7 +952,7 @@ typedef RDDNODE * LPRDDNODE;
|
||||
/* Data management */
|
||||
|
||||
#define SUPER_ADDFIELD(w, ip) ((*(SUPERTABLE)->addField)(w, ip))
|
||||
#define SUPER_APPEND(w,l) ((*(SUPERTABLE)->append)(w,l))
|
||||
#define SUPER_APPEND(w, b) ((*(SUPERTABLE)->append)(w, b))
|
||||
#define SUPER_CREATEFIELDS(w, v) ((*(SUPERTABLE)->createFields)(w, v))
|
||||
#define SUPER_DELETE(w) ((*(SUPERTABLE)->deleterec)(w))
|
||||
#define SUPER_DELETED(w, sp) ((*(SUPERTABLE)->deleted)(w, sp))
|
||||
@@ -926,9 +969,10 @@ typedef RDDNODE * LPRDDNODE;
|
||||
#define SUPER_PUTVALUE(w, i, v) ((*(SUPERTABLE)->putValue)(w, i, v))
|
||||
#define SUPER_PUTREC(w, bp) ((*(SUPERTABLE)->putRec)(w, bp))
|
||||
#define SUPER_RECALL(w) ((*(SUPERTABLE)->recall)(w))
|
||||
#define SUPER_RECCOUNT(w, sp) ((*(SUPERTABLE)->reccount)(w, sp))
|
||||
#define SUPER_RECCOUNT(w, lp) ((*(SUPERTABLE)->reccount)(w, lp))
|
||||
#define SUPER_RECINFO(w,v1,i,v2) ((*(SUPERTABLE)->recInfo)(w,v1,i,v2))
|
||||
#define SUPER_RECNO(w, sp) ((*(SUPERTABLE)->recno)(w, sp))
|
||||
#define SUPER_RECNO(w, lp) ((*(SUPERTABLE)->recno)(w, lp))
|
||||
#define SUPER_RECID(w, i) ((*(SUPERTABLE)->recid)(w, i))
|
||||
#define SUPER_SETFIELDEXTENT(w, s) ((*(SUPERTABLE)->setFieldExtent)(w, s))
|
||||
|
||||
|
||||
@@ -999,6 +1043,7 @@ typedef RDDNODE * LPRDDNODE;
|
||||
#define SUPER_SETLOCATE(w, ip) ((*(SUPERTABLE)->setLocate)(w, ip))
|
||||
#define SUPER_SETSCOPE(w, ip) ((*(SUPERTABLE)->setScope)(w, ip))
|
||||
#define SUPER_SKIPSCOPE(w, bp, l) ((*(SUPERTABLE)->skipScope)(w, bp, l))
|
||||
#define SUPER_LOCATE(w, b) ((*(SUPERTABLE)->locate)(w, b))
|
||||
|
||||
|
||||
/* Miscellaneous */
|
||||
@@ -1013,16 +1058,16 @@ typedef RDDNODE * LPRDDNODE;
|
||||
#define SUPER_GETLOCKS(w, g) ((*(SUPERTABLE)->info)(w, DBI_GETLOCKARRAY, g))
|
||||
#define SUPER_RAWLOCK(w, i, l) ((*(SUPERTABLE)->rawlock)(w, i, l))
|
||||
#define SUPER_LOCK(w, sp) ((*(SUPERTABLE)->lock)(w, sp))
|
||||
#define SUPER_UNLOCK(w,l) ((*(SUPERTABLE)->unlock)(w,l))
|
||||
#define SUPER_UNLOCK(w, i) ((*(SUPERTABLE)->unlock)(w, i))
|
||||
|
||||
|
||||
/* Memofile functions */
|
||||
|
||||
#define SUPER_CLOSEMEMFILE(w) ((*(SUPERTABLE)->closeMemFile)(w))
|
||||
#define SUPER_CREATEMEMFILE(w,bp) ((*(SUPERTABLE)->createMemFile)(w,bp))
|
||||
#define SUPER_GETVALUEFILE(w,i,bp,b) ((*(SUPERTABLE)->getValueFile)(w,i,bp,b))
|
||||
#define SUPER_GETVALUEFILE(w,i,bp,u) ((*(SUPERTABLE)->getValueFile)(w,i,bp,u))
|
||||
#define SUPER_OPENMEMFILE(w,bp) ((*(SUPERTABLE)->openMemFile)(w,bp))
|
||||
#define SUPER_PUTVALUEFILE(w,i,bp) ((*(SUPERTABLE)->putValueFile)(w,i,bp))
|
||||
#define SUPER_PUTVALUEFILE(w,i,bp,u) ((*(SUPERTABLE)->putValueFile)(w,i,bp,u))
|
||||
|
||||
|
||||
/* Database file header handling */
|
||||
@@ -1041,23 +1086,30 @@ typedef RDDNODE * LPRDDNODE;
|
||||
#define SUPER_TABLEEXT(w, fp) ((*(SUPERTABLE)->info)(w, DBI_TABLEEXT, fp))
|
||||
|
||||
/* non WorkArea functions */
|
||||
#define SUPER_EXIT() ((*(SUPERTABLE)->exit)())
|
||||
#define SUPER_DROP(i) ((*(SUPERTABLE)->drop)(i))
|
||||
#define SUPER_EXISTS(it, ii) ((*(SUPERTABLE)->exists)(it, ii))
|
||||
#define SUPER_INIT(r) ((*(SUPERTABLE)->init)(r))
|
||||
#define SUPER_EXIT(r) ((*(SUPERTABLE)->exit)(r))
|
||||
#define SUPER_DROP(r, it, ii) ((*(SUPERTABLE)->drop)(r, it, ii))
|
||||
#define SUPER_EXISTS(r, it, ii) ((*(SUPERTABLE)->exists)(r, it, ii))
|
||||
#define SUPER_RDDINFO(r, i, l, g) ((*(SUPERTABLE)->rddInfo)(r, i, l, g))
|
||||
|
||||
#define ISSUPER_INIT(r) ((SUPERTABLE)->init != NULL)
|
||||
#define ISSUPER_EXIT(r) ((SUPERTABLE)->exit != NULL)
|
||||
|
||||
/*
|
||||
* PROTOTYPES
|
||||
* ----------
|
||||
*/
|
||||
extern ERRCODE hb_rddInherit( PRDDFUNCS pTable, PRDDFUNCS pSubTable, PRDDFUNCS pSuperTable, BYTE * szDrvName );
|
||||
extern ERRCODE hb_rddDisinherit( BYTE * drvName );
|
||||
extern USHORT hb_rddExtendType( USHORT fieldType );
|
||||
extern USHORT hb_rddFieldType( USHORT extendType );
|
||||
extern ERRCODE HB_EXPORT hb_rddInherit( PRDDFUNCS pTable, PRDDFUNCS pSubTable, PRDDFUNCS pSuperTable, BYTE * szDrvName );
|
||||
extern ERRCODE HB_EXPORT hb_rddDisinherit( BYTE * drvName );
|
||||
extern USHORT HB_EXPORT hb_rddExtendType( USHORT fieldType );
|
||||
extern USHORT HB_EXPORT hb_rddFieldType( USHORT extendType );
|
||||
extern LPRDDNODE HB_EXPORT hb_rddGetNode( USHORT uiNode );
|
||||
|
||||
typedef short (* WACALLBACK )( AREA *, int );
|
||||
extern ERRCODE hb_rddIterateWorkAreas ( WACALLBACK pCallBack, int data );
|
||||
USHORT hb_rddFieldIndex( AREAP pArea, char * szName);
|
||||
ERRCODE hb_rddGetTempAlias( char * szAliasTmp );
|
||||
extern ERRCODE HB_EXPORT hb_rddIterateWorkAreas ( WACALLBACK pCallBack, int data );
|
||||
extern USHORT HB_EXPORT hb_rddFieldIndex( AREAP pArea, char * szName );
|
||||
extern USHORT HB_EXPORT hb_rddFieldExpIndex( AREAP pArea, char * szField );
|
||||
extern ERRCODE HB_EXPORT hb_rddGetTempAlias( char * szAliasTmp );
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
|
||||
@@ -68,10 +68,13 @@ typedef struct _DBFHEADER
|
||||
BYTE ulRecCount[ 4 ];
|
||||
BYTE uiHeaderLen[ 2 ];
|
||||
BYTE uiRecordLen[ 2 ];
|
||||
BYTE bReserved1[ 16 ];
|
||||
BYTE bHasTags;
|
||||
BYTE bReserved1[ 2 ];
|
||||
BYTE bTransaction; /* 1-transaction begin */
|
||||
BYTE bEncrypted; /* 1-encryptpted table */
|
||||
BYTE bReserved2[ 12 ];
|
||||
BYTE bHasTags; /* bit filed: 1-production index, 2-memo file in VFP */
|
||||
BYTE bCodePage;
|
||||
BYTE bReserved2[ 2 ];
|
||||
BYTE bReserved3[ 2 ];
|
||||
} DBFHEADER;
|
||||
|
||||
typedef DBFHEADER * LPDBFHEADER;
|
||||
@@ -84,15 +87,32 @@ typedef struct _DBFFIELD
|
||||
{
|
||||
BYTE bName[ 11 ];
|
||||
BYTE bType;
|
||||
BYTE bReserved1[ 4 ];
|
||||
BYTE bReserved1[ 4 ]; /* offset from record begin in FP */
|
||||
BYTE bLen;
|
||||
BYTE bDec;
|
||||
BYTE bReserved2[ 13 ];
|
||||
BYTE bFieldFlags; /* 1-system column, 2-nullable, 4-binary */
|
||||
BYTE bCounter[4]; /* autoincrement counter */
|
||||
BYTE bStep; /* autoincrement step */
|
||||
BYTE bReserved2[ 7 ];
|
||||
BYTE bHasTag;
|
||||
} DBFFIELD;
|
||||
|
||||
typedef DBFFIELD * LPDBFFIELD;
|
||||
|
||||
|
||||
|
||||
/* SMT MEMO field */
|
||||
|
||||
typedef struct _SMTFIELD
|
||||
{
|
||||
BYTE type[2];
|
||||
BYTE length[4];
|
||||
BYTE block[4];
|
||||
} SMTFIELD;
|
||||
|
||||
typedef SMTFIELD * LPSMTFIELD;
|
||||
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
#endif /* HB_DBF_H_ */
|
||||
|
||||
@@ -57,8 +57,12 @@ HB_EXTERN_BEGIN
|
||||
|
||||
/* DBF errors */
|
||||
#define EDBF_OPEN_DBF 1001
|
||||
#define EDBF_OPEN_MEMO 1002
|
||||
#define EDBF_OPEN_INDEX 1003
|
||||
#define EDBF_CREATE_DBF 1004
|
||||
#define EDBF_CREATE 1006
|
||||
#define EDBF_CREATE_MEMO 1005
|
||||
#define EDBF_CREATE_INDEX 1006
|
||||
#define EDBF_CREATE EDBF_CREATE_INDEX
|
||||
#define EDBF_READ 1010
|
||||
#define EDBF_WRITE 1011
|
||||
#define EDBF_CORRUPT 1012
|
||||
@@ -68,9 +72,21 @@ HB_EXTERN_BEGIN
|
||||
#define EDBF_SHARED 1023
|
||||
#define EDBF_APPENDLOCK 1024
|
||||
#define EDBF_READONLY 1025
|
||||
#define EDBF_LIMITEXCEEDED 1027
|
||||
#define EDBF_LOCKTIMEOUT 1035
|
||||
#define EDBF_LOCK 1038
|
||||
/* ORDER errors */
|
||||
#define EDBF_INVALIDKEY 1026
|
||||
#define EDBF_NOTINDEXED 1201
|
||||
#define EDBF_INVALIDORDER 1050
|
||||
#define EDBF_SCOPETYPE 1051
|
||||
#define EDBF_NOTCUSTOM 1052
|
||||
#define EDBF_INVALIDFOR 1053
|
||||
#define EDBF_KEYLENGTH 1054
|
||||
#define EDBF_SIGNATURE 1055
|
||||
|
||||
#define EDBF_MEMOTYPE 1056
|
||||
#define EDBF_MEMOTOOLONG 1057
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
|
||||
@@ -690,6 +690,21 @@ typedef unsigned long HB_COUNTER;
|
||||
(( BYTE * )( p ))[1] = ( BYTE )( (w) >> 8 ); \
|
||||
(( BYTE * )( p ))[2] = ( BYTE )( (w) >> 16 ); \
|
||||
} while ( 0 )
|
||||
#define HB_GET_BE_INT24( p ) ( ( INT32 ) \
|
||||
( ( INT32 ) (( BYTE * )( p ))[2] | \
|
||||
( INT32 ) (( BYTE * )( p ))[1] << 8 | \
|
||||
( INT32 ) (( BYTE * )( p ))[0] << 16 | \
|
||||
( INT32 ) ((( BYTE * )( p ))[0] & 0x80 ? 0xFF : 0x00 ) << 24 ) )
|
||||
#define HB_GET_BE_UINT24( p ) ( ( UINT32 ) \
|
||||
( ( UINT32 ) (( BYTE * )( p ))[2] | \
|
||||
( UINT32 ) (( BYTE * )( p ))[1] << 8 | \
|
||||
( UINT32 ) (( BYTE * )( p ))[0] << 16 ) )
|
||||
#define HB_PUT_BE_UINT24( p, w ) do { \
|
||||
(( BYTE * )( p ))[2] = ( BYTE )( w ); \
|
||||
(( BYTE * )( p ))[1] = ( BYTE )( (w) >> 8 ); \
|
||||
(( BYTE * )( p ))[0] = ( BYTE )( (w) >> 16 ); \
|
||||
} while ( 0 )
|
||||
|
||||
|
||||
|
||||
#if defined( HB_PDP_ENDIAN )
|
||||
|
||||
@@ -67,9 +67,11 @@ HB_EXTERN_BEGIN
|
||||
/* CDX constants and defaults */
|
||||
#define CDX_INDEXEXT ".cdx"
|
||||
#define CDX_MAXKEY 240
|
||||
#define CDX_MAXEXP 255
|
||||
#define CDX_MAXTAGNAMELEN 10
|
||||
#define CDX_PAGELEN 512
|
||||
#define CDX_HEADERLEN 1024
|
||||
#define CDX_HEADEREXPLEN (CDX_HEADERLEN - 512)
|
||||
#define CDX_HEADERPAGES ((CDX_HEADERLEN+CDX_PAGELEN-1)/CDX_PAGELEN)
|
||||
#define CDX_INT_FREESPACE (CDX_PAGELEN-12) /* 500 */
|
||||
#define CDX_EXT_FREESPACE (CDX_PAGELEN-24) /* 488 */
|
||||
@@ -150,7 +152,39 @@ HB_EXTERN_BEGIN
|
||||
#define CDX_TYPE_COMPOUND 0x40 /* FoxPro */
|
||||
#define CDX_TYPE_STRUCTURE 0x80 /* FoxPro */
|
||||
|
||||
typedef void ( * HB_EVALSCOPE_FUNC )( ULONG, BYTE *, ULONG, void * );
|
||||
/*
|
||||
TODO like in SIXCDX:
|
||||
switch ( indexOpt & ( CDX_TYPE_TEMPORARY | CDX_TYPE_CUSTOM ) )
|
||||
case CDX_TYPE_TEMPORARY:
|
||||
PARTIAL_RYO
|
||||
case CDX_TYPE_CUSTOM:
|
||||
PARTIAL_RYO | CHGONLY_RYO
|
||||
case CDX_TYPE_TEMPORARY | CDX_TYPE_CUSTOM:
|
||||
PARTIAL_RYO | NOUPDATE_RYO
|
||||
if index key begin with:
|
||||
'SXCHAR(' or 'SXNUM(' or 'SXDATE(' or 'SXLOG('
|
||||
then
|
||||
| TEMPLATE_RYO
|
||||
|
||||
sx_chill() if ( ! NOUPDATE_RYO ) then set ( CHGONLY_RYO | PARTIAL_RYO )
|
||||
if ( indexOpt & ( CDX_TYPE_TEMPORARY | CDX_TYPE_CUSTOM ) !=
|
||||
CDX_TYPE_TEMPORARY | CDX_TYPE_CUSTOM )
|
||||
{
|
||||
indexOpt &= ~CDX_TYPE_CUSTOM;
|
||||
indexOpt |= CDX_TYPE_TEMPORARY
|
||||
}
|
||||
|
||||
sx_warm() if ( ! NOUPDATE_RYO ) then clear CHGONLY_RYO
|
||||
if ( indexOpt & ( CDX_TYPE_TEMPORARY | CDX_TYPE_CUSTOM ) !=
|
||||
CDX_TYPE_TEMPORARY | CDX_TYPE_CUSTOM )
|
||||
{
|
||||
indexOpt |= CDX_TYPE_CUSTOM;
|
||||
indexOpt &= ~CDX_TYPE_TEMPORARY
|
||||
}
|
||||
|
||||
sx_freeze() set NOUPDATE_RYO
|
||||
indexOpt |= CDX_TYPE_TEMPORARY | CDX_TYPE_CUSTOM;
|
||||
*/
|
||||
|
||||
/* CDX index node strucutres */
|
||||
/* Compact Index Header Record */
|
||||
@@ -162,13 +196,14 @@ typedef struct _CDXTAGHEADER
|
||||
BYTE keySize [ 2 ]; /* key length */
|
||||
BYTE indexOpt; /* index options see CDX_TYPE_* */
|
||||
BYTE indexSig; /* index signature */
|
||||
BYTE reserved2[ 486 ];
|
||||
BYTE reserved2[ 484 ];
|
||||
BYTE ignoreCase[ 2 ]; /* 1 = ignore case, key converted to upper */
|
||||
BYTE ascendFlg[ 2 ]; /* 0 = ascending 1 = descending */
|
||||
BYTE forExpPos[ 2 ]; /* offset of filter expression */
|
||||
BYTE forExpLen[ 2 ]; /* length of filter expression */
|
||||
BYTE keyExpPos[ 2 ]; /* offset of key expression */
|
||||
BYTE keyExpLen[ 2 ]; /* length of key expression */
|
||||
BYTE keyExpPool[ CDX_HEADERLEN - 512 ];
|
||||
BYTE keyExpPool[ CDX_HEADEREXPLEN ];
|
||||
} CDXTAGHEADER;
|
||||
typedef CDXTAGHEADER * LPCDXTAGHEADER;
|
||||
|
||||
@@ -287,6 +322,7 @@ typedef struct _CDXTAG
|
||||
USHORT uiType; /* a type of key expression value */
|
||||
USHORT uiLen; /* length of the key expression value */
|
||||
USHORT nField; /* Field number for simple (one field) key expersion */
|
||||
BYTE bTrail; /* trailing character for shorter key value */
|
||||
BYTE OptFlags; /* index options flag */
|
||||
BOOL AscendKey; /* ascending/descending order flag */
|
||||
BOOL UniqueKey; /* unique order flag */
|
||||
@@ -333,27 +369,29 @@ typedef CDXTAG * LPCDXTAG;
|
||||
|
||||
typedef struct _CDXINDEX
|
||||
{
|
||||
char * szFileName; /* Name of index file */
|
||||
FHANDLE hFile; /* Index file handle */
|
||||
char * szFileName; /* Name of index file */
|
||||
char * szRealName; /* Real name of index file */
|
||||
FHANDLE hFile; /* Index file handle */
|
||||
struct _CDXAREA * pArea; /* Parent WorkArea */
|
||||
struct _CDXINDEX * pNext; /* The next index in the list */
|
||||
LPCDXTAG pCompound; /* Compound Tag (index of tags) */
|
||||
LPCDXTAG TagList; /* List of tags in index file */
|
||||
BOOL fShared; /* Shared file */
|
||||
BOOL fReadonly; /* Read only file */
|
||||
ULONG nextAvail; /* offset to next free page in the end of index file */
|
||||
ULONG freePage; /* offset to next free page inside index file */
|
||||
LPCDXLIST freeLst; /* list of free pages in index file */
|
||||
int lockWrite; /* number of write lock set */
|
||||
int lockRead; /* number of read lock set */
|
||||
ULONG ulLockPos; /* readlock position for CL53 lock scheme */
|
||||
LPCDXTAG pCompound; /* Compound tag */
|
||||
LPCDXTAG TagList; /* List of tags in index file */
|
||||
BOOL fShared; /* Shared file */
|
||||
BOOL fReadonly; /* Read only file */
|
||||
BOOL fDelete; /* delete on close flag */
|
||||
ULONG nextAvail; /* offset to next free page in the end of index file */
|
||||
ULONG freePage; /* offset to next free page inside index file */
|
||||
LPCDXLIST freeLst; /* list of free pages in index file */
|
||||
int lockWrite; /* number of write lock set */
|
||||
int lockRead; /* number of read lock set */
|
||||
HB_FOFFSET ulLockPos; /* readlock position for CL53 lock scheme */
|
||||
#ifdef HB_CDX_DBGCODE
|
||||
BOOL RdLck;
|
||||
BOOL WrLck;
|
||||
BOOL RdLck;
|
||||
BOOL WrLck;
|
||||
#endif
|
||||
BOOL fChanged; /* changes written to index, need upadte ulVersion */
|
||||
ULONG ulVersion; /* network version/update flag */
|
||||
BOOL fFlush; /* changes written to index, need upadte ulVersion */
|
||||
BOOL fChanged; /* changes written to index, need upadte ulVersion */
|
||||
ULONG ulVersion; /* network version/update flag */
|
||||
BOOL fFlush; /* changes written to index, need upadte ulVersion */
|
||||
} CDXINDEX;
|
||||
typedef CDXINDEX * LPCDXINDEX;
|
||||
|
||||
@@ -376,6 +414,7 @@ typedef struct
|
||||
int keyLen; /* key length */
|
||||
BYTE bTrl; /* filler char for shorter keys */
|
||||
BOOL fUnique; /* TRUE if index is unique */
|
||||
BOOL fReindex; /* TRUE if reindexing is in process */
|
||||
ULONG ulMaxRec; /* the highest record number */
|
||||
ULONG ulTotKeys; /* total number of keys indexed */
|
||||
ULONG ulKeys; /* keys in curently created page */
|
||||
@@ -439,43 +478,47 @@ typedef struct _CDXAREA
|
||||
* example.
|
||||
*/
|
||||
|
||||
FHANDLE hDataFile; /* Data file handle */
|
||||
FHANDLE hMemoFile; /* Memo file handle */
|
||||
USHORT uiHeaderLen; /* Size of header */
|
||||
USHORT uiRecordLen; /* Size of record */
|
||||
ULONG ulRecCount; /* Total records */
|
||||
char * szDataFileName; /* Name of data file */
|
||||
char * szMemoFileName; /* Name of memo file */
|
||||
USHORT uiMemoBlockSize; /* Size of memo block */
|
||||
BYTE bMemoType; /* MEMO type used in DBF memo fields */
|
||||
BOOL fHasMemo; /* WorkArea with Memo fields */
|
||||
BOOL fHasTags; /* WorkArea with MDX or CDX index */
|
||||
BOOL fDataFlush; /* data was written to DBF and not commited */
|
||||
BOOL fMemoFlush; /* data was written to MEMO and not commited */
|
||||
BYTE bVersion; /* DBF version ID byte */
|
||||
BYTE bCodePage; /* DBF codepage ID */
|
||||
BOOL fShared; /* Shared file */
|
||||
BOOL fReadonly; /* Read only file */
|
||||
USHORT * pFieldOffset; /* Pointer to field offset array */
|
||||
BYTE * pRecord; /* Buffer of record data */
|
||||
BOOL fValidBuffer; /* State of buffer */
|
||||
BOOL fPositioned; /* Positioned record */
|
||||
ULONG ulRecNo; /* Current record */
|
||||
BOOL fRecordChanged; /* Record changed */
|
||||
BOOL fAppend; /* TRUE if new record is added */
|
||||
BOOL fDeleted; /* TRUE if record is deleted */
|
||||
BOOL fUpdateHeader; /* Update header of file */
|
||||
BOOL fFLocked; /* TRUE if file is locked */
|
||||
BOOL fHeaderLocked; /* TRUE if DBF header is locked */
|
||||
LPDBRELINFO lpdbPendingRel; /* Pointer to parent rel struct */
|
||||
BYTE bYear; /* Last update */
|
||||
BYTE bMonth;
|
||||
BYTE bDay;
|
||||
BYTE bLockType; /* Type of locking shemes */
|
||||
ULONG * pLocksPos; /* List of records locked */
|
||||
ULONG ulNumLocksPos; /* Number of records locked */
|
||||
FHANDLE hDataFile; /* Data file handle */
|
||||
FHANDLE hMemoFile; /* Memo file handle */
|
||||
char * szDataFileName; /* Name of data file */
|
||||
char * szMemoFileName; /* Name of memo file */
|
||||
USHORT uiHeaderLen; /* Size of header */
|
||||
USHORT uiRecordLen; /* Size of record */
|
||||
USHORT uiMemoBlockSize; /* Size of memo block */
|
||||
USHORT uiMemoVersion; /* MEMO file version */
|
||||
DBFHEADER dbfHeader; /* DBF header buffer */
|
||||
BYTE bTableType; /* DBF type */
|
||||
BYTE bMemoType; /* MEMO type used in DBF memo fields */
|
||||
BYTE bLockType; /* Type of locking shemes */
|
||||
BYTE bCryptType; /* Type of used encryption */
|
||||
USHORT * pFieldOffset; /* Pointer to field offset array */
|
||||
BYTE * pRecord; /* Buffer of record data */
|
||||
ULONG ulRecCount; /* Total records */
|
||||
ULONG ulRecNo; /* Current record */
|
||||
BOOL fAutoInc; /* WorkArea with auto increment fields */
|
||||
BOOL fHasMemo; /* WorkArea with Memo fields */
|
||||
BOOL fHasTags; /* WorkArea with MDX or CDX index */
|
||||
BOOL fDataFlush; /* data was written to DBF and not commited */
|
||||
BOOL fMemoFlush; /* data was written to MEMO and not commited */
|
||||
BOOL fShared; /* Shared file */
|
||||
BOOL fReadonly; /* Read only file */
|
||||
BOOL fValidBuffer; /* State of buffer */
|
||||
BOOL fPositioned; /* Positioned record */
|
||||
BOOL fRecordChanged; /* Record changed */
|
||||
BOOL fAppend; /* TRUE if new record is added */
|
||||
BOOL fDeleted; /* TRUE if record is deleted */
|
||||
BOOL fEncrypted; /* TRUE if record is encrypted */
|
||||
BOOL fTableEncrypted; /* TRUE if table is encrypted */
|
||||
BOOL fUpdateHeader; /* Update header of file */
|
||||
BOOL fFLocked; /* TRUE if file is locked */
|
||||
BOOL fHeaderLocked; /* TRUE if DBF header is locked */
|
||||
LPDBRELINFO lpdbPendingRel; /* Pointer to parent rel struct */
|
||||
ULONG * pLocksPos; /* List of records locked */
|
||||
ULONG ulNumLocksPos; /* Number of records locked */
|
||||
BYTE * pCryptKey; /* Pointer to encryption key */
|
||||
PHB_DYNS pTriggerSym; /* DynSym pointer to trigger function */
|
||||
#ifndef HB_CDP_SUPPORT_OFF
|
||||
PHB_CODEPAGE cdPage; /* Area's codepage pointer */
|
||||
PHB_CODEPAGE cdPage; /* Area's codepage pointer */
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -489,8 +532,8 @@ typedef struct _CDXAREA
|
||||
BOOL fCdxAppend; /* Appended record changed */
|
||||
LPCDXINDEX lpIndexes; /* Pointer to indexes array */
|
||||
USHORT uiTag; /* current tag focus */
|
||||
LPCDXSORTINFO pSort; /* Index build structure */
|
||||
BYTE * bCdxSortTab; /* Table with storted characters */
|
||||
LPCDXSORTINFO pSort; /* Index build structur */
|
||||
|
||||
} CDXAREA;
|
||||
|
||||
@@ -539,6 +582,7 @@ static ERRCODE hb_cdxGoHot( CDXAREAP pArea );
|
||||
#define hb_cdxRecCount NULL
|
||||
#define hb_cdxRecInfo NULL
|
||||
#define hb_cdxRecNo NULL
|
||||
#define hb_cdxRecId NULL
|
||||
#define hb_cdxSetFieldExtent NULL
|
||||
#define hb_cdxAlias NULL
|
||||
static ERRCODE hb_cdxClose( CDXAREAP pArea );
|
||||
@@ -577,14 +621,15 @@ static ERRCODE hb_cdxOrderDestroy( CDXAREAP pArea, LPDBORDERINFO pOrderInfo );
|
||||
static ERRCODE hb_cdxOrderInfo( CDXAREAP pArea, USHORT uiIndex, LPDBORDERINFO pOrderInfo );
|
||||
static ERRCODE hb_cdxClearFilter( CDXAREAP pArea );
|
||||
#define hb_cdxClearLocate NULL
|
||||
static ERRCODE hb_cdxClearScope( CDXAREAP pArea );
|
||||
#define hb_cdxClearScope NULL
|
||||
static ERRCODE hb_cdxCountScope( CDXAREAP pArea, void * pPtr, LONG * plRec );
|
||||
#define hb_cdxFilterText NULL
|
||||
static ERRCODE hb_cdxScopeInfo( CDXAREAP pArea, USHORT nScope, PHB_ITEM pItem );
|
||||
#define hb_cdxScopeInfo NULL
|
||||
static ERRCODE hb_cdxSetFilter( CDXAREAP pArea, LPDBFILTERINFO pFilterInfo );
|
||||
#define hb_cdxSetLocate NULL
|
||||
static ERRCODE hb_cdxSetScope( CDXAREAP pArea, LPDBORDSCOPEINFO sInfo );
|
||||
#define hb_cdxSetScope NULL
|
||||
#define hb_cdxSkipScope NULL
|
||||
#define hb_cdxLocate NULL
|
||||
#define hb_cdxCompile NULL
|
||||
#define hb_cdxError NULL
|
||||
#define hb_cdxEvalBlock NULL
|
||||
@@ -598,9 +643,11 @@ static ERRCODE hb_cdxSetScope( CDXAREAP pArea, LPDBORDSCOPEINFO sInfo );
|
||||
#define hb_cdxPutValueFile NULL
|
||||
#define hb_cdxReadDBHeader NULL
|
||||
#define hb_cdxWriteDBHeader NULL
|
||||
#define hb_cdxInit NULL
|
||||
#define hb_cdxExit NULL
|
||||
#define hb_cdxDrop NULL
|
||||
#define hb_cdxExists NULL
|
||||
static ERRCODE hb_cdxRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, PHB_ITEM pItem );
|
||||
#define hb_cdxWhoCares NULL
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include "hbsetup.h"
|
||||
#include "hbapirdd.h"
|
||||
#include "hbdbferr.h"
|
||||
#include "hbdbf.h"
|
||||
#ifndef HB_CDP_SUPPORT_OFF
|
||||
#include "hbapicdp.h"
|
||||
#endif
|
||||
@@ -64,39 +65,68 @@ HB_EXTERN_BEGIN
|
||||
|
||||
/* DBF default file extensions */
|
||||
#define DBF_TABLEEXT ".dbf"
|
||||
|
||||
/* DBF locking schemes */
|
||||
#define DBF_LOCKPOS_CLIP 1000000000L
|
||||
#define DBF_LOCKPOS_CL53 1000000000L
|
||||
#define DBF_LOCKPOS_VFP 0x40000000L
|
||||
#define DBF_LOCKPOS_VFPX 0x7ffffffeL
|
||||
#define DBF_LOCKPOS_CLIP 1000000000UL
|
||||
#define DBF_LOCKPOS_CL53 1000000000UL
|
||||
#define DBF_LOCKPOS_VFP 0x40000000UL
|
||||
#define DBF_LOCKPOS_VFPX 0x7ffffffeUL
|
||||
#define DBF_LOCKPOS_CL53EXT 4000000000UL
|
||||
#define DBF_LOCKPOS_XHB64 HB_LL( 0x7FFFFFFF00000001 )
|
||||
|
||||
#define DBF_LOCKDIR_CLIP 1
|
||||
#define DBF_LOCKDIR_CL53 1
|
||||
#define DBF_LOCKDIR_VFP 2 /* lock forward at at record offset */
|
||||
#define DBF_LOCKDIR_VFPX -1
|
||||
#define DBF_LOCKDIR_CL53EXT 1
|
||||
#define DBF_LOCKDIR_XHB64 1
|
||||
|
||||
#define DBF_FLCKSIZE_CLIP 1000000000L
|
||||
#define DBF_FLCKSIZE_CL53 1000000000L
|
||||
#define DBF_FLCKSIZE_VFP 0x3ffffffdL
|
||||
#define DBF_FLCKSIZE_VFPX 0x07ffffffL
|
||||
#define DBF_FLCKSIZE_CLIP 1000000000UL
|
||||
#define DBF_FLCKSIZE_CL53 1000000000UL
|
||||
#define DBF_FLCKSIZE_VFP 0x3ffffffdUL
|
||||
#define DBF_FLCKSIZE_VFPX 0x07ffffffUL
|
||||
#define DBF_FLCKSIZE_CL53EXT 294967295UL
|
||||
#define DBF_FLCKSIZE_XHB64 0x7ffffffeUL
|
||||
|
||||
#define DBF_RLCKSIZE_CLIP 1L
|
||||
#define DBF_RLCKSIZE_CL53 1L
|
||||
#define DBF_RLCKSIZE_VFP 1L
|
||||
#define DBF_RLCKSIZE_VFPX 1L
|
||||
#define DBF_RLCKSIZE_CLIP 1UL
|
||||
#define DBF_RLCKSIZE_CL53 1UL
|
||||
#define DBF_RLCKSIZE_VFP 1UL
|
||||
#define DBF_RLCKSIZE_VFPX 1UL
|
||||
#define DBF_RLCKSIZE_CL53EXT 1UL
|
||||
#define DBF_RLCKSIZE_XHB64 1UL
|
||||
|
||||
#define IDX_LOCKPOS_CLIP 1000000000L
|
||||
#define IDX_LOCKPOS_CL53 0xfffeffffL
|
||||
#define IDX_LOCKPOS_VFP 0x7ffffffeL
|
||||
#define IDX_LOCKPOS_CLIP 1000000000UL
|
||||
#define IDX_LOCKPOS_CL53 0xfffeffffUL
|
||||
#define IDX_LOCKPOS_VFP 0x7ffffffeUL
|
||||
#define IDX_LOCKPOS_CL53EXT 0xfffeffffUL
|
||||
#define IDX_LOCKPOS_XHB64 HB_LL( 0x7FFFFFFF00000001 )
|
||||
|
||||
#define IDX_LOCKPOOL_CLIP 0UL
|
||||
#define IDX_LOCKPOOL_CL53 0x00010000UL
|
||||
#define IDX_LOCKPOOL_VFP 0UL
|
||||
#define IDX_LOCKPOOL_CL53EXT 0x00010000UL
|
||||
#define IDX_LOCKPOOL_XHB64 0UL
|
||||
|
||||
/*
|
||||
* Private DBF* RDD data kept in RDDNODE
|
||||
*/
|
||||
typedef struct _DBFDATA
|
||||
{
|
||||
char szTableExt[ HB_MAX_FILE_EXT + 1 ];
|
||||
char szIndexExt[ HB_MAX_FILE_EXT + 1 ];
|
||||
char szMemoExt[ HB_MAX_FILE_EXT + 1 ];
|
||||
|
||||
BYTE bLockType; //= 0;
|
||||
BYTE bTableType; //= DB_DBF_STD;
|
||||
BYTE bCryptType; //= DB_CRYPT_NONE;
|
||||
BYTE bMemoType; // = DB_MEMO_FPT;
|
||||
BYTE bMemoExtType;// = DB_MEMOVER_FLEX;
|
||||
USHORT uiMemoBlockSize; // = 0;
|
||||
} DBFDATA;
|
||||
|
||||
typedef DBFDATA * LPDBFDATA;
|
||||
|
||||
#define IDX_LOCKPOOL_CLIP 0L
|
||||
#define IDX_LOCKPOOL_CL53 0x00010000L
|
||||
#define IDX_LOCKPOOL_VFP 0L
|
||||
|
||||
#ifdef OS_UNIX_COMPATIBLE
|
||||
#define DBF_EXLUSIVE_LOCKPOS 0x7fffffffL
|
||||
#define DBF_EXLUSIVE_LOCKSIZE 1L
|
||||
#endif
|
||||
|
||||
/*
|
||||
* DBF WORKAREA
|
||||
@@ -138,43 +168,47 @@ typedef struct _DBFAREA
|
||||
* example.
|
||||
*/
|
||||
|
||||
FHANDLE hDataFile; /* Data file handle */
|
||||
FHANDLE hMemoFile; /* Memo file handle */
|
||||
USHORT uiHeaderLen; /* Size of header */
|
||||
USHORT uiRecordLen; /* Size of record */
|
||||
ULONG ulRecCount; /* Total records */
|
||||
char * szDataFileName; /* Name of data file */
|
||||
char * szMemoFileName; /* Name of memo file */
|
||||
USHORT uiMemoBlockSize; /* Size of memo block */
|
||||
BYTE bMemoType; /* MEMO type used in DBF memo fields */
|
||||
BOOL fHasMemo; /* WorkArea with Memo fields */
|
||||
BOOL fHasTags; /* WorkArea with MDX or CDX index */
|
||||
BOOL fDataFlush; /* data was written to DBF and not commited */
|
||||
BOOL fMemoFlush; /* data was written to MEMO and not commited */
|
||||
BYTE bVersion; /* DBF version ID byte */
|
||||
BYTE bCodePage; /* DBF codepage ID */
|
||||
BOOL fShared; /* Shared file */
|
||||
BOOL fReadonly; /* Read only file */
|
||||
USHORT * pFieldOffset; /* Pointer to field offset array */
|
||||
BYTE * pRecord; /* Buffer of record data */
|
||||
BOOL fValidBuffer; /* State of buffer */
|
||||
BOOL fPositioned; /* Positioned record */
|
||||
ULONG ulRecNo; /* Current record */
|
||||
BOOL fRecordChanged; /* Record changed */
|
||||
BOOL fAppend; /* TRUE if new record is added */
|
||||
BOOL fDeleted; /* TRUE if record is deleted */
|
||||
BOOL fUpdateHeader; /* Update header of file */
|
||||
BOOL fFLocked; /* TRUE if file is locked */
|
||||
BOOL fHeaderLocked; /* TRUE if DBF header is locked */
|
||||
LPDBRELINFO lpdbPendingRel; /* Pointer to parent rel struct */
|
||||
BYTE bYear; /* Last update */
|
||||
BYTE bMonth;
|
||||
BYTE bDay;
|
||||
BYTE bLockType; /* Type of locking shemes */
|
||||
ULONG * pLocksPos; /* List of records locked */
|
||||
ULONG ulNumLocksPos; /* Number of records locked */
|
||||
FHANDLE hDataFile; /* Data file handle */
|
||||
FHANDLE hMemoFile; /* Memo file handle */
|
||||
char * szDataFileName; /* Name of data file */
|
||||
char * szMemoFileName; /* Name of memo file */
|
||||
USHORT uiHeaderLen; /* Size of header */
|
||||
USHORT uiRecordLen; /* Size of record */
|
||||
USHORT uiMemoBlockSize; /* Size of memo block */
|
||||
USHORT uiMemoVersion; /* MEMO file version */
|
||||
DBFHEADER dbfHeader; /* DBF header buffer */
|
||||
BYTE bTableType; /* DBF type */
|
||||
BYTE bMemoType; /* MEMO type used in DBF memo fields */
|
||||
BYTE bLockType; /* Type of locking shemes */
|
||||
BYTE bCryptType; /* Type of used encryption */
|
||||
USHORT * pFieldOffset; /* Pointer to field offset array */
|
||||
BYTE * pRecord; /* Buffer of record data */
|
||||
ULONG ulRecCount; /* Total records */
|
||||
ULONG ulRecNo; /* Current record */
|
||||
BOOL fAutoInc; /* WorkArea with auto increment fields */
|
||||
BOOL fHasMemo; /* WorkArea with Memo fields */
|
||||
BOOL fHasTags; /* WorkArea with MDX or CDX index */
|
||||
BOOL fDataFlush; /* data was written to DBF and not commited */
|
||||
BOOL fMemoFlush; /* data was written to MEMO and not commited */
|
||||
BOOL fShared; /* Shared file */
|
||||
BOOL fReadonly; /* Read only file */
|
||||
BOOL fValidBuffer; /* State of buffer */
|
||||
BOOL fPositioned; /* Positioned record */
|
||||
BOOL fRecordChanged; /* Record changed */
|
||||
BOOL fAppend; /* TRUE if new record is added */
|
||||
BOOL fDeleted; /* TRUE if record is deleted */
|
||||
BOOL fEncrypted; /* TRUE if record is encrypted */
|
||||
BOOL fTableEncrypted; /* TRUE if table is encrypted */
|
||||
BOOL fUpdateHeader; /* Update header of file */
|
||||
BOOL fFLocked; /* TRUE if file is locked */
|
||||
BOOL fHeaderLocked; /* TRUE if DBF header is locked */
|
||||
LPDBRELINFO lpdbPendingRel; /* Pointer to parent rel struct */
|
||||
ULONG * pLocksPos; /* List of records locked */
|
||||
ULONG ulNumLocksPos; /* Number of records locked */
|
||||
BYTE * pCryptKey; /* Pointer to encryption key */
|
||||
PHB_DYNS pTriggerSym; /* DynSym pointer to trigger function */
|
||||
#ifndef HB_CDP_SUPPORT_OFF
|
||||
PHB_CODEPAGE cdPage; /* Area's codepage pointer */
|
||||
PHB_CODEPAGE cdPage; /* Area's codepage pointer */
|
||||
#endif
|
||||
} DBFAREA;
|
||||
|
||||
@@ -223,7 +257,8 @@ static ERRCODE hb_dbfPutValue( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem );
|
||||
static ERRCODE hb_dbfRecall( DBFAREAP pArea );
|
||||
static ERRCODE hb_dbfRecCount( DBFAREAP pArea, ULONG * pRecCount );
|
||||
static ERRCODE hb_dbfRecInfo( DBFAREAP pArea, PHB_ITEM pRecID, USHORT uiInfoType, PHB_ITEM pInfo );
|
||||
static ERRCODE hb_dbfRecNo( DBFAREAP pArea, PHB_ITEM pRecNo );
|
||||
static ERRCODE hb_dbfRecNo( DBFAREAP pArea, ULONG * pRecNo );
|
||||
static ERRCODE hb_dbfRecId( DBFAREAP pArea, PHB_ITEM pRecNo );
|
||||
static ERRCODE hb_dbfSetFieldExtent( DBFAREAP pArea, USHORT uiFieldExtent );
|
||||
#define hb_dbfAlias NULL
|
||||
static ERRCODE hb_dbfClose( DBFAREAP pArea );
|
||||
@@ -236,10 +271,10 @@ static ERRCODE hb_dbfStructSize( DBFAREAP pArea, USHORT * uiSize );
|
||||
static ERRCODE hb_dbfSysName( DBFAREAP pArea, BYTE * pBuffer );
|
||||
#define hb_dbfEval NULL
|
||||
static ERRCODE hb_dbfPack( DBFAREAP pArea );
|
||||
#define hb_dbfPackRec NULL
|
||||
static ERRCODE hb_dbfPackRec( DBFAREAP pArea, ULONG ulRecNo, BOOL *fWritten );
|
||||
static ERRCODE hb_dbfSort( DBFAREAP pArea, LPDBSORTINFO pSortInfo );
|
||||
static ERRCODE hb_dbfTrans( DBFAREAP pArea, LPDBTRANSINFO pTransInfo );
|
||||
static ERRCODE hb_dbfTransRec( DBFAREAP pArea, LPDBTRANSINFO pTransInfo );
|
||||
#define hb_dbfTransRec NULL
|
||||
static ERRCODE hb_dbfZap( DBFAREAP pArea );
|
||||
static ERRCODE hb_dbfChildEnd( DBFAREAP pArea, LPDBRELINFO pRelInfo );
|
||||
static ERRCODE hb_dbfChildStart( DBFAREAP pArea, LPDBRELINFO pRelInfo );
|
||||
@@ -270,33 +305,44 @@ static ERRCODE hb_dbfSetFilter( DBFAREAP pArea, LPDBFILTERINFO pFilterInfo );
|
||||
#define hb_dbfSetLocate NULL
|
||||
#define hb_dbfSetScope NULL
|
||||
#define hb_dbfSkipScope NULL
|
||||
#define hb_dbfLocate NULL
|
||||
#define hb_dbfCompile NULL
|
||||
#define hb_dbfError NULL
|
||||
#define hb_dbfEvalBlock NULL
|
||||
static ERRCODE hb_dbfRawLock( DBFAREAP pArea, USHORT uiAction, ULONG lRecNo );
|
||||
static ERRCODE hb_dbfLock( DBFAREAP pArea, LPDBLOCKINFO pLockInfo );
|
||||
static ERRCODE hb_dbfUnLock( DBFAREAP pArea, ULONG ulRecNo );
|
||||
static ERRCODE hb_dbfUnLock( DBFAREAP pArea, PHB_ITEM pRecNo );
|
||||
#define hb_dbfCloseMemFile NULL
|
||||
static ERRCODE hb_dbfCreateMemFile( DBFAREAP pArea, LPDBOPENINFO pCreateInfo );
|
||||
#define hb_dbfGetValueFile NULL
|
||||
static ERRCODE hb_dbfGetValueFile( DBFAREAP pArea, USHORT uiIndex, BYTE * szFile, USHORT uiMode );
|
||||
static ERRCODE hb_dbfOpenMemFile( DBFAREAP pArea, LPDBOPENINFO pOpenInfo );
|
||||
#define hb_dbfPutValueFile NULL
|
||||
static ERRCODE hb_dbfPutValueFile( DBFAREAP pArea, USHORT uiIndex, BYTE * szFile, USHORT uiMode );
|
||||
|
||||
static ERRCODE hb_dbfReadDBHeader( DBFAREAP pArea );
|
||||
static ERRCODE hb_dbfWriteDBHeader( DBFAREAP pArea );
|
||||
|
||||
#define hb_dbfExit NULL
|
||||
static ERRCODE hb_dbfDrop( PHB_ITEM pItemTable );
|
||||
static ERRCODE hb_dbfInit( LPRDDNODE pRDD );
|
||||
static ERRCODE hb_dbfExit( LPRDDNODE pRDD );
|
||||
static ERRCODE hb_dbfDrop( LPRDDNODE pRDD, PHB_ITEM pItemTable, PHB_ITEM pItemIndex );
|
||||
static ERRCODE hb_dbfExists( LPRDDNODE pRDD, PHB_ITEM pItemTable, PHB_ITEM pItemIndex );
|
||||
static ERRCODE hb_dbfRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, PHB_ITEM pItem );
|
||||
|
||||
#define hb_dbfWhoCares NULL
|
||||
|
||||
#endif /* HB_EXTERNAL_RDDDBF_USE */
|
||||
|
||||
extern BOOL HB_EXPORT hb_dbfExists( PHB_ITEM pItemTable, PHB_ITEM pItemIndex );
|
||||
extern ULONG HB_EXPORT hb_dbfGetMemoBlock( DBFAREAP pArea, USHORT uiIndex );
|
||||
extern void HB_EXPORT hb_dbfPutMemoBlock( DBFAREAP pArea, USHORT uiIndex, ULONG ulBlock );
|
||||
extern ULONG HB_EXPORT hb_dbfGetMemoBlock( DBFAREAP pArea, USHORT uiIndex );
|
||||
extern void HB_EXPORT hb_dbfPutMemoBlock( DBFAREAP pArea, USHORT uiIndex,
|
||||
ULONG ulBlock );
|
||||
extern ERRCODE HB_EXPORT hb_dbfGetMemoData( DBFAREAP pArea, USHORT uiIndex,
|
||||
ULONG * pulBlock, ULONG * pulSize,
|
||||
ULONG * pulType );
|
||||
extern ERRCODE HB_EXPORT hb_dbfSetMemoData( DBFAREAP pArea, USHORT uiIndex,
|
||||
ULONG ulBlock, ULONG ulSize,
|
||||
ULONG ulType );
|
||||
extern ERRCODE HB_EXPORT hb_dbfGetEGcode( ERRCODE errCode );
|
||||
extern BOOL HB_EXPORT hb_dbfLockIdxFile( FHANDLE hFile, BYTE bScheme, USHORT usMode, ULONG *pPoolPos );
|
||||
extern BOOL HB_EXPORT hb_dbfLockIdxGetData( BYTE bScheme, ULONG *ulPos, ULONG *ulPool );
|
||||
extern BOOL HB_EXPORT hb_dbfLockIdxFile( FHANDLE hFile, BYTE bScheme, USHORT usMode, HB_FOFFSET *pPoolPos );
|
||||
extern BOOL HB_EXPORT hb_dbfLockIdxGetData( BYTE bScheme, HB_FOFFSET *ulPos, HB_FOFFSET *ulPool );
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ HB_EXTERN_BEGIN
|
||||
/* MEMO constants and defaults */
|
||||
#define DBT_MEMOEXT ".dbt"
|
||||
#define DBT_BLOCKSIZE 512
|
||||
#define DBT_LOCKPOS 0x00000001L
|
||||
#define DBT_LOCKSIZE 0x7FFFFFFFL
|
||||
#define DBT_LOCKPOS 0x00000000L
|
||||
#define DBT_LOCKSIZE 0x00000001L
|
||||
|
||||
/*
|
||||
* DBFDBT WORKAREA
|
||||
@@ -124,6 +124,7 @@ static ERRCODE hb_dbtPutValue( DBTAREAP pArea, USHORT uiIndex, PHB_ITEM pItem );
|
||||
#define hb_dbtRecCount NULL
|
||||
#define hb_dbtRecInfo NULL
|
||||
#define hb_dbtRecNo NULL
|
||||
#define hb_dbtRecId NULL
|
||||
#define hb_dbtSetFieldExtent NULL
|
||||
#define hb_dbtAlias NULL
|
||||
#define hb_dbtClose NULL
|
||||
@@ -170,6 +171,7 @@ static ERRCODE hb_dbtSysName( DBTAREAP pArea, BYTE * pBuffer );
|
||||
#define hb_dbtSetLocate NULL
|
||||
#define hb_dbtSetScope NULL
|
||||
#define hb_dbtSkipScope NULL
|
||||
#define hb_dbtLocate NULL
|
||||
#define hb_dbtCompile NULL
|
||||
#define hb_dbtError NULL
|
||||
#define hb_dbtEvalBlock NULL
|
||||
@@ -181,11 +183,13 @@ static ERRCODE hb_dbtCreateMemFile( DBTAREAP pArea, LPDBOPENINFO pCreateInfo );
|
||||
#define hb_dbtGetValueFile NULL
|
||||
static ERRCODE hb_dbtOpenMemFile( DBTAREAP pArea, LPDBOPENINFO pOpenInfo );
|
||||
#define hb_dbtPutValueFile NULL
|
||||
static ERRCODE hb_dbtReadDBHeader( DBTAREAP pArea );
|
||||
static ERRCODE hb_dbtWriteDBHeader( DBTAREAP pArea );
|
||||
#define hb_dbtReadDBHeader NULL
|
||||
#define hb_dbtWriteDBHeader NULL
|
||||
#define hb_dbtInit NULL
|
||||
#define hb_dbtExit NULL
|
||||
#define hb_dbtDrop NULL
|
||||
#define hb_dbtExists NULL
|
||||
static ERRCODE hb_dbtRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, PHB_ITEM pItem );
|
||||
#define hb_dbtWhoCares NULL
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
@@ -93,6 +93,7 @@ HB_EXTERN_BEGIN
|
||||
#define hb_delimRecCount NULL
|
||||
#define hb_delimRecInfo NULL
|
||||
#define hb_delimRecNo NULL
|
||||
#define hb_delimRecId NULL
|
||||
#define hb_delimSetFieldExtent NULL
|
||||
#define hb_delimAlias NULL
|
||||
#define hb_delimClose NULL
|
||||
@@ -139,6 +140,7 @@ HB_EXTERN_BEGIN
|
||||
#define hb_delimSetLocate NULL
|
||||
#define hb_delimSetScope NULL
|
||||
#define hb_delimSkipScope NULL
|
||||
#define hb_delimLocate NULL
|
||||
#define hb_delimCompile NULL
|
||||
#define hb_delimError NULL
|
||||
#define hb_delimEvalBlock NULL
|
||||
@@ -152,9 +154,11 @@ HB_EXTERN_BEGIN
|
||||
#define hb_delimPutValueFile NULL
|
||||
#define hb_delimReadDBHeader NULL
|
||||
#define hb_delimWriteDBHeader NULL
|
||||
#define hb_delimInit NULL
|
||||
#define hb_delimExit NULL
|
||||
#define hb_delimDrop NULL
|
||||
#define hb_delimExists NULL
|
||||
#define hb_delimRddInfo NULL
|
||||
#define hb_delimWhoCares NULL
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
@@ -66,24 +66,43 @@
|
||||
HB_EXTERN_BEGIN
|
||||
|
||||
/* MEMO constants and defaults */
|
||||
#define DBT_MEMOEXT ".dbt"
|
||||
#define FPT_MEMOEXT ".fpt"
|
||||
#define FPT_LOCKPOS 0x00000000L
|
||||
#define FPT_LOCKSIZE 0x7FFFFFFFL
|
||||
#define SMT_MEMOEXT ".smt"
|
||||
#define DBT_DEFBLOCKSIZE 512
|
||||
#define FPT_DEFBLOCKSIZE 64
|
||||
#define SMT_DEFBLOCKSIZE 32
|
||||
|
||||
#define FPT_LOCKPOS 0x00000000L
|
||||
#define FPT_LOCKSIZE 0x00000001L
|
||||
|
||||
#define SIX_ITEM_BUFSIZE 14
|
||||
#define FLEX_ITEM_BUFSIZE 8
|
||||
#define MAX_SIXFREEBLOCKS 82
|
||||
#define MAX_FLEXFREEBLOCKS 126
|
||||
#define FLEXGCPAGE_SIZE 1010
|
||||
|
||||
/* usMemoType */
|
||||
#define MEMO_DBT 1
|
||||
#define MEMO_FPT_HB 2
|
||||
#define MEMO_FPT_SIX 3
|
||||
#define MEMO_FPT_SIXHB 4
|
||||
#define MEMO_FPT_FLEX 5
|
||||
#define MEMO_FPT_CLIP 6
|
||||
/* "V" filed types */
|
||||
#define HB_VF_CHAR 64000
|
||||
#define HB_VF_DATE 64001
|
||||
#define HB_VF_INT 64002
|
||||
#define HB_VF_LOG 64003
|
||||
#define HB_VF_DNUM 64004
|
||||
#define HB_VF_ARRAY 64005
|
||||
#define HB_VF_BLOB 64006
|
||||
#define HB_VF_BLOBCOMPRESS 64007
|
||||
#define HB_VF_BLOBENCRYPT 64008
|
||||
|
||||
/* SMT types */
|
||||
#define SMT_IT_NIL 0
|
||||
#define SMT_IT_CHAR 1
|
||||
#define SMT_IT_INT 2
|
||||
#define SMT_IT_DOUBLE 3
|
||||
#define SMT_IT_DATE 4
|
||||
#define SMT_IT_LOGICAL 5
|
||||
#define SMT_IT_ARRAY 6
|
||||
|
||||
#define FPTIT_DUMMY 0xDEADBEAF
|
||||
#define FPTIT_BINARY 0x0000
|
||||
#define FPTIT_PICT 0x0000 /* Picture */
|
||||
#define FPTIT_TEXT 0x0001 /* Text */
|
||||
@@ -118,7 +137,13 @@ HB_EXTERN_BEGIN
|
||||
#define FPTIT_FLEX_ULONG 0x03F7 // 1015 *
|
||||
#define FPTIT_FLEX_DOUBLE 0x03F8 // 1016
|
||||
#define FPTIT_FLEX_LDOUBLE 0x03F9 // 1017 *
|
||||
#define FPTIT_FLEX_COMPCH 0x03FA // 1018 *
|
||||
#define FPTIT_FLEX_COMPRCH 0x03FA // 1018 *
|
||||
|
||||
/* Flex II types */
|
||||
#define FPTIT_FLEX_DBLITEM 0x2710 // 10000 14-bytes Clipper double item
|
||||
#define FPTIT_FLEX_LOGICAL 0x2711 // 10001 4-bytes logical value
|
||||
#define FPTIT_FLEX_NULSTR 0x2722 // 10002 empty string
|
||||
|
||||
|
||||
#define FPTIT_FLEXAR_NIL 0x00
|
||||
#define FPTIT_FLEXAR_STR 0x07
|
||||
@@ -138,24 +163,11 @@ HB_EXTERN_BEGIN
|
||||
#define FPTIT_FLEXAR_LONG2 0x20
|
||||
#define FPTIT_FLEXAR_ULONG 0x21
|
||||
|
||||
/*
|
||||
#define HB_IT_NIL ( ( USHORT ) 0x0000 )
|
||||
#define HB_IT_POINTER ( ( USHORT ) 0x0001 )
|
||||
#define HB_IT_LONGLONG ( ( USHORT ) 0x0040 )
|
||||
#define HB_IT_SYMBOL ( ( USHORT ) 0x0100 )
|
||||
#define HB_IT_ALIAS ( ( USHORT ) 0x0200 )
|
||||
#define HB_IT_BLOCK ( ( USHORT ) 0x1000 )
|
||||
#define HB_IT_BYREF ( ( USHORT ) 0x2000 )
|
||||
#define HB_IT_MEMVAR ( ( USHORT ) 0x4000 )
|
||||
#define HB_IT_ANY ( ( USHORT ) 0xFFFF )
|
||||
*/
|
||||
|
||||
/* MEMO file strucutres */
|
||||
typedef struct _FPTHEADER
|
||||
{
|
||||
BYTE nextBlock[ 4 ]; /* Next free block in the file */
|
||||
BYTE reserved1[ 2 ]; /* */
|
||||
BYTE blockSize[ 2 ]; /* Size of block */
|
||||
BYTE blockSize[ 4 ]; /* Size of block */
|
||||
BYTE signature1[ 10 ]; /* Signature: "SixMemo", "Harbour", "Made by CLIP"-overwrites next bytes*/
|
||||
BYTE nGCitems[ 2 ]; /* number of GC items in reserved2 (max 82)*/
|
||||
BYTE reserved2[ 492 ]; /* */
|
||||
@@ -191,6 +203,7 @@ typedef struct _MEMOGCTABLE
|
||||
BYTE bType; /* MEMO_FPT_SIX or MEMO_FPT_FLEX */
|
||||
BYTE bChanged; /* Should we write GC data to disk */
|
||||
ULONG ulNextBlock; /* Next free block in the file */
|
||||
ULONG ulPrevBlock; /* Previous next free block in the file */
|
||||
ULONG ulRevPage; /* FLEX Rev GC page offset */
|
||||
ULONG ulDirPage; /* FLEX Dir GC page offset */
|
||||
ULONG ulCounter; /* FLEX cyclic counter */
|
||||
@@ -255,6 +268,7 @@ static ERRCODE hb_fptPutValue( FPTAREAP pArea, USHORT uiIndex, PHB_ITEM pItem );
|
||||
#define hb_fptRecCount NULL
|
||||
#define hb_fptRecInfo NULL
|
||||
#define hb_fptRecNo NULL
|
||||
#define hb_fptRecId NULL
|
||||
#define hb_fptSetFieldExtent NULL
|
||||
#define hb_fptAlias NULL
|
||||
#define hb_fptClose NULL
|
||||
@@ -301,6 +315,7 @@ static ERRCODE hb_fptSysName( FPTAREAP pArea, BYTE * pBuffer );
|
||||
#define hb_fptSetLocate NULL
|
||||
#define hb_fptSetScope NULL
|
||||
#define hb_fptSkipScope NULL
|
||||
#define hb_fptLocate NULL
|
||||
#define hb_fptCompile NULL
|
||||
#define hb_fptError NULL
|
||||
#define hb_fptEvalBlock NULL
|
||||
@@ -309,14 +324,16 @@ static ERRCODE hb_fptSysName( FPTAREAP pArea, BYTE * pBuffer );
|
||||
#define hb_fptUnLock NULL
|
||||
#define hb_fptCloseMemFile NULL
|
||||
static ERRCODE hb_fptCreateMemFile( FPTAREAP pArea, LPDBOPENINFO pCreateInfo );
|
||||
#define hb_fptGetValueFile NULL
|
||||
static ERRCODE hb_fptGetValueFile( FPTAREAP pArea, USHORT uiIndex, BYTE * szFile, USHORT uiMode );
|
||||
static ERRCODE hb_fptOpenMemFile( FPTAREAP pArea, LPDBOPENINFO pOpenInfo );
|
||||
#define hb_fptPutValueFile NULL
|
||||
static ERRCODE hb_fptReadDBHeader( FPTAREAP pArea );
|
||||
static ERRCODE hb_fptWriteDBHeader( FPTAREAP pArea );
|
||||
static ERRCODE hb_fptPutValueFile( FPTAREAP pArea, USHORT uiIndex, BYTE * szFile, USHORT uiMode );
|
||||
#define hb_fptReadDBHeader NULL
|
||||
#define hb_fptWriteDBHeader NULL
|
||||
#define hb_fptInit NULL
|
||||
#define hb_fptExit NULL
|
||||
#define hb_fptDrop NULL
|
||||
#define hb_fptExists NULL
|
||||
static ERRCODE hb_fptRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, PHB_ITEM pItem );
|
||||
#define hb_fptWhoCares NULL
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
@@ -58,24 +58,106 @@
|
||||
#ifndef HB_CDP_SUPPORT_OFF
|
||||
#include "hbapicdp.h"
|
||||
#endif
|
||||
#define HB_EXTERNAL_RDDDBF_USE
|
||||
#include "hbrdddbf.h"
|
||||
|
||||
HB_EXTERN_BEGIN
|
||||
|
||||
/* DBFNTX default extensions */
|
||||
#define NTX_INDEXEXT ".ntx"
|
||||
#define NTX_INDEXEXT ".ntx"
|
||||
|
||||
/* DBFNTX constants declarations */
|
||||
|
||||
#define TOP_RECORD 1
|
||||
#define BTTM_RECORD 2
|
||||
#define PREV_RECORD 3
|
||||
#define NEXT_RECORD 4
|
||||
#define NTX_IGNORE_REC_NUM 0x0UL
|
||||
#define NTX_MAX_REC_NUM 0xFFFFFFFFUL
|
||||
|
||||
#define NTX_DUMMYNODE 0xFFFFFFFFUL
|
||||
|
||||
#define NTX_FLAG_DEFALUT 0x0006
|
||||
#define NTX_FLAG_OLDDEFALUT 0x0003
|
||||
#define NTX_FLAG_FORITEM 0x0001
|
||||
#define NTX_FLAG_PARTIAL 0x0008
|
||||
#define NTX_FLAG_EXTLOCK 0x0010
|
||||
#define NTX_FLAG_CUSTOM 0x0020
|
||||
#define NTX_FLAG_CHGONLY 0x0040
|
||||
#define NTX_FLAG_TEMPLATE 0x0080
|
||||
#define NTX_FLAG_SORTRECNO 0x0100
|
||||
#define NTX_FLAG_LARGEFILE 0x0200
|
||||
#define NTX_FLAG_MULTIKEY 0x0400
|
||||
#define NTX_FLAG_COMPOUND 0x8000
|
||||
#define NTX_FLAG_MASK 0x87FF
|
||||
|
||||
#define CTX_MAX_TAGS 63
|
||||
|
||||
#define NTX_MAX_KEY 256 /* Max len of key */
|
||||
#define NTX_MAX_EXP 256 /* Max len of KEY/FOR expression */
|
||||
#define NTXBLOCKBITS 10 /* Size of NTX block in bits */
|
||||
#define NTXBLOCKSIZE (1<<NTXBLOCKBITS) /* Size of block in NTX file */
|
||||
#define NTX_MAX_TAGNAME 10 /* Max len of tag name */
|
||||
#define NTX_TAGITEMSIZE 16 /* Size of tag item in CTX header */
|
||||
#define NTX_HDR_UNUSED 473 /* the unused part of header */
|
||||
#define NTX_PAGES_PER_TAG 8
|
||||
#define NTX_STACKSIZE 32 /* Maximum page stack size */
|
||||
|
||||
/* index file structures - defined as BYTEs to avoid alignment problems */
|
||||
|
||||
typedef struct _NTXHEADER /* Header of NTX file */
|
||||
{
|
||||
BYTE type[2];
|
||||
BYTE version[2];
|
||||
BYTE root[4];
|
||||
BYTE next_page[4];
|
||||
BYTE item_size[2];
|
||||
BYTE key_size[2];
|
||||
BYTE key_dec[2];
|
||||
BYTE max_item[2];
|
||||
BYTE half_page[2];
|
||||
BYTE key_expr[ NTX_MAX_EXP ];
|
||||
BYTE unique[1];
|
||||
BYTE unknown1[1];
|
||||
BYTE descend[1];
|
||||
BYTE unknown2[1];
|
||||
BYTE for_expr[ NTX_MAX_EXP ];
|
||||
BYTE tag_name[ NTX_MAX_TAGNAME + 2 ];
|
||||
BYTE custom[1];
|
||||
BYTE unused[ NTX_HDR_UNUSED ];
|
||||
} NTXHEADER;
|
||||
typedef NTXHEADER * LPNTXHEADER;
|
||||
|
||||
typedef struct _CTXTAGITEM /* TAG item in compound NTX (CTX) header */
|
||||
{
|
||||
BYTE tag_name[ NTX_MAX_TAGNAME + 2 ];
|
||||
BYTE tag_header[ 4 ];
|
||||
} CTXTAGITEM;
|
||||
typedef CTXTAGITEM * LPCTXTAGITEM;
|
||||
|
||||
typedef struct _CTXHEADER /* Header of xHarbour CTX file */
|
||||
{
|
||||
BYTE type[ 2 ]; /* 0x9591 LE */
|
||||
BYTE ntags[ 2 ]; /* number of tag entries MAX63 */
|
||||
BYTE version[ 4 ]; /* update counter LE */
|
||||
BYTE freepage[ 4 ]; /* first free page in index file */
|
||||
BYTE filesize[ 4 ]; /* size of index file in pages */
|
||||
BYTE tags[ CTX_MAX_TAGS * NTX_TAGITEMSIZE ];
|
||||
} CTXHEADER;
|
||||
typedef CTXHEADER * LPCTXHEADER;
|
||||
|
||||
#if 0
|
||||
/* original CLIP CTX file header - for information only it's binary
|
||||
compatible so both RDD can read the same file but it's not safe
|
||||
to use CLIP for writing when the file is open by xHarbour.
|
||||
In spare time I'll update CLIP to respect my extensions and send
|
||||
patches to Rust - hope they will be included in CLIP.
|
||||
*/
|
||||
typedef struct _CTXHEADER /* Header of CLIP CTX file */
|
||||
{
|
||||
BYTE type[ 2 ]; /* 0x9591 in LE */
|
||||
BYTE ntags[ 1 ]; /* number of tag entries */
|
||||
BYTE unused[ 13 ];
|
||||
CTX_TAG tags[ 63 ];
|
||||
} CTXHEADER
|
||||
#endif
|
||||
|
||||
#define NTX_MAX_KEY 256 /* Max len of key */
|
||||
#define NTXBLOCKSIZE 1024 /* Size of block in NTX file */
|
||||
#define NTX_MAX_TAGNAME 12 /* Max len of tag name */
|
||||
#define NTX_LOCK_OFFSET 1000000000
|
||||
#define NTX_PAGES_PER_TAG 32
|
||||
|
||||
/* forward declarations
|
||||
*/
|
||||
@@ -86,137 +168,171 @@ struct _NTXINDEX;
|
||||
|
||||
typedef struct _KEYINFO
|
||||
{
|
||||
/* PHB_ITEM pItem; */
|
||||
LONG Tag;
|
||||
LONG Xtra;
|
||||
char key[ 1 ]; /* value of key */
|
||||
ULONG Tag; /* page number */
|
||||
ULONG Xtra; /* record number */
|
||||
char key[ 1 ]; /* key value */
|
||||
} KEYINFO;
|
||||
|
||||
typedef KEYINFO * LPKEYINFO;
|
||||
|
||||
typedef struct _TREE_STACK
|
||||
{
|
||||
LONG page;
|
||||
ULONG page;
|
||||
SHORT ikey;
|
||||
} TREE_STACK;
|
||||
|
||||
typedef TREE_STACK * LPTREESTACK;
|
||||
|
||||
typedef struct HB_PAGEINFO_STRU
|
||||
typedef struct _HB_PAGEINFO
|
||||
{
|
||||
LONG Page;
|
||||
BOOL Changed;
|
||||
BOOL lBusy;
|
||||
USHORT uiKeys;
|
||||
SHORT CurKey;
|
||||
char* buffer;
|
||||
ULONG Page;
|
||||
BOOL Changed;
|
||||
int iUsed;
|
||||
USHORT uiKeys;
|
||||
struct _HB_PAGEINFO * pNext;
|
||||
struct _HB_PAGEINFO * pPrev;
|
||||
#ifdef HB_NTX_EXTERNAL_PAGEBUFFER
|
||||
char * buffer;
|
||||
#else
|
||||
char buffer[ NTXBLOCKSIZE ];
|
||||
#endif
|
||||
} HB_PAGEINFO;
|
||||
|
||||
typedef HB_PAGEINFO * LPPAGEINFO;
|
||||
|
||||
typedef struct _HB_NTXSCOPE
|
||||
{
|
||||
PHB_ITEM scopeItem;
|
||||
LPKEYINFO scopeKey;
|
||||
USHORT scopeKeyLen;
|
||||
} HB_NTXSCOPE;
|
||||
typedef HB_NTXSCOPE * PHB_NTXSCOPE;
|
||||
|
||||
typedef struct _TAGINFO
|
||||
{
|
||||
char * TagName;
|
||||
LONG TagRoot;
|
||||
char * KeyExpr;
|
||||
char * ForExpr;
|
||||
PHB_ITEM pKeyItem;
|
||||
PHB_ITEM pForItem;
|
||||
PHB_ITEM topScope;
|
||||
PHB_ITEM bottomScope;
|
||||
BOOL fTagName;
|
||||
BOOL AscendKey;
|
||||
BOOL UniqueKey;
|
||||
BOOL Custom;
|
||||
BOOL TagChanged;
|
||||
BOOL TagBOF;
|
||||
BOOL TagEOF;
|
||||
BOOL NewRoot;
|
||||
BOOL Memory;
|
||||
BYTE KeyType;
|
||||
BYTE OptFlags;
|
||||
LONG TagBlock;
|
||||
LONG RootBlock;
|
||||
USHORT nField;
|
||||
USHORT KeyLength;
|
||||
USHORT KeyDec;
|
||||
USHORT MaxKeys;
|
||||
LPTREESTACK stack;
|
||||
USHORT stackDepth;
|
||||
USHORT stackLevel;
|
||||
ULONG keyCount;
|
||||
ULONG ulPagesDepth;
|
||||
ULONG ulPages;
|
||||
ULONG ulPagesStart;
|
||||
LPKEYINFO CurKeyInfo;
|
||||
LPPAGEINFO pages;
|
||||
BOOL InIndex;
|
||||
char* buffer;
|
||||
struct _NTXINDEX * Owner;
|
||||
struct _TAGINFO * pNext;
|
||||
} TAGINFO;
|
||||
char * TagName;
|
||||
char * KeyExpr;
|
||||
char * ForExpr;
|
||||
PHB_ITEM pKeyItem;
|
||||
PHB_ITEM pForItem;
|
||||
HB_NTXSCOPE top;
|
||||
HB_NTXSCOPE bottom;
|
||||
|
||||
BOOL fTagName; /* remove */
|
||||
BOOL fUsrDescend;
|
||||
BOOL AscendKey;
|
||||
BOOL UniqueKey;
|
||||
|
||||
BOOL Signature;
|
||||
|
||||
BOOL Custom;
|
||||
BOOL ChgOnly;
|
||||
BOOL Partial;
|
||||
BOOL Template;
|
||||
BOOL MultiKey;
|
||||
BOOL fSortRec;
|
||||
|
||||
BOOL HdrChanged;
|
||||
BOOL TagBOF;
|
||||
BOOL TagEOF;
|
||||
ULONG HeadBlock;
|
||||
ULONG RootBlock;
|
||||
USHORT uiNumber;
|
||||
BYTE KeyType;
|
||||
USHORT nField;
|
||||
USHORT KeyLength;
|
||||
USHORT KeyDec;
|
||||
USHORT MaxKeys;
|
||||
LPTREESTACK stack;
|
||||
USHORT stackSize;
|
||||
USHORT stackLevel;
|
||||
ULONG keyCount;
|
||||
LPKEYINFO CurKeyInfo;
|
||||
LPKEYINFO HotKeyInfo;
|
||||
BOOL HotFor;
|
||||
|
||||
struct _NTXINDEX * Owner;
|
||||
} TAGINFO;
|
||||
typedef TAGINFO * LPTAGINFO;
|
||||
|
||||
typedef struct _NTXINDEX
|
||||
{
|
||||
char * IndexName;
|
||||
BOOL Locked;
|
||||
LONG NextAvail;
|
||||
struct _NTXAREA * Owner;
|
||||
FHANDLE DiskFile;
|
||||
BOOL fFlush;
|
||||
LPTAGINFO CompoundTag;
|
||||
struct _NTXINDEX * pNext; /* The next index in the list */
|
||||
} NTXINDEX;
|
||||
char * IndexName;
|
||||
char * RealName;
|
||||
ULONG Version; /* The index VERSION filed to signal index updates for other stations */
|
||||
ULONG NextAvail;
|
||||
ULONG TagBlock; /* Index attr, next free page */
|
||||
struct _NTXAREA * Owner;
|
||||
FHANDLE DiskFile;
|
||||
BOOL fDelete; /* delete on close flag */
|
||||
BOOL fReadonly;
|
||||
BOOL fShared;
|
||||
BOOL fFlush;
|
||||
BOOL LargeFile;
|
||||
BOOL Changed;
|
||||
BOOL Update;
|
||||
BOOL Compound;
|
||||
BOOL Production; /* Production index */
|
||||
HB_FOFFSET ulLockPos; /* readlock position for CL53 lock scheme */
|
||||
int lockWrite; /* number of write lock set */
|
||||
int lockRead; /* number of read lock set */
|
||||
|
||||
BYTE * HeaderBuff; /* TODO: make it member */
|
||||
BOOL fValidHeader;
|
||||
int iTags;
|
||||
LPTAGINFO * lpTags;
|
||||
|
||||
ULONG ulPages;
|
||||
ULONG ulPageLast;
|
||||
ULONG ulPagesDepth;
|
||||
LPPAGEINFO *pages;
|
||||
LPPAGEINFO pChanged;
|
||||
LPPAGEINFO pFirst;
|
||||
LPPAGEINFO pLast;
|
||||
|
||||
struct _NTXINDEX * pNext; /* The next index in the list */
|
||||
} NTXINDEX;
|
||||
typedef NTXINDEX * LPNTXINDEX;
|
||||
|
||||
/* Internal structures used by saving file */
|
||||
|
||||
typedef struct _NTXHEADER /* Header of NTX file */
|
||||
/* for index creation */
|
||||
typedef struct
|
||||
{
|
||||
UINT16 type;
|
||||
UINT16 version;
|
||||
UINT32 root;
|
||||
UINT32 next_page;
|
||||
UINT16 item_size;
|
||||
UINT16 key_size;
|
||||
UINT16 key_dec;
|
||||
UINT16 max_item;
|
||||
UINT16 half_page;
|
||||
char key_expr[ NTX_MAX_KEY ];
|
||||
char unique;
|
||||
char unknown1;
|
||||
char descend;
|
||||
char unknown2;
|
||||
char for_expr[ NTX_MAX_KEY ];
|
||||
char tag_name[ NTX_MAX_TAGNAME ];
|
||||
char custom;
|
||||
} NTXHEADER;
|
||||
HB_FOFFSET nOffset; /* offset in temporary file */
|
||||
ULONG ulKeys; /* number of keys in page */
|
||||
ULONG ulKeyBuf; /* number of keys in memory buffer */
|
||||
ULONG ulCurKey; /* current key in memory buffer */
|
||||
BYTE * pKeyPool; /* memory buffer */
|
||||
} NTXSWAPPAGE;
|
||||
typedef NTXSWAPPAGE * LPNTXSWAPPAGE;
|
||||
|
||||
typedef NTXHEADER * LPNTXHEADER;
|
||||
|
||||
typedef struct _NTXBUFFER /* Header of each block in NTX file (only block
|
||||
with header has other format */
|
||||
typedef struct
|
||||
{
|
||||
UINT16 item_count;
|
||||
UINT16 item_offset[ 1 ];
|
||||
} NTXBUFFER;
|
||||
LPTAGINFO pTag; /* current Tag */
|
||||
FHANDLE hTempFile; /* handle to temporary file */
|
||||
char * szTempFileName; /* temporary file name */
|
||||
int keyLen; /* key length */
|
||||
BOOL fUnique; /* TRUE if index is unique */
|
||||
BOOL fReindex; /* TRUE if reindexing is in process */
|
||||
ULONG ulMaxRec; /* the highest record number */
|
||||
ULONG ulTotKeys; /* total number of keys indexed */
|
||||
ULONG ulKeys; /* keys in curently created page */
|
||||
ULONG ulPages; /* number of pages */
|
||||
ULONG ulCurPage; /* current page */
|
||||
ULONG ulPgKeys; /* maximum number of key in page memory buffer */
|
||||
ULONG ulMaxKey; /* maximum number of keys in single page */
|
||||
BYTE * pKeyPool; /* memory buffer for current page then for pages */
|
||||
BYTE * pStartKey; /* begining of key pool after sorting */
|
||||
LPNTXSWAPPAGE pSwapPage; /* list of pages */
|
||||
LPPAGEINFO NodeList[ NTX_STACKSIZE ]; /* Stack of pages */
|
||||
ULONG ulFirst;
|
||||
ULONG * pSortedPages;
|
||||
BYTE pLastKey[ NTX_MAX_KEY ]; /* last key val */
|
||||
ULONG ulLastRec;
|
||||
|
||||
typedef NTXBUFFER * LPNTXBUFFER;
|
||||
|
||||
typedef struct _NTXITEM /* each item in NTX block has following format */
|
||||
{
|
||||
UINT32 page; /* subpage (each key in subpage has < value like this key */
|
||||
UINT32 rec_no; /* RecNo of record with this key */
|
||||
char key[ 1 ]; /* value of key */
|
||||
} NTXITEM;
|
||||
|
||||
typedef NTXITEM * LPNTXITEM;
|
||||
|
||||
struct _NTXAREA;
|
||||
BYTE * pBuffIO; /* index IO buffer */
|
||||
ULONG ulSizeIO; /* size of IO buffer in index pages */
|
||||
ULONG ulPagesIO; /* number of index pages in buffer */
|
||||
ULONG ulFirstIO; /* first page in buffer */
|
||||
ULONG ulLastIO; /* last page in buffer */
|
||||
} NTXSORTINFO;
|
||||
typedef NTXSORTINFO * LPNTXSORTINFO;
|
||||
|
||||
/*
|
||||
* DBF WORKAREA
|
||||
@@ -258,43 +374,47 @@ typedef struct _NTXAREA
|
||||
* example.
|
||||
*/
|
||||
|
||||
FHANDLE hDataFile; /* Data file handle */
|
||||
FHANDLE hMemoFile; /* Memo file handle */
|
||||
USHORT uiHeaderLen; /* Size of header */
|
||||
USHORT uiRecordLen; /* Size of record */
|
||||
ULONG ulRecCount; /* Total records */
|
||||
char * szDataFileName; /* Name of data file */
|
||||
char * szMemoFileName; /* Name of memo file */
|
||||
USHORT uiMemoBlockSize; /* Size of memo block */
|
||||
BYTE bMemoType; /* MEMO type used in DBF memo fields */
|
||||
BOOL fHasMemo; /* WorkArea with Memo fields */
|
||||
BOOL fHasTags; /* WorkArea with MDX or CDX index */
|
||||
BOOL fDataFlush; /* data was written to DBF and not commited */
|
||||
BOOL fMemoFlush; /* data was written to MEMO and not commited */
|
||||
BYTE bVersion; /* DBF version ID byte */
|
||||
BYTE bCodePage; /* DBF codepage ID */
|
||||
BOOL fShared; /* Shared file */
|
||||
BOOL fReadonly; /* Read only file */
|
||||
USHORT * pFieldOffset; /* Pointer to field offset array */
|
||||
BYTE * pRecord; /* Buffer of record data */
|
||||
BOOL fValidBuffer; /* State of buffer */
|
||||
BOOL fPositioned; /* Positioned record */
|
||||
ULONG ulRecNo; /* Current record */
|
||||
BOOL fRecordChanged; /* Record changed */
|
||||
BOOL fAppend; /* TRUE if new record is added */
|
||||
BOOL fDeleted; /* TRUE if record is deleted */
|
||||
BOOL fUpdateHeader; /* Update header of file */
|
||||
BOOL fFLocked; /* TRUE if file is locked */
|
||||
BOOL fHeaderLocked; /* TRUE if DBF header is locked */
|
||||
LPDBRELINFO lpdbPendingRel; /* Pointer to parent rel struct */
|
||||
BYTE bYear; /* Last update */
|
||||
BYTE bMonth;
|
||||
BYTE bDay;
|
||||
BYTE bLockType; /* Type of locking shemes */
|
||||
ULONG * pLocksPos; /* List of records locked */
|
||||
ULONG ulNumLocksPos; /* Number of records locked */
|
||||
FHANDLE hDataFile; /* Data file handle */
|
||||
FHANDLE hMemoFile; /* Memo file handle */
|
||||
char * szDataFileName; /* Name of data file */
|
||||
char * szMemoFileName; /* Name of memo file */
|
||||
USHORT uiHeaderLen; /* Size of header */
|
||||
USHORT uiRecordLen; /* Size of record */
|
||||
USHORT uiMemoBlockSize; /* Size of memo block */
|
||||
USHORT uiMemoVersion; /* MEMO file version */
|
||||
DBFHEADER dbfHeader; /* DBF header buffer */
|
||||
BYTE bTableType; /* DBF type */
|
||||
BYTE bMemoType; /* MEMO type used in DBF memo fields */
|
||||
BYTE bLockType; /* Type of locking shemes */
|
||||
BYTE bCryptType; /* Type of used encryption */
|
||||
USHORT * pFieldOffset; /* Pointer to field offset array */
|
||||
BYTE * pRecord; /* Buffer of record data */
|
||||
ULONG ulRecCount; /* Total records */
|
||||
ULONG ulRecNo; /* Current record */
|
||||
BOOL fAutoInc; /* WorkArea with auto increment fields */
|
||||
BOOL fHasMemo; /* WorkArea with Memo fields */
|
||||
BOOL fHasTags; /* WorkArea with MDX or CDX index */
|
||||
BOOL fDataFlush; /* data was written to DBF and not commited */
|
||||
BOOL fMemoFlush; /* data was written to MEMO and not commited */
|
||||
BOOL fShared; /* Shared file */
|
||||
BOOL fReadonly; /* Read only file */
|
||||
BOOL fValidBuffer; /* State of buffer */
|
||||
BOOL fPositioned; /* Positioned record */
|
||||
BOOL fRecordChanged; /* Record changed */
|
||||
BOOL fAppend; /* TRUE if new record is added */
|
||||
BOOL fDeleted; /* TRUE if record is deleted */
|
||||
BOOL fEncrypted; /* TRUE if record is encrypted */
|
||||
BOOL fTableEncrypted; /* TRUE if table is encrypted */
|
||||
BOOL fUpdateHeader; /* Update header of file */
|
||||
BOOL fFLocked; /* TRUE if file is locked */
|
||||
BOOL fHeaderLocked; /* TRUE if DBF header is locked */
|
||||
LPDBRELINFO lpdbPendingRel; /* Pointer to parent rel struct */
|
||||
ULONG * pLocksPos; /* List of records locked */
|
||||
ULONG ulNumLocksPos; /* Number of records locked */
|
||||
BYTE * pCryptKey; /* Pointer to encryption key */
|
||||
PHB_DYNS pTriggerSym; /* DynSym pointer to trigger function */
|
||||
#ifndef HB_CDP_SUPPORT_OFF
|
||||
PHB_CODEPAGE cdPage; /* Area's codepage pointer */
|
||||
PHB_CODEPAGE cdPage; /* Area's codepage pointer */
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -305,12 +425,13 @@ typedef struct _NTXAREA
|
||||
* example.
|
||||
*/
|
||||
|
||||
LPTAGINFO lpCurTag; /* Pointer to current order */
|
||||
LPTAGINFO lpNtxTag; /* Pointer to tags list */
|
||||
BOOL fNtxAppend; /* TRUE if new record is added */
|
||||
BOOL fNtxAppend; /* TRUE if new record is added */
|
||||
BOOL fSetTagNumbers; /* Tag number should be recreated */
|
||||
LPNTXINDEX lpIndexes; /* Pointer to list of indexes */
|
||||
LPTAGINFO lpCurTag; /* Pointer to current order */
|
||||
LPNTXSORTINFO pSort; /* Index build structure */
|
||||
|
||||
} NTXAREA;
|
||||
|
||||
typedef NTXAREA * LPNTXAREA;
|
||||
|
||||
#ifndef NTXAREAP
|
||||
@@ -328,7 +449,7 @@ typedef NTXAREA * LPNTXAREA;
|
||||
#define ntxEof NULL
|
||||
#define ntxFound NULL
|
||||
static ERRCODE ntxGoBottom( NTXAREAP pArea );
|
||||
static ERRCODE ntxGoTo( NTXAREAP pArea, ULONG ulRecNo );
|
||||
#define ntxGoTo NULL
|
||||
#define ntxGoToId NULL
|
||||
static ERRCODE ntxGoTop( NTXAREAP pArea );
|
||||
static ERRCODE ntxSeek( NTXAREAP pArea, BOOL bSoftSeek, PHB_ITEM pKey, BOOL bFindLast );
|
||||
@@ -357,6 +478,7 @@ static ERRCODE ntxGoHot( NTXAREAP pArea );
|
||||
#define ntxRecCount NULL
|
||||
#define ntxRecInfo NULL
|
||||
#define ntxRecNo NULL
|
||||
#define ntxRecId NULL
|
||||
#define ntxSetFieldsExtent NULL
|
||||
#define ntxAlias NULL
|
||||
static ERRCODE ntxClose( NTXAREAP pArea );
|
||||
@@ -365,7 +487,7 @@ static ERRCODE ntxClose( NTXAREAP pArea );
|
||||
#define ntxCreate NULL
|
||||
#define ntxInfo NULL
|
||||
#define ntxNewArea NULL
|
||||
#define ntxOpen NULL
|
||||
static ERRCODE ntxOpen( NTXAREAP pArea, LPDBOPENINFO pOpenInfo );
|
||||
#define ntxRelease NULL
|
||||
static ERRCODE ntxStructSize( NTXAREAP pArea, USHORT * uiSize );
|
||||
static ERRCODE ntxSysName( NTXAREAP pArea, BYTE * pBuffer );
|
||||
@@ -387,28 +509,25 @@ static ERRCODE ntxZap( NTXAREAP pArea );
|
||||
#define ntxrelText NULL
|
||||
#define ntxsetRel NULL
|
||||
static ERRCODE ntxOrderListAdd( NTXAREAP pArea, LPDBORDERINFO pOrderInfo );
|
||||
/* Open next index */
|
||||
static ERRCODE ntxOrderListClear( NTXAREAP pArea );
|
||||
/* Close all indexes */
|
||||
#define ntxOrderListDelete NULL
|
||||
static ERRCODE ntxOrderListDelete( NTXAREAP pArea, LPDBORDERINFO pOrderInfo );
|
||||
static ERRCODE ntxOrderListFocus( NTXAREAP pArea, LPDBORDERINFO pOrderInfo );
|
||||
static ERRCODE ntxOrderListRebuild( NTXAREAP pArea );
|
||||
static ERRCODE ntxOrderCondition( NTXAREAP area, LPDBORDERCONDINFO pOrdCondInfo );
|
||||
#define ntxOrderCondition NULL
|
||||
static ERRCODE ntxOrderCreate( NTXAREAP pArea, LPDBORDERCREATEINFO pOrderInfo );
|
||||
/* Create new Index */
|
||||
#define ntxOrderDestroy NULL
|
||||
static ERRCODE ntxOrderDestroy( NTXAREAP pArea, LPDBORDERINFO pOrderInfo );
|
||||
static ERRCODE ntxOrderInfo( NTXAREAP pArea, USHORT uiIndex, LPDBORDERINFO pInfo );
|
||||
/* Some information about index */
|
||||
#define ntxClearFilter NULL
|
||||
#define ntxClearLocate NULL
|
||||
static ERRCODE ntxClearScope( NTXAREAP pArea );
|
||||
#define ntxCountScope NULL
|
||||
#define ntxClearScope NULL
|
||||
static ERRCODE ntxCountScope( NTXAREAP pArea, void * pPtr, LONG * plRecNo );
|
||||
#define ntxFilterText NULL
|
||||
static ERRCODE ntxScopeInfo( NTXAREAP pArea, USHORT nScope, PHB_ITEM pItem );
|
||||
#define ntxScopeInfo NULL
|
||||
#define ntxSetFilter NULL
|
||||
#define ntxSetLocate NULL
|
||||
static ERRCODE ntxSetScope( NTXAREAP pArea, LPDBORDSCOPEINFO sInfo );
|
||||
#define ntxSetScope NULL
|
||||
#define ntxSkipScope NULL
|
||||
#define ntxLocate NULL
|
||||
#define ntxCompile NULL
|
||||
#define ntxError NULL
|
||||
#define ntxEvalBlock NULL
|
||||
@@ -422,9 +541,11 @@ static ERRCODE ntxSetScope( NTXAREAP pArea, LPDBORDSCOPEINFO sInfo );
|
||||
#define ntxPutValueFile NULL
|
||||
#define ntxReadDBHeader NULL
|
||||
#define ntxWriteDBHeader NULL
|
||||
#define ntxInit NULL
|
||||
#define ntxExit NULL
|
||||
#define ntxDrop NULL
|
||||
#define ntxExists NULL
|
||||
static ERRCODE ntxRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, PHB_ITEM pItem );
|
||||
#define ntxWhoCares NULL
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
@@ -93,6 +93,7 @@ HB_EXTERN_BEGIN
|
||||
#define hb_sdfRecCount NULL
|
||||
#define hb_sdfRecInfo NULL
|
||||
#define hb_sdfRecNo NULL
|
||||
#define hb_sdfRecId NULL
|
||||
#define hb_sdfSetFieldExtent NULL
|
||||
#define hb_sdfAlias NULL
|
||||
#define hb_sdfClose NULL
|
||||
@@ -139,6 +140,7 @@ HB_EXTERN_BEGIN
|
||||
#define hb_sdfSetLocate NULL
|
||||
#define hb_sdfSetScope NULL
|
||||
#define hb_sdfSkipScope NULL
|
||||
#define hb_sdfLocate NULL
|
||||
#define hb_sdfCompile NULL
|
||||
#define hb_sdfError NULL
|
||||
#define hb_sdfEvalBlock NULL
|
||||
@@ -152,9 +154,11 @@ HB_EXTERN_BEGIN
|
||||
#define hb_sdfPutValueFile NULL
|
||||
#define hb_sdfReadDBHeader NULL
|
||||
#define hb_sdfWriteDBHeader NULL
|
||||
#define hb_sdfInit NULL
|
||||
#define hb_sdfExit NULL
|
||||
#define hb_sdfDrop NULL
|
||||
#define hb_sdfExists NULL
|
||||
#define hb_sdfRddInfo NULL
|
||||
#define hb_sdfWhoCares NULL
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
@@ -92,14 +92,16 @@ extern ERRCODE hb_waFieldName( AREAP pArea, USHORT uiIndex, void * szName );
|
||||
#define hb_waRecall hb_waUnsupported
|
||||
#define hb_waRecCount ( DBENTRYP_ULP ) hb_waUnsupported
|
||||
#define hb_waRecInfo ( DBENTRYP_ISI ) hb_waUnsupported
|
||||
#define hb_waRecNo ( DBENTRYP_I ) hb_waUnsupported
|
||||
#define hb_waRecNo ( DBENTRYP_ULP ) hb_waUnsupported
|
||||
#define hb_waRecId ( DBENTRYP_I ) hb_waUnsupported
|
||||
extern ERRCODE hb_waSetFieldExtent( AREAP pArea, USHORT uiFieldExtent );
|
||||
extern ERRCODE hb_waAlias( AREAP pArea, BYTE * szAlias );
|
||||
extern ERRCODE hb_waClose( AREAP pArea );
|
||||
#define hb_waCreate ( DBENTRYP_VP ) hb_waUnsupported
|
||||
/* Like in Clipper map CREATE() method at work area level to OPEN() */
|
||||
#define hb_waCreate hb_waOpen
|
||||
extern ERRCODE hb_waInfo( AREAP pArea, USHORT uiIndex, PHB_ITEM pItem );
|
||||
extern ERRCODE hb_waNewArea( AREAP pArea );
|
||||
#define hb_waOpen ( DBENTRYP_VP ) hb_waUnsupported
|
||||
extern ERRCODE hb_waOpen( AREAP pArea, LPDBOPENINFO pInfo );
|
||||
extern ERRCODE hb_waRelease( AREAP pArea );
|
||||
extern ERRCODE hb_waStructSize( AREAP pArea, USHORT * uiSize );
|
||||
extern ERRCODE hb_waSysName( AREAP pArea, BYTE * pBuffer );
|
||||
@@ -122,7 +124,7 @@ extern ERRCODE hb_waRelText( AREAP pArea, USHORT uiRelNo, void * pExpr );
|
||||
extern ERRCODE hb_waSetRel( AREAP pArea, LPDBRELINFO pRelInfo );
|
||||
#define hb_waOrderListAdd ( DBENTRYP_OI ) hb_waUnsupported
|
||||
#define hb_waOrderListClear hb_waUnsupported
|
||||
#define hb_waOrderListDelete ( DBENTRYP_VP ) hb_waUnsupported
|
||||
#define hb_waOrderListDelete ( DBENTRYP_OI ) hb_waUnsupported
|
||||
#define hb_waOrderListFocus ( DBENTRYP_OI ) hb_waUnsupported
|
||||
#define hb_waOrderListRebuild hb_waUnsupported
|
||||
extern ERRCODE hb_waOrderCondition( AREAP pArea, LPDBORDERCONDINFO param );
|
||||
@@ -138,25 +140,28 @@ extern ERRCODE hb_waFilterText( AREAP pArea, PHB_ITEM pFilter );
|
||||
#define hb_waScopeInfo ( DBENTRYP_SI ) hb_waUnsupported
|
||||
extern ERRCODE hb_waSetFilter( AREAP pArea, LPDBFILTERINFO pFilterInfo );
|
||||
extern ERRCODE hb_waSetLocate( AREAP pArea, LPDBSCOPEINFO pScopeInfo );
|
||||
#define hb_waSetScope ( DBENTRYP_VOS ) hb_waUnsupported
|
||||
#define hb_waSetScope ( DBENTRYP_VOS ) hb_waUnsupported
|
||||
#define hb_waSkipScope ( DBENTRYP_VPL ) hb_waUnsupported
|
||||
ERRCODE hb_waLocate( AREAP pArea, BOOL fContinue );
|
||||
extern ERRCODE hb_waCompile( AREAP pArea, BYTE * pExpr );
|
||||
extern ERRCODE hb_waError( AREAP pArea, PHB_ITEM pError );
|
||||
extern ERRCODE hb_waEvalBlock( AREAP pArea, PHB_ITEM pBlock );
|
||||
#define hb_waRawLock ( DBENTRYP_VSP ) hb_waUnsupported
|
||||
#define hb_waLock ( DBENTRYP_VL ) hb_waUnsupported
|
||||
#define hb_waUnLock ( DBENTRYP_UL ) hb_waUnsupported
|
||||
#define hb_waUnLock ( DBENTRYP_I ) hb_waUnsupported
|
||||
#define hb_waCloseMemFile hb_waUnsupported
|
||||
#define hb_waCreateMemFile ( DBENTRYP_VP ) hb_waUnsupported
|
||||
#define hb_waGetValueFile ( DBENTRYP_SVPB ) hb_waUnsupported
|
||||
#define hb_waOpenMemFile ( DBENTRYP_VP ) hb_waUnsupported
|
||||
#define hb_waPutValueFile ( DBENTRYP_SVP ) hb_waUnsupported
|
||||
#define hb_waPutValueFile ( DBENTRYP_SVPB ) hb_waUnsupported
|
||||
#define hb_waReadDBHeader hb_waUnsupported
|
||||
#define hb_waWriteDBHeader hb_waUnsupported
|
||||
|
||||
#define hb_rddExit (DBENTRYP_I0) NULL
|
||||
#define hb_rddDrop (DBENTRYP_I1) hb_waUnsupported
|
||||
#define hb_rddExists (DBENTRYP_I2) hb_waUnsupported
|
||||
#define hb_rddInit (DBENTRYP_R) NULL
|
||||
#define hb_rddExit (DBENTRYP_R) NULL
|
||||
#define hb_rddDrop (DBENTRYP_RVV) hb_waRddUnsupported
|
||||
#define hb_rddExists (DBENTRYP_RVV) hb_waRddUnsupported
|
||||
extern ERRCODE hb_rddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnection, PHB_ITEM pItem );
|
||||
|
||||
#define hb_waWhoCares ( DBENTRYP_SVP ) hb_waUnsupported
|
||||
|
||||
|
||||
77
harbour/include/hbsxfunc.h
Normal file
77
harbour/include/hbsxfunc.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* xHarbour Project source code:
|
||||
* header file for SIX compatible functions
|
||||
*
|
||||
* Copyright 2005 Przemyslaw Czerpak <druzus@acn.waw.pl>
|
||||
* www - http://www.xharbour.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HB_SXFUNC_H_
|
||||
#define HB_SXFUNC_H_
|
||||
|
||||
#include "hbapi.h"
|
||||
#include "hbapifs.h"
|
||||
#include "hbapirdd.h"
|
||||
#include "hbapierr.h"
|
||||
#include "hbdate.h"
|
||||
|
||||
HB_EXTERN_BEGIN
|
||||
|
||||
char * hb_sxDtoP( char * pDate, LONG lJulian );
|
||||
LONG hb_sxPtoD( char * pDate );
|
||||
|
||||
void hb_sxEnCrypt( BYTE * pSrc, BYTE * pDst, BYTE * pKeyVal, ULONG ulLen );
|
||||
void hb_sxDeCrypt( BYTE * pSrc, BYTE * pDst, BYTE * pKeyVal, ULONG ulLen );
|
||||
|
||||
BOOL hb_LZSSxDecompressMem( BYTE * pSrcBuf, ULONG ulSrcLen, BYTE * pDstBuf, ULONG ulDstLen );
|
||||
BOOL hb_LZSSxDecompressMem( BYTE * pSrcBuf, ULONG ulSrcLen, BYTE * pDstBuf, ULONG ulDstLen );
|
||||
BOOL hb_LZSSxCompressFile( FHANDLE hInput, FHANDLE hOutput, ULONG * pulSize );
|
||||
BOOL hb_LZSSxDecompressFile( FHANDLE hInput, FHANDLE hOutput );
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
#endif /* HB_SXFUNC_H_ */
|
||||
@@ -88,6 +88,7 @@ extern void hb_vmSend( USHORT uiParams ); /* sends a message to an object */
|
||||
extern PHB_ITEM hb_vmEvalBlock( PHB_ITEM pBlockItem ); /* executes passed codeblock with no arguments */
|
||||
/* executes passed codeblock with variable number of arguments */
|
||||
extern PHB_ITEM hb_vmEvalBlockV( PHB_ITEM pBlockItem, ULONG ulArgCount, ... );
|
||||
extern PHB_ITEM hb_vmEvalBlockOrMacro( HB_ITEM_PTR pItem ); /* execute a codeblock or a macro */
|
||||
|
||||
/* Push */
|
||||
extern void hb_vmPush( PHB_ITEM pItem ); /* pushes a generic item onto the stack */
|
||||
|
||||
@@ -218,6 +218,28 @@ HB_EXPORT char * hb_strncat( char * pDest, const char * pSource, ULONG ulLen )
|
||||
return pBuf;
|
||||
}
|
||||
|
||||
char HB_EXPORT * hb_strndup( const char * pszText, ULONG ulLen )
|
||||
{
|
||||
char * pszDup;
|
||||
ULONG ul;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_strndup(%s, %ld)", pszText, ulLen));
|
||||
|
||||
ul = 0;
|
||||
pszDup = ( char * ) pszText;
|
||||
while( ulLen-- && *pszDup++ )
|
||||
{
|
||||
++ul;
|
||||
}
|
||||
|
||||
pszDup = ( char * ) hb_xgrab( ul + 1 );
|
||||
memcpy( pszDup, pszText, ul );
|
||||
pszDup[ ul ] = '\0';
|
||||
|
||||
return pszDup;
|
||||
}
|
||||
|
||||
|
||||
/* This function copies and converts szText to upper case.
|
||||
* NOTE: Unlike the documentation for strncpy, this routine will always append
|
||||
* a null
|
||||
@@ -598,3 +620,78 @@ double hb_strVal( const char * szText, ULONG ulLen )
|
||||
dVal = ( double ) lVal;
|
||||
return dVal;
|
||||
}
|
||||
|
||||
/*
|
||||
AJ: 2004-02-23
|
||||
Concatenates multiple strings into a single result.
|
||||
Eg. hb_xstrcat (buffer, "A", "B", NULL) stores "AB" in buffer.
|
||||
*/
|
||||
char HB_EXPORT * hb_xstrcat ( char *szDest, const char *szSrc, ... )
|
||||
{
|
||||
char *szResult = szDest;
|
||||
va_list va;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_xstrcat(%p, %p, ...)", szDest, szSrc));
|
||||
|
||||
while( *szDest )
|
||||
szDest++;
|
||||
|
||||
va_start(va, szSrc);
|
||||
|
||||
while( szSrc )
|
||||
{
|
||||
while ( *szSrc )
|
||||
*szDest++ = *szSrc++;
|
||||
szSrc = va_arg ( va, char* );
|
||||
}
|
||||
|
||||
*szDest = '\0';
|
||||
va_end ( va );
|
||||
return ( szResult );
|
||||
}
|
||||
|
||||
/*
|
||||
AJ: 2004-02-23
|
||||
Concatenates multiple strings into a single result.
|
||||
Eg. hb_xstrcpy (buffer, "A", "B", NULL) stores "AB" in buffer.
|
||||
Returns szDest.
|
||||
Any existing contents of szDest are cleared. If the szDest buffer is NULL,
|
||||
allocates a new buffer with the required length and returns that. The
|
||||
buffer is allocated using hb_xgrab(), and should eventually be freed
|
||||
using hb_xfree().
|
||||
*/
|
||||
char HB_EXPORT * hb_xstrcpy ( char *szDest, const char *szSrc, ...)
|
||||
{
|
||||
const char *szSrc_Ptr;
|
||||
va_list va;
|
||||
size_t dest_size;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_xstrcpy(%p, %p, ...)", szDest, szSrc));
|
||||
|
||||
if (szDest == NULL)
|
||||
{
|
||||
va_start (va, szSrc);
|
||||
szSrc_Ptr = szSrc;
|
||||
dest_size = 1;
|
||||
while (szSrc_Ptr)
|
||||
{
|
||||
dest_size += strlen (szSrc_Ptr);
|
||||
szSrc_Ptr = va_arg (va, char *);
|
||||
}
|
||||
va_end (va);
|
||||
|
||||
szDest = (char *) hb_xgrab( dest_size );
|
||||
}
|
||||
|
||||
va_start (va, szSrc);
|
||||
szSrc_Ptr = szSrc;
|
||||
szDest [0] = '\0';
|
||||
while (szSrc_Ptr)
|
||||
{
|
||||
hb_xstrcat (szDest, szSrc_Ptr, NULL );
|
||||
szSrc_Ptr = va_arg (va, char *);
|
||||
}
|
||||
va_end (va);
|
||||
return (szDest);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ C_SOURCES=\
|
||||
|
||||
PRG_SOURCES=\
|
||||
dbf0.prg \
|
||||
dbtotal.prg \
|
||||
dbfuncs.prg \
|
||||
dbfuncs.prg \
|
||||
dbtotal.prg \
|
||||
dblist.prg \
|
||||
dbsort.prg \
|
||||
dbstrux.prg \
|
||||
@@ -25,9 +25,14 @@ PRG_SOURCES=\
|
||||
delim0.prg \
|
||||
rddord.prg \
|
||||
rddsys.prg \
|
||||
|
||||
ifeq ($(HB_MT),MT)
|
||||
MT_LIBNAME=rddmt
|
||||
endif
|
||||
|
||||
LIBNAME=rdd
|
||||
|
||||
|
||||
# The list of all valid DB drivers is defined in config/global.cf.
|
||||
DIRS=$(HB_DB_DRIVERS)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -6,9 +6,15 @@ ROOT = ../../../
|
||||
|
||||
C_SOURCES=\
|
||||
dbfcdx1.c \
|
||||
sixcdx1.c \
|
||||
|
||||
PRG_SOURCES=\
|
||||
dbfcdx0.prg \
|
||||
sixcdx0.prg \
|
||||
|
||||
ifeq ($(HB_MT),MT)
|
||||
MT_LIBNAME=$(LIBNAME)mt
|
||||
endif
|
||||
|
||||
LIBNAME=dbfcdx
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ ANNOUNCE DBFCDX
|
||||
|
||||
procedure DBFCDXInit
|
||||
|
||||
REQUEST _DBF
|
||||
REQUEST _DBFCDX
|
||||
|
||||
rddRegister( "DBF", RDT_FULL )
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
66
harbour/source/rdd/dbfcdx/sixcdx0.prg
Normal file
66
harbour/source/rdd/dbfcdx/sixcdx0.prg
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* DBFCDX RDD (ver.2)
|
||||
*
|
||||
* Copyright 1999 Bruno Cantero <bruno@issnet.net>
|
||||
* Copyright 2003 Przemyslaw Czerpak <druzus@acn.waw.pl>
|
||||
* www - http://www.xharbour.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "rddsys.ch"
|
||||
|
||||
ANNOUNCE SIXCDX
|
||||
|
||||
procedure SIXCDXInit
|
||||
|
||||
REQUEST _DBF
|
||||
REQUEST _SIXCDX
|
||||
|
||||
rddRegister( "DBF", RDT_FULL )
|
||||
rddRegister( "SIXCDX", RDT_FULL )
|
||||
|
||||
return
|
||||
55
harbour/source/rdd/dbfcdx/sixcdx1.c
Normal file
55
harbour/source/rdd/dbfcdx/sixcdx1.c
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* xHarbour Project source code:
|
||||
* SIXCDX RDD
|
||||
*
|
||||
* Copyright 2005 Przemyslaw Czerpak <druzus@priv.onet.pl>
|
||||
* www - http://www.xharbour.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#define HB_SIXCDX
|
||||
|
||||
#include "dbfcdx1.c"
|
||||
@@ -10,6 +10,11 @@ C_SOURCES=\
|
||||
PRG_SOURCES=\
|
||||
dbfdbt0.prg \
|
||||
|
||||
ifeq ($(HB_MT),MT)
|
||||
MT_LIBNAME=dbfdbtmt
|
||||
endif
|
||||
|
||||
|
||||
LIBNAME=dbfdbt
|
||||
|
||||
include $(TOP)$(ROOT)config/lib.cf
|
||||
|
||||
@@ -112,7 +112,8 @@ static RDDFUNCS dbtTable =
|
||||
( DBENTRYP_V ) hb_dbtRecall,
|
||||
( DBENTRYP_ULP ) hb_dbtRecCount,
|
||||
( DBENTRYP_ISI ) hb_dbtRecInfo,
|
||||
( DBENTRYP_I ) hb_dbtRecNo,
|
||||
( DBENTRYP_ULP ) hb_dbtRecNo,
|
||||
( DBENTRYP_I ) hb_dbtRecId,
|
||||
( DBENTRYP_S ) hb_dbtSetFieldExtent,
|
||||
|
||||
|
||||
@@ -154,7 +155,7 @@ static RDDFUNCS dbtTable =
|
||||
|
||||
( DBENTRYP_OI ) hb_dbtOrderListAdd,
|
||||
( DBENTRYP_V ) hb_dbtOrderListClear,
|
||||
( DBENTRYP_VP ) hb_dbtOrderListDelete,
|
||||
( DBENTRYP_OI ) hb_dbtOrderListDelete,
|
||||
( DBENTRYP_OI ) hb_dbtOrderListFocus,
|
||||
( DBENTRYP_V ) hb_dbtOrderListRebuild,
|
||||
( DBENTRYP_VOI ) hb_dbtOrderCondition,
|
||||
@@ -175,6 +176,7 @@ static RDDFUNCS dbtTable =
|
||||
( DBENTRYP_VLO ) hb_dbtSetLocate,
|
||||
( DBENTRYP_VOS ) hb_dbtSetScope,
|
||||
( DBENTRYP_VPL ) hb_dbtSkipScope,
|
||||
( DBENTRYP_B ) hb_dbtLocate,
|
||||
|
||||
|
||||
/* Miscellaneous */
|
||||
@@ -188,7 +190,7 @@ static RDDFUNCS dbtTable =
|
||||
|
||||
( DBENTRYP_VSP ) hb_dbtRawLock,
|
||||
( DBENTRYP_VL ) hb_dbtLock,
|
||||
( DBENTRYP_UL ) hb_dbtUnLock,
|
||||
( DBENTRYP_I ) hb_dbtUnLock,
|
||||
|
||||
|
||||
/* Memofile functions */
|
||||
@@ -197,7 +199,7 @@ static RDDFUNCS dbtTable =
|
||||
( DBENTRYP_VP ) hb_dbtCreateMemFile,
|
||||
( DBENTRYP_SVPB ) hb_dbtGetValueFile,
|
||||
( DBENTRYP_VP ) hb_dbtOpenMemFile,
|
||||
( DBENTRYP_SVP ) hb_dbtPutValueFile,
|
||||
( DBENTRYP_SVPB ) hb_dbtPutValueFile,
|
||||
|
||||
|
||||
/* Database file header handling */
|
||||
@@ -207,9 +209,11 @@ static RDDFUNCS dbtTable =
|
||||
|
||||
|
||||
/* non WorkArea functions */
|
||||
( DBENTRYP_I0 ) hb_dbtExit,
|
||||
( DBENTRYP_I1 ) hb_dbtDrop,
|
||||
( DBENTRYP_I2 ) hb_dbtExists,
|
||||
( DBENTRYP_R ) hb_dbtInit,
|
||||
( DBENTRYP_R ) hb_dbtExit,
|
||||
( DBENTRYP_RVV ) hb_dbtDrop,
|
||||
( DBENTRYP_RVV ) hb_dbtExists,
|
||||
( DBENTRYP_RSLV ) hb_dbtRddInfo,
|
||||
|
||||
/* Special and reserved methods */
|
||||
|
||||
@@ -245,9 +249,9 @@ HB_INIT_SYMBOLS_BEGIN( dbfdbt1__InitSymbols )
|
||||
{ "DBFDBT_GETFUNCTABLE", HB_FS_PUBLIC, {HB_FUNCNAME( DBFDBT_GETFUNCTABLE )}, NULL }
|
||||
HB_INIT_SYMBOLS_END( dbfdbt1__InitSymbols )
|
||||
|
||||
#if defined(HB_STATIC_STARTUP)
|
||||
#if defined(HB_PRAGMA_STARTUP)
|
||||
# pragma startup dbfdbt1__InitSymbols
|
||||
#elif defined(_MSC_VER)
|
||||
#elif defined(HB_MSC_STARTUP)
|
||||
# if _MSC_VER >= 1010
|
||||
# pragma data_seg( ".CRT$XIY" )
|
||||
# pragma comment( linker, "/Merge:.CRT=.data" )
|
||||
@@ -256,8 +260,6 @@ HB_INIT_SYMBOLS_END( dbfdbt1__InitSymbols )
|
||||
# endif
|
||||
static HB_$INITSYM hb_vm_auto_dbfdbt1__InitSymbols = dbfdbt1__InitSymbols;
|
||||
# pragma data_seg()
|
||||
#elif ! defined(__GNUC__)
|
||||
# pragma startup dbfdbt1__InitSymbols
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -319,23 +321,24 @@ static ULONG hb_dbtGetMemoLen( DBTAREAP pArea, USHORT uiIndex )
|
||||
{
|
||||
ULONG ulBlock;
|
||||
BYTE pBlock[ DBT_BLOCKSIZE ];
|
||||
USHORT uiLen;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_dbtGetMemoLen(%p, %hu)", pArea, uiIndex));
|
||||
|
||||
ulBlock = hb_dbfGetMemoBlock( ( DBFAREAP ) pArea, uiIndex );
|
||||
if( ulBlock == 0 )
|
||||
return 0;
|
||||
hb_fsSeek( pArea->hMemoFile, ulBlock * DBT_BLOCKSIZE, FS_SET );
|
||||
hb_fsSeekLarge( pArea->hMemoFile, ( HB_FOFFSET ) ulBlock * DBT_BLOCKSIZE, FS_SET );
|
||||
ulBlock = 0;
|
||||
do
|
||||
{
|
||||
uiIndex = 0;
|
||||
if ( hb_fsRead( pArea->hMemoFile, pBlock, DBT_BLOCKSIZE ) == DBT_BLOCKSIZE )
|
||||
{
|
||||
while( uiIndex < DBT_BLOCKSIZE && pBlock[ uiIndex ] != 0x1A )
|
||||
uiIndex++;
|
||||
ulBlock += uiIndex;
|
||||
}
|
||||
uiLen = hb_fsRead( pArea->hMemoFile, pBlock, DBT_BLOCKSIZE );
|
||||
if ( uiLen == ( USHORT ) FS_ERROR )
|
||||
break;
|
||||
while( uiIndex < uiLen && pBlock[ uiIndex ] != 0x1A )
|
||||
uiIndex++;
|
||||
ulBlock += uiIndex;
|
||||
} while( uiIndex == DBT_BLOCKSIZE );
|
||||
return ulBlock;
|
||||
}
|
||||
@@ -356,16 +359,16 @@ static void hb_dbtGetMemo( DBTAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
if( ulSize > 0 )
|
||||
{
|
||||
ulBlock = hb_dbfGetMemoBlock( ( DBFAREAP ) pArea, uiIndex );
|
||||
hb_fsSeek( pArea->hMemoFile, ulBlock * DBT_BLOCKSIZE, FS_SET );
|
||||
hb_fsSeekLarge( pArea->hMemoFile, ( HB_FOFFSET ) ulBlock * DBT_BLOCKSIZE, FS_SET );
|
||||
hb_fsReadLarge( pArea->hMemoFile, pBuffer, ulSize );
|
||||
#ifndef HB_CDP_SUPPORT_OFF
|
||||
hb_cdpnTranslate( ( char * ) pBuffer, pArea->cdPage, hb_cdp_page, ulSize );
|
||||
#endif
|
||||
}
|
||||
else
|
||||
*pBuffer = '\0';
|
||||
|
||||
hb_itemPutCPtr( pItem, ( char * ) pBuffer, ulSize );
|
||||
#ifndef HB_CDP_SUPPORT_OFF
|
||||
hb_cdpnTranslate( pItem->item.asString.value, pArea->cdPage, hb_cdp_page, ulSize );
|
||||
#endif
|
||||
hb_itemSetCMemo( pItem );
|
||||
}
|
||||
|
||||
@@ -375,50 +378,69 @@ static void hb_dbtGetMemo( DBTAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
static void hb_dbtWriteMemo( DBTAREAP pArea, ULONG ulBlock, PHB_ITEM pItem, ULONG ulLen,
|
||||
ULONG * ulStoredBlock )
|
||||
{
|
||||
BYTE pBlock[ DBT_BLOCKSIZE ], pBuff[4];
|
||||
BYTE pAddr[4];
|
||||
BOOL bNewBlock;
|
||||
ULONG ulNewBlock, ulNextBlock = 0;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_dbtWriteMemo(%p, %lu, %p, %lu, %p)", pArea, ulBlock, pItem,
|
||||
ulLen, ulStoredBlock));
|
||||
|
||||
memset( pBlock, 0x1A, DBT_BLOCKSIZE );
|
||||
bNewBlock = !( ulBlock && ulLen < DBT_BLOCKSIZE - 1 );
|
||||
if( bNewBlock )
|
||||
{
|
||||
/* Get next block from header */
|
||||
hb_fsSeek( pArea->hMemoFile, 0, FS_SET );
|
||||
hb_fsRead( pArea->hMemoFile, pBuff, 4 );
|
||||
ulNewBlock = HB_GET_LE_UINT32( pBuff );
|
||||
ulNextBlock = ulNewBlock * DBT_BLOCKSIZE;
|
||||
hb_fsSeek( pArea->hMemoFile, ulNextBlock, FS_SET );
|
||||
hb_fsRead( pArea->hMemoFile, pAddr, 4 );
|
||||
ulBlock = HB_GET_LE_UINT32( pAddr );
|
||||
}
|
||||
* ulStoredBlock = ulBlock;
|
||||
|
||||
hb_fsSeekLarge( pArea->hMemoFile, ( HB_FOFFSET ) ulBlock * DBT_BLOCKSIZE, FS_SET );
|
||||
#ifndef HB_CDP_SUPPORT_OFF
|
||||
if( hb_cdp_page != pArea->cdPage )
|
||||
{
|
||||
BYTE * pBuff = ( BYTE * ) hb_xalloc( ulLen + 1 );
|
||||
|
||||
if( pBuff )
|
||||
{
|
||||
memcpy( pBuff, pItem->item.asString.value, ulLen );
|
||||
pBuff[ ulLen ] = 0x1A;
|
||||
hb_cdpnTranslate( ( char * ) pBuff, hb_cdp_page, pArea->cdPage, ulLen );
|
||||
hb_fsWriteLarge( pArea->hMemoFile, pBuff, ulLen + 1 );
|
||||
hb_xfree( pBuff );
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE pBlock[ DBT_BLOCKSIZE ], *pSrc = ( BYTE * ) pItem->item.asString.value;
|
||||
ULONG ulWritten = 0, ulRest;
|
||||
|
||||
do
|
||||
{
|
||||
ulRest = HB_MIN( ulLen - ulWritten, DBT_BLOCKSIZE );
|
||||
memcpy( pBlock, pSrc + ulWritten, ulRest );
|
||||
memset( pBlock + ulRest, 0x1A, DBT_BLOCKSIZE - ulRest );
|
||||
hb_cdpnTranslate( ( char * ) pBlock, hb_cdp_page, pArea->cdPage, ulRest );
|
||||
hb_fsWrite( pArea->hMemoFile, pBlock, DBT_BLOCKSIZE );
|
||||
ulWritten += DBT_BLOCKSIZE;
|
||||
}
|
||||
while ( ulWritten <= ulLen );
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
hb_fsSeek( pArea->hMemoFile, ulBlock * DBT_BLOCKSIZE, FS_SET );
|
||||
ulNewBlock = ulBlock;
|
||||
BYTE pBlock[ DBT_BLOCKSIZE ];
|
||||
memset( pBlock, 0x1A, DBT_BLOCKSIZE );
|
||||
hb_fsWriteLarge( pArea->hMemoFile, ( BYTE * ) pItem->item.asString.value, ulLen );
|
||||
hb_fsWrite( pArea->hMemoFile, pBlock, ( DBT_BLOCKSIZE - ( USHORT ) ( ulLen % DBT_BLOCKSIZE ) ) );
|
||||
}
|
||||
* ulStoredBlock = ulNewBlock;
|
||||
|
||||
#ifndef HB_CDP_SUPPORT_OFF
|
||||
hb_cdpnTranslate( pItem->item.asString.value, hb_cdp_page, pArea->cdPage, ulLen );
|
||||
#endif
|
||||
/* Write memo data and eof mark */
|
||||
hb_fsWriteLarge( pArea->hMemoFile, ( BYTE * ) pItem->item.asString.value, ulLen );
|
||||
hb_fsWrite( pArea->hMemoFile, pBlock, ( DBT_BLOCKSIZE - ( USHORT ) ( ulLen % DBT_BLOCKSIZE ) ) );
|
||||
pArea->fMemoFlush = TRUE;
|
||||
#ifndef HB_CDP_SUPPORT_OFF
|
||||
hb_cdpnTranslate( pItem->item.asString.value, pArea->cdPage, hb_cdp_page, ulLen );
|
||||
#endif
|
||||
|
||||
if( bNewBlock )
|
||||
{
|
||||
ulNextBlock += ulLen + 1;
|
||||
ulNextBlock += ( DBT_BLOCKSIZE - ulNextBlock % DBT_BLOCKSIZE );
|
||||
ulNextBlock /= DBT_BLOCKSIZE;
|
||||
HB_PUT_LE_UINT32( pBuff, ulNextBlock );
|
||||
ulBlock += ( ulLen / DBT_BLOCKSIZE ) + 1;
|
||||
HB_PUT_LE_UINT32( pAddr, ulBlock );
|
||||
hb_fsSeek( pArea->hMemoFile, 0, FS_SET );
|
||||
hb_fsWrite( pArea->hMemoFile, pBuff, 4 );
|
||||
hb_fsWrite( pArea->hMemoFile, pAddr, 4 );
|
||||
pArea->fMemoFlush = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -492,7 +514,33 @@ static ERRCODE hb_dbtInfo( DBTAREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
switch( uiIndex )
|
||||
{
|
||||
case DBI_MEMOEXT:
|
||||
hb_itemPutC( pItem, DBT_MEMOEXT );
|
||||
if( pArea->fHasMemo && pArea->hMemoFile != FS_ERROR )
|
||||
{
|
||||
PHB_FNAME pFileName;
|
||||
|
||||
pFileName = hb_fsFNameSplit( ( char * ) pArea->szMemoFileName );
|
||||
hb_itemPutC( pItem, pFileName->szExtension );
|
||||
hb_xfree( pFileName );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_itemClear( pItem );
|
||||
return SELF_RDDINFO( SELF_RDDNODE( pArea ), RDDI_MEMOEXT, 0, pItem );
|
||||
}
|
||||
break;
|
||||
|
||||
case DBI_MEMOBLOCKSIZE:
|
||||
if( pArea->fHasMemo && pArea->hMemoFile != FS_ERROR )
|
||||
hb_itemPutNI( pItem, pArea->uiMemoBlockSize );
|
||||
else
|
||||
hb_itemPutNI( pItem, DBT_BLOCKSIZE );
|
||||
break;
|
||||
|
||||
case DBI_MEMOTYPE:
|
||||
if( pArea->fHasMemo && pArea->hMemoFile != FS_ERROR )
|
||||
hb_itemPutNI( pItem, pArea->bMemoType );
|
||||
else
|
||||
hb_itemPutNI( pItem, DB_MEMO_DBT );
|
||||
break;
|
||||
|
||||
/* case DBI_RDD_VERSION */
|
||||
@@ -654,7 +702,10 @@ static ERRCODE hb_dbtCreateMemFile( DBTAREAP pArea, LPDBOPENINFO pCreateInfo )
|
||||
/* Try create */
|
||||
do
|
||||
{
|
||||
pArea->hMemoFile = hb_spCreate( pCreateInfo->abName, FC_NORMAL );
|
||||
pArea->hMemoFile = hb_fsExtOpen( pCreateInfo->abName, NULL,
|
||||
FO_READWRITE | FO_EXCLUSIVE | FXO_TRUNCATE |
|
||||
FXO_DEFAULTS | FXO_SHARELOCK,
|
||||
NULL, pError );
|
||||
if( pArea->hMemoFile == FS_ERROR )
|
||||
{
|
||||
if( !pError )
|
||||
@@ -711,7 +762,9 @@ static ERRCODE hb_dbtOpenMemFile( DBTAREAP pArea, LPDBOPENINFO pOpenInfo )
|
||||
/* Try open */
|
||||
do
|
||||
{
|
||||
pArea->hMemoFile = hb_spOpen( pOpenInfo->abName, uiFlags );
|
||||
pArea->hMemoFile = hb_fsExtOpen( pOpenInfo->abName, NULL, uiFlags |
|
||||
FXO_DEFAULTS | FXO_SHARELOCK,
|
||||
NULL, pError );
|
||||
if( pArea->hMemoFile == FS_ERROR )
|
||||
{
|
||||
if( !pError )
|
||||
@@ -738,35 +791,56 @@ static ERRCODE hb_dbtOpenMemFile( DBTAREAP pArea, LPDBOPENINFO pOpenInfo )
|
||||
return ( pArea->hMemoFile == FS_ERROR ? FAILURE : SUCCESS );
|
||||
}
|
||||
|
||||
/* ( DBENTRYP_SVP ) hb_dbtPutValueFile : NULL */
|
||||
/* ( DBENTRYP_SVPB ) hb_dbtPutValueFile : NULL */
|
||||
|
||||
/*
|
||||
* Read the database file header record in the WorkArea.
|
||||
* ( DBENTRYP_V ) hb_dbtReadDBHeader
|
||||
* Retrieve (set) information about RDD
|
||||
* ( DBENTRYP_RSLV ) hb_dbtFieldInfo
|
||||
*/
|
||||
static ERRCODE hb_dbtReadDBHeader( DBTAREAP pArea )
|
||||
static ERRCODE hb_dbtRddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnect, PHB_ITEM pItem )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_dbtReadHeader(%p)", pArea));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_dbtRddInfo(%p, %hu, %lu, %p)", pRDD, uiIndex, ulConnect, pItem));
|
||||
|
||||
if( SUPER_READDBHEADER( ( AREAP ) pArea ) == FAILURE )
|
||||
return FAILURE;
|
||||
// Set in SUPER() now 3/05/2004
|
||||
// pArea->fHasMemo = ( pArea->bVersion == 0x83 );
|
||||
switch( uiIndex )
|
||||
{
|
||||
case RDDI_MEMOEXT:
|
||||
{
|
||||
LPDBFDATA pData = ( LPDBFDATA ) pRDD->lpvCargo;
|
||||
char *szNew = hb_itemGetCPtr( pItem );
|
||||
|
||||
if( szNew[0] == '.' && szNew[1] )
|
||||
szNew = hb_strdup( szNew );
|
||||
else
|
||||
szNew = NULL;
|
||||
|
||||
hb_itemPutC( pItem, pData->szMemoExt[ 0 ] ? pData->szMemoExt : DBT_MEMOEXT );
|
||||
if( szNew )
|
||||
{
|
||||
hb_strncpy( pData->szMemoExt, szNew, HB_MAX_FILE_EXT );
|
||||
hb_xfree( szNew );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RDDI_MEMOBLOCKSIZE:
|
||||
hb_itemPutNI( pItem, DBT_BLOCKSIZE );
|
||||
break;
|
||||
|
||||
case RDDI_MEMOTYPE:
|
||||
hb_itemPutNI( pItem, DB_MEMO_DBT );
|
||||
break;
|
||||
|
||||
case RDDI_MEMOGCTYPE:
|
||||
hb_itemPutNI( pItem, 0 );
|
||||
break;
|
||||
|
||||
case RDDI_MEMOREADLOCK:
|
||||
case RDDI_MEMOREUSE:
|
||||
hb_itemPutL( pItem, FALSE );
|
||||
break;
|
||||
|
||||
default:
|
||||
return SUPER_RDDINFO( pRDD, uiIndex, ulConnect, pItem );
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write the database file header record in the WorkArea.
|
||||
* ( DBENTRYP_V ) hb_dbtWriteDBHeader
|
||||
*/
|
||||
static ERRCODE hb_dbtWriteDBHeader( DBTAREAP pArea )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_dbtWriteDBHeader(%p)", pArea));
|
||||
|
||||
if ( pArea->fHasMemo && pArea->bVersion != 0x30 && pArea->bVersion != 0x31 )
|
||||
{
|
||||
pArea->bVersion = 0x83;
|
||||
}
|
||||
return SUPER_WRITEDBHEADER( ( AREAP ) pArea );
|
||||
}
|
||||
|
||||
@@ -10,6 +10,10 @@ C_SOURCES=\
|
||||
PRG_SOURCES=\
|
||||
dbffpt0.prg \
|
||||
|
||||
ifeq ($(HB_MT),MT)
|
||||
MT_LIBNAME=dbffptmt
|
||||
endif
|
||||
|
||||
LIBNAME=dbffpt
|
||||
|
||||
include $(TOP)$(ROOT)config/lib.cf
|
||||
|
||||
@@ -56,9 +56,14 @@ ANNOUNCE DBFFPT
|
||||
|
||||
procedure DBFFPTInit
|
||||
|
||||
REQUEST _DBF
|
||||
REQUEST _DBFFPT
|
||||
|
||||
rddRegister( "DBF", RDT_FULL )
|
||||
rddRegister( "DBFFPT", RDT_FULL )
|
||||
|
||||
return
|
||||
|
||||
/* to satisfy old code which has: REQUEST DBFDBT */
|
||||
proc DBFDBT
|
||||
return
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,10 @@ C_SOURCES=\
|
||||
PRG_SOURCES=\
|
||||
dbfntx0.prg \
|
||||
|
||||
ifeq ($(HB_MT),MT)
|
||||
MT_LIBNAME=dbfntxmt
|
||||
endif
|
||||
|
||||
LIBNAME=dbfntx
|
||||
|
||||
include $(TOP)$(ROOT)config/lib.cf
|
||||
|
||||
@@ -52,15 +52,18 @@
|
||||
|
||||
#include "error.ch"
|
||||
#include "rddsys.ch"
|
||||
#include "dbinfo.ch"
|
||||
|
||||
ANNOUNCE DBFNTX
|
||||
|
||||
procedure DBFNTXInit
|
||||
|
||||
REQUEST _DBF
|
||||
REQUEST _DBFNTX
|
||||
|
||||
rddRegister( "DBF", RDT_FULL )
|
||||
rddRegister( "DBFNTX", RDT_FULL )
|
||||
rddInfo( RDDI_MEMOTYPE, DB_MEMO_DBT, "DBFNTX" )
|
||||
|
||||
return
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -280,11 +280,13 @@ RETURN nil
|
||||
STATIC FUNCTION DbRead()
|
||||
|
||||
LOCAL cAlias := Alias()
|
||||
LOCAL aRec := Array( Fcount() )
|
||||
LOCAL aRec := {}
|
||||
LOCAL nCount
|
||||
|
||||
FOR nCount := 1 TO Fcount()
|
||||
aRec[ nCount ] := Fieldget( nCount )
|
||||
FOR nCount := 1 TO FCount()
|
||||
IF ( FieldType( nCount ) != "M" )
|
||||
AAdd( aRec, Fieldget( nCount ) )
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
RETURN aRec
|
||||
|
||||
@@ -52,11 +52,11 @@
|
||||
|
||||
#include "rddsys.ch"
|
||||
|
||||
ANNOUNCE _DELIM
|
||||
ANNOUNCE DELIM
|
||||
|
||||
init procedure DELIMInit
|
||||
|
||||
REQUEST _DELIMC
|
||||
REQUEST _DELIM
|
||||
|
||||
rddRegister( "DELIM", RDT_TRANSFER )
|
||||
|
||||
|
||||
@@ -59,20 +59,20 @@
|
||||
|
||||
#define __PRG_SOURCE__ __FILE__
|
||||
|
||||
HB_FUNC( _DELIMC );
|
||||
HB_FUNC( _DELIM );
|
||||
HB_FUNC( DELIM_GETFUNCTABLE );
|
||||
|
||||
#undef HB_PRG_PCODE_VER
|
||||
#define HB_PRG_PCODE_VER HB_PCODE_VER
|
||||
|
||||
HB_INIT_SYMBOLS_BEGIN( delim1__InitSymbols )
|
||||
{ "_DELIMC", HB_FS_PUBLIC, {HB_FUNCNAME( _DELIMC )}, NULL },
|
||||
{ "_DELIM", HB_FS_PUBLIC, {HB_FUNCNAME( _DELIM )}, NULL },
|
||||
{ "DELIM_GETFUNCTABLE", HB_FS_PUBLIC, {HB_FUNCNAME( DELIM_GETFUNCTABLE )}, NULL }
|
||||
HB_INIT_SYMBOLS_END( delim1__InitSymbols )
|
||||
|
||||
#if defined(HB_STATIC_STARTUP)
|
||||
#if defined(HB_PRAGMA_STARTUP)
|
||||
#pragma startup delim1__InitSymbols
|
||||
#elif defined(_MSC_VER)
|
||||
#elif defined(HB_MSC_STARTUP)
|
||||
#if _MSC_VER >= 1010
|
||||
#pragma data_seg( ".CRT$XIY" )
|
||||
#pragma comment( linker, "/Merge:.CRT=.data" )
|
||||
@@ -81,8 +81,6 @@ HB_INIT_SYMBOLS_END( delim1__InitSymbols )
|
||||
#endif
|
||||
static HB_$INITSYM hb_vm_auto_delim1__InitSymbols = delim1__InitSymbols;
|
||||
#pragma data_seg()
|
||||
#elif ! defined(__GNUC__)
|
||||
#pragma startup delim1__InitSymbols
|
||||
#endif
|
||||
|
||||
static RDDFUNCS delimSuper;
|
||||
@@ -118,6 +116,7 @@ static RDDFUNCS delimTable = { hb_delimBof,
|
||||
hb_delimRecCount,
|
||||
hb_delimRecInfo,
|
||||
hb_delimRecNo,
|
||||
hb_delimRecId,
|
||||
hb_delimSetFieldExtent,
|
||||
hb_delimAlias,
|
||||
hb_delimClose,
|
||||
@@ -164,6 +163,7 @@ static RDDFUNCS delimTable = { hb_delimBof,
|
||||
hb_delimSetLocate,
|
||||
hb_delimSetScope,
|
||||
hb_delimSkipScope,
|
||||
hb_delimLocate,
|
||||
hb_delimCompile,
|
||||
hb_delimError,
|
||||
hb_delimEvalBlock,
|
||||
@@ -177,9 +177,11 @@ static RDDFUNCS delimTable = { hb_delimBof,
|
||||
hb_delimPutValueFile,
|
||||
hb_delimReadDBHeader,
|
||||
hb_delimWriteDBHeader,
|
||||
hb_delimInit,
|
||||
hb_delimExit,
|
||||
hb_delimDrop,
|
||||
hb_delimExists,
|
||||
hb_delimRddInfo,
|
||||
hb_delimWhoCares
|
||||
};
|
||||
|
||||
@@ -189,9 +191,7 @@ static RDDFUNCS delimTable = { hb_delimBof,
|
||||
*/
|
||||
|
||||
|
||||
HB_FUNC( _DELIMC )
|
||||
{
|
||||
}
|
||||
HB_FUNC( _DELIM ) { ; }
|
||||
|
||||
HB_FUNC( DELIM_GETFUNCTABLE )
|
||||
{
|
||||
|
||||
18
harbour/source/rdd/hbsix/Makefile
Normal file
18
harbour/source/rdd/hbsix/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
ROOT = ../../../
|
||||
|
||||
C_SOURCES=\
|
||||
sxcompr.c \
|
||||
sxcrypt.c \
|
||||
sxdate.c \
|
||||
|
||||
LIBNAME=hbsix
|
||||
|
||||
ifeq ($(HB_MT),MT)
|
||||
MT_LIBNAME=$(LIBNAME)mt
|
||||
endif
|
||||
|
||||
include $(TOP)$(ROOT)config/lib.cf
|
||||
733
harbour/source/rdd/hbsix/sxcompr.c
Normal file
733
harbour/source/rdd/hbsix/sxcompr.c
Normal file
@@ -0,0 +1,733 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* xHarbour Project source code:
|
||||
* SIX compatible functions:
|
||||
* hb_LZSSxCompressMem()
|
||||
* hb_LZSSxDecompressMem()
|
||||
* hb_LZSSxCompressFile()
|
||||
* hb_LZSSxDecompressFile()
|
||||
*
|
||||
* SX_FCOMPRESS
|
||||
* SX_FDECOMPRESS
|
||||
* _SX_STRDECOMPRESS
|
||||
* _SX_STRCOMPRESS
|
||||
*
|
||||
* Copyright 2005 Przemyslaw Czerpak <druzus@acn.waw.pl>
|
||||
* www - http://www.xharbour.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
SIX uses modified version of LZSS algorithm.
|
||||
It uses 12 bits for position offset in ring buffer and 4 bits for the
|
||||
match length. LZSS is modified version of LZ77 algorithm which can store
|
||||
original bytes from input string instead of position and match length in
|
||||
the ring buffer when the match length does not reach some limit. In SIX
|
||||
the minimum match length is 3 and it is used to increase to match length
|
||||
in 4 bit offset by adding 3 also so the efective maximum match length is
|
||||
18. Of course we have to store the information about the type of item in
|
||||
compressed data to know it is (offset+length) pair or simple byte.
|
||||
SIX put 1 byte in compressed data which inform about the type of next
|
||||
8 items: bit set to 1 means normal byte, 0 means item pair.
|
||||
The funny thing is that SIX seems to effectively use only 11 bits ring
|
||||
buffer (2048 bytes size). I still do not know why. Maybe it was a hack
|
||||
for some problems with implementation of encoding or work around for
|
||||
a bug in some signed/unsigned value conversions? Or maybe someone
|
||||
wanted to reduce memory overhead in used algorithm for finding the
|
||||
longest match? The SIX was written for 16-bit DOS and the memory
|
||||
consumption was important though it should not be too much. They
|
||||
documented ~9KB increasing the ring buffer size should be linear to
|
||||
other used (helper) structures.
|
||||
The next interesting thing is that it dynamically overwrites the ring
|
||||
buffer with stream data and does not use any separate look ahead buffers.
|
||||
This fact suggests that SIX uses some simple implementation with
|
||||
greedy early parsing and does not look for optimal matches.
|
||||
Our algorithm has to make the same with the ring buffer to be compatible.
|
||||
UPDATE: Using smaller ring buffer without increasing the match pointer
|
||||
suggested me that it is possible that someone didn't understand it fully
|
||||
and modified already existing algorithm. I spend a while with a google
|
||||
looking for old LZSS implementations and I've found it. IMHO in 99%
|
||||
this code is used in SIX. This is lzss.c file written by Haruhiko Okumura
|
||||
with the following note in header:
|
||||
,---------------------------------------------------------
|
||||
| Use, distribute, and modify this program freely.
|
||||
| Please send me your improved versions.
|
||||
`---------------------------------------------------------
|
||||
This LZSS implementation gives exactly the same results as SIX when we
|
||||
change the ring buffer size (#define N 4096 //in the head of this file)
|
||||
to 2048. So I used exactly the same algorithm with binary tree for
|
||||
finding the longest match. The code may looks a little bit differ then
|
||||
in lzss.c because I've already implement most of it before I found
|
||||
this file and I didn't want to remove it but the original author is
|
||||
Haruhiko Okumura. The text above allow us use it in [x]Harbour.
|
||||
This version isn't for sure improved due to SIX modifications so I do
|
||||
not think I should send it to him. IMHO it is also less usable for
|
||||
other things then strict SIX compatibility - we already have much
|
||||
stronger compressions in ZLIB.
|
||||
After the LZSS compression the result could be longer then original
|
||||
strings. It looks that SIX return original string when the compressed
|
||||
one is longer then original + 253. I do not like it because there is
|
||||
no marker which informs if string was compressed or not and calling
|
||||
decompression procedure for uncompressed data gives broken results.
|
||||
I do not want to make the same.
|
||||
When file is compressed then SIX put the uncompressed file size in
|
||||
first four bytes. Similar situation is with string returned by
|
||||
sx_compress() - first four bytes is uncompressed size in little
|
||||
endian order. This has to be done in upper level functions,
|
||||
hb_LZSSxCompressMem() and hb_LZSSxCompressFile() intentionally
|
||||
do not do that.
|
||||
|
||||
*/
|
||||
|
||||
#include "hbsxfunc.h"
|
||||
|
||||
/* number of bits for encoded item (position,length) */
|
||||
#define ITEMBITS 16
|
||||
/* unused DUMMY bits - who does know why SIX has it? */
|
||||
#define DUMMYBITS 1
|
||||
/* number of bits for position offset */
|
||||
#define OFFSETBITS (12 - DUMMYBITS)
|
||||
/* the minimum match length to encode as new position */
|
||||
#define MINLENGTH 3
|
||||
|
||||
/* number of bits for match length, 1 bit reserved for ITEM type */
|
||||
#define LENGTHBITS ( ITEMBITS - OFFSETBITS - DUMMYBITS )
|
||||
/* the maximum match length we can encode in LENGTHBITS */
|
||||
#define MAXLENGTH ( ( 1 << LENGTHBITS ) + MINLENGTH - 1 )
|
||||
/* size of ring buffer */
|
||||
#define RBUFLENGTH ( 1 << OFFSETBITS )
|
||||
/* the bit mask for ring buffer */
|
||||
#define RBUFMASK ( ( 1 << OFFSETBITS ) - 1 )
|
||||
/* the bit mask for match length */
|
||||
#define MATCHMASK ( ( 1 << LENGTHBITS ) - 1 )
|
||||
/* get ringbuffer index */
|
||||
#define RBUFINDEX(i) ( ( i ) & RBUFMASK )
|
||||
|
||||
/* get ring buffer offset position from low and high bytes */
|
||||
#define LZSS_OFFSET(l, h) ( (l) | ( (h & ~MATCHMASK) << ( 8 - LENGTHBITS ) ) )
|
||||
/* get match length from low and high byte */
|
||||
#define LZSS_LENGTH(l, h) ( ( (h) & MATCHMASK ) + MINLENGTH )
|
||||
|
||||
/* create compressed item from match position and length */
|
||||
#define LZSS_ITEM(o, l) ( ( (o) << LENGTHBITS ) | ( (l) - MINLENGTH ) )
|
||||
/* create low byte of compressed item */
|
||||
#define LZSS_ITMLO(o, l) ( ( BYTE ) (o) )
|
||||
/* create high byte of compressed item */
|
||||
#define LZSS_ITMHI(o, l) ( ( BYTE ) ( ( ( (o) >> ( 8 - LENGTHBITS ) ) & ~MATCHMASK ) | \
|
||||
( (l) - MINLENGTH ) ) )
|
||||
/* maximum size of item set: byte with item type bits plus 8 items */
|
||||
#define ITEMSETSIZE ( ( ITEMBITS << 3 ) + 1 )
|
||||
|
||||
/* the size of IO buffer for file (de)compression */
|
||||
#define LZSS_IOBUFLEN 8192
|
||||
|
||||
/* uninitialized (dummy) node in compression trees */
|
||||
#define DUMMYNODE RBUFLENGTH
|
||||
|
||||
|
||||
typedef struct _HB_LZSSX_COMPR
|
||||
{
|
||||
FHANDLE hInput;
|
||||
BYTE * inBuffer;
|
||||
ULONG inBuffSize;
|
||||
ULONG inBuffPos;
|
||||
ULONG inBuffRead;
|
||||
BOOL fInFree;
|
||||
|
||||
FHANDLE hOutput;
|
||||
BYTE * outBuffer;
|
||||
ULONG outBuffSize;
|
||||
ULONG outBuffPos;
|
||||
BOOL fOutFree;
|
||||
|
||||
ULONG ulMaxSize;
|
||||
ULONG ulOutSize;
|
||||
BOOL fResult;
|
||||
BOOL fContinue;
|
||||
|
||||
BYTE ring_buffer[ RBUFLENGTH + MAXLENGTH - 1 ];
|
||||
|
||||
SHORT match_offset;
|
||||
SHORT match_length;
|
||||
SHORT parent[ RBUFLENGTH + 1 ];
|
||||
SHORT left [ RBUFLENGTH + 1 ];
|
||||
SHORT right [ RBUFLENGTH + 257 ];
|
||||
}
|
||||
HB_LZSSX_COMPR;
|
||||
typedef HB_LZSSX_COMPR * PHB_LZSSX_COMPR;
|
||||
|
||||
void hb_LZSSxExit( PHB_LZSSX_COMPR pCompr )
|
||||
{
|
||||
if( pCompr->fInFree )
|
||||
hb_xfree( pCompr->inBuffer );
|
||||
if( pCompr->fOutFree )
|
||||
hb_xfree( pCompr->outBuffer );
|
||||
hb_xfree( pCompr );
|
||||
}
|
||||
|
||||
static PHB_LZSSX_COMPR hb_LZSSxInit(
|
||||
FHANDLE hInput, BYTE * pSrcBuf, ULONG ulSrcBuf,
|
||||
FHANDLE hOutput, BYTE * pDstBuf, ULONG ulDstBuf )
|
||||
{
|
||||
PHB_LZSSX_COMPR pCompr = ( PHB_LZSSX_COMPR ) hb_xgrab( sizeof( HB_LZSSX_COMPR ) );
|
||||
|
||||
if( hInput != FS_ERROR && ulSrcBuf == 0 )
|
||||
ulSrcBuf = LZSS_IOBUFLEN;
|
||||
if( hOutput != FS_ERROR && ulDstBuf == 0 )
|
||||
ulDstBuf = LZSS_IOBUFLEN;
|
||||
|
||||
pCompr->hInput = hInput;
|
||||
pCompr->inBuffer = pSrcBuf;
|
||||
pCompr->inBuffSize = ulSrcBuf;
|
||||
pCompr->inBuffPos = 0;
|
||||
pCompr->inBuffRead = ( hInput == FS_ERROR ) ? ulSrcBuf : 0;
|
||||
pCompr->fInFree = ( hInput != FS_ERROR && pSrcBuf == NULL );
|
||||
pCompr->hOutput = hOutput;
|
||||
pCompr->outBuffer = pDstBuf;
|
||||
pCompr->outBuffSize = ulDstBuf;
|
||||
pCompr->outBuffPos = 0;
|
||||
pCompr->fOutFree = ( hOutput != FS_ERROR && pDstBuf == NULL );
|
||||
|
||||
pCompr->ulMaxSize = 0;
|
||||
pCompr->ulOutSize = 0;
|
||||
pCompr->fResult = TRUE;
|
||||
pCompr->fContinue = FALSE;
|
||||
|
||||
if( pCompr->fInFree )
|
||||
pCompr->inBuffer = ( BYTE * ) hb_xgrab( ulDstBuf );
|
||||
if( pCompr->fOutFree )
|
||||
pCompr->outBuffer = ( BYTE * ) hb_xgrab( ulDstBuf );
|
||||
|
||||
/* initialize the ring buffer with spaces, because SIX uses
|
||||
dynamic ring buffer then we do not have to fill last MAXLENGTH
|
||||
characters */
|
||||
memset( pCompr->ring_buffer, ' ', RBUFLENGTH - MAXLENGTH );
|
||||
|
||||
return pCompr;
|
||||
}
|
||||
|
||||
static BOOL hb_LZSSxFlush( PHB_LZSSX_COMPR pCompr )
|
||||
{
|
||||
if( pCompr->fResult && pCompr->hOutput != FS_ERROR )
|
||||
{
|
||||
if( hb_fsWriteLarge( pCompr->hOutput, pCompr->outBuffer,
|
||||
pCompr->outBuffPos ) != pCompr->outBuffPos )
|
||||
{
|
||||
pCompr->fResult = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
pCompr->ulOutSize += pCompr->outBuffPos;
|
||||
pCompr->outBuffPos = 0;
|
||||
}
|
||||
}
|
||||
return pCompr->fResult;
|
||||
}
|
||||
|
||||
static BOOL hb_LZSSxWrite( PHB_LZSSX_COMPR pCompr, BYTE bVal )
|
||||
{
|
||||
if( pCompr->fResult )
|
||||
{
|
||||
if( pCompr->outBuffPos == pCompr->outBuffSize )
|
||||
hb_LZSSxFlush( pCompr );
|
||||
if( pCompr->outBuffPos < pCompr->outBuffSize )
|
||||
pCompr->outBuffer[pCompr->outBuffPos] = bVal;
|
||||
else
|
||||
pCompr->fResult = FALSE;
|
||||
}
|
||||
pCompr->outBuffPos++;
|
||||
return pCompr->fResult || pCompr->fContinue;
|
||||
}
|
||||
|
||||
static int hb_LZSSxRead( PHB_LZSSX_COMPR pCompr )
|
||||
{
|
||||
if( pCompr->inBuffPos < pCompr->inBuffRead )
|
||||
return pCompr->inBuffer[ pCompr->inBuffPos++ ];
|
||||
|
||||
if( pCompr->hInput != FS_ERROR )
|
||||
{
|
||||
pCompr->inBuffRead = hb_fsReadLarge( pCompr->hInput, pCompr->inBuffer,
|
||||
pCompr->inBuffSize );
|
||||
pCompr->inBuffPos = 0;
|
||||
if( pCompr->inBuffPos < pCompr->inBuffRead )
|
||||
return pCompr->inBuffer[ pCompr->inBuffPos++ ];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static BOOL hb_LZSSxDecode( PHB_LZSSX_COMPR pCompr )
|
||||
{
|
||||
BOOL fResult = TRUE;
|
||||
USHORT itemMask;
|
||||
int offset, length, index, c, h;
|
||||
|
||||
index = RBUFLENGTH - MAXLENGTH;
|
||||
itemMask = 0;
|
||||
|
||||
do
|
||||
{
|
||||
itemMask >>= 1;
|
||||
/* Is the next character bitfield with type of next 8 items ? */
|
||||
if( ( itemMask & 0x0100 ) == 0 )
|
||||
{
|
||||
if( ( c = hb_LZSSxRead( pCompr ) ) == -1 )
|
||||
break;
|
||||
/* simple trick to reduce number of shift operations */
|
||||
itemMask = c | 0xff00;
|
||||
}
|
||||
if( ( c = hb_LZSSxRead( pCompr ) ) == -1 )
|
||||
break;
|
||||
|
||||
if( itemMask & 1 ) /* Is the next character normal byte ? */
|
||||
{
|
||||
if( ! hb_LZSSxWrite( pCompr, ( BYTE ) c ) )
|
||||
{
|
||||
fResult = FALSE;
|
||||
break;
|
||||
}
|
||||
pCompr->ring_buffer[ index ] = ( BYTE ) c;
|
||||
index = RBUFINDEX( index + 1 );
|
||||
}
|
||||
else /* we have an item pair (ring buffer offset : match length) */
|
||||
{
|
||||
if( ( h = hb_LZSSxRead( pCompr ) ) == -1 )
|
||||
{
|
||||
/* fResult = FALSE; */
|
||||
break;
|
||||
}
|
||||
offset = LZSS_OFFSET( c, h ); /* get offset to ring buffer */
|
||||
length = LZSS_LENGTH( c, h ); /* get match length */
|
||||
for( h = 0; h < length; h++ )
|
||||
{
|
||||
c = pCompr->ring_buffer[ RBUFINDEX( offset + h ) ];
|
||||
if( ! hb_LZSSxWrite( pCompr, ( BYTE ) c ) )
|
||||
{
|
||||
fResult = FALSE;
|
||||
break;
|
||||
}
|
||||
/* SIX does not use additional buffers and dynamically
|
||||
overwrite the ring buffer - we have to make exactly
|
||||
the same or our results will be differ when
|
||||
abs( offset - index ) < length */
|
||||
pCompr->ring_buffer[ index ] = ( BYTE ) c;
|
||||
index = RBUFINDEX( index + 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
while( fResult );
|
||||
|
||||
if( fResult )
|
||||
fResult = hb_LZSSxFlush( pCompr );
|
||||
return fResult;
|
||||
}
|
||||
|
||||
static void hb_LZSSxNodeInsert( PHB_LZSSX_COMPR pCompr, int r )
|
||||
{
|
||||
int i, p, cmp;
|
||||
unsigned char *key;
|
||||
|
||||
cmp = 1;
|
||||
key = &pCompr->ring_buffer[ r ];
|
||||
p = RBUFLENGTH + 1 + key[ 0 ];
|
||||
pCompr->right[ r ] = pCompr->left[ r ] = DUMMYNODE;
|
||||
pCompr->match_length = 0;
|
||||
|
||||
for( ; ; )
|
||||
{
|
||||
if( cmp >= 0 )
|
||||
{
|
||||
if( pCompr->right[ p ] != DUMMYNODE )
|
||||
p = pCompr->right[ p ];
|
||||
else
|
||||
{
|
||||
pCompr->right[ p ] = r;
|
||||
pCompr->parent[ r ] = p;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pCompr->left[ p ] != DUMMYNODE )
|
||||
p = pCompr->left[ p ];
|
||||
else
|
||||
{
|
||||
pCompr->left[ p ] = r;
|
||||
pCompr->parent[ r ] = p;
|
||||
return;
|
||||
}
|
||||
}
|
||||
for( i = 1; i < MAXLENGTH; i++ )
|
||||
{
|
||||
if( ( cmp = key[ i ] - pCompr->ring_buffer[ p + i ] ) != 0 )
|
||||
break;
|
||||
}
|
||||
if( i > pCompr->match_length )
|
||||
{
|
||||
pCompr->match_offset = p;
|
||||
pCompr->match_length = i;
|
||||
if( i >= MAXLENGTH )
|
||||
break;
|
||||
}
|
||||
}
|
||||
pCompr->parent[ r ] = pCompr->parent[ p ];
|
||||
pCompr->left[ r ] = pCompr->left[ p ];
|
||||
pCompr->right[ r ] = pCompr->right[ p ];
|
||||
pCompr->parent[ pCompr->left[ p ] ] = r;
|
||||
pCompr->parent[ pCompr->right[ p ] ] = r;
|
||||
if( pCompr->right[ pCompr->parent[ p ] ] == p )
|
||||
pCompr->right[ pCompr->parent[ p ] ] = r;
|
||||
else
|
||||
pCompr->left[ pCompr->parent[ p ] ] = r;
|
||||
pCompr->parent[ p ] = DUMMYNODE;
|
||||
}
|
||||
|
||||
static void hb_LZSSxNodeDelete( PHB_LZSSX_COMPR pCompr, int p )
|
||||
{
|
||||
if( pCompr->parent[ p ] != DUMMYNODE )
|
||||
{
|
||||
int q;
|
||||
if( pCompr->right[ p ] == DUMMYNODE )
|
||||
q = pCompr->left[ p ];
|
||||
else if( pCompr->left[ p ] == DUMMYNODE )
|
||||
q = pCompr->right[ p ];
|
||||
else
|
||||
{
|
||||
q = pCompr->left[ p ];
|
||||
if( pCompr->right[ q ] != DUMMYNODE )
|
||||
{
|
||||
do
|
||||
{
|
||||
q = pCompr->right[ q ];
|
||||
}
|
||||
while( pCompr->right[ q ] != DUMMYNODE );
|
||||
pCompr->right[ pCompr->parent[ q ] ] = pCompr->left[ q ];
|
||||
pCompr->parent[ pCompr->left[ q ] ] = pCompr->parent[ q ];
|
||||
pCompr->left[ q ] = pCompr->left[ p ];
|
||||
pCompr->parent[ pCompr->left[ p ] ] = q;
|
||||
}
|
||||
pCompr->right[ q ] = pCompr->right[ p ];
|
||||
pCompr->parent[ pCompr->right[ p ] ] = q;
|
||||
}
|
||||
pCompr->parent[ q ] = pCompr->parent[ p ];
|
||||
if( pCompr->right[ pCompr->parent[ p ] ] == p )
|
||||
pCompr->right[ pCompr->parent[ p ] ] = q;
|
||||
else
|
||||
pCompr->left[ pCompr->parent[ p ] ] = q;
|
||||
pCompr->parent[ p ] = DUMMYNODE;
|
||||
}
|
||||
}
|
||||
|
||||
static ULONG hb_LZSSxEncode( PHB_LZSSX_COMPR pCompr )
|
||||
{
|
||||
BYTE itemSet[ITEMSETSIZE];
|
||||
BYTE itemMask;
|
||||
ULONG ulSize = 0;
|
||||
int iItem;
|
||||
short int i, c, len, r, s, last_match_length;
|
||||
|
||||
for( i = RBUFLENGTH + 1; i < RBUFLENGTH + 257; i++ )
|
||||
pCompr->right[i] = DUMMYNODE;
|
||||
for( i = 0; i < RBUFLENGTH; i++ )
|
||||
pCompr->parent[ i ] = DUMMYNODE;
|
||||
|
||||
itemSet[ 0 ] = 0;
|
||||
iItem = itemMask = 1;
|
||||
s = 0;
|
||||
r = RBUFLENGTH - MAXLENGTH;
|
||||
|
||||
for( len = 0; len < MAXLENGTH; len++ )
|
||||
{
|
||||
if( ( c = hb_LZSSxRead( pCompr ) ) == -1 )
|
||||
break;
|
||||
pCompr->ring_buffer[ r + len ] = c;
|
||||
}
|
||||
if( len == 0 )
|
||||
return ulSize;
|
||||
|
||||
for( i = 1; i <= MAXLENGTH; i++ )
|
||||
hb_LZSSxNodeInsert( pCompr, r - i );
|
||||
hb_LZSSxNodeInsert( pCompr, r );
|
||||
|
||||
do
|
||||
{
|
||||
if( pCompr->match_length > len )
|
||||
pCompr->match_length = len;
|
||||
if( pCompr->match_length < MINLENGTH )
|
||||
{
|
||||
pCompr->match_length = 1;
|
||||
itemSet[ 0 ] |= itemMask;
|
||||
itemSet[ iItem++ ] = pCompr->ring_buffer[ r ];
|
||||
}
|
||||
else
|
||||
{
|
||||
itemSet[iItem++] = LZSS_ITMLO( pCompr->match_offset,
|
||||
pCompr->match_length );
|
||||
itemSet[iItem++] = LZSS_ITMHI( pCompr->match_offset,
|
||||
pCompr->match_length );
|
||||
}
|
||||
if( ( itemMask <<= 1 ) == 0 )
|
||||
{
|
||||
for( i = 0; i < iItem; i++ )
|
||||
{
|
||||
if( !hb_LZSSxWrite( pCompr, itemSet[ i ] ) )
|
||||
return ( ULONG ) -1;
|
||||
}
|
||||
ulSize += iItem;
|
||||
itemSet[ 0 ] = 0;
|
||||
iItem = itemMask = 1;
|
||||
}
|
||||
last_match_length = pCompr->match_length;
|
||||
for( i = 0; i < last_match_length &&
|
||||
( c = hb_LZSSxRead( pCompr ) ) != -1; i++ )
|
||||
{
|
||||
hb_LZSSxNodeDelete( pCompr, s );
|
||||
pCompr->ring_buffer[ s ] = c;
|
||||
if( s < MAXLENGTH - 1 )
|
||||
pCompr->ring_buffer[ s + RBUFLENGTH ] = c;
|
||||
s = RBUFINDEX( s + 1 );
|
||||
r = RBUFINDEX( r + 1 );
|
||||
hb_LZSSxNodeInsert( pCompr, r );
|
||||
}
|
||||
while( i++ < last_match_length )
|
||||
{
|
||||
hb_LZSSxNodeDelete( pCompr, s );
|
||||
s = RBUFINDEX( s + 1 );
|
||||
r = RBUFINDEX( r + 1 );
|
||||
if( --len )
|
||||
hb_LZSSxNodeInsert( pCompr, r );
|
||||
}
|
||||
} while( len > 0 );
|
||||
|
||||
if( iItem > 1 )
|
||||
{
|
||||
for( i = 0; i < iItem; i++ )
|
||||
{
|
||||
if( !hb_LZSSxWrite( pCompr, itemSet[ i ] ) )
|
||||
return ( ULONG ) -1;
|
||||
}
|
||||
ulSize += iItem;
|
||||
}
|
||||
|
||||
if( !hb_LZSSxFlush( pCompr ) )
|
||||
return ( ULONG ) -1;
|
||||
|
||||
return ulSize;
|
||||
}
|
||||
|
||||
|
||||
BOOL hb_LZSSxCompressMem( BYTE * pSrcBuf, ULONG ulSrcLen,
|
||||
BYTE * pDstBuf, ULONG ulDstLen,
|
||||
ULONG * pulSize )
|
||||
{
|
||||
PHB_LZSSX_COMPR pCompr;
|
||||
ULONG ulSize;
|
||||
|
||||
pCompr = hb_LZSSxInit( FS_ERROR, pSrcBuf, ulSrcLen,
|
||||
FS_ERROR, pDstBuf, ulDstLen );
|
||||
ulSize = hb_LZSSxEncode( pCompr );
|
||||
hb_LZSSxExit( pCompr );
|
||||
if( pulSize )
|
||||
*pulSize = ulSize;
|
||||
return ( ulSize <= ulDstLen );
|
||||
}
|
||||
|
||||
BOOL hb_LZSSxDecompressMem( BYTE * pSrcBuf, ULONG ulSrcLen,
|
||||
BYTE * pDstBuf, ULONG ulDstLen )
|
||||
{
|
||||
PHB_LZSSX_COMPR pCompr;
|
||||
BOOL fResult;
|
||||
|
||||
pCompr = hb_LZSSxInit( FS_ERROR, pSrcBuf, ulSrcLen,
|
||||
FS_ERROR, pDstBuf, ulDstLen );
|
||||
fResult = hb_LZSSxDecode( pCompr );
|
||||
hb_LZSSxExit( pCompr );
|
||||
return fResult;
|
||||
}
|
||||
|
||||
BOOL hb_LZSSxCompressFile( FHANDLE hInput, FHANDLE hOutput, ULONG * pulSize )
|
||||
{
|
||||
PHB_LZSSX_COMPR pCompr;
|
||||
ULONG ulSize;
|
||||
|
||||
pCompr = hb_LZSSxInit( hInput, NULL, 0, hOutput, NULL, 0 );
|
||||
ulSize = hb_LZSSxEncode( pCompr );
|
||||
hb_LZSSxExit( pCompr );
|
||||
if( pulSize )
|
||||
*pulSize = ulSize;
|
||||
return ulSize != ( ULONG ) -1;
|
||||
}
|
||||
|
||||
BOOL hb_LZSSxDecompressFile( FHANDLE hInput, FHANDLE hOutput )
|
||||
{
|
||||
PHB_LZSSX_COMPR pCompr;
|
||||
BOOL fResult;
|
||||
|
||||
pCompr = hb_LZSSxInit( hInput, NULL, 0, hOutput, NULL, 0 );
|
||||
fResult = hb_LZSSxDecode( pCompr );
|
||||
hb_LZSSxExit( pCompr );
|
||||
return fResult;
|
||||
}
|
||||
|
||||
HB_FUNC( SX_FCOMPRESS )
|
||||
{
|
||||
BOOL fRet = FALSE;
|
||||
FHANDLE hInput, hOutput;
|
||||
char * szSource = hb_parc( 1 ), * szDestin = hb_parc( 2 );
|
||||
BYTE buf[ 4 ];
|
||||
ULONG ulSize;
|
||||
|
||||
if( szSource && *szSource && szDestin && *szDestin )
|
||||
{
|
||||
hInput = hb_fsExtOpen( ( BYTE * ) szSource, NULL, FO_READ | FO_DENYNONE |
|
||||
FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL );
|
||||
if( hInput != FS_ERROR )
|
||||
{
|
||||
hOutput = hb_fsExtOpen( ( BYTE * ) szDestin, NULL, FO_READWRITE |
|
||||
FO_EXCLUSIVE | FXO_TRUNCATE |
|
||||
FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL );
|
||||
if( hOutput != FS_ERROR )
|
||||
{
|
||||
/* store uncompressed file size in first 4 bytes of destination
|
||||
* file in little endian order - for SIX3 compatibility
|
||||
*/
|
||||
ulSize = hb_fsSeek( hInput, 0, FS_END );
|
||||
if( hb_fsSeek( hInput, 0, FS_SET ) == 0 )
|
||||
{
|
||||
HB_PUT_LE_UINT32( buf, ulSize );
|
||||
if( hb_fsWrite( hOutput, buf, 4 ) == 4 )
|
||||
fRet = hb_LZSSxCompressFile( hInput, hOutput, NULL );
|
||||
}
|
||||
hb_fsClose( hOutput );
|
||||
}
|
||||
hb_fsClose( hInput );
|
||||
}
|
||||
}
|
||||
hb_retl( fRet );
|
||||
}
|
||||
|
||||
HB_FUNC( SX_FDECOMPRESS )
|
||||
{
|
||||
BOOL fRet = FALSE;
|
||||
FHANDLE hInput, hOutput;
|
||||
char * szSource = hb_parc( 1 ), * szDestin = hb_parc( 2 );
|
||||
|
||||
if( szSource && *szSource && szDestin && *szDestin )
|
||||
{
|
||||
hInput = hb_fsExtOpen( ( BYTE * ) szSource, NULL, FO_READ | FO_DENYNONE |
|
||||
FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL );
|
||||
if( hInput != FS_ERROR )
|
||||
{
|
||||
hOutput = hb_fsExtOpen( ( BYTE * ) szDestin, NULL, FO_READWRITE |
|
||||
FO_EXCLUSIVE | FXO_TRUNCATE |
|
||||
FXO_DEFAULTS | FXO_SHARELOCK, NULL, NULL );
|
||||
if( hOutput != FS_ERROR )
|
||||
{
|
||||
/* skip the four bytes with original file length */
|
||||
if( hb_fsSeek( hInput, 4, FS_SET ) == 4 )
|
||||
fRet = hb_LZSSxDecompressFile( hInput, hOutput );
|
||||
hb_fsClose( hOutput );
|
||||
}
|
||||
hb_fsClose( hInput );
|
||||
}
|
||||
}
|
||||
hb_retl( fRet );
|
||||
}
|
||||
|
||||
HB_FUNC( _SX_STRCOMPRESS )
|
||||
{
|
||||
BOOL fOK = FALSE;
|
||||
BYTE * pStr = ( BYTE * ) hb_parc( 1 ), * pBuf;
|
||||
|
||||
if( pStr )
|
||||
{
|
||||
ULONG ulLen = hb_parclen( 1 ), ulBuf, ulDst;
|
||||
|
||||
/* this is for strict SIX compatibility - in general very bad idea */
|
||||
ulBuf = ulLen + 257;
|
||||
pBuf = ( BYTE * ) hb_xgrab( ulBuf );
|
||||
HB_PUT_LE_UINT32( pBuf, ulLen );
|
||||
fOK = hb_LZSSxCompressMem( pStr, ulLen, pBuf + 4, ulBuf - 4, &ulDst );
|
||||
if( fOK )
|
||||
hb_retclen( ( char * ) pBuf, ulDst + 4 );
|
||||
hb_xfree( pBuf );
|
||||
}
|
||||
|
||||
if( !fOK )
|
||||
hb_itemReturn( hb_param( 1, HB_IT_ANY ) );
|
||||
}
|
||||
|
||||
HB_FUNC( _SX_STRDECOMPRESS )
|
||||
{
|
||||
BOOL fOK = FALSE;
|
||||
BYTE * pStr = ( BYTE * ) hb_parc( 1 ), * pBuf;
|
||||
|
||||
if( pStr )
|
||||
{
|
||||
ULONG ulLen = hb_parclen( 1 ), ulBuf;
|
||||
|
||||
if( ulLen >= 4 )
|
||||
{
|
||||
ulBuf = HB_GET_LE_UINT32( pStr );
|
||||
pBuf = ( BYTE * ) hb_xalloc( ulBuf );
|
||||
if( pBuf )
|
||||
{
|
||||
fOK = hb_LZSSxDecompressMem( pStr + 4, ulLen - 4, pBuf, ulBuf );
|
||||
if( fOK )
|
||||
hb_retclen( ( char * ) pBuf, ulBuf );
|
||||
hb_xfree( pBuf );
|
||||
}
|
||||
else
|
||||
{
|
||||
PHB_ITEM pItem = hb_errRT_SubstParams( "SIXCOMPRESS", EG_MEM, 0, "possible compressed string corruption", "_SX_STRDECOMPRESS" );
|
||||
hb_itemReturn( pItem );
|
||||
hb_itemRelease( pItem );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !fOK )
|
||||
hb_itemReturn( hb_param( 1, HB_IT_ANY ) );
|
||||
}
|
||||
211
harbour/source/rdd/hbsix/sxcrypt.c
Normal file
211
harbour/source/rdd/hbsix/sxcrypt.c
Normal file
@@ -0,0 +1,211 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* xHarbour Project source code:
|
||||
* SIX compatible functions:
|
||||
* hb_sxEnCrypt()
|
||||
* hb_sxDeCrypt()
|
||||
*
|
||||
* SX_ENCRYPT()
|
||||
* SX_DECRYPT()
|
||||
*
|
||||
* Copyright 2005 Przemyslaw Czerpak <druzus@acn.waw.pl>
|
||||
* www - http://www.xharbour.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hbsxfunc.h"
|
||||
|
||||
#define rnd_mul1 0x0de6d
|
||||
#define rnd_mul2 0x0278D
|
||||
|
||||
static UINT32 hb_sxInitSeed( BYTE * pKeyVal, UINT16 * puiKey )
|
||||
{
|
||||
UINT32 ulSeed = 0;
|
||||
int i;
|
||||
|
||||
for( i = 0; i < 7 ; i++ )
|
||||
{
|
||||
ulSeed = ( ( ( ulSeed >> 16 ) + ( ulSeed << 16 ) ) * 17 ) +
|
||||
HB_GET_LE_UINT16( &pKeyVal[i] );
|
||||
}
|
||||
ulSeed |= 1;
|
||||
*puiKey = ( UINT16 ) ulSeed;
|
||||
return ( ulSeed << 16 ) + ( ulSeed >> 16 );
|
||||
}
|
||||
|
||||
static UINT32 hb_sxNextSeed( UINT32 ulSeed, BYTE * pKeyVal, UINT16 * puiKey )
|
||||
{
|
||||
UINT32 ulTemp1, ulTemp2;
|
||||
UINT16 uiSeedLo, uiSeedHi;
|
||||
|
||||
uiSeedLo = ( UINT16 ) ulSeed;
|
||||
ulTemp1 = ( UINT32 ) rnd_mul1 * ( UINT32 ) uiSeedLo;
|
||||
ulTemp2 = ( UINT32 ) rnd_mul2 * ( UINT32 ) uiSeedLo + ( ulTemp1 >> 16 );
|
||||
uiSeedLo = ( UINT16 ) ulTemp1;
|
||||
ulTemp1 = ( UINT32 ) rnd_mul1 * ( ulSeed >> 16 );
|
||||
uiSeedHi = ( UINT16 ) ( ulTemp1 + ulTemp2 );
|
||||
ulSeed = ( ( UINT32 ) uiSeedHi << 16 ) + ( UINT32 ) uiSeedLo;
|
||||
uiSeedHi |= 1;
|
||||
*puiKey = uiSeedHi + HB_GET_LE_UINT16( pKeyVal );
|
||||
return ulSeed;
|
||||
}
|
||||
|
||||
void hb_sxEnCrypt( BYTE * pSrc, BYTE * pDst, BYTE * pKeyVal, ULONG ulLen )
|
||||
{
|
||||
UINT32 ulSeed;
|
||||
UINT16 uiKey;
|
||||
BYTE uChar, uShft;
|
||||
ULONG ul;
|
||||
int i;
|
||||
|
||||
ulSeed = hb_sxInitSeed( pKeyVal, &uiKey );
|
||||
for( ul = 0, i = 0 ; ul < ulLen ; ul++ )
|
||||
{
|
||||
uChar = pSrc[ul];
|
||||
uShft = uiKey & 0x07;
|
||||
pDst[ul] = ( uChar >> uShft ) + ( uChar << ( 8 - uShft ) ) +
|
||||
( uiKey & 0xFF );
|
||||
ulSeed = hb_sxNextSeed( ulSeed, &pKeyVal[i], &uiKey );
|
||||
if( ++i == 7 )
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void hb_sxDeCrypt( BYTE * pSrc, BYTE * pDst, BYTE * pKeyVal, ULONG ulLen )
|
||||
{
|
||||
UINT32 ulSeed;
|
||||
UINT16 uiKey;
|
||||
BYTE uChar, uShft;
|
||||
ULONG ul;
|
||||
int i;
|
||||
|
||||
ulSeed = hb_sxInitSeed( pKeyVal, &uiKey );
|
||||
for( ul = 0, i = 0 ; ul < ulLen ; ul++ )
|
||||
{
|
||||
uChar = pSrc[ul] - ( uiKey & 0xFF );
|
||||
uShft = uiKey & 0x07;
|
||||
pDst[ul] = ( uChar << uShft ) + ( uChar >> ( 8 - uShft ) );
|
||||
ulSeed = hb_sxNextSeed( ulSeed, &pKeyVal[i], &uiKey );
|
||||
if( ++i == 7 )
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL _hb_sxGetKey( PHB_ITEM pKeyItem, BYTE * pKeyVal )
|
||||
{
|
||||
BOOL fResult = FALSE;
|
||||
PHB_ITEM pItem = NULL;
|
||||
ULONG ulKey;
|
||||
|
||||
if( ! ( hb_itemType( pKeyItem ) & HB_IT_STRING ) )
|
||||
{
|
||||
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
|
||||
|
||||
if( pArea )
|
||||
{
|
||||
pItem = hb_itemNew( NULL );
|
||||
if( SELF_INFO( pArea, DBI_PASSWORD, pItem ) == SUCCESS )
|
||||
pKeyItem = pItem;
|
||||
}
|
||||
}
|
||||
if( hb_itemType( pKeyItem ) & HB_IT_STRING )
|
||||
{
|
||||
ulKey = hb_itemGetCLen( pKeyItem );
|
||||
if( ulKey )
|
||||
memcpy( pKeyVal, hb_itemGetCPtr( pKeyItem ), HB_MIN( ulKey, 8 ) );
|
||||
if( ulKey < 8 )
|
||||
memset( pKeyVal + ulKey, 0, 8 - ulKey );
|
||||
fResult = TRUE;
|
||||
}
|
||||
if( pItem )
|
||||
hb_itemRelease( pItem );
|
||||
return fResult;
|
||||
}
|
||||
|
||||
HB_FUNC( SX_ENCRYPT )
|
||||
{
|
||||
if( hb_pcount() > 0 )
|
||||
{
|
||||
BYTE keyBuf[ 8 ];
|
||||
ULONG ulLen = hb_parclen( 1 );
|
||||
|
||||
if( ulLen > 0 && _hb_sxGetKey( hb_param( 2, HB_IT_ANY ), keyBuf ) )
|
||||
{
|
||||
BYTE * pDst = ( BYTE * ) hb_xgrab( ulLen + 1 );
|
||||
hb_sxEnCrypt( ( BYTE * ) hb_parc( 1 ), pDst, keyBuf, ulLen );
|
||||
pDst[ ulLen ] = 0;
|
||||
hb_retclen_buffer( ( char * ) pDst, ulLen );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_itemReturn( hb_param( 1, HB_IT_ANY ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
hb_ret();
|
||||
}
|
||||
|
||||
HB_FUNC( SX_DECRYPT )
|
||||
{
|
||||
if( hb_pcount() > 0 )
|
||||
{
|
||||
BYTE keyBuf[ 8 ];
|
||||
ULONG ulLen = hb_parclen( 1 );
|
||||
|
||||
if( ulLen > 0 && _hb_sxGetKey( hb_param( 2, HB_IT_ANY ), keyBuf ) )
|
||||
{
|
||||
BYTE * pDst = ( BYTE * ) hb_xgrab( ulLen + 1 );
|
||||
hb_sxDeCrypt( ( BYTE * ) hb_parc( 1 ), pDst, keyBuf, ulLen );
|
||||
pDst[ ulLen ] = 0;
|
||||
hb_retclen_buffer( ( char * ) pDst, ulLen );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_itemReturn( hb_param( 1, HB_IT_ANY ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
hb_ret();
|
||||
}
|
||||
103
harbour/source/rdd/hbsix/sxdate.c
Normal file
103
harbour/source/rdd/hbsix/sxdate.c
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* xHarbour Project source code:
|
||||
* SIX compatible functions:
|
||||
* hb_sxDtoP()
|
||||
* hb_sxPtoD()
|
||||
*
|
||||
* SX_DTOP()
|
||||
* SX_PTOD()
|
||||
*
|
||||
* Copyright 2005 Przemyslaw Czerpak <druzus@acn.waw.pl>
|
||||
* www - http://www.xharbour.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hbsxfunc.h"
|
||||
|
||||
char * hb_sxDtoP( char * pDate, LONG lJulian )
|
||||
{
|
||||
int iYear, iMonth, iDay;
|
||||
LONG lPDate;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_sxDtoP(%p, %ld)", pDate, lJulian));
|
||||
|
||||
hb_dateDecode( lJulian, &iYear, &iMonth, &iDay );
|
||||
lPDate = ( ( ( iYear << 1 ) | ( iMonth >> 3 ) ) << 8 ) |
|
||||
( ( iMonth & 7 ) << 5 ) | iDay;
|
||||
HB_PUT_BE_UINT24( pDate, lPDate );
|
||||
|
||||
return pDate;
|
||||
}
|
||||
|
||||
LONG hb_sxPtoD( char * pDate )
|
||||
{
|
||||
int iYear, iMonth, iDay;
|
||||
LONG lPDate;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_sxPtoD(%p)", pDate));
|
||||
|
||||
if( pDate )
|
||||
{
|
||||
lPDate = HB_GET_BE_UINT24( pDate );
|
||||
iDay = lPDate & 0x1f;
|
||||
iMonth = ( lPDate >> 5 ) & 0x0f;
|
||||
iYear = ( lPDate >> 9 );
|
||||
|
||||
return hb_dateEncode( iYear, iMonth, iDay );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
HB_FUNC( SX_DTOP )
|
||||
{
|
||||
char pDate[ 3 ];
|
||||
hb_retclen( hb_sxDtoP( pDate, hb_pardl( 1 ) ), 3 );
|
||||
}
|
||||
|
||||
HB_FUNC( SX_PTOD )
|
||||
{
|
||||
hb_retdl( hb_sxPtoD( hb_parclen( 1 ) < 3 ? NULL : hb_parc( 1 ) ) );
|
||||
}
|
||||
13
harbour/source/rdd/hsx/Makefile
Normal file
13
harbour/source/rdd/hsx/Makefile
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
ROOT = ../../../
|
||||
|
||||
C_SOURCES=\
|
||||
hsx.c \
|
||||
cftsfunc.c \
|
||||
|
||||
LIBNAME=hsx
|
||||
|
||||
include $(TOP)$(ROOT)config/lib.cf
|
||||
139
harbour/source/rdd/hsx/cftsfunc.c
Normal file
139
harbour/source/rdd/hsx/cftsfunc.c
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* xHarbour Project source code:
|
||||
* HiPer-SEEK / CFTS compatible library
|
||||
* Cfts*() functions
|
||||
*
|
||||
* Copyright 2005 Przemyslaw Czerpak <druzus@acn.waw.pl>
|
||||
* www - http://www.xharbour.org
|
||||
*
|
||||
* Credits:
|
||||
* Many thanks for Mindaugas Kavaliauskas for his assistance,
|
||||
* informations about HSX internals, code checking and general
|
||||
* helping in many things when this library was written.
|
||||
* Przemek.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries with other
|
||||
* files to produce an executable, this does not by itself cause the
|
||||
* resulting executable to be covered by the GNU General Public License.
|
||||
* Your use of that executable is in no way restricted on account of
|
||||
* linking the Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "hbapi.h"
|
||||
|
||||
HB_FUNC_EXTERN( HS_ADD );
|
||||
HB_FUNC_EXTERN( HS_CLOSE );
|
||||
HB_FUNC_EXTERN( HS_CREATE );
|
||||
HB_FUNC_EXTERN( HS_DELETE );
|
||||
HB_FUNC_EXTERN( HS_IFDEL );
|
||||
HB_FUNC_EXTERN( HS_NEXT );
|
||||
HB_FUNC_EXTERN( HS_OPEN );
|
||||
HB_FUNC_EXTERN( HS_KEYCOUNT );
|
||||
HB_FUNC_EXTERN( HS_REPLACE );
|
||||
HB_FUNC_EXTERN( HS_SET );
|
||||
HB_FUNC_EXTERN( HS_UNDELETE );
|
||||
HB_FUNC_EXTERN( HS_VERIFY );
|
||||
HB_FUNC_EXTERN( HS_VERSION );
|
||||
|
||||
HB_FUNC( CFTSADD )
|
||||
{
|
||||
HB_FUNCNAME( HS_ADD )();
|
||||
}
|
||||
|
||||
HB_FUNC( CFTSCLOSE )
|
||||
{
|
||||
HB_FUNCNAME( HS_CLOSE )();
|
||||
}
|
||||
|
||||
HB_FUNC( CFTSCREA )
|
||||
{
|
||||
HB_FUNCNAME( HS_CREATE )();
|
||||
}
|
||||
|
||||
HB_FUNC( CFTSDELETE )
|
||||
{
|
||||
HB_FUNCNAME( HS_DELETE )();
|
||||
}
|
||||
|
||||
HB_FUNC( CFTSIFDEL )
|
||||
{
|
||||
HB_FUNCNAME( HS_IFDEL )();
|
||||
}
|
||||
|
||||
HB_FUNC( CFTSNEXT )
|
||||
{
|
||||
HB_FUNCNAME( HS_NEXT )();
|
||||
}
|
||||
|
||||
HB_FUNC( CFTSOPEN )
|
||||
{
|
||||
HB_FUNCNAME( HS_OPEN )();
|
||||
}
|
||||
|
||||
HB_FUNC( CFTSRECN )
|
||||
{
|
||||
HB_FUNCNAME( HS_KEYCOUNT )();
|
||||
}
|
||||
|
||||
HB_FUNC( CFTSREPLAC )
|
||||
{
|
||||
HB_FUNCNAME( HS_REPLACE )();
|
||||
}
|
||||
|
||||
HB_FUNC( CFTSSET )
|
||||
{
|
||||
HB_FUNCNAME( HS_SET )();
|
||||
}
|
||||
|
||||
HB_FUNC( CFTSUNDEL )
|
||||
{
|
||||
HB_FUNCNAME( HS_UNDELETE )();
|
||||
}
|
||||
|
||||
HB_FUNC( CFTSVERI )
|
||||
{
|
||||
HB_FUNCNAME( HS_VERIFY )();
|
||||
}
|
||||
|
||||
HB_FUNC( CFTSVERS )
|
||||
{
|
||||
HB_FUNCNAME( HS_VERSION )();
|
||||
}
|
||||
1966
harbour/source/rdd/hsx/hsx.c
Normal file
1966
harbour/source/rdd/hsx/hsx.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@
|
||||
* Copyright 1999 Bruno Cantero <bruno@issnet.net>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* This program is hb_xfree software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
@@ -54,6 +54,147 @@
|
||||
|
||||
ANNOUNCE RDDSYS
|
||||
|
||||
init procedure RDDInit
|
||||
PROCEDURE RDDInit
|
||||
|
||||
return
|
||||
RETURN
|
||||
|
||||
PROCEDURE DBFInit
|
||||
|
||||
RETURN
|
||||
|
||||
#pragma BEGINDUMP
|
||||
|
||||
#include "hbrddwrk.h"
|
||||
|
||||
HB_FUNC ( NETERR ) { hb_retl( FALSE ); }
|
||||
|
||||
HB_FUNC ( FIELDPOS ) { hb_retni( 0 ); }
|
||||
|
||||
HB_FUNC( DBRELATION ) { hb_retc( NULL ); }
|
||||
|
||||
HB_FUNC( DBRSELECT ) { hb_retni( 0 ); }
|
||||
|
||||
HB_FUNC( ORDNAME ) { hb_retc( NULL ); }
|
||||
|
||||
HB_FUNC( INDEXORD ) { hb_parni(1); }
|
||||
|
||||
HB_FUNC( RDDNAME ) { hb_retc( NULL ); }
|
||||
|
||||
HB_FUNC( RDDLIST ) { hb_reta( 0 ); }
|
||||
|
||||
HB_FUNC( DBCREATE ) {}
|
||||
|
||||
HB_FUNC( DBCLOSEAREA ) {}
|
||||
|
||||
HB_FUNC( ALIAS ) { hb_retc( NULL ); }
|
||||
|
||||
HB_FUNC( DBAPPEND ) {}
|
||||
|
||||
HB_FUNC( DBSKIP ) { hb_retni( 0 ); }
|
||||
|
||||
HB_FUNC( FIELDGET ) { hb_retc( NULL ); }
|
||||
|
||||
HB_FUNC( FIELDPUT ) { hb_retc( NULL ); }
|
||||
|
||||
HB_FUNC( DBUNLOCK ) { hb_retl( FALSE ); }
|
||||
|
||||
HB_FUNC( DBSKIPPER ) { hb_retni( 0 ); }
|
||||
|
||||
HB_FUNC( DBSEEK ) { hb_retl( FALSE ); }
|
||||
|
||||
HB_FUNC( DBGOTO ) { hb_retni( 0 ); }
|
||||
|
||||
HB_FUNC( INDEXKEY ) { hb_retc( NULL ); }
|
||||
|
||||
HB_FUNC( DBGOTOP ) {}
|
||||
|
||||
HB_FUNC( DBGOBOTTOM ) {}
|
||||
|
||||
HB_FUNC( USED ) { hb_retl( FALSE ); }
|
||||
|
||||
HB_FUNC( SELECT ) { hb_retni( 0 ); }
|
||||
|
||||
HB_FUNC( LOCK ) { hb_retl( FALSE ); }
|
||||
|
||||
HB_FUNC( LASTREC ) { hb_retni( 0 ); }
|
||||
|
||||
HB_FUNC( FOUND ) { hb_retl( FALSE ); }
|
||||
|
||||
HB_FUNC( FLOCK ) { hb_retl( FALSE ); }
|
||||
|
||||
HB_FUNC( DELETED ) { hb_retl( FALSE ); }
|
||||
|
||||
HB_FUNC( BOF ) { hb_retl( FALSE ); }
|
||||
|
||||
HB_FUNC( FIELDNAME ) { hb_retc( NULL ); }
|
||||
|
||||
HB_FUNC( RECCOUNT ) { hb_parni( 0 ); }
|
||||
|
||||
HB_FUNC( FCOUNT ) { hb_parni( 0 ); }
|
||||
|
||||
HB_FUNC( RLOCK ) { hb_retl( FALSE ); }
|
||||
|
||||
HB_FUNC( RECNO ) { hb_retni( 0 ); }
|
||||
|
||||
HB_FUNC( EOF ) { hb_retl( FALSE ); }
|
||||
|
||||
void hb_rddShutDown( void ) {}
|
||||
|
||||
ERRCODE HB_EXPORT hb_rddFieldPut( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pItem );
|
||||
HB_SYMBOL_UNUSED( pFieldSymbol );
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ERRCODE HB_EXPORT hb_rddSelectWorkAreaSymbol( PHB_SYMB pSymAlias )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pSymAlias );
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ERRCODE HB_EXPORT hb_rddSelectWorkAreaAlias( char * szName )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( szName );
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ERRCODE HB_EXPORT hb_rddGetFieldValue( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pItem );
|
||||
HB_SYMBOL_UNUSED( pFieldSymbol );
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ERRCODE HB_EXPORT hb_rddFieldGet( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pItem );
|
||||
HB_SYMBOL_UNUSED( pFieldSymbol );
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ERRCODE HB_EXPORT hb_rddSelectWorkAreaNumber( int iArea )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( iArea );
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
ERRCODE HB_EXPORT hb_rddPutFieldValue( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( pItem );
|
||||
HB_SYMBOL_UNUSED( pFieldSymbol );
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
int HB_EXPORT hb_rddGetCurrentWorkAreaNumber( void )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#pragma ENDDUMP
|
||||
|
||||
@@ -50,19 +50,16 @@
|
||||
*
|
||||
*/
|
||||
|
||||
// Standard Harbour RDDSys system
|
||||
/* Standard Harbour RDDSys system */
|
||||
|
||||
ANNOUNCE RDDSYS
|
||||
|
||||
PROCEDURE RddInit
|
||||
|
||||
REQUEST _DBF
|
||||
REQUEST DBFNTX
|
||||
REQUEST DBFDBT
|
||||
REQUEST DBFFPT
|
||||
|
||||
/* NOTE: Using this internal version of this functions, since at this
|
||||
point the DBFNTX RDD may not be registered, depending on the
|
||||
execution order of INIT procedures. */
|
||||
|
||||
__rddSetDefault( "DBFNTX" )
|
||||
rddSetDefault( "DBFNTX" )
|
||||
|
||||
return
|
||||
|
||||
@@ -52,11 +52,11 @@
|
||||
|
||||
#include "rddsys.ch"
|
||||
|
||||
ANNOUNCE _SDF
|
||||
ANNOUNCE SDF
|
||||
|
||||
init procedure SDFInit
|
||||
|
||||
REQUEST _SDFC
|
||||
REQUEST _SDF
|
||||
|
||||
rddRegister( "SDF", RDT_TRANSFER )
|
||||
|
||||
|
||||
@@ -59,20 +59,20 @@
|
||||
|
||||
#define __PRG_SOURCE__ __FILE__
|
||||
|
||||
HB_FUNC( _SDFC );
|
||||
HB_FUNC( _SDF );
|
||||
HB_FUNC( SDF_GETFUNCTABLE );
|
||||
|
||||
#undef HB_PRG_PCODE_VER
|
||||
#define HB_PRG_PCODE_VER HB_PCODE_VER
|
||||
|
||||
HB_INIT_SYMBOLS_BEGIN( sdf1__InitSymbols )
|
||||
{ "_SDFC", HB_FS_PUBLIC, {HB_FUNCNAME( _SDFC )}, NULL },
|
||||
{ "_SDF", HB_FS_PUBLIC, {HB_FUNCNAME( _SDF )}, NULL },
|
||||
{ "SDF_GETFUNCTABLE", HB_FS_PUBLIC, {HB_FUNCNAME( SDF_GETFUNCTABLE )}, NULL }
|
||||
HB_INIT_SYMBOLS_END( sdf1__InitSymbols )
|
||||
|
||||
#if defined(HB_STATIC_STARTUP)
|
||||
#if defined(HB_PRAGMA_STARTUP)
|
||||
#pragma startup sdf1__InitSymbols
|
||||
#elif defined(_MSC_VER)
|
||||
#elif defined(HB_MSC_STARTUP)
|
||||
#if _MSC_VER >= 1010
|
||||
#pragma data_seg( ".CRT$XIY" )
|
||||
#pragma comment( linker, "/Merge:.CRT=.data" )
|
||||
@@ -81,8 +81,6 @@ HB_INIT_SYMBOLS_END( sdf1__InitSymbols )
|
||||
#endif
|
||||
static HB_$INITSYM hb_vm_auto_sdf1__InitSymbols = sdf1__InitSymbols;
|
||||
#pragma data_seg()
|
||||
#elif ! defined(__GNUC__)
|
||||
#pragma startup sdf1__InitSymbols
|
||||
#endif
|
||||
|
||||
static RDDFUNCS sdfSuper;
|
||||
@@ -118,6 +116,7 @@ static RDDFUNCS sdfTable = { hb_sdfBof,
|
||||
hb_sdfRecCount,
|
||||
hb_sdfRecInfo,
|
||||
hb_sdfRecNo,
|
||||
hb_sdfRecId,
|
||||
hb_sdfSetFieldExtent,
|
||||
hb_sdfAlias,
|
||||
hb_sdfClose,
|
||||
@@ -164,6 +163,7 @@ static RDDFUNCS sdfTable = { hb_sdfBof,
|
||||
hb_sdfSetLocate,
|
||||
hb_sdfSetScope,
|
||||
hb_sdfSkipScope,
|
||||
hb_sdfLocate,
|
||||
hb_sdfCompile,
|
||||
hb_sdfError,
|
||||
hb_sdfEvalBlock,
|
||||
@@ -177,9 +177,11 @@ static RDDFUNCS sdfTable = { hb_sdfBof,
|
||||
hb_sdfPutValueFile,
|
||||
hb_sdfReadDBHeader,
|
||||
hb_sdfWriteDBHeader,
|
||||
hb_sdfInit,
|
||||
hb_sdfExit,
|
||||
hb_sdfDrop,
|
||||
hb_sdfExists,
|
||||
hb_sdfRddInfo,
|
||||
hb_sdfWhoCares
|
||||
};
|
||||
|
||||
@@ -190,9 +192,7 @@ static RDDFUNCS sdfTable = { hb_sdfBof,
|
||||
|
||||
|
||||
|
||||
HB_FUNC( _SDFC )
|
||||
{
|
||||
}
|
||||
HB_FUNC( _SDF ) { ; }
|
||||
|
||||
HB_FUNC( SDF_GETFUNCTABLE )
|
||||
{
|
||||
|
||||
@@ -163,21 +163,11 @@ ERRCODE hb_waSkipFilter( AREAP pArea, LONG lUpDown )
|
||||
*/
|
||||
lUpDown = ( lUpDown < 0 ? -1 : 1 );
|
||||
|
||||
/* remember if we are here after SLEF_GOTOP() */
|
||||
fBottom = pArea->fBottom;
|
||||
|
||||
while ( !pArea->fBof && !pArea->fEof )
|
||||
{
|
||||
/* SET FILTER TO */
|
||||
if( pArea->dbfi.itmCobExpr )
|
||||
{
|
||||
pResult = hb_vmEvalBlock( pArea->dbfi.itmCobExpr );
|
||||
if( HB_IS_LOGICAL( pResult ) && !hb_itemGetL( pResult ) )
|
||||
{
|
||||
if ( SELF_SKIPRAW( pArea, lUpDown ) != SUCCESS )
|
||||
return FAILURE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* SET DELETED */
|
||||
if( hb_set.HB_SET_DELETED )
|
||||
{
|
||||
@@ -189,6 +179,20 @@ ERRCODE hb_waSkipFilter( AREAP pArea, LONG lUpDown )
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* SET FILTER TO */
|
||||
if( pArea->dbfi.itmCobExpr )
|
||||
{
|
||||
pResult = hb_vmEvalBlock( pArea->dbfi.itmCobExpr );
|
||||
if( HB_IS_LOGICAL( pResult ) && !hb_itemGetL( pResult ) )
|
||||
{
|
||||
|
||||
if ( SELF_SKIPRAW( pArea, lUpDown ) != SUCCESS )
|
||||
return FAILURE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -201,6 +205,15 @@ ERRCODE hb_waSkipFilter( AREAP pArea, LONG lUpDown )
|
||||
{
|
||||
if ( fBottom )
|
||||
{
|
||||
/* GOTO EOF (phantom) record -
|
||||
this is the only one place where GOTO is used by xHarbour
|
||||
directly and RDD which does not operate on numbers should
|
||||
serve this method only as SELF_GOEOF() synonym. If it's a
|
||||
problem then we can remove this if and always use SELF_GOTOP()
|
||||
but it also means second table scan if all records filtered
|
||||
are out of filter so I do not want to do that. I will prefer
|
||||
explicit add SELF_GOEOF() method
|
||||
*/
|
||||
uiError = SELF_GOTO( pArea, 0 );
|
||||
}
|
||||
else
|
||||
@@ -222,24 +235,25 @@ ERRCODE hb_waSkipFilter( AREAP pArea, LONG lUpDown )
|
||||
*/
|
||||
ERRCODE hb_waAddField( AREAP pArea, LPDBFIELDINFO pFieldInfo )
|
||||
{
|
||||
ULONG ulSize;
|
||||
LPFIELD pField;
|
||||
char szFieldName[ HB_SYMBOL_NAME_LEN + 1 ], *szPtr;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waAddField(%p, %p)", pArea, pFieldInfo));
|
||||
|
||||
/* Validate the name of field */
|
||||
ulSize = strlen( ( char * ) pFieldInfo->atomName );
|
||||
hb_strLTrim( ( char * ) pFieldInfo->atomName, &ulSize );
|
||||
ulSize = hb_strRTrimLen( ( char * ) pFieldInfo->atomName, ulSize, TRUE );
|
||||
if( !ulSize )
|
||||
szPtr = ( char * ) pFieldInfo->atomName;
|
||||
while( HB_ISSPACE( *szPtr ) )
|
||||
{
|
||||
++szPtr;
|
||||
}
|
||||
hb_strncpyUpperTrim( szFieldName, szPtr, HB_SYMBOL_NAME_LEN );
|
||||
if( strlen( szFieldName ) == 0 )
|
||||
return FAILURE;
|
||||
/* This line writes to the protected memory
|
||||
pFieldInfo->atomName[ulSize] = '\0'; */
|
||||
|
||||
pField = pArea->lpFields + pArea->uiFieldCount;
|
||||
if( pArea->uiFieldCount > 0 )
|
||||
( ( LPFIELD ) ( pField - 1 ) )->lpfNext = pField;
|
||||
pField->sym = ( void * ) hb_dynsymGet( ( char * ) pFieldInfo->atomName );
|
||||
pField->sym = ( void * ) hb_dynsymGetCase( szFieldName );
|
||||
pField->uiType = pFieldInfo->uiType;
|
||||
pField->uiTypeExtended = pFieldInfo->uiTypeExtended;
|
||||
pField->uiLen = pFieldInfo->uiLen;
|
||||
@@ -264,9 +278,9 @@ ERRCODE hb_waCreateFields( AREAP pArea, PHB_ITEM pStruct )
|
||||
uiItems = ( USHORT ) hb_arrayLen( pStruct );
|
||||
SELF_SETFIELDEXTENT( pArea, uiItems );
|
||||
|
||||
pFieldInfo.uiTypeExtended = 0;
|
||||
for( uiCount = 0; uiCount < uiItems; uiCount++ )
|
||||
{
|
||||
pFieldInfo.uiTypeExtended = 0;
|
||||
pFieldDesc = hb_arrayGetItemPtr( pStruct, uiCount + 1 );
|
||||
pFieldInfo.atomName = ( BYTE * ) hb_arrayGetCPtr( pFieldDesc, 1 );
|
||||
iData = hb_arrayGetNI( pFieldDesc, 3 );
|
||||
@@ -283,11 +297,15 @@ ERRCODE hb_waCreateFields( AREAP pArea, PHB_ITEM pStruct )
|
||||
{
|
||||
case 'C':
|
||||
pFieldInfo.uiType = HB_IT_STRING;
|
||||
pFieldInfo.uiLen = uiLen;
|
||||
/* Too many people reported the behavior with code below as a
|
||||
Clipper compatibility bug so I commented this code. Druzus.
|
||||
#ifdef HB_C52_STRICT
|
||||
pFieldInfo.uiLen = uiLen;
|
||||
#else
|
||||
pFieldInfo.uiLen = uiLen + uiDec * 256;
|
||||
#endif
|
||||
*/
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
@@ -297,12 +315,17 @@ ERRCODE hb_waCreateFields( AREAP pArea, PHB_ITEM pStruct )
|
||||
|
||||
case 'M':
|
||||
pFieldInfo.uiType = HB_IT_MEMO;
|
||||
pFieldInfo.uiLen = (uiLen == 4) ? 4 : 10;
|
||||
pFieldInfo.uiLen = ( uiLen == 4 ) ? 4 : 10;
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
pFieldInfo.uiType = HB_IT_ANY;
|
||||
pFieldInfo.uiLen = ( uiLen < 3 || uiLen == 5 ) ? 6 : uiLen;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
pFieldInfo.uiType = HB_IT_DATE;
|
||||
pFieldInfo.uiLen = ( uiLen == 3 ) ? 3 : 8;
|
||||
pFieldInfo.uiLen = ( uiLen == 3 || uiLen == 4 ) ? uiLen : 8;
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
@@ -394,6 +417,10 @@ ERRCODE hb_waFieldInfo( AREAP pArea, USHORT uiIndex, USHORT uiType, PHB_ITEM pIt
|
||||
hb_itemPutC( pItem, "M" );
|
||||
break;
|
||||
|
||||
case HB_IT_ANY:
|
||||
hb_itemPutC( pItem, "V" );
|
||||
break;
|
||||
|
||||
case HB_IT_DATE:
|
||||
hb_itemPutC( pItem, "D" );
|
||||
break;
|
||||
@@ -547,7 +574,9 @@ ERRCODE hb_waClose( AREAP pArea )
|
||||
hb_rddIterateWorkAreas ( hb_waCloseAux, pArea->uiArea );
|
||||
}
|
||||
|
||||
( ( PHB_DYNS ) pArea->atomAlias )->hArea = 0;
|
||||
if( pArea->atomAlias )
|
||||
( ( PHB_DYNS ) pArea->atomAlias )->hArea = 0;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -566,6 +595,15 @@ ERRCODE hb_waInfo( AREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
hb_itemPutL( pItem, FALSE );
|
||||
break;
|
||||
|
||||
/*
|
||||
* IMHO better to return FAILURE to notice that it's not supported
|
||||
*/
|
||||
case DBI_GETDELIMITER:
|
||||
case DBI_SETDELIMITER:
|
||||
case DBI_SEPARATOR:
|
||||
hb_itemPutC( pItem, "" );
|
||||
return FAILURE;
|
||||
|
||||
case DBI_CHILDCOUNT:
|
||||
{
|
||||
LPDBRELINFO lpdbRelations = pArea->lpdbRelations;
|
||||
@@ -599,7 +637,7 @@ ERRCODE hb_waInfo( AREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
break;
|
||||
|
||||
case DBI_FCOUNT:
|
||||
hb_itemPutL( pItem, pArea->uiFieldCount );
|
||||
hb_itemPutNI( pItem, pArea->uiFieldCount );
|
||||
break;
|
||||
|
||||
case DBI_ALIAS:
|
||||
@@ -613,6 +651,18 @@ ERRCODE hb_waInfo( AREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
break;
|
||||
}
|
||||
|
||||
case DBI_RM_SUPPORTED:
|
||||
hb_itemPutL( pItem, FALSE );
|
||||
break;
|
||||
|
||||
case DBI_DB_VERSION:
|
||||
hb_itemPutC( pItem, "" );
|
||||
break;
|
||||
|
||||
case DBI_RDD_VERSION:
|
||||
hb_itemPutC( pItem, "" );
|
||||
break;
|
||||
|
||||
default:
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -627,11 +677,11 @@ ERRCODE hb_waInfo( AREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
|
||||
ERRCODE hb_waOrderInfo( AREAP pArea, USHORT index, LPDBORDERINFO param )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waOrderInfo(%p, %hu, %p)", pArea, index, param));
|
||||
|
||||
HB_SYMBOL_UNUSED( pArea );
|
||||
HB_SYMBOL_UNUSED( index );
|
||||
HB_SYMBOL_UNUSED( param );
|
||||
|
||||
if ( param->itmResult )
|
||||
hb_itemRelease( param->itmResult );
|
||||
hb_errRT_DBCMD( EG_ARG, EDBCMD_BADPARAMETER, NULL, "ORDERINFO" );
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -652,6 +702,25 @@ ERRCODE hb_waNewArea( AREAP pArea )
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a data store in the WorkArea.
|
||||
* Like in Clipper it's also mapped as Create() method at WA level
|
||||
*/
|
||||
ERRCODE hb_waOpen( AREAP pArea, LPDBOPENINFO pInfo )
|
||||
{
|
||||
if( !pArea->atomAlias && pInfo->atomAlias && pInfo->atomAlias[ 0 ] )
|
||||
{
|
||||
pArea->atomAlias = hb_rddAllocWorkAreaAlias( ( char * ) pInfo->atomAlias,
|
||||
( int ) pInfo->uiArea );
|
||||
if( ! pArea->atomAlias )
|
||||
{
|
||||
SELF_CLOSE( ( AREAP ) pArea );
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
ERRCODE hb_waOrderCondition( AREAP pArea, LPDBORDERCONDINFO param )
|
||||
{
|
||||
if( pArea->lpdbOrdCondInfo )
|
||||
@@ -672,6 +741,14 @@ ERRCODE hb_waOrderCondition( AREAP pArea, LPDBORDERCONDINFO param )
|
||||
{
|
||||
hb_itemRelease( pArea->lpdbOrdCondInfo->itmCobEval );
|
||||
}
|
||||
if( pArea->lpdbOrdCondInfo->itmStartRecID )
|
||||
{
|
||||
hb_itemRelease( pArea->lpdbOrdCondInfo->itmStartRecID );
|
||||
}
|
||||
if( pArea->lpdbOrdCondInfo->itmRecID )
|
||||
{
|
||||
hb_itemRelease( pArea->lpdbOrdCondInfo->itmRecID );
|
||||
}
|
||||
hb_xfree( pArea->lpdbOrdCondInfo );
|
||||
}
|
||||
pArea->lpdbOrdCondInfo = param;
|
||||
@@ -692,6 +769,7 @@ ERRCODE hb_waRelease( AREAP pArea )
|
||||
if( pArea->valResult )
|
||||
hb_itemRelease( pArea->valResult );
|
||||
if( pArea->lpdbOrdCondInfo )
|
||||
/* intentionally direct call not a method */
|
||||
hb_waOrderCondition( pArea,NULL );
|
||||
hb_xfree( pArea );
|
||||
return SUCCESS;
|
||||
@@ -726,62 +804,123 @@ ERRCODE hb_waSysName( AREAP pArea, BYTE * pBuffer )
|
||||
*/
|
||||
ERRCODE hb_waEval( AREAP pArea, LPDBEVALINFO pEvalInfo )
|
||||
{
|
||||
BOOL bFor, bWhile;
|
||||
LONG lNext;
|
||||
LONG lNext = 1;
|
||||
BOOL fEof;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waEval(%p, %p)", pArea, pEvalInfo));
|
||||
|
||||
lNext = 0;
|
||||
if( pEvalInfo->dbsci.itmRecID )
|
||||
{
|
||||
SELF_GOTO( pArea, hb_itemGetNL( pEvalInfo->dbsci.itmRecID ) );
|
||||
if( !pArea->fEof )
|
||||
{
|
||||
if( pEvalInfo->dbsci.itmCobWhile )
|
||||
bWhile = hb_itemGetL( hb_vmEvalBlock( pEvalInfo->dbsci.itmCobWhile ) );
|
||||
else
|
||||
bWhile = TRUE;
|
||||
|
||||
if( pEvalInfo->dbsci.itmCobFor )
|
||||
bFor = hb_itemGetL( hb_vmEvalBlock( pEvalInfo->dbsci.itmCobFor ) );
|
||||
else
|
||||
bFor = TRUE;
|
||||
|
||||
if( bWhile && bFor )
|
||||
hb_vmEvalBlock( pEvalInfo->itmBlock );
|
||||
}
|
||||
return SUCCESS;
|
||||
if( SELF_GOTOID( pArea, pEvalInfo->dbsci.itmRecID ) == FAILURE )
|
||||
return FAILURE;
|
||||
}
|
||||
else if( pEvalInfo->dbsci.lNext )
|
||||
{
|
||||
lNext = hb_itemGetNL( pEvalInfo->dbsci.lNext );
|
||||
}
|
||||
else if( !pEvalInfo->dbsci.itmCobWhile &&
|
||||
!hb_itemGetL( pEvalInfo->dbsci.fRest ) )
|
||||
{
|
||||
if( SELF_GOTOP( pArea ) == FAILURE )
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if( !pEvalInfo->dbsci.itmCobWhile &&
|
||||
(!pEvalInfo->dbsci.fRest || !hb_itemGetL( pEvalInfo->dbsci.fRest ) ) &&
|
||||
!pEvalInfo->dbsci.lNext )
|
||||
SELF_GOTOP( pArea );
|
||||
|
||||
if( pEvalInfo->dbsci.lNext )
|
||||
lNext = hb_itemGetNL( pEvalInfo->dbsci.lNext );
|
||||
/* TODO: use SKIPSCOPE() method and fRest parameter */
|
||||
|
||||
if( !pEvalInfo->dbsci.lNext || lNext > 0 )
|
||||
{
|
||||
bFor = TRUE;
|
||||
while( !pArea->fEof )
|
||||
while( TRUE )
|
||||
{
|
||||
if( pEvalInfo->dbsci.itmCobWhile )
|
||||
{
|
||||
if ( ! hb_itemGetL( hb_vmEvalBlock( pEvalInfo->dbsci.itmCobWhile ) ) )
|
||||
break;
|
||||
}
|
||||
if( SELF_EOF( pArea, &fEof ) == FAILURE )
|
||||
return FAILURE;
|
||||
|
||||
if( pEvalInfo->dbsci.itmCobFor )
|
||||
bFor = hb_itemGetL( hb_vmEvalBlock( pEvalInfo->dbsci.itmCobFor ) );
|
||||
|
||||
if( bFor )
|
||||
hb_vmEvalBlock( pEvalInfo->itmBlock );
|
||||
|
||||
if( pEvalInfo->dbsci.lNext && --lNext < 1 )
|
||||
if( fEof )
|
||||
break;
|
||||
|
||||
SELF_SKIP( pArea, 1 );
|
||||
if( pEvalInfo->dbsci.itmCobWhile &&
|
||||
! hb_itemGetL( hb_vmEvalBlock( pEvalInfo->dbsci.itmCobWhile ) ) )
|
||||
break;
|
||||
|
||||
if( ! pEvalInfo->dbsci.itmCobFor ||
|
||||
hb_itemGetL( hb_vmEvalBlock( pEvalInfo->dbsci.itmCobFor ) ) )
|
||||
hb_vmEvalBlock( pEvalInfo->itmBlock );
|
||||
|
||||
if( pEvalInfo->dbsci.itmRecID || ( pEvalInfo->dbsci.lNext && --lNext < 1 ) )
|
||||
break;
|
||||
|
||||
if( SELF_SKIP( pArea, 1 ) == FAILURE )
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Locate a record which pass given condition
|
||||
*/
|
||||
ERRCODE hb_waLocate( AREAP pArea, BOOL fContinue )
|
||||
{
|
||||
LONG lNext = 1;
|
||||
BOOL fEof;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waLocate(%p, %d)", pArea, fContinue));
|
||||
|
||||
if( fContinue )
|
||||
{
|
||||
if( ! pArea->dbsi.itmCobFor )
|
||||
return SUCCESS;
|
||||
|
||||
if ( SELF_SKIP( pArea, 1 ) == FAILURE )
|
||||
return FAILURE;
|
||||
}
|
||||
else if( pArea->dbsi.itmRecID )
|
||||
{
|
||||
if( SELF_GOTOID( pArea, pArea->dbsi.itmRecID ) == FAILURE )
|
||||
return FAILURE;
|
||||
}
|
||||
else if( pArea->dbsi.lNext )
|
||||
{
|
||||
lNext = hb_itemGetNL( pArea->dbsi.lNext );
|
||||
}
|
||||
else if( !pArea->dbsi.itmCobWhile &&
|
||||
!hb_itemGetL( pArea->dbsi.fRest ) )
|
||||
{
|
||||
if( SELF_GOTOP( pArea ) == FAILURE )
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
pArea->fFound = FALSE;
|
||||
|
||||
/* TODO: use SKIPSCOPE() method and fRest parameter */
|
||||
|
||||
if( !pArea->dbsi.lNext || lNext > 0 )
|
||||
{
|
||||
while( TRUE )
|
||||
{
|
||||
if( SELF_EOF( pArea, &fEof ) == FAILURE )
|
||||
return FAILURE;
|
||||
|
||||
if( fEof )
|
||||
break;
|
||||
|
||||
if( !fContinue && pArea->dbsi.itmCobWhile &&
|
||||
! hb_itemGetL( hb_vmEvalBlock( pArea->dbsi.itmCobWhile ) ) )
|
||||
break;
|
||||
|
||||
if( ! pArea->dbsi.itmCobFor ||
|
||||
hb_itemGetL( hb_vmEvalBlock( pArea->dbsi.itmCobFor ) ) )
|
||||
{
|
||||
pArea->fFound = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if( !fContinue &&
|
||||
( pArea->dbsi.itmRecID || ( pArea->dbsi.lNext && --lNext < 1 ) ) )
|
||||
break;
|
||||
|
||||
if( SELF_SKIP( pArea, 1 ) == FAILURE )
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -793,11 +932,58 @@ ERRCODE hb_waEval( AREAP pArea, LPDBEVALINFO pEvalInfo )
|
||||
*/
|
||||
ERRCODE hb_waTrans( AREAP pArea, LPDBTRANSINFO pTransInfo )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waTrans(%p, %p)", pArea, pTransInfo));
|
||||
HB_SYMBOL_UNUSED( pArea );
|
||||
HB_SYMBOL_UNUSED( pTransInfo );
|
||||
LONG lNext = 1;
|
||||
BOOL fEof;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waTrans(%p, %p)", pArea, pTransInfo));
|
||||
|
||||
if( pTransInfo->dbsci.itmRecID )
|
||||
{
|
||||
if( SELF_GOTOID( pArea, pTransInfo->dbsci.itmRecID ) == FAILURE )
|
||||
return FAILURE;
|
||||
}
|
||||
else if( pTransInfo->dbsci.lNext )
|
||||
{
|
||||
lNext = hb_itemGetNL( pTransInfo->dbsci.lNext );
|
||||
}
|
||||
else if( !pTransInfo->dbsci.itmCobWhile &&
|
||||
!hb_itemGetL( pTransInfo->dbsci.fRest ) )
|
||||
{
|
||||
if( SELF_GOTOP( pArea ) == FAILURE )
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* TODO: use SKIPSCOPE() method and fRest parameter */
|
||||
|
||||
if( !pTransInfo->dbsci.lNext || lNext > 0 )
|
||||
{
|
||||
while( TRUE )
|
||||
{
|
||||
if( SELF_EOF( pArea, &fEof ) == FAILURE )
|
||||
return FAILURE;
|
||||
|
||||
if( fEof )
|
||||
break;
|
||||
|
||||
if( pTransInfo->dbsci.itmCobWhile &&
|
||||
! hb_itemGetL( hb_vmEvalBlock( pTransInfo->dbsci.itmCobWhile ) ) )
|
||||
break;
|
||||
|
||||
if( ! pTransInfo->dbsci.itmCobFor ||
|
||||
hb_itemGetL( hb_vmEvalBlock( pTransInfo->dbsci.itmCobFor ) ) )
|
||||
{
|
||||
if( SELF_TRANSREC( pArea, pTransInfo ) == FAILURE )
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if( pTransInfo->dbsci.itmRecID || ( pTransInfo->dbsci.lNext && --lNext < 1 ) )
|
||||
break;
|
||||
|
||||
if( SELF_SKIP( pArea, 1 ) == FAILURE )
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
printf( "\nTODO: hb_waTrans()\n" );
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -806,11 +992,69 @@ ERRCODE hb_waTrans( AREAP pArea, LPDBTRANSINFO pTransInfo )
|
||||
*/
|
||||
ERRCODE hb_waTransRec( AREAP pArea, LPDBTRANSINFO pTransInfo )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waTransRec(%p, %p)", pArea, pTransInfo));
|
||||
HB_SYMBOL_UNUSED( pArea );
|
||||
HB_SYMBOL_UNUSED( pTransInfo );
|
||||
BOOL bDeleted;
|
||||
BYTE *pRecord;
|
||||
ERRCODE errCode;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waTransRec(%p, %p)", pArea, pTransInfo));
|
||||
|
||||
/* Record deleted? */
|
||||
errCode = SELF_DELETED( ( AREAP ) pArea, &bDeleted );
|
||||
if( errCode != SUCCESS )
|
||||
return errCode;
|
||||
|
||||
if( pTransInfo->uiFlags & DBTF_MATCH && pTransInfo->uiFlags & DBTF_PUTREC )
|
||||
{
|
||||
errCode = SELF_GETREC( ( AREAP ) pArea, &pRecord );
|
||||
if( errCode != SUCCESS )
|
||||
return errCode;
|
||||
|
||||
/* Append a new record */
|
||||
errCode = SELF_APPEND( ( AREAP ) pTransInfo->lpaDest, TRUE );
|
||||
if( errCode != SUCCESS )
|
||||
return errCode;
|
||||
|
||||
/* Copy record */
|
||||
errCode = SELF_PUTREC( ( AREAP ) pTransInfo->lpaDest, pRecord );
|
||||
}
|
||||
else
|
||||
{
|
||||
PHB_ITEM pItem = hb_itemNew( NULL );
|
||||
LPDBTRANSITEM pTransItem;
|
||||
USHORT uiCount = 0;
|
||||
|
||||
/* Append a new record */
|
||||
errCode = SELF_APPEND( ( AREAP ) pTransInfo->lpaDest, TRUE );
|
||||
if( errCode != SUCCESS )
|
||||
return errCode;
|
||||
|
||||
pTransItem = pTransInfo->lpTransItems;
|
||||
for( uiCount = pTransInfo->uiItemCount; uiCount; --uiCount )
|
||||
{
|
||||
errCode = SELF_GETVALUE( ( AREAP ) pArea,
|
||||
pTransItem->uiSource, pItem );
|
||||
if( errCode != SUCCESS )
|
||||
break;
|
||||
errCode = SELF_PUTVALUE( ( AREAP ) pTransInfo->lpaDest,
|
||||
pTransItem->uiDest, pItem );
|
||||
if( errCode != SUCCESS )
|
||||
break;
|
||||
++pTransItem;
|
||||
}
|
||||
hb_itemRelease( pItem );
|
||||
}
|
||||
|
||||
/* Delete the new record if copy fail */
|
||||
if( errCode != SUCCESS )
|
||||
{
|
||||
SELF_DELETE( ( AREAP ) pTransInfo->lpaDest );
|
||||
return errCode;
|
||||
}
|
||||
|
||||
/* Delete the new record */
|
||||
if( bDeleted )
|
||||
return SELF_DELETE( ( AREAP ) pTransInfo->lpaDest );
|
||||
|
||||
printf( "\nTODO: hb_waTransRec()\n" );
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -821,8 +1065,17 @@ ERRCODE hb_waChildEnd( AREAP pArea, LPDBRELINFO pRelInfo )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waChildEnd(%p, %p)", pArea, pRelInfo));
|
||||
|
||||
if ( pRelInfo->isScoped )
|
||||
SELF_CLEARSCOPE( pArea );
|
||||
if( pRelInfo->isScoped )
|
||||
{
|
||||
DBORDERINFO pInfo;
|
||||
pInfo.itmOrder = NULL;
|
||||
pInfo.atomBagName = NULL;
|
||||
pInfo.itmResult = hb_itemNew( NULL );
|
||||
pInfo.itmNewVal = NULL;
|
||||
SELF_ORDINFO( pArea, DBOI_SCOPETOPCLEAR, &pInfo );
|
||||
SELF_ORDINFO( pArea, DBOI_SCOPEBOTTOMCLEAR, &pInfo );
|
||||
hb_itemRelease( pInfo.itmResult );
|
||||
}
|
||||
|
||||
pArea->uiParents--;
|
||||
return SUCCESS;
|
||||
@@ -864,33 +1117,35 @@ ERRCODE hb_waSyncChildren( AREAP pArea )
|
||||
*/
|
||||
ERRCODE hb_waClearRel( AREAP pArea )
|
||||
{
|
||||
LPDBRELINFO lpdbRelation, lpdbRelPrev;
|
||||
int iCurrArea;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waClearRel(%p)", pArea ));
|
||||
|
||||
iCurrArea = hb_rddGetCurrentWorkAreaNumber();
|
||||
|
||||
/* Free all relations */
|
||||
lpdbRelation = pArea->lpdbRelations;
|
||||
while( lpdbRelation )
|
||||
if( pArea->lpdbRelations )
|
||||
{
|
||||
hb_rddSelectWorkAreaNumber( lpdbRelation->lpaChild->uiArea );
|
||||
SELF_CHILDEND( lpdbRelation->lpaChild, lpdbRelation );
|
||||
hb_rddSelectWorkAreaNumber( iCurrArea );
|
||||
int iCurrArea = hb_rddGetCurrentWorkAreaNumber();
|
||||
|
||||
if( lpdbRelation->itmCobExpr )
|
||||
do
|
||||
{
|
||||
hb_itemRelease( lpdbRelation->itmCobExpr );
|
||||
}
|
||||
if( lpdbRelation->abKey )
|
||||
hb_itemRelease( lpdbRelation->abKey );
|
||||
LPDBRELINFO lpdbRelation = pArea->lpdbRelations;
|
||||
|
||||
lpdbRelPrev = lpdbRelation;
|
||||
lpdbRelation = lpdbRelation->lpdbriNext;
|
||||
hb_xfree( lpdbRelPrev );
|
||||
hb_rddSelectWorkAreaNumber( lpdbRelation->lpaChild->uiArea );
|
||||
SELF_CHILDEND( lpdbRelation->lpaChild, lpdbRelation );
|
||||
pArea->lpdbRelations = lpdbRelation->lpdbriNext;
|
||||
|
||||
if( lpdbRelation->itmCobExpr )
|
||||
{
|
||||
hb_itemRelease( lpdbRelation->itmCobExpr );
|
||||
}
|
||||
if( lpdbRelation->abKey )
|
||||
{
|
||||
hb_itemRelease( lpdbRelation->abKey );
|
||||
}
|
||||
hb_xfree( lpdbRelation );
|
||||
}
|
||||
while( pArea->lpdbRelations );
|
||||
|
||||
hb_rddSelectWorkAreaNumber( iCurrArea );
|
||||
}
|
||||
pArea->lpdbRelations = NULL;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -926,58 +1181,62 @@ ERRCODE hb_waRelArea( AREAP pArea, USHORT uiRelNo, void * pRelArea )
|
||||
*/
|
||||
ERRCODE hb_waRelEval( AREAP pArea, LPDBRELINFO pRelInfo )
|
||||
{
|
||||
int iCurrArea;
|
||||
PHB_ITEM pResult;
|
||||
DBORDERINFO pInfo;
|
||||
ERRCODE errCode;
|
||||
int iOrder;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waRelEval(%p, %p)", pArea, pRelInfo));
|
||||
|
||||
iCurrArea = hb_rddGetCurrentWorkAreaNumber();
|
||||
hb_rddSelectWorkAreaNumber( pRelInfo->lpaParent->uiArea );
|
||||
pResult = hb_vmEvalBlock( pRelInfo->itmCobExpr );
|
||||
hb_rddSelectWorkAreaNumber( iCurrArea );
|
||||
errCode = SELF_EVALBLOCK( pRelInfo->lpaParent, pRelInfo->itmCobExpr );
|
||||
|
||||
/*
|
||||
* Check the current order
|
||||
*/
|
||||
|
||||
pInfo.itmResult = hb_itemPutNI( NULL, 0 );
|
||||
pInfo.itmOrder = NULL;
|
||||
SELF_ORDINFO( pArea, DBOI_NUMBER, &pInfo );
|
||||
iOrder = hb_itemGetNI( pInfo.itmResult );
|
||||
hb_itemRelease( pInfo.itmResult );
|
||||
|
||||
if( iOrder != 0 )
|
||||
{
|
||||
if ( pRelInfo->isScoped )
|
||||
{
|
||||
DBORDSCOPEINFO sInfo;
|
||||
|
||||
sInfo.scopeValue = pResult;
|
||||
sInfo.nScope = 0;
|
||||
if ( SELF_SETSCOPE( pArea, (LPDBORDSCOPEINFO) &sInfo ) == FAILURE )
|
||||
return FAILURE;
|
||||
sInfo.nScope = 1;
|
||||
if ( SELF_SETSCOPE( pArea, (LPDBORDSCOPEINFO) &sInfo ) == FAILURE )
|
||||
return FAILURE;
|
||||
}
|
||||
if( SELF_SEEK( pArea, 0, pResult, 0 ) == SUCCESS )
|
||||
return SUCCESS;
|
||||
else
|
||||
return FAILURE;
|
||||
}
|
||||
else
|
||||
if( errCode == SUCCESS )
|
||||
{
|
||||
/*
|
||||
* If current order equals to zero, use GOTO instead of SEEK
|
||||
*/
|
||||
* Check the current order
|
||||
*/
|
||||
pResult = pRelInfo->lpaParent->valResult;
|
||||
pRelInfo->lpaParent->valResult = NULL;
|
||||
memset( &pInfo, 0, sizeof( DBORDERINFO ) );
|
||||
pInfo.itmResult = hb_itemPutNI( NULL, 0 );
|
||||
errCode = SELF_ORDINFO( pArea, DBOI_NUMBER, &pInfo );
|
||||
|
||||
if( SELF_GOTO( pArea, hb_itemGetNI( pResult ) ) == SUCCESS )
|
||||
return SUCCESS;
|
||||
else
|
||||
return FAILURE;
|
||||
if( errCode == SUCCESS )
|
||||
{
|
||||
iOrder = hb_itemGetNI( pInfo.itmResult );
|
||||
if( iOrder != 0 )
|
||||
{
|
||||
if( pRelInfo->isScoped )
|
||||
{
|
||||
pInfo.itmNewVal = pResult;
|
||||
errCode = SELF_ORDINFO( pArea, DBOI_SCOPETOP, &pInfo );
|
||||
if( errCode == SUCCESS )
|
||||
errCode = SELF_ORDINFO( pArea, DBOI_SCOPEBOTTOM, &pInfo );
|
||||
}
|
||||
if( errCode == SUCCESS )
|
||||
errCode = SELF_SEEK( pArea, FALSE, pResult, FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* If current order equals to zero, use GOTOID instead of SEEK
|
||||
* Unfortunately it interacts with buggy .prg code which returns
|
||||
* non numerical values from relation expression and RDD accepts
|
||||
* only numerical record ID. In such case SELF_GOTO() works like
|
||||
* SELF_GOEOF() but SELF_GOTOID() reports error. So for Clipper
|
||||
* compatibility SELF_GOTO() is used here but if RDD can use
|
||||
* non numerical record IDs then this method should be overloaded
|
||||
* to use SELF_GOTOID(), [druzus]
|
||||
*/
|
||||
/* errCode = SELF_GOTOID( pArea, pResult ); */
|
||||
errCode = SELF_GOTO( pArea, hb_itemGetNL( pResult ) );
|
||||
}
|
||||
}
|
||||
hb_itemRelease( pInfo.itmResult );
|
||||
hb_itemRelease( pResult );
|
||||
}
|
||||
|
||||
return errCode;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -987,24 +1246,23 @@ ERRCODE hb_waRelText( AREAP pArea, USHORT uiRelNo, void * pExpr )
|
||||
{
|
||||
LPDBRELINFO lpdbRelations;
|
||||
USHORT uiIndex = 1;
|
||||
char* pBuf = (char*) pExpr; /*TODO: Why is the string buffer declared as void*? This creates casting hassles.*/
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waRelText(%p, %hu, %p)", pArea, uiRelNo, pExpr));
|
||||
|
||||
*pBuf = 0;
|
||||
lpdbRelations = pArea->lpdbRelations;
|
||||
|
||||
while( lpdbRelations )
|
||||
{
|
||||
if ( uiIndex++ == uiRelNo )
|
||||
{
|
||||
strcpy(pBuf, lpdbRelations->abKey->item.asString.value );
|
||||
break;
|
||||
/* TODO: Verify buffer size is big enough ?? */
|
||||
hb_strncpy( ( char* ) pExpr, hb_itemGetCPtr( lpdbRelations->abKey ),
|
||||
HARBOUR_MAX_RDD_RELTEXT_LENGTH );
|
||||
return SUCCESS;
|
||||
}
|
||||
lpdbRelations = lpdbRelations->lpdbriNext;
|
||||
}
|
||||
return *pBuf ? SUCCESS : FAILURE ;
|
||||
* ( char * ) pExpr = 0;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1033,6 +1291,7 @@ ERRCODE hb_waSetRel( AREAP pArea, LPDBRELINFO lpdbRelInf )
|
||||
lpdbRelations->lpaChild = lpdbRelInf->lpaChild;
|
||||
lpdbRelations->itmCobExpr = lpdbRelInf->itmCobExpr;
|
||||
lpdbRelations->isScoped = lpdbRelInf->isScoped;
|
||||
lpdbRelations->isOptimized = lpdbRelInf->isOptimized;
|
||||
lpdbRelations->abKey = lpdbRelInf->abKey;
|
||||
lpdbRelations->lpdbriNext = lpdbRelInf->lpdbriNext;
|
||||
|
||||
@@ -1142,6 +1401,7 @@ ERRCODE hb_waSetFilter( AREAP pArea, LPDBFILTERINFO pFilterInfo )
|
||||
{
|
||||
pArea->dbfi.abFilterText = hb_itemNew( pFilterInfo->abFilterText );
|
||||
}
|
||||
pArea->dbfi.fOptimized = pArea->dbfi.fOptimized;
|
||||
pArea->dbfi.fFilter = TRUE;
|
||||
|
||||
return SUCCESS;
|
||||
@@ -1158,17 +1418,13 @@ ERRCODE hb_waSetLocate( AREAP pArea, LPDBSCOPEINFO pScopeInfo )
|
||||
SELF_CLEARLOCATE( pArea );
|
||||
|
||||
if( pScopeInfo->itmCobFor )
|
||||
{
|
||||
pArea->dbsi.itmCobFor = hb_itemNew( pScopeInfo->itmCobFor );
|
||||
}
|
||||
|
||||
if( pScopeInfo->lpstrFor )
|
||||
pArea->dbsi.lpstrFor = hb_itemNew( pScopeInfo->lpstrFor );
|
||||
|
||||
if( pScopeInfo->itmCobWhile )
|
||||
{
|
||||
pArea->dbsi.itmCobWhile = hb_itemNew( pScopeInfo->itmCobWhile );
|
||||
}
|
||||
|
||||
if( pScopeInfo->lpstrWhile )
|
||||
pArea->dbsi.lpstrWhile = hb_itemNew( pScopeInfo->lpstrWhile );
|
||||
@@ -1182,6 +1438,13 @@ ERRCODE hb_waSetLocate( AREAP pArea, LPDBSCOPEINFO pScopeInfo )
|
||||
if( pScopeInfo->fRest )
|
||||
pArea->dbsi.fRest = hb_itemNew( pScopeInfo->fRest );
|
||||
|
||||
pArea->dbsi.fIgnoreFilter = pScopeInfo->fIgnoreFilter;
|
||||
pArea->dbsi.fIncludeDeleted = pScopeInfo->fIncludeDeleted;
|
||||
pArea->dbsi.fLast = pScopeInfo->fLast;
|
||||
pArea->dbsi.fIgnoreDuplicates = pScopeInfo->fIgnoreDuplicates;
|
||||
pArea->dbsi.fBackword = pScopeInfo->fBackword;
|
||||
pArea->dbsi.fOptimized = pScopeInfo->fOptimized;
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1197,9 +1460,6 @@ ERRCODE hb_waCompile( AREAP pArea, BYTE * pExpr )
|
||||
pMacro = hb_macroCompile( ( char * ) pExpr );
|
||||
if( pMacro )
|
||||
{
|
||||
if( ! pArea->valResult )
|
||||
pArea->valResult = hb_itemNew( NULL );
|
||||
|
||||
pArea->valResult = hb_itemPutPtr( pArea->valResult, ( void * ) pMacro );
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -1217,7 +1477,7 @@ ERRCODE hb_waError( AREAP pArea, PHB_ITEM pError )
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waError(%p, %p)", pArea, pError));
|
||||
|
||||
szRddName = ( char * ) hb_xgrab( HARBOUR_MAX_RDD_DRIVERNAME_LENGTH + 1 );
|
||||
if( ( pArea )->lprfsHost->sysName )
|
||||
if( pArea && pArea->lprfsHost->sysName )
|
||||
SELF_SYSNAME( pArea, ( BYTE * ) szRddName );
|
||||
else
|
||||
strcpy( szRddName, "???DRIVER" );
|
||||
@@ -1232,23 +1492,145 @@ ERRCODE hb_waError( AREAP pArea, PHB_ITEM pError )
|
||||
*/
|
||||
ERRCODE hb_waEvalBlock( AREAP pArea, PHB_ITEM pBlock )
|
||||
{
|
||||
PHB_ITEM pItem;
|
||||
int iCurrArea;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_waEvalBlock(%p, %p)", pArea, pBlock));
|
||||
|
||||
if( ! pArea->valResult )
|
||||
pArea->valResult = hb_itemNew( NULL );
|
||||
|
||||
iCurrArea = hb_rddGetCurrentWorkAreaNumber();
|
||||
if ( iCurrArea != pArea->uiArea )
|
||||
hb_rddSelectWorkAreaNumber( pArea->uiArea );
|
||||
else
|
||||
iCurrArea = 0;
|
||||
|
||||
hb_itemCopy( pArea->valResult, hb_vmEvalBlock( pBlock ) );
|
||||
pItem = hb_vmEvalBlockOrMacro( pBlock );
|
||||
if( ! pArea->valResult )
|
||||
pArea->valResult = hb_itemNew( NULL );
|
||||
hb_itemCopy( pArea->valResult, pItem );
|
||||
|
||||
if ( iCurrArea )
|
||||
hb_rddSelectWorkAreaNumber( iCurrArea );
|
||||
|
||||
return hb_vmRequestQuery() ? FAILURE : SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* RDD info
|
||||
*/
|
||||
extern ERRCODE hb_rddInfo( LPRDDNODE pRDD, USHORT uiIndex, ULONG ulConnection, PHB_ITEM pItem )
|
||||
{
|
||||
BOOL fResult;
|
||||
int iResult;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_rddInfo(%p, %hu, %lu, %p)", pRDD, uiIndex, ulConnection, pItem));
|
||||
|
||||
HB_SYMBOL_UNUSED( pRDD );
|
||||
HB_SYMBOL_UNUSED( ulConnection );
|
||||
|
||||
switch( uiIndex )
|
||||
{
|
||||
case RDDI_ISDBF:
|
||||
case RDDI_CANPUTREC:
|
||||
case RDDI_LOCAL:
|
||||
case RDDI_REMOTE:
|
||||
case RDDI_RECORDMAP:
|
||||
case RDDI_ENCRYPTION:
|
||||
case RDDI_TRIGGERS:
|
||||
case RDDI_AUTOLOCK:
|
||||
case RDDI_STRUCTORD:
|
||||
case RDDI_LARGEFILE:
|
||||
case RDDI_MULTITAG:
|
||||
case RDDI_SORTRECNO:
|
||||
case RDDI_MULTIKEY:
|
||||
hb_itemPutL( pItem, FALSE );
|
||||
break;
|
||||
|
||||
case RDDI_CONNECTION:
|
||||
case RDDI_TABLETYPE:
|
||||
case RDDI_MEMOTYPE:
|
||||
case RDDI_MEMOVERSION:
|
||||
hb_itemPutNI( pItem, 0 );
|
||||
break;
|
||||
|
||||
case RDDI_STRICTREAD:
|
||||
fResult = hb_set.HB_SET_STRICTREAD;
|
||||
if( hb_itemType( pItem ) == HB_IT_LOGICAL )
|
||||
hb_set.HB_SET_STRICTREAD = hb_itemGetL( pItem );
|
||||
hb_itemPutL( pItem, fResult );
|
||||
break;
|
||||
case RDDI_OPTIMIZE:
|
||||
fResult = hb_set.HB_SET_OPTIMIZE;
|
||||
if( hb_itemType( pItem ) == HB_IT_LOGICAL )
|
||||
hb_set.HB_SET_OPTIMIZE = hb_itemGetL( pItem );
|
||||
hb_itemPutL( pItem, fResult );
|
||||
break;
|
||||
case RDDI_FORCEOPT:
|
||||
fResult = hb_set.HB_SET_FORCEOPT;
|
||||
if( hb_itemType( pItem ) == HB_IT_LOGICAL )
|
||||
hb_set.HB_SET_FORCEOPT = hb_itemGetL( pItem );
|
||||
hb_itemPutL( pItem, fResult );
|
||||
break;
|
||||
case RDDI_AUTOOPEN:
|
||||
fResult = hb_set.HB_SET_AUTOPEN;
|
||||
if( hb_itemType( pItem ) == HB_IT_LOGICAL )
|
||||
hb_set.HB_SET_AUTOPEN = hb_itemGetL( pItem );
|
||||
hb_itemPutL( pItem, fResult );
|
||||
break;
|
||||
case RDDI_AUTOORDER:
|
||||
fResult = hb_set.HB_SET_AUTORDER;
|
||||
if( hb_itemType( pItem ) == HB_IT_LOGICAL )
|
||||
hb_set.HB_SET_AUTORDER = hb_itemGetL( pItem );
|
||||
hb_itemPutL( pItem, fResult );
|
||||
break;
|
||||
case RDDI_AUTOSHARE:
|
||||
fResult = hb_set.HB_SET_AUTOSHARE;
|
||||
if( hb_itemType( pItem ) == HB_IT_LOGICAL )
|
||||
hb_set.HB_SET_AUTOSHARE = hb_itemGetL( pItem );
|
||||
hb_itemPutL( pItem, fResult );
|
||||
break;
|
||||
case RDDI_LOCKSCHEME:
|
||||
iResult = hb_set.HB_SET_DBFLOCKSCHEME;
|
||||
if( hb_itemType( pItem ) & HB_IT_NUMERIC )
|
||||
hb_set.HB_SET_DBFLOCKSCHEME = hb_itemGetNI( pItem );
|
||||
hb_itemPutNI( pItem, iResult );
|
||||
break;
|
||||
case RDDI_MEMOBLOCKSIZE:
|
||||
iResult = hb_set.HB_SET_MBLOCKSIZE;
|
||||
if( hb_itemType( pItem ) & HB_IT_NUMERIC )
|
||||
hb_set.HB_SET_MBLOCKSIZE = hb_itemGetNI( pItem );
|
||||
hb_itemPutNI( pItem, iResult );
|
||||
break;
|
||||
case RDDI_MEMOEXT:
|
||||
if( hb_itemType( pItem ) & HB_IT_STRING )
|
||||
{
|
||||
if( hb_set.HB_SET_MFILEEXT )
|
||||
{
|
||||
hb_itemPutC( pItem, hb_set.HB_SET_MFILEEXT );
|
||||
hb_xfree( hb_set.HB_SET_MFILEEXT );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_itemPutC( pItem, "" );
|
||||
}
|
||||
hb_set.HB_SET_MFILEEXT = hb_strdup( hb_itemGetCPtr( pItem ) );
|
||||
break;
|
||||
}
|
||||
else if( hb_set.HB_SET_MFILEEXT )
|
||||
{
|
||||
hb_itemPutC( pItem, hb_set.HB_SET_MFILEEXT );
|
||||
break;
|
||||
}
|
||||
case RDDI_TABLEEXT:
|
||||
case RDDI_ORDBAGEXT:
|
||||
case RDDI_ORDEREXT:
|
||||
case RDDI_ORDSTRUCTEXT:
|
||||
case RDDI_DELIMITER:
|
||||
case RDDI_SEPARATOR:
|
||||
hb_itemPutC( pItem, "" );
|
||||
/* no break - return FAILURE */
|
||||
|
||||
default:
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -725,6 +725,36 @@ PHB_ITEM hb_errRT_New_Subst(
|
||||
return pError;
|
||||
}
|
||||
|
||||
PHB_ITEM hb_errRT_SubstParams( char *szSubSystem, ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation )
|
||||
{
|
||||
PHB_ITEM pRetVal;
|
||||
PHB_ITEM pError;
|
||||
PHB_ITEM pArray;
|
||||
|
||||
HB_TRACE_STEALTH( HB_TR_DEBUG, ( "hb_errRT_SubstParams()") );
|
||||
|
||||
pError = hb_errRT_New_Subst( ES_ERROR, szSubSystem ? szSubSystem : HB_ERR_SS_BASE,
|
||||
ulGenCode, ulSubCode, szDescription, szOperation, 0, EF_NONE );
|
||||
|
||||
pArray = hb_arrayFromParams( hb_stack.pBase );
|
||||
|
||||
/* Assign the new array to the object data item. */
|
||||
hb_vmPushSymbol( hb_dynsymGet( "_ARGS" )->pSymbol );
|
||||
hb_vmPush( pError );
|
||||
hb_vmPush( pArray );
|
||||
hb_vmSend( 1 );
|
||||
|
||||
hb_itemRelease( pArray );
|
||||
|
||||
/* Ok, launch... */
|
||||
pRetVal = hb_errLaunchSubst( pError );
|
||||
|
||||
hb_itemRelease( pError );
|
||||
|
||||
return pRetVal;
|
||||
}
|
||||
|
||||
|
||||
HB_FUNC( __ERRRT_BASE )
|
||||
{
|
||||
hb_errRT_BASE( ( ULONG ) hb_parnl( 1 ),
|
||||
@@ -983,6 +1013,20 @@ USHORT hb_errRT_DBCMD( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, c
|
||||
return uiAction;
|
||||
}
|
||||
|
||||
USHORT hb_errRT_DBCMD_Ext( ULONG ulGenCode, ULONG ulSubCode, const char * szDescription, const char * szOperation, USHORT uiFlags )
|
||||
{
|
||||
USHORT uiAction;
|
||||
PHB_ITEM pError;
|
||||
|
||||
pError = hb_errRT_New( ES_ERROR, HB_ERR_SS_DBCMD, ulGenCode, ulSubCode, (char *)szDescription, (char *)szOperation, 0, uiFlags );
|
||||
|
||||
uiAction = hb_errLaunch( pError );
|
||||
|
||||
hb_itemRelease( pError );
|
||||
|
||||
return uiAction;
|
||||
}
|
||||
|
||||
USHORT hb_errRT_TOOLS( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation )
|
||||
{
|
||||
USHORT uiAction;
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
|
||||
#include "hbapi.h"
|
||||
#include "hbapifs.h"
|
||||
#include "hbapierr.h"
|
||||
#include "hbset.h"
|
||||
#include "hb_io.h"
|
||||
|
||||
@@ -2130,24 +2131,172 @@ BYTE HB_EXPORT hb_fsCurDrv( void )
|
||||
return ( BYTE ) uiResult; /* Return the drive number, base 0. */
|
||||
}
|
||||
|
||||
/* TODO: Implement hb_fsExtOpen */
|
||||
|
||||
FHANDLE hb_fsExtOpen( BYTE * pFilename, BYTE * pDefExt,
|
||||
USHORT uiFlags, BYTE * pPaths, PHB_ITEM pError )
|
||||
/* copied from xHarbour */
|
||||
FHANDLE HB_EXPORT hb_fsExtOpen( BYTE * pFilename, BYTE * pDefExt,
|
||||
USHORT uiExFlags, BYTE * pPaths,
|
||||
PHB_ITEM pError )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_fsExtOpen(%s, %s, %hu, %p, %p)", (char*) pFilename, (char*) pDefExt, uiFlags, pPaths, pError));
|
||||
HB_PATHNAMES *pSearchPath = NULL, *pNextPath;
|
||||
PHB_FNAME pFilepath;
|
||||
FHANDLE hFile;
|
||||
BOOL fIsFile = FALSE;
|
||||
BYTE * szPath;
|
||||
USHORT uiFlags;
|
||||
|
||||
s_uiErrorLast = FS_ERROR;
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_fsExtOpen(%s, %s, %hu, %p, %p)", pFilename, pDefExt, uiExFlags, pPaths, pError));
|
||||
|
||||
HB_SYMBOL_UNUSED( pFilename );
|
||||
HB_SYMBOL_UNUSED( pDefExt );
|
||||
HB_SYMBOL_UNUSED( uiFlags );
|
||||
HB_SYMBOL_UNUSED( pPaths );
|
||||
HB_SYMBOL_UNUSED( pError );
|
||||
/*
|
||||
#define FXO_TRUNCATE 0x0100 // Create (truncate if exists)
|
||||
#define FXO_APPEND 0x0200 // Create (append if exists)
|
||||
#define FXO_UNIQUE 0x0400 // Create unique file FO_EXCL ???
|
||||
#define FXO_FORCEEXT 0x0800 // Force default extension
|
||||
#define FXO_DEFAULTS 0x1000 // Use SET command defaults
|
||||
#define FXO_DEVICERAW 0x2000 // Open devices in raw mode
|
||||
// xHarbour extension
|
||||
#define FXO_SHARELOCK 0x4000 // emulate DOS SH_DENY* mode in POSIX OS
|
||||
#define FXO_COPYNAME 0x8000 // copy final szPath into pFilename
|
||||
|
||||
return s_uiErrorLast;
|
||||
hb_errGetFileName( pError );
|
||||
*/
|
||||
|
||||
szPath = (BYTE *) hb_xgrab( _POSIX_PATH_MAX + 1 );
|
||||
|
||||
uiFlags = uiExFlags & 0xff;
|
||||
if( uiExFlags & ( FXO_TRUNCATE | FXO_APPEND | FXO_UNIQUE ) )
|
||||
{
|
||||
uiFlags |= FO_CREAT;
|
||||
if( uiExFlags & FXO_UNIQUE )
|
||||
uiFlags |= FO_EXCL;
|
||||
#if !defined( HB_USE_SHARELOCKS )
|
||||
else if( uiExFlags & FXO_TRUNCATE )
|
||||
uiFlags |= FO_TRUNC;
|
||||
#endif
|
||||
}
|
||||
|
||||
pFilepath = hb_fsFNameSplit( ( char * ) pFilename );
|
||||
|
||||
if( pDefExt && ( ( uiExFlags & FXO_FORCEEXT ) || !pFilepath->szExtension ) )
|
||||
{
|
||||
pFilepath->szExtension = ( char * ) pDefExt;
|
||||
}
|
||||
|
||||
if( pFilepath->szPath )
|
||||
{
|
||||
hb_fsFNameMerge( ( char * ) szPath, pFilepath );
|
||||
}
|
||||
else if( uiExFlags & FXO_DEFAULTS )
|
||||
{
|
||||
if( hb_set.HB_SET_DEFAULT )
|
||||
{
|
||||
pFilepath->szPath = hb_set.HB_SET_DEFAULT;
|
||||
hb_fsFNameMerge( ( char * ) szPath, pFilepath );
|
||||
fIsFile = hb_fsFile( szPath );
|
||||
}
|
||||
if( !fIsFile && hb_set.HB_SET_PATH )
|
||||
{
|
||||
pNextPath = hb_setGetFirstSetPath();
|
||||
while( !fIsFile && pNextPath )
|
||||
{
|
||||
pFilepath->szPath = pNextPath->szPath;
|
||||
hb_fsFNameMerge( ( char * ) szPath, pFilepath );
|
||||
fIsFile = hb_fsFile( szPath );
|
||||
pNextPath = pNextPath->pNext;
|
||||
}
|
||||
}
|
||||
if( !fIsFile )
|
||||
{
|
||||
pFilepath->szPath = hb_set.HB_SET_DEFAULT ? hb_set.HB_SET_DEFAULT : NULL;
|
||||
hb_fsFNameMerge( ( char * ) szPath, pFilepath );
|
||||
}
|
||||
}
|
||||
else if( pPaths )
|
||||
{
|
||||
hb_fsAddSearchPath( ( char * ) pPaths, &pSearchPath );
|
||||
pNextPath = pSearchPath;
|
||||
while( !fIsFile && pNextPath )
|
||||
{
|
||||
pFilepath->szPath = pNextPath->szPath;
|
||||
hb_fsFNameMerge( ( char * ) szPath, pFilepath );
|
||||
fIsFile = hb_fsFile( szPath );
|
||||
pNextPath = pNextPath->pNext;
|
||||
}
|
||||
if( !fIsFile )
|
||||
{
|
||||
pFilepath->szPath = NULL;
|
||||
hb_fsFNameMerge( ( char * ) szPath, pFilepath );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_fsFNameMerge( ( char * ) szPath, pFilepath );
|
||||
}
|
||||
hb_xfree( pFilepath );
|
||||
|
||||
hFile = hb_fsOpen( szPath, uiFlags );
|
||||
|
||||
#if defined( HB_USE_SHARELOCKS )
|
||||
if( hFile != FS_ERROR && uiExFlags & FXO_SHARELOCK )
|
||||
{
|
||||
USHORT uiLock;
|
||||
if( ( uiFlags & ( FO_READ | FO_WRITE | FO_READWRITE ) ) == FO_READ ||
|
||||
( uiFlags & ( FO_DENYREAD | FO_DENYWRITE | FO_EXCLUSIVE ) ) == 0 )
|
||||
uiLock = FL_LOCK | FLX_SHARED;
|
||||
else
|
||||
uiLock = FL_LOCK | FLX_EXCLUSIVE;
|
||||
|
||||
if( !hb_fsLockLarge( hFile, HB_SHARELOCK_POS, HB_SHARELOCK_SIZE, uiLock ) )
|
||||
{
|
||||
hb_fsClose( hFile );
|
||||
hFile = FS_ERROR;
|
||||
/*
|
||||
* fix for neterr() support and Clipper compatibility,
|
||||
* should be revised with a better multi platform solution.
|
||||
*/
|
||||
hb_fsSetError( ( uiExFlags & FXO_TRUNCATE ) ? 5 : 32 );
|
||||
}
|
||||
else if( uiExFlags & FXO_TRUNCATE )
|
||||
{
|
||||
/* truncate the file only if properly locked */
|
||||
hb_fsSeek( hFile, 0, FS_SET );
|
||||
hb_fsWrite( hFile, NULL, 0 );
|
||||
if( hb_fsError() != 0 )
|
||||
{
|
||||
hb_fsClose( hFile );
|
||||
hFile = FS_ERROR;
|
||||
hb_fsSetError( 5 );
|
||||
}
|
||||
}
|
||||
}
|
||||
#elif 1
|
||||
/*
|
||||
* Temporary fix for neterr() support and Clipper compatibility,
|
||||
* should be revised with a better solution.
|
||||
*/
|
||||
if( ( uiExFlags & ( FXO_TRUNCATE | FXO_APPEND | FXO_UNIQUE ) ) == 0 &&
|
||||
hb_fsError() == 5 )
|
||||
{
|
||||
hb_fsSetError( 32 );
|
||||
}
|
||||
#endif
|
||||
|
||||
if( pError )
|
||||
{
|
||||
hb_errPutFileName( pError, ( char * ) szPath );
|
||||
if( hFile == FS_ERROR )
|
||||
{
|
||||
hb_errPutOsCode( pError, hb_fsError() );
|
||||
hb_errPutGenCode( pError, ( uiExFlags & FXO_TRUNCATE ) ? EG_CREATE : EG_OPEN );
|
||||
}
|
||||
}
|
||||
|
||||
if( uiExFlags & FXO_COPYNAME && hFile != FS_ERROR )
|
||||
strcpy( ( char * ) pFilename, ( char * ) szPath );
|
||||
|
||||
hb_xfree( szPath );
|
||||
return hFile;
|
||||
}
|
||||
|
||||
|
||||
BOOL hb_fsEof( FHANDLE hFileHandle )
|
||||
{
|
||||
#if defined(__DJGPP__) || defined(__CYGWIN__) || defined(OS_UNIX_COMPATIBLE)
|
||||
|
||||
@@ -125,6 +125,27 @@ BOOL HB_EXPORT hb_arrayAdd( PHB_ITEM pArray, PHB_ITEM pValue )
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL HB_EXPORT hb_arrayAddForward( PHB_ITEM pArray, PHB_ITEM pValue )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arrayAddForward(%p, %p)", pArray, pValue));
|
||||
|
||||
if( pArray->type == HB_IT_ARRAY )
|
||||
{
|
||||
PHB_BASEARRAY pBaseArray = ( PHB_BASEARRAY ) pArray->item.asArray.value;
|
||||
|
||||
if( pBaseArray->ulLen < ULONG_MAX )
|
||||
{
|
||||
hb_arraySize( pArray, pBaseArray->ulLen + 1 );
|
||||
pBaseArray = ( PHB_BASEARRAY ) pArray->item.asArray.value;
|
||||
hb_itemForwardValue( pBaseArray->pItems + ( pBaseArray->ulLen - 1 ), pValue );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ULONG HB_EXPORT hb_arrayLen( PHB_ITEM pArray )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arrayLen(%p)", pArray));
|
||||
|
||||
@@ -158,6 +158,19 @@ PHB_DYNS HB_EXPORT hb_dynsymNew( PHB_SYMB pSymbol ) /* creates a new dynamic
|
||||
return pDynSym;
|
||||
}
|
||||
|
||||
PHB_DYNS HB_EXPORT hb_dynsymGetCase( char * szName ) /* finds and creates a symbol if not found */
|
||||
{
|
||||
PHB_DYNS pDynSym;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_dynsymGet(%s)", szName));
|
||||
|
||||
pDynSym = hb_dynsymFind( szName );
|
||||
if( ! pDynSym ) /* Does it exists ? */
|
||||
pDynSym = hb_dynsymNew( hb_symbolNew( szName ) ); /* Make new symbol */
|
||||
|
||||
return pDynSym;
|
||||
}
|
||||
|
||||
PHB_DYNS HB_EXPORT hb_dynsymGet( char * szName ) /* finds and creates a symbol if not found */
|
||||
{
|
||||
PHB_DYNS pDynSym;
|
||||
|
||||
@@ -160,6 +160,35 @@ char HB_EXPORT * hb_parc( int iParam, ... )
|
||||
return ( char * ) 0;
|
||||
}
|
||||
|
||||
char HB_EXPORT * hb_parcx( int iParam, ... )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_parc(%d, ...)", iParam));
|
||||
|
||||
if( ( iParam >= 0 && iParam <= hb_pcount() ) || ( iParam == -1 ) )
|
||||
{
|
||||
PHB_ITEM pItem = ( iParam == -1 ) ? &hb_stack.Return : hb_stackItemFromBase( iParam );
|
||||
|
||||
if( HB_IS_BYREF( pItem ) )
|
||||
pItem = hb_itemUnRef( pItem );
|
||||
|
||||
if( HB_IS_STRING( pItem ) )
|
||||
return pItem->item.asString.value;
|
||||
else if( HB_IS_ARRAY( pItem ) )
|
||||
{
|
||||
va_list va;
|
||||
ULONG ulArrayIndex;
|
||||
|
||||
va_start( va, iParam );
|
||||
ulArrayIndex = va_arg( va, ULONG );
|
||||
va_end( va );
|
||||
|
||||
return hb_arrayGetCPtr( pItem, ulArrayIndex );
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
ULONG HB_EXPORT hb_parclen( int iParam, ... )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_parclen(%d, ...)", iParam));
|
||||
@@ -290,6 +319,42 @@ char HB_EXPORT * hb_pardsbuff( char * szDate, int iParam, ... )
|
||||
return hb_dateDecStr( szDate, 0 );
|
||||
}
|
||||
|
||||
/* retrieve a date as long integer - number of days from Julian's day */
|
||||
|
||||
LONG HB_EXPORT hb_pardl( int iParam, ... )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_pardl(%d, ...)", iParam));
|
||||
|
||||
if( ( iParam >= 0 && iParam <= hb_pcount() ) || ( iParam == -1 ) )
|
||||
{
|
||||
PHB_ITEM pItem = ( iParam == -1 ) ? &hb_stack.Return : hb_stackItemFromBase( iParam );
|
||||
|
||||
if( HB_IS_BYREF( pItem ) )
|
||||
{
|
||||
pItem = hb_itemUnRef( pItem );
|
||||
}
|
||||
|
||||
if( HB_IS_DATE( pItem ) )
|
||||
{
|
||||
return pItem->item.asDate.value;
|
||||
}
|
||||
else if( HB_IS_ARRAY( pItem ) )
|
||||
{
|
||||
va_list va;
|
||||
ULONG ulArrayIndex;
|
||||
|
||||
va_start( va, iParam );
|
||||
ulArrayIndex = va_arg( va, ULONG );
|
||||
va_end( va );
|
||||
|
||||
return hb_arrayGetDL( pItem, ulArrayIndex );
|
||||
}
|
||||
}
|
||||
|
||||
return hb_itemGetDL( NULL );
|
||||
}
|
||||
|
||||
|
||||
int HB_EXPORT hb_parl( int iParam, ... )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_parl(%d, ...)", iParam));
|
||||
@@ -649,6 +714,32 @@ void HB_EXPORT hb_retclen_buffer( char * szText, ULONG ulLen )
|
||||
hb_itemPutCPtr( &hb_stack.Return, szText, ulLen );
|
||||
}
|
||||
|
||||
#undef hb_retcAdopt
|
||||
void HB_EXPORT hb_retcAdopt( char * szText )
|
||||
{
|
||||
/*
|
||||
* This functions "adopts" passed pointer to buffer containing a string
|
||||
* as a value of item of string type
|
||||
*
|
||||
* Copied from xHarbour
|
||||
*/
|
||||
HB_TRACE_STEALTH( HB_TR_INFO, ("hb_retcAdopt(%s)", szText ) );
|
||||
|
||||
|
||||
if( ( &(hb_stack.Return) )->type )
|
||||
{
|
||||
hb_itemClear( &(hb_stack.Return) );
|
||||
}
|
||||
|
||||
( &(hb_stack.Return) )->type = HB_IT_STRING;
|
||||
( &(hb_stack.Return) )->item.asString.u.pulHolders = ( HB_COUNTER * ) hb_xgrab( sizeof( HB_COUNTER ) );
|
||||
*( ( &(hb_stack.Return) )->item.asString.u.pulHolders ) = 1;
|
||||
( &(hb_stack.Return) )->item.asString.bStatic = FALSE;
|
||||
( &(hb_stack.Return) )->item.asString.value = szText;
|
||||
( &(hb_stack.Return) )->item.asString.length = strlen( szText );
|
||||
|
||||
}
|
||||
|
||||
/* szDate must have YYYYMMDD format */
|
||||
|
||||
#undef hb_retds
|
||||
|
||||
@@ -3928,6 +3928,36 @@ HB_ITEM_PTR hb_vmEvalBlockV( HB_ITEM_PTR pBlock, ULONG ulArgCount, ... )
|
||||
return &hb_stack.Return;
|
||||
}
|
||||
|
||||
/* Evaluates a passed codeblock item or macro pointer item
|
||||
*/
|
||||
HB_EXPORT HB_ITEM_PTR hb_vmEvalBlockOrMacro( HB_ITEM_PTR pItem )
|
||||
{
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_vmEvalBlockOrMacro(%p)", pItem));
|
||||
|
||||
if ( pItem->type == HB_IT_BLOCK )
|
||||
{
|
||||
hb_vmPushSymbol( &hb_symEval );
|
||||
hb_vmPush( pItem );
|
||||
hb_vmSend( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
HB_MACRO_PTR pMacro = ( HB_MACRO_PTR ) hb_itemGetPtr( pItem );
|
||||
if ( pMacro )
|
||||
{
|
||||
hb_macroRun( pMacro );
|
||||
hb_itemCopy( &hb_stack.Return, hb_stackItemFromTop( - 1 ) );
|
||||
hb_stackPop();
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_itemClear( &hb_stack.Return );
|
||||
}
|
||||
}
|
||||
return &hb_stack.Return;
|
||||
}
|
||||
|
||||
void hb_vmFunction( USHORT uiParams )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_vmFunction(%hu)", uiParams));
|
||||
|
||||
@@ -610,6 +610,19 @@ PHB_ITEM HB_EXPORT hb_itemReturn( PHB_ITEM pItem )
|
||||
return pItem;
|
||||
}
|
||||
|
||||
PHB_ITEM HB_EXPORT hb_itemReturnForward( PHB_ITEM pItem )
|
||||
{
|
||||
HB_TRACE_STEALTH( HB_TR_DEBUG, ("hb_itemReturnForward(%p)", pItem ) );
|
||||
|
||||
if( pItem )
|
||||
{
|
||||
hb_itemForwardValue( &hb_stack.Return, pItem );
|
||||
}
|
||||
|
||||
return pItem;
|
||||
}
|
||||
|
||||
|
||||
PHB_ITEM HB_EXPORT hb_itemPutDS( PHB_ITEM pItem, char * szDate )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutDS(%p, %s)", pItem, szDate));
|
||||
@@ -1152,6 +1165,31 @@ void HB_EXPORT hb_itemCopy( PHB_ITEM pDest, PHB_ITEM pSource )
|
||||
}
|
||||
}
|
||||
|
||||
/* copy (transfer) the value of item without increasing
|
||||
* a reference counters (the pSource item cannot be cleared)
|
||||
*/
|
||||
void HB_EXPORT hb_itemForwardValue( PHB_ITEM pDest, PHB_ITEM pSource )
|
||||
{
|
||||
HB_TRACE_STEALTH( HB_TR_DEBUG, ("hb_itemForwardValue(%p, %p) %i", pDest, pSource, pDest->type ) );
|
||||
|
||||
if( pDest == pSource )
|
||||
{
|
||||
hb_errInternal( HB_EI_ITEMBADCOPY, NULL, "hb_itemForwardValue()", NULL );
|
||||
}
|
||||
|
||||
if( HB_IS_COMPLEX( pDest ) )
|
||||
{
|
||||
hb_itemClear( pDest );
|
||||
}
|
||||
|
||||
/* Forward. */
|
||||
memcpy( pDest, pSource, sizeof( HB_ITEM ) );
|
||||
|
||||
/* Now fake clear the transferer. */
|
||||
//pSource->item.asString.bStatic = FALSE;
|
||||
pSource->type = HB_IT_NIL;
|
||||
}
|
||||
|
||||
void HB_EXPORT hb_itemMove( PHB_ITEM pDest, PHB_ITEM pSource )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemCopy(%p, %p)", pDest, pSource));
|
||||
|
||||
Reference in New Issue
Block a user