Added "ignore" directive for skipping individual symbol resolution.
[wine.git] / tools / winebuild / build.h
blobdc0cff2d77fb8d16df08ed7643f9e00788830ade
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 */
9 #ifndef __WINE_BUILD_H
10 #define __WINE_BUILD_H
12 #include "config.h"
13 #include <stdio.h>
14 #include <stdlib.h>
16 #ifdef NEED_UNDERSCORE_PREFIX
17 # define PREFIX "_"
18 #else
19 # define PREFIX
20 #endif
22 #ifdef HAVE_ASM_STRING
23 # define STRING ".string"
24 #else
25 # define STRING ".ascii"
26 #endif
28 #if defined(__GNUC__) && !defined(__svr4__)
29 # define USE_STABS
30 #else
31 # undef USE_STABS
32 #endif
34 typedef enum
36 TYPE_VARIABLE, /* variable */
37 TYPE_PASCAL_16, /* pascal function with 16-bit return (Win16) */
38 TYPE_PASCAL, /* pascal function with 32-bit return (Win16) */
39 TYPE_ABS, /* absolute value (Win16) */
40 TYPE_REGISTER, /* register function */
41 TYPE_INTERRUPT, /* interrupt handler function (Win16) */
42 TYPE_STUB, /* unimplemented stub */
43 TYPE_STDCALL, /* stdcall function (Win32) */
44 TYPE_CDECL, /* cdecl function (Win32) */
45 TYPE_VARARGS, /* varargs function (Win32) */
46 TYPE_EXTERN, /* external symbol (Win32) */
47 TYPE_FORWARD, /* forwarded function (Win32) */
48 TYPE_NBTYPES
49 } ORD_TYPE;
51 typedef enum
53 SPEC_INVALID,
54 SPEC_WIN16,
55 SPEC_WIN32
56 } SPEC_TYPE;
58 typedef enum
60 SPEC_MODE_DLL,
61 SPEC_MODE_GUIEXE,
62 SPEC_MODE_CUIEXE,
63 SPEC_MODE_GUIEXE_NO_MAIN,
64 SPEC_MODE_CUIEXE_NO_MAIN
65 } SPEC_MODE;
67 typedef struct
69 int n_values;
70 int *values;
71 } ORD_VARIABLE;
73 typedef struct
75 int n_args;
76 char arg_types[17];
77 char link_name[80];
78 } ORD_FUNCTION;
80 typedef struct
82 int value;
83 } ORD_ABS;
85 typedef struct
87 char link_name[80];
88 } ORD_EXTERN;
90 typedef struct
92 char link_name[80];
93 } ORD_FORWARD;
95 typedef struct
97 ORD_TYPE type;
98 int ordinal;
99 int offset;
100 int lineno;
101 int flags;
102 char name[80];
103 union
105 ORD_VARIABLE var;
106 ORD_FUNCTION func;
107 ORD_ABS abs;
108 ORD_EXTERN ext;
109 ORD_FORWARD fwd;
110 } u;
111 } ORDDEF;
113 /* entry point flags */
114 #define FLAG_NOIMPORT 0x01 /* don't make function available for importing */
115 #define FLAG_NORELAY 0x02 /* don't use relay debugging for this function */
116 #define FLAG_RET64 0x04 /* function returns a 64-bit value */
117 #define FLAG_I386 0x08 /* function is i386 only */
119 /* Offset of a structure field relative to the start of the struct */
120 #define STRUCTOFFSET(type,field) ((int)&((type *)0)->field)
122 /* Offset of register relative to the start of the CONTEXT struct */
123 #define CONTEXTOFFSET(reg) STRUCTOFFSET(CONTEXT86,reg)
125 /* Offset of register relative to the start of the STACK16FRAME struct */
126 #define STACK16OFFSET(reg) STRUCTOFFSET(STACK16FRAME,reg)
128 /* Offset of register relative to the start of the STACK32FRAME struct */
129 #define STACK32OFFSET(reg) STRUCTOFFSET(STACK32FRAME,reg)
131 /* Offset of the stack pointer relative to %fs:(0) */
132 #define STACKOFFSET (STRUCTOFFSET(TEB,cur_stack))
135 #define MAX_ORDINALS 2048
137 /* global functions */
139 extern void *xmalloc (size_t size);
140 extern void *xrealloc (void *ptr, size_t size);
141 extern char *xstrdup( const char *str );
142 extern char *strupper(char *s);
143 extern void fatal_error( const char *msg, ... );
144 extern void fatal_perror( const char *msg, ... );
145 extern void warning( const char *msg, ... );
146 extern void dump_bytes( FILE *outfile, const unsigned char *data, int len,
147 const char *label, int constant );
148 extern void add_import_dll( const char *name );
149 extern void add_ignore_symbol( const char *name );
150 extern int resolve_imports( FILE *outfile );
151 extern int output_imports( FILE *outfile );
152 extern void load_res32_file( const char *name );
153 extern int output_resources( FILE *outfile );
154 extern void load_res16_file( const char *name );
155 extern int output_res16_data( FILE *outfile );
156 extern int output_res16_directory( unsigned char *buffer );
158 extern void BuildGlue( FILE *outfile, FILE *infile );
159 extern void BuildRelays( FILE *outfile );
160 extern void BuildSpec16File( FILE *outfile );
161 extern void BuildSpec32File( FILE *outfile );
162 extern SPEC_TYPE ParseTopLevel( FILE *file );
164 /* global variables */
166 extern int current_line;
167 extern int nb_entry_points;
168 extern int nb_names;
169 extern int Base;
170 extern int Limit;
171 extern int DLLHeapSize;
172 extern int UsePIC;
173 extern int debugging;
174 extern int nb_debug_channels;
175 extern int nb_lib_paths;
177 extern char DLLName[80];
178 extern char DLLFileName[80];
179 extern char DLLInitFunc[80];
180 extern char owner_name[80];
181 extern const char *input_file_name;
182 extern const char *output_file_name;
183 extern char **debug_channels;
184 extern char **lib_path;
186 extern ORDDEF EntryPoints[MAX_ORDINALS];
187 extern ORDDEF *Ordinals[MAX_ORDINALS];
188 extern ORDDEF *Names[MAX_ORDINALS];
189 extern SPEC_MODE SpecMode;
191 #endif /* __WINE_BUILD_H */