home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / database / softc210 / headers / softc.h < prev   
Encoding:
C/C++ Source or Header  |  1991-05-22  |  13.3 KB  |  481 lines

  1. /*************************************************
  2.  **                                             **
  3.  **   softc.h                                   **
  4.  **                                             **
  5.  **       SoftC common library header           **
  6.  **                                             **
  7.  **       Copyright (C) 1988, 1989, 1990 by     **
  8.  **               SoftC, Ltd.                   **
  9.  **               16820 Third Street NE         **
  10.  **               Ham Lake, MN 55304            **
  11.  **               (612) 434-6968                **
  12.  **                                             **
  13.  **             All rights reserved.            **
  14.  *************************************************/
  15.  
  16.  
  17. #ifndef __SOFTC_H__
  18. #define __SOFTC_H__
  19.  
  20. /**********
  21.  *
  22.  *  Function Return Codes
  23.  *
  24.  **********/
  25.  
  26.  
  27.  
  28.  
  29. #define SC_KEYPRSNT   11        /* WARNING - key already present in file */
  30. #define SC_NOFUNC     10    /* WARNING - function not supported */
  31. #define SC_MEMWRN     9     /* WARNING - partial memory allocation */
  32. #define SC_NOTBFRD    8     /* WARNING - file I/O not buffered */
  33. #define SC_FILENGTH   7     /* WARNING - file length is incorrect */
  34. #define SC_FLDROUND   6     /* WARNING - numeric field rounded */
  35. #define SC_FLDTRUNC   5     /* WARNING - data field truncated */
  36. #define SC_NOFIND     4     /* WARNING - could not find key in index file */
  37. #define SC_END        3     /* WARNING - no more keys */
  38. #define SC_EMPTY      2     /* WARNING - file is empty */
  39. #define SC_DELREC     1     /* WARNING - record read is marked deleted */
  40. #define SC_SUCCESS    0     /* successful function return code */
  41. #define SC_WRTFAIL    -1    /* ERROR - file write failure */
  42. #define SC_RDFAIL     -2    /* ERROR - file read failure */
  43. #define SC_MEMERR     -3    /* ERROR - memory allocation error */
  44. #define SC_SKFAIL     -4    /* ERROR - file pointer reposition failed */
  45. #define SC_NOFILE     -5    /* ERROR - file not found */
  46. #define SC_FILBAD     -6    /* ERROR - file corrupted */
  47. #define SC_BADEXPR    -7    /* ERROR - bad user specified key expression */
  48. #define SC_NOHNDL     -8    /* ERROR - no handles available */
  49. #define SC_NOPGS      -9    /* ERROR - no index pages loaded */
  50. #define SC_BADPG      -10   /* ERROR - index page was not loaded */
  51. #define SC_CLOSFAIL   -11   /* ERROR - file close failure */
  52. #define SC_BADCMD     -12   /* ERROR - invalid command */
  53. #define SC_BADHNDL    -13   /* ERROR - invalid handle number */
  54. #define SC_BADFNAME   -14   /* ERROR - invalid filename */
  55. #define SC_BADDATE    -15   /* ERROR - invalid date */
  56. #define SC_BADTIME    -16   /* ERROR - invalid time */
  57. #define SC_NODBT      -17   /* ERROR - file not in memo format */
  58. #define SC_NOFPT      -17
  59. #define SC_DBFVERS    -18   /* ERROR - invalid file version */
  60. #define SC_MDXVERS    -18
  61. #define SC_DBTVERS    -18
  62. #define SC_NTXVERS        -18
  63. #define SC_NDXVERS        -18
  64. #define SC_IDXVERS        -18
  65. #define SC_FPTVERS        -18
  66. #define SC_DBFHLEN    -19   /* ERROR - file header length error */
  67. #define SC_MDXHLEN    -19
  68. #define SC_DBFDATE    -20   /* ERROR - last file change date in error */
  69. #define SC_MDXDATE    -20
  70. #define SC_NULLPARM   -21   /* ERROR - parameter address NULL */
  71. #define SC_BADKEYT    -22   /* ERROR - invalid key type */
  72. #define SC_KEYLEN     -23   /* ERROR - invalid key length */
  73. #define SC_ITEMLEN    -24   /* ERROR - item length incorrect */
  74. #define SC_BADROOT    -25   /* ERROR - invalid root page */
  75. #define SC_MAXKEYS    -26   /* ERROR - bad maximum number of keys per page */
  76. #define SC_FLDCNT     -27   /* ERROR - invalid number of fields */
  77. #define SC_BADFLDN    -28   /* ERROR - field name invalid */
  78. #define SC_FLDLEN     -29   /* ERROR - bad field length */
  79. #define SC_DECPL      -30   /* ERROR - decimal places parameter invalid */
  80. #define SC_BADFLDT    -31   /* ERROR - invalid field type */
  81. #define SC_RECLEN     -32   /* ERROR - invalid record length */
  82. #define SC_BADDATA    -33   /* ERROR - bad data */
  83. #define SC_LINELEN    -34   /* ERROR - memo soft line length invalid */
  84. #define SC_MDXFLAG    -35   /* ERROR - MDX flag in DBF file invalid */
  85. #define SC_READOLY    -36   /* ERROR - file open for reading only */
  86. #define SC_LCKVIOL    -37   /* ERROR - file locking violation */
  87. #define SC_LCKBOVR    -38   /* ERROR - sharing buffer overflow */
  88. #define SC_NOPATH     -39   /* ERROR - path not found */
  89. #define SC_ACCDEN     -40   /* ERROR - access to file denied */
  90. #define SC_BADACC     -41   /* ERROR - invalid access code */
  91. #define SC_NOTLCKD    -42   /* ERROR - file must be locked first */
  92. #define SC_NEWDEV     -43   /* ERROR - diskette changed */
  93. #define SC_MINKEYS    -44   /* ERROR - bad minimum number of keys per page */
  94. #define SC_FILSOPEN   -45   /* ERROR - some files remain open */
  95. #define SC_OPENFAIL   -46   /* ERROR - could not open the file */
  96. #define SC_FLSHFAIL   -47   /* ERROR - flush to disk failure */
  97. #define SC_BADTAG     -48   /* ERROR - invalid tag handle */
  98. #define SC_BLKSZ      -49   /* ERROR - invalid page size in blocks */
  99. #define SC_BADTNAME   -50   /* ERROR - invalid tag name */
  100. #define SC_BLKADR     -51   /* ERROR - invalid page offset adder */
  101. #define SC_MAXTAGS    -52   /* ERROR - invalid maximum number of tag table elements */
  102. #define SC_TBLELEN    -53   /* ERROR - bad tag table element length */
  103. #define SC_TAGCNT     -54   /* ERROR - invalid tag count */
  104. #define SC_KEYFORM    -55   /* ERROR - unknown key format switches */
  105. #define SC_UNSWITCH   -56   /* ERROR - unknown switch error */
  106. #define SC_TAGOPEN    -57   /* ERROR - tag in use */
  107.  
  108.  
  109.  
  110.  
  111. /**********
  112.  *
  113.  *  Common Defines
  114.  *
  115.  **********/
  116.  
  117.  
  118.  
  119. #define SC_TRUE 1
  120. #define SC_FALSE 0
  121. #define CONST const
  122.  
  123. #ifdef __SCO_XS5__
  124. #undef CONST
  125. #define CONST
  126. #endif
  127.  
  128. /*
  129.  *  variable type definitions
  130.  */
  131. #define UCHAR unsigned char
  132. #define CHAR char
  133. #define USHORT unsigned short
  134. #define SHORT short
  135. #define UINT unsigned int
  136. #define INT int
  137. #define ULONG unsigned long
  138. #define LONG long
  139. #define SINGLE float
  140. #define DOUBLE double
  141. #define LDOUBLE long double
  142. #define VOID void
  143.  
  144.  
  145. #ifndef F_PTR
  146. #define F_PTR *
  147. #endif
  148.  
  149.  
  150. /* scdikfind, scdnkfind, scdckfind definitions */
  151. #define SC_FIRST 1                  /* find first key */
  152. #define SC_EXACT 2                  /* find exact key (uses record number) */
  153.  
  154. /* scdcopen, scddopen, scdiopen, scdnopen, scdtopen */
  155. #define SC_RDWR 0                   /* read/write access (default) */
  156. #define SC_RDONLY 0x100             /* read only access */
  157. #define SC_BUFFER 0                 /* buffer disk writes in memory (default) */
  158. #define SC_FLUSH 0x200              /* force all writes to disk */
  159. #define SC_EXCLUDE 0                /* open file for exclusive use (default) */
  160. #define SC_SHARED 0x400             /* open file for shared use */
  161.  
  162. /* scdcbfrsz, scddbfrsz, scdibfrsz, scdnbfrsz */
  163. #define SC_SETSZ 0                  /* set buffer size */
  164. #define SC_GETSZ 1                  /* get current buffer size */
  165.  
  166. /* scddrput, scdtrput */
  167. #define SC_UPDATE 0x100             /* update existing record */
  168. #define SC_ADD 0x200                /* append record at end of file */
  169.  
  170. /* scdccreate, scdicreate, scdncreate, scdmtnew */
  171. #define SC_DESCEND 0x100            /* descending key order */
  172. #define SC_UNIQUE 0x80              /* unique index keys */
  173. #define SC_CKEY 'C'                 /* character type key */
  174. #define SC_DKEY 'D'                 /* date type key */
  175. #define SC_LKEY 'L'                 /* logical key type */
  176. #define SC_NKEY 'N'                 /* numeric type key */
  177.  
  178. /* SoftC extended index file key types (scdncreate) */
  179. #define SC_DBLKEY 1                 /* DOUBLE key */
  180. #define SC_FLTKEY 2                 /* SINGLE key */
  181. #define SC_ULNGKEY 3                /* ULONG key */
  182. #define SC_LNGKEY 4                 /* LONG key */
  183. #define SC_USHTKEY 5                /* USHORT key */
  184. #define SC_SHTKEY 6                 /* SHORT key */
  185.  
  186. /* scdinit */
  187. #define SC_USEXHNDL 1               /* allow more than 20 open files */
  188.  
  189. /* SoftC extended data file field types */
  190. #define SC_SHORT_FLD 1              /* signed SHORT integer (16 bits) */
  191. #define SC_USHORT_FLD 2             /* USHORT integer */
  192. #define SC_LONG_FLD 3               /* signed LONG integer (32 bits) */
  193. #define SC_ULONG_FLD 4              /* ULONG integer */
  194. #define SC_FLOAT_FLD 11             /* IEEE single real (32 bits) */
  195. #define SC_MSFLT_FLD 12             /* Microsoft floating poINT (old) */
  196. #define SC_DOUBLE_FLD 13            /* IEEE DOUBLE real (64 bits) */
  197. #define SC_MSDBL_FLD 14             /* Microsoft DOUBLE (old) */
  198.  
  199.  
  200. /* file style flag */
  201. #define SC_DB3         1                 /* dBase3 */
  202. #define SC_DB4         2                 /* dBase4 */
  203. #define SC_FB         3                                    /* FoxBase Plus */
  204. #define SC_FP1         4                      /* FoxPro 1.0 */
  205. #define SC_CLIP87 5                                    /* Clipper Summer 87 */
  206. #define SC_CLIP5     6                                    /* Clipper 5.0 */
  207. #define SC_CLIP     SC_CLIP87                /* Clipper */
  208. #define SC_DBXL   7                 /* dBXL & QuickSilver */
  209. #define SC_DBL2 0x42                /* SoftC unique */
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216. /**********
  217.  *
  218.  *  Type Definitions
  219.  *
  220.  **********/
  221.  
  222.  
  223.  
  224.  
  225. typedef struct {  /* file open bit fields */
  226.   UINT isreadonly:1;    /* read only    - or - read/write (default) */
  227.   UINT isshareable:1;   /* shared       - or - single (default) */
  228.   UINT isunbuffered:1;  /* no buffering - or - auto buffer (default) */
  229. } SC_FLAGS;
  230.  
  231.  
  232.  
  233.  
  234.  
  235. /**********
  236.  *
  237.  *  Program Control Prototypes
  238.  *
  239.  **********/
  240.  
  241.  
  242.  
  243.  
  244. #ifdef __cplusplus
  245. extern "C" {
  246. #endif
  247. INT scdinit( INT,  INT );
  248. VOID scdterm( VOID );
  249. #ifdef __cplusplus
  250. }
  251. #endif
  252.  
  253.  
  254.  
  255.  
  256. /**********
  257.  *
  258.  *  Error Handling Prototypes
  259.  *
  260.  **********/
  261.  
  262.  
  263.  
  264. #define sceclr() (sc_code = SC_SUCCESS)
  265.  
  266. #ifdef __cplusplus
  267. extern "C" {
  268. #endif
  269. CHAR *scemsg(   VOID );
  270.  
  271. VOID sceprintf( CHAR *,           /* format string */
  272.                 ... );            /* variable number of paramters */
  273.  
  274. INT scerrlog(   INT,              /* module ID */
  275.         INT );             /* error/warning code */
  276.  
  277. VOID scewrite(  VOID *,           /* address of data to log */
  278.                 INT );            /* length */
  279. #ifdef __cplusplus
  280. }
  281. #endif
  282.  
  283.  
  284.  
  285.  
  286.  
  287. /**********
  288.  *
  289.  *  External Variables
  290.  *
  291.  **********/
  292.  
  293.  
  294.  
  295. extern CONST CHAR sc_version[];       /* Library Revision */
  296. extern INT sc_code;                   /* function result code */
  297. extern INT sc_log;                    /* use log file to record errors */
  298. extern CHAR sc_logfile[];             /* log file name */
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305. /**********
  306.  *
  307.  *  Module IDs for debug
  308.  *
  309.  **********
  310.  
  311.  
  312.  
  313. CBFRSZ    0x40
  314. CCREATE   0x80
  315. CDI2L     0xc0
  316. CDI2S     0x100
  317. CDIGET    0x140
  318. CDILEAP   0x180
  319. CDIPERM   0x1c0
  320. CDL2DOW   0x200
  321. CDL2I     0x240
  322. CDL2S     0x280
  323. CDS2DAY   0x2c0
  324. CDS2DOW   0x300
  325. CDS2I     0x340
  326. CDS2L     0x380
  327. CDS2MON   0x3c0
  328. CDS2S     0x400
  329. CDSDAY    0x440
  330. CDSDIFF   0x480
  331. CDSGET    0x4c0
  332. CDSLEAP   0x500
  333. CDSMONTH  0x540
  334. CDSPERM   0x580
  335. CDSVALID  0x5c0
  336. CEXPR     0x600
  337. CFLUSH    0x640
  338. CINDEX    0x680
  339. CINFO     0x6c0
  340. CKADD     0x700
  341. CKBOT     0x740
  342. CKCUR     0x780
  343. CKDEL     0x7c0
  344. CKFIND    0x800
  345. CKMAKE    0x840
  346. CKNEXT    0x880
  347. CKPREV    0x8c0
  348. CKTOP     0x900
  349. COPEN     0x940
  350. CPGET     0x980
  351. CPPUT     0x9c0
  352. CTI2S     0xa00
  353. CTIGET    0xa40
  354. CTS2I     0xa80
  355. CTSDIFF   0xac0
  356. CTSGET    0xb00
  357. CTSVALID  0xb40
  358. DBFRSZ    0xb80
  359. DBOF      0xbc0
  360. DCREATE   0xc00
  361. DEOF      0xc40
  362. DFGET     0xc80
  363. DFINFO    0xcc0
  364. DFLUSH    0xd00
  365. DFNAM2NO  0xd40
  366. DFPUT     0xd80
  367. DINFO     0xdc0
  368. DLOCK     0xe00
  369. DLUD      0xe40
  370. DOPEN     0xe80
  371. DPACK     0xec0
  372. DRCLEAR   0xf00
  373. DRGET     0xf40
  374. DRINFO    0xf80
  375. DRNUM     0xfc0
  376. DRPUT     0x1000
  377. DRSTAT    0x1040
  378. DSIZE     0x1080
  379. EMSG      0x10c0
  380. HCREATE   0x1100
  381. HEOF      0x1140
  382. HERASE    0x1180
  383. HEXIST    0x11c0
  384. HFLUSH    0x1200
  385. HLEN      0x1240
  386. HLOCK     0x1280
  387. HREAD     0x12c0
  388. HRENAME   0x1300
  389. HSEEK     0x1340
  390. HSIZE     0x1380
  391. HTELL     0x13c0
  392. HWRITE    0x1400
  393. IBFRSZ    0x1440
  394. ICREATE   0x1480
  395. IEXPR     0x14c0
  396. IFLUSH    0x1500
  397. IINDEX    0x1540
  398. IINFO     0x1580
  399. IKADD     0x15c0
  400. IKBOT     0x1600
  401. IKCUR     0x1640
  402. IKDATE    0x1680
  403. IKDEL     0x16c0
  404. IKFIND    0x1700
  405. IKMAKE    0x1740
  406. IKNEXT    0x1780
  407. IKPREV    0x17c0
  408. IKTOP     0x1800
  409. INIT      0x1840
  410. IOPEN     0x1880
  411. IPGET     0x18c0
  412. IPPUT     0x1900
  413. MCREATE   0x1940
  414. MINFO     0x1980
  415. MKADD     0x19c0
  416. MKBOT     0x1a00
  417. MKCUR     0x1a40
  418. MKDATE    0x1a80
  419. MKDEL     0x1ac0
  420. MKFIND    0x1b00
  421. MKMAKE    0x1b40
  422. MKNEXT    0x1b80
  423. MKNUM     0x1bc0
  424. MKPREV    0x1c00
  425. MKTOP     0x1c40
  426. MOPEN     0x1c80
  427. MTBFRSZ   0x1cc0
  428. MTERASE   0x1d00
  429. MTEXPR    0x1d40
  430. MTFLUSH   0x1d80
  431. MTINDEX   0x1dc0
  432. MTINFO    0x1e00
  433. MTNEW     0x1e40
  434. NBFRSZ    0x1e80
  435. NCREATE   0x1ec0
  436. NEXPR     0x1f00
  437. NFLUSH    0x1f40
  438. NINDEX    0x1f80
  439. NINFO     0x1fc0
  440. NKADD     0x2000
  441. NKBOT     0x2040
  442. NKCUR     0x2080
  443. NKDATE    0x20c0
  444. NKDEL     0x2100
  445. NKFIND    0x2140
  446. NKMAKE    0x2180
  447. NKNEXT    0x21c0
  448. NKPREV    0x2200
  449. NKTOP     0x2240
  450. NOPEN     0x2280
  451. NPGET     0x22c0
  452. NPPUT     0x2300
  453. STRUPR    0x2340
  454. TCREATE   0x2380
  455. TINFO     0x23c0
  456. TOPEN     0x2400
  457. TPACK     0x2440
  458. TRGET     0x2480
  459. TRPUT     0x24c0
  460. WCREATE   0x2500
  461. WINFO     0x2540
  462. WOPEN     0x2580
  463. WPACK     0x25c0
  464. WRGET     0x2600
  465. WRPUT     0x2640
  466. DHGET     0x2680
  467. CHGET     0x26C0
  468. IHGET     0x2700
  469. NHGET     0x2740
  470. THGET     0x2780
  471. WHGET     0x27C0
  472. EVAL      0x2800
  473. MHGET     0x2840
  474. MPGET     0x2880
  475. MPPUT     0x28c0
  476.  
  477. ****************/
  478. #endif
  479.  
  480.  
  481.