Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 7f3619598bcb73f6cd008e89e52dc780636b6002 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
/*******************************************************************************
 * Copyright (c) 2000, 2019 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *    IBM Corporation - initial API and implementation
 *******************************************************************************/

/* Note: This file was auto-generated by org.eclipse.swt.tools.internal.JNIGenerator */
/* DO NOT EDIT - your changes will be lost. */

#include "swt.h"
#include "os_structs.h"

#ifndef NO_CFRange
typedef struct CFRange_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID location, length;
} CFRange_FID_CACHE;

CFRange_FID_CACHE CFRangeFc;

void cacheCFRangeFields(JNIEnv *env, jobject lpObject)
{
	if (CFRangeFc.cached) return;
	CFRangeFc.clazz = (*env)->GetObjectClass(env, lpObject);
	CFRangeFc.location = (*env)->GetFieldID(env, CFRangeFc.clazz, "location", "J");
	CFRangeFc.length = (*env)->GetFieldID(env, CFRangeFc.clazz, "length", "J");
	CFRangeFc.cached = 1;
}

CFRange *getCFRangeFields(JNIEnv *env, jobject lpObject, CFRange *lpStruct)
{
	if (!CFRangeFc.cached) cacheCFRangeFields(env, lpObject);
	lpStruct->location = (CFIndex)(*env)->GetLongField(env, lpObject, CFRangeFc.location);
	lpStruct->length = (CFIndex)(*env)->GetLongField(env, lpObject, CFRangeFc.length);
	return lpStruct;
}

void setCFRangeFields(JNIEnv *env, jobject lpObject, CFRange *lpStruct)
{
	if (!CFRangeFc.cached) cacheCFRangeFields(env, lpObject);
	(*env)->SetLongField(env, lpObject, CFRangeFc.location, (jlong)lpStruct->location);
	(*env)->SetLongField(env, lpObject, CFRangeFc.length, (jlong)lpStruct->length);
}
#endif

#ifndef NO_CGAffineTransform
typedef struct CGAffineTransform_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID a, b, c, d, tx, ty;
} CGAffineTransform_FID_CACHE;

CGAffineTransform_FID_CACHE CGAffineTransformFc;

void cacheCGAffineTransformFields(JNIEnv *env, jobject lpObject)
{
	if (CGAffineTransformFc.cached) return;
	CGAffineTransformFc.clazz = (*env)->GetObjectClass(env, lpObject);
	CGAffineTransformFc.a = (*env)->GetFieldID(env, CGAffineTransformFc.clazz, "a", "D");
	CGAffineTransformFc.b = (*env)->GetFieldID(env, CGAffineTransformFc.clazz, "b", "D");
	CGAffineTransformFc.c = (*env)->GetFieldID(env, CGAffineTransformFc.clazz, "c", "D");
	CGAffineTransformFc.d = (*env)->GetFieldID(env, CGAffineTransformFc.clazz, "d", "D");
	CGAffineTransformFc.tx = (*env)->GetFieldID(env, CGAffineTransformFc.clazz, "tx", "D");
	CGAffineTransformFc.ty = (*env)->GetFieldID(env, CGAffineTransformFc.clazz, "ty", "D");
	CGAffineTransformFc.cached = 1;
}

CGAffineTransform *getCGAffineTransformFields(JNIEnv *env, jobject lpObject, CGAffineTransform *lpStruct)
{
	if (!CGAffineTransformFc.cached) cacheCGAffineTransformFields(env, lpObject);
	lpStruct->a = (CGFloat)(*env)->GetDoubleField(env, lpObject, CGAffineTransformFc.a);
	lpStruct->b = (CGFloat)(*env)->GetDoubleField(env, lpObject, CGAffineTransformFc.b);
	lpStruct->c = (CGFloat)(*env)->GetDoubleField(env, lpObject, CGAffineTransformFc.c);
	lpStruct->d = (CGFloat)(*env)->GetDoubleField(env, lpObject, CGAffineTransformFc.d);
	lpStruct->tx = (CGFloat)(*env)->GetDoubleField(env, lpObject, CGAffineTransformFc.tx);
	lpStruct->ty = (CGFloat)(*env)->GetDoubleField(env, lpObject, CGAffineTransformFc.ty);
	return lpStruct;
}

