Mercurial > hg > early-roguelike
comparison 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 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 253:d9badb9c0179 | 256:c495a4f288c6 | 
|---|---|
| 1 /* | |
| 2 dictutil.h | |
| 3 | |
| 4 UltraRogue: The Ultimate Adventure in the Dungeons of Doom | |
| 5 Copyright (C) 1995 Herb Chong | |
| 6 All rights reserved. | |
| 7 | |
| 8 See the file LICENSE.TXT for full copyright and licensing information. | |
| 9 */ | |
| 10 | |
| 11 /****************************************************************/ | |
| 12 /* HEADERS FOR DICTIONARY MAINTENENCE ROUTINE UTILITIES */ | |
| 13 /****************************************************************/ | |
| 14 | |
| 15 #ifndef dictutil_h_included | |
| 16 #define dictutil_h_included | |
| 17 | |
| 18 static char dictutil_sccsid[] = "%W% %G%"; | |
| 19 | |
| 20 #include <stdio.h> | |
| 21 #include "dict.h" | |
| 22 | |
| 23 /*------------------------------- | |
| 24 Binary read of a block of bytes | |
| 25 -------------------------------*/ | |
| 26 extern int block_read( | |
| 27 FILE *fi, | |
| 28 char *buffer, | |
| 29 size_t count, | |
| 30 long offset ); | |
| 31 | |
| 32 /*-------------------------------- | |
| 33 Binary write of a block of bytes | |
| 34 --------------------------------*/ | |
| 35 extern int block_write( | |
| 36 FILE *fo, | |
| 37 char *buffer, | |
| 38 size_t count ); | |
| 39 | |
| 40 /*-------------------------------------- | |
| 41 Compute a checksum of a block of bytes | |
| 42 --------------------------------------*/ | |
| 43 extern unsigned long compute_checksum( | |
| 44 size_t size, | |
| 45 char *block ); | |
| 46 | |
| 47 /*----------------------------------------------------------------- | |
| 48 Load a block of bytes from a compiled dictionary file into memory | |
| 49 -----------------------------------------------------------------*/ | |
| 50 extern void *dict_load_block( | |
| 51 DICTIONARY *dict, | |
| 52 char *toc_id, | |
| 53 FILE *fi, | |
| 54 void *block ); | |
| 55 | |
| 56 /*----------------------------------- | |
| 57 Create a dictionary parameter entry | |
| 58 -----------------------------------*/ | |
| 59 extern DICT_PARM_ENTRY *dict_make_parm_entry( | |
| 60 char *id, | |
| 61 unsigned long value ); | |
| 62 | |
| 63 /*------------------------------------ | |
| 64 Look up an id in the parameter array | |
| 65 ------------------------------------*/ | |
| 66 extern int dict_parm_index( | |
| 67 DICTIONARY *dict, | |
| 68 char *parm_id ); | |
| 69 | |
| 70 /*------------------------------- | |
| 71 Reset table of contents offsets | |
| 72 -------------------------------*/ | |
| 73 extern BOOLEANC dict_reset_toc_offsets( | |
| 74 DICTIONARY *dict ); | |
| 75 | |
| 76 /*----------------------------------------------------------------- | |
| 77 Save a block of bytes from memory into a compiled dictionary file | |
| 78 -----------------------------------------------------------------*/ | |
| 79 extern BOOLEANC dict_save_block( | |
| 80 DICTIONARY *dict, | |
| 81 char *toc_id, | |
| 82 FILE *fo ); | |
| 83 | |
| 84 /*-------------------------------------------------------------------- | |
| 85 Set the dictionary parm values from the values in the dict structure | |
| 86 --------------------------------------------------------------------*/ | |
| 87 extern BOOLEANC dict_set_parm_values( | |
| 88 DICTIONARY *dict ); | |
| 89 | |
| 90 /*-------------------------------------------------------------------- | |
| 91 Set the values in the dict structure from the dictionary parm values | |
| 92 --------------------------------------------------------------------*/ | |
| 93 extern BOOLEANC dict_set_parm_variables( | |
| 94 DICTIONARY *dict ); | |
| 95 | |
| 96 /*--------------------------- | |
| 97 Set the dictionary parm ids | |
| 98 ---------------------------*/ | |
| 99 extern BOOLEANC dict_set_parm_ids( | |
| 100 DICTIONARY *dict ); | |
| 101 | |
| 102 /*-------------------------------------- | |
| 103 Look up an id in the table of contents | |
| 104 --------------------------------------*/ | |
| 105 extern int dict_toc_index( | |
| 106 DICTIONARY *dict, | |
| 107 char *toc_id ); | |
| 108 | |
| 109 /*------------------------------------ | |
| 110 Record and error and abort if needed | |
| 111 ------------------------------------*/ | |
| 112 extern void signal_error( | |
| 113 char *header, | |
| 114 char *message, | |
| 115 int severity ); | |
| 116 #endif | 
