source-engine/devtools/swigwin-1.3.34/Lib/tcl/jstring.i

43 lines
1000 B
OpenEdge ABL
Raw Normal View History

2020-04-22 16:56:21 +00:00
%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 *);