home *** CD-ROM | disk | FTP | other *** search
/ Datatid 1999 #6 / Datatid_1999-06.iso / internet / Tango352Promo / P.SQL / PTKPKG.1 / BTRAPI.H < prev    next >
Encoding:
C/C++ Source or Header  |  1998-12-08  |  11.9 KB  |  307 lines

  1. #ifndef _BTRAPI_H_INCLUDED
  2. /*************************************************************************
  3. **
  4. **  Copyright 1982-1998 Pervasive Software Inc. All Rights Reserved
  5. **
  6. *************************************************************************/
  7. /***************************************************************************
  8.  BTRAPI.H
  9.     This file contains prototypes for the DOS, Extended DOS, MS Windows,
  10.     MS Windows NT, MS Windows 95, OS2, NLM, and Unix Btrieve call.   The
  11.     calling application may be C or C++.
  12.  
  13.     You must define one of the following to your compiler in order to
  14.     compile for a particular platform:
  15.  
  16.         BTI_DOS     - DOS                                     16-bit Apps
  17.         BTI_DOS_32R - Extended DOS with Rational + bstub.exe  32-bit Apps
  18.         BTI_DOS_32P - Extended DOS with Phar Lap 6.0          32-bit Apps
  19.         BTI_DOS_32B - Extended DOS with Borland PowerPack     32-bit Apps
  20.         BTI_DOS_16B - Extended DOS with Borland PowerPack     16-bit Apps
  21.         BTI_WIN     - MS WINDOWS                              16-bit Apps
  22.         BTI_WIN_32  - Windows NT and Windows 95               32-bit Apps
  23.         BTI_OS2     - OS2                                     16-bit Apps
  24.         BTI_OS2_32  - OS2                                     32-bit Apps
  25.         BTI_NLM     - NetWare NLM                             32-bit Apps
  26.         BTI_SQL     - For 32-Bit OS2 SSQL Apps
  27.         BTI_SOL     - Solaris                                 32-bit Apps
  28.         BTI_HPUX    - HP Unix
  29.         BTI_AIX     - IBM Aix
  30.         BTI_IRIX    - Irix
  31.         BTI_DEC_UNIX  - DEC Unix
  32.  
  33.     If you do not specify one of the above switches to your compiler,
  34.     an error directive will halt the compilation.
  35.  
  36.     Modules are:
  37.       btrapi.c     - compile and link with all apps except NLMs
  38.       btrsamp.c    - sample program which can be compiled for any platform
  39.       btitypes.h   - platform-independent data types
  40.       blobhdr.h    - used by apps which use BTI_DOS_32B or BTI_DOS_32P
  41.       btrapi.h     - included by all apps
  42.       btrconst.h   - Btrieve constants
  43.       bmemcopy.obj - used by apps which use BTI_DOS_32B or BTI_DOS_32P
  44.       w3btrv7.lib  - used by 32-bit apps; versions are provided for
  45.                      Microsoft Visual C++ apps ("COFF" format) and
  46.                      Borland, Watcom, and other compilers ( see NT note
  47.                      below )
  48.  
  49.     Except for DOS or Extended DOS, the Btrieve application developer will
  50.     also need either an import library or linker import statements to
  51.     identify the imported Btrieve functions to the linker.  The imported
  52.     functions are:
  53.  
  54.       MS Windows
  55.       ----------
  56.       W1BTRV7.LIB  - WBTRVINIT, WBRQSHELLINIT, WBTRVSTOP, BTRCALL,
  57.                      BTRCALLID, BTRCALLBACK, RQSHELLINIT
  58.       NT and WIN95
  59.       -------------
  60.       W3BTRV7.LIB - WBTRVINIT, WBRQSHELLINIT, WBTRVSTOP, BTRCALL,
  61.                     BTRCALLID, BTRCALLBACK, RQSHELLINIT ( see NT note below )
  62.  
  63.       OS2
  64.       ---
  65.       O3BTRV7.LIB - BTRVINIT,  BRQSHELLINIT,  BTRVSTOP,  BTRCALL
  66.  
  67.       NLM
  68.       ---
  69.       Use linker import statements - btrv, btrvID
  70.  
  71.       Unix
  72.       -------
  73.       RDA - Tbd
  74.  
  75.     You will need to compile and link 'btrapi.c' if you call any of
  76.     the following functions from the indicated platforms:
  77.           BTRV .......... MS Windows, OS2, DOS
  78.           BTRVID ........ MS Windows, OS2, DOS
  79.           RQSHELLINIT ... MS Windows
  80.  
  81.     For 32-Bit DOS Rational Applications Using Bstub
  82.     ------------------------------------------------
  83.     If you are using the Rational Systems DOS Extender, DOS4G.EXE, along
  84.     with BSTUB.EXE, you will need to define the plaform switch,
  85.     BTI_DOS_32R to your compiler.  You also must link your application
  86.     using the Rational linker, GLU.EXE.  You MUST have a '.def' file
  87.     similar to the following which is used to create a 32-bit btrsamp.exe:
  88.  
  89.          btrsamp.def
  90.          -----------
  91.             LIBRARY btrsamp.dll
  92.             DATA NONSHARED
  93.             EXPORTS
  94.                __ImportedFunctions_
  95.  
  96.     The module, btrapi.c, requires '__ImportedFunctions_' as shown in
  97.     the above btrsamp.def.  This allows btrapi.c to call a function
  98.     in Btrieve without using int386.
  99.  
  100.     Depending on your compiler's naming conventions, you may need to
  101.     add a leading underscore to '_ImportedFunctions' at 3 locations in
  102.     btrapi.c.  For example, when you compile with WATCOM using register-based
  103.     parameter-passing, no change to '_ImportedFunctions' is needed.  But
  104.     if you compile using stack-based parameter-passing, you will need to
  105.     change '_ImportedFunctions' to '__ImportedFunctions' in btrapi.c.  We
  106.     could have added compiler predefined macros to btrapi.c to handle
  107.     this naming problem for you, except we were not assured of the
  108.     predefined macros being present in all cases.
  109.  
  110.     The following is the GLU '.lnk' file for sqlsamp.exe using WATCOM
  111.     libraries:
  112.  
  113.           btrsamp.lnk
  114.           -----------
  115.             btrsamp.obj
  116.             btrapi.obj
  117.             -format lin -stack 40000 -dbg -stub bstub.exe
  118.             e(btrsamp)
  119.             m(btrsamp)
  120.             dos32wc.lib
  121.             clib3r.lib
  122.             math3r.lib
  123.             math387r.lib
  124.             emu387.lib
  125.  
  126.     You invoke GLU.EXE as follows:
  127.  
  128.             glu -deffile btrsamp.def @btrsamp.lnk
  129.  
  130.  
  131.     For 32-Bit Borland PowerPack and Phar Lap DOS Applications
  132.     -----------------------------------------------------------
  133.     You must link 'bmemcopy.obj' with your application.
  134.  
  135.    For 32-Bit NT, Win95, and Win32s Applications
  136.    ---------------------------------------------
  137.    - If using WATCOM, you must use version 10.5 or later.  Earlier versions
  138.      do not understand the format of the import library, w3btrv7.lib.
  139.  
  140.    - If you are using a compiler that complains that w3btrv7.lib has
  141.      an invalid format, you will need to get a version of that compiler that
  142.      understands the 'coff' format used by Microsoft Visual C++.
  143.  
  144.  
  145. ***************************************************************************/
  146. #if !defined(BTI_WIN)     && !defined(BTI_OS2)     && !defined(BTI_DOS) && \
  147.     !defined(BTI_NLM)     && !defined(BTI_DOS_32R) && !defined(BTI_DOS_32P) && \
  148.     !defined(BTI_DOS_32B) && !defined(BTI_WIN_32)  && !defined(BTI_OS2_32) && \
  149.     !defined(BTI_DOS_16B) && !defined(BTI_SOL)     && !defined(BTI_HPUX) && \
  150.     !defined(BTI_AIX)     && !defined(BTI_IRIX)    && !defined(BTI_DEC_UNIX)
  151. #error You must define one of the following: BTI_WIN, BTI_OS2, BTI_DOS, BTI_NLM, BTI_DOS_32R, BTI_DOS_32P, BTI_DOS_32B, BTI_WIN_32, BTI_OS2_32, BTI_DOS_16B, BTI_SOL, BTI_HPUX, BTI_AIX, BTI_IRIX, BTI_DEC_UNIX
  152. #endif
  153.  
  154. #include <btitypes.h>
  155.  
  156. #ifdef __cplusplus
  157. extern "C" {
  158. #endif
  159.  
  160. /***************************************************************************
  161.    PLATFORM-INDEPENDENT FUNCTIONS
  162.      These APIs are the same on all platforms for which they have
  163.      an implementation.  We recommend that you use only these two
  164.      functions with Btrieve 6.x client components, and then issue the
  165.      B_STOP operation prior to exiting your application.
  166. ****************************************************************************/
  167. BTI_API BTRV(
  168.            BTI_WORD     operation,
  169.            BTI_VOID_PTR posBlock,
  170.            BTI_VOID_PTR dataBuffer,
  171.            BTI_WORD_PTR dataLength,
  172.            BTI_VOID_PTR keyBuffer,
  173.            BTI_SINT     keyNumber );
  174.  
  175. BTI_API BTRVID(
  176.            BTI_WORD       operation,
  177.            BTI_VOID_PTR   posBlock,
  178.            BTI_VOID_PTR   dataBuffer,
  179.            BTI_WORD_PTR   dataLength,
  180.            BTI_VOID_PTR   keyBuffer,
  181.            BTI_SINT       keyNumber,
  182.            BTI_BUFFER_PTR clientID );
  183.  
  184. /***************************************************************************
  185.    PLATFORM-SPECIFIC FUNCTIONS
  186.       These APIs are specific to the indicated platform.  With the
  187.       exception of BTRCALLBACK, we recommend that you use either
  188.       BTRV or BTRVID, shown above.  Slight performance gains can be
  189.       achieved by using BTRCALL or BTRCALLID.
  190. ****************************************************************************/
  191. #if defined( BTI_NLM )
  192. BTI_API btrv(
  193.            BTI_WORD     operation,
  194.            BTI_VOID_PTR posBlock,
  195.            BTI_VOID_PTR dataBuffer,
  196.            BTI_WORD_PTR dataLength,
  197.            BTI_VOID_PTR keyBuffer,
  198.            BTI_SINT     keyNumber );
  199. #define BTRV( a, b, c, d, e, f )  btrv( a, b, c, d, e, f )
  200.  
  201. BTI_API btrvID(
  202.            BTI_WORD       operation,
  203.            BTI_VOID_PTR   posBlock,
  204.            BTI_VOID_PTR   dataBuffer,
  205.            BTI_WORD_PTR   dataLength,
  206.            BTI_VOID_PTR   keyBuffer,
  207.            BTI_SINT       keyNumber,
  208.            BTI_BUFFER_PTR clientID );
  209. #define BTRVID( a, b, c, d, e, f, g )  btrvID( a, b, c, d, e, f, g )
  210. #endif
  211.  
  212. #if defined( BTI_WIN ) || defined( BTI_OS2 )
  213. BTI_API BTRCALL(
  214.            BTI_WORD     operation,
  215.            BTI_VOID_PTR posBlock,
  216.            BTI_VOID_PTR dataBuffer,
  217.            BTI_WORD_PTR dataLength,
  218.            BTI_VOID_PTR keyBuffer,
  219.            BTI_BYTE     keyLength,
  220.            BTI_CHAR     ckeynum );
  221.  
  222. BTI_API BTRCALLID(
  223.            BTI_WORD       operation,
  224.            BTI_VOID_PTR   posBlock,
  225.            BTI_VOID_PTR   dataBuffer,
  226.            BTI_WORD_PTR   dataLength,
  227.            BTI_VOID_PTR   keyBuffer,
  228.            BTI_BYTE       keyLength,
  229.            BTI_CHAR       ckeynum,
  230.            BTI_BUFFER_PTR clientID );
  231. #endif
  232.  
  233. #if defined( BTI_WIN_32) || defined( BTI_OS2_32 ) || defined( BTI_SOL ) || \
  234.     defined( BTI_HPUX) || defined( BTI_AIX ) || defined( BTI_IRIX ) || \
  235.     defined( BTI_DEC_UNIX)
  236. #if defined( BTI_OS2_32 )
  237. #define BTRCALL   BTRCALL32
  238. #define BTRCALLID BTRCALLID32
  239. #endif
  240. BTI_API BTRCALL(
  241.            BTI_WORD      operation,
  242.            BTI_VOID_PTR  posBlock,
  243.            BTI_VOID_PTR  dataBuffer,
  244.            BTI_ULONG_PTR dataLength,
  245.            BTI_VOID_PTR  keyBuffer,
  246.            BTI_BYTE      keyLength,
  247.            BTI_CHAR      ckeynum );
  248.  
  249. BTI_API BTRCALLID(
  250.            BTI_WORD       operation,
  251.            BTI_VOID_PTR   posBlock,
  252.            BTI_VOID_PTR   dataBuffer,
  253.            BTI_ULONG_PTR  dataLength,
  254.            BTI_VOID_PTR   keyBuffer,
  255.            BTI_BYTE       keyLength,
  256.            BTI_CHAR       ckeynum,
  257.            BTI_BUFFER_PTR clientID );
  258. #endif
  259.  
  260. #if defined( BTI_WIN ) || defined( BTI_WIN_32 )
  261. BTI_API BTRCallback(
  262.            BTI_WORD                   iAction,
  263.            BTI_WORD                   iOption,
  264.            BTI_CB_FUNC_PTR_T          fCallBackFunction,
  265.            BTI_CB_FUNC_PTR_T BTI_FAR *fPreviousCallBackFunction,
  266.            BTI_VOID_PTR               bUserData,
  267.            BTI_VOID_PTR BTI_FAR      *bPreviousUserData,
  268.            BTI_BUFFER_PTR             bClientID );
  269. #endif
  270.  
  271.  
  272. /***************************************************************************
  273.    HISTORICAL FUNCTIONS
  274.       These APIs were needed prior to Btrieve 6.x client
  275.       components.  Older applications may still call these functions,
  276.       and the Btrieve 6.x client component will do the appropriate
  277.       thing, depending on the platform.  New applications using the
  278.       6.x client components do NOT have to call these functions.
  279. ****************************************************************************/
  280. #if defined( BTI_WIN ) || defined( BTI_WIN_32 )
  281. #define BTRVINIT WBTRVINIT
  282. #define BTRVSTOP WBTRVSTOP
  283. BTI_API WBTRVINIT( BTI_CHAR_PTR option );
  284. BTI_API WBRQSHELLINIT( BTI_CHAR_PTR option );
  285. BTI_API WBTRVSTOP( BTI_VOID );
  286. BTI_API RQSHELLINIT( BTI_CHAR_PTR options );
  287. #endif
  288.  
  289. #if defined( BTI_OS2 )
  290. BTI_API BTRVINIT( BTI_CHAR_PTR options );
  291. BTI_API BTRVSTOP( BTI_VOID );
  292. BTI_API BRQSHELLINIT( BTI_VOID );
  293. #endif
  294.  
  295. #if defined( BTI_OS2_32 )
  296. BTI_API BTRVINIT32( BTI_CHAR_PTR options );
  297. BTI_API BTRVSTOP32( BTI_VOID );
  298. BTI_API BRQSHELLINIT32( BTI_VOID );
  299. #endif
  300.  
  301. #ifdef __cplusplus
  302. }
  303. #endif
  304.  
  305. #define _BTRAPI_H_INCLUDED
  306. #endif
  307.