1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include <jni.h> 18 #include <stdlib.h> // for abort 19 20 extern "C" jobject Java_dalvik_system_JniTest_returnThis(JNIEnv*, jobject obj) { 21 return obj; 22 } 23 24 extern "C" jclass Java_dalvik_system_JniTest_returnClass(JNIEnv*, jclass klass) { 25 return klass; 26 } 27 28 extern "C" jobject Java_dalvik_system_JniTest_returnObjectArgFrom16( 29 JNIEnv*, jobject, int arg_no, 30 jobject o1, jobject o2, jobject o3, jobject o4, jobject o5, 31 jobject o6, jobject o7, jobject o8, jobject o9, jobject o10, 32 jobject o11, jobject o12, jobject o13, jobject o14, jobject o15, 33 jobject o16) { 34 switch(arg_no){ 35 case 0: return o1; 36 case 1: return o2; 37 case 2: return o3; 38 case 3: return o4; 39 case 4: return o5; 40 case 5: return o6; 41 case 6: return o7; 42 case 7: return o8; 43 case 8: return o9; 44 case 9: return o10; 45 case 10: return o11; 46 case 11: return o12; 47 case 12: return o13; 48 case 13: return o14; 49 case 14: return o15; 50 case 15: return o16; 51 default: abort(); 52 } 53 } 54 55 extern "C" jboolean Java_dalvik_system_JniTest_returnBooleanArgFrom16( 56 JNIEnv*, jobject, int arg_no, 57 jboolean o1, jboolean o2, jboolean o3, jboolean o4, jboolean o5, 58 jboolean o6, jboolean o7, jboolean o8, jboolean o9, jboolean o10, 59 jboolean o11, jboolean o12, jboolean o13, jboolean o14, jboolean o15, 60 jboolean o16) { 61 switch(arg_no){ 62 case 0: return o1; 63 case 1: return o2; 64 case 2: return o3; 65 case 3: return o4; 66 case 4: return o5; 67 case 5: return o6; 68 case 6: return o7; 69 case 7: return o8; 70 case 8: return o9; 71 case 9: return o10; 72 case 10: return o11; 73 case 11: return o12; 74 case 12: return o13; 75 case 13: return o14; 76 case 14: return o15; 77 case 15: return o16; 78 default: abort(); 79 } 80 } 81 82 extern "C" jchar Java_dalvik_system_JniTest_returnCharArgFrom16( 83 JNIEnv*, jobject, int arg_no, 84 jchar o1, jchar o2, jchar o3, jchar o4, jchar o5, 85 jchar o6, jchar o7, jchar o8, jchar o9, jchar o10, 86 jchar o11, jchar o12, jchar o13, jchar o14, jchar o15, 87 jchar o16) { 88 switch(arg_no){ 89 case 0: return o1; 90 case 1: return o2; 91 case 2: return o3; 92 case 3: return o4; 93 case 4: return o5; 94 case 5: return o6; 95 case 6: return o7; 96 case 7: return o8; 97 case 8: return o9; 98 case 9: return o10; 99 case 10: return o11; 100 case 11: return o12; 101 case 12: return o13; 102 case 13: return o14; 103 case 14: return o15; 104 case 15: return o16; 105 default: abort(); 106 } 107 } 108 109 extern "C" jbyte Java_dalvik_system_JniTest_returnByteArgFrom16( 110 JNIEnv*, jobject, int arg_no, 111 jbyte o1, jbyte o2, jbyte o3, jbyte o4, jbyte o5, 112 jbyte o6, jbyte o7, jbyte o8, jbyte o9, jbyte o10, 113 jbyte o11, jbyte o12, jbyte o13, jbyte o14, jbyte o15, 114 jbyte o16) { 115 switch(arg_no){ 116 case 0: return o1; 117 case 1: return o2; 118 case 2: return o3; 119 case 3: return o4; 120 case 4: return o5; 121 case 5: return o6; 122 case 6: return o7; 123 case 7: return o8; 124 case 8: return o9; 125 case 9: return o10; 126 case 10: return o11; 127 case 11: return o12; 128 case 12: return o13; 129 case 13: return o14; 130 case 14: return o15; 131 case 15: return o16; 132 default: abort(); 133 } 134 } 135 136 extern "C" jshort Java_dalvik_system_JniTest_returnShortArgFrom16( 137 JNIEnv*, jobject, int arg_no, 138 jshort o1, jshort o2, jshort o3, jshort o4, jshort o5, 139 jshort o6, jshort o7, jshort o8, jshort o9, jshort o10, 140 jshort o11, jshort o12, jshort o13, jshort o14, jshort o15, 141 jshort o16) { 142 switch(arg_no){ 143 case 0: return o1; 144 case 1: return o2; 145 case 2: return o3; 146 case 3: return o4; 147 case 4: return o5; 148 case 5: return o6; 149 case 6: return o7; 150 case 7: return o8; 151 case 8: return o9; 152 case 9: return o10; 153 case 10: return o11; 154 case 11: return o12; 155 case 12: return o13; 156 case 13: return o14; 157 case 14: return o15; 158 case 15: return o16; 159 default: abort(); 160 } 161 } 162 163 extern "C" jint Java_dalvik_system_JniTest_returnIntArgFrom16( 164 JNIEnv*, jobject, int arg_no, 165 jint o1, jint o2, jint o3, jint o4, jint o5, 166 jint o6, jint o7, jint o8, jint o9, jint o10, 167 jint o11, jint o12, jint o13, jint o14, jint o15, 168 jint o16) { 169 switch(arg_no){ 170 case 0: return o1; 171 case 1: return o2; 172 case 2: return o3; 173 case 3: return o4; 174 case 4: return o5; 175 case 5: return o6; 176 case 6: return o7; 177 case 7: return o8; 178 case 8: return o9; 179 case 9: return o10; 180 case 10: return o11; 181 case 11: return o12; 182 case 12: return o13; 183 case 13: return o14; 184 case 14: return o15; 185 case 15: return o16; 186 default: abort(); 187 } 188 } 189 190 extern "C" jlong Java_dalvik_system_JniTest_returnLongArgFrom16( 191 JNIEnv*, jobject, int arg_no, 192 jlong o1, jlong o2, jlong o3, jlong o4, jlong o5, 193 jlong o6, jlong o7, jlong o8, jlong o9, jlong o10, 194 jlong o11, jlong o12, jlong o13, jlong o14, jlong o15, 195 jlong o16) { 196 switch(arg_no){ 197 case 0: return o1; 198 case 1: return o2; 199 case 2: return o3; 200 case 3: return o4; 201 case 4: return o5; 202 case 5: return o6; 203 case 6: return o7; 204 case 7: return o8; 205 case 8: return o9; 206 case 9: return o10; 207 case 10: return o11; 208 case 11: return o12; 209 case 12: return o13; 210 case 13: return o14; 211 case 14: return o15; 212 case 15: return o16; 213 default: abort(); 214 } 215 } 216 217 extern "C" jfloat Java_dalvik_system_JniTest_returnFloatArgFrom16( 218 JNIEnv*, jobject, int arg_no, 219 jfloat o1, jfloat o2, jfloat o3, jfloat o4, jfloat o5, 220 jfloat o6, jfloat o7, jfloat o8, jfloat o9, jfloat o10, 221 jfloat o11, jfloat o12, jfloat o13, jfloat o14, jfloat o15, 222 jfloat o16) { 223 switch(arg_no){ 224 case 0: return o1; 225 case 1: return o2; 226 case 2: return o3; 227 case 3: return o4; 228 case 4: return o5; 229 case 5: return o6; 230 case 6: return o7; 231 case 7: return o8; 232 case 8: return o9; 233 case 9: return o10; 234 case 10: return o11; 235 case 11: return o12; 236 case 12: return o13; 237 case 13: return o14; 238 case 14: return o15; 239 case 15: return o16; 240 default: abort(); 241 } 242 } 243 244 extern "C" jdouble Java_dalvik_system_JniTest_returnDoubleArgFrom16( 245 JNIEnv*, jobject, int arg_no, 246 jdouble o1, jdouble o2, jdouble o3, jdouble o4, jdouble o5, 247 jdouble o6, jdouble o7, jdouble o8, jdouble o9, jdouble o10, 248 jdouble o11, jdouble o12, jdouble o13, jdouble o14, jdouble o15, 249 jdouble o16) { 250 switch(arg_no){ 251 case 0: return o1; 252 case 1: return o2; 253 case 2: return o3; 254 case 3: return o4; 255 case 4: return o5; 256 case 5: return o6; 257 case 6: return o7; 258 case 7: return o8; 259 case 8: return o9; 260 case 9: return o10; 261 case 10: return o11; 262 case 11: return o12; 263 case 12: return o13; 264 case 13: return o14; 265 case 14: return o15; 266 case 15: return o16; 267 default: abort(); 268 } 269 } 270 271 extern "C" jclass Java_dalvik_system_JniTest_envGetSuperclass( 272 JNIEnv* env, jobject, jclass clazz) { 273 return env->GetSuperclass(clazz); 274 } 275