void setCGAffineTransformFields(JNIEnv *env, jobject lpObject, CGAffineTransform *lpStruct)
{
	if (!CGAffineTransformFc.cached) cacheCGAffineTransformFields(env, lpObject);
	(*env)->SetDoubleField(env, lpObject, CGAffineTransformFc.a, (jdouble)lpStruct->a);
	(*env)->SetDoubleField(env, lpObject, CGAffineTransformFc.b, (jdouble)lpStruct->b);
	(*env)->SetDoubleField(env, lpObject, CGAffineTransformFc.c, (jdouble)lpStruct->c);
	(*env)->SetDoubleField(env, lpObject, CGAffineTransformFc.d, (jdouble)lpStruct->d);
	(*env)->SetDoubleField(env, lpObject, CGAffineTransformFc.tx, (jdouble)lpStruct->tx);
	(*env)->SetDoubleField(env, lpObject, CGAffineTransformFc.ty, (jdouble)lpStruct->ty);
}
#endif

#ifndef NO_CGPathElement
typedef struct CGPathElement_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID type, points;
} CGPathElement_FID_CACHE;

CGPathElement_FID_CACHE CGPathElementFc;

void cacheCGPathElementFields(JNIEnv *env, jobject lpObject)
{
	if (CGPathElementFc.cached) return;
	CGPathElementFc.clazz = (*env)->GetObjectClass(env, lpObject);
	CGPathElementFc.type = (*env)->GetFieldID(env, CGPathElementFc.clazz, "type", "I");
	CGPathElementFc.points = (*env)->GetFieldID(env, CGPathElementFc.clazz, "points", "J");
	CGPathElementFc.cached = 1;
}

CGPathElement *getCGPathElementFields(JNIEnv *env, jobject lpObject, CGPathElement *lpStruct)
{
	if (!CGPathElementFc.cached) cacheCGPathElementFields(env, lpObject);
	lpStruct->type = (CGPathElementType)(*env)->GetIntField(env, lpObject, CGPathElementFc.type);
	lpStruct->points = (CGPoint*)(*env)->GetLongField(env, lpObject, CGPathElementFc.points);
	return lpStruct;
}

void setCGPathElementFields(JNIEnv *env, jobject lpObject, CGPathElement *lpStruct)
{
	if (!CGPathElementFc.cached) cacheCGPathElementFields(env, lpObject);
	(*env)->SetIntField(env, lpObject, CGPathElementFc.type, (jint)lpStruct->type);
	(*env)->SetLongField(env, lpObject, CGPathElementFc.points, (jlong)lpStruct->points);
}
#endif

#ifndef NO_CGPoint
typedef struct CGPoint_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID x, y;
} CGPoint_FID_CACHE;

CGPoint_FID_CACHE CGPointFc;

void cacheCGPointFields(JNIEnv *env, jobject lpObject)
{
	if (CGPointFc.cached) return;
	CGPointFc.clazz = (*env)->GetObjectClass(env, lpObject);
	CGPointFc.x = (*env)->GetFieldID(env, CGPointFc.clazz, "x", "D");
	CGPointFc.y = (*env)->GetFieldID(env, CGPointFc.clazz, "y", "D");
	CGPointFc.cached = 1;
}

CGPoint *getCGPointFields(JNIEnv *env, jobject lpObject, CGPoint *lpStruct)
{
	if (!CGPointFc.cached) cacheCGPointFields(env, lpObject);
	lpStruct->x = (CGFloat)(*env)->GetDoubleField(env, lpObject, CGPointFc.x);
	lpStruct->y = (CGFloat)(*env)->GetDoubleField(env, lpObject, CGPointFc.y);
	return lpStruct;
}

