Release 20030408.
[wine/gsoc-2012-control.git] / tools / winebuild / build.h
blob475da5aa5b2841fa9fdacabfc168dc616accbc36
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
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef __WINE_BUILD_H
24 #define __WINE_BUILD_H
26 #ifndef __WINE_CONFIG_H
27 # error You must include config.h to use this header
28 #endif
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <string.h>
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_STUB, /* unimplemented stub */
41 TYPE_STDCALL, /* stdcall function (Win32) */
42 TYPE_CDECL, /* cdecl function (Win32) */
43 TYPE_VARARGS, /* varargs function (Win32) */
44 TYPE_EXTERN, /* external symbol (Win32) */
45 TYPE_NBTYPES
46 } ORD_TYPE;
48 typedef enum
50 SPEC_WIN16,
51 SPEC_WIN32
52 } SPEC_TYPE;
54 typedef enum
56 SPEC_MODE_DLL,
57 SPEC_MODE_GUIEXE,
58 SPEC_MODE_CUIEXE,
59 SPEC_MODE_GUIEXE_UNICODE,
60 SPEC_MODE_CUIEXE_UNICODE
61 } SPEC_MODE;
63 typedef struct
65 int n_values;
66 int *values;
67 } ORD_VARIABLE;
69 typedef struct
71 int n_args;
72 char arg_types[21];
73 } ORD_FUNCTION;
75 typedef struct
77 int value;
78 } ORD_ABS;
80 typedef struct
82 ORD_TYPE type;
83 int ordinal;
84 int offset;
85 int lineno;
86 int flags;
87 char *name; /* public name of this function */
88 char *link_name; /* name of the C symbol to link to */
89 char *export_name; /* name exported under for noname exports */
90 union
92 ORD_VARIABLE var;
93 ORD_FUNCTION func;
94 ORD_ABS abs;
95 } u;
96 } ORDDEF;
98 /* entry point flags */
99 #define FLAG_NORELAY 0x01 /* don't use relay debugging for this function */
100 #define FLAG_NONAME 0x02 /* don't import function by name */
101 #define FLAG_RET64 0x04 /* function returns a 64-bit value */
102 #define FLAG_I386 0x08 /* function is i386 only */
103 #define FLAG_REGISTER 0x10 /* use register calling convention */
104 #define FLAG_INTERRUPT 0x20 /* function is an interrupt handler */
105 #define FLAG_FORWARD 0x100 /* function is a forwarded name */
107 /* Offset of a structure field relative to the start of the struct */
108 #define STRUCTOFFSET(type,field) ((int)&((type *)0)->field)
110 /* Offset of register relative to the start of the CONTEXT struct */
111 #define CONTEXTOFFSET(reg) STRUCTOFFSET(CONTEXT86,reg)
113 /* Offset of register relative to the start of the STACK16FRAME struct */
114 #define STACK16OFFSET(reg) STRUCTOFFSET(STACK16FRAME,reg)
116 /* Offset of register relative to the start of the STACK32FRAME struct */
117 #define STACK32OFFSET(reg) STRUCTOFFSET(STACK32FRAME,reg)
119 /* Offset of the stack pointer relative to %fs:(0) */
120 #define STACKOFFSET (STRUCTOFFSET(TEB,cur_stack))
123 #define MAX_ORDINALS 65535
125 /* global functions */
127 extern void *xmalloc (size_t size);
128 extern void *xrealloc (void *ptr, size_t size);
129 extern char *xstrdup( const char *str );
130 extern char *strupper(char *s);
131 extern void fatal_error( const char *msg, ... );
132 extern void fatal_perror( const char *msg, ... );
133 extern void error( const char *msg, ... );
134 extern void warning( const char *msg, ... );
135 extern void output_standard_file_header( FILE *outfile );
136 extern FILE *open_input_file( const char *srcdir, const char *name );
137 extern void close_input_file( FILE *file );
138 extern void dump_bytes( FILE *outfile, const unsigned char *data, int len,
139 const char *label, int constant );
140 extern const char *make_c_identifier( const char *str );
141 extern int get_alignment(int alignBoundary);
143 extern void add_import_dll( const char *name, int delay );
144 extern void add_ignore_symbol( const char *name );
145 extern void read_undef_symbols( char **argv );
146 extern int resolve_imports( void );
147 extern int output_imports( FILE *outfile );
148 extern int load_res32_file( const char *name );
149 extern int output_resources( FILE *outfile );
150 extern void load_res16_file( const char *name );
151 extern int output_res16_data( FILE *outfile );
152 extern int output_res16_directory( unsigned char *buffer );
153 extern void output_dll_init( FILE *outfile, const char *constructor, const char *destructor );
154 extern int parse_debug_channels( const char *srcdir, const char *filename );
156 extern void BuildGlue( FILE *outfile, const char *srcdir, char **argv );
157 extern void BuildRelays16( FILE *outfile );
158 extern void BuildRelays32( FILE *outfile );
159 extern void BuildSpec16File( FILE *outfile );
160 extern void BuildSpec32File( FILE *outfile );
161 extern void BuildDef32File( FILE *outfile );
162 extern void BuildDebugFile( FILE *outfile, const char *srcdir, char **argv );
163 extern int ParseTopLevel( FILE *file );
165 /* global variables */
167 extern int current_line;
168 extern int nb_entry_points;
169 extern int nb_names;
170 extern int Base;
171 extern int Limit;
172 extern int DLLHeapSize;
173 extern int UsePIC;
174 extern int debugging;
175 extern int stack_size;
176 extern int nb_debug_channels;
177 extern int nb_lib_paths;
178 extern int nb_errors;
179 extern int display_warnings;
180 extern int kill_at;
182 extern char *owner_name;
183 extern char *dll_name;
184 extern char *dll_file_name;
185 extern char *init_func;
186 extern char *input_file_name;
187 extern const char *output_file_name;
188 extern char **debug_channels;
189 extern char **lib_path;
191 extern ORDDEF *EntryPoints[MAX_ORDINALS];
192 extern ORDDEF *Ordinals[MAX_ORDINALS];
193 extern ORDDEF *Names[MAX_ORDINALS];
194 extern SPEC_MODE SpecMode;
195 extern SPEC_TYPE SpecType;
197 #endif /* __WINE_BUILD_H */