/* d4data.h (c)Copyright Sequiter Software Inc., 1988-1996. All rights reserved. */ extern char v4buffer[257] ; typedef int S4CALL S4CMP_FUNCTION( S4CMP_PARM, S4CMP_PARM, size_t) ; /* typedef required to work around VC++ 1.50 bug in definition of Sort4.assignCmp() */ typedef int (S4CALL *S4CMP_FUNCTION_PTR)( S4CMP_PARM, S4CMP_PARM, size_t ) ; #ifdef __SC__ typedef void _cdecl C4DTOK( char S4PTR *, const double ) ; typedef void _cdecl C4STOK( char S4PTR *, const char S4PTR *, const int ) ; #else typedef void C4DTOK( char S4PTR *, const double ) ; typedef void C4STOK( char S4PTR *, const char S4PTR *, const int ) ; #endif #ifdef S4FOX typedef unsigned char translatedChars[256] ; typedef unsigned char compressedChars[2] ; #endif struct DATA4St ; struct FIELD4St ; struct DATA4FILESt ; #ifdef S4COMPILE_TEST #ifndef S4OFF_MEMO struct F4MEMOSt ; #endif #ifndef S4OFF_INDEX struct INDEX4St ; struct TAG4St ; struct TAG4FILESt ; #ifndef N4OTHER struct INDEX4FILESt ; #endif #ifdef S4FOX struct T4VFPSt ; #endif #endif #ifndef S4OFF_TRAN struct S4CLASS TRAN4FILESt ; struct S4CLASS CODE4TRANSSt ; #endif #else struct F4MEMOSt ; struct INDEX4St ; struct TAG4St ; struct TAG4FILESt ; struct S4CLASS TRAN4FILESt ; struct S4CLASS CODE4TRANSSt ; #ifndef N4OTHER struct INDEX4FILESt ; #endif #ifdef S4FOX struct T4VFPSt ; #endif #endif #ifdef S4CBPP class S4CLASS FILE4 ; #else struct FILE4St ; #endif #ifdef S4CBPP class S4CLASS CODE4 ; #else struct CODE4St ; #endif #ifdef S4SERVER struct SERVER4CLIENTSt ; #endif #ifndef S4OFF_COMMUNICATIONS struct SOCKET4St ; #ifdef S4CLIENT struct CONNECTION4St ; #endif #endif #ifdef S4CBPP class S4CLASS Code4 ; typedef int ERROR4FUNCTION( Code4 S4PTR *, short int, long ) ; typedef int ERROR4DESCRIBE_FUNCTION( Code4 S4PTR *, short int, long, const char S4PTR *, const char S4PTR *, const char S4PTR * ) ; typedef int ERROR4STACK( Code4 S4PTR *, short int, long ) ; typedef int ERROR4SET( Code4 S4PTR *, short int ) ; #else typedef int ERROR4FUNCTION( struct CODE4St S4PTR *, short int, long ) ; typedef int ERROR4DESCRIBE_FUNCTION( struct CODE4St S4PTR *, short int, long, const char S4PTR *, const char S4PTR *, const char S4PTR * ) ; typedef int ERROR4STACK( struct CODE4St S4PTR *, short int, long ) ; typedef int ERROR4SET( struct CODE4St S4PTR *, short int ) ; #endif #ifdef __cplusplus #ifdef S4WINDOWS #ifdef S4WIN32 #ifdef _MSC_VER typedef struct _declspec(dllexport) l4linkSt #else typedef struct _export l4linkSt #endif #else typedef struct _export l4linkSt #endif #else typedef struct l4linkSt #endif #else typedef struct l4linkSt #endif { struct l4linkSt S4PTR *n, S4PTR *p ; } LINK4 ; #ifdef S4CBPP class S4CLASS LIST4 { public: #else typedef struct { #endif S4CONV( LINK4 S4PTR *lastNode, LINK4 S4PTR *last_node ) ; /* the last Link */ LINK4 S4PTR *selected ; S4CONV( unsigned short int nLink, unsigned short int n_link ) ; /* The number of links in the list */ #ifdef S4CBPP } ; #else } LIST4 ; #endif typedef struct { LINK4 link ; double data ; /* Make sure it is on a boundry good for at least a double */ } Y4CHUNK ; typedef struct { LINK4 link ; LIST4 chunks ; /* Chunks of pieces */ LIST4 pieces ; /* A list of available memory pieces */ int unitStart; /* The starting # of entries for the Memory Type */ unsigned unitSize ; /* The size of each allocated piece */ int unitExpand ; /* The expansion # of entries for the Memory Type */ int nRepeat ; /* The number of times entry returned for 'new' */ /* If nRepeat is '-1', it is a temporary entry. */ int nUsed ; /* The number of entries used */ #ifdef S4DOS /* no memory sharing under DOS, so can use a CODE4 for limited memory */ #ifdef S4CBPP CODE4 S4PTR *codeBase ; #else struct CODE4St *codeBase ; #endif #endif } MEM4 ; #ifndef S4OFF_OPTIMIZE typedef struct { LIST4 list ; unsigned short int minLink ; unsigned long maxTime ; unsigned long minTime ; char currentPrioCount ; /* should this list be scanned for avail blocks? */ } OPT4LIST ; typedef struct { LINK4 link ; LINK4 lruLink ; char changed ; unsigned len ; void S4PTR *data ; unsigned long readTime ; unsigned long accessTime ; double hitCount ; OPT4LIST *optList ; /* the optimization list the file resides on */ /* these next 2 elements must match the OPT4CMP structure in o4opt.h */ #ifdef S4CBPP FILE4 S4PTR *file ; #else struct FILE4St *file ; #endif long pos ; } OPT4BLOCK ; #ifdef S4CBPP typedef struct S4CLASS #else typedef struct #endif { char blockPower ; char forceCurrent ; /* switch forces a read of current contents */ char numShift ; unsigned char oldMode ; unsigned char doUpdate ; unsigned char checkCount ; unsigned char dummyChar ; unsigned int minLink ; int numBuffers ; unsigned maxBlocks ; unsigned writeBlockCount ; /* is the buffer full? */ unsigned long blockSize ; unsigned long bufferSize ; unsigned long hashTrail ; /* where last optimized file ended */ unsigned long mask ; unsigned long numBlocks ; unsigned long numLists ; unsigned long readStartPos ; unsigned long writeStartPos ; unsigned long writeCurPos ; unsigned long readTimeCount ; unsigned long accessTimeCount ; unsigned int minAccessTimeVariation ; /* access times of less than this value will not be updated == 1% of blocks */ char S4PTR *readBuffer ; char S4PTR *writeBuffer ; char S4PTR *writeBufferActual ; /* writeBuffer just points to the actual buffer */ void S4PTR* S4PTR* buffers ; OPT4BLOCK S4PTR *blocks ; LIST4 S4PTR *lists ; OPT4LIST S4PTR *prio[OPT4NUM_LISTS] ; LIST4 avail ; OPT4LIST dbfLo ; OPT4LIST dbfHi ; OPT4LIST indexLo ; OPT4LIST indexHi ; OPT4LIST other ; LIST4 optFiles ; #ifdef S4WRITE_DELAY LIST4 delayAvail ; /* extra blocks to allow efficient delay-writing */ char S4PTR *delayWriteBuffer ; char S4PTR *delayLargeBuffer ; CRITICAL_SECTION critical4optWrite ; int delayLargeBufferAvail ; int writeBufferActualAvail ; #endif #ifdef S4ADVANCE_READ char S4PTR *advanceLargeBuffer ; CRITICAL_SECTION critical4optRead ; #ifdef S4CBPP FILE4 S4PTR *advanceReadFile ; #else struct FILE4St S4PTR *advanceReadFile ; #endif int advanceLargeBufferAvail ; long advanceLargePos ; unsigned int advanceLargeLen ; #endif #ifdef S4CBPP FILE4 S4PTR *writeFile ; FILE4 S4PTR *readFile ; #else struct FILE4St S4PTR *writeFile ; /* which file has the write buffer? */ struct FILE4St S4PTR *readFile ; /* which file has the write buffer? */ #endif } OPT4 ; #endif /* S4OFF_OPTIMIZE */ #ifdef S4CBPP class S4CLASS FILE4 { public: #else typedef struct FILE4St { #endif #ifndef S4OFF_OPTIMIZE LINK4 link ; /* set to 0 if file not optimized */ #else LINK4 space2 ; #endif /* accessMode and isReadOnly both on indicate 'r' attribute on file */ /* isReadOnly only on indicates user access is limited to read only */ /* if accessMode, will do full bufferring, if isReadOnly, will avoid */ /* performing any disk writes */ char doAllocFree ; char isTemp ; /* True if it is a temporary file */ int hand ; int isReadOnly ; /* True if file is read only */ char S4PTR *nameBuf ; S4CONST char S4PTR *name ; #ifdef S4CBPP CODE4 S4PTR *codeBase ; #else S4CONV( struct CODE4St *codeBase, struct CODE4St *code_base ) ; #endif #ifndef S4OFF_MULTI int lowAccessMode ; /* open access level */ #else int space25 ; #endif #ifndef S4OFF_OPTIMIZE char fileCreated ; /* false if the file has not been created yet - i.e. if a memory-only file */ char writeBuffer ; /* buffer writes where possible */ long hashInit ; long len ; /* internal if optimized */ char type ; /* dbf, index, other */ char bufferWrites ; /* are writes being bufferred? */ int doBuffer ; /* is the file bufferring on? */ long expectedReadSize ; /* record length */ double hitCountAdd ; const void *ownerPtr ; /* points to DATA4/INDEX4 which holds file handle */ #else char space1 ; long space3 ; long space4 ; char space5 ; char space6 ; int space7 ; long space11 ; double space12 ; const void *space13 ; #endif #ifdef S4MULTI_THREAD CRITICAL_SECTION critical4file ; #endif #ifdef S4WRITE_DELAY LIST4 delayWriteFileList ; #endif #ifdef S4READ_ADVANCE LIST4 advanceReadFileList ; char *advanceReadBuf ; /* a buffer for advanced-reading */ int advanceReadBufStatus ; /* the status of the advance-read buffer */ /* AR4EMPTY, AR4IN_USE, AR4FULL */ long advanceReadBufPos ; unsigned advanceReadBufLen ; #endif #ifdef E4ANALYZE_ALL char dupName[L_tmpnam] ; int hasDup ; int inUse ; #else char *space8 ; int space9 ; int space10 ; #endif #ifdef S4CBPP } ; #else } FILE4 ; #endif #ifdef S4WRITE_DELAY typedef void S4PTR * S4DELAY_PARM ; typedef void S4CALL S4DELAY_FUNCTION( S4DELAY_PARM ) ; typedef struct { LINK4 link ; LINK4 fileLink ; /* for the given file, all links on delay-chain */ FILE4 *file ; const char *data ; long pos ; unsigned int len ; int usageFlag ; int status ; S4DELAY_FUNCTION *completionRoutine ; void *completionData ; /* routine-specific data for use in completion routine */ } FILE4WRITE_DELAY ; #endif #ifdef S4READ_ADVANCE typedef void S4PTR * S4ADVANCE_PARM ; typedef void S4CALL S4ADVANCE_FUNCTION( S4ADVANCE_PARM ) ; typedef struct { LINK4 link ; LINK4 fileLink ; /* for the given file, all links on delay-chain */ FILE4 *file ; char *data ; long pos ; unsigned int len ; int usageFlag ; unsigned int status ; S4ADVANCE_FUNCTION *completionRoutine ; void *completionData ; /* routine-specific data for use in completion routine */ } FILE4ADVANCE_READ ; #endif typedef struct S4CLASS { /* structure must remain fixed positions */ long transId ; long clientId ; long clientDataId ; long serverDataId ; short int type ; unsigned long dataLen ; time_t time ; } LOG4HEADER ; typedef struct S4CLASS TRAN4St { /* transaction capabilities for a client */ struct CODE4TRANSSt *c4trans ; LIST4 *dataList ; /* A list of open data files. */ LIST4 localDataList ; char dateFormat[LEN4DATE_FORMAT]; /* Longest is September 15, 1990 */ #ifndef S4OFF_WRITE int currentTranStatus ; /* is there a current transaction? */ #else int space1 ; #endif #ifndef S4OFF_MULTI int unlockAuto ; /* automatic unlocking on or off? */ int savedUnlockAuto ; LIST4 locks ; /* list of Lock4's */ #else int space2 ; int space3 ; LIST4 space4 ; #endif #ifndef S4OFF_WRITE /* given transaction details */ long transId ; long pos ; /* used during examination processing */ LOG4HEADER header ; unsigned dataPos ; /* char *charId ;*/ #else long space6 ; long space7 ; /* used during examination processing */ LOG4HEADER space8 ; char *space9 ; /* used during transaction writing and examination processing */ unsigned space10 ; unsigned space11 ; char *space12 ; #endif #ifdef S4STAND_ALONE int userIdNo ; /* used to determine the id of user */ #endif LIST4 closedDataFiles ; /* during a transaction */ #ifdef S4CLIENT int dataIdCount ; /* client keeps an id on each data4 */ #else char userId[LEN4USERID+1] ; char netId[LEN4NETID+1] ; #endif } TRAN4 ; typedef struct S4CLASS CODE4TRANSSt { #ifdef S4CBPP CODE4 S4PTR *c4 ; #else struct CODE4St *c4 ; #endif #ifndef S4OFF_TRAN int enabled ; #ifndef S4OFF_WRITE #ifndef S4CLIENT struct TRAN4FILESt *transFile ; #else struct TRAN4FILESt *space1 ; #endif #else struct TRAN4FILESt *space1 ; #endif #else int space2 ; struct TRAN4FILESt *space1 ; #endif #ifndef S4SERVER TRAN4 trans ; #else TRAN4 space3 ; #endif } CODE4TRANS ; typedef struct TRAN4FILESt { long transId ; long validState ; /* true/false switch */ unsigned long fileLocks ; /* bit encoded, bit i == byte TRAN4LOCK_BASE+i locked */ FILE4 file ; int status ; CODE4TRANS *c4trans ; } TRAN4FILE ; #ifndef S4OFF_CATALOG typedef struct CATALOG4St { struct DATA4St *data ; int valid ; int catalogAdd ; int catalogStatus ; struct FIELD4St *ownerFld, *aliasFld, *pathNameFld, *typeFld, *readOnlyFld, *indexOpenFld, *createFld, *openModeFld, *logFld ; struct TAG4St *aliasTag, *pathTag ; } CATALOG4 ; #endif #ifdef S4CBPP class S4CLASS CODE4 { public: #else typedef struct CODE4St { #endif /* documented members... (except ifdef'ed ones) */ S4CONV( int autoOpen, int auto_open ) ; /* Automatic production index file opening */ int createTemp ; /* create files as temporary ? */ S4CONV( int errCreate, int create_error ) ; /* Do 'file4create' error ? */ S4CONV( int errDefaultUnique, int default_unique_error ) ; /* e4unique, r4unique, r4uniqueContinue */ S4CONV( int errExpr, int expr_error ) ; S4CONV( int errFieldName, int field_name_error ) ; S4CONV( int errOff, int off_error ) ; /* Show error messages? */ S4CONV( int errOpen, int open_error ) ; /* Do 'file4open' error ? */ S4CONV( int errorCode, int error_code ) ; #ifdef S4WIN32 /* documented member */ void S4PTR *hWnd; /* For use under Microsoft Windows */ #else unsigned hWnd ; /* For use under Microsoft Windows */ #endif int log ; S4CONV( int memExpandData, int mem_expand_data ) ; /* Expanding data allocation */ S4CONV( unsigned memSizeBuffer, unsigned mem_size_buffer ) ;/* Pack, Zap */ S4CONV( unsigned memSizeSortBuffer, unsigned mem_size_sort_buffer ) ; /* The default file buffer size when sorting */ S4CONV( unsigned memSizeSortPool, unsigned mem_size_sort_pool ) ; /* The default pool size for sorting */ S4CONV( unsigned memStartData, unsigned mem_start_data ) ; /* Initial data allocation */ S4CONV( int readOnly, int read_only ) ; int safety ; /* File create with safety ? */ long timeout ; short int compatibility ; /* FoxPro compatibility with... 25, 26, 30 */ /* undocumented members... */ int s4cr2 ; /* used by CodeReporter */ int initialized ; /* only allow a single initUndo */ long errorCode2 ; int numericStrLen ; /* the default length for clipper index files */ int decimals ; /* the default # decimals for clipper index files */ int memExpandDataFile ; unsigned memStartDataFile ; unsigned exprBufLen ; /* for exprWorkBuf */ unsigned storedKeyLen ; /* for storedKeu */ unsigned bufLen ; /* for fieldBuffer */ char S4PTR *exprWorkBuf ; /* used by expression parsing */ char S4PTR *storedKey ; /* used by the expr4key() function */ char S4PTR *fieldBuffer ; char S4PTR *version ; char indexExtension[4] ; MEM4 S4PTR *bitmapMemory ; MEM4 S4PTR *dataMemory ; S4CONV( MEM4 S4PTR *calcMemory, MEM4 S4PTR *calc_memory ) ; MEM4 S4PTR *data4fileMemory ; MEM4 S4PTR *relateDataListMemory ; /* for R4DATA_LIST */ MEM4 S4PTR *relateListMemory ; /* for RELATE4LIST */ MEM4 S4PTR *relateMemory ; MEM4 S4PTR *relationMemory ; MEM4 S4PTR *dataListMemory ; /* for DATA4LIST */ LIST4 availMessages ; /* list of available message buffers */ LIST4 dataFileList ; /* A list of open data files. */ FILE4 *errorLog ; /* log file for error messages */ int collatingSequence ; /* the collating sequence to use when creating a VFP tag */ int codePage ; /* the codepage to use when creating a database file */ #ifdef S4COMPILE_TEST #ifndef S4OFF_MULTI S4CONV( int accessMode, int exclusive ) ; /* how should files be opened? */ int memExpandLock ; /* Expanding lock memory allocation */ unsigned memStartLock ; /* Initial lock memory allocation record locks */ int lockAttemptsSingle ; /* How many times to attempt each lock in a group lock */ unsigned int lockDelay ; int fileFlush ; /* force hard file flush during write */ S4CONV( int readLock, int read_lock ) ; /* Do lock when reading database ? */ S4CONV( int lockAttempts, int lock_attempts ) ; /* How many times to attempt locks. */ MEM4 S4PTR *lockMemory ; MEM4 S4PTR *lockLinkMemory ; #endif #ifndef S4OFF_OPTIMIZE S4CONV( int optimizeWrite, int optimize_write ) ; S4CONV( unsigned memSizeBlock, unsigned mem_size_block ) ; /* Block size (bytes) for memo and index files */ int optimize ; /* should files be automatically bufferred? */ int memMaxPercent ; S4CONV( long memStartMax, long mem_start_max ) ; #endif #ifndef S4OFF_INDEX #ifdef S4OFF_OPTIMIZE S4CONV( unsigned memSizeBlock, unsigned mem_size_block ) ; /* Block size (bytes) for memo and index files */ #endif S4CONV( int errTagName, int tag_name_error ) ; S4CONV( int memExpandBlock, int mem_expand_block ) ; /* Expanding block memory allocation */ S4CONV( int memExpandIndex, int mem_expand_index ) ; /* Expanding index allocation */ S4CONV( int memExpandTag, int mem_expand_tag ) ; /* Expanding tag allocation */ S4CONV( unsigned memStartBlock, unsigned mem_start_block ) ; /* Initial block memory allocation for index files */ S4CONV( unsigned memStartIndex, unsigned mem_start_index ) ; /* Initial index file allocation */ S4CONV( unsigned memStartTag, unsigned mem_start_tag ) ; /* Initial tag allocation */ int memExpandTagFile ; unsigned memStartTagFile ; MEM4 S4PTR *indexMemory ; MEM4 S4PTR *index4fileMemory ; MEM4 S4PTR *tagMemory ; MEM4 S4PTR *tagFileMemory ; #endif #ifndef S4OFF_MEMO S4CONV( unsigned memSizeMemo, unsigned mem_size_memo ) ; S4CONV( unsigned memSizeMemoExpr, unsigned mem_size_memo_expr ) ; #endif #ifndef S4OFF_TRAN int doTrans ; /* Maintain a transaction file? */ #endif #else S4CONV( int accessMode, int exclusive ) ; /* how should files be opened? */ int memExpandLock ; /* Expanding lock memory allocation */ unsigned memStartLock ; /* Initial lock memory allocation record locks */ int lockAttemptsSingle ; /* How many times to attempt each lock in a group lock */ unsigned int lockDelay ; int fileFlush ; /* force hard file flush during write */ S4CONV( int readLock, int read_lock ) ; /* Do lock when reading database ? */ S4CONV( int lockAttempts, int lock_attempts ) ; /* How many times to attempt locks. */ MEM4 S4PTR *lockMemory ; MEM4 S4PTR *lockLinkMemory ; S4CONV( int optimizeWrite, int optimize_write ) ; int optimize ; /* should files be automatically bufferred? */ int memMaxPercent ; S4CONV( long memStartMax, long mem_start_max ) ; S4CONV( unsigned memSizeBlock, unsigned mem_size_block ) ; /* Block size (bytes) for memo and index files */ S4CONV( int errTagName, int tag_name_error ) ; S4CONV( int memExpandBlock, int mem_expand_block ) ; /* Expanding block memory allocation */ S4CONV( int memExpandIndex, int mem_expand_index ) ; /* Expanding index allocation */ S4CONV( int memExpandTag, int mem_expand_tag ) ; /* Expanding tag allocation */ S4CONV( unsigned memStartBlock, unsigned mem_start_block ) ; /* Initial block memory allocation for index files */ S4CONV( unsigned memStartIndex, unsigned mem_start_index ) ; /* Initial index file allocation */ S4CONV( unsigned memStartTag, unsigned mem_start_tag ) ; /* Initial tag allocation */ int memExpandTagFile ; unsigned memStartTagFile ; MEM4 S4PTR *indexMemory ; MEM4 S4PTR *index4fileMemory ; MEM4 S4PTR *tagMemory ; MEM4 S4PTR *tagFileMemory ; S4CONV( unsigned memSizeMemo, unsigned mem_size_memo ) ; S4CONV( unsigned memSizeMemoExpr, unsigned mem_size_memo_expr ) ; int doTrans ; /* Maintain a transaction file? */ #endif #ifdef E4ANALYZE int debugInt ; /* used to check structure integrity (set to 0x5281) */ #else #ifdef S4VBASIC int debugInt ; #else int space1 ; #endif #endif #ifndef N4OTHER unsigned memStartIndexFile ; /* Initial index file allocation */ int memExpandIndexFile ; /* Expanding index file allocation */ #else unsigned space4 ; int space5 ; #endif #ifndef S4DOS #ifdef S4WIN32 void S4PTR *hInst ; void S4PTR *hInstLocal ; #else unsigned hInst ; unsigned hInstLocal ; #endif char protocol[LEN4PROTOCOL+1] ; #else #ifdef S4WIN32 void S4PTR *space6 ; void S4PTR *space7 ; #else unsigned space6 ; unsigned space7 ; #endif char space8[LEN4PROTOCOL+1] ; #endif #ifndef S4OFF_WRITE char *transFileName ; #else char *space47 ; #endif #ifndef S4OFF_CATALOG #ifndef S4CLIENT CATALOG4 S4PTR *catalog ; #else void S4PTR *space48 ; int space49 ; int space50 ; #endif /* S4CLIENT */ #else void S4PTR *space48 ; int space49 ; int space50 ; #endif /* S4OFF_CATALOG */ #ifndef S4OFF_COMMUNICATIONS MEM4 S4PTR *messageLinkMemory ; MEM4 S4PTR *connectionMemory ; MEM4 S4PTR *connectionNetMemory ; LIST4 availDataMessages ; #ifdef S4DISTRIBUTED LIST4 servers ; /* list of connected servers */ #else LIST4 space51 ; #endif struct SOCKET4St S4PTR *defaultServer ; /* LIST4 passwordList ; */ #else MEM4 S4PTR *space52 ; MEM4 S4PTR *space52b ; MEM4 S4PTR *space52c ; LIST4 space53 ; LIST4 space55 ; void S4PTR *space56 ; #endif #ifndef S4OFF_TRAN char *tranData ; /* buffer used to hold transaction entries */ unsigned int tranDataLen ; /* length of transaction entry buffer */ #else char *space57 ; unsigned int space58 ; #endif #ifdef S4MNDX char *memoUseBuffer ; #else char S4PTR *space16a ; #endif #ifndef S4OFF_OPTIMIZE OPT4 opt ; int hasOpt, doOpt, hadOpt ; #endif #ifdef S4STAND_ALONE #ifndef S4OFF_TRAN #ifndef S4OFF_WRITE TRAN4FILE transFile ; int logOpen ; #endif #endif #endif #ifdef S4WRITE_DELAY int delayWritesEnabled ; CRITICAL_SECTION critical4delayWriteList ; LIST4 delayWriteList ; MEM4 S4PTR *delayWriteMemory ; long uninitializeDelayWrite ; /* request to uninitialize delay-writes */ HANDLE initUndoDelayWrite ; /* event for delay-write thread to notify main thread that uninitialization is complete */ HANDLE pendingWriteEvent ; /* event to notify delay-write thread that there is an action to perform */ #endif #ifdef S4READ_ADVANCE int advanceReadsEnabled ; CRITICAL_SECTION critical4advanceReadList ; LIST4 advanceReadList ; MEM4 S4PTR *advanceReadMemory ; HANDLE initUndoAdvanceRead ; long uninitializeAdvanceRead ; HANDLE pendingReadEvent ; #endif #ifdef S4SERVER int singleClient ; int displayErrors ; int readOnlyRequest ; unsigned memStartClient ; unsigned memExpandClient ; struct SERVER4CLIENTSt S4PTR *catalogClient ; MEM4 S4PTR *clientMemory ; struct SERVER4St S4PTR *server ; struct SERVER4CLIENTSt S4PTR *currentClient ; #ifdef N4OTHER int doRemove ; #else int doRemoveSpace ; #endif #ifdef S4DEBUG_LOG char S4PTR *logFileName ; FILE4 logFile ; int log ; #endif #ifndef S4OFF_SECURITY int idhandling ; #endif #else /* singleOpen can take 0,1, or 2, but only 0 and 1 are documented -OPEN4 modes */ int singleOpen ; /* only one instance of a DATA4 allowed (as opposed to exclusive which is access for client) */ S4CONV( int errGo, int go_error ) ; /* Do 'd4go' error ? */ S4CONV( int errRelate, int relate_error ) ; /* do relate4terminate error when no match and relate4terminate selected */ S4CONV( int errSkip, int skip_error ) ; /* Do 'DataIndex::skip' error ? */ int lockEnforce ; /* are pre-locks required for record modifications? */ int doRemove ; const char *lockedNetId ; const char *lockedUserId ; const char *lockedFileName ; long lockedLockItem ; CODE4TRANS c4trans ; S4CONV( MEM4 S4PTR *totalMemory, MEM4 S4PTR *total_memory ) ; S4CONV( LIST4 calcList, LIST4 calc_list ) ; S4CONV( LIST4 totalList, LIST4 total_list ) ; S4CONV( int numReports, int num_reports ) ; short pageno ; long clientDataCount ; #endif #ifdef S4CLIENT int indexFormat ; int openForCreate ; #else int doIndexVerify ; /* for internal purposes only at this point */ struct RELATION4St S4PTR *currentRelation ; char savedKey[I4MAX_KEY_SIZE + 2 * sizeof(long)] ; /* used by i4remove.c, i4tag.c and i4addtag.c, i4versionCheck, t4versionCheck */ #endif #ifdef S4OPTIMIZE_STATS struct DATA4St *statusDbf ; struct FIELD4St *typeFld, *fileNameFld, *offsetFld, *lengthFld ; #endif #ifdef S4CBPP } ; #else } CODE4 ; #endif #ifndef S4OFF_MEMO typedef struct { FILE4 file ; short blockSize ; /* Bytes */ struct DATA4FILESt S4PTR *data ; #ifndef S4OFF_MULTI int fileLock ; /* True if file is locked */ #else int space1 ; #endif } MEMO4FILE ; #endif /* S4OFF_MEMO */ #ifdef S4CBPP class S4CLASS FILE4SEQ_READ { public: #else typedef struct { #endif FILE4 S4PTR *file ; long pos ; /* The next position to read from */ char S4PTR *buffer ; unsigned nextReadLen ; unsigned total ; /* Total buffer length */ unsigned working ; /* Temporary working buffer length (to help align write) */ unsigned avail ; /* # of bytes currently available */ #ifdef S4ADVANCE_READ int doAdvance ; char S4PTR *buf1 ; char S4PTR *buf2 ; unsigned int buf1status, buf2status ; int buf1avail ; int buf2avail ; #endif #ifdef S4CBPP } ; #else } FILE4SEQ_READ ; #endif #ifdef S4CBPP class S4CLASS FILE4SEQ_WRITE { public: #else typedef struct { #endif FILE4 S4PTR *file ; long pos ; /* The next position to read from */ char S4PTR *buffer ; unsigned total ; /* Total buffer length */ unsigned working ; /* Temporary working buffer length (to help align write) */ unsigned avail ; /* # of bytes left in working buffer */ #ifdef S4WRITE_DELAY char S4PTR *buf1 ; char S4PTR *buf2 ; unsigned buf1len ; unsigned buf2len ; int buf1avail ; int buf2avail ; #endif #ifdef S4CBPP } ; #else } FILE4SEQ_WRITE ; #endif typedef struct /* Data File Format */ { char name[11] ; char type ; S4LONG offset ; /* field's offset into record buffer (for vfp 3.0) */ unsigned char len ; unsigned char dec ; #ifdef S4CLIENT_OR_FOX char nullBinary ; /* for FOX 3.0 0x02 == allows null fields, 0x04 == binary field */ char filler2[12] ; #else char filler2[13] ; #endif char hasTag ; } FIELD4IMAGE ; typedef struct { unsigned short int lo[4] ; /* signed short int hi ; significant bit in this field */ } CURRENCY4 ; typedef struct FIELD4St /* Internal Structure and Field Routines. */ { char name[11] ; unsigned short int len ; unsigned short int dec ; short int type ; short int offset ; struct DATA4St S4PTR *data ; #ifdef S4CLIENT_OR_FOX char null ; unsigned short int nullBit ; /* bit which indicates whether field contents currently are null */ char binary ; #endif #ifndef S4OFF_MEMO struct F4MEMOSt S4PTR *memo ; #endif #ifdef S4VBASIC short int debugInt ; /* used to check structure integrity (set to 0x5281) */ #else short int space1 ; #endif } FIELD4 ; #ifndef S4OFF_MEMO typedef struct F4MEMOSt { S4CONV( int isChanged, int is_changed ) ; int status ; /* 0 - Current contents, 1 - Unknown */ char S4PTR *contents ; unsigned int len ; S4CONV( unsigned int lenMax, unsigned int len_max ) ; FIELD4 S4PTR *field ; } F4MEMO ; #endif typedef struct /* Creating Data File */ { char S4PTR *name ; short int type ; unsigned short int len ; unsigned short int dec ; unsigned short int nulls ; /* are nulls allowed? */ } FIELD4INFO ; #ifdef S4SERVER typedef struct { char append ; char delet ; char update ; char index ; char alter ; char refer ; char compress ; char read ; char open ; /* virtual field */ } AUTHORIZE4 ; #endif typedef struct { /* Database Header Information */ char version ; char yy ; /* Last Update */ char mm ; char dd ; S4LONG numRecs ; unsigned short headerLen; /* Header Length, Indicates start of data */ unsigned short recordLen; char zero[16] ; char hasMdxMemo ; /* 0x01 for has mdx, in fox 0x02 for has memo */ char codePage ; char zero2[2] ; } DATA4HEADER_FULL ; typedef struct DATA4FILESt { LINK4 link ; S4CONV( unsigned int recWidth, unsigned int record_width ) ; unsigned short int infoLen ; int nFields ; /* The number of data fields in the database */ int nFieldsMemo ; /* The number of memo fields in the database */ long minCount ; long userCount ; /* number of DATA4's that are using this DATA4FILE */ CODE4 S4PTR *c4 ; char S4PTR *info ; #ifndef S4CLIENT char S4PTR *record ; #else char S4PTR *space1 ; #endif #ifndef S4OFF_WRITE int doDate ; /* does the date need to be updated on unlock/close? */ #endif /**** the next set of lines must remain in order as they are a file view ****/ /* Database Header Information */ char version ; #ifndef S4CLIENT char yy ; /* Last Update */ char mm ; char dd ; #else char space3 ; char space4 ; char space5 ; #endif S4LONG numRecs ; unsigned short headerLen ; /* Header Length, Indicates start of data */ /**** the previous set of lines must remain in order as they are a file view ****/ #ifdef S4SERVER struct SERVER4CLIENTSt S4PTR *singleClient ; /* only one client has access to the file */ time_t nullTime ; /* The last time the datafile had 0 handles, if any */ #else void S4PTR *space6 ; time_t space7 ; #endif #ifdef S4CLIENT struct DATA4St S4PTR *fileLock ; struct DATA4St S4PTR *appendLock ; struct DATA4St S4PTR *lockTest ; #else struct DATA4St S4PTR *space9 ; struct DATA4St S4PTR *space10 ; #endif #ifdef S4CLIENT char accessName[LEN4PATH+1] ; LIST4 lockedRecords ; struct CONNECTION4St S4PTR *connection ; long serverId ; int accessMode ; #endif #ifndef S4CLIENT FILE4 file ; char hasMdxMemo ; /* Has an MDX and/or a memo file attached to it */ int fileChanged ; /* True if the file has been changed since */ /* the header has been updated. */ short blockSize ; #ifndef S4OFF_MEMO MEMO4FILE memoFile ; /* Memo file handle */ #endif int tranStatus ; /* is this data4file using transactions? */ char valid ; /* if valid, a close on a datafile will not low-close it */ #ifndef S4OFF_MULTI #ifdef S4SERVER struct DATA4St *exclusiveOpen ; #endif LIST4 lockedRecords ; /* list of LOCK4's */ long fileServerLock ; /* which data holds file lock */ long fileClientLock ; /* which data holds file lock */ long appendClientLock ; /* True if the file is locked for appending */ long appendServerLock ; /* True if the file is locked for appending */ long tempServerLock ; /* for lock registering */ long tempClientLock ; /* for lock registering */ #endif #endif /* S4CLIENT */ #ifndef S4OFF_OPTIMIZE int hiPrio ; /* used to determine which priority lru list to put block data on and advance group-reads */ /* '1' if d4seek, -1 if d4skip */ #endif #ifdef S4STAND_ALONE char openMdx ; /* does the datafile have an open production file attatched to it */ #endif #ifdef N4OTHER LIST4 tagfiles ; unsigned long indexLocked ; #else LIST4 indexes ; /* list of INDEX4FILE;s */ unsigned long space99 ; #endif } DATA4FILE ; typedef struct DATA4St { LINK4 link ; #ifdef S4SERVER int accessMode ; /* in what mode did the client open the data file */ #endif int bofFlag ; int eofFlag ; int readOnly ; S4CONV( int recordChanged, int record_changed ) ; /* T/F */ S4LONG count ; /* a fairly current record count on the database */ S4CONV( S4LONG recNum, S4LONG rec_num ) ; /* Record number; -1 unknown; 0 for append */ S4LONG recNumOld ; /* Record number, -1 none present; 0 for append */ char S4PTR *groupRecordAlloc ; /* if the current and old record allocations allocated at the same time? */ char S4PTR *record ; /* Data allocated with 'u4alloc' */ char S4PTR *recordOld ; /* Data allocated with 'u4alloc' */ /* Extra byte added for temporary CTRL_Z */ char alias[LEN4DATA_ALIAS+1] ; S4CONV( CODE4 S4PTR *codeBase, CODE4 S4PTR *code_base ) ; TRAN4 S4PTR *trans ; FIELD4 S4PTR *fields ; /* An array of field pointers */ LIST4 indexes ; /* list of INDEX4's */ struct TAG4St *tagSelected ; int codePage ; DATA4FILE *dataFile ; #ifndef S4OFF_MEMO S4CONV( F4MEMO S4PTR *fieldsMemo, F4MEMO S4PTR *fields_memo ) ; /* A list of fields to be flushed */ #ifndef S4OFF_MULTI char memoValidated ; /* Can we be sure memo id #'s are up to date. */ #endif #endif #ifndef S4OFF_TRAN #ifndef S4CLIENT int logVal ; #endif #endif #ifdef S4VBASIC int debugInt ; /* used to check structure integrity (set to 0x5281) */ #endif #ifdef S4SERVER long clientId ; long serverId ; #ifndef S4OFF_SECURITY int owner ; /* set to true if the DATA4 is owner of the table */ AUTHORIZE4 authorize ; #endif #else long clientId ; #endif } DATA4 ; typedef void S4OPERATOR(void) ; /* NOTE: IT IS CRITICAL THAT THE FOLLOWING STRUCTURE'S MEMBERS ARE NOT RE-ORDERED. */ typedef struct E4INFOSt { short int fieldNo ; /* field no in data structure -- since FIELD4 may be transient */ FIELD4 S4PTR *fieldPtr ; int localData ; /* true if the fieldPtr points to a local data4 */ char S4PTR *p1 ; int len ; /* Length */ int numEntries ; /* Number of entries in sub-expression */ int numParms ; int resultPos ; /* The position in the result array for result. */ int i1 ; /* Could be constant position. 'i1' and 'resultPos' and 'functionI' and 'function' must be at last position due to memcmp() in e4isTag() */ int functionI ; S4OPERATOR S4PTR *function ; } E4INFO ; typedef struct e4exprSt { E4INFO S4PTR *info ; int infoN ; S4CONST char S4PTR *source ; char S4PTR *constants ; int len, type ; struct TAG4FILESt S4PTR *tagPtr ; #ifdef S4FOX struct T4VFPSt S4PTR *vfpInfo ; #else void S4PTR *space1 ; #endif DATA4 S4PTR *data ; DATA4FILE S4PTR *dataFile ; S4CONV( CODE4 S4PTR *codeBase, CODE4 S4PTR *code_base ) ; unsigned int lenEval ; /* This is the length of the buffer needed for evaluation. */ int numParms ; /* This is the # of parameter positions used in evaluation. */ char hasTrim ; /* special case for key evaluation */ #ifdef S4CLIPPER int keyDec, keyLen ; /* used for CLIPPER version */ #endif } EXPR4 ; #ifndef S4CLIENT #ifdef N4OTHER typedef struct { long pointer ; /* =0L if record, not pointer */ long num ; unsigned char value[1] ; /* The key size is variable */ } B4KEY_DATA ; #else typedef struct { S4LONG num ; unsigned char value[1] ; /* The key size is variable */ } B4KEY_DATA ; #endif #ifdef S4FOX /* the following structure is used only on the leaf nodes of the tree structure */ typedef struct { short freeSpace ; /* # bytes available in node */ unsigned char recNumMask[4] ; /* record number mask */ unsigned char dupByteCnt ; /* duplicate byte mask count */ unsigned char trailByteCnt ; /* Trailing byte mask count */ unsigned char recNumLen ; /* # bits used for record number */ unsigned char dupCntLen ; /* # bits used for duplicate count */ unsigned char trailCntLen ; /* # bits used for trail count */ unsigned char infoLen ; /* # bytes for holding record number, */ } B4NODE_HEADER ; typedef struct { short nodeAttribute ; /* 0=index, 1=root, 2=leaf */ short nKeys ; /* Block Image starts here */ S4LONG leftNode ; /* -1 if not present */ S4LONG rightNode ; /* -1 if not present */ } B4STD_HEADER ; typedef struct { LINK4 link ; struct TAG4FILESt S4PTR *tag ; int changed ; S4LONG fileBlock ; /* Identifies block within index file */ int keyOn ; /* The current key within the block */ int curTrailCnt ; /* current value used for seeking */ int curDupCnt ; /* current value used for seeking */ int dupPos ; /* bit offset into the info for the duplicate data */ int trailPos ; /* bit offset into the info for the trail data */ int recPos ; /* bit offset into the info for the record # data */ char *curPos ; /* current position into the data (starts at end) */ int builtOn ; /* the 'current' key value (i.e. key really 'on') */ char S4PTR *builtPos ; /* position where built on */ B4KEY_DATA S4PTR *builtKey ; B4STD_HEADER header ; B4NODE_HEADER nodeHdr ; /* only if the block is a leaf */ char data[1] ; /* the remaining data */ } B4BLOCK ; #endif /* ifdef S4FOX */ #ifndef S4FOX #ifdef S4NDX typedef struct { long root ; long eof ; char n1dummy ; char type ; char n2dummy[2] ; short keyLen ; short keysMax ; /* Maximum # of keys per block; <= 100 */ short intOrDate ; /* TRUE (1) if Numeric or Date Key */ short groupLen ; /* keyLen plus 8 increased to a multiple of 2 */ short dummy ; short unique ; /* TRUE if Unique */ /* char expression[256] ; */ /* long version ; */ } I4IND_HEAD_WRITE; #else #ifdef S4CLIPPER typedef struct { short sign ; short version ; long root ; /* Root Block */ long eof ; /* First Free Block Pointer */ short groupLen ; /* Key Length + 2*sizeof(long) */ short keyLen ; /* Key Length */ short keyDec ; /* Number of Decimals in Key */ short keysMax ; /* Maximum # of keys per block; <= 100 */ short keysHalf ; /* Maximum # of keys per half block */ /* char expression[256]; The index expression corresponding to the database. */ /* short unique ; TRUE if Unique */ } I4IND_HEAD_WRITE; #endif #endif #ifdef S4NDX typedef struct { S4LONG oldVersion ; int headerOffset ; S4LONG root ; S4LONG eof ; char n1dummy ; char type ; char n2dummy[2] ; short keyLen ; short keysMax ; /* Maximum # of keys per block; <= 100 */ short intOrDate ; /* TRUE (1) if Numeric or Date Key */ short groupLen ; /* keyLen plus 8 increased to a multiple of 2 */ short dummy ; short unique ; /* TRUE if Unique */ /* char expression[256] ; */ S4LONG version ; } T4HEADER ; #else #ifdef S4CLIPPER typedef struct { short oldVersion ; int headerOffset ; S4LONG virtualEof ; /* The next available file block */ short sign ; short version ; S4LONG root ; /* Root Block */ S4LONG eof ; /* First Free Block Pointer */ short groupLen ; /* Key Length + 2*sizeof(long) */ short keyLen ; /* Key Length */ short keyDec ; /* Number of Decimals in Key */ short keysMax ; /* Maximum # of keys per block; <= 100 */ short keysHalf ; /* Maximum # of keys per half block */ /* char expression[256] ; The index expression corresponding to the database. */ short unique ; /* TRUE if Unique */ short descending ; /* The descending flag corresponding to the index file */ /* char filter[256] ; The filter(for) expression corresponding to the database. */ } T4HEADER ; #else typedef struct { char two ; /* Version number (currently 2) */ char yymmdd[3] ; /* Date of last reindex */ char dataName[12] ; /* Name of associated data file */ char dummy1[4] ; /* extra 4 bytes for data-names-not used in DOS */ short blockChunks ; /* Block Size 1 to 32 (512 byte chunks) */ short blockRw ; /* Block Read/Write Size in bytes */ char isProduction ; /* 1 if production index, else 0 */ char numSlots ; /* number possible tags (48) */ short slotSize ; /* number bytes/tag slot (32) */ short numTags ; short dummy2 ; S4LONG eof ; S4LONG freeList ; /* start of the free list */ char zero[4] ; char createDate[3]; /* not used by CodeBase */ char blank ; } I4HEADER ; #endif /* ifdef S4CLIPPER */ #endif /* ifdef S4NDX */ #endif /* ifndef S4FOX */ #ifndef S4FOX typedef struct { LINK4 link ; struct TAG4FILESt S4PTR *tag ; S4LONG fileBlock ; /* Identifies block within index file */ int changed ; int keyOn ; /* The current key within the block */ short nKeys ; /* Block Image starts here */ #ifdef S4NDX char dummy[2] ; B4KEY_DATA data ; #else #ifdef S4CLIPPER short pointers[( B4BLOCK_SIZE / 2 - 1 )] ; B4KEY_DATA S4PTR *data ; #else char dummy[6] ; B4KEY_DATA info ; #endif #endif } B4BLOCK ; typedef struct { S4LONG headerPos ; /* Header position (in 512 byte chunks) */ char tag[10] ; short x1000 ; /* used for dBASE/SQL expression type - dBASE only allowed for CBPP 1.0x */ char leftChld ; char rightChld ; char parent ; char x2 ; char indexType ; char zeros[11] ; } T4DESC ; #endif /* ifndef S4FOX */ #ifndef N4OTHER typedef struct { #ifdef S4FOX S4LONG root ; /* -1 means unknown */ S4LONG freeList ; /* start of the free list (-1 if none) */ unsigned S4LONG version ; /* used multi-user only */ short keyLen ; /* Key Length */ unsigned char typeCode; /* 0x01 Uniq; 0x08 For Clause; 0x32 Compact; 0x80 Compound */ unsigned char signature ; /* unused */ /* char dummy2[482] ; unused */ char sortSeq[8] ; /* collating sequence (ie GENERAL) */ char dummy3[4] ; short descending ; /* 1 = descending, 0 = ascending */ short filterPos ; /* not used, == to exprLen */ short filterLen ; /* length of filter clause */ short exprPos ; /* not used, == to 0 */ short exprLen ; /* length of expression */ /* char exprPool[512] ; expression and filter pool */ #else S4LONG root ; /* -1 means unknown */ char dummy1[4] ; char typeCode; /* 0x10 Normal; 0x58 Uniq,Desc; 0x50 Uniq; 0x18 Desc */ char type ; /* N,D, or C (F is type N) */ char dummy2[2] ; short keyLen ; short keysMax ; /* Maximum # of keys per block; <= 100 */ char dummy3[2] ; /* 1 if Numeric or Date Key (NDX only) */ short groupLen ; /* keyLen plus 4 (MDX); plus 8 (NDX) */ unsigned char version ; char dummy4 ; short unique ; /* 0x4000 (TRUE)if Unique */ /* Note, 'exprKey[220]' comes after 'unique' and */ /* 'exprFilter[220]' comes at position 0x2FA */ #endif } T4HEADER ; #ifdef S4FOX /* info on codepage and collating sequence */ typedef struct T4VFPSt { int codePage ; /* codepage of database file */ int sortType ; /* collating seq of tag in index file */ translatedChars *tablePtr ; /* points to translation table */ compressedChars *compPtr; /* points to compressed char table */ unsigned char *cpPtr ; /* points to codepage table */ } T4VFP ; #endif #endif /* ifndef N4OTHER */ #endif /* ifdef S4CLIENT */ typedef struct TAG4FILESt { LINK4 link ; #ifndef N4OTHER struct INDEX4FILESt S4PTR *indexFile ; #else void S4PTR *space1 ; #endif char alias[LEN4TAG_ALIAS+1] ; CODE4 S4PTR *codeBase ; int debugInt ; /* used to check structure integrity (set to 0x5281) */ #ifdef N4OTHER int userCount ; #else int space2 ; #endif #ifdef S4CLIENT char S4PTR *exprPtr ; char S4PTR *filterPtr ; short int errUniqueHold ; #else EXPR4 S4PTR *expr ; EXPR4 S4PTR *filter ; S4CMP_FUNCTION *cmp ; C4STOK S4PTR *stok ; /* Conversion for 'seek' */ C4DTOK S4PTR *dtok ; /* Conversion for 'seek' */ #ifdef S4MDX char hadKeys ; #else char space3 ; #endif char hasKeys ; LIST4 blocks ; LIST4 saved ; #ifdef S4FOX char pChar ; T4VFP vfpInfo ; #else char space4 ; char space5 ; /* modify appropriately when above workaround is combined */ #endif #ifdef S4CLIPPER S4LONG checkEof ; /* used for debug purposes to verify eof length */ #else S4LONG space6 ; #endif #ifdef N4OTHER FILE4 file ; S4LONG fileLocked ; MEM4 S4PTR *blockMemory ; #ifndef S4OFF_OPTIMIZE struct TAG4FILESt *readBlockTag ; /* used for optimization -- is a block-read request occurring? */ #endif #else FILE4 space7 ; S4LONG space8 ; void S4PTR *space9 ; #endif T4HEADER header ; S4LONG headerOffset ; /* Offset in file to the tag's header info. */ int rootWrite ; /* True if 'header.root' needs to be written */ int keyDec ; #ifdef S4FOX MEM4 *builtKeyMemory ; #endif #ifdef S4MDX S4LONG changed ; #endif #ifdef S4UNIX int keyType ; #endif #endif } TAG4FILE ; typedef struct TAG4St { LINK4 link ; struct INDEX4St S4PTR *index ; TAG4FILE *tagFile ; /* this uniqueError MUST be 0 if the tag is not unique */ short int errUnique ; /* Is rewriting a unique key an error ? */ #ifndef S4OFF_TRAN int isValid ; #endif #ifndef S4CLIENT #ifndef S4OFF_TRAN LIST4 removedKeys ; /* list of temporarily removed keys for r4unique and e4unique cases */ #endif int added, removed ; /* was an entry added, removed */ #endif } TAG4 ; typedef struct { char S4PTR *name ; S4CONST char S4PTR *expression ; S4CONST char S4PTR *filter ; short int unique ; unsigned short int descending ; } TAG4INFO ; #ifndef N4OTHER typedef struct INDEX4FILESt { LINK4 link ; LIST4 tags ; int userCount ; CODE4 S4PTR *codeBase ; DATA4FILE S4PTR *dataFile ; #ifdef S4CLIENT char accessName[LEN4PATH+1] ; int autoOpened ; long clientId, serverId ; #ifdef S4VBASIC short int debugInt ; /* used to check structure integrity (set to 0x5281) */ #else short int space1 ; #endif #else FILE4 file ; MEM4 S4PTR *blockMemory ; long fileLocked ; #ifdef S4FOX TAG4FILE S4PTR *tagIndex ; /* the tags are a tag in the index file! */ long eof ; unsigned long versionOld ; #else TAG4FILE S4PTR *space2 ; long space3 ; unsigned long space4 ; #endif #ifdef S4MDX I4HEADER header ; long changed ; #endif #ifndef S4OFF_OPTIMIZE TAG4FILE *readBlockTag ; /* used for optimization -- is a block-read request occurring? */ #endif #endif } INDEX4FILE ; #endif typedef struct INDEX4St { LINK4 link ; LIST4 tags ; DATA4 S4PTR *data ; CODE4 S4PTR *codeBase ; #ifndef S4OFF_TRAN int isValid ; #endif #ifndef N4OTHER INDEX4FILE *indexFile ; #endif #ifdef S4CLIENT char alias[LEN4DATA_ALIAS+1] ; #else char accessName[LEN4PATH+1] ; #ifdef N4OTHER FILE4 file ; /* char alias[LEN4TAG_ALIAS+1] ;*/ char S4PTR *path ; long versionOld ; #else FILE4 space1 ; char S4PTR *space2 ; long space3 ; #endif #endif } INDEX4 ; #ifndef S4OFF_TRAN #ifndef S4CLIENT typedef struct { LINK4 link ; long recno ; unsigned char key[1] ; /* of variable length, but marked as '1' for a place holder */ } TAG4KEY_REMOVED ; #endif #endif #ifndef S4CLIENT /* Memo File Structures */ typedef struct { #ifdef S4MFOX S4LONG nextBlock ; /* Memo Entry 1,2, ... */ char usused[2] ; short blockSize ; /* Bytes */ #else #ifdef S4MNDX S4LONG nextBlock ; /* Memo Entry 1,2, ... */ #else S4LONG nextBlock ; /* Memo Entry 1,2, ... */ S4LONG zero ; char fileName[8] ; short zero2 ; short x102 ; short blockSize ; /* Bytes */ short zero3 ; #endif #endif } MEMO4HEADER ; #ifndef S4MNDX #ifndef S4MFOX typedef struct { S4LONG next ; /* The next free block area */ S4LONG num ; /* The number of free blocks in the free block area */ int toDisk ; /* TRUE if this information needs to be written to disk */ S4LONG blockNo ; /* The current block number */ } MEMO4CHAIN_ENTRY ; #endif /* ifndef S4MFOX */ typedef struct { #ifdef S4MFOX S4LONG type ; /* 0 for picture, 1 for text, 2 for OLE -- picture not supported */ S4LONG numChars ; /* Including the 'MemoBlock' */ #else short minusOne ; /* '-1' for dBASE IV */ short startPos ; S4LONG numChars ; /* Including the 'MemoBlock' */ #endif } MEMO4BLOCK ; #endif /* ifndef S4MNDX */ #endif /* ifndef S4CLIENT */ typedef struct { unsigned char sigDig ; /* The number of significant digits; 52 is zero */ unsigned char digitInfo ; /* contains one, len and sign */ unsigned char bcd[10] ; } C4BCD ; #ifndef S4OFF_MULTI /* for a single lock */ typedef struct { short int type ; long recNum ; /* if appropriate */ long clientId ; long serverId ; } LOCK4ID ; typedef struct LOCK4St { LINK4 link ; #ifdef S4CLIENT DATA4 *data ; #else DATA4FILE *data ; #endif LOCK4ID id ; } LOCK4 ; #ifndef S4SERVER typedef struct { LINK4 link ; DATA4 *data ; long recNo ; } LOCK4LINK ; #endif #endif #ifdef S4USE_LOW_MEMORY typedef union { unsigned long block ; struct { unsigned short protect ; unsigned short real ; } ptr ; } FIXED4MEM ; #else typedef void * FIXED4MEM ; #endif #ifdef S4TESTING #ifndef S4SERVER typedef struct { unsigned char T4SUITE[255] ; unsigned char T4RECNO[100] ; } ATS4RECINFO ; #endif #endif