void setCGPointFields(JNIEnv *env, jobject lpObject, CGPoint *lpStruct)
{
	if (!CGPointFc.cached) cacheCGPointFields(env, lpObject);
	(*env)->SetDoubleField(env, lpObject, CGPointFc.x, (jdouble)lpStruct->x);
	(*env)->SetDoubleField(env, lpObject, CGPointFc.y, (jdouble)lpStruct->y);
}
#endif

#ifndef NO_CGRect
typedef struct CGRect_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID origin, size;
} CGRect_FID_CACHE;

CGRect_FID_CACHE CGRectFc;

void cacheCGRectFields(JNIEnv *env, jobject lpObject)
{
	if (CGRectFc.cached) return;
	CGRectFc.clazz = (*env)->GetObjectClass(env, lpObject);
	CGRectFc.origin = (*env)->GetFieldID(env, CGRectFc.clazz, "origin", "Lorg/eclipse/swt/internal/cocoa/CGPoint;");
	CGRectFc.size = (*env)->GetFieldID(env, CGRectFc.clazz, "size", "Lorg/eclipse/swt/internal/cocoa/CGSize;");
	CGRectFc.cached = 1;
}

CGRect *getCGRectFields(JNIEnv *env, jobject lpObject, CGRect *lpStruct)
{
	if (!CGRectFc.cached) cacheCGRectFields(env, lpObject);
	{
	jobject lpObject1 = (*env)->GetObjectField(env, lpObject, CGRectFc.origin);
	if (lpObject1 != NULL) getCGPointFields(env, lpObject1, &lpStruct->origin);
	}
	{
	jobject lpObject1 = (*env)->GetObjectField(env, lpObject, CGRectFc.size);
	if (lpObject1 != NULL) getCGSizeFields(env, lpObject1, &lpStruct->size);
	}
	return lpStruct;
}

void setCGRectFields(JNIEnv *env, jobject lpObject, CGRect *lpStruct)
{
	if (!CGRectFc.cached) cacheCGRectFields(env, lpObject);
	{
	jobject lpObject1 = (*env)->GetObjectField(env, lpObject, CGRectFc.origin);
	if (lpObject1 != NULL) setCGPointFields(env, lpObject1, &lpStruct->origin);
	}
	{
	jobject lpObject1 = (*env)->GetObjectField(env, lpObject, CGRectFc.size);
	if (lpObject1 != NULL) setCGSizeFields(env, lpObject1, &lpStruct->size);
	}
}
#endif

#ifndef NO_CGSize
typedef struct CGSize_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID width, height;
} CGSize_FID_CACHE;

CGSize_FID_CACHE CGSizeFc;

void cacheCGSizeFields(JNIEnv *env, jobject lpObject)
{
	if (CGSizeFc.cached) return;
	CGSizeFc.clazz = (*env)->GetObjectClass(env, lpObject);
	CGSizeFc.width = (*env)->GetFieldID(env, CGSizeFc.clazz, "width", "D");
	CGSizeFc.height = (*env)->GetFieldID(env, CGSizeFc.clazz, "height", "D");
	CGSizeFc.cached = 1;
}

CGSize *getCGSizeFields(JNIEnv *env, jobject lpObject, CGSize *lpStruct)
{
	if (!CGSizeFc.cached) cacheCGSizeFields(env, lpObject);
	lpStruct->width = (CGFloat)(*env)->GetDoubleField(env, lpObject, CGSizeFc.width);
	lpStruct->height = (CGFloat)(*env)->GetDoubleField(env, lpObject, CGSizeFc.height);
	return lpStruct;
}

void setCGSizeFields(JNIEnv *env, jobject lpObject, CGSize *lpStruct)
{
	if (!CGSizeFc.cached) cacheCGSizeFields(env, lpObject);
	(*env)->SetDoubleField(env, lpObject, CGSizeFc.width, (jdouble)lpStruct->width);
	(*env)->SetDoubleField(env, lpObject, CGSizeFc.height, (jdouble)lpStruct->height);
}
#endif

