A 'char *&' (a reference to a char pointer) was only marshalled as a string by
C#, D, Go, Java and PHP; every other language treated it as an opaque char **
pointer. Add char *& string typemaps to the languages that were missing them,
so a char *& function argument, return value or variable is marshalled as a
string in every target language. SWIG's const reference stripping means this
also covers char *const&.
- Lib/typemaps/strings.swg: add Char *& to the %typemaps_string in, freearg,
out, typecheck and director typemaps. This gives char *& to the languages
that use the Unified Typemap Library (Python, Ruby, Perl, Tcl, Octave, Scilab,
R and JavaScript). The shared in typemap now casts &buf to $1_ltype so that a
const char * reference hidden behind a typedef also compiles.
- Lib/lua/luatypemaps.swg, Lib/guile/typemaps.i, Lib/ocaml/ocaml.swg: these
define their own char * string typemaps; give each char *& and const char *&
in/out/freearg typemaps too.
- Lib/r/rtype.swg: the C wrapper returned the char *& string correctly but the R
proxy wrapped it as an undefined _p_p_char S4 class; add char *& to the
scoerceout char list so it is returned as a plain character value.
char_strings.i is now exercised by a runme in every target language, all testing
the same set of functions (get/set/pingpong/global variables and all four char *&
functions), giving complete char *& typemap coverage and testing.
Where a language genuinely cannot support part of the char array portion of the
test (a char[] global has no varin typemap in most scripting languages, a char[16]
parameter is bounds checked, and Guile/OCaml reject char[] parameters), that one
assertion is adapted or skipped with an inline comment; the char *& coverage is
complete everywhere.
Assisted-by: Claude Code (Opus 4.8)
The Go 'in' typemap for char * wrote the null terminator through $1, which
fails to compile as C++ when the matched type is const char *, as happens
with a typedef such as 'typedef const char *MyString'. Allocate and write
the terminator through a char * temp, assign to $1 via $1_ltype, and cast
in the freearg so a const char * buffer can still be freed. Freeing $1
(rather than the temp) keeps the freearg working when char * is remapped
with %apply SWIGTYPE[], which overrides the in typemap but not the freearg.
Add coverage to the common char_strings.i test, which is compiled for
every language, rather than a Go only test: a typedef'd const char * setter
plus a runtime assertion in each language that has a char_strings runme
(c, csharp, d, java, javascript, lua, perl5, php).
See #3290.
Assisted-by: Claude Code (Opus 4.8)
- configure.ac
- Use minimum version 5.2 for Lua
- Add lua 5.5, it was released in dec 2025
- Syntax improvements
- GHA CI
- Remove 'default' Lua version, it is confusing.
Just select the version explicitly.
- Add Lua 5.4 test, we need to test all supported versions 5.2, 5.3 and 5.4
Lua 5.5 is not available on Ubuntu yet.
- Lua documentation Doc/Manual/Lua.html
- Update version to 5.2
- Remove mention to older SWIG version,
whom wishes to go to the very old history can look on CHANGES.
- Add references on missing operators in Lua.
- _ENV exist from Lua 5.2.
- Remove old compatibility code from Lib/lua/luarun.swg.
- Remove LUA_VERSION_NUM from Lua C wrapping code.
It was used for old Lua 5.0 and Lua 5.1.
- Remove _VERSION from Lua tests.
Note: _VERSION remains a keyword and developers may use it in interface files!
- Remove Example/lua/import.lua and Examples/test-suite/lua/import.lua
as they are not used or needed any longer.
- Remove old Lua import.
- Add Examples/test-suite/lua/helpers.lua
- include it in all tests in test-suite.
- Add catch "undefined" global variables enable function.
- Add import_to_globs function.
To add module functions, variables and classes to global scope.
- Remove the -squash-bases option as it is broken
The der.new_func from the example
in the document, "29.3.18.3 Inheritance",
pass from base object to derived object
regardless of using the flag or not.
- Remove -no-old-metatable-bindings as it is deprecated in the last 12 years
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>