mirror of https://github.com/swig/swig
Handle `)` in command line interface filename
SWIG now handles an interface filename specified on the command line which contains a closing parenthesis `)`, and more generally with attributes to `%include` and `%import` which are quoted and contain parentheses. Fixes #1006
This commit is contained in:
parent
663299281e
commit
f8a766295c
|
@ -7,6 +7,12 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.1.0 (in progress)
|
Version 4.1.0 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2022-03-08: olly
|
||||||
|
#1006 SWIG now copes with an interface filename specified on the
|
||||||
|
command line which contains a closing parenthesis `)`, and more
|
||||||
|
generally with attributes to `%include` and `%import` which
|
||||||
|
are quoted and contain parentheses.
|
||||||
|
|
||||||
2022-03-07: Omar Medina
|
2022-03-07: Omar Medina
|
||||||
[Tcl] https://sourceforge.net/p/swig/bugs/1290/
|
[Tcl] https://sourceforge.net/p/swig/bugs/1290/
|
||||||
Fix SWIG_AsWCharPtrAndSize() to actually assign to result
|
Fix SWIG_AsWCharPtrAndSize() to actually assign to result
|
||||||
|
|
|
@ -6,7 +6,9 @@
|
||||||
// For Python
|
// For Python
|
||||||
%warnfilter(SWIGWARN_TYPE_UNDEFINED_CLASS) Bar; // Base class 'Foo' ignored - unknown module name for base. Either import the appropriate module interface file or specify the name of the module in the %import directive.
|
%warnfilter(SWIGWARN_TYPE_UNDEFINED_CLASS) Bar; // Base class 'Foo' ignored - unknown module name for base. Either import the appropriate module interface file or specify the name of the module in the %import directive.
|
||||||
|
|
||||||
%import "import_nomodule.h"
|
// The "dummy=" attribute is a regression test for #1006, fixed in SWIG 4.1.0.
|
||||||
|
// SWIG didn't used to take quoting into account when finding the closing `)`.
|
||||||
|
%import(dummy=")foo\"") "import_nomodule.h"
|
||||||
|
|
||||||
#if !defined(SWIGJAVA) && !defined(SWIGRUBY) && !defined(SWIGCSHARP) && !defined(SWIGD) && !defined(SWIGPYTHON_BUILTIN) && !defined(SWIGPHP)
|
#if !defined(SWIGJAVA) && !defined(SWIGRUBY) && !defined(SWIGCSHARP) && !defined(SWIGD) && !defined(SWIGPYTHON_BUILTIN) && !defined(SWIGPHP)
|
||||||
|
|
||||||
|
|
|
@ -741,14 +741,35 @@ static String *get_options(String *str) {
|
||||||
opt = NewString("(");
|
opt = NewString("(");
|
||||||
while (((c = Getc(str)) != EOF)) {
|
while (((c = Getc(str)) != EOF)) {
|
||||||
Putc(c, opt);
|
Putc(c, opt);
|
||||||
if (c == ')') {
|
switch (c) {
|
||||||
level--;
|
case ')':
|
||||||
if (!level)
|
level--;
|
||||||
return opt;
|
if (!level)
|
||||||
|
return opt;
|
||||||
|
break;
|
||||||
|
case '(':
|
||||||
|
level++;
|
||||||
|
break;
|
||||||
|
case '"':
|
||||||
|
/* Skip over quoted strings */
|
||||||
|
while (1) {
|
||||||
|
c = Getc(str);
|
||||||
|
if (c == EOF)
|
||||||
|
goto bad;
|
||||||
|
Putc(c, opt);
|
||||||
|
if (c == '"')
|
||||||
|
break;
|
||||||
|
if (c == '\\') {
|
||||||
|
c = Getc(str);
|
||||||
|
if (c == EOF)
|
||||||
|
goto bad;
|
||||||
|
Putc(c, opt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (c == '(')
|
|
||||||
level++;
|
|
||||||
}
|
}
|
||||||
|
bad:
|
||||||
Delete(opt);
|
Delete(opt);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue