Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

dbuf.h

Go to the documentation of this file.
00001 /* Copyright (C) 1998 Oregon Graduate Institute of Science & Technology 00002 * 00003 * See the file COPYRIGHT, which should have been supplied with this 00004 * package, for licensing details. We may be contacted through email 00005 * at <quasar-help@cse.ogi.edu>. 00006 */ 00007 00008 #ifndef DBUF_H 00009 #define DBUF_H 00010 00011 #include <stdlib.h> 00012 00013 typedef unsigned char uchar; 00014 00015 struct dbuf; 00016 typedef struct dbuf dbuf; 00017 00018 typedef struct { 00019 void (*free)(dbuf *); 00020 dbuf *(*copy)(dbuf *); 00021 dbuf *(*copy_mut)(dbuf *); 00022 dbuf *(*sub)(dbuf *, size_t, size_t); 00023 dbuf *(*sub_mut)(dbuf *, size_t, size_t); 00024 void (*grow)(dbuf *, size_t); 00025 size_t (*xpnd)(dbuf *); 00026 void (*ins)(dbuf *, size_t, size_t); 00027 void (*del)(dbuf *, size_t, size_t); 00028 } dbuf_vtab; 00029 00030 struct dbuf { 00031 uchar *cur; 00032 uchar *end; 00033 const dbuf_vtab *vtab; 00034 }; 00035 00036 00037 #define dbCUR(db) (db)->cur 00038 #define dbLEN(db) ((db)->end - (db)->cur) 00039 #define dbEND(db) (db)->end 00040 00041 #define dbFREE(db) (*(db)->vtab->free)(db) 00042 #define dbCOPY(db) (*(db)->vtab->copy)(db) 00043 #define dbCOPY_mut(db) (*(db)->vtab->copy_mut)(db) 00044 #define dbSUB(db,pos,len) (*(db)->vtab->sub)(db,pos,len) 00045 #define dbSUB_mut(db,pos,len) (*(db)->vtab->sub_mut)(db,pos,len) 00046 #define dbGROW(db,len) (*(db)->vtab->grow)(db,len) 00047 #define dbXPND(db) (*(db)->vtab->xpnd)(db) 00048 #define dbINS(db,pos,len) (*(db)->vtab->ins)(db,pos,len) 00049 #define dbDEL(db,pos,len) (*(db)->vtab->del)(db,pos,len) 00050 00051 00052 dbuf *new_raw_dbuf(size_t bufsize); 00053 00054 #endif /* DBUF_H */ 00055

Generated on Sun Mar 6 13:35:49 2005 for Komssys by doxygen 1.3.8