source: trunk/tools/pebuild/build.h@ 10367

Last change on this file since 10367 was 10298, checked in by sandervl, 22 years ago

added

File size: 6.1 KB
Line 
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
31typedef 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
44typedef enum
45{
46 SPEC_WIN16,
47 SPEC_WIN32
48} SPEC_TYPE;
49
50typedef 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
59typedef struct
60{
61 int n_values;
62 int *values;
63} ORD_VARIABLE;
64
65typedef struct
66{
67 int n_args;
68 char arg_types[21];
69} ORD_FUNCTION;
70
71typedef struct
72{
73 int value;
74} ORD_ABS;
75
76typedef 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
126extern void *xmalloc (size_t size);
127extern void *xrealloc (void *ptr, size_t size);
128extern char *xstrdup( const char *str );
129extern char *strupper(char *s);
130extern void fatal_error( const char *msg, ... );
131extern void fatal_perror( const char *msg, ... );
132extern void error( const char *msg, ... );
133extern void warning( const char *msg, ... );
134extern void output_standard_file_header( FILE *outfile );
135extern FILE *open_input_file( const char *srcdir, const char *name );
136extern void close_input_file( FILE *file );
137extern void dump_bytes( FILE *outfile, const unsigned char *data, int len,
138 const char *label, int constant );
139extern const char *make_c_identifier( const char *str );
140extern int get_alignment(int alignBoundary);
141
142extern void add_import_dll( const char *name, int delay );
143extern void add_ignore_symbol( const char *name );
144extern void read_undef_symbols( char **argv );
145extern int resolve_imports( void );
146extern int output_imports( FILE *outfile );
147extern int load_res32_file( const char *name );
148extern int output_resources( FILE *outfile );
149extern void load_res16_file( const char *name );
150extern int output_res16_data( FILE *outfile );
151extern int output_res16_directory( unsigned char *buffer );
152extern void output_dll_init( FILE *outfile, const char *constructor, const char *destructor );
153extern int parse_debug_channels( const char *srcdir, const char *filename );
154
155extern void BuildRelays16( FILE *outfile );
156extern void BuildRelays32( FILE *outfile );
157extern void BuildSpec16File( FILE *outfile );
158extern void BuildSpec32File( FILE *outfile );
159extern void BuildDef32File( FILE *outfile );
160extern void BuildDebugFile( FILE *outfile, const char *srcdir, char **argv );
161extern int ParseTopLevel( FILE *file );
162
163/* global variables */
164
165extern int current_line;
166extern int nb_entry_points;
167extern int nb_names;
168extern int Base;
169extern int Limit;
170extern int DLLHeapSize;
171extern int UsePIC;
172extern int debugging;
173extern int stack_size;
174extern int nb_debug_channels;
175extern int nb_lib_paths;
176extern int nb_errors;
177extern int display_warnings;
178extern int kill_at;
179
180extern char *owner_name;
181extern char *dll_name;
182extern char *dll_file_name;
183extern char *init_func;
184extern char *input_file_name;
185extern const char *output_file_name;
186extern char **debug_channels;
187extern char **lib_path;
188
189extern ORDDEF *EntryPoints[MAX_ORDINALS];
190extern ORDDEF *Ordinals[MAX_ORDINALS];
191extern ORDDEF *Names[MAX_ORDINALS];
192extern SPEC_MODE SpecMode;
193extern SPEC_TYPE SpecType;
194
195#endif /* __WINE_BUILD_H */
Note: See TracBrowser for help on using the repository browser.