⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utpersist.h

📁 DataDraw is an ultra-fast persistent database for high performance programs written in C. It s so fa
💻 H
字号:
/* * This file was written by Bill Cox.  It is hereby placed into the public domain. *//* These are the commands supported in the recentChanges.  The high bit of a command byte is used * to indicate that the command is an undo command, rather than a redo command. */typedef enum {    UT_TRANSACTION_COMPLETE = 0, /* TRANSACTION_COMPLETE <32-bit checksum> */    UT_WRITE_FIELD = 1, /* WRITE_FIELD <16-bit field #> <object number> <value> */    UT_WRITE_ARRAY = 2, /* WRITE_ARRAY <16-bit field #> <32-bit index> <32-bit numValues> <values> */    UT_WRITE_GLOBAL = 3, /* WRITE_GLOBAL <8-bit moduleID> <16-bit offset> <8-bit numBytes> <values> */    UT_RESIZE_FIELD = 4 /* RESIZE_FIELD <16-bit field #> <64-bit size> */} utCommandType;/* This is the maximum header size of a command needed to determine it's size */#define UT_COMMAND_MAX_HEADER_SIZE 11typedef struct utModuleStruct *utModule;typedef struct utClassStruct *utClass;typedef struct utFieldStruct *utField;typedef struct utTransactionStruct *utTransaction;typedef struct utEnumStruct *utEnum;typedef struct utEntryStruct *utEntry;typedef struct utUnionStruct *utUnion;typedef struct utUnionCaseStruct *utUnionCase;struct utModuleStruct {    char *prefix;    uint32 hashValue;    uint32 globalSize;    void *globalData;    uint16 firstFieldIndex, numFields;    uint16 firstClassIndex, numClasses;    uint16 firstEnumIndex, numEnums;    void (*start)(void);    void (*stop)(void);    bool initialized;};extern struct utModuleStruct *utModules;extern uint8 utAllocatedModules, utUsedModules;utModule utFindModule(char *prefix);struct utClassStruct {    char *name;    uint32 firstFieldIndex, numFields, numHiddenFields;    uint64 (*constructor)(void);    void (*destructor)(uint64 objectNumber);    void *numUsedPtr;    void *numAllocatedPtr;    void *firstFreePtr;    uint16 nextFreeFieldIndex;    uint8 moduleIndex, referenceSize;};extern struct utClassStruct *utClasses;extern uint16 utAllocatedClasses, utUsedClasses;struct utFieldStruct {    char *name;    void *arrayPtr;    uint32 size;    utFieldType type;    char *destName;    uint32 *numUsedPtr; /* Only for arrays */    uint32 *numAllocatedPtr; /* Only for arrays */    void *(*getValues)(uint64 objectNumber, uint32 *numValues);    void *(*allocValues)(uint64 objectNumber, uint32 numValues);    uint16 classIndex;    uint16 unionIndex; /* Only for unions */    bool array;    bool hidden; /* Only true for fields tracking array properties, or if declared hidden */};extern struct utFieldStruct *utFields;extern uint16 utAllocatedFields, utUsedFields;utField utFindField(utClass theClass, char *name);struct utTransactionStruct {    uint32 position; /* Position in recent changes file, or in utCommandBuffer if not persistent */    uint32 length;};extern struct utTransactionStruct *utTransactions;extern uint32 utUsedTransactions, utAllocatedTransactions;struct utEnumStruct {    uint16 firstEntryIndex, numEntries;    char *name;};extern struct utEnumStruct *utEnums;extern uint16 utAllocatedEnums, utUsedEnums;struct utEntryStruct {    char *name;    uint32 value;};extern struct utEntryStruct *utEntries;extern uint16 utAllocatedEntries, utUsedEntries;struct utUnionStruct {    uint16 fieldIndex;    uint16 switchFieldIndex;    uint16 firstUnionCaseIndex, numUnionCases;};extern struct utUnionStruct *utUnions;extern uint16 utAllocatedUnions, utUsedUnions;struct utUnionCaseStruct {    uint32 value;    utFieldType type;    uint32 size;};extern struct utUnionCaseStruct *utUnionCases;extern uint16 utAllocatedUnionCases, utUsedUnionCases;/* Some utilities */uint64 utFindIntValue(void *values, uint8 size);/* This keeps us from writing the the unopened changes file before starting persistence */extern bool utPersistenceInitialized;extern char *utDatabaseDirectory;extern bool utUseTextDatabaseFormat;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -