home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_08_10
/
8n10032b
< prev
next >
Wrap
Text File
|
1990-06-10
|
4KB
|
108 lines
Listing 2: transact.h
/*************************
File: TRANSACT.H
Created
By: Russell Cook
*************************/
#ifndef _TRANSACT_H_
#define _TRANSACT_H_
#define FHANDLE int
#define BADFHANDLE ((FHANDLE)-1)
FHANDLE FARFNCT VFOpen( char FAR *, /* fully qualified data file name */\
int, /* open flags (O_RDONLY...) */\
int /* permissions */\
);
BOOL FARFNCT VFClose( FHANDLE /* from VFOpen() */ );
FHANDLE FARFNCT OpenTransact( char FAR *, /* fully qualified log name */\
BOOL /* operation flags */\
);
BOOL FARFNCT CloseTransact( FHANDLE /* from TransactOpen() */ );
BOOL FARFNCT DeleteTransactionFile( \
char FAR * /* name of transaction file */\
);
BOOL FARFNCT RollBack( char FAR * /* fully qualified log name */\
);
/* transaction log file type specifiers */
#define NORMAL_TRANS ((BOOL)1)
#define DEL_ON_CLOSE ((BOOL)(NORMAL_TRANS | 2 ))
BOOL FARFNCT BeginTransaction( FHANDLE, /* from VFOpen() */\
FHANDLE /* from TransactOpen() */\
);
BOOL FARFNCT EndTransaction( FHANDLE, /* from VFOpen() */\
FHANDLE /* from TransactOpen() */\
);
int FARFNCT VFRead( FHANDLE, /* from VFOpen() */\
VOID FAR *, /* buffer to be filled */\
unsigned int /* # bytes to be read */\
);
int FARFNCT VFWrite( FHANDLE, /* from VFOpen() */\
VOID FAR *, /* buffer to be written */\
unsigned int /* # of bytes to be written */\
);
long FARFNCT VFLSeek( FHANDLE, /* from VFOpen() */\
long, /* # of bytes to seek */\
int /* location from which to seek */\
);
long FARFNCT VFTell( FHANDLE /* from VFOpen() */ );
BOOL FARFNCT VFLocking( FHANDLE, /* from VFOpen() */\
int, /* type of lock desired */\
long /* # of bytes to lock */\
);
#define SHARED_LOCK ((int) 1)
#define EXCLUSIVE_LOCK ((int) 2)
#define UNLOCK_BYTES ((int) 4)
BOOL FARFNCT VFChangeSize( FHANDLE, /* from VFOpen() */\
long /* new file size */\
);
BOOL FARFNCT VFStat( FHANDLE, /* from VFOpen() */\
struct stat NEAR * /* struct to be filled */\
);
int FARFNCT VFLastError( void );
/* The following error codes may be returned by VFLastError() */
#define ENONE 0 /* no error */
#define EHANDLE 1 /* FHANDLE bad */
#define ECLOSED 2 /* FHANDLE references a closed file */
#define ENOTUSER 3 /* specified file is not a user file */
#define EACTIVE 4 /* unmatched BeginTransaction() */
#define ECLOSE 5 /* system file close failed */
#define EUSER 6 /* specified file is a user file */
#define EUNLINK 7 /* system file unlink failed */
#define ENOTTRACK 8 /* handles specify non-tracking files */
#define ESEEK 9 /* system file seek failed */
#define EOFFSET 10 /* pos. offset from EOF */
#define EPOS 11 /* file position < 0L */
#define ELTYPE 12 /* bad lock type */
#define ELOCK 13 /* system lock function failed */
#define ECHSIZ 14 /* system file size change function failed */
#define EFSTAT 15 /* system file status function failed */
#define EMALLOC 16 /* system memory allocation failed */
#define EREALLOC 17 /* system memory reallocation failed */
#define ESTRDUP 18 /* system string duplication failed */
#define EOPEN 19 /* system file open failed */
#define ETTYPE 20 /* transaction file type is invalid */
#define EREAD 21 /* system file read failed */
#define ENOTCLOSED 22 /* deleting non-closed file not permitted */
#define EWRITE 23 /* system file write failed */
#define ETRACK 24 /* failure storing transaction record */
#define EDELTA 25 /* file size change too great for tracking */
#define EROLL 26 /* failure during transaction log rollback */
#endif /* _TRANSACT_H_ */