]> gerrit.simantics Code Review - simantics/platform.git/blob - c.c
b626890a69daf47bd03c391ad69304b398b16168
[simantics/platform.git] / c.c
1 /*******************************************************************************
2  * Copyright (c) 2000, 2019 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *    IBM Corporation - initial API and implementation
13  *******************************************************************************/
14
15 /* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
16 /* DO NOT EDIT - your changes will be lost. */
17
18 #include "swt.h"
19 #include "c_structs.h"
20 #include "c_stats.h"
21
22 #ifndef C_NATIVE
23 #define C_NATIVE(func) Java_org_eclipse_swt_internal_C_##func
24 #endif
25
26 #ifndef NO_PTR_1sizeof
27 JNIEXPORT jint JNICALL C_NATIVE(PTR_1sizeof)
28         (JNIEnv *env, jclass that)
29 {
30         jint rc = 0;
31         C_NATIVE_ENTER(env, that, PTR_1sizeof_FUNC);
32         rc = (jint)PTR_sizeof();
33         C_NATIVE_EXIT(env, that, PTR_1sizeof_FUNC);
34         return rc;
35 }
36 #endif
37
38 #ifndef NO_free
39 JNIEXPORT void JNICALL C_NATIVE(free)
40         (JNIEnv *env, jclass that, jlong arg0)
41 {
42         C_NATIVE_ENTER(env, that, free_FUNC);
43         free((void *)arg0);
44         C_NATIVE_EXIT(env, that, free_FUNC);
45 }
46 #endif
47
48 #ifndef NO_getenv
49 JNIEXPORT jlong JNICALL C_NATIVE(getenv)
50         (JNIEnv *env, jclass that, jbyteArray arg0)
51 {
52         jbyte *lparg0=NULL;
53         jlong rc = 0;
54         C_NATIVE_ENTER(env, that, getenv_FUNC);
55         if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
56         rc = (jlong)getenv((const char *)lparg0);
57 fail:
58         if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
59         C_NATIVE_EXIT(env, that, getenv_FUNC);
60         return rc;
61 }
62 #endif
63
64 #ifndef NO_malloc
65 JNIEXPORT jlong JNICALL C_NATIVE(malloc)
66         (JNIEnv *env, jclass that, jlong arg0)
67 {
68         jlong rc = 0;
69         C_NATIVE_ENTER(env, that, malloc_FUNC);
70         rc = (jlong)malloc(arg0);
71         C_NATIVE_EXIT(env, that, malloc_FUNC);
72         return rc;
73 }
74 #endif
75
76 #ifndef NO_memmove__JJJ
77 JNIEXPORT void JNICALL C_NATIVE(memmove__JJJ)
78         (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlong arg2)
79 {
80         C_NATIVE_ENTER(env, that, memmove__JJJ_FUNC);
81         memmove((void *)arg0, (const void *)arg1, (size_t)arg2);
82         C_NATIVE_EXIT(env, that, memmove__JJJ_FUNC);
83 }
84 #endif
85
86 #ifndef NO_memmove__J_3BJ
87 JNIEXPORT void JNICALL C_NATIVE(memmove__J_3BJ)
88         (JNIEnv *env, jclass that, jlong arg0, jbyteArray arg1, jlong arg2)
89 {
90         jbyte *lparg1=NULL;
91         C_NATIVE_ENTER(env, that, memmove__J_3BJ_FUNC);
92                 if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail;
93         memmove((void *)arg0, (const void *)lparg1, (size_t)arg2);
94 fail:
95                 if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, JNI_ABORT);
96         C_NATIVE_EXIT(env, that, memmove__J_3BJ_FUNC);
97 }
98 #endif
99
100 #ifndef NO_memmove__J_3CJ
101 JNIEXPORT void JNICALL C_NATIVE(memmove__J_3CJ)
102         (JNIEnv *env, jclass that, jlong arg0, jcharArray arg1, jlong arg2)
103 {
104         jchar *lparg1=NULL;
105         C_NATIVE_ENTER(env, that, memmove__J_3CJ_FUNC);
106                 if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail;
107         memmove((void *)arg0, (const void *)lparg1, (size_t)arg2);
108 fail:
109                 if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, JNI_ABORT);
110         C_NATIVE_EXIT(env, that, memmove__J_3CJ_FUNC);
111 }
112 #endif
113
114 #ifndef NO_memmove__J_3DJ
115 JNIEXPORT void JNICALL C_NATIVE(memmove__J_3DJ)
116         (JNIEnv *env, jclass that, jlong arg0, jdoubleArray arg1, jlong arg2)
117 {
118         jdouble *lparg1=NULL;
119         C_NATIVE_ENTER(env, that, memmove__J_3DJ_FUNC);
120                 if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail;
121         memmove((void *)arg0, (const void *)lparg1, (size_t)arg2);
122 fail:
123                 if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, JNI_ABORT);
124         C_NATIVE_EXIT(env, that, memmove__J_3DJ_FUNC);
125 }
126 #endif
127
128 #ifndef NO_memmove__J_3FJ
129 JNIEXPORT void JNICALL C_NATIVE(memmove__J_3FJ)
130         (JNIEnv *env, jclass that, jlong arg0, jfloatArray arg1, jlong arg2)
131 {
132         jfloat *lparg1=NULL;
133         C_NATIVE_ENTER(env, that, memmove__J_3FJ_FUNC);
134                 if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail;
135         memmove((void *)arg0, (const void *)lparg1, (size_t)arg2);
136 fail:
137                 if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, JNI_ABORT);
138         C_NATIVE_EXIT(env, that, memmove__J_3FJ_FUNC);
139 }
140 #endif
141
142 #ifndef NO_memmove__J_3IJ
143 JNIEXPORT void JNICALL C_NATIVE(memmove__J_3IJ)
144         (JNIEnv *env, jclass that, jlong arg0, jintArray arg1, jlong arg2)
145 {
146         jint *lparg1=NULL;
147         C_NATIVE_ENTER(env, that, memmove__J_3IJ_FUNC);
148                 if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail;
149         memmove((void *)arg0, (const void *)lparg1, (size_t)arg2);
150 fail:
151                 if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, JNI_ABORT);
152         C_NATIVE_EXIT(env, that, memmove__J_3IJ_FUNC);
153 }
154 #endif
155
156 #ifndef NO_memmove__J_3JJ
157 JNIEXPORT void JNICALL C_NATIVE(memmove__J_3JJ)
158         (JNIEnv *env, jclass that, jlong arg0, jlongArray arg1, jlong arg2)
159 {
160         jlong *lparg1=NULL;
161         C_NATIVE_ENTER(env, that, memmove__J_3JJ_FUNC);
162                 if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail;
163         memmove((void *)arg0, (const void *)lparg1, (size_t)arg2);
164 fail:
165                 if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, JNI_ABORT);
166         C_NATIVE_EXIT(env, that, memmove__J_3JJ_FUNC);
167 }
168 #endif
169
170 #ifndef NO_memmove__J_3SJ
171 JNIEXPORT void JNICALL C_NATIVE(memmove__J_3SJ)
172         (JNIEnv *env, jclass that, jlong arg0, jshortArray arg1, jlong arg2)
173 {
174         jshort *lparg1=NULL;
175         C_NATIVE_ENTER(env, that, memmove__J_3SJ_FUNC);
176                 if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail;
177         memmove((void *)arg0, (const void *)lparg1, (size_t)arg2);
178 fail:
179                 if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, JNI_ABORT);
180         C_NATIVE_EXIT(env, that, memmove__J_3SJ_FUNC);
181 }
182 #endif
183
184 #ifndef NO_memmove___3BJJ
185 JNIEXPORT void JNICALL C_NATIVE(memmove___3BJJ)
186         (JNIEnv *env, jclass that, jbyteArray arg0, jlong arg1, jlong arg2)
187 {
188         jbyte *lparg0=NULL;
189         C_NATIVE_ENTER(env, that, memmove___3BJJ_FUNC);
190                 if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail;
191         memmove((void *)lparg0, (const void *)arg1, (size_t)arg2);
192 fail:
193                 if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0);
194         C_NATIVE_EXIT(env, that, memmove___3BJJ_FUNC);
195 }
196 #endif
197
198 #ifndef NO_memmove___3B_3CJ
199 JNIEXPORT void JNICALL C_NATIVE(memmove___3B_3CJ)
200         (JNIEnv *env, jclass that, jbyteArray arg0, jcharArray arg1, jlong arg2)
201 {
202         jbyte *lparg0=NULL;
203         jchar *lparg1=NULL;
204         C_NATIVE_ENTER(env, that, memmove___3B_3CJ_FUNC);
205                 if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail;
206                 if (arg1) if ((lparg1 = (*env)->GetPrimitiveArrayCritical(env, arg1, NULL)) == NULL) goto fail;
207         memmove((void *)lparg0, (const void *)lparg1, (size_t)arg2);
208 fail:
209                 if (arg1 && lparg1) (*env)->ReleasePrimitiveArrayCritical(env, arg1, lparg1, JNI_ABORT);
210                 if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0);
211         C_NATIVE_EXIT(env, that, memmove___3B_3CJ_FUNC);
212 }
213 #endif
214
215 #ifndef NO_memmove___3CJJ
216 JNIEXPORT void JNICALL C_NATIVE(memmove___3CJJ)
217         (JNIEnv *env, jclass that, jcharArray arg0, jlong arg1, jlong arg2)
218 {
219         jchar *lparg0=NULL;
220         C_NATIVE_ENTER(env, that, memmove___3CJJ_FUNC);
221                 if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail;
222         memmove((void *)lparg0, (const void *)arg1, (size_t)arg2);
223 fail:
224                 if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0);
225         C_NATIVE_EXIT(env, that, memmove___3CJJ_FUNC);
226 }
227 #endif
228
229 #ifndef NO_memmove___3DJJ
230 JNIEXPORT void JNICALL C_NATIVE(memmove___3DJJ)
231         (JNIEnv *env, jclass that, jdoubleArray arg0, jlong arg1, jlong arg2)
232 {
233         jdouble *lparg0=NULL;
234         C_NATIVE_ENTER(env, that, memmove___3DJJ_FUNC);
235                 if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail;
236         memmove((void *)lparg0, (const void *)arg1, (size_t)arg2);
237 fail:
238                 if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0);
239         C_NATIVE_EXIT(env, that, memmove___3DJJ_FUNC);
240 }
241 #endif
242
243 #ifndef NO_memmove___3FJJ
244 JNIEXPORT void JNICALL C_NATIVE(memmove___3FJJ)
245         (JNIEnv *env, jclass that, jfloatArray arg0, jlong arg1, jlong arg2)
246 {
247         jfloat *lparg0=NULL;
248         C_NATIVE_ENTER(env, that, memmove___3FJJ_FUNC);
249                 if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail;
250         memmove((void *)lparg0, (const void *)arg1, (size_t)arg2);
251 fail:
252                 if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0);
253         C_NATIVE_EXIT(env, that, memmove___3FJJ_FUNC);
254 }
255 #endif
256
257 #ifndef NO_memmove___3IJJ
258 JNIEXPORT void JNICALL C_NATIVE(memmove___3IJJ)
259         (JNIEnv *env, jclass that, jintArray arg0, jlong arg1, jlong arg2)
260 {
261         jint *lparg0=NULL;
262         C_NATIVE_ENTER(env, that, memmove___3IJJ_FUNC);
263                 if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail;
264         memmove((void *)lparg0, (const void *)arg1, (size_t)arg2);
265 fail:
266                 if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0);
267         C_NATIVE_EXIT(env, that, memmove___3IJJ_FUNC);
268 }
269 #endif
270
271 #ifndef NO_memmove___3I_3BJ
272 JNIEXPORT void JNICALL C_NATIVE(memmove___3I_3BJ)
273         (JNIEnv *env, jclass that, jintArray arg0, jbyteArray arg1, jlong arg2)
274 {
275         jint *lparg0=NULL;
276         jbyte *lparg1=NULL;
277         C_NATIVE_ENTER(env, that, memmove___3I_3BJ_FUNC);
278         if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
279                 if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail;
280         memmove((void *)lparg0, (const void *)lparg1, (size_t)arg2);
281 fail:
282                 if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0);
283         if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
284         C_NATIVE_EXIT(env, that, memmove___3I_3BJ_FUNC);
285 }
286 #endif
287
288 #ifndef NO_memmove___3JJJ
289 JNIEXPORT void JNICALL C_NATIVE(memmove___3JJJ)
290         (JNIEnv *env, jclass that, jlongArray arg0, jlong arg1, jlong arg2)
291 {
292         jlong *lparg0=NULL;
293         C_NATIVE_ENTER(env, that, memmove___3JJJ_FUNC);
294                 if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail;
295         memmove((void *)lparg0, (const void *)arg1, (size_t)arg2);
296 fail:
297                 if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0);
298         C_NATIVE_EXIT(env, that, memmove___3JJJ_FUNC);
299 }
300 #endif
301
302 #ifndef NO_memmove___3SJJ
303 JNIEXPORT void JNICALL C_NATIVE(memmove___3SJJ)
304         (JNIEnv *env, jclass that, jshortArray arg0, jlong arg1, jlong arg2)
305 {
306         jshort *lparg0=NULL;
307         C_NATIVE_ENTER(env, that, memmove___3SJJ_FUNC);
308                 if (arg0) if ((lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL)) == NULL) goto fail;
309         memmove((void *)lparg0, (const void *)arg1, (size_t)arg2);
310 fail:
311                 if (arg0 && lparg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0);
312         C_NATIVE_EXIT(env, that, memmove___3SJJ_FUNC);
313 }
314 #endif
315
316 #ifndef NO_memset
317 JNIEXPORT jlong JNICALL C_NATIVE(memset)
318         (JNIEnv *env, jclass that, jlong arg0, jint arg1, jlong arg2)
319 {
320         jlong rc = 0;
321         C_NATIVE_ENTER(env, that, memset_FUNC);
322         rc = (jlong)memset((void *)arg0, arg1, (size_t)arg2);
323         C_NATIVE_EXIT(env, that, memset_FUNC);
324         return rc;
325 }
326 #endif
327
328 #ifndef NO_setenv
329 JNIEXPORT jint JNICALL C_NATIVE(setenv)
330         (JNIEnv *env, jclass that, jbyteArray arg0, jbyteArray arg1, jint arg2)
331 {
332         jbyte *lparg0=NULL;
333         jbyte *lparg1=NULL;
334         jint rc = 0;
335         C_NATIVE_ENTER(env, that, setenv_FUNC);
336         if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
337         if (arg1) if ((lparg1 = (*env)->GetByteArrayElements(env, arg1, NULL)) == NULL) goto fail;
338         rc = (jint)setenv((const char *)lparg0, (const char *)lparg1, arg2);
339 fail:
340         if (arg1 && lparg1) (*env)->ReleaseByteArrayElements(env, arg1, lparg1, 0);
341         if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
342         C_NATIVE_EXIT(env, that, setenv_FUNC);
343         return rc;
344 }
345 #endif
346
347 #ifndef NO_strlen
348 JNIEXPORT jint JNICALL C_NATIVE(strlen)
349         (JNIEnv *env, jclass that, jlong arg0)
350 {
351         jint rc = 0;
352         C_NATIVE_ENTER(env, that, strlen_FUNC);
353         rc = (jint)strlen((char *)arg0);
354         C_NATIVE_EXIT(env, that, strlen_FUNC);
355         return rc;
356 }
357 #endif
358