#ifndef NO_CTParagraphStyleSetting
typedef struct CTParagraphStyleSetting_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID spec, valueSize, value;
} CTParagraphStyleSetting_FID_CACHE;

CTParagraphStyleSetting_FID_CACHE CTParagraphStyleSettingFc;

void cacheCTParagraphStyleSettingFields(JNIEnv *env, jobject lpObject)
{
	if (CTParagraphStyleSettingFc.cached) return;
	CTParagraphStyleSettingFc.clazz = (*env)->GetObjectClass(env, lpObject);
	CTParagraphStyleSettingFc.spec = (*env)->GetFieldID(env, CTParagraphStyleSettingFc.clazz, "spec", "I");
	CTParagraphStyleSettingFc.valueSize = (*env)->GetFieldID(env, CTParagraphStyleSettingFc.clazz, "valueSize", "J");
	CTParagraphStyleSettingFc.value = (*env)->GetFieldID(env, CTParagraphStyleSettingFc.clazz, "value", "J");
	CTParagraphStyleSettingFc.cached = 1;
}

CTParagraphStyleSetting *getCTParagraphStyleSettingFields(JNIEnv *env, jobject lpObject, CTParagraphStyleSetting *lpStruct)
{
	if (!CTParagraphStyleSettingFc.cached) cacheCTParagraphStyleSettingFields(env, lpObject);
	lpStruct->spec = (CTParagraphStyleSpecifier)(*env)->GetIntField(env, lpObject, CTParagraphStyleSettingFc.spec);
	lpStruct->valueSize = (size_t)(*env)->GetLongField(env, lpObject, CTParagraphStyleSettingFc.valueSize);
	lpStruct->value = (void*)(*env)->GetLongField(env, lpObject, CTParagraphStyleSettingFc.value);
	return lpStruct;
}

void setCTParagraphStyleSettingFields(JNIEnv *env, jobject lpObject, CTParagraphStyleSetting *lpStruct)
{
	if (!CTParagraphStyleSettingFc.cached) cacheCTParagraphStyleSettingFields(env, lpObject);
	(*env)->SetIntField(env, lpObject, CTParagraphStyleSettingFc.spec, (jint)lpStruct->spec);
	(*env)->SetLongField(env, lpObject, CTParagraphStyleSettingFc.valueSize, (jlong)lpStruct->valueSize);
	(*env)->SetLongField(env, lpObject, CTParagraphStyleSettingFc.value, (jlong)lpStruct->value);
}
#endif

#ifndef NO_NSAffineTransformStruct
typedef struct NSAffineTransformStruct_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID m11, m12, m21, m22, tX, tY;
} NSAffineTransformStruct_FID_CACHE;

NSAffineTransformStruct_FID_CACHE NSAffineTransformStructFc;

void cacheNSAffineTransformStructFields(JNIEnv *env, jobject lpObject)
{
	if (NSAffineTransformStructFc.cached) return;
	NSAffineTransformStructFc.clazz = (*env)->GetObjectClass(env, lpObject);
	NSAffineTransformStructFc.m11 = (*env)->GetFieldID(env, NSAffineTransformStructFc.clazz, "m11", "D");
	NSAffineTransformStructFc.m12 = (*env)->GetFieldID(env, NSAffineTransformStructFc.clazz, "m12", "D");
	NSAffineTransformStructFc.m21 = (*env)->GetFieldID(env, NSAffineTransformStructFc.clazz, "m21", "D");
	NSAffineTransformStructFc.m22 = (*env)->GetFieldID(env, NSAffineTransformStructFc.clazz, "m22", "D");
	NSAffineTransformStructFc.tX = (*env)->GetFieldID(env, NSAffineTransformStructFc.clazz, "tX", "D");
	NSAffineTransformStructFc.tY = (*env)->GetFieldID(env, NSAffineTransformStructFc.clazz, "tY", "D");
	NSAffineTransformStructFc.cached = 1;
}

