~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/tools/winebuild/build.h

Version: ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  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  * 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.
 12  *
 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.
 17  *
 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 21  */
 22 
 23 #ifndef __WINE_BUILD_H
 24 #define __WINE_BUILD_H
 25 
 26 #ifndef __WINE_CONFIG_H
 27 # error You must include config.h to use this header
 28 #endif
 29 
 30 #include <stdio.h>
 31 #include <stdlib.h>
 32 #include <string.h>
 33 
 34 #ifndef max
 35 #define max(a,b)   (((a) > (b)) ? (a) : (b))
 36 #endif
 37 #ifndef min
 38 #define min(a,b)   (((a) < (b)) ? (a) : (b))
 39 #endif
 40 
 41 typedef enum
 42 {
 43     TYPE_VARIABLE,     /* variable */
 44     TYPE_PASCAL,       /* pascal function (Win16) */
 45     TYPE_ABS,          /* absolute value (Win16) */
 46     TYPE_STUB,         /* unimplemented stub */
 47     TYPE_STDCALL,      /* stdcall function (Win32) */
 48     TYPE_CDECL,        /* cdecl function (Win32) */
 49     TYPE_VARARGS,      /* varargs function (Win32) */
 50     TYPE_EXTERN,       /* external symbol (Win32) */
 51     TYPE_NBTYPES
 52 } ORD_TYPE;
 53 
 54 typedef enum
 55 {
 56     SPEC_WIN16,
 57     SPEC_WIN32
 58 } SPEC_TYPE;
 59 
 60 typedef struct
 61 {
 62     int n_values;
 63     int *values;
 64 } ORD_VARIABLE;
 65 
 66 typedef struct
 67 {
 68     char arg_types[21];
 69 } ORD_FUNCTION;
 70 
 71 typedef struct
 72 {
 73     unsigned short value;
 74 } ORD_ABS;
 75 
 76 typedef struct
 77 {
 78     ORD_TYPE    type;
 79     int         ordinal;
 80     int         lineno;
 81     int         flags;
 82     char       *name;         /* public name of this function */
 83     char       *link_name;    /* name of the C symbol to link to */
 84     char       *export_name;  /* name exported under for noname exports */
 85     union
 86     {
 87         ORD_VARIABLE   var;
 88         ORD_FUNCTION   func;
 89         ORD_ABS        abs;
 90     } u;
 91 } ORDDEF;
 92 
 93 typedef struct
 94 {
 95     char            *src_name;           /* file name of the source spec file */
 96     char            *file_name;          /* file name of the dll */
 97     char            *dll_name;           /* internal name of the dll */
 98     char            *init_func;          /* initialization routine */
 99     char            *main_module;        /* main Win32 module for Win16 specs */
100     SPEC_TYPE        type;               /* type of dll (Win16/Win32) */
101     int              base;               /* ordinal base */
102     int              limit;              /* ordinal limit */
103     int              stack_size;         /* exe stack size */
104     int              heap_size;          /* exe heap size */
105     int              nb_entry_points;    /* number of used entry points */
106     int              alloc_entry_points; /* number of allocated entry points */
107     int              nb_names;           /* number of entry points with names */
108     unsigned int     nb_resources;       /* number of resources */
109     int              characteristics;    /* characteristics for the PE header */
110     int              dll_characteristics;/* DLL characteristics for the PE header */
111     int              subsystem;          /* subsystem id */
112     int              subsystem_major;    /* subsystem version major number */
113     int              subsystem_minor;    /* subsystem version minor number */
114     ORDDEF          *entry_points;       /* dll entry points */
115     ORDDEF         **names;              /* array of entry point names (points into entry_points) */
116     ORDDEF         **ordinals;           /* array of dll ordinals (points into entry_points) */
117     struct resource *resources;          /* array of dll resources (format differs between Win16/Win32) */
118 } DLLSPEC;
119 
120 enum target_cpu
121 {
122     CPU_x86, CPU_x86_64, CPU_SPARC, CPU_ALPHA, CPU_POWERPC
123 };
124 
125 enum target_platform
126 {
127     PLATFORM_UNSPECIFIED,
128     PLATFORM_APPLE,
129     PLATFORM_FREEBSD,
130     PLATFORM_SOLARIS,
131     PLATFORM_WINDOWS
132 };
133 
134 extern char *target_alias;
135 extern enum target_cpu target_cpu;
136 extern enum target_platform target_platform;
137 
138 /* entry point flags */
139 #define FLAG_NORELAY   0x01  /* don't use relay debugging for this function */
140 #define FLAG_NONAME    0x02  /* don't export function by name */
141 #define FLAG_RET16     0x04  /* function returns a 16-bit value */
142 #define FLAG_RET64     0x08  /* function returns a 64-bit value */
143 #define FLAG_REGISTER  0x10  /* use register calling convention */
144 #define FLAG_PRIVATE   0x20  /* function is private (cannot be imported) */
145 #define FLAG_ORDINAL   0x40  /* function should be imported by ordinal */
146 
147 #define FLAG_FORWARD   0x100  /* function is a forwarded name */
148 #define FLAG_EXT_LINK  0x200  /* function links to an external symbol */
149 
150 #define FLAG_CPU(cpu)  (0x01000 << (cpu))
151 #define FLAG_CPU_MASK  0x1f000
152 #define FLAG_CPU_WIN64 (FLAG_CPU(CPU_x86_64))
153 #define FLAG_CPU_WIN32 (FLAG_CPU_MASK & ~FLAG_CPU_WIN64)
154 
155 #define MAX_ORDINALS  65535
156 
157 /* some Windows constants */
158 
159 #define IMAGE_FILE_RELOCS_STRIPPED         0x0001 /* No relocation info */
160 #define IMAGE_FILE_EXECUTABLE_IMAGE        0x0002
161 #define IMAGE_FILE_LINE_NUMS_STRIPPED      0x0004
162 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED     0x0008
163 #define IMAGE_FILE_AGGRESIVE_WS_TRIM       0x0010
164 #define IMAGE_FILE_LARGE_ADDRESS_AWARE     0x0020
165 #define IMAGE_FILE_16BIT_MACHINE           0x0040
166 #define IMAGE_FILE_BYTES_REVERSED_LO       0x0080
167 #define IMAGE_FILE_32BIT_MACHINE           0x0100
168 #define IMAGE_FILE_DEBUG_STRIPPED          0x0200
169 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
170 #define IMAGE_FILE_NET_RUN_FROM_SWAP       0x0800
171 #define IMAGE_FILE_SYSTEM                  0x1000
172 #define IMAGE_FILE_DLL                     0x2000
173 #define IMAGE_FILE_UP_SYSTEM_ONLY          0x4000
174 #define IMAGE_FILE_BYTES_REVERSED_HI       0x8000
175 
176 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
177 
178 #define IMAGE_SUBSYSTEM_NATIVE      1
179 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
180 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
181 
182 /* global functions */
183 
184 #ifndef __GNUC__
185 #define __attribute__(X)
186 #endif
187 
188 #ifndef DECLSPEC_NORETURN
189 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
190 #  define DECLSPEC_NORETURN __declspec(noreturn)
191 # else
192 #  define DECLSPEC_NORETURN __attribute__((noreturn))
193 # endif
194 #endif
195 
196 extern void *xmalloc (size_t size);
197 extern void *xrealloc (void *ptr, size_t size);
198 extern char *xstrdup( const char *str );
199 extern char *strupper(char *s);
200 extern int strendswith(const char* str, const char* end);
201 extern DECLSPEC_NORETURN void fatal_error( const char *msg, ... )
202    __attribute__ ((__format__ (__printf__, 1, 2)));
203 extern DECLSPEC_NORETURN void fatal_perror( const char *msg, ... )
204    __attribute__ ((__format__ (__printf__, 1, 2)));
205 extern void error( const char *msg, ... )
206    __attribute__ ((__format__ (__printf__, 1, 2)));
207 extern void warning( const char *msg, ... )
208    __attribute__ ((__format__ (__printf__, 1, 2)));
209 extern int output( const char *format, ... )
210    __attribute__ ((__format__ (__printf__, 1, 2)));
211 extern const char *get_as_command(void);
212 extern const char *get_ld_command(void);
213 extern const char *get_nm_command(void);
214 extern const char *get_windres_command(void);
215 extern char *get_temp_file_name( const char *prefix, const char *suffix );
216 extern void output_standard_file_header(void);
217 extern FILE *open_input_file( const char *srcdir, const char *name );
218 extern void close_input_file( FILE *file );
219 extern void dump_bytes( const void *buffer, unsigned int size );
220 extern int remove_stdcall_decoration( char *name );
221 extern void assemble_file( const char *src_file, const char *obj_file );
222 extern DLLSPEC *alloc_dll_spec(void);
223 extern void free_dll_spec( DLLSPEC *spec );
224 extern const char *make_c_identifier( const char *str );
225 extern const char *get_stub_name( const ORDDEF *odp, const DLLSPEC *spec );
226 extern enum target_cpu get_cpu_from_name( const char *name );
227 extern unsigned int get_alignment(unsigned int align);
228 extern unsigned int get_page_size(void);
229 extern unsigned int get_ptr_size(void);
230 extern const char *asm_name( const char *func );
231 extern const char *func_declaration( const char *func );
232 extern const char *asm_globl( const char *func );
233 extern const char *get_asm_ptr_keyword(void);
234 extern const char *get_asm_string_keyword(void);
235 extern const char *get_asm_short_keyword(void);
236 extern const char *get_asm_rodata_section(void);
237 extern const char *get_asm_string_section(void);
238 extern void output_function_size( const char *name );
239 extern void output_gnu_stack_note(void);
240 
241 extern void add_import_dll( const char *name, const char *filename );
242 extern void add_delayed_import( const char *name );
243 extern void add_ignore_symbol( const char *name );
244 extern void add_extra_ld_symbol( const char *name );
245 extern void read_undef_symbols( DLLSPEC *spec, char **argv );
246 extern int resolve_imports( DLLSPEC *spec );
247 extern int has_imports(void);
248 extern int has_relays( DLLSPEC *spec );
249 extern void output_get_pc_thunk(void);
250 extern void output_module( DLLSPEC *spec );
251 extern void output_stubs( DLLSPEC *spec );
252 extern void output_imports( DLLSPEC *spec );
253 extern void output_exports( DLLSPEC *spec );
254 extern int load_res32_file( const char *name, DLLSPEC *spec );
255 extern void output_resources( DLLSPEC *spec );
256 extern void output_bin_resources( DLLSPEC *spec, unsigned int start_rva );
257 extern void output_fake_module( DLLSPEC *spec );
258 extern void load_res16_file( const char *name, DLLSPEC *spec );
259 extern void output_res16_data( DLLSPEC *spec );
260 extern void output_bin_res16_data( DLLSPEC *spec );
261 extern void output_res16_directory( DLLSPEC *spec );
262 extern void output_bin_res16_directory( DLLSPEC *spec, unsigned int data_offset );
263 extern void output_spec16_file( DLLSPEC *spec );
264 extern void output_fake_module16( DLLSPEC *spec16 );
265 extern void output_res_o_file( DLLSPEC *spec );
266 
267 extern void BuildRelays16(void);
268 extern void BuildRelays32(void);
269 extern void BuildSpec16File( DLLSPEC *spec );
270 extern void BuildSpec32File( DLLSPEC *spec );
271 extern void BuildDef32File( DLLSPEC *spec );
272 
273 extern void add_16bit_exports( DLLSPEC *spec32, DLLSPEC *spec16 );
274 extern int parse_spec_file( FILE *file, DLLSPEC *spec );
275 extern int parse_def_file( FILE *file, DLLSPEC *spec );
276 
277 /* buffer management */
278 
279 extern int byte_swapped;
280 extern const char *input_buffer_filename;
281 extern const unsigned char *input_buffer;
282 extern size_t input_buffer_pos;
283 extern size_t input_buffer_size;
284 extern unsigned char *output_buffer;
285 extern size_t output_buffer_pos;
286 extern size_t output_buffer_size;
287 
288 extern void init_input_buffer( const char *file );
289 extern void init_output_buffer(void);
290 extern void flush_output_buffer(void);
291 extern unsigned char get_byte(void);
292 extern unsigned short get_word(void);
293 extern unsigned int get_dword(void);
294 extern void put_data( const void *data, size_t size );
295 extern void put_byte( unsigned char val );
296 extern void put_word( unsigned short val );
297 extern void put_dword( unsigned int val );
298 extern void put_qword( unsigned int val );
299 extern void put_pword( unsigned int val );
300 extern void align_output( unsigned int align );
301 
302 /* global variables */
303 
304 extern int current_line;
305 extern int UsePIC;
306 extern int nb_lib_paths;
307 extern int nb_errors;
308 extern int display_warnings;
309 extern int kill_at;
310 extern int verbose;
311 extern int save_temps;
312 extern int link_ext_symbols;
313 extern int force_pointer_size;
314 
315 extern char *input_file_name;
316 extern char *spec_file_name;
317 extern FILE *output_file;
318 extern const char *output_file_name;
319 extern char **lib_path;
320 
321 extern char *as_command;
322 extern char *ld_command;
323 extern char *nm_command;
324 
325 #endif  /* __WINE_BUILD_H */
326 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.