Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 1993 Robert J. Amstadt |
| 3 | * Copyright 1995 Martin von Loewis |
| 4 | * Copyright 1995, 1996, 1997 Alexandre Julliard |
| 5 | * Copyright 1997 Eric Youngdale |
| 6 | * Copyright 1999 Ulrich Weigand |
| 7 | */ |
| 8 | |
| 9 | #ifndef __WINE_BUILD_H |
| 10 | #define __WINE_BUILD_H |
| 11 | |
François Gouget | 1425941 | 2001-11-06 20:57:11 +0000 | [diff] [blame] | 12 | #ifndef __WINE_CONFIG_H |
| 13 | # error You must include config.h to use this header |
| 14 | #endif |
| 15 | |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 16 | #include <stdio.h> |
| 17 | #include <stdlib.h> |
| 18 | |
| 19 | #ifdef NEED_UNDERSCORE_PREFIX |
| 20 | # define PREFIX "_" |
| 21 | #else |
| 22 | # define PREFIX |
| 23 | #endif |
| 24 | |
| 25 | #ifdef HAVE_ASM_STRING |
| 26 | # define STRING ".string" |
| 27 | #else |
| 28 | # define STRING ".ascii" |
| 29 | #endif |
| 30 | |
| 31 | #if defined(__GNUC__) && !defined(__svr4__) |
| 32 | # define USE_STABS |
| 33 | #else |
| 34 | # undef USE_STABS |
| 35 | #endif |
| 36 | |
| 37 | typedef enum |
| 38 | { |
Alexandre Julliard | 39b3195 | 2000-11-26 04:31:48 +0000 | [diff] [blame] | 39 | TYPE_VARIABLE, /* variable */ |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 40 | TYPE_PASCAL_16, /* pascal function with 16-bit return (Win16) */ |
| 41 | TYPE_PASCAL, /* pascal function with 32-bit return (Win16) */ |
| 42 | TYPE_ABS, /* absolute value (Win16) */ |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 43 | TYPE_STUB, /* unimplemented stub */ |
| 44 | TYPE_STDCALL, /* stdcall function (Win32) */ |
| 45 | TYPE_CDECL, /* cdecl function (Win32) */ |
| 46 | TYPE_VARARGS, /* varargs function (Win32) */ |
| 47 | TYPE_EXTERN, /* external symbol (Win32) */ |
| 48 | TYPE_FORWARD, /* forwarded function (Win32) */ |
| 49 | TYPE_NBTYPES |
| 50 | } ORD_TYPE; |
| 51 | |
| 52 | typedef enum |
| 53 | { |
| 54 | SPEC_INVALID, |
| 55 | SPEC_WIN16, |
| 56 | SPEC_WIN32 |
| 57 | } SPEC_TYPE; |
| 58 | |
| 59 | typedef enum |
| 60 | { |
| 61 | SPEC_MODE_DLL, |
| 62 | SPEC_MODE_GUIEXE, |
Alexandre Julliard | c585a50 | 2000-09-27 23:40:43 +0000 | [diff] [blame] | 63 | SPEC_MODE_CUIEXE, |
Alexandre Julliard | 909eff9 | 2000-12-15 03:38:11 +0000 | [diff] [blame] | 64 | SPEC_MODE_GUIEXE_UNICODE, |
| 65 | SPEC_MODE_CUIEXE_UNICODE |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 66 | } SPEC_MODE; |
| 67 | |
| 68 | typedef struct |
| 69 | { |
| 70 | int n_values; |
| 71 | int *values; |
| 72 | } ORD_VARIABLE; |
| 73 | |
| 74 | typedef struct |
| 75 | { |
| 76 | int n_args; |
Marcus Meissner | b63ab44 | 2001-06-08 19:02:57 +0000 | [diff] [blame] | 77 | char arg_types[21]; |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 78 | } ORD_FUNCTION; |
| 79 | |
| 80 | typedef struct |
| 81 | { |
| 82 | int value; |
| 83 | } ORD_ABS; |
| 84 | |
| 85 | typedef struct |
| 86 | { |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 87 | ORD_TYPE type; |
| 88 | int ordinal; |
| 89 | int offset; |
Alexandre Julliard | 39b3195 | 2000-11-26 04:31:48 +0000 | [diff] [blame] | 90 | int lineno; |
| 91 | int flags; |
Alexandre Julliard | 66fed8c | 2000-12-15 23:04:40 +0000 | [diff] [blame] | 92 | char *name; |
| 93 | char *link_name; |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 94 | union |
| 95 | { |
| 96 | ORD_VARIABLE var; |
| 97 | ORD_FUNCTION func; |
| 98 | ORD_ABS abs; |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 99 | } u; |
| 100 | } ORDDEF; |
| 101 | |
Alexandre Julliard | 39b3195 | 2000-11-26 04:31:48 +0000 | [diff] [blame] | 102 | /* entry point flags */ |
| 103 | #define FLAG_NOIMPORT 0x01 /* don't make function available for importing */ |
| 104 | #define FLAG_NORELAY 0x02 /* don't use relay debugging for this function */ |
| 105 | #define FLAG_RET64 0x04 /* function returns a 64-bit value */ |
| 106 | #define FLAG_I386 0x08 /* function is i386 only */ |
Alexandre Julliard | 7662ea1 | 2001-12-14 23:14:22 +0000 | [diff] [blame] | 107 | #define FLAG_REGISTER 0x10 /* use register calling convention */ |
| 108 | #define FLAG_INTERRUPT 0x20 /* function is an interrupt handler */ |
Alexandre Julliard | 39b3195 | 2000-11-26 04:31:48 +0000 | [diff] [blame] | 109 | |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 110 | /* Offset of a structure field relative to the start of the struct */ |
| 111 | #define STRUCTOFFSET(type,field) ((int)&((type *)0)->field) |
| 112 | |
| 113 | /* Offset of register relative to the start of the CONTEXT struct */ |
| 114 | #define CONTEXTOFFSET(reg) STRUCTOFFSET(CONTEXT86,reg) |
| 115 | |
| 116 | /* Offset of register relative to the start of the STACK16FRAME struct */ |
| 117 | #define STACK16OFFSET(reg) STRUCTOFFSET(STACK16FRAME,reg) |
| 118 | |
| 119 | /* Offset of register relative to the start of the STACK32FRAME struct */ |
| 120 | #define STACK32OFFSET(reg) STRUCTOFFSET(STACK32FRAME,reg) |
| 121 | |
| 122 | /* Offset of the stack pointer relative to %fs:(0) */ |
| 123 | #define STACKOFFSET (STRUCTOFFSET(TEB,cur_stack)) |
| 124 | |
| 125 | |
Alexandre Julliard | 66fed8c | 2000-12-15 23:04:40 +0000 | [diff] [blame] | 126 | #define MAX_ORDINALS 65535 |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 127 | |
| 128 | /* global functions */ |
| 129 | |
| 130 | extern void *xmalloc (size_t size); |
| 131 | extern void *xrealloc (void *ptr, size_t size); |
| 132 | extern char *xstrdup( const char *str ); |
| 133 | extern char *strupper(char *s); |
| 134 | extern void fatal_error( const char *msg, ... ); |
Alexandre Julliard | 003e24c | 2000-10-23 21:33:06 +0000 | [diff] [blame] | 135 | extern void fatal_perror( const char *msg, ... ); |
Alexandre Julliard | c585a50 | 2000-09-27 23:40:43 +0000 | [diff] [blame] | 136 | extern void warning( const char *msg, ... ); |
Alexandre Julliard | cbeb644 | 2000-10-25 20:33:58 +0000 | [diff] [blame] | 137 | extern void dump_bytes( FILE *outfile, const unsigned char *data, int len, |
| 138 | const char *label, int constant ); |
Josh DuBois | 0b64cfb | 2001-02-13 02:06:38 +0000 | [diff] [blame] | 139 | extern int get_alignment(int alignBoundary); |
| 140 | |
Eric Pouech | 5e32d16 | 2000-12-26 01:22:34 +0000 | [diff] [blame] | 141 | extern void add_import_dll( const char *name, int delay ); |
Jon Griffiths | 4f12e61 | 2000-12-14 22:18:22 +0000 | [diff] [blame] | 142 | extern void add_ignore_symbol( const char *name ); |
Dmitry Timoshkov | 3724de9 | 2001-05-22 19:55:51 +0000 | [diff] [blame] | 143 | extern int resolve_imports( void ); |
Alexandre Julliard | c585a50 | 2000-09-27 23:40:43 +0000 | [diff] [blame] | 144 | extern int output_imports( FILE *outfile ); |
Alexandre Julliard | 003e24c | 2000-10-23 21:33:06 +0000 | [diff] [blame] | 145 | extern void load_res32_file( const char *name ); |
| 146 | extern int output_resources( FILE *outfile ); |
Alexandre Julliard | cbeb644 | 2000-10-25 20:33:58 +0000 | [diff] [blame] | 147 | extern void load_res16_file( const char *name ); |
| 148 | extern int output_res16_data( FILE *outfile ); |
| 149 | extern int output_res16_directory( unsigned char *buffer ); |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 150 | |
| 151 | extern void BuildGlue( FILE *outfile, FILE *infile ); |
Alexandre Julliard | eb9a863 | 2001-12-11 00:50:33 +0000 | [diff] [blame] | 152 | extern void BuildRelays16( FILE *outfile ); |
| 153 | extern void BuildRelays32( FILE *outfile ); |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 154 | extern void BuildSpec16File( FILE *outfile ); |
Alexandre Julliard | 3570bfd | 2000-11-13 04:46:34 +0000 | [diff] [blame] | 155 | extern void BuildSpec32File( FILE *outfile ); |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 156 | extern SPEC_TYPE ParseTopLevel( FILE *file ); |
| 157 | |
| 158 | /* global variables */ |
| 159 | |
| 160 | extern int current_line; |
| 161 | extern int nb_entry_points; |
| 162 | extern int nb_names; |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 163 | extern int Base; |
| 164 | extern int Limit; |
| 165 | extern int DLLHeapSize; |
| 166 | extern int UsePIC; |
| 167 | extern int debugging; |
Alexandre Julliard | 3581865 | 2001-06-07 22:29:03 +0000 | [diff] [blame] | 168 | extern int stack_size; |
Alexandre Julliard | 9a63469 | 2000-11-05 04:49:13 +0000 | [diff] [blame] | 169 | extern int nb_debug_channels; |
Alexandre Julliard | 000c13a | 2000-11-09 20:31:18 +0000 | [diff] [blame] | 170 | extern int nb_lib_paths; |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 171 | |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 172 | extern char DLLName[80]; |
| 173 | extern char DLLFileName[80]; |
Alexandre Julliard | 76d3671 | 2000-07-28 00:07:18 +0000 | [diff] [blame] | 174 | extern char owner_name[80]; |
Alexandre Julliard | 66fed8c | 2000-12-15 23:04:40 +0000 | [diff] [blame] | 175 | extern char *init_func; |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 176 | extern const char *input_file_name; |
| 177 | extern const char *output_file_name; |
Alexandre Julliard | 9a63469 | 2000-11-05 04:49:13 +0000 | [diff] [blame] | 178 | extern char **debug_channels; |
Alexandre Julliard | 000c13a | 2000-11-09 20:31:18 +0000 | [diff] [blame] | 179 | extern char **lib_path; |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 180 | |
Alexandre Julliard | 66fed8c | 2000-12-15 23:04:40 +0000 | [diff] [blame] | 181 | extern ORDDEF *EntryPoints[MAX_ORDINALS]; |
Alexandre Julliard | e482eeb | 2000-06-23 20:15:35 +0000 | [diff] [blame] | 182 | extern ORDDEF *Ordinals[MAX_ORDINALS]; |
| 183 | extern ORDDEF *Names[MAX_ORDINALS]; |
| 184 | extern SPEC_MODE SpecMode; |
| 185 | |
| 186 | #endif /* __WINE_BUILD_H */ |