/* ============================================= = MODULE: SFILE.H = = VERSION: 2.2.9 = = = =FUNCTION: SFILE - Macros & Globals = = = = SYSTEM: SFILE = = SYSVERS: 2.2.10 = = CREATED: 07MAR88 = = UPDATED: 22APR93 = = = = (c) 1988,89,90,91,92,93 = = BY: The Symmetry Group = ============================================= FUNCTION: Include file for the Symmetry File System. OPERATION: HISTORY: VERS DATE BY NOTES 1.00.X 07 Mar 88 CVP Created. 1.0.0 11 Jul 89 CVP -Final Release -Include stdtyp.h 2.1.0 15 Dec 89 CVP -Add parmaters to sf_dmrd/wr. -Add sf_rdmd() sf_wdmd(). -Increase buffer size to 10k. 2.1.0B 14 May 90 CVP -Add sf_rsmd(), sf_wsmd(), sf_smrd(), and sf_smwr() and remove dm... -Add link control parameters. 2.1.3 13 Sep 90 CVP -Add sf_ncopn(), and sf_tidx(). 2.1.4 13 Nov 90 CVP -Add FXBUF typedef. 2.2.0E 16 Aug 91 CVP -Remove lseek() prototype. 2.2.0E 03 Sep 91 CVP -Use new Prototype Macros. 2.2.6B 27 May 92 CVP -Add sf_mline(). 2.2.6C 29 Jul 92 CVP -Revise prototyping. 2.2.7 07 Dec 92 CVP -Add SH_BEGIN & SH_END. -Add parameters to all global and typedef function pointers. 2.2.9 22 Apr 93 CVP -Add sh_dmp(). -Change sf_open() to sf_opn(). EJECT SECTION "Include Files"*/ #include "stdtyp.h" /*Standard Types*/ SH_HBEGIN /*EJECT SECTION "ERROR & WARNING CODES" [EXTERN] TYPE NAME; COMMENT */ #define SF_OK 0 /*No Error*/ #define SF_WOPEN 1 /*Warning - Already Open*/ #define SF_WDIR 2 /*Warning - End/Beginning of Directory*/ #define SF_WEND 2 /*Warning - End/Beginning of Data/Directory*/ #define SF_WCLS 3 /*Warning - Already Closed*/ #define SF_WCREA 4 /*Warning - Created*/ #define SF_WREAD 5 /*Warning - Read Truncated*/ #define SF_WCM 6 /*Warning - Closest Match*/ #define SF_WRO 7 /*Warning - Open File Read Only*/ #define SF_EREAD -1 /*Error - Read Error*/ #define SF_EWRITE -2 /*Error - Write Error*/ #define SF_EOPEN -3 /*Error - Unable to Open*/ #define SF_ENOPEN -4 /*Error - Not Open Error*/ #define SF_ERO -5 /*Error - Read Only*/ #define SF_ENFILE -6 /*Error - Not a File*/ #define SF_EEOF -7 /*Error - Unexpected EOF*/ #define SF_EDIR -8 /*Error - Directory Error*/ #define SF_ESTR -9 /*Error - SFILE Structure Error*/ #define SF_ENDEF -10 /*Error - Function Not Defined*/ #define SF_ENALW -11 /*Error - Function Not Allowed*/ #define SF_EBUF -12 /*Error - No Dynamic Memory Space*/ /*EJECT SECTION "LIMITS & SIZES" [STATIC] TYPE NAME; COMMENT */ #define NDMBUF 10000 /*EJECT SECTION "STRUCTURES & TYPEDEFS" [EXTERN] TYPE NAME; COMMENT */ typedef struct /*SFILE Access Table*/ {ushort ttype; /*Table Entry Type 0 System 1 SFILE File 2 Temporary File 3 Directory Block 4 Multi Block 5 Data Block 6 Fixed Directory Block FFH End of Table*/ ushort tcode; /*Table Entry Code 0 Don't Care !0 Required Block Code*/ ushort taccess; /*Table Entry Access 0 Read Only 1 Read/Write 2 Read/Write/Create*/ ushort tfile; /*Index of SFILE Table Entry*/ short towner; /*Index of Owner 0 Root Block*/ char *name; /*File Name or Block Name/Function*/ /*** Data Buffer or Directory Page Array ***/ void *dbuf; /*Data Buffer Pointer*/ ushort dnum; /*Data Buffer Number of Elements*/ ushort dlen; /*Data Buffer Element Length*/ /*** SYMBOL Access Pointers ***/ /*Ignore if NULL*/ ushort *dpcurp; /*Dir Page Current Element Ptr*/ ushort *dpnump; /*Dir Page Number of Elements Ptr*/ /*** (12 Bytes) Block Header Data ***/ short btype; /*Block Type / File Handle <=0 Not Open*/ ushort bcode; /*Block Code (Access Code for Files)*/ long blen; /*Block Length*/ ushort belen; /*Block Data Element Length*/ ushort benum; /*Block Data Number of Elements*/ /*** Non Initialized Data ***/ /*** Block Data ***/ long bbase; /*Block Base Position*/ long bpos; /*Block Current Position (from BBASE) or File Position*/ /*** Directory Page Data ***/ ushort dpstart; /*Directory Page First Element*/ ushort becur; /*Block Data Current Element*/ }SFAT; typedef struct /*Directory Page Element*/ /*** (6 Bytes) Working Directory Data ***/ {ushort elem; /*Element Number*/ long dpos; /*Data Block Position (from sf_tbl[].bbase)*/ /*** Directory Data from File***/ /*Total Length sf_tbl[].dlen*/ long dlen; /*Data Block Length*/ char data[1]; /*Application Data (Length is dummy)*/ }SFDT; typedef struct /*Message Table*/ {char *msg; /*Message String*/ }MSG; typedef struct /*Fixed Directory Buffer*/ {ushort elem; /*Element*/ long dpos; /*Data Block Position*/ long dlen; /*Block Lengtn*/ ushort data; /*Data (Type Code)*/ }FXBUF; typedef struct /*System Data Buffer*/ {ushort vers; /*PDB File Format Version*/ char system[20]; /*System Name*/ }SBUF; /*EJECT SECTION "SUBROUTINES" [EXTERN] TYPE NAME; COMMENT */ SH_EXTF(void, sf_rwsel)(SH_ARG1(void)); SH_EXTF(short, sf_ncopn)(SH_ARG1(ushort)); SH_EXTF(short, sf_opn)(SH_ARG1(ushort)); SH_EXTF(short, sf_close)(SH_ARG1(ushort)); SH_EXTF(short, sf_fpage)(SH_ARG1(ushort)); SH_EXTF(short, sf_rpage)(SH_ARG1(ushort) SH_ARG(ushort)); SH_EXTF(short, sf_npage)(SH_ARG1(ushort)); SH_EXTF(short, sf_dblk)(SH_ARG1(ushort)); SH_EXTF(short, sf_aline)(SH_ARG1(ushort)); SH_EXTF(short, sf_dline)(SH_ARG1(ushort) SH_ARG(bool)); SH_EXTF(short, sf_wline)(SH_ARG1(ushort)); SH_EXTF(short, sf_cline)(SH_ARG1(ushort) SH_ARG(ushort)); SH_EXTF(short, sf_mline)(SH_ARG1(ushort) SH_ARG(ushort)); SH_EXTF(short, sf_felem)(SH_ARG1(ushort) SH_ARG(void*) SH_ARGF(ushort)); SH_EXTF(short, sf_selem)(SH_ARG1(ushort) SH_ARG(ushort)); SH_EXTF(short, sf_nline)(SH_ARG1(ushort) SH_ARG(ushort)); SH_EXTF(short, sf_pline)(SH_ARG1(ushort) SH_ARG(ushort)); SH_EXTF(short, sf_wdata)(SH_ARG1(ushort) SH_ARG(char*) SH_ARG(ushort)); SH_EXTF(short, sf_rdata)(SH_ARG1(ushort) SH_ARG(char*) SH_ARG(ushort)); SH_EXTF(short, sf_add)(SH_ARG1(ushort) SH_ARG(long) SH_ARG(long)); SH_EXTF(short, sf_del)(SH_ARG1(ushort) SH_ARG(long) SH_ARG(long)); SH_EXTF(short, sf_cpy)(SH_ARG1(ushort) SH_ARG(long) SH_ARG(ushort) SH_ARG(long) SH_ARG(long)); SH_EXTF(void, sf_gcur)(SH_ARG1(ushort)); SH_EXTF(void, sf_scur)(SH_ARG1(ushort)); SH_EXTF(short, sf_read)(SH_ARG1(ushort) SH_ARG(long) SH_ARG(void*) SH_ARG(ushort)); SH_EXTF(short, sf_write)(SH_ARG1(ushort) SH_ARG(long) SH_ARG(void*) SH_ARG(ushort)); SH_EXTF(void, sf_dmsg)(SH_ARG1(short)); SH_EXTF(ushort, sf_scmp)(SH_ARG1(char*) SH_ARG(char*)); SH_EXTF(void, sf_nscn)(SH_ARG1(ushort) SH_ARG(ushort)); SH_EXTF(char*, sf_addr)(SH_ARG1(ushort)); SH_EXTF(short, sf_idx)(SH_ARG1(ushort)); SH_EXTF(short, sf_tidx)(SH_ARG1(ushort)); SH_EXTF(short, sf_wsmd)(SH_ARG1(ushort) SH_ARG(ushort)); SH_EXTF(short, sf_rsmd)(SH_ARG1(ushort) SH_ARG(ushort)); SH_EXTF(short, sf_smrd)(SH_ARG1(ushort) SH_ARG(long) SH_ARG(ushort) SH_ARG(ushort) SH_ARG(ushort) SH_ARG(ushort)); SH_EXTF(short, sf_smwr)(SH_ARG1(ushort) SH_ARG(long) SH_ARG(ushort) SH_ARG(ushort) SH_ARG(ushort) SH_ARG(ushort)); SH_EXTF(short, sf_wsstr)(SH_ARG1(ushort) SH_ARG(ushort)); SH_EXTF(short, sf_rsstr)(SH_ARG1(ushort) SH_ARG(ushort)); SH_EXTF(void, sf_dmp)(SH_ARG1(void)); /*EJECT SECTION "SUBROUTINES - Implemented as Macros" [EXTERN] TYPE NAME; COMMENT */ /*EJECT SECTION "GLOBALS" [EXTERN] TYPE NAME; COMMENT */ /*** Option Link Control & Pointers ***/ extern bool sf_rw; /*Allow Read/Write*/ SH_EXTF( short, *sf__alne)(SH_ARG1(ushort)); /*Pointer - Add Line*/ SH_EXTF( short, *sf__wlne)(SH_ARG1(ushort)); /*Pointer - Write Line*/ SH_EXTF( short, *sf__add)(SH_ARG1(ushort) SH_ARG(long) SH_ARG(long)); /*Pointer - SFILE Add Space*/ SH_EXTF( short, *sf__wr)(SH_ARG1(ushort) SH_ARG(long) SH_ARG(void*) SH_ARG(ushort)); /*Pointer - SFILE Write*/ extern SFAT* sf_ptbl[]; /*SFILE Access Table Pointers*/ extern ushort sf_smhdl; /*SMEM Handle*/ extern short sf_error; /*Current Error Code*/ extern ushort sf_index; /*Current Index*/ extern MSG* sf_err; /*Pointer to Error Messages*/ extern ushort sf_nerr; /*Number of Error Messages*/ extern MSG* sf_wrn; /*Pointer to Warning Messages*/ extern ushort sf_nwrn; /*Number of Warning Messages*/ extern MSG* sf_msg; /*Pointer to Messages*/ extern ushort sf_nmsg; /*Number of Messages*/ SH_HEND