⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bullet_2.h

📁 支持Xbase DBF格式的一套函数库的程序
💻 H
📖 第 1 页 / 共 3 页
字号:

/* BULLET_2.H    18-Nov-96-chh
 *
 *  Bullet header for 32-bit C/C++ (DOSX32, OS/2, and Win32s/Win32)
 *  Bullet call numbers, parameter packs, and error number equates
 *
 *  Requires PLATFORM defined and set to ON_DOSX32 (3), ON_OS2 (4),
 *  or ON_WIN32 (5) before getting here.  For example:
 *    #define PLATFORM ON_DOSX32  (ON_DOSX32 defined as 3)
 *
 */

#ifndef __BULLET_H
#define __BULLET_H

/*
 * The #pragma pack(1)/#pragma pack() is no longer required since all
 * structure members in this header will align properly -- all are
 * 32-bit size except for the structure "FieldDescType", but fieldDA
 * member (a LONG) is at a 32-bit alignment already (at byte offset +12).
 * The altFieldLength member, same structure, is also already at
 * proper alignment for a 16-bit value (at byte offset +18).  If, for
 * some reason, your compiler aligns the members differently, then you
 * must use the appropriate compiler pragma to prevent this -- the
 * FieldDescType size is 32 bytes exactly.  It is not likely that any
 * conforming compiler will alter this structure, but, now you know what
 * to do if it does.
 *
 * #pragma pack(1)
 *
 * NOTE: In your program source code, when you layout your record buffer
 * structure, you must use the #pragma pack(1)/#pragma pack() directives
 * around it since it will be, most likely, modified.  The reason is that
 * this structure MUST start with the implicit TAG field (a BYTE), and so,
 * unless you use only BYTE/CHAR members in your structure (Bullet can use
 * binary field values), or take special care to align the record layout
 * so no padding is performed by the compiler, then you will need to use
 * the pack(1) pragma.
 *
 * #pragma pack()
 */

/* Re: Bullet/X for DOSX32:
 * (refer to ccdosfn.c for more)
 * Bullet ccdosfn.c provides no OS call support to determine the
 * system country code and code page ID.  This can be coded in
 * ccdosfn.c, but it is quite compiler- and extender-dependent.
 * The current state is to supply a collate sequence table for
 * country code=1 and code page=437 (the table is statically coded).
 * For other sort tables, modify as required.  If support for this
 * at the system level is made available at run-time, you may
 * want to change the following to 0, for both CTRYCODE and CODEPAGE.
 * Until this is so coded, you cannot use 0 here (as with the Win32
 * and OS/2 versions), else error EXB_216501 (8251) is the result.
 * This table is added to each index file (if NLS or a user sort).
 */

#ifndef PLATFORM
 #error No PLATFORM specified
 #error ---------------------
#endif

#ifndef ON_DOSX32
 #define ON_DOSX32 3
 #define ON_OS2    4
 #define ON_WIN32  5
#endif

#if PLATFORM == ON_DOSX32
 #define CTRYCODE 1     /* 0 signifies default country code (at index create) */
 #define CODEPAGE 437   /* 0 signifies default code page (at index create) */
                        /* but DOS extender may not support OS call to get info */
                        /* see ccdosfn.c for making changes for DOSX32 platform */
 #define RELOCK_AVAIL 0 /* relock not supported */

 #define VOID void      /* these are already defined if Win32 or OS/2, but not DOS */
 #define SHORT short
 #define LONG long
 #define CHAR char

 typedef unsigned char BYTE;
 typedef unsigned short USHORT;
 typedef unsigned long ULONG;
 typedef unsigned char *PSZ;
 typedef VOID *PVOID;

 #define APIENTRY __cdecl

#elif PLATFORM == ON_OS2
 #define CTRYCODE 0
 #define CODEPAGE 0
 #define RELOCK_AVAIL 1    /* relock is supported */

 /* above types are assumed defined in os2def.h */

#elif PLATFORM == ON_WIN32
 #define CTRYCODE 0
 #define CODEPAGE 0     /* may be ANSI or OEM code page value, depending on USE*CHARSET flag */
 #define RELOCK_AVAIL 0 /* relock not supported */
 
 /* above types are assume defined in windef.h and winnt.h */

#else
 #error No PLATFORM specified
 #error ---------------------

#endif

#ifndef __BLT_DYNA    // define this if using run-time loading of BULLET*.DLL
                      // via LoadLibrary(Win32) or DosLoadModule(OS/2)
 #ifdef __cplusplus
  extern "C" LONG APIENTRY BULLET(PVOID datapack);
 #else
  extern LONG APIENTRY BULLET(PVOID datapack);
 #endif

#else

  LONG (* APIENTRY BULLET)(PVOID datapack);

#endif



/* The following on mutex-semaphore protection does not apply to Bullet/X */
/* unless the semaphore routines (in ccdosfn.c) are coded to do something */

