CHANGELOG: 3000-08-29 22:00 GMT+1 Bruno Cantero <bruno@issnet.net>

This commit is contained in:
Bruno Cantero
2000-08-29 20:16:56 +00:00
parent 26c63dfa4e
commit 0473817fe2
26 changed files with 5743 additions and 3617 deletions

View File

@@ -1,3 +1,57 @@
3000-08-29 22:00 GMT+1 Bruno Cantero <bruno@issnet.net>
* include/hbapirdd.h
* Changed WORKAREA structure, 100% Clipper compatible.
! Uncommented disabled RDD methods.
+ include/hbrddwrk.h
+ source/rdd/workarea.c
+ Basic RDD (waNew, waOpen, ...) like Clipper.
* source/rdd/dbcmd.c
+ Added __dbArrange(), dbInfo(), dbFieldInfo(), dbRecordInfo(),
dbFileGet() and dbFilePut() functions.
! Removed default RDD functions.
* source/rtl/dummy.prg
! Removed __dbArrange(), dbSort(), dbInfo(), dbFieldInfo(), dbRecordInfo(),
dbFileGet() and dbFilePut() functions.
+ include/hbdbsort.h
+ source/rdd/dbsort.prg
+ source/rdd/hbdbsort.c
+ Added dbSort() function.
+ include/hbrdddbf.h
+ include/hbrdddel.h
+ include/hbrddsdf.h
* source/rdd/dbf0.prg
* source/rdd/dbf1.c
* source/rdd/delim0.prg
* source/rdd/delim1.c
* source/rdd/sdf0.prg
* source/rdd/sdf1.c
* Changed and added functions, now 100% Clipper compatible.
* source/rdd/dbfntx/dbfntx0.prg
* Disabled RDD (broken).
* source/rdd/Makefile
+ Added new files.
* source/rdd/dbfntx/Makefile
* source/rdd/dbfcdx/Makefile
* Disabled DBFNTX and DBFCDX RDD's.
* makefile.bc
* makefile.vc
* Disabled DBFNTX and DBFCDX RDD's.
+ Added new files.
+ tests/Makefile
+ tests/newrdd.prg
+ Test file for new DBF RDD.
2000-08-28 17:00 UTC+0800 Ron Pinkas <ron@profit-master.com>
* source/compiler/harbour.y
- Removed 1 un-needed hb_comp_szDeclaredFun = NULL
@@ -80,6 +134,7 @@
* source/compiler/simplex.c
* Corrected Reset at <EOF>
>>>>>>> 1.2574
2000-08-22 10:40 UTC+0800 Ron Pinkas <ron@profit-master.com>
* source/compiler/simplex.c
* source/compiler/harbour.slx

View File

