blob: 9a5e382c7af8ff6402796de4b7bbbeffcfd79c80 [file] [log] [blame]
Alexandre Julliarde482eeb2000-06-23 20:15:35 +00001/*
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
9#ifndef __WINE_BUILD_H
10#define __WINE_BUILD_H
11
François Gouget14259412001-11-06 20:57:11 +000012#ifndef __WINE_CONFIG_H
13# error You must include config.h to use this header
14#endif
15
Alexandre Julliarde482eeb2000-06-23 20:15:35 +000016#include <stdio.h>
17#include <stdlib.h>
18
19#ifdef NEED_UNDERSCORE_PREFIX
20# define PREFIX "_"
21#else
22# define PREFIX
23#endif
24
25#ifdef HAVE_ASM_STRING
26# define STRING ".string"
27#else
28# define STRING ".ascii"
29#endif
30
31#if defined(__GNUC__) && !defined(__svr4__)
32# define USE_STABS
33#else
34# undef USE_STABS
35#endif
36
37typedef enum
38{
Alexandre Julliard39b31952000-11-26 04:31:48 +000039 TYPE_VARIABLE, /* variable */
Alexandre Julliarde482eeb2000-06-23 20:15:35 +000040 TYPE_PASCAL_16, /* pascal function with 16-bit return (Win16) */
41 TYPE_PASCAL, /* pascal function with 32-bit return (Win16) */
42 TYPE_ABS, /* absolute value (Win16) */
Alexandre Julliarde482eeb2000-06-23 20:15:35 +000043 TYPE_STUB, /* unimplemented stub */
44 TYPE_STDCALL, /* stdcall function (Win32) */
45 TYPE_CDECL, /* cdecl function (Win32) */
46 TYPE_VARARGS, /* varargs function (Win32) */
47 TYPE_EXTERN, /* external symbol (Win32) */
48 TYPE_FORWARD, /* forwarded function (Win32) */
49 TYPE_NBTYPES
50} ORD_TYPE;
51
52typedef enum
53{
54 SPEC_INVALID,
55 SPEC_WIN16,
56 SPEC_WIN32
57} SPEC_TYPE;
58
59typedef enum
60{
61 SPEC_MODE_DLL,
62 SPEC_MODE_GUIEXE,
Alexandre Julliardc585a502000-09-27 23:40:43 +000063 SPEC_MODE_CUIEXE,
Alexandre Julliard909eff92000-12-15 03:38:11 +000064 SPEC_MODE_GUIEXE_UNICODE,
65 SPEC_MODE_CUIEXE_UNICODE
Alexandre Julliarde482eeb2000-06-23 20:15:35 +000066} SPEC_MODE;
67
68typedef struct
69{
70 int n_values;
71 int *values;
72} ORD_VARIABLE;
73
74typedef struct
75{
76 int n_args;
Marcus Meissnerb63ab442001-06-08 19:02:57 +000077 char arg_types[21];
Alexandre Julliarde482eeb2000-06-23 20:15:35 +000078} ORD_FUNCTION;
79
80typedef struct
81{
82 int value;
83} ORD_ABS;
84
85typedef struct
86{
Alexandre Julliarde482eeb2000-06-23 20:15:35 +000087 ORD_TYPE type;
88 int ordinal;
89 int offset;
Alexandre Julliard39b31952000-11-26 04:31:48 +000090 int lineno;
91 int flags;
Alexandre Julliard66fed8c2000-12-15 23:04:40 +000092 char *name;
93 char *link_name;
Alexandre Julliarde482eeb2000-06-23 20:15:35 +000094 union
95 {
96 ORD_VARIABLE var;
97 ORD_FUNCTION func;
98 ORD_ABS abs;
Alexandre Julliarde482eeb2000-06-23 20:15:35 +000099 } u;
100} ORDDEF;
101
Alexandre Julliard39b31952000-11-26 04:31:48 +0000102/* entry point flags */
103#define FLAG_NOIMPORT 0x01 /* don't make function available for importing */
104#define FLAG_NORELAY 0x02 /* don't use relay debugging for this function */
105#define FLAG_RET64 0x04 /* function returns a 64-bit value */
106#define FLAG_I386 0x08 /* function is i386 only */
Alexandre Julliard7662ea12001-12-14 23:14:22 +0000107#define FLAG_REGISTER 0x10 /* use register calling convention */
108#define FLAG_INTERRUPT 0x20 /* function is an interrupt handler */
Alexandre Julliard39b31952000-11-26 04:31:48 +0000109
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000110 /* Offset of a structure field relative to the start of the struct */
111#define STRUCTOFFSET(type,field) ((int)&((type *)0)->field)
112
113 /* Offset of register relative to the start of the CONTEXT struct */
114#define CONTEXTOFFSET(reg) STRUCTOFFSET(CONTEXT86,reg)
115
116 /* Offset of register relative to the start of the STACK16FRAME struct */
117#define STACK16OFFSET(reg) STRUCTOFFSET(STACK16FRAME,reg)
118
119 /* Offset of register relative to the start of the STACK32FRAME struct */
120#define STACK32OFFSET(reg) STRUCTOFFSET(STACK32FRAME,reg)
121
122 /* Offset of the stack pointer relative to %fs:(0) */
123#define STACKOFFSET (STRUCTOFFSET(TEB,cur_stack))
124
125
Alexandre Julliard66fed8c2000-12-15 23:04:40 +0000126#define MAX_ORDINALS 65535
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000127
128/* global functions */
129
130extern void *xmalloc (size_t size);
131extern void *xrealloc (void *ptr, size_t size);
132extern char *xstrdup( const char *str );
133extern char *strupper(char *s);
134extern void fatal_error( const char *msg, ... );
Alexandre Julliard003e24c2000-10-23 21:33:06 +0000135extern void fatal_perror( const char *msg, ... );
Alexandre Julliardc585a502000-09-27 23:40:43 +0000136extern void warning( const char *msg, ... );
Alexandre Julliardcbeb6442000-10-25 20:33:58 +0000137extern void dump_bytes( FILE *outfile, const unsigned char *data, int len,
138 const char *label, int constant );
Josh DuBois0b64cfb2001-02-13 02:06:38 +0000139extern int get_alignment(int alignBoundary);
140
Eric Pouech5e32d162000-12-26 01:22:34 +0000141extern void add_import_dll( const char *name, int delay );
Jon Griffiths4f12e612000-12-14 22:18:22 +0000142extern void add_ignore_symbol( const char *name );
Dmitry Timoshkov3724de92001-05-22 19:55:51 +0000143extern int resolve_imports( void );
Alexandre Julliardc585a502000-09-27 23:40:43 +0000144extern int output_imports( FILE *outfile );
Alexandre Julliard003e24c2000-10-23 21:33:06 +0000145extern void load_res32_file( const char *name );
146extern int output_resources( FILE *outfile );
Alexandre Julliardcbeb6442000-10-25 20:33:58 +0000147extern void load_res16_file( const char *name );
148extern int output_res16_data( FILE *outfile );
149extern int output_res16_directory( unsigned char *buffer );
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000150
151extern void BuildGlue( FILE *outfile, FILE *infile );
Alexandre Julliardeb9a8632001-12-11 00:50:33 +0000152extern void BuildRelays16( FILE *outfile );
153extern void BuildRelays32( FILE *outfile );
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000154extern void BuildSpec16File( FILE *outfile );
Alexandre Julliard3570bfd2000-11-13 04:46:34 +0000155extern void BuildSpec32File( FILE *outfile );
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000156extern SPEC_TYPE ParseTopLevel( FILE *file );
157
158/* global variables */
159
160extern int current_line;
161extern int nb_entry_points;
162extern int nb_names;
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000163extern int Base;
164extern int Limit;
165extern int DLLHeapSize;
166extern int UsePIC;
167extern int debugging;
Alexandre Julliard35818652001-06-07 22:29:03 +0000168extern int stack_size;
Alexandre Julliard9a634692000-11-05 04:49:13 +0000169extern int nb_debug_channels;
Alexandre Julliard000c13a2000-11-09 20:31:18 +0000170extern int nb_lib_paths;
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000171
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000172extern char DLLName[80];
173extern char DLLFileName[80];
Alexandre Julliard76d36712000-07-28 00:07:18 +0000174extern char owner_name[80];
Alexandre Julliard66fed8c2000-12-15 23:04:40 +0000175extern char *init_func;
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000176extern const char *input_file_name;
177extern const char *output_file_name;
Alexandre Julliard9a634692000-11-05 04:49:13 +0000178extern char **debug_channels;
Alexandre Julliard000c13a2000-11-09 20:31:18 +0000179extern char **lib_path;
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000180
Alexandre Julliard66fed8c2000-12-15 23:04:40 +0000181extern ORDDEF *EntryPoints[MAX_ORDINALS];
Alexandre Julliarde482eeb2000-06-23 20:15:35 +0000182extern ORDDEF *Ordinals[MAX_ORDINALS];
183extern ORDDEF *Names[MAX_ORDINALS];
184extern SPEC_MODE SpecMode;
185
186#endif /* __WINE_BUILD_H */