home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / blt2rx_o.zip / c_src.zip / bullet_2.h < prev    next >
C/C++ Source or Header  |  1996-10-12  |  32KB  |  743 lines

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