argcargv.i cosmetic updates

This commit is contained in:
William S Fulton 2022-05-15 18:32:53 +01:00
commit e4cdf9d98f
6 changed files with 25 additions and 32 deletions

View file

@ -1,21 +1,18 @@
/* ------------------------------------------------------------
* --- Argc & Argv ---
* ------------------------------------------------------------ */
/* ------------------------------------------------------------
* SWIG library containing argc and argv multi-argument typemaps
Use it as follow:
Use it as follows:
%apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) }
%inline %{
int mainApp(size_t argc, const char **argv)
int mainApp(size_t argc, const char **argv)
{
return argc;
}
then in the ruby side:
then from ruby:
args = ["asdf", "asdf2"]
mainApp(args);
@ -31,7 +28,7 @@
VALUE *ptr = RARRAY_PTR($input);
for (i=0; i < size; i++, ptr++) {
$2[i]= StringValuePtr(*ptr);
}
}
$2[i]=NULL;
} else {
$1 = 0; $2 = 0;