home *** CD-ROM | disk | FTP | other *** search
- /*************************************************
- ** **
- ** softc.h **
- ** **
- ** SoftC common library header **
- ** **
- ** Copyright (C) 1988, 1989, 1990 by **
- ** SoftC, Ltd. **
- ** 16820 Third Street NE **
- ** Ham Lake, MN 55304 **
- ** (612) 434-6968 **
- ** **
- ** All rights reserved. **
- *************************************************/
-
-
- #ifndef __SOFTC_H__
- #define __SOFTC_H__
-
- /**********
- *
- * Function Return Codes
- *
- **********/
-
-
-
-
- #define SC_KEYPRSNT 11 /* WARNING - key already present in file */
- #define SC_NOFUNC 10 /* WARNING - function not supported */
- #define SC_MEMWRN 9 /* WARNING - partial memory allocation */
- #define SC_NOTBFRD 8 /* WARNING - file I/O not buffered */
- #define SC_FILENGTH 7 /* WARNING - file length is incorrect */
- #define SC_FLDROUND 6 /* WARNING - numeric field rounded */
- #define SC_FLDTRUNC 5 /* WARNING - data field truncated */
- #define SC_NOFIND 4 /* WARNING - could not find key in index file */
- #define SC_END 3 /* WARNING - no more keys */
- #define SC_EMPTY 2 /* WARNING - file is empty */
- #define SC_DELREC 1 /* WARNING - record read is marked deleted */
- #define SC_SUCCESS 0 /* successful function return code */
- #define SC_WRTFAIL -1 /* ERROR - file write failure */
- #define SC_RDFAIL -2 /* ERROR - file read failure */
- #define SC_MEMERR -3 /* ERROR - memory allocation error */
- #define SC_SKFAIL -4 /* ERROR - file pointer reposition failed */
- #define SC_NOFILE -5 /* ERROR - file not found */
- #define SC_FILBAD -6 /* ERROR - file corrupted */
- #define SC_BADEXPR -7 /* ERROR - bad user specified key expression */
- #define SC_NOHNDL -8 /* ERROR - no handles available */
- #define SC_NOPGS -9 /* ERROR - no index pages loaded */
- #define SC_BADPG -10 /* ERROR - index page was not loaded */
- #define SC_CLOSFAIL -11 /* ERROR - file close failure */
- #define SC_BADCMD -12 /* ERROR - invalid command */
- #define SC_BADHNDL -13 /* ERROR - invalid handle number */
- #define SC_BADFNAME -14 /* ERROR - invalid filename */
- #define SC_BADDATE -15 /* ERROR - invalid date */
- #define SC_BADTIME -16 /* ERROR - invalid time */
- #define SC_NODBT -17 /* ERROR - file not in memo format */
- #define SC_NOFPT -17
- #define SC_DBFVERS -18 /* ERROR - invalid file version */
- #define SC_MDXVERS -18
- #define SC_DBTVERS -18
- #define SC_NTXVERS -18
- #define SC_NDXVERS -18
- #define SC_IDXVERS -18
- #define SC_FPTVERS -18
- #define SC_DBFHLEN -19 /* ERROR - file header length error */
- #define SC_MDXHLEN -19
- #define SC_DBFDATE -20 /* ERROR - last file change date in error */
- #define SC_MDXDATE -20
- #define SC_NULLPARM -21 /* ERROR - parameter address NULL */
- #define SC_BADKEYT -22 /* ERROR - invalid key type */
- #define SC_KEYLEN -23 /* ERROR - invalid key length */
- #define SC_ITEMLEN -24 /* ERROR - item length incorrect */
- #define SC_BADROOT -25 /* ERROR - invalid root page */
- #define SC_MAXKEYS -26 /* ERROR - bad maximum number of keys per page */
- #define SC_FLDCNT -27 /* ERROR - invalid number of fields */
- #define SC_BADFLDN -28 /* ERROR - field name invalid */
- #define SC_FLDLEN -29 /* ERROR - bad field length */
- #define SC_DECPL -30 /* ERROR - decimal places parameter invalid */
- #define SC_BADFLDT -31 /* ERROR - invalid field type */
- #define SC_RECLEN -32 /* ERROR - invalid record length */
- #define SC_BADDATA -33 /* ERROR - bad data */
- #define SC_LINELEN -34 /* ERROR - memo soft line length invalid */
- #define SC_MDXFLAG -35 /* ERROR - MDX flag in DBF file invalid */
- #define SC_READOLY -36 /* ERROR - file open for reading only */
- #define SC_LCKVIOL -37 /* ERROR - file locking violation */
- #define SC_LCKBOVR -38 /* ERROR - sharing buffer overflow */
- #define SC_NOPATH -39 /* ERROR - path not found */
- #define SC_ACCDEN -40 /* ERROR - access to file denied */
- #define SC_BADACC -41 /* ERROR - invalid access code */
- #define SC_NOTLCKD -42 /* ERROR - file must be locked first */
- #define SC_NEWDEV -43 /* ERROR - diskette changed */
- #define SC_MINKEYS -44 /* ERROR - bad minimum number of keys per page */
- #define SC_FILSOPEN -45 /* ERROR - some files remain open */
- #define SC_OPENFAIL -46 /* ERROR - could not open the file */
- #define SC_FLSHFAIL -47 /* ERROR - flush to disk failure */
- #define SC_BADTAG -48 /* ERROR - invalid tag handle */
- #define SC_BLKSZ -49 /* ERROR - invalid page size in blocks */
- #define SC_BADTNAME -50 /* ERROR - invalid tag name */
- #define SC_BLKADR -51 /* ERROR - invalid page offset adder */
- #define SC_MAXTAGS -52 /* ERROR - invalid maximum number of tag table elements */
- #define SC_TBLELEN -53 /* ERROR - bad tag table element length */
- #define SC_TAGCNT -54 /* ERROR - invalid tag count */
- #define SC_KEYFORM -55 /* ERROR - unknown key format switches */
- #define SC_UNSWITCH -56 /* ERROR - unknown switch error */
- #define SC_TAGOPEN -57 /* ERROR - tag in use */
-
-
-
-
- /**********
- *
- * Common Defines
- *
- **********/
-
-
-
- #define SC_TRUE 1
- #define SC_FALSE 0
- #define CONST const
-
- #ifdef __SCO_XS5__
- #undef CONST
- #define CONST
- #endif
-
- /*
- * variable type definitions
- */
- #define UCHAR unsigned char
- #define CHAR char
- #define USHORT unsigned short
- #define SHORT short
- #define UINT unsigned int
- #define INT int
- #define ULONG unsigned long
- #define LONG long
- #define SINGLE float
- #define DOUBLE double
- #define LDOUBLE long double
- #define VOID void
-
-
- #ifndef F_PTR
- #define F_PTR *
- #endif
-
-
- /* scdikfind, scdnkfind, scdckfind definitions */
- #define SC_FIRST 1 /* find first key */
- #define SC_EXACT 2 /* find exact key (uses record number) */
-
- /* scdcopen, scddopen, scdiopen, scdnopen, scdtopen */
- #define SC_RDWR 0 /* read/write access (default) */
- #define SC_RDONLY 0x100 /* read only access */
- #define SC_BUFFER 0 /* buffer disk writes in memory (default) */
- #define SC_FLUSH 0x200 /* force all writes to disk */
- #define SC_EXCLUDE 0 /* open file for exclusive use (default) */
- #define SC_SHARED 0x400 /* open file for shared use */
-
- /* scdcbfrsz, scddbfrsz, scdibfrsz, scdnbfrsz */
- #define SC_SETSZ 0 /* set buffer size */
- #define SC_GETSZ 1 /* get current buffer size */
-
- /* scddrput, scdtrput */
- #define SC_UPDATE 0x100 /* update existing record */
- #define SC_ADD 0x200 /* append record at end of file */
-
- /* scdccreate, scdicreate, scdncreate, scdmtnew */
- #define SC_DESCEND 0x100 /* descending key order */
- #define SC_UNIQUE 0x80 /* unique index keys */
- #define SC_CKEY 'C' /* character type key */
- #define SC_DKEY 'D' /* date type key */
- #define SC_LKEY 'L' /* logical key type */
- #define SC_NKEY 'N' /* numeric type key */
-
- /* SoftC extended index file key types (scdncreate) */
- #define SC_DBLKEY 1 /* DOUBLE key */
- #define SC_FLTKEY 2 /* SINGLE key */
- #define SC_ULNGKEY 3 /* ULONG key */
- #define SC_LNGKEY 4 /* LONG key */
- #define SC_USHTKEY 5 /* USHORT key */
- #define SC_SHTKEY 6 /* SHORT key */
-
- /* scdinit */
- #define SC_USEXHNDL 1 /* allow more than 20 open files */
-
- /* SoftC extended data file field types */
- #define SC_SHORT_FLD 1 /* signed SHORT integer (16 bits) */
- #define SC_USHORT_FLD 2 /* USHORT integer */
- #define SC_LONG_FLD 3 /* signed LONG integer (32 bits) */
- #define SC_ULONG_FLD 4 /* ULONG integer */
- #define SC_FLOAT_FLD 11 /* IEEE single real (32 bits) */
- #define SC_MSFLT_FLD 12 /* Microsoft floating poINT (old) */
- #define SC_DOUBLE_FLD 13 /* IEEE DOUBLE real (64 bits) */
- #define SC_MSDBL_FLD 14 /* Microsoft DOUBLE (old) */
-
-
- /* file style flag */
- #define SC_DB3 1 /* dBase3 */
- #define SC_DB4 2 /* dBase4 */
- #define SC_FB 3 /* FoxBase Plus */
- #define SC_FP1 4 /* FoxPro 1.0 */
- #define SC_CLIP87 5 /* Clipper Summer 87 */
- #define SC_CLIP5 6 /* Clipper 5.0 */
- #define SC_CLIP SC_CLIP87 /* Clipper */
- #define SC_DBXL 7 /* dBXL & QuickSilver */
- #define SC_DBL2 0x42 /* SoftC unique */
-
-
-
-
-
-
- /**********
- *
- * Type Definitions
- *
- **********/
-
-
-
-
- typedef struct { /* file open bit fields */
- UINT isreadonly:1; /* read only - or - read/write (default) */
- UINT isshareable:1; /* shared - or - single (default) */
- UINT isunbuffered:1; /* no buffering - or - auto buffer (default) */
- } SC_FLAGS;
-
-
-
-
-
- /**********
- *
- * Program Control Prototypes
- *
- **********/
-
-
-
-
- #ifdef __cplusplus
- extern "C" {
- #endif
- INT scdinit( INT, INT );
- VOID scdterm( VOID );
- #ifdef __cplusplus
- }
- #endif
-
-
-
-
- /**********
- *
- * Error Handling Prototypes
- *
- **********/
-
-
-
- #define sceclr() (sc_code = SC_SUCCESS)
-
- #ifdef __cplusplus
- extern "C" {
- #endif
- CHAR *scemsg( VOID );
-
- VOID sceprintf( CHAR *, /* format string */
- ... ); /* variable number of paramters */
-
- INT scerrlog( INT, /* module ID */
- INT ); /* error/warning code */
-
- VOID scewrite( VOID *, /* address of data to log */
- INT ); /* length */
- #ifdef __cplusplus
- }
- #endif
-
-
-
-
-
- /**********
- *
- * External Variables
- *
- **********/
-
-
-
- extern CONST CHAR sc_version[]; /* Library Revision */
- extern INT sc_code; /* function result code */
- extern INT sc_log; /* use log file to record errors */
- extern CHAR sc_logfile[]; /* log file name */
-
-
-
-
-
-
- /**********
- *
- * Module IDs for debug
- *
- **********
-
-
-
- CBFRSZ 0x40
- CCREATE 0x80
- CDI2L 0xc0
- CDI2S 0x100
- CDIGET 0x140
- CDILEAP 0x180
- CDIPERM 0x1c0
- CDL2DOW 0x200
- CDL2I 0x240
- CDL2S 0x280
- CDS2DAY 0x2c0
- CDS2DOW 0x300
- CDS2I 0x340
- CDS2L 0x380
- CDS2MON 0x3c0
- CDS2S 0x400
- CDSDAY 0x440
- CDSDIFF 0x480
- CDSGET 0x4c0
- CDSLEAP 0x500
- CDSMONTH 0x540
- CDSPERM 0x580
- CDSVALID 0x5c0
- CEXPR 0x600
- CFLUSH 0x640
- CINDEX 0x680
- CINFO 0x6c0
- CKADD 0x700
- CKBOT 0x740
- CKCUR 0x780
- CKDEL 0x7c0
- CKFIND 0x800
- CKMAKE 0x840
- CKNEXT 0x880
- CKPREV 0x8c0
- CKTOP 0x900
- COPEN 0x940
- CPGET 0x980
- CPPUT 0x9c0
- CTI2S 0xa00
- CTIGET 0xa40
- CTS2I 0xa80
- CTSDIFF 0xac0
- CTSGET 0xb00
- CTSVALID 0xb40
- DBFRSZ 0xb80
- DBOF 0xbc0
- DCREATE 0xc00
- DEOF 0xc40
- DFGET 0xc80
- DFINFO 0xcc0
- DFLUSH 0xd00
- DFNAM2NO 0xd40
- DFPUT 0xd80
- DINFO 0xdc0
- DLOCK 0xe00
- DLUD 0xe40
- DOPEN 0xe80
- DPACK 0xec0
- DRCLEAR 0xf00
- DRGET 0xf40
- DRINFO 0xf80
- DRNUM 0xfc0
- DRPUT 0x1000
- DRSTAT 0x1040
- DSIZE 0x1080
- EMSG 0x10c0
- HCREATE 0x1100
- HEOF 0x1140
- HERASE 0x1180
- HEXIST 0x11c0
- HFLUSH 0x1200
- HLEN 0x1240
- HLOCK 0x1280
- HREAD 0x12c0
- HRENAME 0x1300
- HSEEK 0x1340
- HSIZE 0x1380
- HTELL 0x13c0
- HWRITE 0x1400
- IBFRSZ 0x1440
- ICREATE 0x1480
- IEXPR 0x14c0
- IFLUSH 0x1500
- IINDEX 0x1540
- IINFO 0x1580
- IKADD 0x15c0
- IKBOT 0x1600
- IKCUR 0x1640
- IKDATE 0x1680
- IKDEL 0x16c0
- IKFIND 0x1700
- IKMAKE 0x1740
- IKNEXT 0x1780
- IKPREV 0x17c0
- IKTOP 0x1800
- INIT 0x1840
- IOPEN 0x1880
- IPGET 0x18c0
- IPPUT 0x1900
- MCREATE 0x1940
- MINFO 0x1980
- MKADD 0x19c0
- MKBOT 0x1a00
- MKCUR 0x1a40
- MKDATE 0x1a80
- MKDEL 0x1ac0
- MKFIND 0x1b00
- MKMAKE 0x1b40
- MKNEXT 0x1b80
- MKNUM 0x1bc0
- MKPREV 0x1c00
- MKTOP 0x1c40
- MOPEN 0x1c80
- MTBFRSZ 0x1cc0
- MTERASE 0x1d00
- MTEXPR 0x1d40
- MTFLUSH 0x1d80
- MTINDEX 0x1dc0
- MTINFO 0x1e00
- MTNEW 0x1e40
- NBFRSZ 0x1e80
- NCREATE 0x1ec0
- NEXPR 0x1f00
- NFLUSH 0x1f40
- NINDEX 0x1f80
- NINFO 0x1fc0
- NKADD 0x2000
- NKBOT 0x2040
- NKCUR 0x2080
- NKDATE 0x20c0
- NKDEL 0x2100
- NKFIND 0x2140
- NKMAKE 0x2180
- NKNEXT 0x21c0
- NKPREV 0x2200
- NKTOP 0x2240
- NOPEN 0x2280
- NPGET 0x22c0
- NPPUT 0x2300
- STRUPR 0x2340
- TCREATE 0x2380
- TINFO 0x23c0
- TOPEN 0x2400
- TPACK 0x2440
- TRGET 0x2480
- TRPUT 0x24c0
- WCREATE 0x2500
- WINFO 0x2540
- WOPEN 0x2580
- WPACK 0x25c0
- WRGET 0x2600
- WRPUT 0x2640
- DHGET 0x2680
- CHGET 0x26C0
- IHGET 0x2700
- NHGET 0x2740
- THGET 0x2780
- WHGET 0x27C0
- EVAL 0x2800
- MHGET 0x2840
- MPGET 0x2880
- MPPUT 0x28c0
-
- ****************/
- #endif
-
-