NSAffineTransformStruct *getNSAffineTransformStructFields(JNIEnv *env, jobject lpObject, NSAffineTransformStruct *lpStruct)
{
	if (!NSAffineTransformStructFc.cached) cacheNSAffineTransformStructFields(env, lpObject);
	lpStruct->m11 = (CGFloat)(*env)->GetDoubleField(env, lpObject, NSAffineTransformStructFc.m11);
	lpStruct->m12 = (CGFloat)(*env)->GetDoubleField(env, lpObject, NSAffineTransformStructFc.m12);
	lpStruct->m21 = (CGFloat)(*env)->GetDoubleField(env, lpObject, NSAffineTransformStructFc.m21);
	lpStruct->m22 = (CGFloat)(*env)->GetDoubleField(env, lpObject, NSAffineTransformStructFc.m22);
	lpStruct->tX = (CGFloat)(*env)->GetDoubleField(env, lpObject, NSAffineTransformStructFc.tX);
	lpStruct->tY = (CGFloat)(*env)->GetDoubleField(env, lpObject, NSAffineTransformStructFc.tY);
	return lpStruct;
}

void setNSAffineTransformStructFields(JNIEnv *env, jobject lpObject, NSAffineTransformStruct *lpStruct)
{
	if (!NSAffineTransformStructFc.cached) cacheNSAffineTransformStructFields(env, lpObject);
	(*env)->SetDoubleField(env, lpObject, NSAffineTransformStructFc.m11, (jdouble)lpStruct->m11);
	(*env)->SetDoubleField(env, lpObject, NSAffineTransformStructFc.m12, (jdouble)lpStruct->m12);
	(*env)->SetDoubleField(env, lpObject, NSAffineTransformStructFc.m21, (jdouble)lpStruct->m21);
	(*env)->SetDoubleField(env, lpObject, NSAffineTransformStructFc.m22, (jdouble)lpStruct->m22);
	(*env)->SetDoubleField(env, lpObject, NSAffineTransformStructFc.tX, (jdouble)lpStruct->tX);
	(*env)->SetDoubleField(env, lpObject, NSAffineTransformStructFc.tY, (jdouble)lpStruct->tY);
}
#endif

#ifndef NO_NSPoint
typedef struct NSPoint_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID x, y;
} NSPoint_FID_CACHE;

NSPoint_FID_CACHE NSPointFc;

void cacheNSPointFields(JNIEnv *env, jobject lpObject)
{
	if (NSPointFc.cached) return;
	NSPointFc.clazz = (*env)->GetObjectClass(env, lpObject);
	NSPointFc.x = (*env)->GetFieldID(env, NSPointFc.clazz, "x", "D");
	NSPointFc.y = (*env)->GetFieldID(env, NSPointFc.clazz, "y", "D");
	NSPointFc.cached = 1;
}

NSPoint *getNSPointFields(JNIEnv *env, jobject lpObject, NSPoint *lpStruct)
{
	if (!NSPointFc.cached) cacheNSPointFields(env, lpObject);
	lpStruct->x = (CGFloat)(*env)->GetDoubleField(env, lpObject, NSPointFc.x);
	lpStruct->y = (CGFloat)(*env)->GetDoubleField(env, lpObject, NSPointFc.y);
	return lpStruct;
}

void setNSPointFields(JNIEnv *env, jobject lpObject, NSPoint *lpStruct)
{
	if (!NSPointFc.cached) cacheNSPointFields(env, lpObject);
	(*env)->SetDoubleField(env, lpObject, NSPointFc.x, (jdouble)lpStruct->x);
	(*env)->SetDoubleField(env, lpObject, NSPointFc.y, (jdouble)lpStruct->y);
}
#endif

#ifndef NO_NSRange
typedef struct NSRange_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID location, length;
} NSRange_FID_CACHE;

NSRange_FID_CACHE NSRangeFc;

void cacheNSRangeFields(JNIEnv *env, jobject lpObject)
{
	if (NSRangeFc.cached) return;
	NSRangeFc.clazz = (*env)->GetObjectClass(env, lpObject);
	NSRangeFc.location = (*env)->GetFieldID(env, NSRangeFc.clazz, "location", "J");
	NSRangeFc.length = (*env)->GetFieldID(env, NSRangeFc.clazz, "length", "J");
	NSRangeFc.cached = 1;
}

