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.
 
 
 
 
 
 

44 lines
952 B

%include <typemaps/valtypes.swg>
%fragment(SWIG_AsVal_frag(jstring),"header") {
SWIGINTERN int
SWIG_AsVal(jstring)(VALUE obj, jstring *val)
{
if (NIL_P(obj)){
if (val) *val = 0;
return SWIG_OK;
}
if (TYPE(obj) == T_STRING) {
if (val) {
char *cstr = rb_string_value_ptr(&(obj));
jsize len = RSTRING_LEN(obj);
*val = JvNewStringLatin1(cstr, len);
}
return SWIG_NEWOBJ;
}
return SWIG_TypeError;
}
}
%fragment(SWIG_From_frag(jstring),"header") {
SWIGINTERNINLINE VALUE
SWIG_From(jstring)(jstring val)
{
if (!val) {
return Qnil;
} else {
jint len = JvGetStringUTFLength(val);
char buf[len];
JvGetStringUTFRegion(val, 0, len, buf);
return rb_str_new(buf,len);
}
}
}
%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 *);