From 80d05a1a6ce48100014f6dbce812667ddb0918e4 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Thu, 6 Oct 2022 14:33:15 +1300 Subject: [PATCH] Eliminate 2 redundant copies of swig banner We had a banner for C, a banner for target languages (parameterised to allow the comment sequence to be specified) and a special banner for XML files in scilab.cxx. The XML variant was only needed because the standard banner contains `--` for a hyphen, so we now use ` - ` for that instead. The C banner now calls Swig_banner_target_lang() with a suitable comment sequence to print the actual banner text. --- Source/Modules/scilab.cxx | 6 +----- Source/Swig/misc.c | 13 +++---------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Source/Modules/scilab.cxx b/Source/Modules/scilab.cxx index ede6e0c66..a99ce0025 100644 --- a/Source/Modules/scilab.cxx +++ b/Source/Modules/scilab.cxx @@ -957,11 +957,7 @@ public: gatewayXML = NewString(""); Printf(gatewayXML, "\n"); Printf(gatewayXML, "\n"); Printf(gatewayXML, "\n", gatewayName); diff --git a/Source/Swig/misc.c b/Source/Swig/misc.c index f89a8c977..92e45fbe0 100644 --- a/Source/Swig/misc.c +++ b/Source/Swig/misc.c @@ -69,15 +69,8 @@ const char *Swig_package_version(void) { * ----------------------------------------------------------------------------- */ void Swig_banner(File *f) { - Printf(f, "/* ----------------------------------------------------------------------------\n\ - * This file was automatically generated by SWIG (https://www.swig.org).\n\ - * Version %s\n\ - *\n\ - * This file is not intended to be easily readable and contains a number of\n\ - * coding conventions designed to improve portability and efficiency. Do not make\n\ - * changes to this file unless you know what you are doing--modify the SWIG\n\ - * interface file instead.\n", Swig_package_version()); - /* String too long for ISO compliance */ + Printf(f, "/* ----------------------------------------------------------------------------\n"); + Swig_banner_target_lang(f, " *"); Printf(f, " * ----------------------------------------------------------------------------- */\n"); } @@ -92,7 +85,7 @@ void Swig_banner_target_lang(File *f, const_String_or_char_ptr commentchar) { Printf(f, "%s This file was automatically generated by SWIG (https://www.swig.org).\n", commentchar); Printf(f, "%s Version %s\n", commentchar, Swig_package_version()); Printf(f, "%s\n", commentchar); - Printf(f, "%s Do not make changes to this file unless you know what you are doing--modify\n", commentchar); + Printf(f, "%s Do not make changes to this file unless you know what you are doing - modify\n", commentchar); Printf(f, "%s the SWIG interface file instead.\n", commentchar); }