From 092f9d9874756380240f91716aef5e67c66f437d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 7 Mar 2023 07:28:32 +0100 Subject: [apinames] Fix VMS handling of overly long function names. Based on ideas from Jouk Jansen . * src/tools/vms_shorten_symbol.c: New file, taken from https://sourceforge.net/p/vms-ports/vmsshortsym/ci/default/tree/vms_shorten_symbol.c with some minor edits to allow compilation with C++ and being included in another source code file. * src/tools/apinames.c: Include `vms_shorten_symbol.c`. (PROGRAM_VERSION): Set to '0.5'. (names_dump) [OUTPUT_VMS_OPT]: Call `vms_shorten_symbol` to get unique function identifiers not longer than 31 characters. --- src/tools/apinames.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/tools/apinames.c') diff --git a/src/tools/apinames.c b/src/tools/apinames.c index e1b085172..8c395aea3 100644 --- a/src/tools/apinames.c +++ b/src/tools/apinames.c @@ -22,8 +22,10 @@ #include #include +#include "vms_shorten_symbol.c" + #define PROGRAM_NAME "apinames" -#define PROGRAM_VERSION "0.4" +#define PROGRAM_VERSION "0.5" #define LINEBUFF_SIZE 1024 @@ -214,12 +216,23 @@ names_dump( FILE* out, break; case OUTPUT_VMS_OPT: - fprintf( out, "GSMATCH=LEQUAL,2,0\n" - "CASE_SENSITIVE=YES\n" - "SYMBOL_VECTOR=(-\n" ); - for ( nn = 0; nn < num_names - 1; nn++ ) - fprintf( out, " %s=PROCEDURE,-\n", the_names[nn].name ); - fprintf( out, " %s=PROCEDURE)\n", the_names[num_names - 1].name ); + fprintf( out, "case_sensitive=YES\n" ); + + for ( nn = 0; nn < num_names; nn++ ) + { + char short_symbol[32]; + + + if ( vms_shorten_symbol( the_names[nn].name, short_symbol, 1 ) == -1 ) + panic( "could not shorten name '%s'", the_names[nn].name ); + fprintf( out, "symbol_vector = ( %s = PROCEDURE)\n", short_symbol ); + + strcat( the_names[nn].name , "64__" ); + + if ( vms_shorten_symbol( the_names[nn].name, short_symbol, 1 ) == -1 ) + panic( "could not shorten name '%s'", the_names[nn].name ); + fprintf( out, "symbol_vector = ( %s = PROCEDURE)\n", short_symbol ); + } break; -- cgit v1.2.1