/*************************************************
 **                                             **
 **   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.            **
 *************************************************/



/**********
 *
 *  Function Return Codes
 *
 **********/




#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_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




/**********
 *
 *  Error Handling Prototypes
 *
 **********/



#define sceclr() (sc_code = SC_SUCCESS)

char *scemsg(   void );
void sceprintf( char *,           /* format string */
                ... );            /* variable number of paramters */

int scerrlog(   int modid,        /* module ID */
                int code );       /* error/warning code */

void scewrite(  void *,           /* address of data to log */
                int );            /* length */





/**********
 *
 *  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

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



