From 2a8cb127ecea54f09d3a8607175ae9c5dd845537 Mon Sep 17 00:00:00 2001 From: TekuConcept Date: Thu, 9 May 2019 11:56:08 -0600 Subject: [PATCH] Add JS Native Directive Testcase --- Examples/test-suite/native_directive.i | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Examples/test-suite/native_directive.i b/Examples/test-suite/native_directive.i index d08c9a954..39b9856a0 100644 --- a/Examples/test-suite/native_directive.i +++ b/Examples/test-suite/native_directive.i @@ -41,3 +41,33 @@ extern "C" JNIEXPORT jint JNICALL Java_native_1directive_native_1directiveJNI_Co %} #endif + +#if defined(SWIG_V8_VERSION) +%{ +static SwigV8ReturnValue wrap_alpha_count(const SwigV8Arguments &args) { + SWIGV8_HANDLESCOPE(); + v8::Handle jsresult; + char *arg1 = (char *) 0 ; + int res1 ; + char *buf1 = 0 ; + int alloc1 = 0 ; + int result; + if(args.Length() != 1) SWIG_exception_fail(SWIG_ERROR, + "Illegal number of arguments for _wrap_count_characters."); + res1 = SWIG_AsCharPtrAndSize(args[0], &buf1, NULL, &alloc1); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "count_characters" + "', argument " "1"" of type '" "char const *""'"); + } + arg1 = reinterpret_cast< char * >(buf1); + result = (int)count_characters((char const *)arg1); + jsresult = SWIG_From_int(static_cast< int >(result)); + if (alloc1 == SWIG_NEWOBJ) delete[] buf1; + SWIGV8_RETURN(jsresult); +fail: + SWIGV8_RETURN(SWIGV8_UNDEFINED()); +} +%} +%native(CountAlphaCharacters) void wrap_alpha_count(); +#endif +