@@ -36,17 +36,21 @@
#ifndef HB_APIRDD_H_
#define HB_APIRDD_H_
#include "hbapi.h"
#include "hbapifs.h"
#if defined(HB_EXTERN_C)
extern "C" {
#endif
#define HARBOUR_MAX_RDD_DRIVERNAME_LENGTH 32
#define HARBOUR_MAX_RDD_ALIAS_LENGTH 32
#define HARBOUR_MAX_RDD_FIELDNAME_LENGTH 32
/* RDD virtual machine integration functions */
extern int hb_rddGetCurrentWorkAreaNumber( void );
extern void * hb_rddGetCurrentWorkAreaPointer( void );
extern ERRCODE hb_rddSelectWorkAreaAlias( char * szAlias );
extern ERRCODE hb_rddSelectWorkAreaNumber( int iArea );
extern ERRCODE hb_rddSelectWorkAreaSymbol( PHB_SYMB pSymAlias );
@@ -57,12 +61,34 @@ extern ERRCODE hb_rddFieldPut( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol );
extern void hb_rddShutDown( void );
/* DBCMD errors */
#define EDBCMD_SEEK_BADPARAMETER 1001
#define EDBCMD_NOALIAS 1002
#define EDBCMD_NOVAR 1003
#define EDBCMD_USE_BADPARAMETER 1005
#define EDBCMD_REL_BADPARAMETER 1006
#define EDBCMD_FIELDNAME_BADPARAMETER 1009
#define EDBCMD_DUPALIAS 1011
#define EDBCMD_DBCMDBADPARAMETER 1014
#define EDBCMD_BADPARAMETER 1015
#define EDBCMD_INFOBADPARAMETER 1032
#define EDBCMD_DBINFOBADPARAMETER 1034
#define EDBCMD_DBFILEPUTBADPARAMETER 1041
#define EDBCMD_DBFILEGETBADPARAMETER 1042
#define EDBCMD_NOTABLE 2001
#define EDBCMD_EVAL_BADPARAMETER 2019
/* Flags for DBTRANSINFO */
#define DBTF_MATCH 0x0001
#define DBTF_PUTREC 0x0002
/* Codes for Locking methods */
#define DBLM_EXCLUSIVE 1
@@ -70,6 +96,7 @@ extern void hb_rddShutDown( void );
#define DBLM_FILE 3
/* Codes for SELF_ORDINFO() */
#define DBOI_CONDITION 1 /* Get the order condition */
@@ -89,6 +116,7 @@ extern void hb_rddShutDown( void );
#define DBOI_UNIQUE 13 /* Get the flag if the order has the unique attribute set */
/* Codes for SELF_INFO() */
#define DBI_ISDBF 1 /* Logical: RDD support DBF file format? */
@@ -101,12 +129,9 @@ extern void hb_rddShutDown( void );
#define DBI_GETLOCKARRAY 8 /* Array: Get an array of locked records */
#define DBI_TABLEEXT 9 /* String: Get table file extension */
#define DBI_FULLPATH 10 /* String: Full path name of opened file */
#define DBI_ISFLOCK 20 /* Get file lock status */
#define DBI_CHILDCOUNT 22 /* Number of opened relations */
#define DBI_FILEHANDLE 23 /* Handle of opened file */
#define DBI_BOF 26 /* BOF flag - alternate to bof() */
#define DBI_EOF 27 /* EOF flag - alternate to eof() */
#define DBI_DBFILTER 28 /* Filter expression */
@@ -118,17 +143,15 @@ extern void hb_rddShutDown( void );
#define DBI_GETSCOPE 34 /* Locate codeblock */
#define DBI_LOCKOFFSET 35 /* New locking offset */
#define DBI_SHARED 36 /* Gets/Sets the shared flag */
#define DBI_MEMOEXT 37 /* String: Get memo file extension */
#define DBI_MEMOHANDLE 38 /* Dos handle for memo file */
#define DBI_MEMOBLOCKSIZE 39 /* Blocksize in memo files */
#define DBI_DB_VERSION 101 /* HOST driver Version */
#define DBI_RDD_VERSION 102 /* RDD version (current RDD) */
#define DBI_USER 1000 /* Start of user definable DBI_ values */
/* Codes for SELF_RECINFO() */
#define DBRI_DELETED 1
@@ -138,6 +161,7 @@ extern void hb_rddShutDown( void );
#define DBRI_UPDATED 5
/* Codes for SELF_FIELDINFO() */
#define DBS_NAME 1
@@ -146,6 +170,7 @@ extern void hb_rddShutDown( void );
#define DBS_DEC 4
/* Codes for RawLock types */
#define FILE_LOCK 1
@@ -157,114 +182,15 @@ extern void hb_rddShutDown( void );
#define APPEND_LOCK 7
#define APPEND_UNLOCK 8
/* forward declarations
/*
* Forward declarations
*/
struct _RDDFUNCS;
struct _AREA;
struct _TAGINFO;
struct _INDEXINFO;
typedef struct _FILEINFO
{
FHANDLE hFile;
char * szFileName; /* Name of file */
ULONG * pLocksPos; /* List of records locked */
ULONG lNumLocksPos; /* Number of records locked */
BOOL fFileLocked; /* TRUE if entire file is locked */
BOOL fAppend; /* TRUE if new record is added */
struct _FILEINFO * pNext; /* The next file in the list */
} FILEINFO;
typedef FILEINFO * LPFILEINFO;
typedef struct _KEYINFO
{
PHB_ITEM pItem;
LONG Tag;
LONG Xtra;
struct _KEYINFO * pNext;
} KEYINFO;
typedef KEYINFO * LPKEYINFO;
typedef struct HB_PAGEINFO_STRU
{
LONG Page;
LONG Left;
LONG Right;
BOOL Changed;
BOOL NewRoot;
BOOL LastEntry;
BOOL Reload;
BOOL ChkBOF;
BOOL ChkEOF;
BYTE PageType;
LONG RNMask;
BYTE ReqByte;
BYTE RNBits;
BYTE DCBits;
BYTE TCBits;
BYTE DCMask;
BYTE TCMask;
USHORT Space;
LPKEYINFO pKeys;
USHORT uiKeys;
SHORT CurKey;
struct HB_PAGEINFO_STRU * Owner;
struct HB_PAGEINFO_STRU * Child;
struct _TAGINFO * TagParent;
} HB_PAGEINFO;
typedef HB_PAGEINFO * LPPAGEINFO;
typedef struct _TAGINFO
{
char * TagName;
char * KeyExpr;
char * ForExpr;
PHB_ITEM pKeyItem;
PHB_ITEM pForItem;
BOOL AscendKey;
BOOL UniqueKey;
BOOL TagChanged;
BOOL TagBOF;
BOOL TagEOF;
BYTE KeyType;
BYTE OptFlags;
LONG TagBlock;
LONG RootBlock;
USHORT KeyLength;
USHORT MaxKeys;
LPKEYINFO CurKeyInfo;
LPPAGEINFO RootPage;
struct _INDEXINFO * Owner;
struct _TAGINFO * pNext;
} TAGINFO;
typedef TAGINFO * LPTAGINFO;
typedef struct _INDEXINFO
{
char * IndexName;
BOOL Exact;
BOOL Corrupted;
LONG TagRoot;
LONG NextAvail;
struct _AREA * Owner;
FHANDLE DiskFile;
LPTAGINFO CompoundTag;
LPTAGINFO TagList;
struct _INDEXINFO * pNext; /* The next index in the list */
} INDEXINFO;
typedef INDEXINFO * LPINDEXINFO;
/*
* DBFIELDINFO
@@ -276,7 +202,7 @@ typedef struct
{
BYTE * atomName; /* FIELD (symbol) name */
USHORT uiType; /* FIELD type */
USHORT typeExtended; /* FIELD type extended */
USHORT uiTypeExtended; /* FIELD type extended */
USHORT uiLen; /* Overall FIELD length */
USHORT uiDec; /* Decimal places of numeric FIELD */
} DBFIELDINFO;
@@ -286,10 +212,10 @@ typedef DBFIELDINFO * LPDBFIELDINFO;
/*
* DBOPENINFO
* ----------
* The Open Info structure
*/
* DBOPENINFO
* ----------
* The Open Info structure
*/
typedef struct
{
@@ -306,41 +232,10 @@ typedef DBOPENINFO * LPDBOPENINFO;
/*
* DBEXTENDINFO
* ------------
* Additional properties
*/
typedef struct
{
USHORT uiHeaderLen; /* Size of header */
USHORT uiRecordLen; /* Size of record */
BYTE * bRecord; /* Buffer of the data */
BOOL fValidBuffer; /* State of buffer */
BOOL fHasMemo; /* Work Area with Memo fields */
BOOL fHasMDX; /* MDX or CDX indexes */
ULONG ulRecNo; /* Current record */
ULONG ulNextBlock; /* Next block for memos */
BOOL fExclusive; /* Share the file */
BOOL fReadOnly; /* Read only file */
BYTE bYear; /* Last update */
BYTE bMonth;
BYTE bDay;
BOOL fRecordChanged; /* Record changed */
ULONG ulRecCount; /* Total records */
PHB_ITEM itmEval; /* EVAL expression for __dbPack() */
ULONG ulEvery; /* Every records for eval itmEval */
} DBEXTENDINFO;
typedef DBEXTENDINFO * LPDBEXTENDINFO;
/*
* DBORDERCONDINFO
* ---------------
* The Create Order conditional Info structure
*/
* DBORDERCONDINFO
* ---------------
* The Create Order conditional Info structure
*/
typedef struct _DBORDERCONDINFO
{
@@ -369,10 +264,10 @@ typedef DBORDERCONDINFO * LPDBORDERCONDINFO;
/*
* DBORDERCREATE
* -------------
* The Create Order Info structure
*/
* DBORDERCREATE
* -------------
* The Create Order Info structure
*/
typedef struct
{
@@ -390,10 +285,10 @@ typedef DBORDERCREATEINFO * LPDBORDERCREATEINFO;
/*
* DBORDERINFO
* -----------
* The Set Index Info structure
*/
* DBORDERINFO
* -----------
* The Set Index Info structure
*/
typedef struct
{
@@ -409,10 +304,10 @@ typedef DBORDERINFO * LPDBORDERINFO;
/*
* DBSCOPEINFO
* -----------
* The Scope Info structure
*/
* DBSCOPEINFO
* -----------
* The Scope Info structure
*/
typedef struct
{
@@ -431,11 +326,13 @@ typedef struct
typedef DBSCOPEINFO * LPDBSCOPEINFO;
/*
* DBORDSCOPEINFO
* -----------
* The Order Scope Info structure
*/
* DBORDSCOPEINFO
* --------------
* The Order Scope Info structure
*/
typedef struct
{
@@ -445,11 +342,13 @@ typedef struct
typedef DBORDSCOPEINFO * LPDBORDSCOPEINFO;
/*
* DBFILTERINFO
* ------------
* The Filter Info structure
*/
* DBFILTERINFO
* ------------
* The Filter Info structure
*/
typedef struct
{
@@ -463,19 +362,19 @@ typedef DBFILTERINFO * LPDBFILTERINFO;
/*
* DBRELINFO
* ------------
* The Relationship Info structure
*/
* DBRELINFO
* ---------
* The Relationship Info structure
*/
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 */
struct _AREA *lpaParent; /* The parent of this relation */
struct _AREA *lpaChild; /* The parents children */
struct _DBRELINFO *lpdbriNext; /* Next child or parent */
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 */
struct _AREA * lpaParent; /* The parent of this relation */
struct _AREA * lpaChild; /* The parents children */
struct _DBRELINFO * lpdbriNext; /* Next child or parent */
} DBRELINFO;
typedef DBRELINFO * LPDBRELINFO;
@@ -483,13 +382,13 @@ typedef DBRELINFO * LPDBRELINFO;
/*
* DBEVALINFO
* ------------
* The Evaluation Info structure
*
* Contains information necessary for a block evaluation
* on each record of the workarea
*/
* DBEVALINFO
* ----------
* The Evaluation Info structure
*
* Contains information necessary for a block evaluation
* on each record of the workarea
*/
typedef struct
{
@@ -502,13 +401,13 @@ typedef DBEVALINFO * LPDBEVALINFO;
/*
* DBTRANSITEM
* ------------
* The Transfer Item structure
*
* Defines a single transfer item (usually a field) from
* one database to another; used by DBTRANSINFO
*/
* DBTRANSITEM
* -----------
* The Transfer Item structure
*
* Defines a single transfer item (usually a field) from
* one database to another; used by DBTRANSINFO
*/
typedef struct
{
@@ -521,22 +420,22 @@ typedef DBTRANSITEM * LPDBTRANSITEM;
/*
* DBTRANSINFO
* ------------
* The Transfer Info structure
*
* Defines a global transfer of data items from on workarea
* to another
*/
* DBTRANSINFO
* -----------
* The Transfer Info structure
*
* Defines a global transfer of data items from on workarea
* to another
*/
typedef struct
{
struct _AREA *lpaSource; /* Pointer to source work area */
struct _AREA *lpaDest; /* Pointer to dest work area */
DBSCOPEINFO dbsci; /* Scope to limit transfer */
USHORT uiFlags; /* Transfer attributes */
USHORT uiItemCount; /* Number of items below */
LPDBTRANSITEM lpTransItems; /* Array of items */
struct _AREA * lpaSource; /* Pointer to source work area */
struct _AREA * lpaDest; /* Pointer to dest work area */
DBSCOPEINFO dbsci; /* Scope to limit transfer */
USHORT uiFlags; /* Transfer attributes */
USHORT uiItemCount; /* Number of items below */
LPDBTRANSITEM lpTransItems; /* Array of items */
} DBTRANSINFO;
typedef DBTRANSINFO * LPDBTRANSINFO;
@@ -544,14 +443,14 @@ typedef DBTRANSINFO * LPDBTRANSINFO;
/*
* DBSORTITEM
* ----------
* The Sort Item Structure
*
* An array of items that, together, indicate the key value to
* use while sorting data. The order of the array determines the
* order of the sorting.
*/
* DBSORTITEM
* ----------
* The Sort Item Structure
*
* An array of items that, together, indicate the key value to
* use while sorting data. The order of the array determines the
* order of the sorting.
*/
typedef struct
{
@@ -573,12 +472,12 @@ typedef DBSORTITEM * LPDBSORTITEM;
/*
* DBSORTINFO
* ----------
* The Sort Info Structure
*
* Information for a physical sort on the workarea
*/
* DBSORTINFO
* ----------
* The Sort Info Structure
*
* Information for a physical sort on the workarea
*/
typedef struct
{
@@ -592,18 +491,18 @@ typedef DBSORTINFO * LPDBSORTINFO;
/*
* DBLOCKINFO
* ----------
* The Lock Info Structure
*
* Information for a record or file lock
*/
* DBLOCKINFO
* ----------
* The Lock Info Structure
*
* Information for a record or file lock
*/
typedef struct
{
ULONG itmRecID;
USHORT uiMethod;
BOOL fResult;
PHB_ITEM itmRecID;
USHORT uiMethod;
BOOL fResult;
} DBLOCKINFO;
typedef DBLOCKINFO * LPDBLOCKINFO;
@@ -611,12 +510,12 @@ typedef DBLOCKINFO * LPDBLOCKINFO;
/*
* FIELD
* -----
* The Field structure
*
* This is the basic unit of access for a workarea
*/
* FIELD
* -----
* The Field structure
*
* This is the basic unit of access for a workarea
*/
typedef struct _FIELD
{
@@ -625,10 +524,8 @@ typedef struct _FIELD
USHORT uiLen; /* Field length */
USHORT uiDec; /* Decimal length */
USHORT uiArea; /* Area this field resides in */
USHORT uiOffset; /* Offset for this field */
void * sym; /* Symbol that represents the field */
void * memo; /* Pointer to memo data */
struct _FIELD *lpfNext; /* The next field in the list */
struct _FIELD * lpfNext; /* The next field in the list */
} FIELD;
typedef FIELD * LPFIELD;
@@ -638,40 +535,36 @@ typedef FIELD * LPFIELD;
/*--------------------* WORKAREA structure *----------------------*/
/*
* WORKAREA
* --------
* The Workarea Structure
*
* Information to administrate the workarea
*/
* WORKAREA
* --------
* The Workarea Structure
*
* Information to administrate the workarea
*/
typedef struct _AREA
{
struct _RDDFUNCS * lprfsHost; /* Virtual method table for this workarea */
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 */
USHORT uiFieldCount; /* Total number of fields used */
LPFIELD lpFields; /* Pointer to an array of fields */
void * lpFieldExtents; /* Void ptr for additional field properties */
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 */
USHORT uiFieldCount; /* Total number of fields used */
LPFIELD lpFields; /* Pointer to an array of fields */
void * lpFieldExtents; /* Void ptr for additional field properties */
PHB_ITEM valResult; /* All purpose result holder */
BOOL fTop; /* TRUE if "top" */
BOOL fBottom; /* TRUE if "bottom" */
BOOL fBof; /* TRUE if "bof" */
BOOL fEof; /* TRUE if "eof" */
BOOL fFound; /* TRUE if "found" */
DBSCOPEINFO dbsi; /* Info regarding last LOCATE */
DBSCOPEINFO dbsi; /* Info regarding last LOCATE */
DBFILTERINFO dbfi; /* Filter in effect */
LPDBORDERCONDINFO lpdbOrdCondInfo;
LPDBRELINFO lpdbRelations; /* Parent/Child relationships used */
USHORT uiParents; /* Number of parents for this area */
USHORT heap;
USHORT heapSize;
USHORT rddID;
LPFILEINFO lpDataInfo; /* Data files used by this workarea */
LPINDEXINFO lpIndexInfo; /* Indexes used by this workarea */
LPDBEXTENDINFO lpExtendInfo; /* Additional properties */
LPDBRELINFO lpdbRelations; /* Parent/Child relationships used */
USHORT uiParents; /* Number of parents for this area */
USHORT heap;
USHORT heapSize;
USHORT rddID;
} AREA;
typedef AREA * LPAREA;
@@ -680,6 +573,8 @@ typedef AREA * LPAREA;
#define AREAP LPAREA
#endif
/*--------------------* Virtual Method Table *----------------------*/
typedef USHORT ( * DBENTRYP_V )( AREAP area );
@@ -690,8 +585,11 @@ typedef USHORT ( * DBENTRYP_UL )( AREAP area, ULONG param );
typedef USHORT ( * DBENTRYP_I )( AREAP area, PHB_ITEM param );
typedef USHORT ( * DBENTRYP_SI )( AREAP area, USHORT index, PHB_ITEM param );
typedef USHORT ( * DBENTRYP_VP )( AREAP area, LPDBOPENINFO param );
typedef USHORT ( * DBENTRYP_VT )( AREAP area, LPDBTRANSINFO param );
typedef USHORT ( * DBENTRYP_VF )( AREAP area, LPDBFIELDINFO param );
typedef USHORT ( * DBENTRYP_VL )( AREAP area, LPDBLOCKINFO param );
typedef USHORT ( * DBENTRYP_VR )( AREAP area, LPDBRELINFO param );
typedef USHORT ( * DBENTRYP_VS )( AREAP area, LPDBSORTINFO param );
typedef USHORT ( * DBENTRYP_VFI )( AREAP area, LPDBFILTERINFO param );
typedef USHORT ( * DBENTRYP_VEI )( AREAP area, LPDBEVALINFO param );
typedef USHORT ( * DBENTRYP_VLO )( AREAP area, LPDBSCOPEINFO param );
@@ -706,6 +604,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_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 );
@@ -715,7 +614,6 @@ 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);
/*--------------------* Virtual Method Table *----------------------*/
typedef struct _RDDFUNCS
@@ -775,36 +673,32 @@ typedef struct _RDDFUNCS
DBENTRYP_P sysName;
DBENTRYP_VEI dbEval;
DBENTRYP_V pack;
#if 0
DBENTRYP_LSP packRec;
DBENTRYP_VP sort;
DBENTRYP_VP trans;
DBENTRYP_VP transRec;
#endif
DBENTRYP_VS sort;
DBENTRYP_VT trans;
DBENTRYP_VT transRec;
DBENTRYP_V zap;
/* Relational Methods */
DBENTRYP_VP childEnd;
DBENTRYP_VP childStart;
DBENTRYP_VP childSync;
DBENTRYP_VR childEnd;
DBENTRYP_VR childStart;
DBENTRYP_VR childSync;
DBENTRYP_V syncChildren;
DBENTRYP_V clearRel;
DBENTRYP_V forceRel;
DBENTRYP_SVP relArea;
DBENTRYP_VP relEval;
DBENTRYP_VR relEval;
DBENTRYP_SVP relText;
DBENTRYP_VP setRel;
DBENTRYP_VR setRel;
/* Order Management */
DBENTRYP_OI orderListAdd;
DBENTRYP_V orderListClear;
#if 0
DBENTRYP_VP orderListDelete;
#endif
DBENTRYP_OI orderListFocus;
DBENTRYP_V orderListRebuild;
DBENTRYP_VOI orderCondition;
@@ -845,7 +739,7 @@ typedef struct _RDDFUNCS
DBENTRYP_V closeMemFile;
DBENTRYP_VP createMemFile;
DBENTRYP_SVP getValueFile;
DBENTRYP_SVPB getValueFile;
DBENTRYP_VP openMemFile;
DBENTRYP_SVP putValueFile;
@@ -866,6 +760,8 @@ typedef RDDFUNCS * PRDDFUNCS;
#define RDDFUNCSCOUNT ( sizeof( RDDFUNCS ) / sizeof( DBENTRYP_V ) )
/*--------------------* SELF Methods *------------------------*/
/* Movement and positioning methods */
@@ -950,7 +846,6 @@ typedef RDDFUNCS * PRDDFUNCS;
#define SELF_ORDLSTFOCUS(w, lp) ((*(w)->lprfsHost->orderListFocus)(w,lp))
#define SELF_ORDLSTREBUILD(w) ((*(w)->lprfsHost->orderListRebuild)(w))
#define SELF_ORDLSTCLEAR(w) ((*(w)->lprfsHost->orderListClear)(w))
#define SELF_ORDSETCOND(w, ip) ((*(w)->lprfsHost->orderCondition)(w, ip))
#define SELF_ORDCREATE(w, ip) ((*(w)->lprfsHost->orderCreate)(w, ip))
#define SELF_ORDDESTROY(w, p) ((*(w)->lprfsHost->orderDestroy)(w, p))
@@ -998,7 +893,7 @@ typedef RDDFUNCS * PRDDFUNCS;
#define SELF_CLOSEMEMFILE(w) ((*(w)->lprfsHost->closeMemFile)(w))
#define SELF_CREATEMEMFILE(w,bp) ((*(w)->lprfsHost->createMemFile)(w,bp))
#define SELF_GETVALUEFILE(w,i,bp) ((*(w)->lprfsHost->getValueFile)(w,i,bp))
#define SELF_GETVALUEFILE(w,i,bp,b) ((*(w)->lprfsHost->getValueFile)(w,i,bp,b))
#define SELF_OPENMEMFILE(w,bp) ((*(w)->lprfsHost->openMemFile)(w,bp))
#define SELF_PUTVALUEFILE(w,i,bp) ((*(w)->lprfsHost->putValueFile)(w,i,bp))
@@ -1104,7 +999,6 @@ typedef RDDFUNCS * PRDDFUNCS;
#define SUPER_ORDLSTFOCUS(w, lp) ((*(SUPERTABLE)->orderListFocus)(w, lp))
#define SUPER_ORDLSTREBUILD(w) ((*(SUPERTABLE)->orderListRebuild)(w))
#define SUPER_ORDLSTCLEAR(w) ((*(SUPERTABLE)->orderListClear)(w))
#define SUPER_ORDSETCOND(w,ip) ((*(SUPERTABLE)->orderCondition)(w, ip))
#define SUPER_ORDCREATE(w, ip) ((*(SUPERTABLE)->orderCreate)(w, ip))
#define SUPER_ORDDELETE(w, ip) ((*(SUPERTABLE)->orderDelete)(w, ip))
@@ -1152,7 +1046,7 @@ typedef RDDFUNCS * PRDDFUNCS;
#define SUPER_CLOSEMEMFILE(w) ((*(SUPERTABLE)->closeMemFile)(w))
#define SUPER_CREATEMEMFILE(w,bp) ((*(SUPERTABLE)->createMemFile)(w,bp))
#define SUPER_GETVALUEFILE(w,i,bp) ((*(SUPERTABLE)->getValueFile)(w,i,bp))
#define SUPER_GETVALUEFILE(w,i,bp,b) ((*(SUPERTABLE)->getValueFile)(w,i,bp,b))
#define SUPER_OPENMEMFILE(w,bp) ((*(SUPERTABLE)->openMemFile)(w,bp))
#define SUPER_PUTVALUEFILE(w,i,bp) ((*(SUPERTABLE)->putValueFile)(w,i,bp))
@@ -1173,10 +1067,11 @@ typedef RDDFUNCS * PRDDFUNCS;
#define SUPER_TABLEEXT(w, fp) ((*(SUPERTABLE)->info)(w, DBI_TABLEEXT, fp))
/*
* PROTOTYPES
* ----------
*/
* 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 );
@@ -1186,4 +1081,4 @@ extern USHORT hb_rddFieldType( USHORT extendType );
}
#endif
#endif /* HB_APIRDD_H_ */
#endif /* HB_APIRDD_H_ */

View File

@@ -0,0 +1,80 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* SORT RDD module
*
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version, with one exception:
*
* The exception is that if you link the Harbour Runtime Library (HRL)
* and/or the Harbour Virtual Machine (HVM) 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 HRL
* and/or HVM code into it.
*
* 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 program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
#ifndef HB_DBSORT_H_
#define HB_DBSORT_H_
#include "hbrdddbf.h"
#if defined(HB_EXTERN_C)
extern "C" {
#endif
/*
* DBQUICKSORT
* -----------
* The Quick Sort Item Structure
*/
typedef struct _DBQUICKSORT
{
FHANDLE hFile;
BYTE szTempName[ _POSIX_PATH_MAX + 1 ];
BYTE * pBuffer;
BYTE * pSwapBufferA;
BYTE * pSwapBufferB;
BYTE * pCmpBufferA;
BYTE * pCmpBufferB;
USHORT uiRecordLen;
USHORT uiMaxRecords;
LPDBSORTINFO pSortInfo;
} DBQUICKSORT;
typedef DBQUICKSORT * LPDBQUICKSORT;
/*
* PROTOTYPES
* ----------
*/
extern BOOL hb_dbQSortInit( LPDBQUICKSORT pQuickSort, LPDBSORTINFO pSortInfo, USHORT uiRecordLen );
extern void hb_dbQSortExit( LPDBQUICKSORT pQuickSort );
extern BOOL hb_dbQSortAdvance( LPDBQUICKSORT pQuickSort, USHORT uiCount );
extern void hb_dbQSortComplete( LPDBQUICKSORT pQuickSort );
#if defined(HB_EXTERN_C)
}
#endif
#endif /* HB_DBSORT_H_ */

287
harbour/include/hbrdddbf.h Normal file
View File

@@ -0,0 +1,287 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* DBF RDD module
*
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version, with one exception:
*
* The exception is that if you link the Harbour Runtime Library (HRL)
* and/or the Harbour Virtual Machine (HVM) 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 HRL
* and/or HVM code into it.
*
* 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 program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
#ifndef HB_RDDDBF_H_
#define HB_RDDDBF_H_
#include "hbapirdd.h"
#if defined(HB_EXTERN_C)
extern "C" {
#endif
/* DBF header */
typedef struct _DBFHEADER
{
BYTE bVersion;
BYTE bYear;
BYTE bMonth;
BYTE bDay;
ULONG ulRecCount;
USHORT uiHeaderLen;
USHORT uiRecordLen;
BYTE bReserved1[ 16 ];
BYTE bHasTags;
BYTE bReserved2[ 3 ];
} DBFHEADER;
typedef DBFHEADER * LPDBFHEADER;
typedef struct _DBFFIELD
{
BYTE bName[ 11 ];
BYTE bType;
BYTE bReserved1[ 4 ];
BYTE bLen;
BYTE bDec;
BYTE bReserved2[ 13 ];
BYTE bHasTag;
} DBFFIELD;
typedef DBFFIELD * LPDBFFIELD;
/* DBF errors */
#define EDBF_OPEN_DBF 1001
#define EDBF_CREATE_DBF 1004
#define EDBF_READ 1010
#define EDBF_WRITE 1011
#define EDBF_CORRUPT 1012
#define EDBF_DATATYPE 1020
#define EDBF_DATAWIDTH 1021
#define EDBF_UNLOCKED 1022
#define EDBF_SHARED 1023
#define EDBF_APPENDLOCK 1024
#define EDBF_READONLY 1025
/* DBF default file extensions */
#define DBF_TABLEEXT ".dbf"
#define DBF_MEMOEXT ".dbt"
/* DBF lock */
#define DBF_LOCKPOS 1000000000L
/*
* DBF WORKAREA
* ------------
* The Workarea Structure of DBF RDD
*
*/
typedef struct _DBFAREA
{
struct _RDDFUNCS * lprfsHost; /* Virtual method table for this workarea */
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 */
USHORT uiFieldCount; /* Total number of fields used */
LPFIELD lpFields; /* Pointer to an array of fields */
void * lpFieldExtents; /* Void ptr for additional field properties */
PHB_ITEM valResult; /* All purpose result holder */
BOOL fTop; /* TRUE if "top" */
BOOL fBottom; /* TRUE if "bottom" */
BOOL fBof; /* TRUE if "bof" */
BOOL fEof; /* TRUE if "eof" */
BOOL fFound; /* TRUE if "found" */
DBSCOPEINFO dbsi; /* Info regarding last LOCATE */
DBFILTERINFO dbfi; /* Filter in effect */
LPDBORDERCONDINFO lpdbOrdCondInfo;
LPDBRELINFO lpdbRelations; /* Parent/Child relationships used */
USHORT uiParents; /* Number of parents for this area */
USHORT heap;
USHORT heapSize;
USHORT rddID;
/*
* DBFS's additions to the workarea structure
*
* Warning: The above section MUST match WORKAREA exactly! Any
* additions to the structure MUST be added below, as in this
* example.
*/
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 */
BOOL fHasMemo; /* WorkArea with Memo fields */
BOOL fHasTags; /* WorkArea with MDX or CDX index */
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 */
LPDBRELINFO lpdbPendingRel; /* Pointer to parent rel struct */
BYTE bYear; /* Last update */
BYTE bMonth;
BYTE bDay;
ULONG * pLocksPos; /* List of records locked */
ULONG ulNumLocksPos; /* Number of records locked */
} DBFAREA;
typedef DBFAREA * LPDBFAREA;
#ifndef DBFAREAP
#define DBFAREAP LPDBFAREA
#endif
/*
* -- DBF METHODS --
*/
#define SUPERTABLE ( &dbfSuper )
extern ERRCODE hb_dbfBof( DBFAREAP pArea, BOOL * pBof );
extern ERRCODE hb_dbfEof( DBFAREAP pArea, BOOL * pEof );
extern ERRCODE hb_dbfFound( DBFAREAP pArea, BOOL * pFound );
extern ERRCODE hb_dbfGoBottom( DBFAREAP pArea );
extern ERRCODE hb_dbfGoTo( DBFAREAP pArea, ULONG ulRecNo );
extern ERRCODE hb_dbfGoToId( DBFAREAP pArea, PHB_ITEM pItem );
extern ERRCODE hb_dbfGoTop( DBFAREAP pArea );
#define hb_dbfSeek NULL
extern ERRCODE hb_dbfSkip( DBFAREAP pArea, LONG lToSkip );
#define hb_dbfSkipFilter NULL
extern ERRCODE hb_dbfSkipRaw( DBFAREAP pArea, LONG lToSkip );
extern ERRCODE hb_dbfAddField( DBFAREAP pArea, LPDBFIELDINFO pFieldInfo );
extern ERRCODE hb_dbfAppend( DBFAREAP pArea, BOOL bUnLockAll );
#define hb_dbfCreateFields NULL
extern ERRCODE hb_dbfDeleteRec( DBFAREAP pArea );
extern ERRCODE hb_dbfDeleted( DBFAREAP pArea, BOOL * pDeleted );
#define hb_dbfFieldCount NULL
#define hb_dbfFieldDisplay NULL
#define hb_dbfFieldInfo NULL
#define hb_dbfFieldName NULL
extern ERRCODE hb_dbfFlush( DBFAREAP pArea );
#define hb_dbfGetRec NULL
extern ERRCODE hb_dbfGetValue( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem );
extern ERRCODE hb_dbfGetVarLen( DBFAREAP pArea, USHORT uiIndex, ULONG * pLength );
extern ERRCODE hb_dbfGoCold( DBFAREAP pArea );
extern ERRCODE hb_dbfGoHot( DBFAREAP pArea );
extern ERRCODE hb_dbfPutRec( DBFAREAP pArea, BYTE * pBuffer );
extern ERRCODE hb_dbfPutValue( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem );
extern ERRCODE hb_dbfRecAll( DBFAREAP pArea );
extern ERRCODE hb_dbfRecCount( DBFAREAP pArea, ULONG * pRecCount );
#define hb_dbfRecInfo NULL
extern ERRCODE hb_dbfRecNo( DBFAREAP pArea, PHB_ITEM pRecNo );
extern ERRCODE hb_dbfSetFieldExtent( DBFAREAP pArea, USHORT uiFieldExtent );
#define hb_dbfAlias NULL
extern ERRCODE hb_dbfClose( DBFAREAP pArea );
extern ERRCODE hb_dbfCreate( DBFAREAP pArea, LPDBOPENINFO pCreateInfo );
extern ERRCODE hb_dbfInfo( DBFAREAP pArea, USHORT uiIndex, PHB_ITEM pItem );
extern ERRCODE hb_dbfNewArea( DBFAREAP pArea );
extern ERRCODE hb_dbfOpen( DBFAREAP pArea, LPDBOPENINFO pOpenInfo );
#define hb_dbfRelease NULL
extern ERRCODE hb_dbfStructSize( DBFAREAP pArea, USHORT * uiSize );
extern ERRCODE hb_dbfSysName( DBFAREAP pArea, BYTE * pBuffer );
#define hb_dbfEval NULL
extern ERRCODE hb_dbfPack( DBFAREAP pArea );
#define hb_dbfPackRec NULL
extern ERRCODE hb_dbfSort( DBFAREAP pArea, LPDBSORTINFO pSortInfo );
extern ERRCODE hb_dbfTrans( DBFAREAP pArea, LPDBTRANSINFO pTransInfo );
extern ERRCODE hb_dbfTransRec( DBFAREAP pArea, LPDBTRANSINFO pTransInfo );
extern ERRCODE hb_dbfZap( DBFAREAP pArea );
extern ERRCODE hb_dbfChildEnd( DBFAREAP pArea, LPDBRELINFO pRelInfo );
extern ERRCODE hb_dbfChildStart( DBFAREAP pArea, LPDBRELINFO pRelInfo );
extern ERRCODE hb_dbfChildSync( DBFAREAP pArea, LPDBRELINFO pRelInfo );
#define hb_dbfSyncChildren NULL
#define hb_dbfClearRel NULL
extern ERRCODE hb_dbfForceRel( DBFAREAP pArea );
#define hb_dbfRelArea NULL
#define hb_dbfRelEval NULL
#define hb_dbfRelText NULL
#define hb_dbfSetRel NULL
#define hb_dbfOrderListAdd NULL
#define hb_dbfOrderListClear NULL
#define hb_dbfOrderListDelete NULL
#define hb_dbfOrderListFocus NULL
#define hb_dbfOrderListRebuild NULL
#define hb_dbfOrderCondition NULL
#define hb_dbfOrderCreate NULL
#define hb_dbfOrderDestroy NULL
#define hb_dbfOrderInfo NULL
#define hb_dbfClearFilter NULL
#define hb_dbfClearLocate NULL
#define hb_dbfClearScope NULL
#define hb_dbfCountScope NULL
#define hb_dbfFilterText NULL
#define hb_dbfScopeInfo NULL
extern ERRCODE hb_dbfSetFilter( DBFAREAP pArea, LPDBFILTERINFO pFilterInfo );
#define hb_dbfSetLocate NULL
#define hb_dbfSetScope NULL
#define hb_dbfSkipScope NULL
#define hb_dbfCompile NULL
#define hb_dbfError NULL
#define hb_dbfEvalBlock NULL
#define hb_dbfRawLock NULL
extern ERRCODE hb_dbfLock( DBFAREAP pArea, LPDBLOCKINFO pLockInfo );
extern ERRCODE hb_dbfUnLock( DBFAREAP pArea, ULONG ulRecNo );
#define hb_dbfCloseMemFile NULL
#define hb_dbfCreateMemFile NULL
#define hb_dbfGetValueFile NULL
extern ERRCODE hb_dbfOpenMemFile( DBFAREAP pArea, LPDBOPENINFO pOpenInfo );
#define hb_dbfPutValueFile NULL
extern ERRCODE hb_dbfReadDBHeader( DBFAREAP pArea );
extern ERRCODE hb_dbfWriteDBHeader( DBFAREAP pArea );
#define hb_dbfWhoCares NULL
#if defined(HB_EXTERN_C)
}
#endif
#endif /* HB_RDDDBF_H_ */

146
harbour/include/hbrdddel.h Normal file
View File

@@ -0,0 +1,146 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* DELIMITED RDD module
*
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version, with one exception:
*
* The exception is that if you link the Harbour Runtime Library (HRL)
* and/or the Harbour Virtual Machine (HVM) 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 HRL
* and/or HVM code into it.
*
* 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 program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
#ifndef HB_RDDDEL_H_
#define HB_RDDDEL_H_
#include "hbapirdd.h"
#if defined(HB_EXTERN_C)
extern "C" {
#endif
/*
* -- DELIMITED METHODS --
*/
#define hb_delimBof NULL
#define hb_delimEof NULL
#define hb_delimFound NULL
#define hb_delimGoBottom NULL
#define hb_delimGoTo NULL
#define hb_delimGoToId NULL
#define hb_delimGoTop NULL
#define hb_delimSeek NULL
#define hb_delimSkip NULL
#define hb_delimSkipFilter NULL
#define hb_delimSkipRaw NULL
#define hb_delimAddField NULL
#define hb_delimAppend NULL
#define hb_delimCreateFields NULL
#define hb_delimDeleteRec NULL
#define hb_delimDeleted NULL
#define hb_delimFieldCount NULL
#define hb_delimFieldDisplay NULL
#define hb_delimFieldInfo NULL
#define hb_delimFieldName NULL
#define hb_delimFlush NULL
#define hb_delimGetRec NULL
#define hb_delimGetValue NULL
#define hb_delimGetVarLen NULL
#define hb_delimGoCold NULL
#define hb_delimGoHot NULL
#define hb_delimPutRec NULL
#define hb_delimPutValue NULL
#define hb_delimRecAll NULL
#define hb_delimRecCount NULL
#define hb_delimRecInfo NULL
#define hb_delimRecNo NULL
#define hb_delimSetFieldExtent NULL
#define hb_delimAlias NULL
#define hb_delimClose NULL
#define hb_delimCreate NULL
#define hb_delimInfo NULL
#define hb_delimNewArea NULL
#define hb_delimOpen NULL
#define hb_delimRelease NULL
#define hb_delimStructSize NULL
#define hb_delimSysName NULL
#define hb_delimEval NULL
#define hb_delimPack NULL
#define hb_delimPackRec NULL
#define hb_delimSort NULL
#define hb_delimTrans NULL
#define hb_delimTransRec NULL
#define hb_delimZap NULL
#define hb_delimChildEnd NULL
#define hb_delimChildStart NULL
#define hb_delimChildSync NULL
#define hb_delimSyncChildren NULL
#define hb_delimClearRel NULL
#define hb_delimForceRel NULL
#define hb_delimRelArea NULL
#define hb_delimRelEval NULL
#define hb_delimRelText NULL
#define hb_delimSetRel NULL
#define hb_delimOrderListAdd NULL
#define hb_delimOrderListClear NULL
#define hb_delimOrderListDelete NULL
#define hb_delimOrderListFocus NULL
#define hb_delimOrderListRebuild NULL
#define hb_delimOrderCondition NULL
#define hb_delimOrderCreate NULL
#define hb_delimOrderDestroy NULL
#define hb_delimOrderInfo NULL
#define hb_delimClearFilter NULL
#define hb_delimClearLocate NULL
#define hb_delimClearScope NULL
#define hb_delimCountScope NULL
#define hb_delimFilterText NULL
#define hb_delimScopeInfo NULL
#define hb_delimSetFilter NULL
#define hb_delimSetLocate NULL
#define hb_delimSetScope NULL
#define hb_delimSkipScope NULL
#define hb_delimCompile NULL
#define hb_delimError NULL
#define hb_delimEvalBlock NULL
#define hb_delimRawLock NULL
#define hb_delimLock NULL
#define hb_delimUnLock NULL
#define hb_delimCloseMemFile NULL
#define hb_delimCreateMemFile NULL
#define hb_delimGetValueFile NULL
#define hb_delimOpenMemFile NULL
#define hb_delimPutValueFile NULL
#define hb_delimReadDBHeader NULL
#define hb_delimWriteDBHeader NULL
#define hb_delimWhoCares NULL
#if defined(HB_EXTERN_C)
}
#endif
#endif /* HB_RDDDEL_H_ */

146
harbour/include/hbrddsdf.h Normal file
View File

@@ -0,0 +1,146 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* SDF RDD module
*
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version, with one exception:
*
* The exception is that if you link the Harbour Runtime Library (HRL)
* and/or the Harbour Virtual Machine (HVM) 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 HRL
* and/or HVM code into it.
*
* 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 program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
#ifndef HB_RDDSDF_H_
#define HB_RDDSDF_H_
#include "hbapirdd.h"
#if defined(HB_EXTERN_C)
extern "C" {
#endif
/*
* -- SDF METHODS --
*/
#define hb_sdfBof NULL
#define hb_sdfEof NULL
#define hb_sdfFound NULL
#define hb_sdfGoBottom NULL
#define hb_sdfGoTo NULL
#define hb_sdfGoToId NULL
#define hb_sdfGoTop NULL
#define hb_sdfSeek NULL
#define hb_sdfSkip NULL
#define hb_sdfSkipFilter NULL
#define hb_sdfSkipRaw NULL
#define hb_sdfAddField NULL
#define hb_sdfAppend NULL
#define hb_sdfCreateFields NULL
#define hb_sdfDeleteRec NULL
#define hb_sdfDeleted NULL
#define hb_sdfFieldCount NULL
#define hb_sdfFieldDisplay NULL
#define hb_sdfFieldInfo NULL
#define hb_sdfFieldName NULL
#define hb_sdfFlush NULL
#define hb_sdfGetRec NULL
#define hb_sdfGetValue NULL
#define hb_sdfGetVarLen NULL
#define hb_sdfGoCold NULL
#define hb_sdfGoHot NULL
#define hb_sdfPutRec NULL
#define hb_sdfPutValue NULL
#define hb_sdfRecAll NULL
#define hb_sdfRecCount NULL
#define hb_sdfRecInfo NULL
#define hb_sdfRecNo NULL
#define hb_sdfSetFieldExtent NULL
#define hb_sdfAlias NULL
#define hb_sdfClose NULL
#define hb_sdfCreate NULL
#define hb_sdfInfo NULL
#define hb_sdfNewArea NULL
#define hb_sdfOpen NULL
#define hb_sdfRelease NULL
#define hb_sdfStructSize NULL
#define hb_sdfSysName NULL
#define hb_sdfEval NULL
#define hb_sdfPack NULL
#define hb_sdfPackRec NULL
#define hb_sdfSort NULL
#define hb_sdfTrans NULL
#define hb_sdfTransRec NULL
#define hb_sdfZap NULL
#define hb_sdfChildEnd NULL
#define hb_sdfChildStart NULL
#define hb_sdfChildSync NULL
#define hb_sdfSyncChildren NULL
#define hb_sdfClearRel NULL
#define hb_sdfForceRel NULL
#define hb_sdfRelArea NULL
#define hb_sdfRelEval NULL
#define hb_sdfRelText NULL
#define hb_sdfSetRel NULL
#define hb_sdfOrderListAdd NULL
#define hb_sdfOrderListClear NULL
#define hb_sdfOrderListDelete NULL
#define hb_sdfOrderListFocus NULL
#define hb_sdfOrderListRebuild NULL
#define hb_sdfOrderCondition NULL
#define hb_sdfOrderCreate NULL
#define hb_sdfOrderDestroy NULL
#define hb_sdfOrderInfo NULL
#define hb_sdfClearFilter NULL
#define hb_sdfClearLocate NULL
#define hb_sdfClearScope NULL
#define hb_sdfCountScope NULL
#define hb_sdfFilterText NULL
#define hb_sdfScopeInfo NULL
#define hb_sdfSetFilter NULL
#define hb_sdfSetLocate NULL
#define hb_sdfSetScope NULL
#define hb_sdfSkipScope NULL
#define hb_sdfCompile NULL
#define hb_sdfError NULL
#define hb_sdfEvalBlock NULL
#define hb_sdfRawLock NULL
#define hb_sdfLock NULL
#define hb_sdfUnLock NULL
#define hb_sdfCloseMemFile NULL
#define hb_sdfCreateMemFile NULL
#define hb_sdfGetValueFile NULL
#define hb_sdfOpenMemFile NULL
#define hb_sdfPutValueFile NULL
#define hb_sdfReadDBHeader NULL
#define hb_sdfWriteDBHeader NULL
#define hb_sdfWhoCares NULL
#if defined(HB_EXTERN_C)
}
#endif
#endif /* HB_RDDSDF_H_ */

146
harbour/include/hbrddwrk.h Normal file
View File

@@ -0,0 +1,146 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Default RDD module
*
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version, with one exception:
*
* The exception is that if you link the Harbour Runtime Library (HRL)
* and/or the Harbour Virtual Machine (HVM) 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 HRL
* and/or HVM code into it.
*
* 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 program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
#ifndef HB_RDDWRK_H_
#define HB_RDDWRK_H_
#include "hbapirdd.h"
#if defined(HB_EXTERN_C)
extern "C" {
#endif
/*
* -- METHODS --
*/
extern ERRCODE hb_waBof( AREAP pArea, BOOL * pBof );
extern ERRCODE hb_waEof( AREAP pArea, BOOL * pEof );
extern ERRCODE hb_waFound( AREAP pArea, BOOL * pFound );
#define hb_waGoBottom hb_waUnsupported
#define hb_waGoTo ( DBENTRYP_UL ) hb_waUnsupported
#define hb_waGoToId ( DBENTRYP_I ) hb_waUnsupported
#define hb_waGoTop hb_waUnsupported
#define hb_waSeek ( DBENTRYP_BIB ) hb_waUnsupported
extern ERRCODE hb_waSkip( AREAP pArea, LONG lToSkip );
extern ERRCODE hb_waSkipFilter( AREAP pArea, LONG lUpDown );
#define hb_waSkipRaw ( DBENTRYP_L ) hb_waUnsupported
extern ERRCODE hb_waAddField( AREAP pArea, LPDBFIELDINFO pFieldInfo );
#define hb_waAppend ( DBENTRYP_B ) hb_waUnsupported
extern ERRCODE hb_waCreateFields( AREAP pArea, PHB_ITEM pStruct );
#define hb_waDeleteRec hb_waUnsupported
#define hb_waDeleted ( DBENTRYP_BP ) hb_waUnsupported
extern ERRCODE hb_waFieldCount( AREAP pArea, USHORT * uiFields );
#define hb_waFieldDisplay ( DBENTRYP_VF ) hb_waUnsupported
extern ERRCODE hb_waFieldInfo( AREAP pArea, USHORT uiIndex, USHORT uiType, PHB_ITEM pItem );
extern ERRCODE hb_waFieldName( AREAP pArea, USHORT uiIndex, void * szName );
#define hb_waFlush hb_waUnsupported
#define hb_waGetRec ( DBENTRYP_PP ) hb_waUnsupported
#define hb_waGetValue ( DBENTRYP_SI ) hb_waUnsupported
#define hb_waGetVarLen ( DBENTRYP_SVL ) hb_waUnsupported
#define hb_waGoCold hb_waUnsupported
#define hb_waGoHot hb_waUnsupported
#define hb_waPutRec ( DBENTRYP_P ) hb_waUnsupported
#define hb_waPutValue ( DBENTRYP_SI ) hb_waUnsupported
#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
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
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_waRelease( AREAP pArea );
extern ERRCODE hb_waStructSize( AREAP pArea, USHORT * uiSize );
extern ERRCODE hb_waSysName( AREAP pArea, BYTE * pBuffer );
extern ERRCODE hb_waEval( AREAP pArea, LPDBEVALINFO pEvalInfo );
#define hb_waPack hb_waUnsupported
#define hb_waPackRec ( DBENTRYP_LSP ) hb_waUnsupported
#define hb_waSort ( DBENTRYP_VS ) hb_waUnsupported
extern ERRCODE hb_waTrans( AREAP pArea, LPDBTRANSINFO pTransInfo );
extern ERRCODE hb_waTransRec( AREAP pArea, LPDBTRANSINFO pTransInfo );
#define hb_waZap hb_waUnsupported
extern ERRCODE hb_waChildEnd( AREAP pArea, LPDBRELINFO pRelInfo );
extern ERRCODE hb_waChildStart( AREAP pArea, LPDBRELINFO pRelInfo );
#define hb_waChildSync ( DBENTRYP_VR ) hb_waUnsupported
extern ERRCODE hb_waSyncChildren( AREAP pArea );
extern ERRCODE hb_waClearRel( AREAP pArea );
#define hb_waForceRel hb_waUnsupported
extern ERRCODE hb_waRelArea( AREAP pArea, USHORT uiRelNo, void * pRelArea );
extern ERRCODE hb_waRelEval( AREAP pArea, LPDBRELINFO pRelInfo );
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_waOrderListFocus ( DBENTRYP_OI ) hb_waUnsupported
#define hb_waOrderListRebuild hb_waUnsupported
#define hb_waOrderCondition ( DBENTRYP_VOI ) hb_waUnsupported
#define hb_waOrderCreate ( DBENTRYP_VOC ) hb_waUnsupported
#define hb_waOrderDestroy ( DBENTRYP_OI ) hb_waUnsupported
#define hb_waOrderInfo ( DBENTRYP_OII ) hb_waNull
extern ERRCODE hb_waClearFilter( AREAP pArea );
extern ERRCODE hb_waClearLocate( AREAP pArea );
#define hb_waClearScope hb_waUnsupported
#define hb_waCountScope ( DBENTRYP_VPLP ) hb_waUnsupported
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_VP ) hb_waUnsupported
#define hb_waSkipScope ( DBENTRYP_VPL ) hb_waUnsupported
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_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_waReadDBHeader hb_waUnsupported
#define hb_waWriteDBHeader hb_waUnsupported
#define hb_waWhoCares ( DBENTRYP_SVP ) hb_waUnsupported
#if defined(HB_EXTERN_C)
}
#endif
#endif /* HB_RDDWRK_H_ */

View File

@@ -366,6 +366,7 @@ MACRO_LIB_OBJS = \
RDD_LIB_OBJS = \
$(OBJ_DIR)\dbcmd.obj \
$(OBJ_DIR)\workarea.obj \
$(OBJ_DIR)\dbf1.obj \
$(OBJ_DIR)\dbnubs.obj \
$(OBJ_DIR)\delim1.obj \
@@ -373,6 +374,8 @@ RDD_LIB_OBJS = \
\
$(OBJ_DIR)\dbf0.obj \
$(OBJ_DIR)\dblist.obj \
$(OBJ_DIR)\dbsort.obj \
$(OBJ_DIR)\hbdbsort.obj \
$(OBJ_DIR)\dbstrux.obj \
$(OBJ_DIR)\dbupdat.obj \
$(OBJ_DIR)\delim0.obj \
@@ -383,14 +386,20 @@ RDD_LIB_OBJS = \
NULSYS_LIB_OBJS = \
$(OBJ_DIR)\nulsys.obj
#DBFNTX_LIB_OBJS = \
# $(OBJ_DIR)\dbfntx1.obj \
# \
# $(OBJ_DIR)\dbfntx0.obj
DBFNTX_LIB_OBJS = \
$(OBJ_DIR)\dbfntx1.obj \
\
$(OBJ_DIR)\dbfntx0.obj
#DBFCDX_LIB_OBJS = \
# $(OBJ_DIR)\dbfcdx1.obj \
# \
# $(OBJ_DIR)\dbfcdx0.obj
DBFCDX_LIB_OBJS = \
$(OBJ_DIR)\dbfcdx1.obj \
\
$(OBJ_DIR)\dbfcdx0.obj
#
@@ -776,6 +785,10 @@ $(OBJ_DIR)\dbcmd.obj : $(RDD_DIR)\dbcmd.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(RDD_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\workarea.obj : $(RDD_DIR)\workarea.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(RDD_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\dbf0.c : $(RDD_DIR)\dbf0.prg
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
@@ -794,6 +807,17 @@ $(OBJ_DIR)\dblist.obj : $(OBJ_DIR)\dblist.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(RDD_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\dbsort.c : $(RDD_DIR)\dbsort.prg
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
$(OBJ_DIR)\dbsort.obj : $(OBJ_DIR)\dbsort.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(RDD_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\hbdbsort.obj : $(RDD_DIR)\hbdbsort.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(RDD_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\dbnubs.obj : $(RDD_DIR)\dbnubs.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(RDD_LIB) $(ARFLAGS) -+$@,,
@@ -1865,9 +1889,9 @@ $(OBJ_DIR)\dbfntx0.obj : $(OBJ_DIR)\dbfntx0.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(DBFNTX_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\dbfntx1.obj : $(RDD_DIR)\dbfntx\dbfntx1.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(DBFNTX_LIB) $(ARFLAGS) -+$@,,
#$(OBJ_DIR)\dbfntx1.obj : $(RDD_DIR)\dbfntx\dbfntx1.c
# $(CC) $(CLIBFLAGS) -o$@ $**
# tlib $(DBFNTX_LIB) $(ARFLAGS) -+$@,,
#
# DBFCDX.LIB dependencies
@@ -1880,9 +1904,9 @@ $(OBJ_DIR)\dbfcdx0.obj : $(OBJ_DIR)\dbfcdx0.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(DBFCDX_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\dbfcdx1.obj : $(RDD_DIR)\dbfcdx\dbfcdx1.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(DBFCDX_LIB) $(ARFLAGS) -+$@,,
#$(OBJ_DIR)\dbfcdx1.obj : $(RDD_DIR)\dbfcdx\dbfcdx1.c
# $(CC) $(CLIBFLAGS) -o$@ $**
# tlib $(DBFCDX_LIB) $(ARFLAGS) -+$@,,
#
# DEBUG.LIB dependencies
@@ -2262,4 +2286,4 @@ $(OBJ_DIR)\ft_funcs.c : $(HBDOC_DIR)\ft_funcs.prg
$(HARBOUR_EXE) $(HARBOURFLAGS) $** -o$@
$(OBJ_DIR)\ft_funcs.obj : $(OBJ_DIR)\ft_funcs.c
$(CC) $(CLIBFLAGS) -o$@ $**
$(CC) $(CLIBFLAGS) -o$@ $**

View File

@@ -402,6 +402,7 @@ MACRO_LIB_OBJS = \
RDD_LIB_OBJS = \
$(OBJ_DIR)\dbcmd.obj \
$(OBJ_DIR)\workarea.obj \
$(OBJ_DIR)\dbf1.obj \
$(OBJ_DIR)\dbnubs.obj \
$(OBJ_DIR)\delim1.obj \
@@ -409,6 +410,8 @@ RDD_LIB_OBJS = \
\
$(OBJ_DIR)\dbf0.obj \
$(OBJ_DIR)\dblist.obj \
$(OBJ_DIR)\dbsort.obj \
$(OBJ_DIR)\hbdbsort.obj \
$(OBJ_DIR)\dbstrux.obj \
$(OBJ_DIR)\dbupdat.obj \
$(OBJ_DIR)\delim0.obj \
@@ -443,9 +446,11 @@ NULSYS_LIB_OBJS = \
$(HARBOUR_EXE) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $<
$(MAKE) -nologo /$(MK_FLAGS) /f$(MK_FILE) $(DBFNTX_LIB)2
#DBFNTX_LIB_OBJS = \
# $(OBJ_DIR)\dbfntx1.obj \
# \
# $(OBJ_DIR)\dbfntx0.obj
DBFNTX_LIB_OBJS = \
$(OBJ_DIR)\dbfntx1.obj \
\
$(OBJ_DIR)\dbfntx0.obj
#
@@ -459,9 +464,11 @@ DBFNTX_LIB_OBJS = \
$(HARBOUR_EXE) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $<
$(MAKE) -nologo /$(MK_FLAGS) /f$(MK_FILE) $(DBFCDX_LIB)2
#DBFCDX_LIB_OBJS = \
# $(OBJ_DIR)\dbfcdx1.obj \
# \
# $(OBJ_DIR)\dbfcdx0.obj
DBFCDX_LIB_OBJS = \
$(OBJ_DIR)\dbfcdx1.obj \
\
$(OBJ_DIR)\dbfcdx0.obj
#

View File

@@ -6,14 +6,17 @@ ROOT = ../../
C_SOURCES=\
dbcmd.c \
workarea.c \
dbf1.c \
dbnubs.c \
sdf1.c \
delim1.c \
hbdbsort.c \
PRG_SOURCES=\
dbf0.prg \
dblist.prg \
dbsort.prg \
dbstrux.prg \
dbupdat.prg \
sdf0.prg \

File diff suppressed because it is too large Load Diff

View File

@@ -43,5 +43,4 @@ init procedure DBFInit
rddRegister( "DBF", RDT_FULL )
return
return

File diff suppressed because it is too large Load Diff

View File

@@ -4,8 +4,8 @@
ROOT = ../../../
C_SOURCES=\
dbfcdx1.c \
#C_SOURCES=\
# dbfcdx1.c \
PRG_SOURCES=\
dbfcdx0.prg \

View File

@@ -4,8 +4,8 @@
ROOT = ../../../
C_SOURCES=\
dbfntx1.c \
#C_SOURCES=\
# dbfntx1.c \
PRG_SOURCES=\
dbfntx0.prg \

View File

@@ -40,11 +40,11 @@ ANNOUNCE DBFNTX
init procedure DBFNTXInit
REQUEST _DBFNTX
/* REQUEST _DBFNTX
*/
rddRegister( "DBF", RDT_FULL )
rddRegister( "DBFNTX", RDT_FULL )
/* rddRegister( "DBFNTX", RDT_FULL )
*/
return
/* NOTE: Commented out, because in Harbour the INIT order is not guaranteed,

View File

@@ -0,0 +1,74 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* __DBSORT() function
*
* Copyright 2000 Bruno Cantero <bruno@issnet.net>
* www - http://www.harbour-project.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 of the License, or
* (at your option) any later version, with one exception:
*
* The exception is that if you link the Harbour Runtime Library (HRL)
* and/or the Harbour Virtual Machine (HVM) 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 HRL
* and/or HVM code into it.
*
* 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 program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
FUNCTION __dbSort( cToFileName, aFields, bFor, bWhile, nNext, nRecord, lRest )
LOCAL nArea
LOCAL nToArea
LOCAL aStruct
LOCAL oError
LOCAL lError := .F.
nArea := Select()
aStruct := dbStruct()
IF Empty( aStruct )
RETURN .F.
ENDIF
BEGIN SEQUENCE
dbCreate( cToFileName, aStruct,, .T., "" )
nToArea := Select()
dbSelectArea( nArea )
__dbArrange( nToArea, aStruct, bFor, bWhile, nNext, nRecord, lRest, aFields )
RECOVER USING oError
lError := .T.
END SEQUENCE
IF nToArea != NIL
dbSelectArea( nToArea )
dbCloseArea()
ENDIF
dbSelectArea( nArea )
IF lError
Break( oError )
ENDIF
RETURN .T.

View File

@@ -43,5 +43,4 @@ init procedure DELIMInit
rddRegister( "DELIM", RDT_TRANSFER )
return
return

View File

@@ -33,13 +33,12 @@
*
*/
#define SUPERTABLE ( &delimSuper )
#include "hbapi.h"
#include "hbinit.h"
#include "hbapiitm.h"
#include "hbvm.h"
#include "hbapirdd.h"
#include "rddsys.ch"
#include "hbapiitm.h"
#include "hbrdddel.h"
HB_FUNC( _DELIMC );
HB_FUNC( DELIM_GETFUNCTABLE );
@@ -61,13 +60,107 @@ HB_INIT_SYMBOLS_END( delim1__InitSymbols )
#pragma startup delim1__InitSymbols
#endif
static RDDFUNCS delimSuper = { 0 };
static RDDFUNCS delimSuper = { NULL };
static RDDFUNCS delimTable = { hb_delimBof,
hb_delimEof,
hb_delimFound,
hb_delimGoBottom,
hb_delimGoTo,
hb_delimGoToId,
hb_delimGoTop,
hb_delimSeek,
hb_delimSkip,
hb_delimSkipFilter,
hb_delimSkipRaw,
hb_delimAddField,
hb_delimAppend,
hb_delimCreateFields,
hb_delimDeleteRec,
hb_delimDeleted,
hb_delimFieldCount,
hb_delimFieldDisplay,
hb_delimFieldInfo,
hb_delimFieldName,
hb_delimFlush,
hb_delimGetRec,
hb_delimGetValue,
hb_delimGetVarLen,
hb_delimGoCold,
hb_delimGoHot,
hb_delimPutRec,
hb_delimPutValue,
hb_delimRecAll,
hb_delimRecCount,
hb_delimRecInfo,
hb_delimRecNo,
hb_delimSetFieldExtent,
hb_delimAlias,
hb_delimClose,
hb_delimCreate,
hb_delimInfo,
hb_delimNewArea,
hb_delimOpen,
hb_delimRelease,
hb_delimStructSize,
hb_delimSysName,
hb_delimEval,
hb_delimPack,
hb_delimPackRec,
hb_delimSort,
hb_delimTrans,
hb_delimTransRec,
hb_delimZap,
hb_delimChildEnd,
hb_delimChildStart,
hb_delimChildSync,
hb_delimSyncChildren,
hb_delimClearRel,
hb_delimForceRel,
hb_delimRelArea,
hb_delimRelEval,
hb_delimRelText,
hb_delimSetRel,
hb_delimOrderListAdd,
hb_delimOrderListClear,
hb_delimOrderListDelete,
hb_delimOrderListFocus,
hb_delimOrderListRebuild,
hb_delimOrderCondition,
hb_delimOrderCreate,
hb_delimOrderDestroy,
hb_delimOrderInfo,
hb_delimClearFilter,
hb_delimClearLocate,
hb_delimClearScope,
hb_delimCountScope,
hb_delimFilterText,
hb_delimScopeInfo,
hb_delimSetFilter,
hb_delimSetLocate,
hb_delimSetScope,
hb_delimSkipScope,
hb_delimCompile,
hb_delimError,
hb_delimEvalBlock,
hb_delimRawLock,
hb_delimLock,
hb_delimUnLock,
hb_delimCloseMemFile,
hb_delimCreateMemFile,
hb_delimGetValueFile,
hb_delimOpenMemFile,
hb_delimPutValueFile,
hb_delimReadDBHeader,
hb_delimWriteDBHeader,
hb_delimWhoCares
};
/*
* -- DELIM METHODS --
*/
static RDDFUNCS delimTable = { 0 };
HB_FUNC( _DELIMC )
{
@@ -81,9 +174,11 @@ HB_FUNC( DELIM_GETFUNCTABLE )
uiCount = ( USHORT * ) hb_itemGetPtr( hb_param( 1, HB_IT_POINTER ) );
* uiCount = RDDFUNCSCOUNT;
pTable = ( RDDFUNCS * ) hb_itemGetPtr( hb_param( 2, HB_IT_POINTER ) );
HB_TRACE(HB_TR_DEBUG, ("DELIM_GETFUNCTABLE(%i, %p)", uiCount, pTable));
if( pTable )
hb_retni( hb_rddInherit( pTable, &delimTable, &delimSuper, 0 ) );
else
hb_retni( FAILURE );
}
}

View File

@@ -0,0 +1,234 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* SORT RDD module
*
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version, with one exception:
*
* The exception is that if you link the Harbour Runtime Library (HRL)
* and/or the Harbour Virtual Machine (HVM) 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 HRL
* and/or HVM code into it.
*
* 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 program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
#include "hbdbsort.h"
BOOL hb_dbQSortInit( LPDBQUICKSORT pQuickSort, LPDBSORTINFO pSortInfo, USHORT uiRecordLen )
{
/* Create temp file */
hb_fsTempName( pQuickSort->szTempName, NULL, NULL );
pQuickSort->hFile = hb_fsCreate( ( BYTE * ) pQuickSort->szTempName, FC_NORMAL );
if( pQuickSort->hFile == FS_ERROR )
return FALSE;
/* Alloc buffers */
pQuickSort->uiMaxRecords = USHRT_MAX / uiRecordLen;
pQuickSort->pBuffer = ( BYTE * ) hb_xgrab( pQuickSort->uiMaxRecords * uiRecordLen );
pQuickSort->pSwapBufferA = ( BYTE * ) hb_xgrab( uiRecordLen );
pQuickSort->pSwapBufferB = ( BYTE * ) hb_xgrab( uiRecordLen );
pQuickSort->pCmpBufferA = ( BYTE * ) hb_xgrab( uiRecordLen );
pQuickSort->pCmpBufferB = ( BYTE * ) hb_xgrab( uiRecordLen );
/* Fill structure */
pQuickSort->uiRecordLen = uiRecordLen;
pQuickSort->pSortInfo = pSortInfo;
return TRUE;
}
void hb_dbQSortExit( LPDBQUICKSORT pQuickSort )
{
/* Close and delete temp file */
hb_fsClose( pQuickSort->hFile );
hb_fsDelete( pQuickSort->szTempName );
/* Free buffers */
hb_xfree( pQuickSort->pBuffer );
hb_xfree( pQuickSort->pSwapBufferA );
hb_xfree( pQuickSort->pSwapBufferB );
hb_xfree( pQuickSort->pCmpBufferA );
hb_xfree( pQuickSort->pCmpBufferB );
}
BOOL hb_dbQSortAdvance( LPDBQUICKSORT pQuickSort, USHORT uiCount )
{
USHORT uiSize;
/* Write chunk */
uiSize = uiCount * pQuickSort->uiRecordLen;
return ( hb_fsWrite( pQuickSort->hFile, pQuickSort->pBuffer, uiSize ) == uiSize );
}
static BOOL hb_dbQSortIsLess( LPDBQUICKSORT pQuickSort, ULONG ulRecNo1, ULONG ulRecNo2 )
{
USHORT uiCount, uiField;
DBFAREAP pArea;
LPFIELD pField;
BOOL bAscending, bIgnoreCase;
int iResult;
pArea = ( DBFAREAP ) pQuickSort->pSortInfo->dbtri.lpaSource;
/* Read records */
hb_fsSeek( pQuickSort->hFile, ( ulRecNo1 - 1 ) * pQuickSort->uiRecordLen, FS_SET );
hb_fsRead( pQuickSort->hFile, pQuickSort->pSwapBufferA, pQuickSort->uiRecordLen );
hb_fsSeek( pQuickSort->hFile, ( ulRecNo2 - 1 ) * pQuickSort->uiRecordLen, FS_SET );
hb_fsRead( pQuickSort->hFile, pQuickSort->pSwapBufferB, pQuickSort->uiRecordLen );
/* Compare fields */
for( uiCount = 0; uiCount < pQuickSort->pSortInfo->uiItemCount; uiCount++ )
{
/* Sort flags */
bIgnoreCase = ( ( pQuickSort->pSortInfo->lpdbsItem[ uiCount ].uiFlags & SF_CASE ) == SF_CASE );
bAscending = ( ( pQuickSort->pSortInfo->lpdbsItem[ uiCount ].uiFlags & SF_ASCEND ) == SF_ASCEND );
uiField = pQuickSort->pSortInfo->lpdbsItem[ uiCount ].uiField - 1;
pField = pArea->lpFields + uiField;
if( pField->uiType == HB_IT_MEMO )
continue;
if( pField->uiType == HB_IT_LOGICAL )
{
if( pQuickSort->pSwapBufferA[ pArea->pFieldOffset[ uiField ] ] == 'T' ||
pQuickSort->pSwapBufferA[ pArea->pFieldOffset[ uiField ] ] == 't' ||
pQuickSort->pSwapBufferA[ pArea->pFieldOffset[ uiField ] ] == 'Y' ||
pQuickSort->pSwapBufferA[ pArea->pFieldOffset[ uiField ] ] == 'y' )
* pQuickSort->pCmpBufferA = '1';
else
* pQuickSort->pCmpBufferA = '0';
if( pQuickSort->pSwapBufferB[ pArea->pFieldOffset[ uiField ] ] == 'T' ||
pQuickSort->pSwapBufferB[ pArea->pFieldOffset[ uiField ] ] == 't' ||
pQuickSort->pSwapBufferB[ pArea->pFieldOffset[ uiField ] ] == 'Y' ||
pQuickSort->pSwapBufferB[ pArea->pFieldOffset[ uiField ] ] == 'y' )
* pQuickSort->pCmpBufferB = '1';
else
* pQuickSort->pCmpBufferB = '0';
}
else
{
memcpy( pQuickSort->pCmpBufferA, pQuickSort->pSwapBufferA +
pArea->pFieldOffset[ uiField ], pField->uiLen );
memcpy( pQuickSort->pCmpBufferB, pQuickSort->pSwapBufferB +
pArea->pFieldOffset[ uiField ], pField->uiLen );
}
pQuickSort->pCmpBufferA[ pField->uiLen ] = 0;
pQuickSort->pCmpBufferB[ pField->uiLen ] = 0;
/* Compare buffers */
if( bIgnoreCase )
iResult = stricmp( ( const char * ) pQuickSort->pCmpBufferA,
( const char * ) pQuickSort->pCmpBufferB );
else
iResult = strcmp( ( const char * ) pQuickSort->pCmpBufferA,
( const char * ) pQuickSort->pCmpBufferB );
if( iResult == 0 )
continue;
else if( bAscending )
return ( iResult < 0 );
else
return ( iResult > 0 );
}
return FALSE;
}
static void hb_dbQSortSwap( LPDBQUICKSORT pQuickSort, ULONG ulRecNo1, ULONG ulRecNo2 )
{
/* Swap records */
hb_fsSeek( pQuickSort->hFile, ( ulRecNo1 - 1 ) * pQuickSort->uiRecordLen, FS_SET );
hb_fsRead( pQuickSort->hFile, pQuickSort->pSwapBufferA, pQuickSort->uiRecordLen );
hb_fsSeek( pQuickSort->hFile, ( ulRecNo2 - 1 ) * pQuickSort->uiRecordLen, FS_SET );
hb_fsRead( pQuickSort->hFile, pQuickSort->pSwapBufferB, pQuickSort->uiRecordLen );
hb_fsSeek( pQuickSort->hFile, ( ulRecNo1 - 1 ) * pQuickSort->uiRecordLen, FS_SET );
hb_fsWrite( pQuickSort->hFile, pQuickSort->pSwapBufferB, pQuickSort->uiRecordLen );
hb_fsSeek( pQuickSort->hFile, ( ulRecNo2 - 1 ) * pQuickSort->uiRecordLen, FS_SET );
hb_fsWrite( pQuickSort->hFile, pQuickSort->pSwapBufferA, pQuickSort->uiRecordLen );
}
static void hb_dbQSortDo( LPDBQUICKSORT pQuickSort, ULONG ulFirst, ULONG ulLast )
{
ULONG ulPivot, ulLeft, ulRight;
/* Select pivot */
if( hb_dbQSortIsLess( pQuickSort, ulFirst, ulLast ) )
ulPivot = ulLast;
else
ulPivot = ulFirst;
ulLeft = ulFirst;
ulRight = ulLast;
do
{
/* partition into two segments */
while( ulLeft <= ulLast && hb_dbQSortIsLess( pQuickSort, ulLeft, ulPivot ) )
ulLeft++;
while( ulRight >= ulFirst && hb_dbQSortIsLess( pQuickSort, ulPivot, ulRight ) )
ulRight--;
if( ulLeft <= ulRight )
{
/* Swap records */
if( ulLeft < ulRight )
hb_dbQSortSwap( pQuickSort, ulLeft, ulRight );
ulLeft++;
ulRight--;
}
} while( ulLeft <= ulRight );
/* Sort segment */
if( ulFirst < ulRight )
hb_dbQSortDo( pQuickSort, ulFirst, ulRight );
/* Sort segment */
if( ulLeft < ulLast )
hb_dbQSortDo( pQuickSort, ulLeft, ulLast );
}
void hb_dbQSortComplete( LPDBQUICKSORT pQuickSort )
{
ULONG ulRecCount;
AREAP pArea;
ulRecCount = hb_fsSeek( pQuickSort->hFile, 0, FS_END ) / pQuickSort->uiRecordLen;
if( ulRecCount > 1 )
{
hb_dbQSortDo( pQuickSort, 1, ulRecCount );
pArea = pQuickSort->pSortInfo->dbtri.lpaDest;
hb_fsSeek( pQuickSort->hFile, 0, FS_SET );
while( ulRecCount-- > 0 )
{
/* Read sorted record */
hb_fsRead( pQuickSort->hFile, pQuickSort->pSwapBufferA, pQuickSort->uiRecordLen );
/* Remove deleted flag */
pQuickSort->pSwapBufferA[ 0 ] = ' ';
/* Append a new record and copy data */
if( SELF_APPEND( pArea, TRUE ) == FAILURE ||
SELF_PUTREC( pArea, pQuickSort->pSwapBufferA ) == FAILURE )
break;
}
}
hb_dbQSortExit( pQuickSort );
}

View File

@@ -43,5 +43,4 @@ init procedure SDFInit
rddRegister( "SDF", RDT_TRANSFER )
return
return

View File

@@ -33,13 +33,12 @@
*
*/
#define SUPERTABLE ( &sdfSuper )
#include "hbapi.h"
#include "hbinit.h"
#include "hbapiitm.h"
#include "hbvm.h"
#include "hbapirdd.h"
#include "rddsys.ch"
#include "hbapiitm.h"
#include "hbrddsdf.h"
HB_FUNC( _SDFC );
HB_FUNC( SDF_GETFUNCTABLE );
@@ -61,13 +60,108 @@ HB_INIT_SYMBOLS_END( sdf1__InitSymbols )
#pragma startup sdf1__InitSymbols
#endif
static RDDFUNCS sdfSuper = { 0 };
static RDDFUNCS sdfSuper = { NULL };
static RDDFUNCS sdfTable = { hb_sdfBof,
hb_sdfEof,
hb_sdfFound,
hb_sdfGoBottom,
hb_sdfGoTo,
hb_sdfGoToId,
hb_sdfGoTop,
hb_sdfSeek,
hb_sdfSkip,
hb_sdfSkipFilter,
hb_sdfSkipRaw,
hb_sdfAddField,
hb_sdfAppend,
hb_sdfCreateFields,
hb_sdfDeleteRec,
hb_sdfDeleted,
hb_sdfFieldCount,
hb_sdfFieldDisplay,
hb_sdfFieldInfo,
hb_sdfFieldName,
hb_sdfFlush,
hb_sdfGetRec,
hb_sdfGetValue,
hb_sdfGetVarLen,
hb_sdfGoCold,
hb_sdfGoHot,
hb_sdfPutRec,
hb_sdfPutValue,
hb_sdfRecAll,
hb_sdfRecCount,
hb_sdfRecInfo,
hb_sdfRecNo,
hb_sdfSetFieldExtent,
hb_sdfAlias,
hb_sdfClose,
hb_sdfCreate,
hb_sdfInfo,
hb_sdfNewArea,
hb_sdfOpen,
hb_sdfRelease,
hb_sdfStructSize,
hb_sdfSysName,
hb_sdfEval,
hb_sdfPack,
hb_sdfPackRec,
hb_sdfSort,
hb_sdfTrans,
hb_sdfTransRec,
hb_sdfZap,
hb_sdfChildEnd,
hb_sdfChildStart,
hb_sdfChildSync,
hb_sdfSyncChildren,
hb_sdfClearRel,
hb_sdfForceRel,
hb_sdfRelArea,
hb_sdfRelEval,
hb_sdfRelText,
hb_sdfSetRel,
hb_sdfOrderListAdd,
hb_sdfOrderListClear,
hb_sdfOrderListDelete,
hb_sdfOrderListFocus,
hb_sdfOrderListRebuild,
hb_sdfOrderCondition,
hb_sdfOrderCreate,
hb_sdfOrderDestroy,
hb_sdfOrderInfo,
hb_sdfClearFilter,
hb_sdfClearLocate,
hb_sdfClearScope,
hb_sdfCountScope,
hb_sdfFilterText,
hb_sdfScopeInfo,
hb_sdfSetFilter,
hb_sdfSetLocate,
hb_sdfSetScope,
hb_sdfSkipScope,
hb_sdfCompile,
hb_sdfError,
hb_sdfEvalBlock,
hb_sdfRawLock,
hb_sdfLock,
hb_sdfUnLock,
hb_sdfCloseMemFile,
hb_sdfCreateMemFile,
hb_sdfGetValueFile,
hb_sdfOpenMemFile,
hb_sdfPutValueFile,
hb_sdfReadDBHeader,
hb_sdfWriteDBHeader,
hb_sdfWhoCares
};
/*
* -- SDF METHODS --
*/
static RDDFUNCS sdfTable = { 0 };
HB_FUNC( _SDFC )
{
@@ -81,9 +175,11 @@ HB_FUNC( SDF_GETFUNCTABLE )
uiCount = ( USHORT * ) hb_itemGetPtr( hb_param( 1, HB_IT_POINTER ) );
* uiCount = RDDFUNCSCOUNT;
pTable = ( RDDFUNCS * ) hb_itemGetPtr( hb_param( 2, HB_IT_POINTER ) );
HB_TRACE(HB_TR_DEBUG, ("SDF_GETFUNCTABLE(%i, %p)", uiCount, pTable));
if( pTable )
hb_retni( hb_rddInherit( pTable, &sdfTable, &sdfSuper, 0 ) );
else
hb_retni( FAILURE );
}
}

View File

@@ -0,0 +1,887 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Default RDD module
*
* 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
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version, with one exception:
*
* The exception is that if you link the Harbour Runtime Library (HRL)
* and/or the Harbour Virtual Machine (HVM) 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 HRL
* and/or HVM code into it.
*
* 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 program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
* their web site at http://www.gnu.org/).
*
*/
#include <ctype.h>
#include "hbapi.h"
#include "hbinit.h"
#include "hbvm.h"
#include "hbapiitm.h"
#include "hbapierr.h"
#include "hbset.h"
#include "hbrddwrk.h"
/*
* -- METHODS --
*/
/*
* Determine logical beginning of file.
*/
ERRCODE hb_waBof( AREAP pArea, BOOL * pBof )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waBof(%p, %p)", pArea, pBof));
* pBof = pArea->fBof;
return SUCCESS;
}
/*
* Determine logical end of file.
*/
ERRCODE hb_waEof( AREAP pArea, BOOL * pEof )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waEof(%p, %p)", pArea, pEof));
* pEof = pArea->fEof;
return SUCCESS;
}
/*
* Determine outcome of the last search operation.
*/
ERRCODE hb_waFound( AREAP pArea, BOOL * pFound )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waFound(%p, %p)", pArea, pFound));
* pFound = pArea->fFound;
return SUCCESS;
}
/*
* Reposition cursor relative to current position.
*/
ERRCODE hb_waSkip( AREAP pArea, LONG lToSkip )
{
LONG lSkip;
HB_TRACE(HB_TR_DEBUG, ("hb_waSkip(%p, %ld)", pArea, lToSkip));
/* Flush record and exit */
if( lToSkip == 0 )
return SELF_SKIPRAW( pArea, 0 );
pArea->fTop = pArea->fBottom = FALSE;
if( lToSkip > 0 )
lSkip = 1;
else
{
lSkip = -1;
lToSkip *= -1;
}
while( lToSkip-- > 0 )
{
SELF_SKIPRAW( pArea, lSkip );
SELF_SKIPFILTER( pArea, lSkip );
if( pArea->fBof || pArea->fEof )
break;
}
/* Update Bof and Eof flags */
if( lToSkip < 0 )
pArea->fEof = FALSE;
else if( lToSkip > 0 )
pArea->fBof = FALSE;
return SUCCESS;
}
/*
* Reposition cursor respecting any filter setting.
*/
ERRCODE hb_waSkipFilter( AREAP pArea, LONG lUpDown )
{
BOOL bTop, bBottom, bOutOfRange, bDeleted;
PHB_ITEM pResult;
ERRCODE uiError;
HB_TRACE(HB_TR_DEBUG, ("hb_waSkipFilter(%p, %ld)", pArea, lUpDown));
if( !hb_set.HB_SET_DELETED && pArea->dbfi.itmCobExpr == NULL )
return SUCCESS;
bTop = pArea->fTop;
bBottom = pArea->fBottom;
bOutOfRange = FALSE;
while( TRUE )
{
if( pArea->fBof || pArea->fEof )
{
bOutOfRange = TRUE;
break;
}
/* SET FILTER TO */
if( pArea->dbfi.itmCobExpr )
{
pResult = hb_vmEvalBlock( pArea->dbfi.itmCobExpr );
if( HB_IS_LOGICAL( pResult ) && !hb_itemGetL( pResult ) )
{
SELF_SKIPRAW( pArea, lUpDown );
continue;
}
}
/* SET DELETED */
if( hb_set.HB_SET_DELETED )
{
SELF_DELETED( pArea, &bDeleted );
if( bDeleted )
{
SELF_SKIPRAW( pArea, lUpDown );
continue;
}
}
break;
}
if( bOutOfRange )
{
if( bTop && lUpDown > 0 )
uiError = SELF_GOTO( pArea, 0 );
else if( bBottom && lUpDown < 0 )
uiError = SELF_GOTO( pArea, 0 );
else if( lUpDown < 0 )
{
uiError = SELF_GOTOP( pArea );
pArea->fBof = TRUE;
pArea->fEof = FALSE;
}
else
{
uiError = SELF_GOTO( pArea, 0 );
pArea->fBof = FALSE;
}
}
else
uiError = SUCCESS;
return uiError;
}
/*
* Add a field to the WorkArea.
*/
ERRCODE hb_waAddField( AREAP pArea, LPDBFIELDINFO pFieldInfo )
{
ULONG ulSize;
LPFIELD pField;
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 );
if( !ulSize )
return FAILURE;
pField = pArea->lpFields + pArea->uiFieldCount;
if( pArea->uiFieldCount > 0 )
( ( LPFIELD ) ( pField - 1 ) )->lpfNext = pField;
pField->sym = ( void * ) hb_dynsymGet( ( char * ) pFieldInfo->atomName );
pField->uiType = pFieldInfo->uiType;
pField->uiTypeExtended = pFieldInfo->uiTypeExtended;
pField->uiLen = pFieldInfo->uiLen;
pField->uiDec = pFieldInfo->uiDec;
pField->uiArea = pArea->uiArea;
pArea->uiFieldCount ++;
return SUCCESS;
}
/*
* Add all fields defined in an array to the WorkArea.
*/
ERRCODE hb_waCreateFields( AREAP pArea, PHB_ITEM pStruct )
{
USHORT uiItems, uiCount, uiLen, uiDec;
DBFIELDINFO pFieldInfo;
PHB_ITEM pFieldDesc;
int iData;
HB_TRACE(HB_TR_DEBUG, ("hb_waCreateFields(%p, %p)", pArea, pStruct));
uiItems = ( USHORT ) hb_arrayLen( pStruct );
SELF_SETFIELDEXTENT( pArea, uiItems );
pFieldInfo.uiTypeExtended = 0;
for( uiCount = 0; uiCount < uiItems; uiCount++ )
{
pFieldDesc = hb_arrayGetItemPtr( pStruct, uiCount + 1 );
pFieldInfo.atomName = ( BYTE * ) hb_arrayGetCPtr( pFieldDesc, 1 );
iData = hb_arrayGetNI( pFieldDesc, 3 );
if( iData < 0 )
iData = 0;
uiLen = pFieldInfo.uiLen = ( USHORT ) iData;
iData = hb_arrayGetNI( pFieldDesc, 4 );
if( iData < 0 )
iData = 0;
uiDec = ( USHORT ) iData;
pFieldInfo.uiDec = 0;
iData = toupper( hb_arrayGetCPtr( pFieldDesc, 2 )[ 0 ] );
switch( iData )
{
case 'C':
pFieldInfo.uiType = HB_IT_STRING;
pFieldInfo.uiLen = uiLen + uiDec * 256;
break;
case 'L':
pFieldInfo.uiType = HB_IT_LOGICAL;
pFieldInfo.uiLen = 1;
break;
case 'M':
pFieldInfo.uiType = HB_IT_MEMO;
pFieldInfo.uiLen = 10;
break;
case 'D':
pFieldInfo.uiType = HB_IT_DATE;
pFieldInfo.uiLen = 8;
break;
case 'N':
pFieldInfo.uiType = HB_IT_LONG;
if( uiLen > 20 )
return FAILURE;
else
pFieldInfo.uiDec = uiDec;
break;
default:
return FAILURE;
}
/* Add field */
if( SELF_ADDFIELD( pArea, &pFieldInfo ) == FAILURE )
return FAILURE;
}
return SUCCESS;
}
/*
* Determine the number of fields in the WorkArea.
*/
ERRCODE hb_waFieldCount( AREAP pArea, USHORT * uiFields )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waFieldCount(%p, %p)", pArea, uiFields));
* uiFields = pArea->uiFieldCount;
return SUCCESS;
}
/*
* Retrieve information about a field.
*/
ERRCODE hb_waFieldInfo( AREAP pArea, USHORT uiIndex, USHORT uiType, PHB_ITEM pItem )
{
LPFIELD pField;
HB_TRACE(HB_TR_DEBUG, ("hb_waFieldInfo(%p, %hu, %hu, %p)", pArea, uiIndex, uiType, pItem));
if( uiIndex > pArea->uiFieldCount )
return FAILURE;
pField = pArea->lpFields + uiIndex - 1;
switch( uiType )
{
case DBS_NAME:
hb_itemPutC( pItem, ( ( PHB_DYNS ) pField->sym )->pSymbol->szName );
break;
case DBS_TYPE:
switch( pField->uiType )
{
case HB_IT_STRING:
hb_itemPutC( pItem, "C" );
break;
case HB_IT_LOGICAL:
hb_itemPutC( pItem, "L" );
break;
case HB_IT_MEMO:
hb_itemPutC( pItem, "M" );
break;
case HB_IT_DATE:
hb_itemPutC( pItem, "D" );
break;
case HB_IT_LONG:
hb_itemPutC( pItem, "N" );
break;
default:
hb_itemPutC( pItem, "U" );
break;
}
break;
case DBS_LEN:
hb_itemPutNL( pItem, pField->uiLen );
break;
case DBS_DEC:
hb_itemPutNL( pItem, pField->uiDec );
break;
default:
return FAILURE;
}
return SUCCESS;
}
/*
* Determine the name associated with a field number.
*/
ERRCODE hb_waFieldName( AREAP pArea, USHORT uiIndex, void * szName )
{
LPFIELD pField;
HB_TRACE(HB_TR_DEBUG, ("hb_waFieldName(%p, %hu, %p)", pArea, uiIndex, szName));
if( uiIndex > pArea->uiFieldExtent )
return FAILURE;
pField = pArea->lpFields + uiIndex - 1;
strncpy( ( char * ) szName, ( ( PHB_DYNS ) pField->sym )->pSymbol->szName,
HARBOUR_MAX_RDD_FIELDNAME_LENGTH );
return SUCCESS;
}
/*
* Establish the extent of the array of fields for a WorkArea.
*/
ERRCODE hb_waSetFieldExtent( AREAP pArea, USHORT uiFieldExtent )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waSetFieldExtent(%p, %hu)", pArea, uiFieldExtent));
pArea->uiFieldExtent = uiFieldExtent;
/* Alloc field array */
pArea->lpFields = ( LPFIELD ) hb_xgrab( uiFieldExtent * sizeof( FIELD ) );
memset( pArea->lpFields, 0, uiFieldExtent * sizeof( FIELD ) );
return SUCCESS;
}
/*
* Obtain the alias of the WorkArea.
*/
ERRCODE hb_waAlias( AREAP pArea, BYTE * szAlias )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waAlias(%p, %p)", pArea, szAlias));
strncpy( ( char * ) szAlias, ( ( PHB_DYNS ) pArea->atomAlias )->pSymbol->szName,
HARBOUR_MAX_RDD_ALIAS_LENGTH );
return SUCCESS;
}
/*
* Close the table in the WorkArea.
*/
ERRCODE hb_waClose( AREAP pArea )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waClose(%p)", pArea));
/* Clear items */
SELF_CLEARFILTER( pArea );
SELF_CLEARREL( pArea );
SELF_CLEARLOCATE( pArea );
if( pArea->uiParents > 0 )
printf( "\nTODO: hb_waClose()\n" );
( ( PHB_DYNS ) pArea->atomAlias )->hArea = 0;
return SUCCESS;
}
/*
* Retrieve information about the current driver.
*/
ERRCODE hb_waInfo( AREAP pArea, USHORT uiIndex, PHB_ITEM pItem )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waInfo(%p, %hu, %p)", pArea, uiIndex, pItem));
HB_SYMBOL_UNUSED( pArea );
if( uiIndex == DBI_ISDBF || uiIndex == DBI_CANPUTREC )
{
hb_itemPutL( pItem, FALSE );
return SUCCESS;
}
else
return FAILURE;
}
/*
* Clear the WorkArea for use.
*/
ERRCODE hb_waNewArea( AREAP pArea )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waNewArea(%p)", pArea));
pArea->valResult = hb_itemNew( NULL );
return SUCCESS;
}
/*
* Release all references to a WorkArea.
*/
ERRCODE hb_waRelease( AREAP pArea )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waRelease(%p)", pArea));
/* Free all allocated pointers */
if( pArea->lpFields )
hb_xfree( pArea->lpFields );
if( pArea->valResult )
hb_itemRelease( pArea->valResult );
hb_xfree( pArea );
return SUCCESS;
}
/*
* Retrieve the size of the WorkArea structure.
*/
ERRCODE hb_waStructSize( AREAP pArea, USHORT * uiSize )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waStrucSize(%p, %p)", pArea, uiSize));
HB_SYMBOL_UNUSED( pArea );
* uiSize = sizeof( AREA );
return SUCCESS;
}
/*
* Obtain the name of replaceable database driver (RDD) subsystem.
*/
ERRCODE hb_waSysName( AREAP pArea, BYTE * pBuffer )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waSysName(%p, %p)", pArea, pBuffer));
HB_SYMBOL_UNUSED( pArea );
pBuffer[ 0 ] = 0;
return SUCCESS;
}
/*
* Evaluate code block for each record in WorkArea.
*/
ERRCODE hb_waEval( AREAP pArea, LPDBEVALINFO pEvalInfo )
{
BOOL bFor, bWhile;
ULONG ulNext;
HB_TRACE(HB_TR_DEBUG, ("hb_waEval(%p, %p)", pArea, pEvalInfo));
ulNext = 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( !pEvalInfo->dbsci.fRest || !hb_itemGetL( pEvalInfo->dbsci.fRest ) )
SELF_GOTOP( pArea );
if( pEvalInfo->dbsci.lNext )
ulNext = hb_itemGetNL( pEvalInfo->dbsci.lNext );
while( !pArea->fEof )
{
if( pEvalInfo->dbsci.lNext && ulNext-- < 1 )
break;
if( pEvalInfo->dbsci.itmCobWhile )
{
bWhile = hb_itemGetL( hb_vmEvalBlock( pEvalInfo->dbsci.itmCobWhile ) );
if( !bWhile )
break;
}
else
bWhile = TRUE;
if( pEvalInfo->dbsci.itmCobFor )
bFor = hb_itemGetL( hb_vmEvalBlock( pEvalInfo->dbsci.itmCobFor ) );
else
bFor = TRUE;
if( bFor && bWhile )
hb_vmEvalBlock( pEvalInfo->itmBlock );
SELF_SKIP( pArea, 1 );
}
return SUCCESS;
}
/*
* Copy one or more records from one WorkArea to another.
*/
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 );
printf( "\nTODO: hb_waTrans()\n" );
return SUCCESS;
}
/*
* Copy a record to another WorkArea.
*/
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 );
printf( "\nTODO: hb_waTransRec()\n" );
return SUCCESS;
}
/*
* Report end of relation.
*/
ERRCODE hb_waChildEnd( AREAP pArea, LPDBRELINFO pRelInfo )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waChildEnd(%p, %p)", pArea, pRelInfo));
HB_SYMBOL_UNUSED( pRelInfo );
pArea->uiParents --;
return SUCCESS;
}
/*
* Report initialization of a relation.
*/
ERRCODE hb_waChildStart( AREAP pArea, LPDBRELINFO pRelInfo )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waChildStart(%p, %p)", pArea, pRelInfo));
HB_SYMBOL_UNUSED( pRelInfo );
pArea->uiParents ++;
return SUCCESS;
}
/*
* Force relational movement in child WorkAreas.
*/
ERRCODE hb_waSyncChildren( AREAP pArea )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waSyncChildren(%p)", pArea));
HB_SYMBOL_UNUSED( pArea );
printf( "\nTODO: hb_waSyncChildren()\n" );
return SUCCESS;
}
/*
* Clear all relations in the specified WorkArea.
*/
ERRCODE hb_waClearRel( AREAP pArea )
{
LPDBRELINFO lpdbRelation;
HB_TRACE(HB_TR_DEBUG, ("hb_waClearRel(%p)", pArea ));
/* Free all relations */
lpdbRelation = pArea->lpdbRelations;
while( lpdbRelation )
{
SELF_CHILDEND( pArea, lpdbRelation );
if( lpdbRelation->itmCobExpr )
hb_itemRelease( lpdbRelation->itmCobExpr );
if( lpdbRelation->abKey )
hb_itemRelease( lpdbRelation->abKey );
hb_xfree( lpdbRelation );
pArea->lpdbRelations = pArea->lpdbRelations->lpdbriNext;
lpdbRelation = pArea->lpdbRelations;
}
return SUCCESS;
}
/*
* Obtain the logical number of the specified WorkArea.
*/
ERRCODE hb_waRelArea( AREAP pArea, USHORT uiRelNo, void * pRelArea )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waRelArea(%p, %hu, %p)", pArea, uiRelNo, pExpr));
HB_SYMBOL_UNUSED( pArea );
HB_SYMBOL_UNUSED( uiRelNo );
HB_SYMBOL_UNUSED( pRelArea );
printf( "\nTODO: hb_waRelArea()\n" );
return SUCCESS;
}
/*
* Evaluate a block against the relation in specified WorkArea.
*/
ERRCODE hb_waRelEval( AREAP pArea, LPDBRELINFO pRelInfo )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waRelEval(%p, %p)", pArea, pRelInfo));
HB_SYMBOL_UNUSED( pArea );
HB_SYMBOL_UNUSED( pRelInfo );
printf( "\nTODO: hb_waRelEval()\n" );
return SUCCESS;
}
/*
* Obtain the character expression of the specified relation.
*/
ERRCODE hb_waRelText( AREAP pArea, USHORT uiRelNo, void * pExpr )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waRelText(%p, %hu, %p)", pArea, uiRelNo, pExpr));
HB_SYMBOL_UNUSED( pArea );
HB_SYMBOL_UNUSED( pExpr );
printf( "\nTODO: hb_waRelText()\n" );
return SUCCESS;
}
/*
* Set a relation in the parent file.
*/
extern ERRCODE hb_waSetRel( AREAP pArea, LPDBRELINFO pRelInfo )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waSetRel(%p, %p)", pArea, pRelInfo));
HB_SYMBOL_UNUSED( pArea );
HB_SYMBOL_UNUSED( pRelInfo );
printf( "\nTODO: hb_waSetRel()\n" );
return SUCCESS;
}
/*
* Clear the active filter expression.
*/
ERRCODE hb_waClearFilter( AREAP pArea )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waClearFilter(%p)", pArea));
/* Free all items */
if( pArea->dbfi.itmCobExpr )
{
hb_itemRelease( pArea->dbfi.itmCobExpr );
pArea->dbfi.itmCobExpr = NULL;
}
if( pArea->dbfi.abFilterText )
{
hb_itemRelease( pArea->dbfi.abFilterText );
pArea->dbfi.abFilterText = NULL;
}
return SUCCESS;
}
/*
* Clear the active locate expression.
*/
ERRCODE hb_waClearLocate( AREAP pArea )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waClearLocate(%p)", pArea));
/* Free all items */
if( pArea->dbsi.itmCobFor )
{
hb_itemRelease( pArea->dbsi.itmCobFor );
pArea->dbsi.itmCobFor = NULL;
}
if( pArea->dbsi.lpstrFor )
{
hb_itemRelease( pArea->dbsi.lpstrFor );
pArea->dbsi.lpstrFor = NULL;
}
if( pArea->dbsi.itmCobWhile )
{
hb_itemRelease( pArea->dbsi.itmCobWhile );
pArea->dbsi.itmCobWhile = NULL;
}
if( pArea->dbsi.lpstrWhile )
{
hb_itemRelease( pArea->dbsi.lpstrWhile );
pArea->dbsi.lpstrWhile = NULL;
}
if( pArea->dbsi.lNext )
{
hb_itemRelease( pArea->dbsi.lNext );
pArea->dbsi.lNext = NULL;
}
if( pArea->dbsi.itmRecID )
{
hb_itemRelease( pArea->dbsi.itmRecID );
pArea->dbsi.itmRecID = NULL;
}
if( pArea->dbsi.fRest )
{
hb_itemRelease( pArea->dbsi.fRest );
pArea->dbsi.fRest = NULL;
}
return SUCCESS;
}
/*
* Return filter condition of the specified WorkArea.
*/
ERRCODE hb_waFilterText( AREAP pArea, PHB_ITEM pFilter )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waFilterText(%p, %p)", pArea, pFilter));
if( pArea->dbfi.abFilterText )
hb_itemCopy( pFilter, pArea->dbfi.abFilterText );
return SUCCESS;
}
/*
* Set the filter condition for the specified WorkArea.
*/
ERRCODE hb_waSetFilter( AREAP pArea, LPDBFILTERINFO pFilterInfo )
{
HB_TRACE(HB_TR_DEBUG, ("hb_wsSetFilter(%p, %p)", pArea, pFilterInfo));
/* Clear the active filter expression */
SELF_CLEARFILTER( pArea );
if( pFilterInfo->itmCobExpr )
pArea->dbfi.itmCobExpr = hb_itemNew( pFilterInfo->itmCobExpr );
if( pFilterInfo->abFilterText )
pArea->dbfi.abFilterText = hb_itemNew( pFilterInfo->abFilterText );
return SUCCESS;
}
/*
* Set the locate scope for the specified WorkArea.
*/
ERRCODE hb_waSetLocate( AREAP pArea, LPDBSCOPEINFO pScopeInfo )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waSetLocate(%p, %p)", pArea, pScopeInfo));
/* Clear the active locate expression */
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 );
if( pScopeInfo->lNext )
pArea->dbsi.lNext = hb_itemNew( pScopeInfo->lNext );
if( pScopeInfo->itmRecID )
pArea->dbsi.itmRecID = hb_itemNew( pScopeInfo->itmRecID );
if( pScopeInfo->fRest )
pArea->dbsi.fRest = hb_itemNew( pScopeInfo->fRest );
return SUCCESS;
}
/*
* Compile a character expression.
*/
ERRCODE hb_waCompile( AREAP pArea, BYTE * pExpr )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waCompile(%p, %p)", pArea, pExpr));
HB_SYMBOL_UNUSED( pArea );
HB_SYMBOL_UNUSED( pExpr );
printf( "\nTODO: hb_waCompile()\n" );
return SUCCESS;
}
/*
* Raise a runtime error.
*/
ERRCODE hb_waError( AREAP pArea, PHB_ITEM pError )
{
char * szRddName;
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 )
SELF_SYSNAME( pArea, ( BYTE * ) szRddName );
else
strcpy( szRddName, "???DRIVER" );
hb_errPutSeverity( pError, ES_ERROR );
hb_errPutSubSystem( pError, szRddName );
hb_xfree( szRddName );
return hb_errLaunch( pError );
}
/*
* Evaluate a code block.
*/
ERRCODE hb_waEvalBlock( AREAP pArea, PHB_ITEM pBlock )
{
HB_TRACE(HB_TR_DEBUG, ("hb_waEvalBlock(%p, %p)", pArea, pBlock));
hb_itemCopy( pArea->valResult, hb_vmEvalBlock( pBlock ) );
return SUCCESS;
}

