Added LGPL standard comment, and copyright notices where necessary.
[wine/multimedia.git] / tools / winebuild / build.h
blob6c3f07f86433f27a8542f57baeb12683374ca438
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>
33 #ifdef NEED_UNDERSCORE_PREFIX
34 # define PREFIX "_"
35 #else
36 # define PREFIX
37 #endif
39 #ifdef HAVE_ASM_STRING
40 # define STRING ".string"
41 #else
42 # define STRING ".ascii"
43 #endif
45 #if defined(__GNUC__) && !defined(__svr4__)
46 # define USE_STABS
47 #else
48 # undef USE_STABS
49 #endif
51 typedef enum
53 TYPE_VARIABLE, /* variable */
54 TYPE_PASCAL_16, /* pascal function with 16-bit return (Win16) */
55 TYPE_PASCAL, /* pascal function with 32-bit return (Win16) */
56 TYPE_ABS, /* absolute value (Win16) */
57 TYPE_STUB, /* unimplemented stub */
58 TYPE_STDCALL, /* stdcall function (Win32) */
59 TYPE_CDECL, /* cdecl function (Win32) */
60 TYPE_VARARGS, /* varargs function (Win32) */
61 TYPE_EXTERN, /* external symbol (Win32) */
62 TYPE_FORWARD, /* forwarded function (Win32) */
63 TYPE_NBTYPES
64 } ORD_TYPE;
66 typedef enum
68 SPEC_INVALID,
69 SPEC_WIN16,
70 SPEC_WIN32
71 } SPEC_TYPE;
73 typedef enum
75 SPEC_MODE_DLL,
76 SPEC_MODE_GUIEXE,
77 SPEC_MODE_CUIEXE,
78 SPEC_MODE_GUIEXE_UNICODE,
79 SPEC_MODE_CUIEXE_UNICODE
80 } SPEC_MODE;
82 typedef struct
84 int n_values;
85 int *values;
86 } ORD_VARIABLE;
88 typedef struct
90 int n_args;
91 char arg_types[21];
92 } ORD_FUNCTION;
94 typedef struct
96 int value;
97 } ORD_ABS;
99 typedef struct
101 ORD_TYPE type;
102 int ordinal;
103 int offset;
104 int lineno;
105 int flags;
106 char *name;
107 char *link_name;
108 union
110 ORD_VARIABLE var;
111 ORD_FUNCTION func;
112 ORD_ABS abs;
113 } u;
114 } ORDDEF;
116 /* entry point flags */
117 #define FLAG_NOIMPORT 0x01 /* don't make function available for importing */
118 #define FLAG_NORELAY 0x02 /* don't use relay debugging for this function */
119 #define FLAG_RET64 0x04 /* function returns a 64-bit value */
120 #define FLAG_I386 0x08 /* function is i386 only */
121 #define FLAG_REGISTER 0x10 /* use register calling convention */
122 #define FLAG_INTERRUPT 0x20 /* function is an interrupt handler */
124 /* Offset of a structure field relative to the start of the struct */
125 #define STRUCTOFFSET(type,field) ((int)&((type *)0)->field)
127 /* Offset of register relative to the start of the CONTEXT struct */
128 #define CONTEXTOFFSET(reg) STRUCTOFFSET(CONTEXT86,reg)
130 /* Offset of register relative to the start of the STACK16FRAME struct */
131 #define STACK16OFFSET(reg) STRUCTOFFSET(STACK16FRAME,reg)
133 /* Offset of register relative to the start of the STACK32FRAME struct */
134 #define STACK32OFFSET(reg) STRUCTOFFSET(STACK32FRAME,reg)
136 /* Offset of the stack pointer relative to %fs:(0) */
137 #define STACKOFFSET (STRUCTOFFSET(TEB,cur_stack))
140 #define MAX_ORDINALS 65535
142 /* global functions */
144 extern void *xmalloc (size_t size);
145 extern void *xrealloc (void *ptr, size_t size);
146 extern char *xstrdup( const char *str );
147 extern char *strupper(char *s);
148 extern void fatal_error( const char *msg, ... );
149 extern void fatal_perror( const char *msg, ... );
150 extern void warning( const char *msg, ... );
151 extern void output_standard_file_header( FILE *outfile );
152 extern void dump_bytes( FILE *outfile, const unsigned char *data, int len,
153 const char *label, int constant );
154 extern int get_alignment(int alignBoundary);
156 extern void add_import_dll( const char *name, int delay );
157 extern void add_ignore_symbol( const char *name );
158 extern int resolve_imports( void );
159 extern int output_imports( FILE *outfile );
160 extern void load_res32_file( const char *name );
161 extern int output_resources( FILE *outfile );
162 extern void load_res16_file( const char *name );
163 extern int output_res16_data( FILE *outfile );
164 extern int output_res16_directory( unsigned char *buffer );
166 extern void BuildGlue( FILE *outfile, FILE *infile );
167 extern void BuildRelays16( FILE *outfile );
168 extern void BuildRelays32( FILE *outfile );
169 extern void BuildSpec16File( FILE *outfile );
170 extern void BuildSpec32File( FILE *outfile );
171 extern void BuildDef32File( FILE *outfile );
172 extern SPEC_TYPE ParseTopLevel( FILE *file );
174 /* global variables */
176 extern int current_line;
177 extern int nb_entry_points;
178 extern int nb_names;
179 extern int Base;
180 extern int Limit;
181 extern int DLLHeapSize;
182 extern int UsePIC;
183 extern int debugging;
184 extern int stack_size;
185 extern int nb_debug_channels;
186 extern int nb_lib_paths;
188 extern char DLLName[80];
189 extern char DLLFileName[80];
190 extern char owner_name[80];
191 extern char *init_func;
192 extern const char *input_file_name;
193 extern const char *output_file_name;
194 extern char **debug_channels;
195 extern char **lib_path;
197 extern ORDDEF *EntryPoints[MAX_ORDINALS];
198 extern ORDDEF *Ordinals[MAX_ORDINALS];
199 extern ORDDEF *Names[MAX_ORDINALS];
200 extern SPEC_MODE SpecMode;
202 #endif /* __WINE_BUILD_H */