home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
clarion
/
brokcode.zip
/
READHD2.EXE
/
lha
/
FILE2.DOC
next >
Wrap
Text File
|
1988-08-01
|
7KB
|
199 lines
COPYRIGHT 1988 CLARION SOFTWARE CORP. ALL RIGHTS RESERVED.
#define FILESG2 0x3343 /* file signature */
#define MEMOSG2 0x334D /* file signature */
#define FLDNMSIZ 16 /* max size of a field name */
#define PRESIZ 3 /* max size field name prefix */
#define MAXFLDS 256 /* max number of fields per record */
#define DEFEXT ".DAT" /* default file extension for sfiles */
#define KEYEXT ".K00" /* default file extension for indices */
#define IDXEXT ".I00" /* default file extension for indices */
#define TMPEXT ".T00" /* default file extension for temps */
#define MEMEXT ".MEM" /* default file extension for temps */
#define MEMTMP ".M00" /* default file extension for temps */
#define LOGEXT ".LOG" /* default file extension for logout */
#define BUFMAX 20 /* maximum number of requested buffers */
#define NODESIZE 512 /* size of nodes in key files */
#define MEMOSIZE 256 /* size of memo text block */
#define MAXKEYSIZ 245 /* maximum length of key */
#define MAXKEYS 255 /* maximum number of keys */
#define MAXPICLEN 256 /* maximum length of picture */
#define DTODEF 0xFFFF /* default dto is -1 */
/* record status types */
#define NEWREC 0x01
#define OLDREC 0x02
#define RVISED 0x04
#define BACKED 0x08
#define DELTED 0x10
#define EMPTY 0x20
#define RDLOCK 0x40
#define WTLOCK 0x80
/* sf file status defines for sfatr */
#define FILLOCK 0x01 /* file is locked */
#define FILOWN 0x02 /* file is owned */
#define FILCRYP 0x04 /* records are encrypted */
#define FILMEMO 0x08 /* memo file exists */
#define FILCOMP 0x10 /* file is compressed */
#define FILRCLM 0x20 /* reclaim deleted records */
#define FILREAD 0x40 /* file is read only */
#define FILCRET 0x80 /* file may be created */
/* field types */
#define FLNG 0x01 /* LONG - long */
#define FREL 0x02 /* REAL - double */
#define FSTR 0x03 /* STRING - char[] */
#define FPIC 0x04 /* PICTURE - char[] */
#define FBYT 0x05 /* BYTE - char */
#define FSHT 0x06 /* SHORT - int */
#define FGRP 0x07 /* GROUP */
#define FDEC 0x08 /* DECIMAL */
/************************************************************************/
/******************* ON DISK STRUCTURES NEEDED BY EXEC ******************/
/************************************************************************/
/* data file header */
typedef struct {
unsigned filesig; /* signature */
unsigned sfatr; /* file attributes */
unsigned char numbkeys; /* number of keys in this file */
unsigned long numrecs; /* number of records in file */
unsigned long numdels; /* number of deleted records */
unsigned numflds; /* number of fields */
unsigned numpics; /* number of pictures */
unsigned numarrs; /* number of arrays */
unsigned reclen; /* record length */
unsigned long offset; /* start of data area */
unsigned long logeof; /* logical end of file */
unsigned long logbof; /* logical beginning of file */
unsigned long freerec; /* first usable deleted record */
unsigned char recnam[FLDNMSIZ-4]; /* record name without pre */
unsigned char memnam[FLDNMSIZ-4]; /* memo name without pre */
unsigned char filpre[PRESIZ]; /* file name prefix */
unsigned char recpre[PRESIZ]; /* record name prefix */
unsigned memolen; /* size of memo */
unsigned memowid; /* column length of memo */
unsigned long lockcnt; /* file locked counter */
unsigned long chgtime; /* time of last change */
unsigned long chgdate; /* date of last change */
unsigned chcksum; /* checksum used for encrypt */
} FILEHEAD;
typedef struct {
unsigned char fldtype; /* type of field */
char fldname[FLDNMSIZ]; /* name of field */
unsigned foffset; /* offset into record */
unsigned length; /* length of field */
unsigned char decsig; /* significance for decimals */
unsigned char decdec; /* number of decimal places */
unsigned arrnum; /* array number */
unsigned picnum; /* picture number */
} FLDDESC;
typedef struct {
unsigned char numcomps; /* number of components for key */
char keynams[FLDNMSIZ]; /* name of this key */
unsigned char comptyp; /* type of composite */
unsigned char complen; /* length of composite */
} KEYSECT;
typedef struct {
unsigned char fldtype; /* field type */
unsigned fldnum; /* field number */
unsigned elmoff; /* record offset of this element */
unsigned char elmlen; /* length of element */
} KEYPART;
typedef struct {
unsigned piclen;
char picstr[MAXPICLEN];
} PICDESC;
typedef struct {
unsigned maxdim;
unsigned lendim;
} ARRPART;
typedef struct {
unsigned numdim;
unsigned totdim;
unsigned elmsiz;
ARRPART arrprt[(sizeof(ARRPART)*MAXTOTDIM)];
} ARRDESC;
/* record header */
typedef struct {
unsigned char rhd;
unsigned long rptr;
} RECHEAD;
Graphical repesentation of header
┌─
│
│ FILEHEAD
│
└─
┌─ should be FILEHEAD.numflds of these
│ Field 1 FLDDSC
├─
│ Field 2 FLDDSC
:
: etc.
└─
Key definitions FILEHEAD.numbkeys of these
┌─ ┌─
│ │ Key 1 KEYSECT
│ └─
│ ┌─ Key components KEYSECT.numcomps of these
│ │ Key 1 Part 1 KEYPART
│ ├─
│ :
│ └─
├─
:
:
└─
PICDESC are variable length. Read the length first to get the number
of additional bytes to read.
┌─ FILEHEAD.numpics of these
│ PICDESC 1
: etc.
└─
Array definitions FILEHEAD.numarrs of these
┌─ ┌─
│ │ Array 1 ARRDESC
│ └─
│ ┌─ Array parts ARRDESC.totdims of these
│ │ Array 1 Part 1 ARRPART
│ ├─
│ :
│ └─
├─
:
:
└─
Start of data records use FILEHEAD.offset to get relative position
within the file to get to here.
┌─
│ RECHEAD
└─
┌─ Data record get length from FILEHEAD.reclen
│
│
:
:
└─