View File

@@ -52,12 +52,7 @@ FUNCTION ordSkipUnique() ; RETURN .F.
#endif
#ifdef HB_COMPAT_C53
FUNCTION dbFileGet() ; RETURN .F.
FUNCTION dbFilePut() ; RETURN .F.
FUNCTION dbInfo() ; RETURN NIL
FUNCTION dbOrderInfo() ; RETURN NIL
FUNCTION dbRecordInfo() ; RETURN NIL
FUNCTION dbFieldInfo() ; RETURN NIL
#endif
FUNCTION MLCToPos() ; RETURN 0
@@ -68,13 +63,10 @@ FUNCTION __dbCopy() ; RETURN NIL
FUNCTION __dbDelim() ; RETURN NIL
FUNCTION __dbJoin() ; RETURN NIL
FUNCTION __dbSDF() ; RETURN NIL
FUNCTION __dbSort() ; RETURN NIL
FUNCTION __dbTotal() ; RETURN NIL
/* NOTE: Internal functions */
FUNCTION __dbArrange() ; RETURN NIL
FUNCTION __dbFList() ; RETURN {}
FUNCTION __dbOpenSDF() ; RETURN NIL
FUNCTION __dbTrans() ; RETURN NIL
FUNCTION __dbTransRec() ; RETURN NIL
FUNCTION __dbTransRec() ; RETURN NIL

