source: trunk/tools/pebuild/main.c@ 10298

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

added

File size: 3.1 KB
Line 
1/*
2 * Main function
3 *
4 * Copyright 1993 Robert J. Amstadt
5 * Copyright 1995 Martin von Loewis
6 * Copyright 1995, 1996, 1997 Alexandre Julliard
7 * Copyright 1997 Eric Youngdale
8 * Copyright 1999 Ulrich Weigand
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#include "config.h"
26#include "port.h"
27
28#include <assert.h>
29#include <stdio.h>
30#include <errno.h>
31#include <string.h>
32#include <ctype.h>
33#ifdef HAVE_GETOPT_H
34# include <getopt.h>
35#endif
36
37#include "build.h"
38
39ORDDEF *EntryPoints[MAX_ORDINALS];
40ORDDEF *Ordinals[MAX_ORDINALS];
41ORDDEF *Names[MAX_ORDINALS];
42
43SPEC_MODE SpecMode = SPEC_MODE_DLL;
44SPEC_TYPE SpecType = SPEC_WIN32;
45
46int Base = MAX_ORDINALS;
47int Limit = 0;
48int DLLHeapSize = 0;
49int UsePIC = 0;
50int stack_size = 0;
51int nb_entry_points = 0;
52int nb_names = 0;
53int nb_debug_channels = 0;
54int nb_lib_paths = 0;
55int nb_errors = 0;
56int display_warnings = 0;
57int kill_at = 0;
58
59/* we only support relay debugging on i386 */
60#if defined(__i386__) && !defined(NO_TRACE_MSGS)
61int debugging = 1;
62#else
63int debugging = 0;
64#endif
65
66char *owner_name = NULL;
67char *dll_name = NULL;
68char *dll_file_name = NULL;
69char *init_func = NULL;
70char **debug_channels = NULL;
71char **lib_path = NULL;
72
73char *input_file_name = NULL;
74const char *output_file_name = NULL;
75
76static FILE *input_file;
77static FILE *output_file;
78static const char *current_src_dir;
79static int nb_res_files;
80static char **res_files;
81
82/* set the dll file name from the input file name */
83static void set_dll_file_name( const char *name )
84{
85 char *p;
86
87 if (dll_file_name) return;
88
89 if ((p = strrchr( name, '\\' ))) name = p + 1;
90 if ((p = strrchr( name, '/' ))) name = p + 1;
91 dll_file_name = xmalloc( strlen(name) + 5 );
92 strcpy( dll_file_name, name );
93 if ((p = strrchr( dll_file_name, '.' )) && !strcmp( p, ".def" )) *p = 0;
94 if (!strchr( dll_file_name, '.' )) strcat( dll_file_name, ".dll" );
95
96 dll_name = strdup(dll_file_name);
97 p = strrchr(dll_name, '.');
98 if(p) *p = 0;
99}
100
101
102/*******************************************************************
103 * command-line option handling
104 */
105static const char usage_str[] =
106"Usage: pebuild dllname dllname.def\n\n";
107
108
109/*******************************************************************
110 * main
111 */
112int main(int argc, char **argv)
113{
114 if(argc != 3) {
115 printf(usage_str);
116 return -1;
117 }
118
119 set_dll_file_name(argv[1]);
120 input_file = open_input_file( NULL, argv[2] );
121
122 ParseTopLevel(input_file);
123 BuildSpec32File( stdout );
124
125 return 0;
126}
Note: See TracBrowser for help on using the repository browser.