aboutsummaryrefslogtreecommitdiff
path: root/Lib/ruby/argcargv.i
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/ruby/argcargv.i')
-rw-r--r--Lib/ruby/argcargv.i22
1 files changed, 9 insertions, 13 deletions
diff --git a/Lib/ruby/argcargv.i b/Lib/ruby/argcargv.i
index fc0bc406a..b8efcffb7 100644
--- a/Lib/ruby/argcargv.i
+++ b/Lib/ruby/argcargv.i
@@ -1,26 +1,22 @@
-/* ------------------------------------------------------------
- * --- 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);
+ $args = ["asdf", "asdf2"]
+ mainApp(args)
- * ------------------------------------------------------------ */
+ * ------------------------------------------------------------- */
%typemap(in) (int ARGC, char **ARGV) {
if (rb_obj_is_kind_of($input,rb_cArray)) {
@@ -31,7 +27,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;