NSRange *getNSRangeFields(JNIEnv *env, jobject lpObject, NSRange *lpStruct)
{
	if (!NSRangeFc.cached) cacheNSRangeFields(env, lpObject);
	lpStruct->location = (NSUInteger)(*env)->GetLongField(env, lpObject, NSRangeFc.location);
	lpStruct->length = (NSUInteger)(*env)->GetLongField(env, lpObject, NSRangeFc.length);
	return lpStruct;
}

void setNSRangeFields(JNIEnv *env, jobject lpObject, NSRange *lpStruct)
{
	if (!NSRangeFc.cached) cacheNSRangeFields(env, lpObject);
	(*env)->SetLongField(env, lpObject, NSRangeFc.location, (jlong)lpStruct->location);
	(*env)->SetLongField(env, lpObject, NSRangeFc.length, (jlong)lpStruct->length);
}
#endif

#ifndef NO_NSRect
typedef struct NSRect_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID x, y, width, height;
} NSRect_FID_CACHE;

NSRect_FID_CACHE NSRectFc;

void cacheNSRectFields(JNIEnv *env, jobject lpObject)
{
	if (NSRectFc.cached) return;
	NSRectFc.clazz = (*env)->GetObjectClass(env, lpObject);
	NSRectFc.x = (*env)->GetFieldID(env, NSRectFc.clazz, "x", "D");
	NSRectFc.y = (*env)->GetFieldID(env, NSRectFc.clazz, "y", "D");
	NSRectFc.width = (*env)->GetFieldID(env, NSRectFc.clazz, "width", "D");
	NSRectFc.height = (*env)->GetFieldID(env, NSRectFc.clazz, "height", "D");
	NSRectFc.cached = 1;
}

NSRect *getNSRectFields(JNIEnv *env, jobject lpObject, NSRect *lpStruct)
{
	if (!NSRectFc.cached) cacheNSRectFields(env, lpObject);
	lpStruct->origin.x = (*env)->GetDoubleField(env, lpObject, NSRectFc.x);
	lpStruct->origin.y = (*env)->GetDoubleField(env, lpObject, NSRectFc.y);
	lpStruct->size.width = (*env)->GetDoubleField(env, lpObject, NSRectFc.width);
	lpStruct->size.height = (*env)->GetDoubleField(env, lpObject, NSRectFc.height);
	return lpStruct;
}

void setNSRectFields(JNIEnv *env, jobject lpObject, NSRect *lpStruct)
{
	if (!NSRectFc.cached) cacheNSRectFields(env, lpObject);
	(*env)->SetDoubleField(env, lpObject, NSRectFc.x, (jdouble)lpStruct->origin.x);
	(*env)->SetDoubleField(env, lpObject, NSRectFc.y, (jdouble)lpStruct->origin.y);
	(*env)->SetDoubleField(env, lpObject, NSRectFc.width, (jdouble)lpStruct->size.width);
	(*env)->SetDoubleField(env, lpObject, NSRectFc.height, (jdouble)lpStruct->size.height);
}
#endif

#ifndef NO_NSSize
typedef struct NSSize_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID width, height;
} NSSize_FID_CACHE;

NSSize_FID_CACHE NSSizeFc;

void cacheNSSizeFields(JNIEnv *env, jobject lpObject)
{
	if (NSSizeFc.cached) return;
	NSSizeFc.clazz = (*env)->GetObjectClass(env, lpObject);
	NSSizeFc.width = (*env)->GetFieldID(env, NSSizeFc.clazz, "width", "D");
	NSSizeFc.height = (*env)->GetFieldID(env, NSSizeFc.clazz, "height", "D");
	NSSizeFc.cached = 1;
}

