tiny.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * (c) Copyright 1993-2012 The Open Group
  5. * (c) Copyright 2012-2022 CDE Project contributors, see
  6. * CONTRIBUTORS for details
  7. *
  8. * These libraries and programs are free software; you can
  9. * redistribute them and/or modify them under the terms of the GNU
  10. * Lesser General Public License as published by the Free Software
  11. * Foundation; either version 2 of the License, or (at your option)
  12. * any later version.
  13. *
  14. * These libraries and programs are distributed in the hope that
  15. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  16. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  17. * PURPOSE. See the GNU Lesser General Public License for more
  18. * details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with these libraries and programs; if not, write
  22. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  23. * Floor, Boston, MA 02110-1301 USA
  24. */
  25. #include <stdio.h>
  26. #include "vista.h"
  27. #include "dbtype.h"
  28. #include "dbswab.h"
  29. #ifndef BASE_FILE_NAME
  30. #define BASE_FILE_NAME "tiny"
  31. #endif
  32. #define DBD_MAP_SIZE 8
  33. #define PAGE_SIZE 4096
  34. #define FILE_TABLE_SIZE 10
  35. #define RECORD_TABLE_SIZE 8
  36. #define FIELD_TABLE_SIZE 49
  37. #define SET_TABLE_SIZE 3
  38. #define MEMBER_TABLE_SIZE 3
  39. #define SORT_TABLE_SIZE 0
  40. #define KEY_TABLE_SIZE 0
  41. int main(void) {
  42. fwrite(dbd_VERSION, DBD_COMPAT_LEN, 1, stdout);
  43. INT dbd_map[DBD_MAP_SIZE] = {
  44. PAGE_SIZE,
  45. FILE_TABLE_SIZE,
  46. RECORD_TABLE_SIZE,
  47. FIELD_TABLE_SIZE,
  48. SET_TABLE_SIZE,
  49. MEMBER_TABLE_SIZE,
  50. SORT_TABLE_SIZE,
  51. KEY_TABLE_SIZE
  52. };
  53. for (int i = 0; i < DBD_MAP_SIZE; ++i) HTONS(dbd_map[i]);
  54. fwrite(dbd_map, sizeof(INT), DBD_MAP_SIZE, stdout);
  55. FILE_ENTRY file_entry[FILE_TABLE_SIZE] = {
  56. {
  57. .ft_desc = 0,
  58. .ft_status = CLOSED,
  59. .ft_type = DATA,
  60. .ft_slots = 0x20,
  61. .ft_slsize = 0x7E,
  62. .ft_pgsize = 0x1000,
  63. .ft_flags = 0
  64. },
  65. {
  66. .ft_desc = 0,
  67. .ft_status = CLOSED,
  68. .ft_type = DATA,
  69. .ft_slots = 0x8,
  70. .ft_slsize = 0xFE,
  71. .ft_pgsize = 0x800,
  72. .ft_flags = 0
  73. },
  74. {
  75. .ft_desc = 0,
  76. .ft_status = CLOSED,
  77. .ft_type = DATA,
  78. .ft_slots = 0x3C,
  79. .ft_slsize = 0x22,
  80. .ft_pgsize = 0x800,
  81. .ft_flags = 0
  82. },
  83. {
  84. .ft_desc = 0,
  85. .ft_status = CLOSED,
  86. .ft_type = DATA,
  87. .ft_slots = 0x23,
  88. .ft_slsize = 0x3A,
  89. .ft_pgsize = 0x800,
  90. .ft_flags = 0
  91. },
  92. {
  93. .ft_desc = 0,
  94. .ft_status = CLOSED,
  95. .ft_type = DATA,
  96. .ft_slots = 0x6,
  97. .ft_slsize = 0x9A,
  98. .ft_pgsize = 0x400,
  99. .ft_flags = 0
  100. },
  101. {
  102. .ft_desc = 0,
  103. .ft_status = CLOSED,
  104. .ft_type = KEY,
  105. .ft_slots = 0x30,
  106. .ft_slsize = 0x2A,
  107. .ft_pgsize = 0x800,
  108. .ft_flags = 0
  109. },
  110. {
  111. .ft_desc = 0,
  112. .ft_status = CLOSED,
  113. .ft_type = KEY,
  114. .ft_slots = 0x11,
  115. .ft_slsize = 0x74,
  116. .ft_pgsize = 0x800,
  117. .ft_flags = 0
  118. },
  119. {
  120. .ft_desc = 0,
  121. .ft_status = CLOSED,
  122. .ft_type = KEY,
  123. .ft_slots = 0x4E,
  124. .ft_slsize = 0x1A,
  125. .ft_pgsize = 0x800,
  126. .ft_flags = 0
  127. },
  128. {
  129. .ft_desc = 0,
  130. .ft_status = CLOSED,
  131. .ft_type = KEY,
  132. .ft_slots = 0x28,
  133. .ft_slsize = 0x32,
  134. .ft_pgsize = 0x800,
  135. .ft_flags = 0
  136. },
  137. {
  138. .ft_desc = 0,
  139. .ft_status = CLOSED,
  140. .ft_type = KEY,
  141. .ft_slots = 0x7,
  142. .ft_slsize = 0x90,
  143. .ft_pgsize = 0x400,
  144. .ft_flags = 0
  145. }
  146. };
  147. snprintf(file_entry[0].ft_name, FILENMLEN, "%s.d00", BASE_FILE_NAME);
  148. snprintf(file_entry[1].ft_name, FILENMLEN, "%s.d01", BASE_FILE_NAME);
  149. snprintf(file_entry[2].ft_name, FILENMLEN, "%s.d21", BASE_FILE_NAME);
  150. snprintf(file_entry[3].ft_name, FILENMLEN, "%s.d22", BASE_FILE_NAME);
  151. snprintf(file_entry[4].ft_name, FILENMLEN, "%s.d23", BASE_FILE_NAME);
  152. snprintf(file_entry[5].ft_name, FILENMLEN, "%s.k00", BASE_FILE_NAME);
  153. snprintf(file_entry[6].ft_name, FILENMLEN, "%s.k01", BASE_FILE_NAME);
  154. snprintf(file_entry[7].ft_name, FILENMLEN, "%s.k21", BASE_FILE_NAME);
  155. snprintf(file_entry[8].ft_name, FILENMLEN, "%s.k22", BASE_FILE_NAME);
  156. snprintf(file_entry[9].ft_name, FILENMLEN, "%s.k23", BASE_FILE_NAME);
  157. for (int i = 0; i < FILE_TABLE_SIZE; ++i) {
  158. FILE_ENTRY *p = &file_entry[i];
  159. HTONS(p->ft_desc);
  160. HTONS(p->ft_slots);
  161. HTONS(p->ft_slsize);
  162. HTONS(p->ft_pgsize);
  163. HTONS(p->ft_flags);
  164. }
  165. fwrite(file_entry, sizeof(FILE_ENTRY), FILE_TABLE_SIZE, stdout);
  166. RECORD_ENTRY record_entry[RECORD_TABLE_SIZE] = {
  167. {
  168. .rt_file = 0,
  169. .rt_len = 0x7E,
  170. .rt_data = 0x12,
  171. .rt_fields = 0,
  172. .rt_fdtot = 0x13,
  173. .rt_flags = 0
  174. },
  175. {
  176. .rt_file = 0,
  177. .rt_len = 0x7E,
  178. .rt_data = 0x12,
  179. .rt_fields = 0x13,
  180. .rt_fdtot = 0x2,
  181. .rt_flags = 0
  182. },
  183. {
  184. .rt_file = 0,
  185. .rt_len = 0x7E,
  186. .rt_data = 0x1E,
  187. .rt_fields = 0x15,
  188. .rt_fdtot = 0xC,
  189. .rt_flags = 0
  190. },
  191. {
  192. .rt_file = 0,
  193. .rt_len = 0x7E,
  194. .rt_data = 0x13,
  195. .rt_fields = 0x21,
  196. .rt_fdtot = 0x2,
  197. .rt_flags = 0
  198. },
  199. {
  200. .rt_file = 0x1,
  201. .rt_len = 0xFE,
  202. .rt_data = 0x12,
  203. .rt_fields = 0x23,
  204. .rt_fdtot = 0x2,
  205. .rt_flags = 0
  206. },
  207. {
  208. .rt_file = 0x2,
  209. .rt_len = 0x22,
  210. .rt_data = 0x6,
  211. .rt_fields = 0x25,
  212. .rt_fdtot = 0x4,
  213. .rt_flags = 0
  214. },
  215. {
  216. .rt_file = 0x3,
  217. .rt_len = 0x3A,
  218. .rt_data = 0x6,
  219. .rt_fields = 0x29,
  220. .rt_fdtot = 0x4,
  221. .rt_flags = 0
  222. },
  223. {
  224. .rt_file = 0x4,
  225. .rt_len = 0x9A,
  226. .rt_data = 0x6,
  227. .rt_fields = 0x2D,
  228. .rt_fdtot = 0x4,
  229. .rt_flags = 0
  230. }
  231. };
  232. for (int i = 0; i < RECORD_TABLE_SIZE; ++i) {
  233. RECORD_ENTRY *p = &record_entry[i];
  234. HTONS(p->rt_file);
  235. HTONS(p->rt_len);
  236. HTONS(p->rt_data);
  237. HTONS(p->rt_fields);
  238. HTONS(p->rt_fdtot);
  239. HTONS(p->rt_flags);
  240. }
  241. fwrite(record_entry, sizeof(RECORD_ENTRY), RECORD_TABLE_SIZE, stdout);
  242. FIELD_ENTRY field_entry[FIELD_TABLE_SIZE] = {
  243. {
  244. .fd_key = NOKEY,
  245. .fd_type = LONGINT,
  246. .fd_len = 0x4,
  247. .fd_dim = {0},
  248. .fd_keyfile = 0,
  249. .fd_keyno = 0,
  250. .fd_ptr = 0x12,
  251. .fd_rec = 0,
  252. .fd_flags = 0x4
  253. },
  254. {
  255. .fd_key = NOKEY,
  256. .fd_type = LONGINT,
  257. .fd_len = 0x4,
  258. .fd_dim = {0},
  259. .fd_keyfile = 0,
  260. .fd_keyno = 0,
  261. .fd_ptr = 0x16,
  262. .fd_rec = 0,
  263. .fd_flags = 0x4
  264. },
  265. {
  266. .fd_key = NOKEY,
  267. .fd_type = LONGINT,
  268. .fd_len = 0x4,
  269. .fd_dim = {0},
  270. .fd_keyfile = 0,
  271. .fd_keyno = 0,
  272. .fd_ptr = 0x1A,
  273. .fd_rec = 0,
  274. .fd_flags = 0
  275. },
  276. {
  277. .fd_key = NOKEY,
  278. .fd_type = LONGINT,
  279. .fd_len = 0x4,
  280. .fd_dim = {0},
  281. .fd_keyfile = 0,
  282. .fd_keyno = 0,
  283. .fd_ptr = 0x1E,
  284. .fd_rec = 0,
  285. .fd_flags = 0
  286. },
  287. {
  288. .fd_key = NOKEY,
  289. .fd_type = LONGINT,
  290. .fd_len = 0x4,
  291. .fd_dim = {0},
  292. .fd_keyfile = 0,
  293. .fd_keyno = 0,
  294. .fd_ptr = 0x22,
  295. .fd_rec = 0,
  296. .fd_flags = 0
  297. },
  298. {
  299. .fd_key = NOKEY,
  300. .fd_type = LONGINT,
  301. .fd_len = 0x4,
  302. .fd_dim = {0},
  303. .fd_keyfile = 0,
  304. .fd_keyno = 0,
  305. .fd_ptr = 0x26,
  306. .fd_rec = 0,
  307. .fd_flags = 0
  308. },
  309. {
  310. .fd_key = NOKEY,
  311. .fd_type = LONGINT,
  312. .fd_len = 0x4,
  313. .fd_dim = {0},
  314. .fd_keyfile = 0,
  315. .fd_keyno = 0,
  316. .fd_ptr = 0x2A,
  317. .fd_rec = 0,
  318. .fd_flags = 0
  319. },
  320. {
  321. .fd_key = NOKEY,
  322. .fd_type = LONGINT,
  323. .fd_len = 0x4,
  324. .fd_dim = {0},
  325. .fd_keyfile = 0,
  326. .fd_keyno = 0,
  327. .fd_ptr = 0x2E,
  328. .fd_rec = 0,
  329. .fd_flags = 0
  330. },
  331. {
  332. .fd_key = NOKEY,
  333. .fd_type = CHARACTER,
  334. .fd_len = 0x8,
  335. .fd_dim = {0x8, 0, 0},
  336. .fd_keyfile = 0,
  337. .fd_keyno = 0,
  338. .fd_ptr = 0x32,
  339. .fd_rec = 0,
  340. .fd_flags = 0
  341. },
  342. {
  343. .fd_key = NOKEY,
  344. .fd_type = CHARACTER,
  345. .fd_len = 0x32,
  346. .fd_dim = {0x32, 0, 0},
  347. .fd_keyfile = 0,
  348. .fd_keyno = 0,
  349. .fd_ptr = 0x3A,
  350. .fd_rec = 0,
  351. .fd_flags = 0
  352. },
  353. {
  354. .fd_key = NOKEY,
  355. .fd_type = SHORTINT,
  356. .fd_len = 0x2,
  357. .fd_dim = {0},
  358. .fd_keyfile = 0,
  359. .fd_keyno = 0,
  360. .fd_ptr = 0x6C,
  361. .fd_rec = 0,
  362. .fd_flags = 0
  363. },
  364. {
  365. .fd_key = NOKEY,
  366. .fd_type = SHORTINT,
  367. .fd_len = 0x2,
  368. .fd_dim = {0},
  369. .fd_keyfile = 0,
  370. .fd_keyno = 0,
  371. .fd_ptr = 0x6E,
  372. .fd_rec = 0,
  373. .fd_flags = 0
  374. },
  375. {
  376. .fd_key = NOKEY,
  377. .fd_type = SHORTINT,
  378. .fd_len = 0x2,
  379. .fd_dim = {0},
  380. .fd_keyfile = 0,
  381. .fd_keyno = 0,
  382. .fd_ptr = 0x70,
  383. .fd_rec = 0,
  384. .fd_flags = 0
  385. },
  386. {
  387. .fd_key = NOKEY,
  388. .fd_type = SHORTINT,
  389. .fd_len = 0x2,
  390. .fd_dim = {0},
  391. .fd_keyfile = 0,
  392. .fd_keyno = 0,
  393. .fd_ptr = 0x72,
  394. .fd_rec = 0,
  395. .fd_flags = 0
  396. },
  397. {
  398. .fd_key = NOKEY,
  399. .fd_type = SHORTINT,
  400. .fd_len = 0x2,
  401. .fd_dim = {0},
  402. .fd_keyfile = 0,
  403. .fd_keyno = 0,
  404. .fd_ptr = 0x74,
  405. .fd_rec = 0,
  406. .fd_flags = 0
  407. },
  408. {
  409. .fd_key = NOKEY,
  410. .fd_type = SHORTINT,
  411. .fd_len = 0x2,
  412. .fd_dim = {0},
  413. .fd_keyfile = 0,
  414. .fd_keyno = 0,
  415. .fd_ptr = 0x76,
  416. .fd_rec = 0,
  417. .fd_flags = 0
  418. },
  419. {
  420. .fd_key = NOKEY,
  421. .fd_type = SHORTINT,
  422. .fd_len = 0x2,
  423. .fd_dim = {0},
  424. .fd_keyfile = 0,
  425. .fd_keyno = 0,
  426. .fd_ptr = 0x78,
  427. .fd_rec = 0,
  428. .fd_flags = 0
  429. },
  430. {
  431. .fd_key = NOKEY,
  432. .fd_type = SHORTINT,
  433. .fd_len = 0x2,
  434. .fd_dim = {0},
  435. .fd_keyfile = 0,
  436. .fd_keyno = 0,
  437. .fd_ptr = 0x7A,
  438. .fd_rec = 0,
  439. .fd_flags = 0
  440. },
  441. {
  442. .fd_key = NOKEY,
  443. .fd_type = SHORTINT,
  444. .fd_len = 0x2,
  445. .fd_dim = {0},
  446. .fd_keyfile = 0,
  447. .fd_keyno = 0,
  448. .fd_ptr = 0x7C,
  449. .fd_rec = 0,
  450. .fd_flags = 0
  451. },
  452. {
  453. .fd_key = NOKEY,
  454. .fd_type = SHORTINT,
  455. .fd_len = 0x2,
  456. .fd_dim = {0},
  457. .fd_keyfile = 0,
  458. .fd_keyno = 0,
  459. .fd_ptr = 0x12,
  460. .fd_rec = 0x1,
  461. .fd_flags = 0
  462. },
  463. {
  464. .fd_key = NOKEY,
  465. .fd_type = CHARACTER,
  466. .fd_len = 0x6A,
  467. .fd_dim = {0x1, 0x6A, 0},
  468. .fd_keyfile = 0,
  469. .fd_keyno = 0,
  470. .fd_ptr = 0x14,
  471. .fd_rec = 0x1,
  472. .fd_flags = 0
  473. },
  474. {
  475. .fd_key = NOKEY,
  476. .fd_type = LONGINT,
  477. .fd_len = 0x4,
  478. .fd_dim = {0},
  479. .fd_keyfile = 0,
  480. .fd_keyno = 0,
  481. .fd_ptr = 0x1E,
  482. .fd_rec = 0x2,
  483. .fd_flags = 0x4
  484. },
  485. {
  486. .fd_key = NOKEY,
  487. .fd_type = LONGINT,
  488. .fd_len = 0x4,
  489. .fd_dim = {0},
  490. .fd_keyfile = 0,
  491. .fd_keyno = 0,
  492. .fd_ptr = 0x22,
  493. .fd_rec = 0x2,
  494. .fd_flags = 0x4
  495. },
  496. {
  497. .fd_key = NOKEY,
  498. .fd_type = LONGINT,
  499. .fd_len = 0x4,
  500. .fd_dim = {0},
  501. .fd_keyfile = 0,
  502. .fd_keyno = 0,
  503. .fd_ptr = 0x26,
  504. .fd_rec = 0x2,
  505. .fd_flags = 0x0
  506. },
  507. {
  508. .fd_key = NOKEY,
  509. .fd_type = LONGINT,
  510. .fd_len = 0x4,
  511. .fd_dim = {0},
  512. .fd_keyfile = 0,
  513. .fd_keyno = 0,
  514. .fd_ptr = 0x2A,
  515. .fd_rec = 0x2,
  516. .fd_flags = 0x0
  517. },
  518. {
  519. .fd_key = NOKEY,
  520. .fd_type = LONGINT,
  521. .fd_len = 0x4,
  522. .fd_dim = {0},
  523. .fd_keyfile = 0,
  524. .fd_keyno = 0,
  525. .fd_ptr = 0x2E,
  526. .fd_rec = 0x2,
  527. .fd_flags = 0x0
  528. },
  529. {
  530. .fd_key = UNIQUE,
  531. .fd_type = CHARACTER,
  532. .fd_len = 0x20,
  533. .fd_dim = {0x20, 0, 0},
  534. .fd_keyfile = 0x5,
  535. .fd_keyno = 0,
  536. .fd_ptr = 0x32,
  537. .fd_rec = 0x2,
  538. .fd_flags = 0x0
  539. },
  540. {
  541. .fd_key = NOKEY,
  542. .fd_type = CHARACTER,
  543. .fd_len = 0x22,
  544. .fd_dim = {0x22, 0, 0},
  545. .fd_keyfile = 0,
  546. .fd_keyno = 0,
  547. .fd_ptr = 0x52,
  548. .fd_rec = 0x2,
  549. .fd_flags = 0
  550. },
  551. {
  552. .fd_key = NOKEY,
  553. .fd_type = SHORTINT,
  554. .fd_len = 0x2,
  555. .fd_dim = {0},
  556. .fd_keyfile = 0,
  557. .fd_keyno = 0,
  558. .fd_ptr = 0x74,
  559. .fd_rec = 0x2,
  560. .fd_flags = 0
  561. },
  562. {
  563. .fd_key = NOKEY,
  564. .fd_type = SHORTINT,
  565. .fd_len = 0x2,
  566. .fd_dim = {0},
  567. .fd_keyfile = 0,
  568. .fd_keyno = 0,
  569. .fd_ptr = 0x76,
  570. .fd_rec = 0x2,
  571. .fd_flags = 0
  572. },
  573. {
  574. .fd_key = NOKEY,
  575. .fd_type = SHORTINT,
  576. .fd_len = 0x2,
  577. .fd_dim = {0},
  578. .fd_keyfile = 0,
  579. .fd_keyno = 0,
  580. .fd_ptr = 0x78,
  581. .fd_rec = 0x2,
  582. .fd_flags = 0
  583. },
  584. {
  585. .fd_key = NOKEY,
  586. .fd_type = SHORTINT,
  587. .fd_len = 0x2,
  588. .fd_dim = {0},
  589. .fd_keyfile = 0,
  590. .fd_keyno = 0,
  591. .fd_ptr = 0x7A,
  592. .fd_rec = 0x2,
  593. .fd_flags = 0
  594. },
  595. {
  596. .fd_key = NOKEY,
  597. .fd_type = SHORTINT,
  598. .fd_len = 0x2,
  599. .fd_dim = {0},
  600. .fd_keyfile = 0,
  601. .fd_keyno = 0,
  602. .fd_ptr = 0x7C,
  603. .fd_rec = 0x2,
  604. .fd_flags = 0
  605. },
  606. {
  607. .fd_key = NOKEY,
  608. .fd_type = SHORTINT,
  609. .fd_len = 0x2,
  610. .fd_dim = {0},
  611. .fd_keyfile = 0,
  612. .fd_keyno = 0,
  613. .fd_ptr = 0x13,
  614. .fd_rec = 0x3,
  615. .fd_flags = 0
  616. },
  617. {
  618. .fd_key = DUPLICATES,
  619. .fd_type = CHARACTER,
  620. .fd_len = 0x69,
  621. .fd_dim = {0x1, 0x69, 0},
  622. .fd_keyfile = 0x6,
  623. .fd_keyno = 0x1,
  624. .fd_ptr = 0x15,
  625. .fd_rec = 0x3,
  626. .fd_flags = 0x400
  627. },
  628. {
  629. .fd_key = NOKEY,
  630. .fd_type = SHORTINT,
  631. .fd_len = 0x2,
  632. .fd_dim = {0},
  633. .fd_keyfile = 0,
  634. .fd_keyno = 0,
  635. .fd_ptr = 0x12,
  636. .fd_rec = 0x4,
  637. .fd_flags = 0
  638. },
  639. {
  640. .fd_key = NOKEY,
  641. .fd_type = CHARACTER,
  642. .fd_len = 0xEA,
  643. .fd_dim = {0xEA, 0x1, 0},
  644. .fd_keyfile = 0,
  645. .fd_keyno = 0,
  646. .fd_ptr = 0x14,
  647. .fd_rec = 0x4,
  648. .fd_flags = 0
  649. },
  650. {
  651. .fd_key = UNIQUE,
  652. .fd_type = CHARACTER,
  653. .fd_len = 0x10,
  654. .fd_dim = {0x10, 0, 0},
  655. .fd_keyfile = 0x7,
  656. .fd_keyno = 0x2,
  657. .fd_ptr = 0x6,
  658. .fd_rec = 0x5,
  659. .fd_flags = 0
  660. },
  661. {
  662. .fd_key = NOKEY,
  663. .fd_type = LONGINT,
  664. .fd_len = 0x4,
  665. .fd_dim = {0},
  666. .fd_keyfile = 0,
  667. .fd_keyno = 0,
  668. .fd_ptr = 0x16,
  669. .fd_rec = 0x5,
  670. .fd_flags = 0x0
  671. },
  672. {
  673. .fd_key = NOKEY,
  674. .fd_type = LONGINT,
  675. .fd_len = 0x4,
  676. .fd_dim = {0},
  677. .fd_keyfile = 0,
  678. .fd_keyno = 0,
  679. .fd_ptr = 0x1A,
  680. .fd_rec = 0x5,
  681. .fd_flags = 0x0
  682. },
  683. {
  684. .fd_key = NOKEY,
  685. .fd_type = LONGINT,
  686. .fd_len = 0x4,
  687. .fd_dim = {0},
  688. .fd_keyfile = 0,
  689. .fd_keyno = 0,
  690. .fd_ptr = 0x1E,
  691. .fd_rec = 0x5,
  692. .fd_flags = 0x0
  693. },
  694. {
  695. .fd_key = UNIQUE,
  696. .fd_type = CHARACTER,
  697. .fd_len = 0x28,
  698. .fd_dim = {0x28, 0, 0},
  699. .fd_keyfile = 0x8,
  700. .fd_keyno = 0x3,
  701. .fd_ptr = 0x6,
  702. .fd_rec = 0x6,
  703. .fd_flags = 0
  704. },
  705. {
  706. .fd_key = NOKEY,
  707. .fd_type = LONGINT,
  708. .fd_len = 0x4,
  709. .fd_dim = {0},
  710. .fd_keyfile = 0,
  711. .fd_keyno = 0,
  712. .fd_ptr = 0x2E,
  713. .fd_rec = 0x6,
  714. .fd_flags = 0x0
  715. },
  716. {
  717. .fd_key = NOKEY,
  718. .fd_type = LONGINT,
  719. .fd_len = 0x4,
  720. .fd_dim = {0},
  721. .fd_keyfile = 0,
  722. .fd_keyno = 0,
  723. .fd_ptr = 0x32,
  724. .fd_rec = 0x6,
  725. .fd_flags = 0x0
  726. },
  727. {
  728. .fd_key = NOKEY,
  729. .fd_type = LONGINT,
  730. .fd_len = 0x4,
  731. .fd_dim = {0},
  732. .fd_keyfile = 0,
  733. .fd_keyno = 0,
  734. .fd_ptr = 0x36,
  735. .fd_rec = 0x6,
  736. .fd_flags = 0x0
  737. },
  738. {
  739. .fd_key = UNIQUE,
  740. .fd_type = CHARACTER,
  741. .fd_len = 0x86,
  742. .fd_dim = {0x86, 0, 0},
  743. .fd_keyfile = 0x9,
  744. .fd_keyno = 0x4,
  745. .fd_ptr = 0x6,
  746. .fd_rec = 0x7,
  747. .fd_flags = 0
  748. },
  749. {
  750. .fd_key = NOKEY,
  751. .fd_type = LONGINT,
  752. .fd_len = 0x4,
  753. .fd_dim = {0},
  754. .fd_keyfile = 0,
  755. .fd_keyno = 0,
  756. .fd_ptr = 0x8E,
  757. .fd_rec = 0x7,
  758. .fd_flags = 0x0
  759. },
  760. {
  761. .fd_key = NOKEY,
  762. .fd_type = LONGINT,
  763. .fd_len = 0x4,
  764. .fd_dim = {0},
  765. .fd_keyfile = 0,
  766. .fd_keyno = 0,
  767. .fd_ptr = 0x92,
  768. .fd_rec = 0x7,
  769. .fd_flags = 0x0
  770. },
  771. {
  772. .fd_key = NOKEY,
  773. .fd_type = LONGINT,
  774. .fd_len = 0x4,
  775. .fd_dim = {0},
  776. .fd_keyfile = 0,
  777. .fd_keyno = 0,
  778. .fd_ptr = 0x96,
  779. .fd_rec = 0x7,
  780. .fd_flags = 0x0
  781. }
  782. };
  783. for (int i = 0; i < FIELD_TABLE_SIZE; ++i) {
  784. FIELD_ENTRY *p = &field_entry[i];
  785. HTONS(p->fd_len);
  786. HTONS(p->fd_keyfile);
  787. HTONS(p->fd_keyno);
  788. HTONS(p->fd_ptr);
  789. HTONS(p->fd_rec);
  790. HTONS(p->fd_flags);
  791. for (int j = 0; j < MAXDIMS; ++j) HTONS(p->fd_dim[j]);
  792. }
  793. fwrite(field_entry, sizeof(FIELD_ENTRY), FIELD_TABLE_SIZE, stdout);
  794. SET_ENTRY set_entry[SET_TABLE_SIZE] = {
  795. {
  796. .st_order = LAST,
  797. .st_own_rt = 0,
  798. .st_own_ptr = 0x6,
  799. .st_members = 0,
  800. .st_memtot = 0x1,
  801. .st_flags = 0
  802. },
  803. {
  804. .st_order = LAST,
  805. .st_own_rt = 0x2,
  806. .st_own_ptr = 0x6,
  807. .st_members = 0x1,
  808. .st_memtot = 0x1,
  809. .st_flags = 0
  810. },
  811. {
  812. .st_order = LAST,
  813. .st_own_rt = 0x2,
  814. .st_own_ptr = 0x12,
  815. .st_members = 0x2,
  816. .st_memtot = 0x1,
  817. .st_flags = 0
  818. }
  819. };
  820. for (int i = 0; i < SET_TABLE_SIZE; ++i) {
  821. SET_ENTRY *p = &set_entry[i];
  822. HTONS(p->st_order);
  823. HTONS(p->st_own_rt);
  824. HTONS(p->st_own_ptr);
  825. HTONS(p->st_members);
  826. HTONS(p->st_memtot);
  827. HTONS(p->st_flags);
  828. }
  829. fwrite(set_entry, sizeof(SET_ENTRY), SET_TABLE_SIZE, stdout);
  830. MEMBER_ENTRY member_entry[MEMBER_TABLE_SIZE] = {
  831. {
  832. .mt_record = 0x1,
  833. .mt_mem_ptr = 0x6,
  834. .mt_sort_fld = 0,
  835. .mt_totsf = 0
  836. },
  837. {
  838. .mt_record = 0x4,
  839. .mt_mem_ptr = 0x6,
  840. .mt_sort_fld = 0,
  841. .mt_totsf = 0
  842. },
  843. {
  844. .mt_record = 0x3,
  845. .mt_mem_ptr = 0x7,
  846. .mt_sort_fld = 0,
  847. .mt_totsf = 0
  848. }
  849. };
  850. for (int i = 0; i < MEMBER_TABLE_SIZE; ++i) {
  851. MEMBER_ENTRY *p = &member_entry[i];
  852. HTONS(p->mt_record);
  853. HTONS(p->mt_mem_ptr);
  854. HTONS(p->mt_sort_fld);
  855. HTONS(p->mt_totsf);
  856. }
  857. fwrite(member_entry, sizeof(MEMBER_ENTRY), MEMBER_TABLE_SIZE, stdout);
  858. fprintf(stdout,
  859. "OR_DBREC\n"
  860. "OR_DBMISCREC\n"
  861. "OR_OBJREC\n"
  862. "OR_MISCREC\n"
  863. "OR_BLOBREC\n"
  864. "OR_SWORDREC\n"
  865. "OR_LWORDREC\n"
  866. "OR_HWORDREC\n"
  867. "OR_DBFLAGS\n"
  868. "OR_DBUFLAGS\n"
  869. "OR_RECCOUNT\n"
  870. "OR_MAXDBA\n"
  871. "OR_AVAILD99\n"
  872. "OR_UNAVAILD99\n"
  873. "OR_HUFID\n"
  874. "OR_DBSECMASK\n"
  875. "OR_VERSION\n"
  876. "OR_DBFILL\n"
  877. "OR_DBOTYPE\n"
  878. "OR_COMPFLAGS\n"
  879. "OR_DBACCESS\n"
  880. "OR_MINWORDSZ\n"
  881. "OR_MAXWORDSZ\n"
  882. "OR_RECSLOTS\n"
  883. "OR_FZKEYSZ\n"
  884. "OR_ABSTRSZ\n"
  885. "OR_LANGUAGE\n"
  886. "OR_DBMISCTYPE\n"
  887. "OR_DBMISC\n"
  888. "OR_OBJFLAGS\n"
  889. "OR_OBJUFLAGS\n"
  890. "OR_OBJSIZE\n"
  891. "OR_OBJDATE\n"
  892. "OR_OBJSECMASK\n"
  893. "OR_OBJKEY\n"
  894. "OR_OBJFILL\n"
  895. "OR_OBJACCESS\n"
  896. "OR_OBJTYPE\n"
  897. "OR_OBJCOST\n"
  898. "OR_OBJHDROFFSET\n"
  899. "OR_OBJEUREKA\n"
  900. "OR_MISCTYPE\n"
  901. "OR_MISC\n"
  902. "OR_BLOBLEN\n"
  903. "OR_BLOB\n"
  904. "OR_SWORDKEY\n"
  905. "OR_SWOFFSET\n"
  906. "OR_SWFREE\n"
  907. "OR_SWADDRS\n"
  908. "OR_LWORDKEY\n"
  909. "OR_LWOFFSET\n"
  910. "OR_LWFREE\n"
  911. "OR_LWADDRS\n"
  912. "OR_HWORDKEY\n"
  913. "OR_HWOFFSET\n"
  914. "OR_HWFREE\n"
  915. "OR_HWADDRS\n"
  916. "OR_DB_MISCS\n"
  917. "OR_OBJ_BLOBS\n"
  918. "OR_OBJ_MISCS\n");
  919. return 0;
  920. }