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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
21 | */
|
---|
22 |
|
---|
23 | #ifndef __WINE_BUILD_H
|
---|
24 | #define __WINE_BUILD_H
|
---|
25 |
|
---|
26 |
|
---|
27 | #include <stdio.h>
|
---|
28 | #include <stdlib.h>
|
---|
29 | #include <string.h>
|
---|
30 |
|
---|
31 | typedef enum
|
---|
32 | {
|
---|
33 | TYPE_VARIABLE, /* variable */
|
---|
34 | TYPE_PASCAL, /* pascal function (Win16) */
|
---|
35 | TYPE_ABS, /* absolute value (Win16) */
|
---|
36 | TYPE_STUB, /* unimplemented stub */
|
---|
37 | TYPE_STDCALL, /* stdcall function (Win32) */
|
---|
38 | TYPE_CDECL, /* cdecl function (Win32) */
|
---|
39 | TYPE_VARARGS, /* varargs function (Win32) */
|
---|
40 | TYPE_EXTERN, /* external symbol (Win32) */
|
---|
41 | TYPE_NBTYPES
|
---|
42 | } ORD_TYPE;
|
---|
43 |
|
---|
44 | typedef enum
|
---|
45 | {
|
---|
46 | SPEC_WIN16,
|
---|
47 | SPEC_WIN32
|
---|
48 | } SPEC_TYPE;
|
---|
49 |
|
---|
50 | typedef enum
|
---|
51 | {
|
---|
52 | SPEC_MODE_DLL,
|
---|
53 | SPEC_MODE_GUIEXE,
|
---|
54 | SPEC_MODE_CUIEXE,
|
---|
55 | SPEC_MODE_GUIEXE_UNICODE,
|
---|
56 | SPEC_MODE_CUIEXE_UNICODE
|
---|
57 | } SPEC_MODE;
|
---|
58 |
|
---|
59 | typedef struct
|
---|
60 | {
|
---|
61 | int n_values;
|
---|
62 | int *values;
|
---|
63 | } ORD_VARIABLE;
|
---|
64 |
|
---|
65 | typedef struct
|
---|
66 | {
|
---|
67 | int n_args;
|
---|
68 | char arg_types[21];
|
---|
69 | } ORD_FUNCTION;
|
---|
70 |
|
---|
71 | typedef struct
|
---|
72 | {
|
---|
73 | int value;
|
---|
74 | } ORD_ABS;
|
---|
75 |
|
---|
76 | typedef struct
|
---|
77 | {
|
---|
78 | ORD_TYPE type;
|
---|
79 | int ordinal;
|
---|
80 | int offset;
|
---|
81 | int lineno;
|
---|
82 | int flags;
|
---|
83 | char *name; /* public name of this function */
|
---|
84 | char *link_name; /* name of the C symbol to link to */
|
---|
85 | char *export_name; /* name exported under for noname exports */
|
---|
86 | union
|
---|
87 | {
|
---|
88 | ORD_VARIABLE var;
|
---|
89 | ORD_FUNCTION func;
|
---|
90 | ORD_ABS abs;
|
---|
91 | } u;
|
---|
92 | } ORDDEF;
|
---|
93 |
|
---|
94 | /* entry point flags */
|
---|
95 | #define FLAG_NORELAY 0x01 /* don't use relay debugging for this function */
|
---|
96 | #define FLAG_NONAME 0x02 /* don't import function by name */
|
---|
97 | #define FLAG_RET16 0x04 /* function returns a 16-bit value */
|
---|
98 | #define FLAG_RET64 0x08 /* function returns a 64-bit value */
|
---|
99 | #define FLAG_I386 0x10 /* function is i386 only */
|
---|
100 | #define FLAG_REGISTER 0x20 /* use register calling convention */
|
---|
101 | #define FLAG_INTERRUPT 0x40 /* function is an interrupt handler */
|
---|
102 | #define FLAG_PRIVATE 0x80 /* function is private (cannot be imported) */
|
---|
103 |
|
---|
104 | #define FLAG_FORWARD 0x100 /* function is a forwarded name */
|
---|
105 |
|
---|
106 | /* Offset of a structure field relative to the start of the struct */
|
---|
107 | #define STRUCTOFFSET(type,field) ((int)&((type *)0)->field)
|
---|
108 |
|
---|
109 | /* Offset of register relative to the start of the CONTEXT struct */
|
---|
110 | #define CONTEXTOFFSET(reg) STRUCTOFFSET(CONTEXT86,reg)
|
---|
111 |
|
---|
112 | /* Offset of register relative to the start of the STACK16FRAME struct */
|
---|
113 | #define STACK16OFFSET(reg) STRUCTOFFSET(STACK16FRAME,reg)
|
---|
114 |
|
---|
115 | /* Offset of register relative to the start of the STACK32FRAME struct */
|
---|
116 | #define STACK32OFFSET(reg) STRUCTOFFSET(STACK32FRAME,reg)
|
---|
117 |
|
---|
118 | /* Offset of the stack pointer relative to %fs:(0) */
|
---|
119 | #define STACKOFFSET (STRUCTOFFSET(TEB,cur_stack))
|
---|
120 |
|
---|
121 |
|
---|
122 | #define MAX_ORDINALS 65535
|
---|
123 |
|
---|
124 | /* global functions */
|
---|
125 |
|
---|
126 | extern void *xmalloc (size_t size);
|
---|
127 | extern void *xrealloc (void *ptr, size_t size);
|
---|
128 | extern char *xstrdup( const char *str );
|
---|
129 | extern char *strupper(char *s);
|
---|
130 | extern void fatal_error( const char *msg, ... );
|
---|
131 | extern void fatal_perror( const char *msg, ... );
|
---|
132 | extern void error( const char *msg, ... );
|
---|
133 | extern void warning( const char *msg, ... );
|
---|
134 | extern void output_standard_file_header( FILE *outfile );
|
---|
135 | extern FILE *open_input_file( const char *srcdir, const char *name );
|
---|
136 | extern void close_input_file( FILE *file );
|
---|
137 | extern void dump_bytes( FILE *outfile, const unsigned char *data, int len,
|
---|
138 | const char *label, int constant );
|
---|
139 | extern const char *make_c_identifier( const char *str );
|
---|
140 | extern int get_alignment(int alignBoundary);
|
---|
141 |
|
---|
142 | extern void add_import_dll( const char *name, int delay );
|
---|
143 | extern void add_ignore_symbol( const char *name );
|
---|
144 | extern void read_undef_symbols( char **argv );
|
---|
145 | extern int resolve_imports( void );
|
---|
146 | extern int output_imports( FILE *outfile );
|
---|
147 | extern int load_res32_file( const char *name );
|
---|
148 | extern int output_resources( FILE *outfile );
|
---|
149 | extern void load_res16_file( const char *name );
|
---|
150 | extern int output_res16_data( FILE *outfile );
|
---|
151 | extern int output_res16_directory( unsigned char *buffer );
|
---|
152 | extern void output_dll_init( FILE *outfile, const char *constructor, const char *destructor );
|
---|
153 | extern int parse_debug_channels( const char *srcdir, const char *filename );
|
---|
154 |
|
---|
155 | extern void BuildRelays16( FILE *outfile );
|
---|
156 | extern void BuildRelays32( FILE *outfile );
|
---|
157 | extern void BuildSpec16File( FILE *outfile );
|
---|
158 | extern void BuildSpec32File( FILE *outfile );
|
---|
159 | extern void BuildDef32File( FILE *outfile );
|
---|
160 | extern void BuildDebugFile( FILE *outfile, const char *srcdir, char **argv );
|
---|
161 | extern int ParseTopLevel( FILE *file );
|
---|
162 |
|
---|
163 | /* global variables */
|
---|
164 |
|
---|
165 | extern int current_line;
|
---|
166 | extern int nb_entry_points;
|
---|
167 | extern int nb_names;
|
---|
168 | extern int Base;
|
---|
169 | extern int Limit;
|
---|
170 | extern int DLLHeapSize;
|
---|
171 | extern int UsePIC;
|
---|
172 | extern int debugging;
|
---|
173 | extern int stack_size;
|
---|
174 | extern int nb_debug_channels;
|
---|
175 | extern int nb_lib_paths;
|
---|
176 | extern int nb_errors;
|
---|
177 | extern int display_warnings;
|
---|
178 | extern int kill_at;
|
---|
179 |
|
---|
180 | extern char *owner_name;
|
---|
181 | extern char *dll_name;
|
---|
182 | extern char *dll_file_name;
|
---|
183 | extern char *init_func;
|
---|
184 | extern char *input_file_name;
|
---|
185 | extern const char *output_file_name;
|
---|
186 | extern char **debug_channels;
|
---|
187 | extern char **lib_path;
|
---|
188 |
|
---|
189 | extern ORDDEF *EntryPoints[MAX_ORDINALS];
|
---|
190 | extern ORDDEF *Ordinals[MAX_ORDINALS];
|
---|
191 | extern ORDDEF *Names[MAX_ORDINALS];
|
---|
192 | extern SPEC_MODE SpecMode;
|
---|
193 | extern SPEC_TYPE SpecType;
|
---|
194 |
|
---|
195 | #endif /* __WINE_BUILD_H */
|
---|