2000-06-23 22:15:35 +02:00
|
|
|
/*
|
|
|
|
* Copyright 1993 Robert J. Amstadt
|
|
|
|
* Copyright 1995 Martin von Loewis
|
|
|
|
* Copyright 1995, 1996, 1997 Alexandre Julliard
|
|
|
|
* Copyright 1997 Eric Youngdale
|
|
|
|
* Copyright 1999 Ulrich Weigand
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2000-06-23 22:15:35 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __WINE_BUILD_H
|
|
|
|
#define __WINE_BUILD_H
|
|
|
|
|
2002-04-25 23:40:56 +02:00
|
|
|
#ifndef __WINE_CONFIG_H
|
|
|
|
# error You must include config.h to use this header
|
|
|
|
#endif
|
2001-11-06 21:57:11 +01:00
|
|
|
|
2000-06-23 22:15:35 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2002-03-11 06:09:02 +01:00
|
|
|
#include <string.h>
|
2000-06-23 22:15:35 +02:00
|
|
|
|
|
|
|
#ifdef NEED_UNDERSCORE_PREFIX
|
|
|
|
# define PREFIX "_"
|
|
|
|
#else
|
|
|
|
# define PREFIX
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_ASM_STRING
|
|
|
|
# define STRING ".string"
|
|
|
|
#else
|
|
|
|
# define STRING ".ascii"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
2000-11-26 05:31:48 +01:00
|
|
|
TYPE_VARIABLE, /* variable */
|
2000-06-23 22:15:35 +02:00
|
|
|
TYPE_PASCAL_16, /* pascal function with 16-bit return (Win16) */
|
|
|
|
TYPE_PASCAL, /* pascal function with 32-bit return (Win16) */
|
|
|
|
TYPE_ABS, /* absolute value (Win16) */
|
|
|
|
TYPE_STUB, /* unimplemented stub */
|
|
|
|
TYPE_STDCALL, /* stdcall function (Win32) */
|
|
|
|
TYPE_CDECL, /* cdecl function (Win32) */
|
|
|
|
TYPE_VARARGS, /* varargs function (Win32) */
|
|
|
|
TYPE_EXTERN, /* external symbol (Win32) */
|
|
|
|
TYPE_FORWARD, /* forwarded function (Win32) */
|
|
|
|
TYPE_NBTYPES
|
|
|
|
} ORD_TYPE;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
SPEC_WIN16,
|
|
|
|
SPEC_WIN32
|
|
|
|
} SPEC_TYPE;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
SPEC_MODE_DLL,
|
|
|
|
SPEC_MODE_GUIEXE,
|
2000-09-28 01:40:43 +02:00
|
|
|
SPEC_MODE_CUIEXE,
|
2000-12-15 04:38:11 +01:00
|
|
|
SPEC_MODE_GUIEXE_UNICODE,
|
|
|
|
SPEC_MODE_CUIEXE_UNICODE
|
2000-06-23 22:15:35 +02:00
|
|
|
} SPEC_MODE;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int n_values;
|
|
|
|
int *values;
|
|
|
|
} ORD_VARIABLE;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int n_args;
|
2001-06-08 21:02:57 +02:00
|
|
|
char arg_types[21];
|
2000-06-23 22:15:35 +02:00
|
|
|
} ORD_FUNCTION;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int value;
|
|
|
|
} ORD_ABS;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
ORD_TYPE type;
|
|
|
|
int ordinal;
|
|
|
|
int offset;
|
2000-11-26 05:31:48 +01:00
|
|
|
int lineno;
|
|
|
|
int flags;
|
2000-12-16 00:04:40 +01:00
|
|
|
char *name;
|
|
|
|
char *link_name;
|
2000-06-23 22:15:35 +02:00
|
|
|
union
|
|
|
|
{
|
|
|
|
ORD_VARIABLE var;
|
|
|
|
ORD_FUNCTION func;
|
|
|
|
ORD_ABS abs;
|
|
|
|
} u;
|
|
|
|
} ORDDEF;
|
|
|
|
|
2000-11-26 05:31:48 +01:00
|
|
|
/* entry point flags */
|
|
|
|
#define FLAG_NOIMPORT 0x01 /* don't make function available for importing */
|
|
|
|
#define FLAG_NORELAY 0x02 /* don't use relay debugging for this function */
|
|
|
|
#define FLAG_RET64 0x04 /* function returns a 64-bit value */
|
|
|
|
#define FLAG_I386 0x08 /* function is i386 only */
|
2001-12-15 00:14:22 +01:00
|
|
|
#define FLAG_REGISTER 0x10 /* use register calling convention */
|
|
|
|
#define FLAG_INTERRUPT 0x20 /* function is an interrupt handler */
|
2000-11-26 05:31:48 +01:00
|
|
|
|
2000-06-23 22:15:35 +02:00
|
|
|
/* Offset of a structure field relative to the start of the struct */
|
|
|
|
#define STRUCTOFFSET(type,field) ((int)&((type *)0)->field)
|
|
|
|
|
|
|
|
/* Offset of register relative to the start of the CONTEXT struct */
|
|
|
|
#define CONTEXTOFFSET(reg) STRUCTOFFSET(CONTEXT86,reg)
|
|
|
|
|
|
|
|
/* Offset of register relative to the start of the STACK16FRAME struct */
|
|
|
|
#define STACK16OFFSET(reg) STRUCTOFFSET(STACK16FRAME,reg)
|
|
|
|
|
|
|
|
/* Offset of register relative to the start of the STACK32FRAME struct */
|
|
|
|
#define STACK32OFFSET(reg) STRUCTOFFSET(STACK32FRAME,reg)
|
|
|
|
|
|
|
|
/* Offset of the stack pointer relative to %fs:(0) */
|
|
|
|
#define STACKOFFSET (STRUCTOFFSET(TEB,cur_stack))
|
|
|
|
|
|
|
|
|
2000-12-16 00:04:40 +01:00
|
|
|
#define MAX_ORDINALS 65535
|
2000-06-23 22:15:35 +02:00
|
|
|
|
|
|
|
/* global functions */
|
|
|
|
|
|
|
|
extern void *xmalloc (size_t size);
|
|
|
|
extern void *xrealloc (void *ptr, size_t size);
|
|
|
|
extern char *xstrdup( const char *str );
|
|
|
|
extern char *strupper(char *s);
|
|
|
|
extern void fatal_error( const char *msg, ... );
|
2000-10-23 23:33:06 +02:00
|
|
|
extern void fatal_perror( const char *msg, ... );
|
2000-09-28 01:40:43 +02:00
|
|
|
extern void warning( const char *msg, ... );
|
2002-03-10 00:29:33 +01:00
|
|
|
extern void output_standard_file_header( FILE *outfile );
|
2000-10-25 22:33:58 +02:00
|
|
|
extern void dump_bytes( FILE *outfile, const unsigned char *data, int len,
|
|
|
|
const char *label, int constant );
|
2002-05-14 22:54:58 +02:00
|
|
|
extern const char *make_c_identifier( const char *str );
|
2001-02-13 03:06:38 +01:00
|
|
|
extern int get_alignment(int alignBoundary);
|
|
|
|
|
2000-12-26 02:22:34 +01:00
|
|
|
extern void add_import_dll( const char *name, int delay );
|
2000-12-14 23:18:22 +01:00
|
|
|
extern void add_ignore_symbol( const char *name );
|
2001-05-22 21:55:51 +02:00
|
|
|
extern int resolve_imports( void );
|
2000-09-28 01:40:43 +02:00
|
|
|
extern int output_imports( FILE *outfile );
|
2000-10-23 23:33:06 +02:00
|
|
|
extern void load_res32_file( const char *name );
|
|
|
|
extern int output_resources( FILE *outfile );
|
2000-10-25 22:33:58 +02:00
|
|
|
extern void load_res16_file( const char *name );
|
|
|
|
extern int output_res16_data( FILE *outfile );
|
|
|
|
extern int output_res16_directory( unsigned char *buffer );
|
2002-06-15 01:42:53 +02:00
|
|
|
extern void output_dll_init( FILE *outfile, const char *constructor, const char *destructor );
|
2002-05-14 22:54:58 +02:00
|
|
|
extern void parse_debug_channels( const char *srcdir, const char *filename );
|
2000-06-23 22:15:35 +02:00
|
|
|
|
|
|
|
extern void BuildGlue( FILE *outfile, FILE *infile );
|
2001-12-11 01:50:33 +01:00
|
|
|
extern void BuildRelays16( FILE *outfile );
|
|
|
|
extern void BuildRelays32( FILE *outfile );
|
2000-06-23 22:15:35 +02:00
|
|
|
extern void BuildSpec16File( FILE *outfile );
|
2000-11-13 05:46:34 +01:00
|
|
|
extern void BuildSpec32File( FILE *outfile );
|
2002-02-04 19:48:18 +01:00
|
|
|
extern void BuildDef32File( FILE *outfile );
|
2002-05-14 22:54:58 +02:00
|
|
|
extern void BuildDebugFile( FILE *outfile );
|
2002-03-26 02:55:25 +01:00
|
|
|
extern SPEC_TYPE ParseTopLevel( FILE *file, int def_only );
|
2000-06-23 22:15:35 +02:00
|
|
|
|
|
|
|
/* global variables */
|
|
|
|
|
|
|
|
extern int current_line;
|
|
|
|
extern int nb_entry_points;
|
|
|
|
extern int nb_names;
|
|
|
|
extern int Base;
|
|
|
|
extern int Limit;
|
|
|
|
extern int DLLHeapSize;
|
|
|
|
extern int UsePIC;
|
|
|
|
extern int debugging;
|
2001-06-08 00:29:03 +02:00
|
|
|
extern int stack_size;
|
2000-11-05 05:49:13 +01:00
|
|
|
extern int nb_debug_channels;
|
2000-11-09 21:31:18 +01:00
|
|
|
extern int nb_lib_paths;
|
2002-03-21 02:38:53 +01:00
|
|
|
extern int display_warnings;
|
2000-06-23 22:15:35 +02:00
|
|
|
|
|
|
|
extern char DLLName[80];
|
|
|
|
extern char DLLFileName[80];
|
2000-07-28 02:07:18 +02:00
|
|
|
extern char owner_name[80];
|
2000-12-16 00:04:40 +01:00
|
|
|
extern char *init_func;
|
2000-06-23 22:15:35 +02:00
|
|
|
extern const char *input_file_name;
|
|
|
|
extern const char *output_file_name;
|
2000-11-05 05:49:13 +01:00
|
|
|
extern char **debug_channels;
|
2000-11-09 21:31:18 +01:00
|
|
|
extern char **lib_path;
|
2000-06-23 22:15:35 +02:00
|
|
|
|
2000-12-16 00:04:40 +01:00
|
|
|
extern ORDDEF *EntryPoints[MAX_ORDINALS];
|
2000-06-23 22:15:35 +02:00
|
|
|
extern ORDDEF *Ordinals[MAX_ORDINALS];
|
|
|
|
extern ORDDEF *Names[MAX_ORDINALS];
|
|
|
|
extern SPEC_MODE SpecMode;
|
|
|
|
|
|
|
|
#endif /* __WINE_BUILD_H */
|