View File

@@ -114,9 +114,7 @@ PRG_SOURCES=\
test_all.prg \
testbrdb.prg \
testbrw.prg \
testcdx.prg \
testcgi.prg \
testdbf.prg \
testdecl.prg \
testerro.prg \
testfor.prg \
@@ -125,7 +123,6 @@ PRG_SOURCES=\
teststr.prg \
testpre.prg \
testread.prg \
testrdd.prg \
testvars.prg \
testwarn.prg \
tstalias.prg \
@@ -136,6 +133,7 @@ PRG_SOURCES=\
version.prg \
vmasort.prg \
while.prg \
newrdd.prg \
PRG_HEADERS=\
db_brows.ch \
@@ -179,6 +177,9 @@ BAD_PRG_SOURCES=\
testtok.prg \
tstprag.prg \
vec1.prg \
testrdd.prg \
testcdx.prg \
testdbf.prg \
C_SOURCES=\

361
harbour/tests/newrdd.prg Normal file
View File

@@ -0,0 +1,361 @@
function Main()
local nI, aArray
REQUEST _DBF
rddSetDefault( "DBF" )
SET EXCLUSIVE OFF
CLS
dbUseArea( .T., "DBF", "Test", "TESTDBF", .T., .F. )
? "RecCount:", TESTDBF->( RecCount() )
? "Used:", TESTDBF->( Used() )
? "Select:", TESTDBF->( Select() )
? "RecSize:", TESTDBF->( RecSize() )
? "RecNo:", TESTDBF->( RecNo() )
? "NetErr:", TESTDBF->( NetErr() )
? "Press any key to continue..."
InKey( 0 )
CLS
aArray := RddList( 0 )
? "Rdd's: "
for nI := 1 to Len( aArray )
?? aArray[ nI ], ""
next
? "RddName:", TESTDBF->( RddName() )
? "lUpdate:", TESTDBF->( lUpdate() )
? "Header:", TESTDBF->( Header() )
? "FieldPos( 'LAST' ):", TESTDBF->( FieldPos( "LAST" ) )
? "FieldName( 2 ):", TESTDBF->( FieldName( 2 ) )
? "DBF():", TESTDBF->( DBF() )
? "Alias( 1 ):", Alias( 1 )
? "dbTableExt():", TESTDBF->( dbTableExt() )
aArray := TESTDBF->( dbStruct() )
? "dbStruct:"
for nI := 1 to Len( aArray )
? PadR( aArray[ nI ][ 1 ], 10 ) , aArray[ nI ][ 2 ], aArray[ nI ][ 3 ], aArray[ nI ][ 4 ]
next
? "Press any key to continue..."
InKey( 0 )
CLS
? "dbGoTop():"
dbGoTop()
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "dbSkip( -1 ):"
dbSkip( -1 )
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "dbSkip( -1 ):"
dbSkip( -1 )
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "dbSkip( 1 ):"
dbSkip( 1 )
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "dbSkip( 1 ):"
dbSkip( 1 )
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "dbGoTop():"
dbGoTop()
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "dbSkip( 1 ):"
dbSkip( 1 )
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "dbSkip( 1 ):"
dbSkip( 1 )
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "dbSkip( -1 ):"
dbSkip( -1 )
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "dbSkip( -1 ):"
dbSkip( -1 )
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
InKey( 0 )
CLS
? "dbGoBottom():"
dbGoBottom()
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "dbSkip( 1 ):"
dbSkip( 1 )
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "dbSkip( 1 ):"
dbSkip( 1 )
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "dbSkip( -1 ):"
dbSkip( -1 )
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "dbSkip( -1 ):"
dbSkip( -1 )
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "Press any key to continue..."
InKey( 0 )
CLS
? "dbGoto( 490 ):"
dbGoto( 490 )
? "Bof Eof Found Deleted RecNo:", TESTDBF->( Bof() ), TESTDBF->( Eof() ), ;
TESTDBF->( Found() ), TESTDBF->( Deleted() ), TESTDBF->( Deleted() ), ;
TESTDBF->( RecNo() )
? "FCount:", TESTDBF->( FCount() )
for nI := 1 to TESTDBF->( FCount() )
? "FieldGet( " + LTrim( Str( nI ) ) + " ):", TESTDBF->( FieldGet( nI ) )
next
? "Press any key to continue..."
InKey( 0 )
CLS
? "while !TESTDBF->( Eof() )"
? " ? TESTDBF->FIRST, TESTDBF->( RecNo() )"
? " TESTDBF->( dbSkip() )"
? "end"
? ""
while !TESTDBF->( Eof() )
? TESTDBF->FIRST, TESTDBF->( RecNo() )
TESTDBF->( dbSkip() )
end
? "Press any key to continue..."
InKey( 0 )
CLS
? "SET FILTER TO TESTDBF->AGE == 21"
? "? TESTDBF->( dbFilter() )"
? "TESTDBF->( dbGoTop() )"
? "while !TESTDBF->( Eof() )"
? " ? TESTDBF->FIRST, TESTDBF->AGE, TESTDBF->( RecNo() )"
? " TESTDBF->( dbSkip() )"
? "end"
? "SET FILTER TO"
? ""
SET FILTER TO TESTDBF->AGE == 21
? TESTDBF->( dbFilter() )
TESTDBF->( dbGoTop() )
while !TESTDBF->( Eof() )
? TESTDBF->FIRST, TESTDBF->AGE, TESTDBF->( RecNo() )
TESTDBF->( dbSkip() )
end
SET FILTER TO
? "Press any key to continue..."
InKey( 0 )
CLS
? "TESTDBF->( Found() )"
? "LOCATE FOR TESTDBF->AGE == 23"
? "while TESTDBF->( Found() )"
? " ? TESTDBF->FIRST, TESTDBF->AGE, TESTDBF->( RecNo() )"
? " CONTINUE"
? "end"
TESTDBF->( Found() )
LOCATE FOR TESTDBF->AGE == 23
while TESTDBF->( Found() )
? TESTDBF->FIRST, TESTDBF->AGE, TESTDBF->( RecNo() )
CONTINUE
end
? "Press any key to continue..."
InKey( 0 )
CLS
? "TESTDBF->( dbEval( { || QOut( TESTDBF->FIRST, TESTDBF->AGE ) }, ;"
? " { || TESTDBF->AGE == 23 } ) )"
? ""
? "dbCommit()"
TESTDBF->( dbEval( { || QOut( TESTDBF->FIRST, TESTDBF->AGE ) }, ;
{ || TESTDBF->AGE == 23 } ) )
TESTDBF->( dbCommit() )
? "Press any key to continue..."
InKey( 0 )
CLS
? 'dbCreate( "NewRdd", { { "First_Name", "C", 20, 0 }, ;'
? ' { "Age", "N", 3, 0 }, ;'
? ' { "Date", "D", 8, 0 }, ;'
? ' { "Student", "L", 1, 0 } },, .T., "NEWRDD" )'
? 'SET CENTURY ON'
dbCreate( "NewRdd", { { "First_Name", "C", 20, 0 }, ;
{ "Age", "N", 3, 0 }, ;
{ "Date", "D", 8, 0 }, ;
{ "Rate", "N", 6, 2 }, ;
{ "Student", "L", 1, 0 } },, .T., "NEWRDD" )
SET CENTURY ON
? "lUpdate:", NEWRDD->( lUpdate() )
? "Press any key to continue..."
InKey( 0 )
CLS
? 'Select( "TESTDBF" )'
? "SET FILTER TO TESTDBF->SALARY > 120000"
? "TESTDBF->( dbGoTop() )"
? "while !TESTDBF->( Eof() )"
? " NEWRDD->( dbAppend() )"
? " NEWRDD->FIRST_NAME := TESTDBF->FIRST"
? " NEWRDD->AGE := TESTDBF->AGE"
? " NEWRDD->DATE := TESTDBF->HIREDATE"
? " NEWRDD->RATE := Val( Right( LTrim( Str( Seconds() ) ), 5 ) )"
? " NEWRDD->STUDENT := TESTDBF->MARRIED"
? " TESTDBF->( dbSkip() )"
? "end"
? "SET FILTER TO"
? "? NEWRDD->( RecCount() )"
? "NEWRDD->( dbGoTop() )"
? "NEWRDD->( dbRLock( 1 ) )"
? "NEWRDD->( dbDelete() )"
? "? NEWRDD->( Deleted() )"
? "NEWRDD->( dbGoBottom() )"
? "NEWRDD->( dbRLock() )"
? "NEWRDD->( dbDelete() )"
? "? NEWRDD->( Deleted() )"
? "NEWRDD->( dbRLock( 3 ) )"
Select( "TESTDBF" )
SET FILTER TO TESTDBF->SALARY > 120000
TESTDBF->( dbGoTop() )
while !TESTDBF->( Eof() )
NEWRDD->( dbAppend() )
NEWRDD->FIRST_NAME := TESTDBF->FIRST
NEWRDD->AGE := TESTDBF->AGE
NEWRDD->DATE := TESTDBF->HIREDATE
NEWRDD->RATE := Val( Right( LTrim( Str( Seconds() ) ), 5 ) )
NEWRDD->STUDENT := TESTDBF->MARRIED
TESTDBF->( dbSkip() )
end
SET FILTER TO
? NEWRDD->( RecCount() )
NEWRDD->( dbGoTop() )
NEWRDD->( dbRLock( 1 ) )
NEWRDD->( dbDelete() )
? NEWRDD->( Deleted() )
NEWRDD->( dbGoBottom() )
NEWRDD->( dbRLock() )
NEWRDD->( dbDelete() )
? NEWRDD->( Deleted() )
NEWRDD->( dbRLock( 3 ) )
? "Press any key to continue..."
InKey( 0 )
CLS
aArray := NEWRDD->( dbRLockList() )
? "aArray := NEWRDD->( dbRLockList() )"
? "for nI := 1 to Len( aArray )"
? " ? aArray[ nI ]"
? "next"
? "dbRLockList(): "
for nI := 1 to Len( aArray )
? aArray[ nI ]
next
? "Press any key to continue..."
InKey( 0 )
CLS
? 'NEWRDD->( dbCloseArea() )'
? 'dbUseArea( .T., "DBF", "NewRdd", "NEWRDD", .F., .F. )'
? 'nI := 1'
? 'NEWRDD->( __dbPack( { || QOut( nI ), nI++ } ) )'
? '? "RecCount:", NEWRDD->( RecCount() )'
? ""
NEWRDD->( dbCloseArea() )
dbUseArea( .T., "DBF", "NewRdd", "NEWRDD", .F., .F. )
? "Press any key to continue..."
InKey( 0 )
CLS
nI := 1
NEWRDD->( __dbPack( { || QOut( nI ), nI++ } ) )
? "RecCount:", NEWRDD->( RecCount() )
? "Press any key to continue..."
InKey( 0 )
CLS
? '? "RecCount:", NEWRDD->( RecCount() )'
? 'NEWRDD->( __dbZap() )'
? '? "RecCount:", NEWRDD->( RecCount() )'
? ""
? "RecCount:", NEWRDD->( RecCount() )
NEWRDD->( __dbZap() )
? "RecCount:", NEWRDD->( RecCount() )
? "Press any key to continue..."
InKey( 0 )
CLS
? 'NEWRDD->( dbCloseArea() )'
? 'SORT ON FIRST /DC, AGE /D TO NEWRDD'
? 'dbUseArea( .T., "DBF", "NewRdd", "NEWRDD", .F., .F. )'
? '? "RecCount:", NEWRDD->( RecCount() )'
? 'for nI := 1 to 8'
? ' ? NEWRDD->FIRST, NEWRDD->AGE'
? ' NEWRDD->( dbSkip() )'
? 'next'
? '? "..."'
? 'NEWRDD->( dbGoBottom() )'
? 'NEWRDD->( dbSkip( -8 ) )'
? 'for nI := 1 to 8'
? ' ? NEWRDD->FIRST, NEWRDD->AGE'
? ' NEWRDD->( dbSkip() )'
? 'next'
? "Press any key to continue..."
InKey( 0 )
CLS
NEWRDD->( dbCloseArea() )
Select( "TESTDBF" )
SORT ON FIRST /DC, AGE /D TO NEWRDD
dbUseArea( .T., "DBF", "NewRdd", "NEWRDD", .F., .F. )
? "RecCount:", NEWRDD->( RecCount() )
for nI := 1 to 8
? NEWRDD->FIRST, NEWRDD->AGE
NEWRDD->( dbSkip() )
next
? "..."
NEWRDD->( dbGoBottom() )
NEWRDD->( dbSkip( -8 ) )
for nI := 1 to 8
? NEWRDD->FIRST, NEWRDD->AGE
NEWRDD->( dbSkip() )
next
return nil