/
JSCContext.go
667 lines (559 loc) · 20.3 KB
/
JSCContext.go
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
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
// Code generated by girgen. DO NOT EDIT.
package javascriptcore
import (
"fmt"
"runtime"
"unsafe"
"github.com/diamondburned/gotk4/pkg/core/gbox"
"github.com/diamondburned/gotk4/pkg/core/gextras"
coreglib "github.com/diamondburned/gotk4/pkg/core/glib"
)
// #include <stdlib.h>
// #include <glib-object.h>
// #include <jsc/jsc.h>
// extern void callbackDelete(gpointer);
// extern void _gotk4_javascriptcore4_ExceptionHandler(JSCContext*, JSCException*, gpointer);
import "C"
// GType values.
var (
GTypeContext = coreglib.Type(C.jsc_context_get_type())
)
func init() {
coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{
coreglib.TypeMarshaler{T: GTypeContext, F: marshalContext},
})
}
// CheckSyntaxMode: enum values to specify a mode to check for syntax errors in
// jsc_context_check_syntax().
type CheckSyntaxMode C.gint
const (
// CheckSyntaxModeScript: mode to check syntax of a script.
CheckSyntaxModeScript CheckSyntaxMode = iota
// CheckSyntaxModeModule: mode to check syntax of a module.
CheckSyntaxModeModule
)
// String returns the name in string for CheckSyntaxMode.
func (c CheckSyntaxMode) String() string {
switch c {
case CheckSyntaxModeScript:
return "Script"
case CheckSyntaxModeModule:
return "Module"
default:
return fmt.Sprintf("CheckSyntaxMode(%d)", c)
}
}
// CheckSyntaxResult: enum values to specify the result of
// jsc_context_check_syntax().
type CheckSyntaxResult C.gint
const (
// CheckSyntaxResultSuccess: no errors.
CheckSyntaxResultSuccess CheckSyntaxResult = iota
// CheckSyntaxResultRecoverableError: recoverable syntax error.
CheckSyntaxResultRecoverableError
// CheckSyntaxResultIrrecoverableError: irrecoverable syntax error.
CheckSyntaxResultIrrecoverableError
// CheckSyntaxResultUnterminatedLiteralError: unterminated literal error.
CheckSyntaxResultUnterminatedLiteralError
// CheckSyntaxResultOutOfMemoryError: out of memory error.
CheckSyntaxResultOutOfMemoryError
// CheckSyntaxResultStackOverflowError: stack overflow error.
CheckSyntaxResultStackOverflowError
)
// String returns the name in string for CheckSyntaxResult.
func (c CheckSyntaxResult) String() string {
switch c {
case CheckSyntaxResultSuccess:
return "Success"
case CheckSyntaxResultRecoverableError:
return "RecoverableError"
case CheckSyntaxResultIrrecoverableError:
return "IrrecoverableError"
case CheckSyntaxResultUnterminatedLiteralError:
return "UnterminatedLiteralError"
case CheckSyntaxResultOutOfMemoryError:
return "OutOfMemoryError"
case CheckSyntaxResultStackOverflowError:
return "StackOverflowError"
default:
return fmt.Sprintf("CheckSyntaxResult(%d)", c)
}
}
// ExceptionHandler: function used to handle JavaScript exceptions in a
// CContext.
type ExceptionHandler func(context *Context, exception *Exception)
// ContextOverrides contains methods that are overridable.
type ContextOverrides struct {
}
func defaultContextOverrides(v *Context) ContextOverrides {
return ContextOverrides{}
}
// Context represents a JavaScript execution context, where all operations take
// place and where the values will be associated.
//
// When a new context is created, a global object is allocated and the built-in
// JavaScript objects (Object, Function, String, Array) are populated.
// You can execute JavaScript in the context by using jsc_context_evaluate() or
// jsc_context_evaluate_with_source_uri(). It's also possible to register custom
// objects in the context with jsc_context_register_class().
type Context struct {
_ [0]func() // equal guard
*coreglib.Object
}
var (
_ coreglib.Objector = (*Context)(nil)
)
func init() {
coreglib.RegisterClassInfo[*Context, *ContextClass, ContextOverrides](
GTypeContext,
initContextClass,
wrapContext,
defaultContextOverrides,
)
}
func initContextClass(gclass unsafe.Pointer, overrides ContextOverrides, classInitFunc func(*ContextClass)) {
if classInitFunc != nil {
class := (*ContextClass)(gextras.NewStructNative(gclass))
classInitFunc(class)
}
}
func wrapContext(obj *coreglib.Object) *Context {
return &Context{
Object: obj,
}
}
func marshalContext(p uintptr) (interface{}, error) {
return wrapContext(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil
}
// NewContext: create a new CContext. The context is created in a new
// CVirtualMachine. Use jsc_context_new_with_virtual_machine() to create a new
// CContext in an existing CVirtualMachine.
//
// The function returns the following values:
//
// - context: newly created CContext.
//
func NewContext() *Context {
var _cret *C.JSCContext // in
_cret = C.jsc_context_new()
var _context *Context // out
_context = wrapContext(coreglib.AssumeOwnership(unsafe.Pointer(_cret)))
return _context
}
// NewContextWithVirtualMachine: create a new CContext in virtual_machine.
//
// The function takes the following parameters:
//
// - vm: CVirtualMachine.
//
// The function returns the following values:
//
// - context: newly created CContext.
//
func NewContextWithVirtualMachine(vm *VirtualMachine) *Context {
var _arg1 *C.JSCVirtualMachine // out
var _cret *C.JSCContext // in
_arg1 = (*C.JSCVirtualMachine)(unsafe.Pointer(coreglib.InternObject(vm).Native()))
_cret = C.jsc_context_new_with_virtual_machine(_arg1)
runtime.KeepAlive(vm)
var _context *Context // out
_context = wrapContext(coreglib.AssumeOwnership(unsafe.Pointer(_cret)))
return _context
}
// CheckSyntax: check the given code in context for syntax errors. The
// line_number is the starting line number in uri; the value is one-based so the
// first line is 1. uri and line_number are only used to fill the exception.
// In case of errors exception will be set to a new CException with the details.
// You can pass NULL to exception to ignore the error details.
//
// The function takes the following parameters:
//
// - code: javaScript script to check.
// - length of code, or -1 if code is a nul-terminated string.
// - mode: CCheckSyntaxMode.
// - uri: source URI.
// - lineNumber: starting line number.
//
// The function returns the following values:
//
// - exception (optional): return location for a CException, or NULL to
// ignore.
// - checkSyntaxResult: CCheckSyntaxResult.
//
func (context *Context) CheckSyntax(code string, length int, mode CheckSyntaxMode, uri string, lineNumber uint) (*Exception, CheckSyntaxResult) {
var _arg0 *C.JSCContext // out
var _arg1 *C.char // out
var _arg2 C.gssize // out
var _arg3 C.JSCCheckSyntaxMode // out
var _arg4 *C.char // out
var _arg5 C.unsigned // out
var _arg6 *C.JSCException // in
var _cret C.JSCCheckSyntaxResult // in
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
_arg1 = (*C.char)(unsafe.Pointer(C.CString(code)))
defer C.free(unsafe.Pointer(_arg1))
_arg2 = C.gssize(length)
_arg3 = C.JSCCheckSyntaxMode(mode)
_arg4 = (*C.char)(unsafe.Pointer(C.CString(uri)))
defer C.free(unsafe.Pointer(_arg4))
_arg5 = C.unsigned(lineNumber)
_cret = C.jsc_context_check_syntax(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_arg6)
runtime.KeepAlive(context)
runtime.KeepAlive(code)
runtime.KeepAlive(length)
runtime.KeepAlive(mode)
runtime.KeepAlive(uri)
runtime.KeepAlive(lineNumber)
var _exception *Exception // out
var _checkSyntaxResult CheckSyntaxResult // out
if _arg6 != nil {
_exception = wrapException(coreglib.AssumeOwnership(unsafe.Pointer(_arg6)))
}
_checkSyntaxResult = CheckSyntaxResult(_cret)
return _exception, _checkSyntaxResult
}
// ClearException: clear the uncaught exception in context if any.
func (context *Context) ClearException() {
var _arg0 *C.JSCContext // out
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
C.jsc_context_clear_exception(_arg0)
runtime.KeepAlive(context)
}
// Evaluate code in context.
//
// The function takes the following parameters:
//
// - code: javaScript script to evaluate.
// - length of code, or -1 if code is a nul-terminated string.
//
// The function returns the following values:
//
// - value representing the last value generated by the script.
//
func (context *Context) Evaluate(code string, length int) *Value {
var _arg0 *C.JSCContext // out
var _arg1 *C.char // out
var _arg2 C.gssize // out
var _cret *C.JSCValue // in
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
_arg1 = (*C.char)(unsafe.Pointer(C.CString(code)))
defer C.free(unsafe.Pointer(_arg1))
_arg2 = C.gssize(length)
_cret = C.jsc_context_evaluate(_arg0, _arg1, _arg2)
runtime.KeepAlive(context)
runtime.KeepAlive(code)
runtime.KeepAlive(length)
var _value *Value // out
_value = wrapValue(coreglib.AssumeOwnership(unsafe.Pointer(_cret)))
return _value
}
// EvaluateInObject: evaluate code and create an new object where symbols
// defined in code will be added as properties, instead of being added to
// context global object. The new object is returned as object parameter.
// Similar to how jsc_value_new_object() works, if object_instance is not
// NULL object_class must be provided too. The line_number is the starting
// line number in uri; the value is one-based so the first line is 1. uri and
// line_number will be shown in exceptions and they don't affect the behavior of
// the script.
//
// The function takes the following parameters:
//
// - code: javaScript script to evaluate.
// - length of code, or -1 if code is a nul-terminated string.
// - objectInstance (optional): object instance.
// - objectClass (optional) or NULL to use the default.
// - uri: source URI.
// - lineNumber: starting line number.
//
// The function returns the following values:
//
// - object: return location for a CValue.
// - value representing the last value generated by the script.
//
func (context *Context) EvaluateInObject(code string, length int, objectInstance unsafe.Pointer, objectClass *Class, uri string, lineNumber uint) (object, value *Value) {
var _arg0 *C.JSCContext // out
var _arg1 *C.char // out
var _arg2 C.gssize // out
var _arg3 C.gpointer // out
var _arg4 *C.JSCClass // out
var _arg5 *C.char // out
var _arg6 C.guint // out
var _arg7 *C.JSCValue // in
var _cret *C.JSCValue // in
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
_arg1 = (*C.char)(unsafe.Pointer(C.CString(code)))
defer C.free(unsafe.Pointer(_arg1))
_arg2 = C.gssize(length)
_arg3 = (C.gpointer)(unsafe.Pointer(objectInstance))
if objectClass != nil {
_arg4 = (*C.JSCClass)(unsafe.Pointer(coreglib.InternObject(objectClass).Native()))
}
_arg5 = (*C.char)(unsafe.Pointer(C.CString(uri)))
defer C.free(unsafe.Pointer(_arg5))
_arg6 = C.guint(lineNumber)
_cret = C.jsc_context_evaluate_in_object(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, &_arg7)
runtime.KeepAlive(context)
runtime.KeepAlive(code)
runtime.KeepAlive(length)
runtime.KeepAlive(objectInstance)
runtime.KeepAlive(objectClass)
runtime.KeepAlive(uri)
runtime.KeepAlive(lineNumber)
var _object *Value // out
var _value *Value // out
_object = wrapValue(coreglib.AssumeOwnership(unsafe.Pointer(_arg7)))
_value = wrapValue(coreglib.AssumeOwnership(unsafe.Pointer(_cret)))
return _object, _value
}
// EvaluateWithSourceURI: evaluate code in context using uri as the source URI.
// The line_number is the starting line number in uri; the value is one-based so
// the first line is 1. uri and line_number will be shown in exceptions and they
// don't affect the behavior of the script.
//
// The function takes the following parameters:
//
// - code: javaScript script to evaluate.
// - length of code, or -1 if code is a nul-terminated string.
// - uri: source URI.
// - lineNumber: starting line number.
//
// The function returns the following values:
//
// - value representing the last value generated by the script.
//
func (context *Context) EvaluateWithSourceURI(code string, length int, uri string, lineNumber uint) *Value {
var _arg0 *C.JSCContext // out
var _arg1 *C.char // out
var _arg2 C.gssize // out
var _arg3 *C.char // out
var _arg4 C.guint // out
var _cret *C.JSCValue // in
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
_arg1 = (*C.char)(unsafe.Pointer(C.CString(code)))
defer C.free(unsafe.Pointer(_arg1))
_arg2 = C.gssize(length)
_arg3 = (*C.char)(unsafe.Pointer(C.CString(uri)))
defer C.free(unsafe.Pointer(_arg3))
_arg4 = C.guint(lineNumber)
_cret = C.jsc_context_evaluate_with_source_uri(_arg0, _arg1, _arg2, _arg3, _arg4)
runtime.KeepAlive(context)
runtime.KeepAlive(code)
runtime.KeepAlive(length)
runtime.KeepAlive(uri)
runtime.KeepAlive(lineNumber)
var _value *Value // out
_value = wrapValue(coreglib.AssumeOwnership(unsafe.Pointer(_cret)))
return _value
}
// Exception: get the last unhandled exception thrown in context by API
// functions calls.
//
// The function returns the following values:
//
// - exception (optional) or NULL if there isn't any unhandled exception in
// the CContext.
//
func (context *Context) Exception() *Exception {
var _arg0 *C.JSCContext // out
var _cret *C.JSCException // in
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
_cret = C.jsc_context_get_exception(_arg0)
runtime.KeepAlive(context)
var _exception *Exception // out
if _cret != nil {
_exception = wrapException(coreglib.Take(unsafe.Pointer(_cret)))
}
return _exception
}
// GlobalObject: get a CValue referencing the context global object.
//
// The function returns the following values:
//
// - value: CValue.
//
func (context *Context) GlobalObject() *Value {
var _arg0 *C.JSCContext // out
var _cret *C.JSCValue // in
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
_cret = C.jsc_context_get_global_object(_arg0)
runtime.KeepAlive(context)
var _value *Value // out
_value = wrapValue(coreglib.AssumeOwnership(unsafe.Pointer(_cret)))
return _value
}
// Value: get a property of context global object with name.
//
// The function takes the following parameters:
//
// - name: value name.
//
// The function returns the following values:
//
// - value: CValue.
//
func (context *Context) Value(name string) *Value {
var _arg0 *C.JSCContext // out
var _arg1 *C.char // out
var _cret *C.JSCValue // in
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
_arg1 = (*C.char)(unsafe.Pointer(C.CString(name)))
defer C.free(unsafe.Pointer(_arg1))
_cret = C.jsc_context_get_value(_arg0, _arg1)
runtime.KeepAlive(context)
runtime.KeepAlive(name)
var _value *Value // out
_value = wrapValue(coreglib.AssumeOwnership(unsafe.Pointer(_cret)))
return _value
}
// VirtualMachine: get the CVirtualMachine where context was created.
//
// The function returns the following values:
//
// - virtualMachine where the CContext was created.
//
func (context *Context) VirtualMachine() *VirtualMachine {
var _arg0 *C.JSCContext // out
var _cret *C.JSCVirtualMachine // in
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
_cret = C.jsc_context_get_virtual_machine(_arg0)
runtime.KeepAlive(context)
var _virtualMachine *VirtualMachine // out
_virtualMachine = wrapVirtualMachine(coreglib.Take(unsafe.Pointer(_cret)))
return _virtualMachine
}
// PopExceptionHandler: remove the last CExceptionHandler previously pushed to
// context with jsc_context_push_exception_handler().
func (context *Context) PopExceptionHandler() {
var _arg0 *C.JSCContext // out
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
C.jsc_context_pop_exception_handler(_arg0)
runtime.KeepAlive(context)
}
// PushExceptionHandler: push an exception handler in context.
// Whenever a JavaScript exception happens in the CContext, the given
// handler will be called. The default CExceptionHandler simply calls
// jsc_context_throw_exception() to throw the exception to the CContext.
// If you don't want to catch the exception, but only get notified about it,
// call jsc_context_throw_exception() in handler like the default one does.
// The last exception handler pushed is the only one used by the CContext,
// use jsc_context_pop_exception_handler() to remove it and set the previous
// one. When handler is removed from the context, destroy_notify i called with
// user_data as parameter.
//
// The function takes the following parameters:
//
// - handler: CExceptionHandler.
//
func (context *Context) PushExceptionHandler(handler ExceptionHandler) {
var _arg0 *C.JSCContext // out
var _arg1 C.JSCExceptionHandler // out
var _arg2 C.gpointer
var _arg3 C.GDestroyNotify
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
_arg1 = (*[0]byte)(C._gotk4_javascriptcore4_ExceptionHandler)
_arg2 = C.gpointer(gbox.Assign(handler))
_arg3 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete))
C.jsc_context_push_exception_handler(_arg0, _arg1, _arg2, _arg3)
runtime.KeepAlive(context)
runtime.KeepAlive(handler)
}
// SetValue: set a property of context global object with name and value.
//
// The function takes the following parameters:
//
// - name: value name.
// - value: CValue.
//
func (context *Context) SetValue(name string, value *Value) {
var _arg0 *C.JSCContext // out
var _arg1 *C.char // out
var _arg2 *C.JSCValue // out
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
_arg1 = (*C.char)(unsafe.Pointer(C.CString(name)))
defer C.free(unsafe.Pointer(_arg1))
_arg2 = (*C.JSCValue)(unsafe.Pointer(coreglib.InternObject(value).Native()))
C.jsc_context_set_value(_arg0, _arg1, _arg2)
runtime.KeepAlive(context)
runtime.KeepAlive(name)
runtime.KeepAlive(value)
}
// Throw an exception to context using the given error message. The created
// CException can be retrieved with jsc_context_get_exception().
//
// The function takes the following parameters:
//
// - errorMessage: error message.
//
func (context *Context) Throw(errorMessage string) {
var _arg0 *C.JSCContext // out
var _arg1 *C.char // out
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
_arg1 = (*C.char)(unsafe.Pointer(C.CString(errorMessage)))
defer C.free(unsafe.Pointer(_arg1))
C.jsc_context_throw(_arg0, _arg1)
runtime.KeepAlive(context)
runtime.KeepAlive(errorMessage)
}
// ThrowException: throw exception to context.
//
// The function takes the following parameters:
//
// - exception: CException.
//
func (context *Context) ThrowException(exception *Exception) {
var _arg0 *C.JSCContext // out
var _arg1 *C.JSCException // out
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
_arg1 = (*C.JSCException)(unsafe.Pointer(coreglib.InternObject(exception).Native()))
C.jsc_context_throw_exception(_arg0, _arg1)
runtime.KeepAlive(context)
runtime.KeepAlive(exception)
}
// ThrowWithName: throw an exception to context using the given error
// name and message. The created CException can be retrieved with
// jsc_context_get_exception().
//
// The function takes the following parameters:
//
// - errorName: error name.
// - errorMessage: error message.
//
func (context *Context) ThrowWithName(errorName, errorMessage string) {
var _arg0 *C.JSCContext // out
var _arg1 *C.char // out
var _arg2 *C.char // out
_arg0 = (*C.JSCContext)(unsafe.Pointer(coreglib.InternObject(context).Native()))
_arg1 = (*C.char)(unsafe.Pointer(C.CString(errorName)))
defer C.free(unsafe.Pointer(_arg1))
_arg2 = (*C.char)(unsafe.Pointer(C.CString(errorMessage)))
defer C.free(unsafe.Pointer(_arg2))
C.jsc_context_throw_with_name(_arg0, _arg1, _arg2)
runtime.KeepAlive(context)
runtime.KeepAlive(errorName)
runtime.KeepAlive(errorMessage)
}
// ContextGetCurrent: get the CContext that is currently executing a function.
// This should only be called within a function or method callback, otherwise
// NULL will be returned.
//
// The function returns the following values:
//
// - context (optional) that is currently executing.
//
func ContextGetCurrent() *Context {
var _cret *C.JSCContext // in
_cret = C.jsc_context_get_current()
var _context *Context // out
if _cret != nil {
_context = wrapContext(coreglib.Take(unsafe.Pointer(_cret)))
}
return _context
}
// ContextClass: instance of this type is always passed by reference.
type ContextClass struct {
*contextClass
}
// contextClass is the struct that's finalized.
type contextClass struct {
native *C.JSCContextClass
}