Don't collapse runs of whitespace to a single space, instead replace
each whitespace with one space.
Leave the expression as-is if it contains one or more double quotes
as we don't want to change the value of string literals, and any
expression containing double quotes won't currently work in the context
where we need to replace newlines anyway.
Fixes#3127 better
We don't seem to have anything in the testsuite which exercises this
case.
There's some special handling of casts applied to string literals in the
parser which was committed as part of the fix for this, but removing it
doesn't seem to cause anything to fail (not even this testcase which
it reportedly fixed), and a wide character version seems to work without
any equivalent special handling. Maybe other things have changed since
which fixed this case without needing special cast handling. Deserves
further investigation.
Most languages now use "NullReferenceError" in the error message
where they previously used "ValueError". Also exception changes:
Guile: "swig-null-reference-error" instead of "swig-value-error"
MzScheme: "swig-null-reference-error" instead of "swig-value-error"
PHP: zend_ce_type_error instead of zend_ce_value_error
Python: Consistently raises TypeError instead of a mix of ValueError
and TypeError.
Ruby: Consistently raises NullReferenceError instead of a mix of
ArgumentError and NullReferenceErrorError.
The consistent raising of a TypeError instead of ValueError for Python
ensures that incorrectly passing 'None' into a C++ reference argument
will correctly convert the error into a NotImplemented error for
the rich comparisons implementations per PEP 207. Fixes#2987
Note that the li_constraints checking implementation for the NONNULL
typemap for pointers also makes the same error change from
SWIG_ValueError to SWIG_NullReferenceError.
The D typemaps use SWIG_DNullReferenceException instead of
SWIG_DIllegalArgumentException, although this ultimately has no change
as the same D Exception is still thrown.
Many of the target languages don't handle this currently. Those
that don't support this in their strings never will, but others
can probably be fixed.
Fixes#2996Fixes#2997
Fix wrapping of string constants containing bytes 0-8, 11, 12 or 14-31
followed by a digit '0' to '7'. We were emitting these bytes as a one
or two character octal escape sequence which when interpreted would
include the following character.
* char_binary_java_fix-tidyup:
Move SWIGStringWithLengthHelper to csharphead.swg
cdata whitespace/cosmetic fixups
cdata doc updates
Rename `typemaps/cdata_struct.swg` to `typemaps/cdata_begin.swg`. And `typemaps/cdata.swg` to `typemaps/cdata.swg`. Move `cdata_apply.swg` content to `typemaps/cdata.swg`.
Group the C# marshalling of STRING-LENGTH typemap into C# class named SWIGStringWithLengthHelper.
Leave Length & string reverse order typemap in typemaps/strings.swg
Support old C# as "LPUTF8Str" was add in 2017.
Improve documentation. Follow @wsfulton reviews.
Use a dummy for MzScheme and untested OCaml cdate. To prevent compilation error.
Further fixing follow reviews.
Reorganise raw data typemap, so typemaps folder contain only common part. Improve document.
Inline SWIG_string_to_utf8_bytes SWIG_utf8_bytes_to_string code
Fixes of STRING/BYTES LENGTH typemaps.
Conflicts:
CHANGES.current
Support parsing `sizeof(X)` for any expression or type X by skipping
balanced parentheses. We don't need to actually parse X since the type
of sizeof is always size_t.
Fixes#2919
Handle alternative operator names in C++ preprocessor expressions.
Handle full set of alternative operator names in C++ expressions
(previously only "and", "or" and "not" were understood).
Fixes#2914
instead of copy constructor when passing movable types. This was
previously implemented only for parameters passed to a global function
or static member function and is now extended to member methods.
Enhancement to e777b054d5.
Fix Java STRING LENGTH typemap.
Use string type in static typed languages (Java, C#, D and Go).
Add BYTES LENGTH typemap and apply it for binary data.
Use byte type in static typed languages.
Add li_cdata_cpp, li_cdata and char_binary
tests for most of languages(apart from R and experimental).
Fix the director_binary_string test and add it to C#, D, Go,
Perl, PHP, Python, Ruby and octave.
Update documents.
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
Fix type deduction for certain cases involving C-style casts, or
which are syntactically like a C-style cast applied to an unary
operator, such as: (7)*6
See #2796
With Perl the returned string is still being corrupted (the testcase
flags this as "TODO" for Perl's test harness).
Warnings aren't currently emitted for Perl, Ruby or Tcl as I'm not
seeing where in the UTL maze the directorout typemap actually gets
defined.
SWIG can now deduce the type of an expression including variables, and
the deduced type for unary & is now correct (it was the type of the
subexpression & was applied to).
Adjust the floating point constants to be 1.125 and 2.25 (which
can be exactly represented in base-2 floating point) instead of
1.1 and 2.2 (which can't). This avoids problems on platforms where
floating point calculations suffer from excess precision, the most
commonly used of which is x86 when using 387 FP instructions.