home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / blt2_214.zip / bullet_2.h < prev    next >
C/C++ Source or Header  |  1996-11-23  |  33KB  |  756 lines

  1.  
  2. /* BULLET_2.H    23-Nov-96-chh
  3.  *
  4.  *  Bullet header for 32-bit C/C++ (DOSX32, OS/2, and Win32s/Win32)
  5.  *  Bullet call numbers, parameter packs, and error number equates
  6.  *
  7.  *  Requires PLATFORM defined and set to ON_DOSX32 (3), ON_OS2 (4),
  8.  *  or ON_WIN32 (5) before getting here.  For example:
  9.  *    #define PLATFORM ON_DOSX32  (ON_DOSX32 defined as 3)
  10.  *
  11.  */
  12.  
  13. #ifndef __BULLET_H
  14. #define __BULLET_H
  15.  
  16. /*
  17.  * The #pragma pack(1)/#pragma pack() is no longer required since all
  18.  * structure members in this header will align properly -- all are
  19.  * 32-bit size except for the structure "FieldDescType", but fieldDA
  20.  * member (a LONG) is at a 32-bit alignment already (at byte offset +12).
  21.  * The altFieldLength member, same structure, is also already at
  22.  * proper alignment for a 16-bit value (at byte offset +18).  If, for
  23.  * some reason, your compiler aligns the members differently, then you
  24.  * must use the appropriate compiler pragma to prevent this -- the
  25.  * FieldDescType size is 32 bytes exactly.  It is not likely that any
  26.  * conforming compiler will alter this structure, but, now you know what
  27.  * to do if it does.
  28.  *
  29.  * #pragma pack(1)
  30.  *
  31.  * NOTE: In your program source code, when you layout your record buffer
  32.  * structure, you must use the #pragma pack(1)/#pragma pack() directives
  33.  * around it since it will be, most likely, modified.  The reason is that
  34.  * this structure MUST start with the implicit TAG field (a BYTE), and so,
  35.  * unless you use only BYTE/CHAR members in your structure (Bullet can use
  36.  * binary field values), or take special care to align the record layout
  37.  * so no padding is performed by the compiler, then you will need to use
  38.  * the pack(1) pragma.
  39.  *
  40.  * #pragma pack()
  41.  */
  42.  
  43. /* Re: Bullet/X for DOSX32:
  44.  * (refer to ccdosfn.c for more)
  45.  * Bullet ccdosfn.c provides no OS call support to determine the
  46.  * system country code and code page ID.  This can be coded in
  47.  * ccdosfn.c, but it is quite compiler- and extender-dependent.
  48.  * The current state is to supply a collate sequence table for
  49.  * country code=1 and code page=437 (the table is statically coded).
  50.  * For other sort tables, modify as required.  If support for this
  51.  * at the system level is made available at run-time, you may
  52.  * want to change the following to 0, for both CTRYCODE and CODEPAGE.
  53.  * Until this is so coded, you cannot use 0 here (as with the Win32
  54.  * and OS/2 versions), else error EXB_216501 (8251) is the result.
  55.  * This table is added to each index file (if NLS or a user sort).
  56.  */
  57.  
  58. #ifndef PLATFORM
  59.  #error No PLATFORM specified
  60.  #error ---------------------
  61. #endif
  62.  
  63. #ifndef ON_DOSX32
  64.  #define ON_DOSX32 3
  65.  #define ON_OS2    4
  66.  #define ON_WIN32  5
  67. #endif
  68.  
  69. #if PLATFORM == ON_DOSX32
  70.  #define CTRYCODE 1     /* 0 signifies default country code (at index create) */
  71.  #define CODEPAGE 437   /* 0 signifies default code page (at index create) */
  72.                         /* but DOS extender may not support OS call to get info */
  73.                         /* see ccdosfn.c for making changes for DOSX32 platform */
  74.  #define RELOCK_AVAIL 0 /* relock not supported */
  75.  
  76.  #define VOID void      /* these are already defined if Win32 or OS/2, but not DOS */
  77.  #define SHORT short
  78.  #define LONG long
  79.  #define CHAR char
  80.  
  81.  typedef unsigned char BYTE;
  82.  typedef unsigned short USHORT;
  83.  typedef unsigned long ULONG;
  84.  typedef unsigned char *PSZ;
  85.  typedef VOID *PVOID;
  86.  
  87.  #define APIENTRY __cdecl
  88.  
  89. #elif PLATFORM == ON_OS2
  90.  #define CTRYCODE 0
  91.  #define CODEPAGE 0
  92.  #define RELOCK_AVAIL 1    /* relock is supported */
  93.  
  94.  /* above types are assumed defined in os2def.h */
  95.  
  96. #elif PLATFORM == ON_WIN32
  97.  #define CTRYCODE 0
  98.  #define CODEPAGE 0     /* may be ANSI or OEM code page value, depending on USE*CHARSET flag */
  99.  #define RELOCK_AVAIL 0 /* relock not supported */
  100.  
  101.  /* above types are assume defined in windef.h and winnt.h */
  102.  
  103. #else
  104.  #error No PLATFORM specified
  105.  #error ---------------------
  106.  
  107. #endif
  108.  
  109. #ifndef __BLT_DYNA    // define this if using run-time loading of BULLET*.DLL
  110.                       // via LoadLibrary(Win32) or DosLoadModule(OS/2)
  111.  #ifdef __cplusplus
  112.   extern "C" LONG APIENTRY BULLET(PVOID datapack);
  113.  #else
  114.   extern LONG APIENTRY BULLET(PVOID datapack);
  115.  #endif
  116.  
  117. #else
  118.  
  119.   LONG (* APIENTRY BULLET)(PVOID datapack);
  120.  
  121. #endif
  122.  
  123.  
  124.  
  125. /* The following on mutex-semaphore protection does not apply to Bullet/X */
  126. /* unless the semaphore routines (in ccdosfn.c) are coded to do something */
  127.  
  128. /* All Bullet routines are mutex-semaphore protected except the following:
  129.  *
  130.  * MEMORY_XB            STAT_HANDLE_XB          GET_ERROR_CLASS_XB
  131.  * QUERY_SYSVARS_XB     QUERY_VECTORS_XB        CHECK_REMOTE_XB
  132.  * STAT_DATA_XB         STAT_INDEX_XB
  133.  *
  134.  * This means that any thread can call the above routines at any time.  All
  135.  * other calls in the current process block until the previous thread exits 
  136.  * BULLET.  The default mutex wait is 0 milliseconds, and can be set via 
  137.  * SET_SYSVARS_XB using the MUTEX_SEM_TIMEOUT index.  In the case of
  138.  * STAT_DATA_XB and STAT_INDEX_XB, these should be used only when there
  139.  * is no chance that another thread may close that file handle while the
  140.  * routine is working.
  141.  *
  142.  */
  143.  
  144.  
  145.  
  146. /* ************************************************************************
  147.  *
  148.  * xxx.func call numbers
  149.  *
  150.  * ************************************************************************/
  151.  
  152. #define GEN_ERR_XB              0
  153. #define INIT_XB                 1  /* system */
  154. #define EXIT_XB                 2
  155. #define MEMORY_XB               4
  156. #define BACKUP_FILE_XB          6
  157. #define STAT_HANDLE_XB          7
  158. #define GET_ERROR_CLASS_XB      8
  159.  
  160. #define QUERY_SYSVARS_XB        10 /* advanced system */
  161. #define SET_SYSVARS_XB          11
  162. #define SET_DVMON_XB            12 /* reserved */
  163. #define QUERY_VECTORS_XB        13
  164. #define SET_VECTORS_XB          14
  165.  
  166. #define CREATE_DATA_XB          20 /* data control mid-level */
  167. #define OPEN_DATA_XB            21
  168. #define CLOSE_DATA_XB           22
  169. #define STAT_DATA_XB            23
  170. #define READ_DATA_HEADER_XB     24
  171. #define FLUSH_DATA_HEADER_XB    25
  172. #define COPY_DATA_HEADER_XB     26
  173. #define ZAP_DATA_HEADER_XB      27
  174.  
  175. #define CREATE_INDEX_XB         30 /* key control mid-level */
  176. #define OPEN_INDEX_XB           31
  177. #define CLOSE_INDEX_XB          32
  178. #define STAT_INDEX_XB           33
  179. #define READ_INDEX_HEADER_XB    34
  180. #define FLUSH_INDEX_HEADER_XB   35
  181. #define COPY_INDEX_HEADER_XB    36
  182. #define ZAP_INDEX_HEADER_XB     37
  183.  
  184. #define GET_DESCRIPTOR_XB       40 /* data access mid-level */
  185. #define GET_RECORD_XB           41
  186. #define ADD_RECORD_XB           42
  187. #define UPDATE_RECORD_XB        43
  188. #define DELETE_RECORD_XB        44
  189. #define UNDELETE_RECORD_XB      45
  190. #define DEBUMP_RECORD_XB        46
  191. #define PACK_RECORDS_XB         47
  192.  
  193. #define GET_MEMO_SIZE_XB        50 /* memo access mid-level */
  194. #define GET_MEMO_XB             51
  195. #define ADD_MEMO_XB             52
  196. #define UPDATE_MEMO_XB          53
  197. #define DELETE_MEMO_XB          54
  198. #define MEMO_BYPASS_XB          59 /* see below for bypass ordinals */
  199.  
  200. #define BYPASS_CREATE_MEMO       1 /* The bypass routines are automatically */
  201. #define BYPASS_OPEN_MEMO         2 /* performed by BULLET but can be done */
  202. #define BYPASS_CLOSE_MEMO        3 /* manually, if needed - these numbers are */
  203. #define BYPASS_READ_MEMO_HEADER  4 /* put in MDP.memoBypass, with MDP.func */
  204. #define BYPASS_FLUSH_MEMO_HEADER 5 /* set to MEMO_BYPASS_XB */
  205.  
  206.  
  207.  
  208. #define FIRST_KEY_XB            60 /* key access mid-level */
  209. #define EQUAL_KEY_XB            61
  210. #define EQUAL_OR_GREATER_KEY_XB 110
  211. #define EQUAL_OR_LESSER_KEY_XB  111
  212. #define NEXT_KEY_XB             62
  213. #define PREV_KEY_XB             63
  214. #define LAST_KEY_XB             64
  215. #define STORE_KEY_XB            65
  216. #define DELETE_KEY_XB           66
  217. #define BUILD_KEY_XB            67
  218. #define GET_CURRENT_KEY_XB      68
  219. #define GET_KEY_FOR_RECORD_XB   69
  220.  
  221. #define GET_FIRST_XB            70 /* key and data access high-level */
  222. #define GET_EQUAL_XB            71
  223. #define GET_EQUAL_OR_GREATER_XB 112
  224. #define GET_EQUAL_OR_LESSER_XB  113
  225. #define GET_NEXT_XB             72
  226. #define GET_PREV_XB             73
  227. #define GET_LAST_XB             74
  228. #define INSERT_XB               75
  229. #define UPDATE_XB               76
  230. #define REINDEX_XB              77
  231.  
  232. #define LOCK_XB                 80 /* network control */
  233. #define UNLOCK_XB               81
  234. #define LOCK_INDEX_XB           82
  235. #define UNLOCK_INDEX_XB         83
  236. #define LOCK_DATA_XB            84
  237. #define UNLOCK_DATA_XB          85
  238. #define CHECK_REMOTE_XB         86
  239. #define RELOCK_XB               87
  240. #define RELOCK_INDEX_XB         88
  241. #define RELOCK_DATA_XB          89
  242.  
  243. #define DELETE_FILE_DOS         90 /* DOS file I/O low-level */
  244. #define RENAME_FILE_DOS         91
  245. #define CREATE_FILE_DOS         92
  246. #define OPEN_FILE_DOS           93
  247. #define SEEK_FILE_DOS           94
  248. #define READ_FILE_DOS           95
  249. #define WRITE_FILE_DOS          96
  250. #define CLOSE_FILE_DOS          97
  251. #define ACCESS_FILE_DOS         98
  252. #define EXPAND_FILE_DOS         99
  253. #define MAKE_DIR_DOS            100
  254. #define COMMIT_FILE_DOS         101
  255.  
  256. /* ************************************************************************
  257.  *
  258.  * operating system file I/O equates
  259.  *
  260.  * ************************************************************************/
  261.  
  262. #define READONLY        0x00000000 /* std file access mode */
  263. #define WRITEONLY       0x00000001 /* no underscore used for std equates */
  264. #define READWRITE       0x00000002
  265.  
  266. #define DENYREADWRITE   0x00000010 /* std file share mode, cannot be 0 */
  267. #define DENYWRITE       0x00000020
  268. #define DENYREAD        0x00000030
  269. #define DENYNONE        0x00000040
  270. #define NOINHERIT       0x00000080
  271.  
  272. #define NO_LOCALITY     0x00000000 /* optional cache modes */
  273. #define SEQ_LOCALITY    0x00010000
  274. #define RND_LOCALITY    0x00020000
  275. #define MIX_LOCALITY    0x00030000
  276. #define SKIP_CACHE      0x00100000 /* not inherited by child process */
  277. #define WRITE_THROUGH   0x00400000 /* not inherited by child process */
  278.  
  279.  
  280. #define LOCK_SHARED      1         /* a read-only lock, OS/2 and NT only */
  281. #define LOCK_EXCLUSIVE   0         /* default */
  282.  
  283. /* ************************************************************************
  284.  *
  285.  * .sortFunction IDs, Query/SetSysVars|Vectors item IDs
  286.  *
  287.  * ************************************************************************/
  288.  
  289. // SORT_SET flag:  USE_*_CHARSET defaults to OEM character set, and is used
  290. // (OEM or ANSI) if the .sortFunction is NLS or a custom sort-compare.
  291.  
  292. #define USE_OEM_CHARSET  (0 << 17) /* for DOSX32, OS/2, and Windows */
  293. #define USE_ANSI_CHARSET (1 << 17) /* for Windows (.sortFunction flag) */
  294.  
  295. #define DUPS_ALLOWED (1 << 16) /* allow duplicate keys (.sortFunction flag) */
  296.  
  297. /* All Bullet system vars set to default values at INIT_XB */
  298. /* Sorts 1-19 also used as CIP.sortFunction (can be OR'ed with DUPS_ALLOWED) */
  299. /* Intrinsic sorts (1-6) are read-only (R-O) */
  300.  
  301. #define ASCII_SORT 1    /* sort by: ASCII value (R-O) */
  302. #define NLS_SORT   2    /* NLS (R-O) */
  303. #define S16_SORT   3    /* 16-bit signed integer (R-O) */
  304. #define U16_SORT   4    /* 16-bit unsigned integer (R-O) */
  305. #define S32_SORT   5    /* 32-bit signed integer (R-O) */
  306. #define U32_SORT   6    /* 32-bit unsigned integer (R-O) */
  307.  
  308. /* sorts 7 to 9 are reserved */
  309. /* Custom sort-compare functions are from 10 to 19 */
  310.  
  311. #define BUILD_KEY_FUNC  20      /* key build function ptr */
  312. #define PARSER_FUNC     21      /* key expression parser function ptr */
  313.  
  314. #define MUTEX_SEM_HANDLE     29 /* handle of Bullet's mutex semaphore (R-O) */
  315. #define LOCK_TIMEOUT         30 /* lock-wait timeout (default=0, no wait)*/
  316. #define MUTEX_SEM_TIMEOUT    31 /* mutex semaphore-wait timeout (def=0,none) */
  317. #define PACK_BUFFER_SIZE     32 /* pack buffer size (def=0, min autosize) */
  318. #define REINDEX_BUFFER_SIZE  33 /* reindex buffer size (def=0, min autosize) */
  319. #define REINDEX_PACK_PCT     34 /* reindex node pack % (default=100, max) */
  320. #define TMP_PATH_PTR         35 /* temporary file path ptr (default=NULL) */
  321. #define REINDEX_SKIP_TAG     36 /* index skip tag select (default=0, none) */
  322. #define COMMIT_AT_EACH       37 /* commit each insert/update in pack (def=0) */
  323. #define MEMO_BLOCKSIZE       38 /* memo block size (default=512 bytes) */
  324. #define MEMO_EXTENSION       39 /* memo filename extension (default='DBT\0') */
  325. #define MAX_DATAFILE_SIZE    40 /* max data size (default=0x7FEFFFFF=2095MB) */
  326. #define MAX_INDEXFILE_SIZE   41 /* max index size (default=0x7FEFFFFF=2095MB)*/
  327. #define ATOMIC_MODE          42 /* bit0=1 atomic next/prev key access (def=0)*/
  328. #define CALLBACK_PTR         43 /* callback at reindex/pack (def=0, none) */
  329.  
  330. /* ************************************************************************
  331.  *
  332.  * Query/SetVectors vector IDs
  333.  *
  334.  * ************************************************************************/
  335.  
  336. #define VECTOR_CLOSE_FILE           2
  337. #define VECTOR_CREATE_DIR           3
  338. #define VECTOR_CREATE_FILE          4
  339. #define VECTOR_CREATE_UNIQUE_FILE   5
  340. #define VECTOR_DELETE_FILE          6
  341. #define VECTOR_LENGTH_FILE          7
  342. #define VECTOR_MOVE_FILE            8
  343. #define VECTOR_OPEN_FILE            9
  344. #define VECTOR_READ_FILE           10
  345. #define VECTOR_SEEK_FILE           11
  346. #define VECTOR_UPDATE_DIR_ENTRY    12
  347. #define VECTOR_WRITE_FILE          13
  348. #define VECTOR_LOCK_FILE           14
  349. #define VECTOR_IS_DRIVE_REMOTE     15
  350. #define VECTOR_IS_FILE_REMOTE      16
  351. #define VECTOR_EXITLIST            17
  352. #define VECTOR_REMOVE_EXITLIST     18
  353. #define VECTOR_FREE                19
  354. #define VECTOR_GET_SORT_TABLE      20
  355. #define VECTOR_GET_COUNTRY_INFO    21
  356. #define VECTOR_GET_ERROR_CLASS     22
  357. #define VECTOR_GET_MEMORY          23
  358. #define VECTOR_GET_TMP_DIR         24
  359. #define VECTOR_GET_VERSION         25
  360. #define VECTOR_MALLOC              26
  361. #define VECTOR_SET_HANDLE_COUNT    27
  362. #define VECTOR_GET_TIME_INFO       28
  363. #define VECTOR_UPPERCASE           29
  364. #define VECTOR_CLOSE_MUTEX_SEM     30
  365. #define VECTOR_CREATE_MUTEX_SEM    31
  366. #define VECTOR_RELEASE_MUTEX_SEM   32
  367. #define VECTOR_REQUEST_MUTEX_SEM   33
  368.  
  369.  
  370. /* ************************************************************************
  371.  *
  372.  * Parameter pack structures, typedefs
  373.  *
  374.  * ************************************************************************/
  375.  
  376. /* AP, CP, CDP, etc., are suggested variable names */
  377.  
  378. typedef struct _ACCESSPACK {
  379. ULONG func;
  380. ULONG stat;
  381. ULONG handle;         /* I, handle of Bullet file to access */
  382. LONG  recNo;          /* IO, record number */
  383. PVOID recPtr;         /* I, programmer's record buffer */
  384. PVOID keyPtr;         /* I, programmer's key buffer */
  385. PVOID nextPtr;        /* I, NULL if not xaction, else next AP in list */
  386. } ACCESSPACK; /* AP */
  387. typedef ACCESSPACK *PACCESSPACK;
  388.  
  389. /* CBP is the structure received by the callback procedure */
  390. /* structure members are filled in by Bullet */
  391.  
  392. typedef struct _CALLBACKPACK {
  393. ULONG sizeIs;         /* structure size (current 16 bytes) */
  394. ULONG callMode;       /* 0=from reindex; 1=from DBF pack */
  395. ULONG handle;         /* file handle */
  396. ULONG data1;          /* for callMode=0/1: progress percent (1-99,0) */
  397. } CALLBACKPACK; /* CBP */
  398. typedef CALLBACKPACK *PCALLBACKPACK;
  399.  
  400. typedef struct _COPYPACK {
  401. ULONG func;
  402. ULONG stat;
  403. ULONG handle;         /* I, handle of Bullet file to copy */
  404. PSZ   filenamePtr;    /* I, filename to use (drv+path must exist if used) */
  405. } COPYPACK; /* CP */
  406. typedef COPYPACK *PCOPYPACK;
  407.  
  408. typedef struct _CREATEDATAPACK {
  409. ULONG func;
  410. ULONG stat;
  411. PSZ   filenamePtr;    /* I, filename to use */
  412. ULONG noFields;       /* I, 1 to 1024 */
  413. PVOID fieldListPtr;   /* I, descriptor list, 1 per field */
  414. ULONG fileID;         /* I, 0x03 for standard DBF, 0x8B if memo file also */
  415. } CREATEDATAPACK; /* CDP */
  416. typedef CREATEDATAPACK *PCREATEDATAPACK;
  417.  
  418. typedef struct _CREATEINDEXPACK {
  419. ULONG func;
  420. ULONG stat;
  421. PSZ   filenamePtr;    /* I, filename to use */
  422. PSZ   keyExpPtr;      /* I, e.g., "SUBSTR(LNAME,1,4)+SSN" */
  423. LONG  xbLink;         /* I, opened data file handle this indexes */
  424. ULONG sortFunction;   /* I, 1-9 system, 10-19 custom */
  425. ULONG codePage;       /* I, 0=use process default */
  426. ULONG countryCode;    /* I, 0=use process default */
  427. PVOID collatePtr;     /* I, NULL=use cc/cp else use passed table for sort */
  428. ULONG nodeSize;       /* I, 512, 1024, or 2048 */
  429. } CREATEINDEXPACK; /* CIP */
  430. typedef CREATEINDEXPACK *PCREATEINDEXPACK;
  431.  
  432. typedef struct _FIELDDESCTYPE {
  433. BYTE  fieldName[11];  /* IO, upper A-Z and _; 1-10 chars, 0-filled, 0-term */
  434. BYTE  fieldType;      /* IO, C,D,L,N, or M */
  435. LONG  fieldDA;        /* x, offset within record (run-time storage option) */
  436. BYTE  fieldLen;       /* IO, C=1-255,D=8,L=1,N=1-19,M=10 */
  437. BYTE  fieldDC;        /* IO, fieldType=N then 0-15 else 0 */
  438. USHORT altFieldLength;/* IO, 0 */
  439. BYTE  filler[12];     /* I, 0 */
  440. } FIELDDESCTYPE; /* nested in _DESCRIPTORPACK */
  441. typedef FIELDDESCTYPE *PFIELDDESCTYPE;
  442.  
  443. typedef struct _DESCRIPTORPACK {
  444. ULONG func;
  445. ULONG stat;
  446. ULONG handle;         /* I, handle of DBF file */
  447. ULONG fieldNumber;    /* IO, first field is 1 */
  448. ULONG fieldOffset;    /* O, offset of field within record (tag=offset 0) */
  449. FIELDDESCTYPE FD;     /* IO FD.fieldName only, O for rest of FD */
  450. } DESCRIPTORPACK; /* DP */
  451. typedef DESCRIPTORPACK *PDESCRIPTORPACK;
  452.  
  453. typedef struct _DOSFILEPACK {
  454. ULONG func;
  455. ULONG stat;
  456. PSZ   filenamePtr;    /* I, filename to use */
  457. ULONG handle;         /* IO, handle of open file */
  458. ULONG asMode;         /* I, access-sharing mode */
  459. ULONG bytes;          /* IO, bytes to read, write, length of */
  460. LONG  seekTo;         /* IO, seek to offset, current offset */
  461. ULONG method;         /* I, seek method (0=start of file, 1=current, 2=end) */
  462. PVOID bufferPtr;      /* I, buffer to read into or write from */
  463. ULONG attr;           /* I, attribute to create file with */
  464. PSZ   newNamePtr;     /* I, name to use on rename */
  465. } DOSFILEPACK; /* DFP */
  466. typedef DOSFILEPACK *PDOSFILEPACK;
  467.  
  468. typedef struct _EXITPACK {
  469. ULONG func;
  470. ULONG stat;
  471. } EXITPACK; /* EP */
  472. typedef EXITPACK *PEXITPACK;
  473.  
  474. typedef struct _HANDLEPACK {
  475. ULONG func;
  476. ULONG stat;
  477. ULONG handle;         /* I, handle of Bullet file */
  478. } HANDLEPACK; /* HP */
  479. typedef HANDLEPACK *PHANDLEPACK;
  480.  
  481. typedef struct _INITPACK {
  482. ULONG func;
  483. ULONG stat;
  484. ULONG JFTsize;        /* I, max opened files (20-1024+) */
  485. ULONG versionDOS;     /* O, e.g., 230 for 2.30 */
  486. ULONG versionBullet;  /* O, e.g., 2019 for 2.019 */
  487. ULONG versionOS;      /* O, e.g., 4=OS/2 32-bit */
  488. PVOID exitPtr;        /* O, function pointer to EXIT_XB routine */
  489. } INITPACK; /* IP */
  490. typedef INITPACK *PINITPACK;
  491.  
  492. typedef struct _LOCKPACK {
  493. ULONG func;
  494. ULONG stat;
  495. ULONG handle;         /* I, handle of Bullet file to lock */
  496. ULONG xlMode;         /* I, index lock mode (0=exclusive, 1=shared) */
  497. ULONG dlMode;         /* I, data lock mode (0=exclusive, 1=shared) */
  498. LONG  recStart;       /* I, if data, first record # to lock, or 0 for all */
  499. ULONG recCount;       /* I, if data and recStart!=0, # records to lock */
  500. PVOID nextPtr;        /* I, NULL if not xaction, else next LP in list */
  501. } LOCKPACK; /* LP */
  502. typedef LOCKPACK *PLOCKPACK;
  503.  
  504. typedef struct _MEMODATAPACK {
  505. ULONG func;
  506. ULONG stat;
  507. ULONG dbfHandle;      /* I, handle of DBF file to which this memo file belongs */
  508. ULONG memoBypass;     /* I, memo bypass function to do, if any */
  509. PVOID memoPtr;        /* I, ptr to memo record buffer */
  510. ULONG memoNo;         /* IO, memo record number (aka block number) */
  511. ULONG memoOffset;     /* I, position within record to start read/update */
  512. ULONG memoBytes;      /* IO, number of bytes to read/update */
  513. } MEMODATAPACK; /* MDP */
  514. typedef MEMODATAPACK *PMEMODATAPACK;
  515.  
  516. typedef struct _MEMORYPACK {
  517. ULONG func;
  518. ULONG stat;
  519. ULONG memory;         /* O, not used in OS/2 */
  520. } MEMORYPACK; /* MP */
  521. typedef MEMORYPACK *PMEMORYPACK;
  522.  
  523. typedef struct _OPENPACK {
  524. ULONG func;
  525. ULONG stat;
  526. ULONG handle;         /* O, handle of file opened */
  527. PSZ   filenamePtr;    /* I, Bullet file to open */
  528. ULONG asMode;         /* I, access-sharing-cache mode */
  529. LONG  xbLink;         /* I, if index open, xbLink=handle of its opened DBF */
  530. } OPENPACK; /* OP */
  531. typedef OPENPACK *POPENPACK;
  532.  
  533. typedef struct _QUERYSETPACK {
  534. ULONG func;
  535. ULONG stat;
  536. ULONG item;           /* I, Bullet sysvar item to get/set */
  537. ULONG itemValue;      /* IO, current/new value */
  538. } QUERYSETPACK; /* QSP */
  539. typedef QUERYSETPACK *PQUERYSETPACK;
  540.  
  541. typedef struct _REMOTEPACK {
  542. ULONG func;
  543. ULONG stat;
  544. ULONG handle;         /* I, handle of file, or if 0, use RP.drive */
  545. ULONG drive;          /* I, drive (1=A,2=B,3=C,...0=current) to check */
  546. ULONG isRemote;       /* O, =1 of handle/drive is remote, =0 if local */
  547. ULONG flags;          /* O, 0 */
  548. ULONG isShare;        /* O, 1 */
  549. } REMOTEPACK; /* RP */
  550. typedef REMOTEPACK *PREMOTEPACK;
  551.  
  552. typedef struct _STATDATAPACK {
  553. ULONG func;
  554. ULONG stat;
  555. ULONG handle;         /* I, handle to check */
  556. ULONG fileType;       /* O, bit0=1 data file */
  557. ULONG flags;          /* O, bit0=1 dirty, bit1=1 full-lock, bit2=1 shared */
  558. ULONG progress;       /* O, 0,1-99% pack progress */
  559. PVOID morePtr;        /* O, 0 */
  560. ULONG fields;         /* O, fields per record */
  561. ULONG asMode;         /* O, access-sharing-cache mode */
  562. PSZ   filenamePtr;    /* O, filename used in open */
  563. ULONG fileID;         /* O, first byte of DBF file */
  564. ULONG lastUpdate;     /* O, high word=year,low byte=day, high byte=month */
  565. ULONG records;        /* O, data records (including "deleted") */
  566. ULONG recordLength;   /* O, record length */
  567. ULONG xactionFlag;    /* O, 0 */
  568. ULONG encryptFlag;    /* O, 0 */
  569. PVOID herePtr;        /* O, this file's control address */
  570. ULONG memoHandle;     /* O, handle of open memo file (0 if none) */
  571. ULONG memoBlockSize;  /* O, memo file block size */
  572. ULONG memoFlags;      /* O, bit0=1 dirty */
  573. ULONG memoLastRecord; /* O, last accessed memo record (0 if none) */
  574. ULONG memoLastSize;   /* O, size of last accessed memo record (in bytes, +8) */
  575. ULONG lockCount;      /* O, number of full-locks in force */
  576. } STATDATAPACK; /* SDP */
  577. typedef STATDATAPACK *PSTATDATAPACK;
  578.  
  579. typedef struct _STATHANDLEPACK {
  580. ULONG func;
  581. ULONG stat;
  582. ULONG handle;         /* I, handle to check */
  583. LONG  ID;             /* O, bit0=1 data file, bit0=1 index file */
  584. } STATHANDLEPACK; /* SHP */
  585. typedef STATHANDLEPACK *PSTATHANDLEPACK;
  586.  
  587. typedef struct _STATINDEXPACK {
  588. ULONG func;
  589. ULONG stat;
  590. ULONG handle;         /* I, handle to check */
  591. ULONG fileType;       /* O, bit0=0 index file */
  592. ULONG flags;          /* O, bit0=1 dirty, bit1=1 full-lock, bit2=1 shared */
  593. ULONG progress;       /* O, 0,1-99% reindex progress */
  594. PVOID morePtr;        /* O, 0 */
  595. ULONG xbLink;         /* O, XB file link handle */
  596. ULONG asMode;         /* O, access-sharing-cache mode */
  597. PSZ   filenamePtr;    /* O, pointer to filename used in open */
  598. ULONG fileID;         /* O, "31ch" */
  599. PSZ   keyExpPtr;      /* O, pointer to key expression */
  600. ULONG keys;           /* O, keys in file */
  601. ULONG keyLength;      /* O, key length */
  602. ULONG keyRecNo;       /* O, record number of current key */
  603. PVOID keyPtr;         /* O, ptr to current key value (valid to keyLength) */
  604. PVOID herePtr;        /* O, this file's control address */
  605. ULONG codePage;       /* O, code page at create time */
  606. ULONG countryCode;    /* O, country code at create time */
  607. PVOID CTptr;          /* O, collate table ptr, NULL=no collate table present */
  608. ULONG nodeSize;       /* O, node size */
  609. ULONG sortFunction;   /* O, sort function ID */
  610. ULONG lockCount;      /* O, number of full-locks in force */
  611. } STATINDEXPACK; /* SIP */
  612. typedef STATINDEXPACK *PSTATINDEXPACK;
  613.  
  614. typedef struct _XERRORPACK {
  615. ULONG func;
  616. ULONG stat;           /* I, error to check */
  617. ULONG errClass;       /* O, class of error */
  618. ULONG action;         /* O, action recommended for error */
  619. ULONG location;       /* O, location of error */
  620. } XERRORPACK; /* XEP */
  621. typedef XERRORPACK *PXERRORPACK;
  622.  
  623.  
  624. /* ************************************************************************
  625.  *
  626.  * Error codes
  627.  *
  628.  * ************************************************************************/
  629.  
  630. #define EXB_NOT_ENOUGH_MEMORY   8  /* cannot get memory requested */
  631. #define EXB_INVALID_DRIVE       15 /* not a valid drive letter */
  632. #define EXB_UNEXPECTED_EOF      38 /* unexpect EOF (bytes read != bytes asked) */
  633. #define EXB_DISK_FULL           39 /* disk full on WriteFile */
  634. #define EXB_FILE_EXISTS         80 /* cannot create file since it already exists */
  635. #define EXB_SEM_OWNER_DIED      105 /* in place of Win32 error 80h (mutex) */
  636. #define EXB_TIMEOUT             640 /* in place of Win32 error 102h (mutex) */
  637.  
  638. /* Other operating system errors are as returned by OS itself */
  639.  
  640. /* System/general error codes */
  641.  
  642. #define EXB_OR_WITH_FAULTS      8192 /* 8192+1 to +4, close-type errors */
  643.  
  644.                                      /* ERR_216501/6 are for Bullet/x only */
  645. #define EXB_216501              8251 /* INT21/6501h not supported by DOS extender */
  646.                                      /* (do not use default cc/cp) */
  647. #define EXB_216506              8256 /* INT21/6506h not supported by DOS extender */
  648.                                      /* (provide a custom collate table) */
  649.  
  650. #define EXB_ILLEGAL_CMD         8300 /* function not allowed */
  651. #define EXB_OLD_DOS             8301 /* OS version < MIN_DOS_NEEDED */
  652. #define EXB_NOT_INITIALIZED     8302 /* init not active, must do INIT_XB */
  653. #define EXB_ALREADY_INITIALIZED 8303 /* init already active, must do EXIT_XB */
  654. #define EXB_TOO_MANY_HANDLES    8304 /* more than 1024 opens requested */
  655. #define EXB_SYSTEM_HANDLE       8305 /* Bullet won't use or close handles 0-2 */
  656. #define EXB_FILE_NOT_OPEN       8306 /* file not open (not Bullet handle, including xbLink) */
  657. #define EXB_FILE_IS_DIRTY       8307 /* tried to reload header but current still dirty */
  658. #define EXB_BAD_FILETYPE        8308 /* tried key op on non-key file, data op on non... */
  659. #define EXB_TOO_MANY_PACKS      8309 /* too many INSERT,UPDATE,REINDEX,LOCK_XB packs */
  660. #define EXB_NULL_RECPTR         8310 /* null record pointer passed to Bullet */
  661. #define EXB_NULL_KEYPTR         8311 /* null key pointer passed to Bullet */
  662. #define EXB_NULL_MEMOPTR        8312 /* null memo pointer passed to Bullet */
  663. #define EXB_EXPIRED             8313 /* evaluation time period has expired */
  664. #define EXB_BAD_INDEX           8314 /* Query/SetSysVars index beyond last one */
  665. #define EXB_RO_INDEX            8315 /* SetSysVar index item is read-only */
  666. #define EXB_FILE_BOUNDS         8316 /* file size > 4GB, or > system var sets */
  667. #define EXB_FORCE_ROLLBACK      8397 /* rollback test completed (internal use) */
  668. #define EXB_INVALID_DLL         8398 /* DLL seems to be invalid, 8399 same */
  669.  
  670. /* Multi-access error codes */
  671.  
  672. #define EXB_BAD_LOCK_MODE       8401 /* lock mode (LP) not valid */
  673. #define EXB_NOTHING_TO_RELOCK   8402 /* cannot relock without existing full-lock */
  674. #define EXB_SHARED_LOCK_ON      8403 /* write access needed but lock is shared (flush on backup) */
  675.  
  676. /* Index error codes */
  677.  
  678. #define EXB_KEY_NOT_FOUND       8501 /* exact match of key not found */
  679. #define EXB_KEY_EXISTS          8502 /* key exists already and dups not allowed */
  680. #define EXB_END_OF_FILE         8503 /* already at last index order */
  681. #define EXB_TOP_OF_FILE         8504 /* already at first index order */
  682. #define EXB_EMPTY_FILE          8505 /* nothing to do since no keys */
  683. #define EXB_CANNOT_GET_LAST     8506 /* cannot locate last key */
  684. #define EXB_BAD_INDEX_STACK     8507 /* index file is corrupt */
  685. #define EXB_BAD_INDEX_READ0     8508 /* index file is corrupt */
  686. #define EXB_BAD_INDEX_WRITE0    8509 /* index file is corrupt */
  687.  
  688. #define EXB_OLD_INDEX           8521 /* old index, run through ReindexOld to update */
  689. #define EXB_UNKNOWN_INDEX       8522 /* not a Bullet index file */
  690. #define EXB_KEY_TOO_LONG        8523 /* keylength > 62 (or 64 if unique), or is 0 */
  691.  
  692. #define EXB_PARSER_NULL         8531 /* parser function pointer is NULL */
  693. #define EXB_BUILDER_NULL        8532 /* build key function pointer is NULL */
  694. #define EXB_BAD_SORT_FUNC       8533 /* CIP.sortFunction not valid */
  695. #define EXB_BAD_NODE_SIZE       8534 /* CIP.nodeSize is not 512, 1024, or 2048 */
  696. #define EXB_FILENAME_TOO_LONG   8535 /* CIP.filenamePtr->pathname > max path length */
  697.  
  698. #define EXB_KEYX_NULL           8541 /* expression is effectively NULL */
  699. #define EXB_KEYX_TOO_LONG       8542 /* CIP.keyExpPtr->expression > 159 */
  700. #define EXB_KEYX_SYM_TOO_LONG   8543 /* fieldname/funcname in expression > 10 chars */
  701. #define EXB_KEYX_SYM_UNKNOWN    8544 /* fieldname/funcname in expression unknown */
  702. #define EXB_KEYX_TOO_MANY_SYMS  8545 /* too many symbols/fields used in expression */
  703. #define EXB_KEYX_BAD_SUBSTR     8546 /* invalid SUBSTR() operand in expression */
  704. #define EXB_KEYX_BAD_SUBSTR_SZ  8547 /* SUBSTR() exceeds field's size */
  705. #define EXB_KEYX_BAD_FORM       8548 /* didn't match expected symbol in expression */
  706.  
  707. #define EXB_NO_READS_FOR_RUN    8551 /* unlikely, use different reindex buffer size */
  708. #define EXB_TOO_MANY_RUNS       8552 /* unlikely, too many runs (64K or more runs) */
  709. #define EXB_TOO_MANY_RUNS_FOR_BUFFER 8553 /* unlikely, too many runs for run buffer */
  710. #define EXB_TOO_MANY_DUPLICATES 8554 /* more than 64K "identical" keys */
  711.  
  712. #define EXB_INSERT_RECNO_BAD    8561 /* AP.recNo cannot be > 0 if inserting */
  713. #define EXB_PREV_APPEND_EMPTY   8562 /* no prev append for insert yet AP.recNo==80000000h */
  714. #define EXB_PREV_APPEND_MISMATCH 8563 /* prev append's xbLink does not match this */
  715. #define EXB_INSERT_KBO_FAILED   8564 /* could not back out key at INSERT_XB */
  716. #define EXB_INSERT_DBO_FAILED   8565 /* could not back out data records at INSERT_XB */
  717.  
  718. #define WRN_NOTHING_TO_UPDATE   8571 /* all AP.recNo=0 at UPDATE_XB */
  719. #define EXB_INTERNAL_UPDATE     8572 /* internal error UPDATE_XB, not in hdl/rec# list */
  720.  
  721. #define EXB_FAILED_DATA_RESTORE 8573 /* could not restore original data record (*) */
  722. #define EXB_FAILED_KEY_DELETE   8574 /* could not remove new key (*) */
  723. #define EXB_FAILED_KEY_RESTORE  8575 /* could not restore original key(*) */
  724. /* *original error, which forced a back-out, has been replaced by this error */ 
  725. /* this error is always returned in the first AP.stat (-1 on data, 1 on index) */
  726.  
  727. /* Data error codes */
  728.  
  729. #define EXB_EXT_XBLINK          8601 /* xbLink handle is not internal DBF (is -1) */
  730. #define EXB_FIELDNAME_TOO_LONG  8602 /* fieldname is > 10 characters */
  731. #define EXB_RECORD_TOO_LONG     8603 /* record length is > 64K */
  732. #define EXB_FIELD_NOT_FOUND     8604 /* fieldname not found in descriptor info */
  733. #define EXB_BAD_FIELD_COUNT     8605 /* fields <= 0 or >= MAX_FIELDS (Init,Open) */
  734.                                      /* and also GetDescriptor by field number */
  735. #define EXB_BAD_HEADER          8606 /* bad header (reclen=0, etc., from LocateTo, Flush) */
  736. #define EXB_BUFFER_TOO_SMALL    8607 /* buffer too small (pack buffer < reclen in pack) */
  737. #define EXB_INTERNAL_PACK       8608 /* internal error in PackRecords */
  738. #define EXB_BAD_RECNO           8609 /* record number=0 or > records in data file hdr */
  739.                                      /* or Pack on empty data file */
  740. #define WRN_RECORD_TAGGED       8610 /* record's tag field matches skip tag */
  741.  
  742. /* Memo error codes */
  743.  
  744. #define WRN_CANNOT_OPEN_MEMO    8701 /* DBF says memo file but memo open fails */
  745. #define EXB_MEMO_NOT_OPEN       8702 /* no open memo file for operation */
  746. #define EXB_BAD_BLOCKSIZE       8703 /* memo blocksize must be at least 24 bytes */
  747. #define EXB_MEMO_DELETED        8704 /* memo is deleted */
  748. #define EXB_MEMO_PAST_END       8705 /* memo data requested is past end of record */
  749. #define EXB_BAD_MEMONO          8706 /* memo number is not valid */
  750. #define EXB_MEMO_IN_USE         8707 /* memo add encountered likely corrupt memo file */
  751. #define EXB_BAD_AVAIL_LINK      8708 /* memo avail link cannot be valid (is 0) */
  752. #define EXB_MEMO_ZERO_SIZE      8709 /* memo data has no size */
  753. #define EXB_MEMO_IS_SMALLER     8710 /* memo attempt to shrink but already <= size */
  754.  
  755. #endif /* ifndef __BULLET_H */
  756.