| 1 | /* sys/omflib.h (emx+gcc) */ | 
|---|
| 2 |  | 
|---|
| 3 | /* Public header file for the emx OMFLIB library. */ | 
|---|
| 4 |  | 
|---|
| 5 | #ifndef _SYS_OMFLIB_H | 
|---|
| 6 | #define _SYS_OMFLIB_H | 
|---|
| 7 |  | 
|---|
| 8 | #if defined (__cplusplus) | 
|---|
| 9 | extern "C" { | 
|---|
| 10 | #endif | 
|---|
| 11 |  | 
|---|
| 12 | #ifndef _BYTE_WORD_DWORD | 
|---|
| 13 | #define _BYTE_WORD_DWORD | 
|---|
| 14 | typedef unsigned char byte; | 
|---|
| 15 | typedef unsigned short word; | 
|---|
| 16 | typedef unsigned long dword; | 
|---|
| 17 | #endif /* _BYTE_WORD_DWORD */ | 
|---|
| 18 |  | 
|---|
| 19 | #if !defined (THEADR) | 
|---|
| 20 |  | 
|---|
| 21 | /* OMF record types.  To get the 32-bit variant of a record type, add | 
|---|
| 22 | REC32. */ | 
|---|
| 23 | #define THEADR          0x80    /* Translator module header record */ | 
|---|
| 24 | #define COMENT          0x88    /* Comment record */ | 
|---|
| 25 | #define MODEND          0x8a    /* Module end record */ | 
|---|
| 26 | #define EXTDEF          0x8c    /* External names definition record */ | 
|---|
| 27 | #define TYPDEF          0x8e    /* Type definition record */ | 
|---|
| 28 | #define PUBDEF          0x90    /* Public names definition record */ | 
|---|
| 29 | #define LINNUM          0x94    /* Line numbers record */ | 
|---|
| 30 | #define LNAMES          0x96    /* List of names record */ | 
|---|
| 31 | #define SEGDEF          0x98    /* Segment definition record */ | 
|---|
| 32 | #define GRPDEF          0x9a    /* Group definition record */ | 
|---|
| 33 | #define FIXUPP          0x9c    /* Fixup record */ | 
|---|
| 34 | #define LEDATA          0xa0    /* Logical enumerated data record */ | 
|---|
| 35 | #define LIDATA          0xa2    /* Logical iterated data record */ | 
|---|
| 36 | #define COMDEF          0xb0    /* Communal names definition record */ | 
|---|
| 37 | #define COMDEF_TYPEFAR  0x61            /* Commnual name type: far */ | 
|---|
| 38 | #define COMDEF_TYPENEAR 0x62            /* Commnual name type: near */ | 
|---|
| 39 | #define COMDAT          0xc2    /* Common block */ | 
|---|
| 40 | #define ALIAS           0xc6    /* Alias definition record */ | 
|---|
| 41 | #define LIBHDR          0xf0    /* Library header */ | 
|---|
| 42 | #define LIBEND          0xf1    /* Library end */ | 
|---|
| 43 |  | 
|---|
| 44 | /* Add this constant (using the | operator) to get the 32-bit variant | 
|---|
| 45 | of a record type.  Some fields will contain 32-bit values instead | 
|---|
| 46 | of 16-bit values. */ | 
|---|
| 47 | #define REC32           0x01 | 
|---|
| 48 |  | 
|---|
| 49 | #endif | 
|---|
| 50 |  | 
|---|
| 51 | /* Comment classes */ | 
|---|
| 52 | #define CLASS_TRANS     0x00            /* Translators - who uses this? */ | 
|---|
| 53 | #define CLASS_INTELC    0x01            /* Intel Copryight */ | 
|---|
| 54 | #define CLASS_MSDOSVER  0x9c            /* MS-DOS version - obsolete */ | 
|---|
| 55 | #define CLASS_MODEL     0x9d            /* Memory model - ignored by linker. */ | 
|---|
| 56 | #define CLASS_DOSSEG    0x9e            /* Linker DOSSEG switch. */ | 
|---|
| 57 | #define CLASS_DEFLIB    0x9f            /* Default library. */ | 
|---|
| 58 | #define CLASS_OMFEXT    0xa0            /* OMF extenstions */ | 
|---|
| 59 | #define OMFEXT_IMPDEF   0x01 | 
|---|
| 60 | #define OMFEXT_EXPDEF   0x02 | 
|---|
| 61 | #define OMFEXT_INCDEF   0x03 | 
|---|
| 62 | #define OMFEXT_PROTLIB  0x04 | 
|---|
| 63 | #define OMFEXT_LNKDIR   0x05 | 
|---|
| 64 | #define CLASS_DBGTYPE   0xa1            /* Debug type */ | 
|---|
| 65 | #define CLASS_PASS      0xa2            /* End of linker pass 1. */ | 
|---|
| 66 | #define CLASS_LIBMOD    0xa3            /* Library module comment. */ | 
|---|
| 67 | #define CLASS_EXESTR    0xa4            /* Executable Module Identification String. */ | 
|---|
| 68 | #define CLASS_INCERR    0xa6            /* Incremental compilation error. */ | 
|---|
| 69 | #define CLASS_NOPAD     0xa7            /* No segment padding. */ | 
|---|
| 70 | #define CLASS_WKEXT     0xa8            /* Weak external. */ | 
|---|
| 71 | #define CLASS_LZEXT     0xa9            /* Lazy external. */ | 
|---|
| 72 | #define CLASS_PHARLAP   0xaa            /* PharLap Format record. */ | 
|---|
| 73 | #define CLASS_IPADATA   0xae            /* Interprocedural Analysis Data record. */ | 
|---|
| 74 | #define CLASS_TIS       0xac            /* TIS standard level? 'TIS' + version word. */ | 
|---|
| 75 | #define CLASS_DBGPACK   0xad            /* /DBGPACK DLL name for ilink. */ | 
|---|
| 76 | #define CLASS_IDMDLL    0xaf            /* Identifier Manipulator Dynamic Link Library. */ | 
|---|
| 77 |  | 
|---|
| 78 |  | 
|---|
| 79 | #if !defined (IMPDEF_CLASS) | 
|---|
| 80 | #define IMPDEF_CLASS    CLASS_OMFEXT | 
|---|
| 81 | #define LIBMOD_CLASS    0xa3 | 
|---|
| 82 | #define IMPDEF_SUBTYPE  OMFEXT_IMPDEF | 
|---|
| 83 | #endif | 
|---|
| 84 |  | 
|---|
| 85 | struct omflib; | 
|---|
| 86 |  | 
|---|
| 87 | struct omflib *omflib_open (const char *fname, char *error); | 
|---|
| 88 | struct omflib *omflib_create (const char *fname, int page_size, char *error); | 
|---|
| 89 | int omflib_close (struct omflib *p, char *error); | 
|---|
| 90 | int omflib_module_name (char *dst, const char *src); | 
|---|
| 91 | int omflib_find_module (struct omflib *p, const char *name, char *error); | 
|---|
| 92 | int omflib_mark_deleted (struct omflib *p, const char *name, char *error); | 
|---|
| 93 | int omflib_pubdef_walk (struct omflib *p, word page, | 
|---|
| 94 | int (*walker)(const char *name, char *error), char *error); | 
|---|
| 95 | int omflib_extract (struct omflib *p, const char *name, char *error); | 
|---|
| 96 | int omflib_add_module (struct omflib *p, const char *fname, char *error); | 
|---|
| 97 | int omflib_module_count (struct omflib *p, char *error); | 
|---|
| 98 | int omflib_module_info (struct omflib *p, int n, char *name, int *page, | 
|---|
| 99 | char *error); | 
|---|
| 100 | int omflib_copy_lib (struct omflib *dst, struct omflib *src, char *error); | 
|---|
| 101 | int omflib_finish (struct omflib *p, char *error); | 
|---|
| 102 | int omflib_write_record (struct omflib *p, byte rec_type, word rec_len, | 
|---|
| 103 | const byte *buffer, int chksum, char *error); | 
|---|
| 104 | int omflib_write_module (struct omflib *p, const char *name, word *pagep, | 
|---|
| 105 | char *error); | 
|---|
| 106 | int omflib_add_pub (struct omflib *p, const char *name, word page, | 
|---|
| 107 | char *error); | 
|---|
| 108 | int omflib_header (struct omflib *p, char *error); | 
|---|
| 109 | int omflib_find_symbol (struct omflib *p, const char *name, char *error); | 
|---|
| 110 | long omflib_page_pos (struct omflib *p, int page); | 
|---|
| 111 |  | 
|---|
| 112 | #if defined (__cplusplus) | 
|---|
| 113 | } | 
|---|
| 114 | #endif | 
|---|
| 115 |  | 
|---|
| 116 | #endif /* not _SYS_OMFLIB_H */ | 
|---|