Modified source engine (2017) developed by valve and leaked in 2020. Not for commercial purporses
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1000 B

5 years ago
%include <typemaps/valtypes.swg>
%fragment(SWIG_AsVal_frag(jstring),"header") {
SWIGINTERN int
SWIG_AsVal_dec(jstring)(Tcl_Obj * obj, jstring *val)
{
int len = 0;
const char *cstr = Tcl_GetStringFromObj(obj, &len);
if (!cstr || (strcmp(cstr,"NULL") == 0)) {
if (val) *val = 0;
return SWIG_OK;
} else {
int len = 0;
const Tcl_UniChar *ucstr = Tcl_GetUnicodeFromObj(obj,&len);
if (val) {
*val = JvNewString((const jchar*)ucstr, len);
}
}
return SWIG_NEWOBJ;
}
}
%fragment(SWIG_From_frag(jstring),"header") {
SWIGINTERNINLINE Tcl_Obj *
SWIG_From_dec(jstring)(jstring val)
{
if (!val) {
return Tcl_NewStringObj("NULL",-1);
} else {
return Tcl_NewUnicodeObj((Tcl_UniChar *)JvGetStringChars(val),JvGetStringUTFLength(val));
}
}
}
%typemaps_asvalfrom(%checkcode(STRING),
%arg(SWIG_AsVal(jstring)),
%arg(SWIG_From(jstring)),
%arg(SWIG_AsVal_frag(jstring)),
%arg(SWIG_From_frag(jstring)),
java::lang::String *);