Sweden-Number/tools/makedep.c

573 lines
16 KiB
C
Raw Normal View History

/*
* Generate include file dependencies
*
* Copyright 1996 Alexandre Julliard
*
* 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
*/
#include "config.h"
#define NO_LIBWINE_PORT
#include "wine/port.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
/* Max first-level includes per file */
#define MAX_INCLUDES 200
typedef struct _INCL_FILE
{
struct _INCL_FILE *next;
char *name;
char *filename;
struct _INCL_FILE *included_by; /* file that included this one */
int included_line; /* line where this file was included */
int system; /* is it a system include (#include <name>) */
struct _INCL_FILE *owner;
struct _INCL_FILE *files[MAX_INCLUDES];
} INCL_FILE;
static INCL_FILE *firstSrc;
static INCL_FILE *firstInclude;
typedef struct _INCL_PATH
{
struct _INCL_PATH *next;
const char *name;
} INCL_PATH;
static INCL_PATH *firstPath;
static const char *SrcDir = NULL;
static const char *OutputFileName = "Makefile";
static const char *Separator = "### Dependencies";
static const char *ProgramName;
static const char Usage[] =
"Usage: %s [options] [files]\n"
"Options:\n"
" -Idir Search for include files in directory 'dir'\n"
" -Cdir Search for source files in directory 'dir'\n"
" -fxxx Store output in file 'xxx' (default: Makefile)\n"
" -sxxx Use 'xxx' as separator (default: \"### Dependencies\")\n";
/*******************************************************************
* fatal_error
*/
static void fatal_error( const char *msg, ... )
{
va_list valist;
va_start( valist, msg );
vfprintf( stderr, msg, valist );
va_end( valist );
exit(1);
}
/*******************************************************************
* xmalloc
*/
static void *xmalloc( int size )
{
void *res;
if (!(res = malloc (size ? size : 1)))
fatal_error( "%s: Virtual memory exhausted.\n", ProgramName );
return res;
}
/*******************************************************************
* xstrdup
*/
static char *xstrdup( const char *str )
{
char *res = strdup( str );
if (!res) fatal_error( "%s: Virtual memory exhausted.\n", ProgramName );
return res;
}
/*******************************************************************
* get_extension
*/
static char *get_extension( char *filename )
{
char *ext = strrchr( filename, '.' );
if (ext && strchr( ext, '/' )) ext = NULL;
return ext;
}
/*******************************************************************
* is_generated
*
* Test if a given file type is generated during the make process
*/
static int is_generated( const char *name )
{
static const char * const extensions[] = { ".tab.h", ".mc.rc" };
size_t i, len = strlen(name);
for (i = 0; i < sizeof(extensions)/sizeof(extensions[0]); i++)
{
if (len <= strlen(extensions[i])) continue;
if (!strcmp( name + len - strlen(extensions[i]), extensions[i] )) return 1;
}
return 0;
}
/*******************************************************************
* add_include_path
*
* Add a directory to the include path.
*/
static void add_include_path( const char *name )
{
INCL_PATH *path = xmalloc( sizeof(*path) );
INCL_PATH **p = &firstPath;
while (*p) p = &(*p)->next;
*p = path;
path->next = NULL;
path->name = name;
}
/*******************************************************************
* add_src_file
*
* Add a source file to the list.
*/
static INCL_FILE *add_src_file( const char *name )
{
INCL_FILE **p = &firstSrc;
INCL_FILE *file = xmalloc( sizeof(*file) );
memset( file, 0, sizeof(*file) );
file->name = xstrdup(name);
while (*p) p = &(*p)->next;
*p = file;
return file;
}
/*******************************************************************
* add_include
*
* Add an include file if it doesn't already exists.
*/
static INCL_FILE *add_include( INCL_FILE *pFile, const char *name, int line, int system )
{
INCL_FILE **p = &firstInclude;
char *ext;
int pos;
for (pos = 0; pos < MAX_INCLUDES; pos++) if (!pFile->files[pos]) break;
if (pos >= MAX_INCLUDES)
fatal_error( "%s: %s: too many included files, please fix MAX_INCLUDES\n",
ProgramName, pFile->name );
/* enforce some rules for the Wine tree */
if (!memcmp( name, "../", 3 ))
fatal_error( "%s:%d: #include directive with relative path not allowed\n",
pFile->filename, line );
if (!strcmp( name, "config.h" ))
{
if ((ext = strrchr( pFile->filename, '.' )) && !strcmp( ext, ".h" ))
fatal_error( "%s:%d: config.h must not be included by a header file\n",
pFile->filename, line );
if (pos)
fatal_error( "%s:%d: config.h must be included before anything else\n",
pFile->filename, line );
}
else if (!strcmp( name, "wine/port.h" ))
{
if ((ext = strrchr( pFile->filename, '.' )) && !strcmp( ext, ".h" ))
fatal_error( "%s:%d: wine/port.h must not be included by a header file\n",
pFile->filename, line );
if (!pos) fatal_error( "%s:%d: config.h must be included before wine/port.h\n",
pFile->filename, line );
if (pos > 1)
fatal_error( "%s:%d: wine/port.h must be included before everything except config.h\n",
pFile->filename, line );
if (strcmp( pFile->files[0]->name, "config.h" ))
fatal_error( "%s:%d: config.h must be included before wine/port.h\n",
pFile->filename, line );
}
while (*p && strcmp( name, (*p)->name )) p = &(*p)->next;
if (!*p)
{
*p = xmalloc( sizeof(INCL_FILE) );
memset( *p, 0, sizeof(INCL_FILE) );
(*p)->name = xstrdup(name);
(*p)->included_by = pFile;
(*p)->included_line = line;
(*p)->system = system || pFile->system;
}
pFile->files[pos] = *p;
return *p;
}
/*******************************************************************
* open_src_file
*/
static FILE *open_src_file( INCL_FILE *pFile )
{
FILE *file;
/* first try name as is */
if ((file = fopen( pFile->name, "r" )))
{
pFile->filename = xstrdup( pFile->name );
return file;
}
/* now try in source dir */
if (SrcDir)
{
pFile->filename = xmalloc( strlen(SrcDir) + strlen(pFile->name) + 2 );
strcpy( pFile->filename, SrcDir );
strcat( pFile->filename, "/" );
strcat( pFile->filename, pFile->name );
file = fopen( pFile->filename, "r" );
}
if (!file)
{
perror( pFile->name );
exit(1);
}
return file;
}
/*******************************************************************
* open_include_file
*/
static FILE *open_include_file( INCL_FILE *pFile )
{
FILE *file = NULL;
INCL_PATH *path;
for (path = firstPath; path; path = path->next)
{
char *filename = xmalloc(strlen(path->name) + strlen(pFile->name) + 2);
strcpy( filename, path->name );
strcat( filename, "/" );
strcat( filename, pFile->name );
if ((file = fopen( filename, "r" )))
{
pFile->filename = filename;
break;
}
free( filename );
}
if (!file && pFile->system) return NULL; /* ignore system files we cannot find */
/* try in src file directory */
if (!file)
{
char *p = strrchr(pFile->included_by->filename, '/');
if (p)
{
int l = p - pFile->included_by->filename + 1;
char *filename = xmalloc(l + strlen(pFile->name) + 1);
memcpy( filename, pFile->included_by->filename, l );
strcpy( filename + l, pFile->name );
if ((file = fopen( filename, "r" ))) pFile->filename = filename;
else free( filename );
}
}
if (!file)
{
if (pFile->included_by->system) return NULL; /* ignore if included by a system file */
if (firstPath) perror( pFile->name );
else fprintf( stderr, "%s: %s: File not found\n",
ProgramName, pFile->name );
while (pFile->included_by)
{
fprintf( stderr, " %s was first included from %s:%d\n",
pFile->name, pFile->included_by->name, pFile->included_line );
pFile = pFile->included_by;
}
exit(1);
}
return file;
}
/*******************************************************************
* parse_idl_file
*/
static void parse_idl_file( INCL_FILE *pFile, FILE *file )
{
char buffer[1024];
char *include;
int line = 0;
while (fgets( buffer, sizeof(buffer)-1, file ))
{
char quote;
char *p = buffer;
line++;
while (*p && isspace(*p)) p++;
if (!strncmp( p, "import", 6 ))
{
p += 6;
while (*p && isspace(*p)) p++;
if (*p != '\"') continue;
}
else
{
if (*p++ != '#') continue;
while (*p && isspace(*p)) p++;
if (strncmp( p, "include", 7 )) continue;
p += 7;
while (*p && isspace(*p)) p++;
if (*p != '\"' && *p != '<' ) continue;
}
quote = *p++;
if (quote == '<') quote = '>';
include = p;
while (*p && (*p != quote)) p++;
if (!*p) fatal_error( "%s:%d: Malformed #include or import directive\n",
pFile->filename, line );
*p = 0;
add_include( pFile, include, line, (quote == '>') );
}
}
/*******************************************************************
* parse_c_file
*/
static void parse_c_file( INCL_FILE *pFile, FILE *file )
{
char buffer[1024];
char *include;
int line = 0;
while (fgets( buffer, sizeof(buffer)-1, file ))
{
char quote;
char *p = buffer;
line++;
while (*p && isspace(*p)) p++;
if (*p++ != '#') continue;
while (*p && isspace(*p)) p++;
if (strncmp( p, "include", 7 )) continue;
p += 7;
while (*p && isspace(*p)) p++;
if (*p != '\"' && *p != '<' ) continue;
quote = *p++;
if (quote == '<') quote = '>';
include = p;
while (*p && (*p != quote)) p++;
if (!*p) fatal_error( "%s:%d: Malformed #include directive\n",
pFile->filename, line );
*p = 0;
add_include( pFile, include, line, (quote == '>') );
}
}
/*******************************************************************
* parse_file
*/
static void parse_file( INCL_FILE *pFile, int src )
{
char *ext;
FILE *file;
if (is_generated( pFile->name ))
{
/* file is generated during make, don't try to open it */
pFile->filename = xstrdup( pFile->name );
return;
}
file = src ? open_src_file( pFile ) : open_include_file( pFile );
if (!file) return;
ext = get_extension( pFile->name );
if (ext && !strcmp( ext, ".idl" )) parse_idl_file( pFile, file );
else parse_c_file( pFile, file );
fclose(file);
}
/*******************************************************************
* output_include
*/
static void output_include( FILE *file, INCL_FILE *pFile,
INCL_FILE *owner, int *column )
{
int i;
if (pFile->owner == owner) return;
if (!pFile->filename) return;
pFile->owner = owner;
if (*column + strlen(pFile->filename) + 1 > 70)
{
fprintf( file, " \\\n" );
*column = 0;
}
fprintf( file, " %s", pFile->filename );
*column += strlen(pFile->filename) + 1;
for (i = 0; i < MAX_INCLUDES; i++)
if (pFile->files[i]) output_include( file, pFile->files[i],
owner, column );
}
Release 970928 Sat Sep 27 12:36:56 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [if1632/relay.c] Made Catch and Throw also save %si and %di (untested). * [memory/selector.c] Added check for %fs and %gs in SELECTOR_FreeBlock. * [rc/winerc.c] Generated files no longer depend on Wine includes. Made .h generation optional. * [tools/build.c] [loader/task.c] Added CALL32_Init function. Added possibility to pass arguments when using CALLTO16_regs_. 32-bit stack pointer is now saved on the 16-bit stack, instead of using IF1632_Saved32_esp. Removed CallTo32 callbacks. * [tools/makedep.c] [*/Makefile.in] Added support for directly generating dependencies for .y, .l and .rc files. Modified the makefiles to use this feature. * [windows/winproc.c] [if1632/thunk.c] Use CALLTO16_regs to call window procedures. Thu Sep 25 12:18:57 1997 Kristian Nielsen <kristian.nielsen@risoe.dk> * [if1632/kernel.spec] Changed entry for SwitchStackBack to remove arguments from stack upon return (arguments left over from previous SwitchStackTo()). Borland C++ 4.0 now compiles "Hello World" (but crashes after outputting the .exe). Wed Sep 24 13:54:44 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] SearchPath might get NULL buffer (empty LRU list in wordpad). * [memory/selector.c] Added SUnMapLS*. * [loader/pe_image.c] Be able to run executeables from non mmap()ble filesystems. PE_LoadLibrary adds librarys loaded by another process to its own modref list too. * [windows/keyboard.c][include/accel.h][loader/resource.c] Fixed accelerator leakage, use SDK defines/names. * [graphics/env.c][misc/main.c] Set/GetEnvironemnt have nothing to do with environment vars, but with Printer Environment. * [graphics/escape.c] Escape32: map args back to segmented pointers. * [windows/win.c] WS_POPUP|WS_CHILD windows don't need a parent window (SDK). Tue Sep 16 14:40:16 1997 Robert Wilhelm <robert@physiol.med.tu-muenchen.de> * [if1632/crtdll.spec] [misc/crtdll.c] Added signal().
1997-09-28 19:43:24 +02:00
/*******************************************************************
* output_src
*/
static void output_src( FILE *file, INCL_FILE *pFile, int *column )
{
char *obj = xstrdup( pFile->name );
char *ext = get_extension( obj );
Release 970928 Sat Sep 27 12:36:56 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [if1632/relay.c] Made Catch and Throw also save %si and %di (untested). * [memory/selector.c] Added check for %fs and %gs in SELECTOR_FreeBlock. * [rc/winerc.c] Generated files no longer depend on Wine includes. Made .h generation optional. * [tools/build.c] [loader/task.c] Added CALL32_Init function. Added possibility to pass arguments when using CALLTO16_regs_. 32-bit stack pointer is now saved on the 16-bit stack, instead of using IF1632_Saved32_esp. Removed CallTo32 callbacks. * [tools/makedep.c] [*/Makefile.in] Added support for directly generating dependencies for .y, .l and .rc files. Modified the makefiles to use this feature. * [windows/winproc.c] [if1632/thunk.c] Use CALLTO16_regs to call window procedures. Thu Sep 25 12:18:57 1997 Kristian Nielsen <kristian.nielsen@risoe.dk> * [if1632/kernel.spec] Changed entry for SwitchStackBack to remove arguments from stack upon return (arguments left over from previous SwitchStackTo()). Borland C++ 4.0 now compiles "Hello World" (but crashes after outputting the .exe). Wed Sep 24 13:54:44 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] SearchPath might get NULL buffer (empty LRU list in wordpad). * [memory/selector.c] Added SUnMapLS*. * [loader/pe_image.c] Be able to run executeables from non mmap()ble filesystems. PE_LoadLibrary adds librarys loaded by another process to its own modref list too. * [windows/keyboard.c][include/accel.h][loader/resource.c] Fixed accelerator leakage, use SDK defines/names. * [graphics/env.c][misc/main.c] Set/GetEnvironemnt have nothing to do with environment vars, but with Printer Environment. * [graphics/escape.c] Escape32: map args back to segmented pointers. * [windows/win.c] WS_POPUP|WS_CHILD windows don't need a parent window (SDK). Tue Sep 16 14:40:16 1997 Robert Wilhelm <robert@physiol.med.tu-muenchen.de> * [if1632/crtdll.spec] [misc/crtdll.c] Added signal().
1997-09-28 19:43:24 +02:00
if (ext)
{
*ext++ = 0;
if (!strcmp( ext, "y" )) /* yacc file */
Release 970928 Sat Sep 27 12:36:56 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [if1632/relay.c] Made Catch and Throw also save %si and %di (untested). * [memory/selector.c] Added check for %fs and %gs in SELECTOR_FreeBlock. * [rc/winerc.c] Generated files no longer depend on Wine includes. Made .h generation optional. * [tools/build.c] [loader/task.c] Added CALL32_Init function. Added possibility to pass arguments when using CALLTO16_regs_. 32-bit stack pointer is now saved on the 16-bit stack, instead of using IF1632_Saved32_esp. Removed CallTo32 callbacks. * [tools/makedep.c] [*/Makefile.in] Added support for directly generating dependencies for .y, .l and .rc files. Modified the makefiles to use this feature. * [windows/winproc.c] [if1632/thunk.c] Use CALLTO16_regs to call window procedures. Thu Sep 25 12:18:57 1997 Kristian Nielsen <kristian.nielsen@risoe.dk> * [if1632/kernel.spec] Changed entry for SwitchStackBack to remove arguments from stack upon return (arguments left over from previous SwitchStackTo()). Borland C++ 4.0 now compiles "Hello World" (but crashes after outputting the .exe). Wed Sep 24 13:54:44 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] SearchPath might get NULL buffer (empty LRU list in wordpad). * [memory/selector.c] Added SUnMapLS*. * [loader/pe_image.c] Be able to run executeables from non mmap()ble filesystems. PE_LoadLibrary adds librarys loaded by another process to its own modref list too. * [windows/keyboard.c][include/accel.h][loader/resource.c] Fixed accelerator leakage, use SDK defines/names. * [graphics/env.c][misc/main.c] Set/GetEnvironemnt have nothing to do with environment vars, but with Printer Environment. * [graphics/escape.c] Escape32: map args back to segmented pointers. * [windows/win.c] WS_POPUP|WS_CHILD windows don't need a parent window (SDK). Tue Sep 16 14:40:16 1997 Robert Wilhelm <robert@physiol.med.tu-muenchen.de> * [if1632/crtdll.spec] [misc/crtdll.c] Added signal().
1997-09-28 19:43:24 +02:00
{
*column += fprintf( file, "y.tab.o: y.tab.c" );
Release 970928 Sat Sep 27 12:36:56 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [if1632/relay.c] Made Catch and Throw also save %si and %di (untested). * [memory/selector.c] Added check for %fs and %gs in SELECTOR_FreeBlock. * [rc/winerc.c] Generated files no longer depend on Wine includes. Made .h generation optional. * [tools/build.c] [loader/task.c] Added CALL32_Init function. Added possibility to pass arguments when using CALLTO16_regs_. 32-bit stack pointer is now saved on the 16-bit stack, instead of using IF1632_Saved32_esp. Removed CallTo32 callbacks. * [tools/makedep.c] [*/Makefile.in] Added support for directly generating dependencies for .y, .l and .rc files. Modified the makefiles to use this feature. * [windows/winproc.c] [if1632/thunk.c] Use CALLTO16_regs to call window procedures. Thu Sep 25 12:18:57 1997 Kristian Nielsen <kristian.nielsen@risoe.dk> * [if1632/kernel.spec] Changed entry for SwitchStackBack to remove arguments from stack upon return (arguments left over from previous SwitchStackTo()). Borland C++ 4.0 now compiles "Hello World" (but crashes after outputting the .exe). Wed Sep 24 13:54:44 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] SearchPath might get NULL buffer (empty LRU list in wordpad). * [memory/selector.c] Added SUnMapLS*. * [loader/pe_image.c] Be able to run executeables from non mmap()ble filesystems. PE_LoadLibrary adds librarys loaded by another process to its own modref list too. * [windows/keyboard.c][include/accel.h][loader/resource.c] Fixed accelerator leakage, use SDK defines/names. * [graphics/env.c][misc/main.c] Set/GetEnvironemnt have nothing to do with environment vars, but with Printer Environment. * [graphics/escape.c] Escape32: map args back to segmented pointers. * [windows/win.c] WS_POPUP|WS_CHILD windows don't need a parent window (SDK). Tue Sep 16 14:40:16 1997 Robert Wilhelm <robert@physiol.med.tu-muenchen.de> * [if1632/crtdll.spec] [misc/crtdll.c] Added signal().
1997-09-28 19:43:24 +02:00
}
else if (!strcmp( ext, "l" )) /* lex file */
Release 970928 Sat Sep 27 12:36:56 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [if1632/relay.c] Made Catch and Throw also save %si and %di (untested). * [memory/selector.c] Added check for %fs and %gs in SELECTOR_FreeBlock. * [rc/winerc.c] Generated files no longer depend on Wine includes. Made .h generation optional. * [tools/build.c] [loader/task.c] Added CALL32_Init function. Added possibility to pass arguments when using CALLTO16_regs_. 32-bit stack pointer is now saved on the 16-bit stack, instead of using IF1632_Saved32_esp. Removed CallTo32 callbacks. * [tools/makedep.c] [*/Makefile.in] Added support for directly generating dependencies for .y, .l and .rc files. Modified the makefiles to use this feature. * [windows/winproc.c] [if1632/thunk.c] Use CALLTO16_regs to call window procedures. Thu Sep 25 12:18:57 1997 Kristian Nielsen <kristian.nielsen@risoe.dk> * [if1632/kernel.spec] Changed entry for SwitchStackBack to remove arguments from stack upon return (arguments left over from previous SwitchStackTo()). Borland C++ 4.0 now compiles "Hello World" (but crashes after outputting the .exe). Wed Sep 24 13:54:44 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] SearchPath might get NULL buffer (empty LRU list in wordpad). * [memory/selector.c] Added SUnMapLS*. * [loader/pe_image.c] Be able to run executeables from non mmap()ble filesystems. PE_LoadLibrary adds librarys loaded by another process to its own modref list too. * [windows/keyboard.c][include/accel.h][loader/resource.c] Fixed accelerator leakage, use SDK defines/names. * [graphics/env.c][misc/main.c] Set/GetEnvironemnt have nothing to do with environment vars, but with Printer Environment. * [graphics/escape.c] Escape32: map args back to segmented pointers. * [windows/win.c] WS_POPUP|WS_CHILD windows don't need a parent window (SDK). Tue Sep 16 14:40:16 1997 Robert Wilhelm <robert@physiol.med.tu-muenchen.de> * [if1632/crtdll.spec] [misc/crtdll.c] Added signal().
1997-09-28 19:43:24 +02:00
{
*column += fprintf( file, "%s.o: %s.c", LEX_OUTPUT_ROOT, LEX_OUTPUT_ROOT );
Release 970928 Sat Sep 27 12:36:56 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [if1632/relay.c] Made Catch and Throw also save %si and %di (untested). * [memory/selector.c] Added check for %fs and %gs in SELECTOR_FreeBlock. * [rc/winerc.c] Generated files no longer depend on Wine includes. Made .h generation optional. * [tools/build.c] [loader/task.c] Added CALL32_Init function. Added possibility to pass arguments when using CALLTO16_regs_. 32-bit stack pointer is now saved on the 16-bit stack, instead of using IF1632_Saved32_esp. Removed CallTo32 callbacks. * [tools/makedep.c] [*/Makefile.in] Added support for directly generating dependencies for .y, .l and .rc files. Modified the makefiles to use this feature. * [windows/winproc.c] [if1632/thunk.c] Use CALLTO16_regs to call window procedures. Thu Sep 25 12:18:57 1997 Kristian Nielsen <kristian.nielsen@risoe.dk> * [if1632/kernel.spec] Changed entry for SwitchStackBack to remove arguments from stack upon return (arguments left over from previous SwitchStackTo()). Borland C++ 4.0 now compiles "Hello World" (but crashes after outputting the .exe). Wed Sep 24 13:54:44 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] SearchPath might get NULL buffer (empty LRU list in wordpad). * [memory/selector.c] Added SUnMapLS*. * [loader/pe_image.c] Be able to run executeables from non mmap()ble filesystems. PE_LoadLibrary adds librarys loaded by another process to its own modref list too. * [windows/keyboard.c][include/accel.h][loader/resource.c] Fixed accelerator leakage, use SDK defines/names. * [graphics/env.c][misc/main.c] Set/GetEnvironemnt have nothing to do with environment vars, but with Printer Environment. * [graphics/escape.c] Escape32: map args back to segmented pointers. * [windows/win.c] WS_POPUP|WS_CHILD windows don't need a parent window (SDK). Tue Sep 16 14:40:16 1997 Robert Wilhelm <robert@physiol.med.tu-muenchen.de> * [if1632/crtdll.spec] [misc/crtdll.c] Added signal().
1997-09-28 19:43:24 +02:00
}
else if (!strcmp( ext, "rc" )) /* resource file */
Release 970928 Sat Sep 27 12:36:56 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [if1632/relay.c] Made Catch and Throw also save %si and %di (untested). * [memory/selector.c] Added check for %fs and %gs in SELECTOR_FreeBlock. * [rc/winerc.c] Generated files no longer depend on Wine includes. Made .h generation optional. * [tools/build.c] [loader/task.c] Added CALL32_Init function. Added possibility to pass arguments when using CALLTO16_regs_. 32-bit stack pointer is now saved on the 16-bit stack, instead of using IF1632_Saved32_esp. Removed CallTo32 callbacks. * [tools/makedep.c] [*/Makefile.in] Added support for directly generating dependencies for .y, .l and .rc files. Modified the makefiles to use this feature. * [windows/winproc.c] [if1632/thunk.c] Use CALLTO16_regs to call window procedures. Thu Sep 25 12:18:57 1997 Kristian Nielsen <kristian.nielsen@risoe.dk> * [if1632/kernel.spec] Changed entry for SwitchStackBack to remove arguments from stack upon return (arguments left over from previous SwitchStackTo()). Borland C++ 4.0 now compiles "Hello World" (but crashes after outputting the .exe). Wed Sep 24 13:54:44 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] SearchPath might get NULL buffer (empty LRU list in wordpad). * [memory/selector.c] Added SUnMapLS*. * [loader/pe_image.c] Be able to run executeables from non mmap()ble filesystems. PE_LoadLibrary adds librarys loaded by another process to its own modref list too. * [windows/keyboard.c][include/accel.h][loader/resource.c] Fixed accelerator leakage, use SDK defines/names. * [graphics/env.c][misc/main.c] Set/GetEnvironemnt have nothing to do with environment vars, but with Printer Environment. * [graphics/escape.c] Escape32: map args back to segmented pointers. * [windows/win.c] WS_POPUP|WS_CHILD windows don't need a parent window (SDK). Tue Sep 16 14:40:16 1997 Robert Wilhelm <robert@physiol.med.tu-muenchen.de> * [if1632/crtdll.spec] [misc/crtdll.c] Added signal().
1997-09-28 19:43:24 +02:00
{
*column += fprintf( file, "%s.res: %s", obj, pFile->filename );
}
else if (!strcmp( ext, "mc" )) /* message file */
{
*column += fprintf( file, "%s.mc.rc: %s", obj, pFile->filename );
Release 970928 Sat Sep 27 12:36:56 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [if1632/relay.c] Made Catch and Throw also save %si and %di (untested). * [memory/selector.c] Added check for %fs and %gs in SELECTOR_FreeBlock. * [rc/winerc.c] Generated files no longer depend on Wine includes. Made .h generation optional. * [tools/build.c] [loader/task.c] Added CALL32_Init function. Added possibility to pass arguments when using CALLTO16_regs_. 32-bit stack pointer is now saved on the 16-bit stack, instead of using IF1632_Saved32_esp. Removed CallTo32 callbacks. * [tools/makedep.c] [*/Makefile.in] Added support for directly generating dependencies for .y, .l and .rc files. Modified the makefiles to use this feature. * [windows/winproc.c] [if1632/thunk.c] Use CALLTO16_regs to call window procedures. Thu Sep 25 12:18:57 1997 Kristian Nielsen <kristian.nielsen@risoe.dk> * [if1632/kernel.spec] Changed entry for SwitchStackBack to remove arguments from stack upon return (arguments left over from previous SwitchStackTo()). Borland C++ 4.0 now compiles "Hello World" (but crashes after outputting the .exe). Wed Sep 24 13:54:44 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] SearchPath might get NULL buffer (empty LRU list in wordpad). * [memory/selector.c] Added SUnMapLS*. * [loader/pe_image.c] Be able to run executeables from non mmap()ble filesystems. PE_LoadLibrary adds librarys loaded by another process to its own modref list too. * [windows/keyboard.c][include/accel.h][loader/resource.c] Fixed accelerator leakage, use SDK defines/names. * [graphics/env.c][misc/main.c] Set/GetEnvironemnt have nothing to do with environment vars, but with Printer Environment. * [graphics/escape.c] Escape32: map args back to segmented pointers. * [windows/win.c] WS_POPUP|WS_CHILD windows don't need a parent window (SDK). Tue Sep 16 14:40:16 1997 Robert Wilhelm <robert@physiol.med.tu-muenchen.de> * [if1632/crtdll.spec] [misc/crtdll.c] Added signal().
1997-09-28 19:43:24 +02:00
}
else if (!strcmp( ext, "idl" )) /* IDL file */
{
*column += fprintf( file, "%s.h: %s", obj, pFile->filename );
}
Release 970928 Sat Sep 27 12:36:56 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [if1632/relay.c] Made Catch and Throw also save %si and %di (untested). * [memory/selector.c] Added check for %fs and %gs in SELECTOR_FreeBlock. * [rc/winerc.c] Generated files no longer depend on Wine includes. Made .h generation optional. * [tools/build.c] [loader/task.c] Added CALL32_Init function. Added possibility to pass arguments when using CALLTO16_regs_. 32-bit stack pointer is now saved on the 16-bit stack, instead of using IF1632_Saved32_esp. Removed CallTo32 callbacks. * [tools/makedep.c] [*/Makefile.in] Added support for directly generating dependencies for .y, .l and .rc files. Modified the makefiles to use this feature. * [windows/winproc.c] [if1632/thunk.c] Use CALLTO16_regs to call window procedures. Thu Sep 25 12:18:57 1997 Kristian Nielsen <kristian.nielsen@risoe.dk> * [if1632/kernel.spec] Changed entry for SwitchStackBack to remove arguments from stack upon return (arguments left over from previous SwitchStackTo()). Borland C++ 4.0 now compiles "Hello World" (but crashes after outputting the .exe). Wed Sep 24 13:54:44 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] SearchPath might get NULL buffer (empty LRU list in wordpad). * [memory/selector.c] Added SUnMapLS*. * [loader/pe_image.c] Be able to run executeables from non mmap()ble filesystems. PE_LoadLibrary adds librarys loaded by another process to its own modref list too. * [windows/keyboard.c][include/accel.h][loader/resource.c] Fixed accelerator leakage, use SDK defines/names. * [graphics/env.c][misc/main.c] Set/GetEnvironemnt have nothing to do with environment vars, but with Printer Environment. * [graphics/escape.c] Escape32: map args back to segmented pointers. * [windows/win.c] WS_POPUP|WS_CHILD windows don't need a parent window (SDK). Tue Sep 16 14:40:16 1997 Robert Wilhelm <robert@physiol.med.tu-muenchen.de> * [if1632/crtdll.spec] [misc/crtdll.c] Added signal().
1997-09-28 19:43:24 +02:00
else
{
*column += fprintf( file, "%s.o: %s", obj, pFile->filename );
Release 970928 Sat Sep 27 12:36:56 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [if1632/relay.c] Made Catch and Throw also save %si and %di (untested). * [memory/selector.c] Added check for %fs and %gs in SELECTOR_FreeBlock. * [rc/winerc.c] Generated files no longer depend on Wine includes. Made .h generation optional. * [tools/build.c] [loader/task.c] Added CALL32_Init function. Added possibility to pass arguments when using CALLTO16_regs_. 32-bit stack pointer is now saved on the 16-bit stack, instead of using IF1632_Saved32_esp. Removed CallTo32 callbacks. * [tools/makedep.c] [*/Makefile.in] Added support for directly generating dependencies for .y, .l and .rc files. Modified the makefiles to use this feature. * [windows/winproc.c] [if1632/thunk.c] Use CALLTO16_regs to call window procedures. Thu Sep 25 12:18:57 1997 Kristian Nielsen <kristian.nielsen@risoe.dk> * [if1632/kernel.spec] Changed entry for SwitchStackBack to remove arguments from stack upon return (arguments left over from previous SwitchStackTo()). Borland C++ 4.0 now compiles "Hello World" (but crashes after outputting the .exe). Wed Sep 24 13:54:44 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] SearchPath might get NULL buffer (empty LRU list in wordpad). * [memory/selector.c] Added SUnMapLS*. * [loader/pe_image.c] Be able to run executeables from non mmap()ble filesystems. PE_LoadLibrary adds librarys loaded by another process to its own modref list too. * [windows/keyboard.c][include/accel.h][loader/resource.c] Fixed accelerator leakage, use SDK defines/names. * [graphics/env.c][misc/main.c] Set/GetEnvironemnt have nothing to do with environment vars, but with Printer Environment. * [graphics/escape.c] Escape32: map args back to segmented pointers. * [windows/win.c] WS_POPUP|WS_CHILD windows don't need a parent window (SDK). Tue Sep 16 14:40:16 1997 Robert Wilhelm <robert@physiol.med.tu-muenchen.de> * [if1632/crtdll.spec] [misc/crtdll.c] Added signal().
1997-09-28 19:43:24 +02:00
}
}
free( obj );
}
/*******************************************************************
* output_dependencies
*/
static void output_dependencies(void)
{
INCL_FILE *pFile;
int i, column;
FILE *file = NULL;
char buffer[1024];
if (Separator && ((file = fopen( OutputFileName, "r+" ))))
{
while (fgets( buffer, sizeof(buffer), file ))
if (!strncmp( buffer, Separator, strlen(Separator) )) break;
ftruncate( fileno(file), ftell(file) );
Release 970120 Sun Jan 19 11:46:48 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [loader/module.c] Fixed LoadModule() to always call the DLL initialization code. * [windows/event.c] Moved all the keyboard stuff to windows/keyboard.c * [tools/build.c] Fixed Win32 register functions. Sat Jan 18 22:24:41 1997 David Makepeace <D.Makepeace@mailbox.uq.oz.au> * [tools/makedep.c] Fixed bug which causes SEGV on Solaris x86. Fri Jan 17 18:32:27 1997 Frans van Dorsselaer <dorssel@rulhmpc49.LeidenUniv.nl> * [controls/edit.c] Implemented WM_UNDO, WM_CONTEXTMENU (temporary using WM_RBUTTONUP), WM_COMMAND, WM_INITPOPUPMENU, WM_SYSKEYDOWN. Fixed EM_SETSEL and some minor bugs (features). Hence: fully functional undo and a win95 menu with the right mouse button. * [include/resources.h] [resources/TODO] [resources/sysres_??.rc] Added a context menu for the edit control. Translations, please ... Fri Jan 17 08:29:52 1997 David Faure <david.faure@ifhamy.insa-lyon.fr> * [windows/event.c] Move EVENT_ToAscii to windows/keyboard.c (where name ToAscii) Fixed Keypad keys 0-9 and . in EVENT_event_to_vkey. Added 3-state handling of toggle keys (CapsLock, NumLock) in order to make them work with any X server. Toggle keys now generate WM_KEYDOWN and WM_KEYUP on each pressing. * [include/keyboard.h] Totally replaced the file (formerly containing the vkcase definitions) by the declaration of 'extern' variables contained by event.c and used by keyboard.c * [windows/keyboard.c] Started to rewrite VkKeyScan and MapVirtualKey, to make them use the table keyc2vkey or X functions only. ToAscii : added keypad 0-9 and . special case. Changed toggle keys active mask from 0x80 to 0x1. * [misc/keyboard.c] File deleted. Contents moved to windows/keyboard.c. * [misc/main.c] Added putenv XKB_DISABLE to disable XKB extension (which, when present, causes AltGr to change keyboard group instead of being a modifier). Tue Jan 14 22:56:43 1997 Philippe De Muyter <phdm@info.ucl.ac.be> * [windows/event.c] Do not assume NumLockMask is Mod2Mask, but compute it by scanning output of XGetModifierMapping for XK_Num_Lock. Tue Jan 14 15:49:49 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [loader/pe_*.c] [include/peexe.h] [include/resource32.h] [debugger/*.c] General clean up. Changed defines/structures to match Windows NT SDK. * [loader/main.c] Don't crash on empty command-line. * [windows/winpos.c] winpos.c made win32 clean. * [misc/ntdll.c] Some string conversion additions. * [files/file.c] GetFileAttributes/GetTempFileName fixed. * [misc/ver.c] VerInstallFile implemented. Mon Jan 13 15:03:11 1997 Philippe De Muyter <phdm@info.ucl.ac.be> * [tools/build.c]: Use PREFIX also in stabs messages. Mon Jan 13 10:40:33 1997 John Harvey <john@division.co.uk> * [graphics/win16drv/*] [include/win16drv.h] Many fixes and some new features. * [graphics/x11drv/font.c] [graphics/x11drv/init.c] [include/x11drv.h] [objects/font.c] GetTextMetrics() moved to graphics driver. * [if1632/gdi.spec] [misc/fontengine.c] [misc/Makefile.in] New dummy EngineEnumerateFont, EngineRealizeFont functions. * [include/windows.h] TEXTFORM16 and FONTINFO16 structure definitions moved here from include/win16drv.h
1997-01-20 20:43:45 +01:00
fseek( file, 0L, SEEK_END );
}
if (!file)
{
if (!(file = fopen( OutputFileName, Separator ? "a" : "w" )))
{
perror( OutputFileName );
exit(1);
}
}
for( pFile = firstSrc; pFile; pFile = pFile->next)
{
Release 970928 Sat Sep 27 12:36:56 1997 Alexandre Julliard <julliard@lrc.epfl.ch> * [if1632/relay.c] Made Catch and Throw also save %si and %di (untested). * [memory/selector.c] Added check for %fs and %gs in SELECTOR_FreeBlock. * [rc/winerc.c] Generated files no longer depend on Wine includes. Made .h generation optional. * [tools/build.c] [loader/task.c] Added CALL32_Init function. Added possibility to pass arguments when using CALLTO16_regs_. 32-bit stack pointer is now saved on the 16-bit stack, instead of using IF1632_Saved32_esp. Removed CallTo32 callbacks. * [tools/makedep.c] [*/Makefile.in] Added support for directly generating dependencies for .y, .l and .rc files. Modified the makefiles to use this feature. * [windows/winproc.c] [if1632/thunk.c] Use CALLTO16_regs to call window procedures. Thu Sep 25 12:18:57 1997 Kristian Nielsen <kristian.nielsen@risoe.dk> * [if1632/kernel.spec] Changed entry for SwitchStackBack to remove arguments from stack upon return (arguments left over from previous SwitchStackTo()). Borland C++ 4.0 now compiles "Hello World" (but crashes after outputting the .exe). Wed Sep 24 13:54:44 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] SearchPath might get NULL buffer (empty LRU list in wordpad). * [memory/selector.c] Added SUnMapLS*. * [loader/pe_image.c] Be able to run executeables from non mmap()ble filesystems. PE_LoadLibrary adds librarys loaded by another process to its own modref list too. * [windows/keyboard.c][include/accel.h][loader/resource.c] Fixed accelerator leakage, use SDK defines/names. * [graphics/env.c][misc/main.c] Set/GetEnvironemnt have nothing to do with environment vars, but with Printer Environment. * [graphics/escape.c] Escape32: map args back to segmented pointers. * [windows/win.c] WS_POPUP|WS_CHILD windows don't need a parent window (SDK). Tue Sep 16 14:40:16 1997 Robert Wilhelm <robert@physiol.med.tu-muenchen.de> * [if1632/crtdll.spec] [misc/crtdll.c] Added signal().
1997-09-28 19:43:24 +02:00
column = 0;
output_src( file, pFile, &column );
for (i = 0; i < MAX_INCLUDES; i++)
if (pFile->files[i]) output_include( file, pFile->files[i],
pFile, &column );
fprintf( file, "\n" );
}
fclose(file);
}
/*******************************************************************
* parse_option
*/
static void parse_option( const char *opt )
{
switch(opt[1])
{
case 'I':
if (opt[2]) add_include_path( opt + 2 );
break;
case 'C':
if (opt[2]) SrcDir = opt + 2;
else SrcDir = NULL;
break;
case 'f':
if (opt[2]) OutputFileName = opt + 2;
break;
case 's':
if (opt[2]) Separator = opt + 2;
else Separator = NULL;
break;
default:
fprintf( stderr, "Unknown option '%s'\n", opt );
fprintf( stderr, Usage, ProgramName );
exit(1);
}
}
/*******************************************************************
* main
*/
int main( int argc, char *argv[] )
{
INCL_FILE *pFile;
ProgramName = argv[0];
while (argc > 1)
{
if (*argv[1] == '-') parse_option( argv[1] );
else
{
pFile = add_src_file( argv[1] );
parse_file( pFile, 1 );
}
argc--;
argv++;
}
for (pFile = firstInclude; pFile; pFile = pFile->next)
parse_file( pFile, 0 );
if( firstSrc ) output_dependencies();
return 0;
}