The default typemap should not be in this library file - this is for users to add in if they want C default argument support.
32 lines
826 B
OpenEdge ABL
32 lines
826 B
OpenEdge ABL
/* ------------------------------------------------------------
|
|
* --- Argc & Argv ---
|
|
* ------------------------------------------------------------ */
|
|
|
|
%typemap(in) (int ARGC, char **ARGV) {
|
|
int i;
|
|
I32 len;
|
|
AV *av = (AV *)SvRV($input);
|
|
if (SvTYPE(av) != SVt_PVAV) {
|
|
SWIG_croak("in method '$symname', Expecting reference to argv array");
|
|
goto fail;
|
|
}
|
|
len = av_len(av) + 1;
|
|
$1 = ($1_ltype) len;
|
|
$2 = (char **) malloc((len+1)*sizeof(char *));
|
|
for (i = 0; i < len; i++) {
|
|
SV **tv = av_fetch(av, i, 0);
|
|
$2[i] = SvPV_nolen(*tv);
|
|
}
|
|
$2[i] = NULL;
|
|
}
|
|
|
|
%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) {
|
|
AV *av = (AV *)SvRV($input);
|
|
$1 = SvTYPE(av) == SVt_PVAV;
|
|
}
|
|
|
|
%typemap(freearg) (int ARGC, char **ARGV) {
|
|
if ($2 != NULL) {
|
|
free((void *)$2);
|
|
}
|
|
}
|