diff options
Diffstat (limited to 'src/3rdparty/freetype/src/tools/apinames.c')
-rw-r--r-- | src/3rdparty/freetype/src/tools/apinames.c | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/src/3rdparty/freetype/src/tools/apinames.c b/src/3rdparty/freetype/src/tools/apinames.c index 7f191e19c9..c85df721a0 100644 --- a/src/3rdparty/freetype/src/tools/apinames.c +++ b/src/3rdparty/freetype/src/tools/apinames.c @@ -10,7 +10,7 @@ * accepted if you are using GCC for compilation (and probably by * other compilers too). * - * Author: David Turner, 2005, 2006, 2008, 2009 + * Author: David Turner, 2005, 2006, 2008-2013 * * This code is explicitly placed into the public domain. * @@ -22,7 +22,7 @@ #include <ctype.h> #define PROGRAM_NAME "apinames" -#define PROGRAM_VERSION "0.1" +#define PROGRAM_VERSION "0.2" #define LINEBUFF_SIZE 1024 @@ -31,7 +31,8 @@ typedef enum OutputFormat_ OUTPUT_LIST = 0, /* output the list of names, one per line */ OUTPUT_WINDOWS_DEF, /* output a Windows .DEF file for Visual C++ or Mingw */ OUTPUT_BORLAND_DEF, /* output a Windows .DEF file for Borland C++ */ - OUTPUT_WATCOM_LBC /* output a Watcom Linker Command File */ + OUTPUT_WATCOM_LBC, /* output a Watcom Linker Command File */ + OUTPUT_NETWARE_IMP /* output a NetWare ImportFile */ } OutputFormat; @@ -59,8 +60,9 @@ static void names_add( const char* name, const char* end ) { - int nn, len, h; - Name nm; + unsigned int h; + int nn, len; + Name nm; if ( end <= name ) return; @@ -86,7 +88,8 @@ names_add( const char* name, if ( num_names >= max_names ) { max_names += (max_names >> 1) + 4; - the_names = (NameRec*)realloc( the_names, sizeof(the_names[0])*max_names ); + the_names = (NameRec*)realloc( the_names, + sizeof ( the_names[0] ) * max_names ); if ( the_names == NULL ) panic( "not enough memory" ); } @@ -115,7 +118,8 @@ name_compare( const void* name1, static void names_sort( void ) { - qsort( the_names, (size_t)num_names, sizeof(the_names[0]), name_compare ); + qsort( the_names, (size_t)num_names, + sizeof ( the_names[0] ), name_compare ); } @@ -126,6 +130,7 @@ names_dump( FILE* out, { int nn; + switch ( format ) { case OUTPUT_WINDOWS_DEF: @@ -150,23 +155,26 @@ names_dump( FILE* out, case OUTPUT_WATCOM_LBC: { - /* we must omit the .dll suffix from the library name */ - char temp[512]; - char* dot; + const char* dot; + if ( dll_name == NULL ) { fprintf( stderr, - "you must provide a DLL name with the -d option !!\n" ); - exit(4); + "you must provide a DLL name with the -d option!\n" ); + exit( 4 ); } + /* we must omit the .dll suffix from the library name */ dot = strchr( dll_name, '.' ); if ( dot != NULL ) { - int len = (dot - dll_name); - if ( len > (int)(sizeof(temp)-1) ) - len = sizeof(temp)-1; + char temp[512]; + int len = dot - dll_name; + + + if ( len > (int)( sizeof ( temp ) - 1 ) ) + len = sizeof ( temp ) - 1; memcpy( temp, dll_name, len ); temp[len] = 0; @@ -180,6 +188,16 @@ names_dump( FILE* out, } break; + case OUTPUT_NETWARE_IMP: + { + if ( dll_name != NULL ) + fprintf( out, " (%s)\n", dll_name ); + for ( nn = 0; nn < num_names - 1; nn++ ) + fprintf( out, " %s,\n", the_names[nn].name ); + fprintf( out, " %s\n", the_names[num_names - 1].name ); + } + break; + default: /* LIST */ for ( nn = 0; nn < num_names; nn++ ) fprintf( out, "%s\n", the_names[nn].name ); @@ -201,7 +219,7 @@ typedef enum State_ static int read_header_file( FILE* file, int verbose ) { - static char buff[ LINEBUFF_SIZE+1 ]; + static char buff[LINEBUFF_SIZE + 1]; State state = STATE_START; while ( !feof( file ) ) @@ -304,6 +322,7 @@ usage( void ) " -w : output .DEF file for Visual C++ and Mingw\n" " -wB : output .DEF file for Borland C++\n" " -wW : output Watcom Linker Response File\n" + " -wN : output NetWare Import File\n" "\n"; fprintf( stderr, @@ -387,6 +406,10 @@ int main( int argc, const char* const* argv ) format = OUTPUT_WATCOM_LBC; break; + case 'N': + format = OUTPUT_NETWARE_IMP; + break; + case 0: break; |