typeArrayOop oopFactory::new_charArray(const char* utf8_str, TRAPS) { int length = utf8_str == NULL ? 0 : UTF8::unicode_length(utf8_str); typeArrayOop result = new_charArray(length, CHECK_NULL); if (length > 0) { UTF8::convert_to_unicode(utf8_str, result->char_at_addr(0), length); } return result; }
SWIGEXPORT jstring JNICALL Java_faust_1dsp_faust_1dspJNI_new_1charArray(JNIEnv *jenv, jclass jcls, jint jarg1) { jstring jresult = 0 ; int arg1 ; char *result = 0 ; (void)jenv; (void)jcls; arg1 = (int)jarg1; result = (char *)new_charArray(arg1); if (result) jresult = jenv->NewStringUTF((const char *)result); return jresult; }
// initialize type testStruct void initTestStruct ( testStruct* obj ) { unsigned j; unsigned size = 3; // scalar obj -> Double = 3.14159265358979323844; obj -> Float = 2.71828182845904523536; obj -> Int = 123456; obj -> Long = 756789123; obj -> Short = 16000; obj -> Unsigned = 126; obj -> Char = 'X'; obj -> Bool = true; obj -> Stringg = "Hello World!"; obj -> DoubleComplex = 5 + 4*I; obj -> FloatComplex = 10 - 3*I; // array obj -> DoubleArray = new_doubleArray ( size ); for ( j = 0; j < size; ++j ) obj -> DoubleArray -> elem [j] = j; obj -> FloatArray = new_floatArray ( size ); for ( j = 0; j < size; ++j ) obj -> FloatArray -> elem [j] = j; obj -> IntArray = new_intArray ( size ); for ( j = 0; j < size; ++j ) obj -> IntArray -> elem [j] = j; obj -> LongArray = new_longArray ( size ); for ( j = 0; j < size; ++j ) obj -> LongArray -> elem [j] = j; obj -> ShortArray = new_shortArray ( size ); for ( j = 0; j < size; ++j ) obj -> ShortArray -> elem [j] = j; obj -> UnsignedArray = new_unsignedArray ( size ); for ( j = 0; j < size; ++j ) obj -> UnsignedArray -> elem [j] = j; obj -> CharArray = new_charArray ( size ); for ( j = 0; j < size; ++j ) obj -> CharArray -> elem [j] = 'A' + j; obj -> BoolArray = new_boolArray ( size ); for ( j = 0; j < size; ++j ) obj -> BoolArray -> elem [j] = j % 2; obj -> StringArray = new_CstringRefArray ( size ); obj -> StringArray -> elem [0] = "Array"; obj -> StringArray -> elem [1] = "of"; obj -> StringArray -> elem [2] = "Cstring"; obj -> DoubleComplexArray = new_doubleComplexArray ( size ); for ( j = 0; j < size; ++j ) { obj -> DoubleComplexArray -> elem [j] = j + I * j; } obj -> FloatComplexArray = new_floatComplexArray ( size ); for ( j = 0; j < size; ++j ) { obj -> FloatComplexArray -> elem [j] = j + I * j; } }