Example #1
0
 String[] getArgNames(JNIMethod method) {
   int n_args = method.getParameters().size();
   if (n_args == 0) return new String[0];
   String name = method.getName();
   String params = "";
   int index = 0;
   while (true) {
     index = classSource.indexOf(name, index + 1);
     if (!Character.isWhitespace(classSource.charAt(index - 1))) continue;
     if (index == -1) return null;
     int parantesesStart = classSource.indexOf("(", index);
     if (classSource.substring(index + name.length(), parantesesStart).trim().length() == 0) {
       int parantesesEnd = classSource.indexOf(")", parantesesStart);
       params = classSource.substring(parantesesStart + 1, parantesesEnd);
       break;
     }
   }
   String[] names = new String[n_args];
   StringTokenizer tk = new StringTokenizer(params, ",");
   for (int i = 0; i < names.length; i++) {
     String s = tk.nextToken().trim();
     StringTokenizer tk1 = new StringTokenizer(s, " ");
     String s1 = null;
     while (tk1.hasMoreTokens()) {
       s1 = tk1.nextToken();
     }
     names[i] = s1.trim();
   }
   return names;
 }
Example #2
0
 static String getFunctionName(JNIMethod method, List<JNIType> paramTypes) {
   if ((method.getModifiers() & Modifier.NATIVE) == 0) return method.getName();
   String function = toC(method.getName());
   if (!method.isNativeUnique()) {
     StringBuffer buffer = new StringBuffer();
     buffer.append(function);
     buffer.append("__");
     for (JNIType paramType : paramTypes) {
       buffer.append(toC(paramType.getTypeSignature(false)));
     }
     return buffer.toString();
   }
   return function;
 }
Example #3
0
 static String getFunctionName(JNIMethod method) {
   return getFunctionName(method, method.getParameterTypes());
 }