| 1 | /* omflib0.h (emx+gcc) -- Copyright (c) 1993-1996 by Eberhard Mattes */ | 
|---|
| 2 |  | 
|---|
| 3 | /* Private header file for the emx OMFLIB library. */ | 
|---|
| 4 |  | 
|---|
| 5 | #define FALSE 0 | 
|---|
| 6 | #define TRUE  1 | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef _BYTE_WORD_DWORD | 
|---|
| 9 | #define _BYTE_WORD_DWORD | 
|---|
| 10 | typedef unsigned char byte; | 
|---|
| 11 | typedef unsigned short word; | 
|---|
| 12 | typedef unsigned long dword; | 
|---|
| 13 | #endif /* _BYTE_WORD_DWORD */ | 
|---|
| 14 |  | 
|---|
| 15 | #define FLAG_DELETED  0x0001 | 
|---|
| 16 |  | 
|---|
| 17 | enum omf_state | 
|---|
| 18 | { | 
|---|
| 19 | OS_EMPTY,                     /* Empty module */ | 
|---|
| 20 | OS_SIMPLE,                    /* Alias or import definition only */ | 
|---|
| 21 | OS_OTHER,                     /* Any other records present */ | 
|---|
| 22 | }; | 
|---|
| 23 |  | 
|---|
| 24 | struct omfmod | 
|---|
| 25 | { | 
|---|
| 26 | char *name; | 
|---|
| 27 | word page; | 
|---|
| 28 | word flags; | 
|---|
| 29 | }; | 
|---|
| 30 |  | 
|---|
| 31 | struct pubsym | 
|---|
| 32 | { | 
|---|
| 33 | word page; | 
|---|
| 34 | char *name; | 
|---|
| 35 | }; | 
|---|
| 36 |  | 
|---|
| 37 | struct omflib | 
|---|
| 38 | { | 
|---|
| 39 | FILE *f; | 
|---|
| 40 | long dict_offset; | 
|---|
| 41 | int page_size; | 
|---|
| 42 | int dict_blocks; | 
|---|
| 43 | int flags; | 
|---|
| 44 | struct omfmod *mod_tab; | 
|---|
| 45 | int mod_alloc; | 
|---|
| 46 | int mod_count; | 
|---|
| 47 | byte *dict; | 
|---|
| 48 | int block_index; | 
|---|
| 49 | int block_index_delta; | 
|---|
| 50 | int bucket_index; | 
|---|
| 51 | int bucket_index_delta; | 
|---|
| 52 | struct pubsym *pub_tab; | 
|---|
| 53 | int pub_alloc; | 
|---|
| 54 | int pub_count; | 
|---|
| 55 | char output; | 
|---|
| 56 | word mod_page; | 
|---|
| 57 | enum omf_state state; | 
|---|
| 58 | char mod_name[256+1]; | 
|---|
| 59 | }; | 
|---|
| 60 |  | 
|---|
| 61 | struct ptr | 
|---|
| 62 | { | 
|---|
| 63 | byte *ptr; | 
|---|
| 64 | int len; | 
|---|
| 65 | }; | 
|---|
| 66 |  | 
|---|
| 67 | #pragma pack(1) | 
|---|
| 68 |  | 
|---|
| 69 | struct omf_rec | 
|---|
| 70 | { | 
|---|
| 71 | byte rec_type; | 
|---|
| 72 | word rec_len; | 
|---|
| 73 | }; | 
|---|
| 74 |  | 
|---|
| 75 | struct lib_header | 
|---|
| 76 | { | 
|---|
| 77 | byte rec_type; | 
|---|
| 78 | word rec_len; | 
|---|
| 79 | dword dict_offset; | 
|---|
| 80 | word dict_blocks; | 
|---|
| 81 | byte flags; | 
|---|
| 82 | }; | 
|---|
| 83 |  | 
|---|
| 84 | #pragma pack() | 
|---|
| 85 |  | 
|---|
| 86 | int omflib_set_error (char *error); | 
|---|
| 87 | int omflib_read_dictionary (struct omflib *p, char *error); | 
|---|
| 88 | void omflib_hash (struct omflib *p, const byte *name); | 
|---|
| 89 | int omflib_pad (FILE *f, int size, int force, char *error); | 
|---|
| 90 | int omflib_copy_module (struct omflib *dst_lib, FILE *dst_file, | 
|---|
| 91 | struct omflib *src_lib, FILE *src_file, const char *mod_name, char *error); | 
|---|
| 92 | int omflib_make_mod_tab (struct omflib *p, char *error); | 
|---|
| 93 | int omflib_pubdef (struct omf_rec *rec, byte *buf, word page, | 
|---|
| 94 | int (*walker)(const char *name, char *error), char *error); | 
|---|
| 95 | int omflib_impdef (struct omf_rec *rec, byte *buf, word page, | 
|---|
| 96 | int (*walker)(const char *name, char *error), char *error); | 
|---|
| 97 | int omflib_alias (struct omf_rec *rec, byte *buf, word page, | 
|---|
| 98 | int (*walker)(const char *name, char *error), char *error); | 
|---|