diff options
author | Gaius Mulley <gaiusmod2@gmail.com> | 2024-10-01 14:26:31 +0100 |
---|---|---|
committer | Gaius Mulley <gaiusmod2@gmail.com> | 2024-10-01 14:26:31 +0100 |
commit | fda30a3c8a7c6b06f02be40e3fd0740f893a1b4f (patch) | |
tree | d92e04cbd599122dad2259c91ddd63d283a6993a /gcc/m2 | |
parent | 35dd5cfbfd7f33b5f22ae209635f40af4ab6863c (diff) | |
download | gcc-fda30a3c8a7c6b06f02be40e3fd0740f893a1b4f.zip gcc-fda30a3c8a7c6b06f02be40e3fd0740f893a1b4f.tar.gz gcc-fda30a3c8a7c6b06f02be40e3fd0740f893a1b4f.tar.bz2 |
PR modula2/116918 -fswig correct syntax
This patch fixes the syntax for the generated swig interface file.
The % characters in fprintf require escaping.
gcc/m2/ChangeLog:
PR modula2/116918
* gm2-compiler/M2Swig.mod (AnnotateProcedure): Capitalize
the generated comment, split comment into multiple lines and
terminate the comment with ". */".
(DoCheckUnbounded): Escape the % character with %%.
(DoWriteFile): Ditto.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
Diffstat (limited to 'gcc/m2')
-rw-r--r-- | gcc/m2/gm2-compiler/M2Swig.mod | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/gcc/m2/gm2-compiler/M2Swig.mod b/gcc/m2/gm2-compiler/M2Swig.mod index 194abd5..b7f3442 100644 --- a/gcc/m2/gm2-compiler/M2Swig.mod +++ b/gcc/m2/gm2-compiler/M2Swig.mod @@ -685,7 +685,7 @@ VAR son, p, i: CARDINAL ; needComma: BOOLEAN ; BEGIN - fprintf0(f, '/* parameter: ') ; + fprintf0(f, '/* Parameter: ') ; p := NoOfParam(sym) ; i := 1 ; needComma := FALSE ; @@ -695,14 +695,14 @@ BEGIN THEN IF needComma THEN - fprintf0(f, ', ') + fprintf0(f, ',\n ') END ; CalculateVarDirective(sym, son, TRUE) ; needComma := TRUE END ; INC(i) END ; - fprintf0(f, ' */\n\n') + fprintf0(f, '. */\n\n') END AnnotateProcedure ; @@ -879,9 +879,9 @@ BEGIN IF NOT includedArray THEN includedArray := TRUE ; - fprintf0(f, '%include "carrays.i"\n') + fprintf0(f, '%%include "carrays.i"\n') END ; - fprintf0(f, '%') ; + fprintf0(f, '%%') ; fprintf0(f, 'apply (char *STRING, int LENGTH) { (') ; DoUnbounded(sym) ; fprintf0(f, ') };\n') ; @@ -908,12 +908,12 @@ VAR BEGIN mainModule := sym ; n := GetSymName(sym) ; - fprintf0(f, '/* automatically generated by gm2 -fswig */\n') ; - fprintf0(f, '%') ; + fprintf0(f, '/* Automatically generated by gm2 -fswig. */\n') ; + fprintf0(f, '%%') ; fprintf1(f, 'module %a\n\n', n) ; - fprintf0(f, '%') ; + fprintf0(f, '%%') ; fprintf1(f, 'include exception.i\n\n', n) ; - fprintf0(f, '%') ; + fprintf0(f, '%%') ; fprintf0(f, 'exception {\n') ; fprintf0(f, ' try {\n') ; fprintf0(f, ' $action\n') ; @@ -922,9 +922,9 @@ BEGIN fprintf0(f, ' }\n') ; fprintf0(f, '}\n\n') ; ForeachItemInListDo(Done, DoCheckUnbounded) ; - fprintf0(f, '\n%{\n') ; + fprintf0(f, '\n%%{\n') ; ForeachItemInListDo(Done, DoCheckExported) ; - fprintf0(f, '%}\n\n') ; + fprintf0(f, '%%}\n\n') ; ForeachItemInListDo(Done, DoCheckExported) END DoWriteFile ; |