NSSize *getNSSizeFields(JNIEnv *env, jobject lpObject, NSSize *lpStruct)
{
	if (!NSSizeFc.cached) cacheNSSizeFields(env, lpObject);
	lpStruct->width = (CGFloat)(*env)->GetDoubleField(env, lpObject, NSSizeFc.width);
	lpStruct->height = (CGFloat)(*env)->GetDoubleField(env, lpObject, NSSizeFc.height);
	return lpStruct;
}

void setNSSizeFields(JNIEnv *env, jobject lpObject, NSSize *lpStruct)
{
	if (!NSSizeFc.cached) cacheNSSizeFields(env, lpObject);
	(*env)->SetDoubleField(env, lpObject, NSSizeFc.width, (jdouble)lpStruct->width);
	(*env)->SetDoubleField(env, lpObject, NSSizeFc.height, (jdouble)lpStruct->height);
}
#endif

#ifndef NO_PMResolution
typedef struct PMResolution_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID hRes, vRes;
} PMResolution_FID_CACHE;

PMResolution_FID_CACHE PMResolutionFc;

void cachePMResolutionFields(JNIEnv *env, jobject lpObject)
{
	if (PMResolutionFc.cached) return;
	PMResolutionFc.clazz = (*env)->GetObjectClass(env, lpObject);
	PMResolutionFc.hRes = (*env)->GetFieldID(env, PMResolutionFc.clazz, "hRes", "D");
	PMResolutionFc.vRes = (*env)->GetFieldID(env, PMResolutionFc.clazz, "vRes", "D");
	PMResolutionFc.cached = 1;
}

PMResolution *getPMResolutionFields(JNIEnv *env, jobject lpObject, PMResolution *lpStruct)
{
	if (!PMResolutionFc.cached) cachePMResolutionFields(env, lpObject);
	lpStruct->hRes = (*env)->GetDoubleField(env, lpObject, PMResolutionFc.hRes);
	lpStruct->vRes = (*env)->GetDoubleField(env, lpObject, PMResolutionFc.vRes);
	return lpStruct;
}

void setPMResolutionFields(JNIEnv *env, jobject lpObject, PMResolution *lpStruct)
{
	if (!PMResolutionFc.cached) cachePMResolutionFields(env, lpObject);
	(*env)->SetDoubleField(env, lpObject, PMResolutionFc.hRes, (jdouble)lpStruct->hRes);
	(*env)->SetDoubleField(env, lpObject, PMResolutionFc.vRes, (jdouble)lpStruct->vRes);
}
#endif

#ifndef NO_objc_super
typedef struct objc_super_FID_CACHE {
	int cached;
	jclass clazz;
	jfieldID receiver, super_class;
} objc_super_FID_CACHE;

objc_super_FID_CACHE objc_superFc;

void cacheobjc_superFields(JNIEnv *env, jobject lpObject)
{
	if (objc_superFc.cached) return;
	objc_superFc.clazz = (*env)->GetObjectClass(env, lpObject);
	objc_superFc.receiver = (*env)->GetFieldID(env, objc_superFc.clazz, "receiver", "J");
	objc_superFc.super_class = (*env)->GetFieldID(env, objc_superFc.clazz, "super_class", "J");
	objc_superFc.cached = 1;
}

struct objc_super *getobjc_superFields(JNIEnv *env, jobject lpObject, struct objc_super *lpStruct)
{
	if (!objc_superFc.cached) cacheobjc_superFields(env, lpObject);
	lpStruct->receiver = (id)(*env)->GetLongField(env, lpObject, objc_superFc.receiver);
	lpStruct->swt_super_class = (Class)(*env)->GetLongField(env, lpObject, objc_superFc.super_class);
	return lpStruct;
}

void setobjc_superFields(JNIEnv *env, jobject lpObject, struct objc_super *lpStruct)
{
	if (!objc_superFc.cached) cacheobjc_superFields(env, lpObject);
	(*env)->SetLongField(env, lpObject, objc_superFc.receiver, (jlong)lpStruct->receiver);
	(*env)->SetLongField(env, lpObject, objc_superFc.super_class, (jlong)lpStruct->swt_super_class);
}
#endif

Back to the top