Commit 59e6403c authored by Brad King's avatar Brad King
Browse files

ENH: Added "signed char" type support to wrappers.

parent a9bceca4
......@@ -250,7 +250,6 @@ SET_SOURCE_FILES_PROPERTIES(
vtkOStrStreamWrapper.cxx
vtkOStreamWrapper.cxx
vtkOldStyleCallbackCommand.cxx
vtkSignedCharArray.cxx
vtkSmartPointerBase.cxx
vtkStdString.cxx
vtkTimeStamp.cxx
......
......@@ -578,6 +578,31 @@ JNIEXPORT jarray vtkJavaMakeJArrayOfIntFrom__Int64(JNIEnv *env, __int64 *ptr, in
}
#endif
JNIEXPORT jarray vtkJavaMakeJArrayOfIntFromSignedChar(JNIEnv *env, signed char *ptr, int size)
{
jintArray ret;
int i;
jint *array;
ret = env->NewIntArray(size);
if (ret == 0)
{
// should throw an exception here
return 0;
}
array = env->GetIntArrayElements(ret,NULL);
// copy the data
for (i = 0; i < size; i++)
{
array[i] = (int)ptr[i];
}
env->ReleaseIntArrayElements(ret,array,0);
return ret;
}
JNIEXPORT jarray vtkJavaMakeJArrayOfFloatFromFloat(JNIEnv *env, float *ptr, int size)
{
jfloatArray ret;
......
......@@ -48,6 +48,7 @@ extern JNIEXPORT jarray vtkJavaMakeJArrayOfIntFromLongLong(JNIEnv *env, long lon
#if defined(VTK_TYPE_USE___INT64)
extern JNIEXPORT jarray vtkJavaMakeJArrayOfIntFrom__Int64(JNIEnv *env, __int64 *arr, int size);
#endif
extern JNIEXPORT jarray vtkJavaMakeJArrayOfIntFromSignedChar(JNIEnv *env, signed char *arr, int size);
extern JNIEXPORT jarray vtkJavaMakeJArrayOfLongFromLong(JNIEnv *env, long *arr, int size);
extern JNIEXPORT jarray vtkJavaMakeJArrayOfByteFromUnsignedChar(JNIEnv *env, unsigned char *arr, int size);
extern JNIEXPORT jarray vtkJavaMakeJArrayOfByteFromChar(JNIEnv *env, char *arr, int size);
......
This diff is collapsed.
......@@ -163,6 +163,8 @@ Modify lex.yy.c:
"__int64" return(INT64__);
"signed"[\t\n\r ]*"char" return(SIGNED_CHAR);
"class" return(CLASS);
"public" return(PUBLIC);
"private" return(PRIVATE);
......
This diff is collapsed.
......@@ -163,6 +163,7 @@ char *vtkstrdup(const char *in)
%token DOUBLE
%token VOID
%token CHAR
%token SIGNED_CHAR
%token CLASS_REF
%token OTHER
%token CONST
......@@ -429,7 +430,8 @@ type_primitive:
} |
IdType { postSig("vtkIdType "); $<integer>$ = 0xA;} |
LONG_LONG { postSig("long long "); $<integer>$ = 0xB;} |
INT64__ { postSig("__int64 "); $<integer>$ = 0xC;};
INT64__ { postSig("__int64 "); $<integer>$ = 0xC;} |
SIGNED_CHAR { postSig("signed char "); $<integer>$ = 0xD;};
optional_scope: | ':' scope_list;
......
......@@ -53,6 +53,7 @@ void output_temp(FILE *fp,int i)
case 0xA: fprintf(fp,"int "); break;
case 0xB: fprintf(fp,"int "); break;
case 0xC: fprintf(fp,"int "); break;
case 0xD: fprintf(fp,"char "); break;
case 0x2: fprintf(fp,"void "); break;
case 0x3: fprintf(fp,"char "); break;
case 0x9: fprintf(fp,"%s ",currentFunction->ArgClasses[i]); break;
......@@ -95,7 +96,7 @@ void return_result(FILE *fp)
case 0x313:
fprintf(fp,"byte[] ");
break;
case 0x304: case 0x305: case 0x306: case 0x30A: case 0x30B: case 0x30C:
case 0x304: case 0x305: case 0x306: case 0x30A: case 0x30B: case 0x30C: case 0x30D:
case 0x314: case 0x315: case 0x316: case 0x31A: case 0x31B: case 0x31C:
fprintf(fp,"int[] "); break;
}
......
......@@ -53,6 +53,7 @@ void output_temp(FILE *fp,int i)
case 0xB: fprintf(fp,"int "); break;
case 0xC: fprintf(fp,"int "); break;
case 0x2: fprintf(fp,"void "); break;
case 0xD: fprintf(fp,"char "); break;
case 0x3: fprintf(fp,"char "); break;
case 0x9: fprintf(fp,"%s ",currentFunction->ArgClasses[i]); break;
case 0x8: return;
......@@ -91,7 +92,7 @@ void return_result(FILE *fp)
case 0x301: case 0x307:
fprintf(fp,"double[] ");
break;
case 0x304: case 0x305: case 0x306: case 0x30A: case 0x30B: case 0x30C:
case 0x304: case 0x305: case 0x306: case 0x30A: case 0x30B: case 0x30C: case 0x30D:
case 0x313: case 0x314: case 0x315: case 0x316: case 0x31A: case 0x31B: case 0x31C:
fprintf(fp,"int[] "); break;
}
......
......@@ -73,6 +73,7 @@ void output_proto_vars(FILE *fp, int i)
case 0xA: fprintf(fp,"jint "); break;
case 0xB: fprintf(fp,"jint "); break;
case 0xC: fprintf(fp,"jint "); break;
case 0xD: fprintf(fp,"jint "); break;
case 0x2: fprintf(fp,"void "); break;
case 0x3: fprintf(fp,"jchar "); break;
case 0x9: fprintf(fp,"jobject "); break;
......@@ -128,6 +129,10 @@ void use_hints(FILE *fp)
fprintf(fp," return vtkJavaMakeJArrayOfIntFrom__Int64(env,temp%i,%i);\n",
MAX_ARGS, currentFunction->HintSize);
break;
case 0x30D:
fprintf(fp," return vtkJavaMakeJArrayOfIntFromSignedChar(env,temp%i,%i);\n",
MAX_ARGS, currentFunction->HintSize);
break;
case 0x305: case 0x306: case 0x314: case 0x315: case 0x316:
case 0x31A: case 0x31B: case 0x31C:
break;
......@@ -142,7 +147,7 @@ void return_result(FILE *fp)
case 0x2: fprintf(fp,"void "); break;
case 0x3: fprintf(fp,"jchar "); break;
case 0x7: fprintf(fp,"jdouble "); break;
case 0x4: case 0x5: case 0x6: case 0xA: case 0xB: case 0xC:
case 0x4: case 0x5: case 0x6: case 0xA: case 0xB: case 0xC: case 0xD:
case 0x13: case 0x14: case 0x15: case 0x16: case 0x1A: case 0x1B: case 0x1C:
fprintf(fp,"jint ");
break;
......@@ -153,7 +158,7 @@ void return_result(FILE *fp)
case 0x301: case 0x307: case 0x313:
case 0x304: case 0x305: case 0x306: case 0x30A: case 0x30B: case 0x30C:
case 0x31A: case 0x31B: case 0x31C:
case 0x30D: case 0x31A: case 0x31B: case 0x31C:
fprintf(fp,"jarray "); break;
}
}
......@@ -201,6 +206,7 @@ void output_temp(FILE *fp, int i, int aType, char *Id, int aCount)
case 0xA: fprintf(fp,"vtkIdType "); break;
case 0xB: fprintf(fp,"long long "); break;
case 0xC: fprintf(fp,"__int64 "); break;
case 0xD: fprintf(fp,"signed char "); break;
case 0x9:
fprintf(fp,"%s ",Id); break;
case 0x8: return;
......@@ -283,6 +289,7 @@ void get_args(FILE *fp, int i)
case 0x30A:
case 0x30B:
case 0x30C:
case 0x30D:
fprintf(fp," tempArray%i = (void *)(env->GetIntArrayElements(id%i,NULL));\n",i,i);
for (j = 0; j < currentFunction->ArgCounts[i]; j++)
{
......@@ -328,6 +335,7 @@ void copy_and_release_args(FILE *fp, int i)
case 0x30A:
case 0x30B:
case 0x30C:
case 0x30D:
for (j = 0; j < currentFunction->ArgCounts[i]; j++)
{
fprintf(fp," ((jint *)tempArray%i)[%i] = temp%i[%i];\n",i,j,i,j);
......@@ -378,7 +386,7 @@ void do_return(FILE *fp)
/* this is done by looking them up in a hint file */
case 0x301: case 0x307: case 0x313:
case 0x304: case 0x305: case 0x306:
case 0x30A: case 0x30B: case 0x30C:
case 0x30A: case 0x30B: case 0x30C: case 0x30D:
use_hints(fp);
break;
default: fprintf(fp," return temp%i;\n", MAX_ARGS); break;
......@@ -783,7 +791,7 @@ void outputFunction(FILE *fp, FileInfo *data)
{
case 0x301: case 0x302: case 0x307:
case 0x304: case 0x305: case 0x306:
case 0x30A: case 0x30B: case 0x30C:
case 0x30A: case 0x30B: case 0x30C: case 0x30D:
case 0x313:
args_ok = currentFunction->HaveHint;
break;
......
......@@ -147,6 +147,7 @@ void output_temp(FILE *fp, int i, int aType, char *Id, int aCount)
case 0xA: fprintf(fp,"vtkIdType "); break;
case 0xB: fprintf(fp,"long long "); break;
case 0xC: fprintf(fp,"__int64 "); break;
case 0xD: fprintf(fp,"signed char "); break;
case 0x8: return;
}
......@@ -217,7 +218,7 @@ void do_return(FILE *fp)
/* handle functions returning vectors */
/* this is done by looking them up in a hint file */
case 0x301: case 0x307: case 0x30A: case 0x30B: case 0x30C:
case 0x301: case 0x307: case 0x30A: case 0x30B: case 0x30C: case 0x30D:
case 0x304: case 0x305: case 0x306:
use_hints(fp);
break;
......@@ -244,6 +245,7 @@ void do_return(FILE *fp)
case 0x4:
case 0x5:
case 0x6:
case 0xD:
{
fprintf(fp," return PyInt_FromLong(temp%i);\n", MAX_ARGS);
break;
......@@ -455,6 +457,7 @@ char *get_format_string()
case 0xB: case 0xC:
result[currPos] = 'l'; currPos++; break;
#endif
case 0xD: result[currPos] = 'i'; currPos++; break;
case 0x3: result[currPos] = 'c'; currPos++; break;
case 0x13: result[currPos] = 'b'; currPos++; break;
}
......@@ -559,6 +562,7 @@ void get_python_signature()
case 0x303: add_to_sig(result,"string",&currPos); break;
case 0x1:
case 0x7: add_to_sig(result,"float",&currPos); break;
case 0xD:
case 0xA:
case 0x1B:
case 0xB:
......@@ -648,6 +652,7 @@ void get_python_signature()
case 0xA:
case 0xB:
case 0xC:
case 0xD:
case 0x1B:
case 0x1C:
case 0x13:
......@@ -1175,7 +1180,7 @@ void outputFunction(FILE *fp, FileInfo *data)
/* if we need a return type hint make sure we have one */
switch (currentFunction->ReturnType % 0x1000)
{
case 0x301: case 0x307: case 0x30A: case 0x30B: case 0x30C:
case 0x301: case 0x307: case 0x30A: case 0x30B: case 0x30C: case 0x30D:
case 0x304: case 0x305: case 0x306:
args_ok = currentFunction->HaveHint;
break;
......
......@@ -66,6 +66,7 @@ void output_temp(FILE *fp, int i, int aType, char *Id, int count)
case 0xA: fprintf(fp,"vtkIdType "); break;
case 0xB: fprintf(fp,"long long "); break;
case 0xC: fprintf(fp,"__int64 "); break;
case 0xD: fprintf(fp,"signed char "); break;
case 0x8: return;
}
......@@ -114,7 +115,7 @@ void use_hints(FILE *fp)
fprintf(fp,");\n");
fprintf(fp," Tcl_SetResult(interp, tempResult, TCL_VOLATILE);\n");
break;
case 0x304: case 0x305:
case 0x304: case 0x305: case 0x30D:
#ifndef VTK_USE_64BIT_IDS
case 0x30A:
#endif
......@@ -415,7 +416,7 @@ void return_result(FILE *fp)
/* handle functions returning vectors */
/* this is done by looking them up in a hint file */
case 0x301: case 0x307:
case 0x304: case 0x305: case 0x306: case 0x30A: case 0x30B: case 0x30C:
case 0x304: case 0x305: case 0x306: case 0x30A: case 0x30B: case 0x30C: case 0x30D:
case 0x313: case 0x314: case 0x315: case 0x316: case 0x31A: case 0x31B: case 0x31C:
use_hints(fp);
break;
......@@ -460,7 +461,7 @@ void get_args(FILE *fp, int i)
start_arg);
fprintf(fp," temp%i = tempd;\n",i);
break;
case 0x4: case 0x5: case 0x6: case 0xA: case 0xB: case 0xC:
case 0x4: case 0x5: case 0x6: case 0xA: case 0xB: case 0xC: case 0xD:
fprintf(fp," if (Tcl_GetInt(interp,argv[%i],&tempi) != TCL_OK) error = 1;\n",
start_arg);
fprintf(fp," temp%i = tempi;\n",i);
......@@ -512,7 +513,7 @@ void get_args(FILE *fp, int i)
start_arg);
fprintf(fp," temp%i[%i] = tempd;\n",i,j);
break;
case 0x4: case 0x5: case 0x6: case 0xA: case 0xB: case 0xC:
case 0x4: case 0x5: case 0x6: case 0xA: case 0xB: case 0xC: case 0xD:
fprintf(fp," if (Tcl_GetInt(interp,argv[%i],&tempi) != TCL_OK) error = 1;\n",
start_arg);
fprintf(fp," temp%i[%i] = tempi;\n",i,j);
......@@ -603,7 +604,7 @@ void outputFunction(FILE *fp, FileInfo *data)
switch (currentFunction->ReturnType % 0x1000)
{
case 0x301: case 0x307:
case 0x304: case 0x305: case 0x306: case 0x30A: case 0x30B: case 0x30C:
case 0x304: case 0x305: case 0x306: case 0x30A: case 0x30B: case 0x30C: case 0x30D:
case 0x313: case 0x314: case 0x315: case 0x316: case 0x31A: case 0x31B: case 0x31C:
args_ok = currentFunction->HaveHint;
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment