diff --git a/CHANGES.current b/CHANGES.current index f14dc24ad..3818bdf0b 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -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) =========================== +2022-05-15: erezgeva, eiselekd + [Lua, Perl, PHP, Tcl] #2275 #2276 Add argcargv.i library containing + (int ARGC, char **ARGV) multi-argument typemaps. + + Document this library in Typemaps.html. + 2022-05-04: wsfulton [C#] Add C# wchar_t * director typemaps diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index 57ef77087..dfa9f6101 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -419,6 +419,7 @@
+The argcargv.i library is a simple library providing multi-argument typemaps for handling C +argc argv command line argument C string arrays. +The argc parameter contains the argument count and argv contains the argument vector array. +
+ ++This library provides the following multi-argument typemap: +
+ ++(int ARGC, char **ARGV) +
+ ++Apply this multi-argument typemap to your use case, for example: +
+ +
+%apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) }
+
+int mainApp(size_t argc, const char **argv);
+
++then from Ruby: +
+ ++$args = ["myarg1", "myarg2"] +mainApp(args); ++
@@ -331,7 +373,7 @@ In this example, the function int_to_uint() would be used to cast type Note: When working with simple pointers, typemaps can often be used to provide more seamless operation.
-@@ -510,7 +552,7 @@ used with types of char or char *. SWIG's default handling of these types is to handle them as character strings and the two macros do not do enough to change this.
-@@ -671,7 +713,7 @@ Now, in a script: -
diff --git a/Lib/lua/argcargv.i b/Lib/lua/argcargv.i index 376d346d8..94cc8ed42 100644 --- a/Lib/lua/argcargv.i +++ b/Lib/lua/argcargv.i @@ -9,7 +9,7 @@ then from lua: args = { "arg0", "arg1" } - mainApp(args); + mainApp(args) * ------------------------------------------------------------ */ diff --git a/Lib/ruby/argcargv.i b/Lib/ruby/argcargv.i index 330221a05..24df9c94a 100644 --- a/Lib/ruby/argcargv.i +++ b/Lib/ruby/argcargv.i @@ -7,15 +7,14 @@ %inline %{ - int mainApp(size_t argc, const char **argv) - { + int mainApp(size_t argc, const char **argv) { return argc; } then from ruby: - args = ["asdf", "asdf2"] - mainApp(args); + $args = ["asdf", "asdf2"] + mainApp(args) * ------------------------------------------------------------ */