Mercurial > hg > early-roguelike
annotate urogue/dictutil.h @ 256:c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
author | John "Elwin" Edwards |
---|---|
date | Tue, 31 Jan 2017 19:56:04 -0500 |
parents | |
children | 13b482bd9e66 |
rev | line source |
---|---|
256
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
1 /* |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
2 dictutil.h |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
3 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
4 UltraRogue: The Ultimate Adventure in the Dungeons of Doom |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
5 Copyright (C) 1995 Herb Chong |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
6 All rights reserved. |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
7 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
8 See the file LICENSE.TXT for full copyright and licensing information. |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
9 */ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
10 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
11 /****************************************************************/ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
12 /* HEADERS FOR DICTIONARY MAINTENENCE ROUTINE UTILITIES */ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
13 /****************************************************************/ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
14 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
15 #ifndef dictutil_h_included |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
16 #define dictutil_h_included |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
17 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
18 static char dictutil_sccsid[] = "%W% %G%"; |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
19 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
20 #include <stdio.h> |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
21 #include "dict.h" |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
22 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
23 /*------------------------------- |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
24 Binary read of a block of bytes |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
25 -------------------------------*/ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
26 extern int block_read( |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
27 FILE *fi, |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
28 char *buffer, |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
29 size_t count, |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
30 long offset ); |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
31 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
32 /*-------------------------------- |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
33 Binary write of a block of bytes |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
34 --------------------------------*/ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
35 extern int block_write( |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
36 FILE *fo, |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
37 char *buffer, |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
38 size_t count ); |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
39 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
40 /*-------------------------------------- |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
41 Compute a checksum of a block of bytes |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
42 --------------------------------------*/ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
43 extern unsigned long compute_checksum( |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
44 size_t size, |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
45 char *block ); |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
46 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
47 /*----------------------------------------------------------------- |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
48 Load a block of bytes from a compiled dictionary file into memory |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
49 -----------------------------------------------------------------*/ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
50 extern void *dict_load_block( |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
51 DICTIONARY *dict, |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
52 char *toc_id, |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
53 FILE *fi, |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
54 void *block ); |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
55 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
56 /*----------------------------------- |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
57 Create a dictionary parameter entry |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
58 -----------------------------------*/ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
59 extern DICT_PARM_ENTRY *dict_make_parm_entry( |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
60 char *id, |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
61 unsigned long value ); |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
62 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
63 /*------------------------------------ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
64 Look up an id in the parameter array |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
65 ------------------------------------*/ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
66 extern int dict_parm_index( |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
67 DICTIONARY *dict, |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
68 char *parm_id ); |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
69 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
70 /*------------------------------- |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
71 Reset table of contents offsets |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
72 -------------------------------*/ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
73 extern BOOLEANC dict_reset_toc_offsets( |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
74 DICTIONARY *dict ); |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
75 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
76 /*----------------------------------------------------------------- |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
77 Save a block of bytes from memory into a compiled dictionary file |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
78 -----------------------------------------------------------------*/ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
79 extern BOOLEANC dict_save_block( |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
80 DICTIONARY *dict, |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
81 char *toc_id, |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
82 FILE *fo ); |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
83 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
84 /*-------------------------------------------------------------------- |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
85 Set the dictionary parm values from the values in the dict structure |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
86 --------------------------------------------------------------------*/ |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
87 extern BOOLEANC dict_set_parm_values( |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
88 DICTIONARY *dict ); |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
89 |
c495a4f288c6
Import UltraRogue from the Roguelike Restoration Project (r1490)
John "Elwin" Edwards
parents:
diff
changeset
|
90 /*-------------------------------------------------------------------- |