aboutsummaryrefslogtreecommitdiff
path: root/engines/cge/btfile.h
diff options
context:
space:
mode:
Diffstat (limited to 'engines/cge/btfile.h')
-rw-r--r--engines/cge/btfile.h95
1 files changed, 42 insertions, 53 deletions
diff --git a/engines/cge/btfile.h b/engines/cge/btfile.h
index 0df9636573..c55891cae4 100644
--- a/engines/cge/btfile.h
+++ b/engines/cge/btfile.h
@@ -25,73 +25,62 @@
* Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
*/
-#ifndef __BTFILE__
-#define __BTFILE__
+#ifndef __BTFILE__
+#define __BTFILE__
-#include "cge/general.h"
+#include "cge/general.h"
namespace CGE {
-#define BT_SIZE K(1)
-#define BT_KEYLEN 13
-#define BT_LEVELS 2
+#define BT_SIZE K(1)
+#define BT_KEYLEN 13
+#define BT_LEVELS 2
-#define BT_NONE 0xFFFF
-#define BT_ROOT 0
+#define BT_NONE 0xFFFF
+#define BT_ROOT 0
-struct BT_KEYPACK
-{
- char Key[BT_KEYLEN];
- uint32 Mark;
- uint16 Size;
+struct BT_KEYPACK {
+ char Key[BT_KEYLEN];
+ uint32 Mark;
+ uint16 Size;
};
-
-struct BT_PAGE
-{
- struct HEA
- {
- uint16 Count;
- uint16 Down;
- } Hea;
- union
- {
- // dummy filler to make proper size of union
- uint8 Data[BT_SIZE-sizeof(HEA)];
- // inner version of data: key + word-sized page link
- struct INNER
- {
- uint8 Key[BT_KEYLEN];
- uint16 Down;
- } Inn[(BT_SIZE-sizeof(HEA))/sizeof(INNER)];
- // leaf version of data: key + all user data
- BT_KEYPACK Lea[(BT_SIZE-sizeof(HEA))/sizeof(BT_KEYPACK)];
- };
+struct BT_PAGE {
+ struct HEA {
+ uint16 Count;
+ uint16 Down;
+ } Hea;
+ union {
+ // dummy filler to make proper size of union
+ uint8 Data[BT_SIZE - sizeof(HEA)];
+ // inner version of data: key + word-sized page link
+ struct INNER {
+ uint8 Key[BT_KEYLEN];
+ uint16 Down;
+ } Inn[(BT_SIZE - sizeof(HEA)) / sizeof(INNER)];
+ // leaf version of data: key + all user data
+ BT_KEYPACK Lea[(BT_SIZE - sizeof(HEA)) / sizeof(BT_KEYPACK)];
+ };
};
-
-
-
-class BTFILE : public IOHAND
-{
- struct
- {
- BT_PAGE * Page;
- uint16 PgNo;
- int Indx;
- bool Updt;
- } Buff[BT_LEVELS];
- void PutPage (int lev, bool hard = FALSE);
- BT_PAGE * GetPage (int lev, uint16 pgn);
+class BTFILE : public IOHAND {
+ struct {
+ BT_PAGE *Page;
+ uint16 PgNo;
+ int Indx;
+ bool Updt;
+ } Buff[BT_LEVELS];
+ void PutPage(int lev, bool hard = FALSE);
+ BT_PAGE *GetPage(int lev, uint16 pgn);
public:
- BTFILE (const char * name, IOMODE mode = REA, CRYPT * crpt = NULL);
- virtual ~BTFILE (void);
- BT_KEYPACK * Find(const char * key);
- BT_KEYPACK * Next(void);
- void Make(BT_KEYPACK * keypack, uint16 count);
+ BTFILE(const char *name, IOMODE mode = REA, CRYPT *crpt = NULL);
+ virtual ~BTFILE(void);
+ BT_KEYPACK *Find(const char *key);
+ BT_KEYPACK *Next(void);
+ void Make(BT_KEYPACK *keypack, uint16 count);
};
} // End of namespace CGE