dbtype.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /*
  24. * COMPONENT_NAME: austext
  25. *
  26. * FUNCTIONS: ALLOC
  27. * BITS
  28. * CALLOC
  29. * DB_ENTER
  30. * DB_REF
  31. * FREE
  32. * LOCK_SET
  33. * MEM_LOCK
  34. * MEM_UNLOCK
  35. * NUM2EXT
  36. * NUM2INT
  37. * ORIGIN
  38. * RETURN
  39. * RN_REF
  40. * TABLE_SIZE
  41. * arraysize
  42. * bytecmp
  43. * bytecpy
  44. * byteset
  45. *
  46. * ORIGINS: 27,157
  47. *
  48. * (C) COPYRIGHT International Business Machines Corp. 1995, 1996
  49. * All Rights Reserved
  50. * US Government Users Restricted Rights - Use, duplication or
  51. * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  52. */
  53. /*----------------------------------------------------------------------------
  54. $TOG: dbtype.h /main/6 1998/03/19 19:00:38 mgreess $
  55. dbtype.h: Standard db_VISTA header file containing:
  56. - DDL dictionary type definitions
  57. - Machine dependent constant definitions
  58. - Miscellaneous constants used by runtime functions
  59. - Virtual memory page table type definitions
  60. (An #include "vista.h" must precede this include)
  61. (C) Copyright 1984, 1985, 1986 by Raima Corporation.
  62. ----------------------------------------------------------------------------*/
  63. /* ********************** EDIT HISTORY *******************************
  64. SCR DATE INI DESCRIPTION
  65. ----- --------- --- -----------------------------------------------------
  66. 101 21-Jun-88 RSC Added rn_type and rn_dba to database table
  67. 344 06-Jul-88 RSC LOGFILELEN also defined in dblock.h - add ifndef
  68. 115 18-Jul-88 RSC Integrate VAX VMS changes
  69. 21-Jul-88 RSC Fix bugaboo in VAX integration
  70. 368 28-Jul-88 RSC Integrate BSD changes into code
  71. 310 10-Aug-88 RSC Cleanup function prototype
  72. 19-Aug-88 RSC Moved rn_type,rn_dba to separate table for compatibility
  73. with db_QUERY and db_REVISE
  74. 423 10-Sep-88 RSC Add dbpush names for netunix.c
  75. 423 22-Sep-88 RSC Modify/simplify DB_ENTER macro for Lattice compiler
  76. 368 23-Sep-88 RSC Change type of pid from INT to int and
  77. corrected defn of MESSAGE
  78. 423 26-Sep-88 RSC Moved INIT_PAGE_P defn to initial.c
  79. 11-Oct-88 RSC Fix for ONE_DB compile
  80. 441 06-Dec-88 RSC Move defn of MESSAGE from netgen.h to here
  81. 532 06-Jan-89 RSC Fixed defn of DB_ID for ONE_DB
  82. $Log$
  83. * Revision 1.2 1995/10/13 18:29:38 miker
  84. * Added #define DtSrFILENMLEN to expand max filename len.
  85. * Changed FILENMLEN from 48 to DtSrFILENMLEN (240: 256 - 16).
  86. */
  87. /* Compiler dependencies are handled with ifdef macros:
  88. NOTE: One of these macros should be defined on the compile command,
  89. for example
  90. cc -c -DUNIX fillnew.c
  91. Failure to do so will produce compilation errors.
  92. UNIX = Unix C compiler
  93. LAT = Lattice
  94. MSC = Microsoft
  95. AZ = Aztec
  96. C86 = CI C86
  97. DS = DeSmet
  98. VMS = Vax/VMS
  99. HHS = Harris H-series
  100. */
  101. #define PGHOLD 1
  102. #define NOPGHOLD 0
  103. #define PGFREE 1
  104. #define NOPGFREE 0
  105. #define KEYFIND 0
  106. #define KEYNEXT 1
  107. #define KEYPREV 2
  108. #define KEYFRST 3
  109. #define KEYLAST 4
  110. /* dictionary attribute flags */
  111. #define SORTFLD 0x0001 /* field is a set sort field */
  112. #define STRUCTFLD 0x0002 /* field is sub-field of struct */
  113. #define UNSIGNEDFLD 0x0004 /* field is unsigned */
  114. #define STATIC 0x0002 /* file/record is static */
  115. #define LOCAL 0x0004 /* file/record is local */
  116. #define COMKEYED 0x0010 /* record/field contains/included in compound key */
  117. #define TIMESTAMPED 0x0001 /* record/set is timestamped */
  118. #define TRUE 1
  119. #define FALSE 0
  120. #define YES 1
  121. #define NO 0
  122. #define BITS_PER_BYTE 8
  123. /* Number of bits in a "type" */
  124. #define BITS( type ) (BITS_PER_BYTE * sizeof( type ))
  125. /* Number of elements in a vector */
  126. #define arraysize(v) (sizeof(v)/sizeof(*(v)))
  127. /* Number of bytes in a disk block */
  128. #define D_BLKSZ 512
  129. #define DBD_COMPAT_LEN 6
  130. #define INT_SIZE sizeof(int)
  131. #define SHORT_SIZE sizeof(short)
  132. #define LONG_SIZE sizeof(long)
  133. #ifndef NO_FLOAT
  134. #define FLOAT_SIZE sizeof(float)
  135. #define DOUBLE_SIZE sizeof(double)
  136. #endif
  137. #define CHAR_SIZE sizeof(char)
  138. #define DB_ADDR_SIZE sizeof(LONG)
  139. #define PGHDRSIZE 4
  140. #define CTBNAME "vista.ctb"
  141. #define RECHDRSIZE 6
  142. #define NONE -1
  143. /* FILEMASK, ADDRMASK, FILESHIFT always operate on 4-byte variables */
  144. #define FILEMASK 0x000000FF
  145. #define ADDRMASK 0x00FFFFFF
  146. #define FILESHIFT 24
  147. #define OPTKEYSHIFT 10
  148. #define OPTKEYMASK 0xFC00
  149. #define OPTKEYNDX 0x003F
  150. #define OPTKEY_LIMIT 63
  151. #define RLBMASK 0x4000
  152. /* The following constants all depend on the size of INT and DB_ADDR */
  153. /* creation timestamp in rec hdr = sizeof(INT) + DB_ADDR_SIZE */
  154. #define RECCRTIME 6
  155. /* update timestamp in rec hdr = RECCRTIME + sizeof(LONG) */
  156. #define RECUPTIME 10
  157. /* member count prior + next timestamp (opt) */
  158. /* max size of set pointer = sizeof(LONG) + 2*DB_ADDR_SIZE + sizeof(ULONG) */
  159. #define SETPSIZE 16
  160. /* Offset to total members in set ptr */
  161. #define SP_MEMBERS 0
  162. /* Offset to first member ptr in set ptr */
  163. #define SP_FIRST 4
  164. /* Offset to last member ptr in set ptr = 2+DB_ADDR_SIZE */
  165. #define SP_LAST 8
  166. /* Size of member pointer = 3*DB_ADDR_SIZE */
  167. #define MEMPSIZE 12
  168. /* Offset to owner ptr in member ptr */
  169. #define MP_OWNER 0
  170. /* Offset to previous member ptr in member ptr = DB_ADDR_SIZE */
  171. #define MP_PREV 4
  172. /* Offset to next member ptr in member ptr = 2*DB_ADDR_SIZE */
  173. #define MP_NEXT 8
  174. /* maximum length of a database file name */
  175. #define DtSrFILENMLEN 240 /* expand max filename len from 48 */
  176. #ifndef FILENMLEN
  177. #define FILENMLEN DtSrFILENMLEN
  178. #endif
  179. #ifndef LOGFILELEN
  180. #define LOGFILELEN 48
  181. #endif
  182. /* maximum length of a database name */
  183. #define DBNMLEN 12
  184. /* maximum length of a database path */
  185. #define PATHLEN FILENMLEN-15
  186. #define MAXDIMS 3
  187. #define OPEN 'o'
  188. #define CLOSED 'c'
  189. #define DATA 'd'
  190. #define KEY 'k'
  191. #define OVERFLOW 'o'
  192. typedef struct FILE_ENTRY_S {
  193. char ft_name[FILENMLEN]; /* name of file */
  194. INT ft_desc; /* file descriptor */
  195. char ft_status; /* 'o'=opened, 'c'=closed */
  196. char ft_type; /* 'd'=data, 'k'=key, 'o'=overflow */
  197. INT ft_slots; /* record slots per page */
  198. INT ft_slsize; /* size of record slots in bytes */
  199. INT ft_pgsize; /* size of page */
  200. INT ft_flags; /* 0x0002 is set if file is static */
  201. } FILE_ENTRY;
  202. typedef struct RECORD_ENTRY_S {
  203. INT rt_file; /* file table entry of file containing record */
  204. INT rt_len; /* total length of record */
  205. INT rt_data; /* offset to start of data in record */
  206. INT rt_fields; /* first field def in field_table */
  207. INT rt_fdtot; /* total number of fields in record */
  208. INT rt_flags; /* 0x0001 is set if record is timestamped
  209. 0x0002 is set if record is static */
  210. } RECORD_ENTRY;
  211. #define FIRST 'f'
  212. #define LAST 'l'
  213. #define ASCENDING 'a'
  214. #define DESCENDING 'd'
  215. #define NOORDER 'n'
  216. #define NEXT 'n'
  217. typedef struct SET_ENTRY_S {
  218. INT st_order; /* 'f'=first, 'l'=last, 'a'=ascending,
  219. 'd'=descending, 'n'=no order */
  220. INT st_own_rt; /* record table entry of owner */
  221. INT st_own_ptr; /* offset to set pointers in record */
  222. INT st_members; /* index of first member record in member table */
  223. INT st_memtot; /* total number of members of set */
  224. INT st_flags; /* 0x0001 is set if record is timestamped */
  225. } SET_ENTRY;
  226. typedef struct MEMBER_ENTRY_S {
  227. INT mt_record; /* record table entry for this member */
  228. INT mt_mem_ptr; /* offset to member ptrs in record */
  229. INT mt_sort_fld; /* sort table entry of first sort field */
  230. INT mt_totsf; /* total number of sort fields */
  231. } MEMBER_ENTRY;
  232. typedef struct SORT_ENTRY_S {
  233. INT se_fld; /* field table entry of sort field */
  234. INT se_set; /* set table entry of sorted set */
  235. } SORT_ENTRY;
  236. #define NOKEY 'n'
  237. #define DUPLICATES 'd'
  238. #define UNIQUE 'u'
  239. #define CHARACTER 'c'
  240. #define SHORTINT 's'
  241. #define REGINT 'i'
  242. #define LONGINT 'l'
  243. #ifndef NO_FLOAT
  244. #define FLOAT 'f'
  245. #define DOUBLE 'F'
  246. #endif
  247. #define DBADDR 'd'
  248. #define GROUPED 'g'
  249. #define COMKEY 'k'
  250. typedef struct FIELD_ENTRY_S {
  251. char fd_key; /* 'n'=none, 'd'=duplicates, 'u'=unique */
  252. char fd_type; /* 'c'=char, 's'=short, 'i'=int, 'l'=long, 'd'=DB_ADDR,
  253. 'f' = float, 'D' = double, 'g'=grouped field,
  254. 'k' = compound key */
  255. INT fd_len; /* length of field in bytes */
  256. INT fd_dim[MAXDIMS]; /* size of each array dimension */
  257. INT fd_keyfile; /* file_table entry for key file */
  258. INT fd_keyno; /* key prefix number */
  259. INT fd_ptr; /* offset to field in record or
  260. 1st compound key field in key_table */
  261. INT fd_rec; /* record table entry of record containing field */
  262. INT fd_flags; /* 0x0001 is set if field in "by" clause of set spec
  263. 0x0002 is set if field member of struct field
  264. 0x0004 is set if field is unsigned data type
  265. 0x0008 is set if field is an optional key */
  266. } FIELD_ENTRY;
  267. /* compound key table entry declaration */
  268. typedef struct KEY_ENTRY_S {
  269. INT kt_key; /* compound key field number */
  270. INT kt_field; /* field number of included field */
  271. INT kt_ptr; /* offset to start of field data in key */
  272. INT kt_sort; /* 'a' = ascending, 'd' = descending */
  273. } KEY_ENTRY;
  274. /* database table entry declaration */
  275. typedef struct DB_ENTRY_S {
  276. char db_name[DBNMLEN]; /* name of this database */
  277. char db_path[PATHLEN]; /* name of path to this database */
  278. DB_ADDR sysdba; /* database address of system record */
  279. DB_ADDR curr_dbt_rec;/* this db's current record */
  280. INT Page_size; /* size of this db's page */
  281. INT Size_ft; /* size of this db's file_table */
  282. INT ft_offset; /* offset to start of this db's file_table entries */
  283. INT Size_rt; /* size of this db's record_table */
  284. INT rt_offset; /* offset to start of this db's record_table entries */
  285. INT Size_fd; /* size of this db's field_table */
  286. INT fd_offset; /* offset to start of this db's field_table entries */
  287. INT Size_st; /* size of this db's set_table */
  288. INT st_offset; /* offset to start of this db's set_table entries */
  289. INT Size_mt; /* size of this db's member_table */
  290. INT mt_offset; /* offset to start of this db's member_table entries */
  291. INT Size_srt; /* size of this db's sort_table */
  292. INT srt_offset; /* offset to start of this db's sort_table entries */
  293. INT Size_kt; /* size of this db's key_table */
  294. INT kt_offset; /* offset to strary of this db's key table entries */
  295. INT key_offset; /* key prefix offset for this db */
  296. } DB_ENTRY;
  297. /* Structure containing current record type & address for recfrst/set/next..*/
  298. typedef struct RN_ENTRY_S {
  299. INT rn_type; /* Last record type supplied to recfrst/recset */
  300. DB_ADDR rn_dba; /* Last db addr computed by recfrst/recset/recnext */
  301. } RN_ENTRY;
  302. #define DB_REF(item) (db_global.Curr_db_table->item)
  303. #define RN_REF(item) (curr_rn_table->item)
  304. #define NUM2INT(num, offset) ((num) + db_global.Curr_db_table->offset)
  305. #define NUM2EXT(num, offset) ((num) - db_global.Curr_db_table->offset)
  306. #define ORIGIN(offset) (curr_db_table->offset)
  307. #define TABLE_SIZE(size) DB_REF(size)
  308. /* Country code table definition */
  309. typedef struct CNTRY_TBL_S {
  310. unsigned char out_chr;
  311. unsigned char sort_as1;
  312. unsigned char sort_as2;
  313. unsigned char sub_sort;
  314. } CNTRY_TBL;
  315. /* names lists structure declaration */
  316. typedef struct OBJNAMES_S {
  317. char **recs;
  318. char **flds;
  319. char **sets;
  320. } OBJNAMES;
  321. /* directory separator character:
  322. MS-DOS: '\'
  323. UNIX: '/'
  324. */
  325. #ifdef HHS
  326. #define DIRCHAR '*'
  327. #else
  328. #define DIRCHAR '/'
  329. #endif
  330. /* The following define aid in the use of a set of routines which use RMS
  331. directly to do the i/o to database files. */
  332. #define DB_OPEN open_b
  333. #define DB_CLOSE close
  334. #define DB_LSEEK lseek
  335. #define DB_WRITE write
  336. #define DB_READ read
  337. typedef struct {FILE_NO *ptr; LOCK_DESC} FILE_NO_P;
  338. typedef struct {int *ptr; LOCK_DESC} INT_P;
  339. typedef struct {struct NODE_PATH_S *ptr; LOCK_DESC} NODE_PATH_P;
  340. typedef struct {struct KEY_INFO_S *ptr; LOCK_DESC} KEY_INFO_P;
  341. typedef struct {struct ren_entry *ptr; LOCK_DESC} REN_ENTRY_P;
  342. typedef struct {struct RN_ENTRY_S *ptr; LOCK_DESC} RN_ENTRY_P;
  343. typedef struct {struct LOOKUP_ENTRY_S *ptr; LOCK_DESC} LOOKUP_ENTRY_P;
  344. typedef struct {struct page_entry *ptr; LOCK_DESC} PAGE_ENTRY_P;
  345. typedef struct {struct DB_ENTRY_S *ptr; LOCK_DESC} DB_ENTRY_P;
  346. typedef struct {struct FILE_ENTRY_S *ptr; LOCK_DESC} FILE_ENTRY_P;
  347. typedef struct {struct RECORD_ENTRY_S *ptr; LOCK_DESC} RECORD_ENTRY_P;
  348. typedef struct {struct SET_ENTRY_S *ptr; LOCK_DESC} SET_ENTRY_P;
  349. typedef struct {struct MEMBER_ENTRY_S *ptr; LOCK_DESC} MEMBER_ENTRY_P;
  350. typedef struct {struct SORT_ENTRY_S *ptr; LOCK_DESC} SORT_ENTRY_P;
  351. typedef struct {struct FIELD_ENTRY_S *ptr; LOCK_DESC} FIELD_ENTRY_P;
  352. typedef struct {struct KEY_ENTRY_S *ptr; LOCK_DESC} KEY_ENTRY_P;
  353. typedef struct {struct PGZERO_S *ptr; LOCK_DESC} PGZERO_P;
  354. typedef struct {struct RI_ENTRY_S *ptr; LOCK_DESC} RI_ENTRY_P;
  355. typedef struct {ULONG *ptr; LOCK_DESC} ULONG_P;
  356. typedef struct {LONG *ptr; LOCK_DESC} LONG_P;
  357. typedef struct {struct CNTRY_TBL_S *ptr; LOCK_DESC} CNTRY_TBL_P;
  358. struct sk {
  359. INT sk_fld;
  360. CHAR_P sk_val;
  361. };
  362. /* PJH 20201124 unused struct variable declaration in header causing issues
  363. struct sk __SK__;
  364. */
  365. typedef struct { struct sk *ptr; LOCK_DESC } SK_P;
  366. /* node key search path stack entry: one per level per key field */
  367. typedef struct NODE_PATH_S {
  368. F_ADDR node; /* node (page) number */
  369. INT slot; /* slot number of key */
  370. } NODE_PATH;
  371. /* index key information: one entry per key field */
  372. typedef struct KEY_INFO_S {
  373. NODE_PATH_P Node_path; /* stack of node #s in search path */
  374. INT level; /* current level # in node path */
  375. INT max_lvls; /* maximum possible levels for key */
  376. INT lstat; /* last key function status */
  377. INT fldno; /* field number of key */
  378. FILE_NO keyfile; /* key file containing this key */
  379. CHAR_P Keyval; /* ptr to last key value */
  380. DB_ADDR dba; /* db address of last key */
  381. } KEY_INFO;
  382. #define node_path Node_path.ptr
  383. #define keyval Keyval.ptr
  384. /* key slot structure */
  385. typedef struct key_slot {
  386. F_ADDR child; /* child node pointer */
  387. INT keyno; /* key number */
  388. char data[1]; /* start of key data */
  389. } KEY_SLOT;
  390. typedef union key_type {
  391. char kd[256];
  392. struct key_slot ks;
  393. } KEY_TYPE;
  394. /* file rename table entry declarations */
  395. typedef struct ren_entry {
  396. CHAR_P Ren_db_name;
  397. CHAR_P File_name;
  398. FILE_NO file_no;
  399. } REN_ENTRY;
  400. #define bytecpy(s1, s2, n) memcpy((char *)(s1), (char *)(s2), (unsigned)(n))
  401. #define bytecmp(s1, s2, n) memcmp((char *)(s1), (char *)(s2), (unsigned)(n))
  402. #define byteset(s, c, n) memset((char *)(s), (char)(c), (unsigned)(n))
  403. typedef struct MESSAGE_S {
  404. #ifdef GENERAL
  405. INT mtype;
  406. char mtext[1];
  407. #else /* GENERAL */
  408. LONG mtype;
  409. int pid;
  410. char mtext[1];
  411. #endif /* GENERAL */
  412. } MESSAGE;
  413. #ifdef COMMA /* COMMA */
  414. #define DB_ID , dbn
  415. #define NO_DB_ID , -1
  416. #else /* COMMA */
  417. #define DB_ID dbn
  418. #define NO_DB_ID -1
  419. #define COMMA
  420. #endif /* COMMA */
  421. #define TASK_ID /**/
  422. #define LOCK_SET(a) /**/
  423. #define TDTL_PARAM
  424. #define DB_ENTER(TDTL_PARAM) if ( startup(TDTL_PARAM) != S_OKAY ) { return( db_status ); } else
  425. #define RETURN(x) return( x )
  426. #define ALLOC(l, b, v) d_alloc(b)
  427. #define CALLOC(l, i, s, v) d_calloc(i, s)
  428. #define MEM_LOCK(cp) d_memlock((CHAR_P *)(cp))
  429. #define MEM_UNLOCK(cp) d_memunlock((CHAR_P *)(cp))
  430. #define FREE(cp) d_free((CHAR_P *)(cp))
  431. /* Lock sets are defined in dblfcns.c */
  432. #define LOCK_NONE -1
  433. #define LOCK_ALL 0
  434. #define LOCK_IO 1
  435. #define LOCK_NOIO 2
  436. #define RECORD_IO 3
  437. #define RECORD_NOIO 4
  438. #define SET_IO 5
  439. #define SET_NOIO 6
  440. #ifdef GENERAL
  441. #define TIMEOUT_DEF 20
  442. #else
  443. #define TIMEOUT_DEF 10
  444. #endif
  445. #include <sys/types.h>
  446. #include <sys/stat.h>
  447. #include "trxlog.h"
  448. #include "dblock.h"
  449. #include "ll.h"
  450. #include "dbxtrn.h"
  451. typedef struct LOOKUP_ENTRY_S {
  452. FILE_NO file; /* file table entry number (0..size_ft-1) */
  453. F_ADDR pageno; /* database page number */
  454. short pg_slot; /* page table slot pointing to this entry */
  455. } LOOKUP_ENTRY;
  456. /* virtual page table entry */
  457. typedef struct page_entry {
  458. BOOLEAN recently_used; /* LRU flag */
  459. BOOLEAN modified; /* TRUE if page has been modified */
  460. INT holdcnt; /* "hold-in-cache" counter */
  461. short lu_slot; /* lookup table slot pointing to this entry */
  462. CHAR_P Buff; /* page buffer pointer */
  463. } PAGE_ENTRY;
  464. #define buff Buff.ptr
  465. #include <string.h>
  466. #include <unistd.h>
  467. #include <stdlib.h>
  468. #include <time.h>
  469. #include "proto.h"
  470. /* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC dbtype.h */