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
43 #if !defined(HAVE_POPEN) && defined(HAVE__POPEN)
47 #if !defined(HAVE_PCLOSE) && defined(HAVE__PCLOSE)
48 #define pclose _pclose
51 #if !defined(HAVE_STRNCASECMP) && defined(HAVE__STRNICMP)
52 # define strncasecmp _strnicmp
55 #if !defined(HAVE_STRCASECMP) && defined(HAVE__STRICMP)
56 # define strcasecmp _stricmp
59 #define PUT_WORD(ptr, w) (*(WORD *)(ptr) = (w))
60 #define PUT_LE_WORD(ptr, w) \
61 do { ((BYTE *)(ptr))[0] = LOBYTE(w); \
62 ((BYTE *)(ptr))[1] = HIBYTE(w); } while (0)
63 #define PUT_BE_WORD(ptr, w) \
64 do { ((BYTE *)(ptr))[1] = LOBYTE(w); \
65 ((BYTE *)(ptr))[0] = HIBYTE(w); } while (0)
67 #if defined(ALLOW_UNALIGNED_ACCESS)
68 #define PUT_UA_WORD(ptr, w) PUT_WORD(ptr, w)
69 #elif defined(WORDS_BIGENDIAN)
70 #define PUT_UA_WORD(ptr, w) PUT_BE_WORD(ptr, w)
72 #define PUT_UA_WORD(ptr, w) PUT_LE_WORD(ptr, w)
75 #ifdef NEED_UNDERSCORE_PREFIX
76 # define __ASM_NAME(name) "_" name
78 # define __ASM_NAME(name) name
81 #ifdef NEED_TYPE_IN_DEF
82 # define __ASM_FUNC(name) ".def " __ASM_NAME(name) "; .scl 2; .type 32; .endef"
84 # define __ASM_FUNC(name) ".type " __ASM_NAME(name) ",@function"
87 #ifdef NEED_UNDERSCORE_PREFIX
93 #ifdef HAVE_ASM_STRING
94 # define STRING ".string"
96 # define STRING ".ascii"
101 TYPE_VARIABLE
, /* variable */
102 TYPE_PASCAL_16
, /* pascal function with 16-bit return (Win16) */
103 TYPE_PASCAL
, /* pascal function with 32-bit return (Win16) */
104 TYPE_ABS
, /* absolute value (Win16) */
105 TYPE_STUB
, /* unimplemented stub */
106 TYPE_STDCALL
, /* stdcall function (Win32) */
107 TYPE_CDECL
, /* cdecl function (Win32) */
108 TYPE_VARARGS
, /* varargs function (Win32) */
109 TYPE_EXTERN
, /* external symbol (Win32) */
110 TYPE_FORWARD
, /* forwarded function (Win32) */
126 SPEC_MODE_GUIEXE_UNICODE
,
127 SPEC_MODE_CUIEXE_UNICODE
164 /* entry point flags */
165 #define FLAG_NOIMPORT 0x01 /* don't make function available for importing */
166 #define FLAG_NORELAY 0x02 /* don't use relay debugging for this function */
167 #define FLAG_RET64 0x04 /* function returns a 64-bit value */
168 #define FLAG_I386 0x08 /* function is i386 only */
169 #define FLAG_REGISTER 0x10 /* use register calling convention */
170 #define FLAG_INTERRUPT 0x20 /* function is an interrupt handler */
172 /* Offset of a structure field relative to the start of the struct */
173 #define STRUCTOFFSET(type,field) ((int)&((type *)0)->field)
175 /* Offset of register relative to the start of the CONTEXT struct */
176 #define CONTEXTOFFSET(reg) STRUCTOFFSET(CONTEXT86,reg)
178 /* Offset of register relative to the start of the STACK16FRAME struct */
179 #define STACK16OFFSET(reg) STRUCTOFFSET(STACK16FRAME,reg)
181 /* Offset of register relative to the start of the STACK32FRAME struct */
182 #define STACK32OFFSET(reg) STRUCTOFFSET(STACK32FRAME,reg)
184 /* Offset of the stack pointer relative to %fs:(0) */
185 #define STACKOFFSET (STRUCTOFFSET(TEB,cur_stack))
188 #define MAX_ORDINALS 65535
190 /* global functions */
192 extern void *xmalloc (size_t size
);
193 extern void *xrealloc (void *ptr
, size_t size
);
194 extern char *xstrdup( const char *str
);
195 extern char *strupper(char *s
);
196 extern void fatal_error( const char *msg
, ... );
197 extern void fatal_perror( const char *msg
, ... );
198 extern void warning( const char *msg
, ... );
199 extern void output_standard_file_header( FILE *outfile
);
200 extern void dump_bytes( FILE *outfile
, const unsigned char *data
, int len
,
201 const char *label
, int constant
);
202 extern int get_alignment(int alignBoundary
);
204 extern void add_import_dll( const char *name
, int delay
);
205 extern void add_ignore_symbol( const char *name
);
206 extern int resolve_imports( void );
207 extern int output_imports( FILE *outfile
);
208 extern void load_res32_file( const char *name
);
209 extern int output_resources( FILE *outfile
);
210 extern void load_res16_file( const char *name
);
211 extern int output_res16_data( FILE *outfile
);
212 extern int output_res16_directory( unsigned char *buffer
);
214 extern void BuildGlue( FILE *outfile
, FILE *infile
);
215 extern void BuildRelays16( FILE *outfile
);
216 extern void BuildRelays32( FILE *outfile
);
217 extern void BuildSpec16File( FILE *outfile
);
218 extern void BuildSpec32File( FILE *outfile
);
219 extern void BuildDef32File( FILE *outfile
);
220 extern SPEC_TYPE
ParseTopLevel( FILE *file
, int def_only
);
222 /* global variables */
224 extern int current_line
;
225 extern int nb_entry_points
;
229 extern int DLLHeapSize
;
231 extern int debugging
;
232 extern int stack_size
;
233 extern int nb_debug_channels
;
234 extern int nb_lib_paths
;
235 extern int display_warnings
;
237 extern char DLLName
[80];
238 extern char DLLFileName
[80];
239 extern char owner_name
[80];
240 extern char *init_func
;
241 extern const char *input_file_name
;
242 extern const char *output_file_name
;
243 extern char **debug_channels
;
244 extern char **lib_path
;
246 extern ORDDEF
*EntryPoints
[MAX_ORDINALS
];
247 extern ORDDEF
*Ordinals
[MAX_ORDINALS
];
248 extern ORDDEF
*Names
[MAX_ORDINALS
];
249 extern SPEC_MODE SpecMode
;
251 #endif /* __WINE_BUILD_H */