/* All Bullet routines are mutex-semaphore protected except the following:
 *
 * MEMORY_XB            STAT_HANDLE_XB          GET_ERROR_CLASS_XB
 * QUERY_SYSVARS_XB     QUERY_VECTORS_XB        CHECK_REMOTE_XB
 * STAT_DATA_XB         STAT_INDEX_XB
 *
 * This means that any thread can call the above routines at any time.  All
 * other calls in the current process block until the previous thread exits 
 * BULLET.  The default mutex wait is 0 milliseconds, and can be set via 
 * SET_SYSVARS_XB using the MUTEX_SEM_TIMEOUT index.  In the case of
 * STAT_DATA_XB and STAT_INDEX_XB, these should be used only when there
 * is no chance that another thread may close that file handle while the
 * routine is working.
 *
 */



/* ************************************************************************
 *
 * xxx.func call numbers
 *
 * ************************************************************************/

#define GEN_ERR_XB              0
#define INIT_XB                 1  /* system */
#define EXIT_XB                 2
#define MEMORY_XB               4
#define BACKUP_FILE_XB          6
#define STAT_HANDLE_XB          7
#define GET_ERROR_CLASS_XB      8

#define QUERY_SYSVARS_XB        10 /* advanced system */
#define SET_SYSVARS_XB          11
#define SET_DVMON_XB            12 /* reserved */
#define QUERY_VECTORS_XB        13
#define SET_VECTORS_XB          14

#define CREATE_DATA_XB          20 /* data control mid-level */
#define OPEN_DATA_XB            21
#define CLOSE_DATA_XB           22
#define STAT_DATA_XB            23
#define READ_DATA_HEADER_XB     24
#define FLUSH_DATA_HEADER_XB    25
#define COPY_DATA_HEADER_XB     26
#define ZAP_DATA_HEADER_XB      27

#define CREATE_INDEX_XB         30 /* key control mid-level */
#define OPEN_INDEX_XB           31
#define CLOSE_INDEX_XB          32
#define STAT_INDEX_XB           33
#define READ_INDEX_HEADER_XB    34
#define FLUSH_INDEX_HEADER_XB   35
#define COPY_INDEX_HEADER_XB    36
#define ZAP_INDEX_HEADER_XB     37

#define GET_DESCRIPTOR_XB       40 /* data access mid-level */
#define GET_RECORD_XB           41
#define ADD_RECORD_XB           42
#define UPDATE_RECORD_XB        43
#define DELETE_RECORD_XB        44
#define UNDELETE_RECORD_XB      45
#define DEBUMP_RECORD_XB        46
#define PACK_RECORDS_XB         47

#define GET_MEMO_SIZE_XB        50 /* memo access mid-level */
#define GET_MEMO_XB             51
#define ADD_MEMO_XB             52
#define UPDATE_MEMO_XB          53
#define DELETE_MEMO_XB          54
#define MEMO_BYPASS_XB          59 /* see below for bypass ordinals */

#define BYPASS_CREATE_MEMO       1 /* The bypass routines are automatically */
#define BYPASS_OPEN_MEMO         2 /* performed by BULLET but can be done */
#define BYPASS_CLOSE_MEMO        3 /* manually, if needed - these numbers are */
#define BYPASS_READ_MEMO_HEADER  4 /* put in MDP.memoBypass, with MDP.func */
#define BYPASS_FLUSH_MEMO_HEADER 5 /* set to MEMO_BYPASS_XB */

#define FIRST_KEY_XB            60 /* key access mid-level */
#define EQUAL_KEY_XB            61
#define NEXT_KEY_XB             62
#define PREV_KEY_XB             63
#define LAST_KEY_XB             64
#define STORE_KEY_XB            65
#define DELETE_KEY_XB           66
#define BUILD_KEY_XB            67
#define GET_CURRENT_KEY_XB      68
#define GET_KEY_FOR_RECORD_XB   69

#define GET_FIRST_XB            70 /* key and data access high-level */
#define GET_EQUAL_XB            71
#define GET_NEXT_XB             72
#define GET_PREV_XB             73
#define GET_LAST_XB             74
#define INSERT_XB               75
#define UPDATE_XB               76
#define REINDEX_XB              77

#define LOCK_XB                 80 /* network control */
#define UNLOCK_XB               81
#define LOCK_INDEX_XB           82
#define UNLOCK_INDEX_XB         83
#define LOCK_DATA_XB            84
#define UNLOCK_DATA_XB          85
#define CHECK_REMOTE_XB         86
#define RELOCK_XB               87
#define RELOCK_INDEX_XB         88
#define RELOCK_DATA_XB          89

#define DELETE_FILE_DOS         90 /* DOS file I/O low-level */
#define RENAME_FILE_DOS         91
#define CREATE_FILE_DOS         92
#define OPEN_FILE_DOS           93
#define SEEK_FILE_DOS           94
#define READ_FILE_DOS           95
#define WRITE_FILE_DOS          96
#define CLOSE_FILE_DOS          97
#define ACCESS_FILE_DOS         98
#define EXPAND_FILE_DOS         99
#define MAKE_DIR_DOS            100
#define COMMIT_FILE_DOS         101

/* ************************************************************************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -