Removed support for 'rsrc' spec file statement.
[wine/multimedia.git] / tools / winebuild / build.h
blobd7785f16f19c3cc54370a4039d0df8ce20d8b4d6
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 #ifdef HAVE_ASM_STRING
35 # define STRING ".string"
36 #else
37 # define STRING ".ascii"
38 #endif
40 typedef enum
42 TYPE_VARIABLE, /* variable */
43 TYPE_PASCAL_16, /* pascal function with 16-bit return (Win16) */
44 TYPE_PASCAL, /* pascal function with 32-bit return (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_FORWARD, /* forwarded function (Win32) */
52 TYPE_NBTYPES
53 } ORD_TYPE;
55 typedef enum
57 SPEC_WIN16,
58 SPEC_WIN32
59 } SPEC_TYPE;
61 typedef enum
63 SPEC_MODE_DLL,
64 SPEC_MODE_GUIEXE,
65 SPEC_MODE_CUIEXE,
66 SPEC_MODE_GUIEXE_UNICODE,
67 SPEC_MODE_CUIEXE_UNICODE
68 } SPEC_MODE;
70 typedef struct
72 int n_values;
73 int *values;
74 } ORD_VARIABLE;
76 typedef struct
78 int n_args;
79 char arg_types[21];
80 } ORD_FUNCTION;
82 typedef struct
84 int value;
85 } ORD_ABS;
87 typedef struct
89 ORD_TYPE type;
90 int ordinal;
91 int offset;
92 int lineno;
93 int flags;
94 char *name; /* public name of this function */
95 char *link_name; /* name of the C symbol to link to */
96 char *export_name; /* name exported under for noname exports */
97 union
99 ORD_VARIABLE var;
100 ORD_FUNCTION func;
101 ORD_ABS abs;
102 } u;
103 } ORDDEF;
105 /* entry point flags */
106 #define FLAG_NOIMPORT 0x01 /* don't make function available for importing */
107 #define FLAG_NORELAY 0x02 /* don't use relay debugging for this function */
108 #define FLAG_NONAME 0x04 /* don't import function by name */
109 #define FLAG_RET64 0x08 /* function returns a 64-bit value */
110 #define FLAG_I386 0x10 /* function is i386 only */
111 #define FLAG_REGISTER 0x20 /* use register calling convention */
112 #define FLAG_INTERRUPT 0x40 /* function is an interrupt handler */
114 /* Offset of a structure field relative to the start of the struct */
115 #define STRUCTOFFSET(type,field) ((int)&((type *)0)->field)
117 /* Offset of register relative to the start of the CONTEXT struct */
118 #define CONTEXTOFFSET(reg) STRUCTOFFSET(CONTEXT86,reg)
120 /* Offset of register relative to the start of the STACK16FRAME struct */
121 #define STACK16OFFSET(reg) STRUCTOFFSET(STACK16FRAME,reg)
123 /* Offset of register relative to the start of the STACK32FRAME struct */
124 #define STACK32OFFSET(reg) STRUCTOFFSET(STACK32FRAME,reg)
126 /* Offset of the stack pointer relative to %fs:(0) */
127 #define STACKOFFSET (STRUCTOFFSET(TEB,cur_stack))
130 #define MAX_ORDINALS 65535
132 /* global functions */
134 extern void *xmalloc (size_t size);
135 extern void *xrealloc (void *ptr, size_t size);
136 extern char *xstrdup( const char *str );
137 extern char *strupper(char *s);
138 extern void fatal_error( const char *msg, ... );
139 extern void fatal_perror( const char *msg, ... );
140 extern void warning( const char *msg, ... );
141 extern void output_standard_file_header( FILE *outfile );
142 extern FILE *open_input_file( const char *srcdir, const char *name );
143 extern void close_input_file( FILE *file );
144 extern void dump_bytes( FILE *outfile, const unsigned char *data, int len,
145 const char *label, int constant );
146 extern const char *make_c_identifier( const char *str );
147 extern int get_alignment(int alignBoundary);
149 extern void add_import_dll( const char *name, int delay );
150 extern void add_ignore_symbol( const char *name );
151 extern void read_undef_symbols( char **argv );
152 extern int resolve_imports( void );
153 extern int output_imports( FILE *outfile );
154 extern void load_res32_file( const char *name );
155 extern int output_resources( FILE *outfile );
156 extern void load_res16_file( const char *name );
157 extern int output_res16_data( FILE *outfile );
158 extern int output_res16_directory( unsigned char *buffer );
159 extern void output_dll_init( FILE *outfile, const char *constructor, const char *destructor );
160 extern void parse_debug_channels( const char *srcdir, const char *filename );
162 extern void BuildGlue( FILE *outfile, const char *srcdir, char **argv );
163 extern void BuildRelays16( FILE *outfile );
164 extern void BuildRelays32( FILE *outfile );
165 extern void BuildSpec16File( FILE *outfile );
166 extern void BuildSpec32File( FILE *outfile );
167 extern void BuildDef32File( FILE *outfile );
168 extern void BuildDebugFile( FILE *outfile, const char *srcdir, char **argv );
169 extern void ParseTopLevel( FILE *file );
171 /* global variables */
173 extern int current_line;
174 extern int nb_entry_points;
175 extern int nb_names;
176 extern int Base;
177 extern int Limit;
178 extern int DLLHeapSize;
179 extern int UsePIC;
180 extern int debugging;
181 extern int stack_size;
182 extern int nb_debug_channels;
183 extern int nb_lib_paths;
184 extern int display_warnings;
186 extern char DLLName[80];
187 extern char DLLFileName[80];
188 extern char owner_name[80];
189 extern char *init_func;
190 extern char *input_file_name;
191 extern const char *output_file_name;
192 extern char **debug_channels;
193 extern char **lib_path;
195 extern ORDDEF *EntryPoints[MAX_ORDINALS];
196 extern ORDDEF *Ordinals[MAX_ORDINALS];
197 extern ORDDEF *Names[MAX_ORDINALS];
198 extern SPEC_MODE SpecMode;
199 extern SPEC_TYPE SpecType;
201 #endif /* __WINE_BUILD_H */