File: JSCContext.h.in

package info (click to toggle)
webkit2gtk 2.48.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 429,764 kB
  • sloc: cpp: 3,697,587; javascript: 194,444; ansic: 169,997; python: 46,499; asm: 19,295; ruby: 18,528; perl: 16,602; xml: 4,650; yacc: 2,360; sh: 2,098; java: 1,993; lex: 1,327; pascal: 366; makefile: 298
file content (178 lines) | stat: -rw-r--r-- 7,107 bytes parent folder | download | duplicates (11)
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
/*
 * Copyright (C) 2018 Igalia S.L.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#if !defined(__JSC_H_INSIDE__) && !defined(BUILDING_WEBKIT)
#error "Only <jsc/jsc.h> can be included directly."
#endif

#ifndef JSCContext_h
#define JSCContext_h

#include <glib-object.h>
#include <jsc/JSCDefines.h>
#include <jsc/JSCException.h>
#include <jsc/JSCClass.h>
#include <jsc/JSCValue.h>
#include <jsc/JSCVirtualMachine.h>

G_BEGIN_DECLS

#define JSC_TYPE_CONTEXT            (jsc_context_get_type())

#if !ENABLE(2022_GLIB_API)
#define JSC_CONTEXT(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), JSC_TYPE_CONTEXT, JSCContext))
#define JSC_IS_CONTEXT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), JSC_TYPE_CONTEXT))
#define JSC_CONTEXT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  JSC_TYPE_CONTEXT, JSCContextClass))
#define JSC_IS_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  JSC_TYPE_CONTEXT))
#define JSC_CONTEXT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  JSC_TYPE_CONTEXT, JSCContextClass))

struct _JSCContextClass {
    GObjectClass parent_class;

    void (*_jsc_reserved0) (void);
    void (*_jsc_reserved1) (void);
    void (*_jsc_reserved2) (void);
    void (*_jsc_reserved3) (void);
};
#endif

JSC_DECLARE_FINAL_TYPE (JSCContext, jsc_context, JSC, CONTEXT, GObject)

typedef void (* JSCExceptionHandler) (JSCContext   *context,
                                      JSCException *exception,
                                      gpointer      user_data);

typedef enum {
    JSC_CHECK_SYNTAX_MODE_SCRIPT,
    JSC_CHECK_SYNTAX_MODE_MODULE
} JSCCheckSyntaxMode;

typedef enum {
    JSC_CHECK_SYNTAX_RESULT_SUCCESS,
    JSC_CHECK_SYNTAX_RESULT_RECOVERABLE_ERROR,
    JSC_CHECK_SYNTAX_RESULT_IRRECOVERABLE_ERROR,
    JSC_CHECK_SYNTAX_RESULT_UNTERMINATED_LITERAL_ERROR,
    JSC_CHECK_SYNTAX_RESULT_OUT_OF_MEMORY_ERROR,
    JSC_CHECK_SYNTAX_RESULT_STACK_OVERFLOW_ERROR,
} JSCCheckSyntaxResult;

JSC_API JSCContext *
jsc_context_new                      (void);

JSC_API JSCContext *
jsc_context_new_with_virtual_machine (JSCVirtualMachine  *vm);

JSC_API JSCVirtualMachine *
jsc_context_get_virtual_machine      (JSCContext         *context);

JSC_API JSCException *
jsc_context_get_exception            (JSCContext         *context);

JSC_API void
jsc_context_throw                    (JSCContext         *context,
                                      const char         *error_message);

JSC_API void
jsc_context_throw_printf             (JSCContext         *context,
                                      const char         *format,
                                      ...) G_GNUC_PRINTF (2, 3);

JSC_API void
jsc_context_throw_with_name          (JSCContext         *context,
                                      const char         *error_name,
                                      const char         *error_message);

JSC_API void
jsc_context_throw_with_name_printf   (JSCContext         *context,
                                      const char         *error_name,
                                      const char         *format,
                                      ...) G_GNUC_PRINTF (3, 4);

JSC_API void
jsc_context_throw_exception          (JSCContext         *context,
                                      JSCException       *exception);

JSC_API void
jsc_context_clear_exception          (JSCContext         *context);

JSC_API void
jsc_context_push_exception_handler   (JSCContext         *context,
                                      JSCExceptionHandler handler,
                                      gpointer            user_data,
                                      GDestroyNotify      destroy_notify);

JSC_API void
jsc_context_pop_exception_handler    (JSCContext         *context);

JSC_API JSCContext *
jsc_context_get_current              (void);

JSC_API JSCValue *
jsc_context_evaluate                 (JSCContext         *context,
                                      const char         *code,
                                      gssize              length) G_GNUC_WARN_UNUSED_RESULT;

JSC_API JSCValue *
jsc_context_evaluate_with_source_uri (JSCContext         *context,
                                      const char         *code,
                                      gssize              length,
                                      const char         *uri,
                                      guint               line_number) G_GNUC_WARN_UNUSED_RESULT;

JSC_API JSCValue *
jsc_context_evaluate_in_object       (JSCContext         *context,
                                      const char         *code,
                                      gssize              length,
                                      gpointer            object_instance,
                                      JSCClass           *object_class,
                                      const char         *uri,
                                      guint               line_number,
                                      JSCValue          **object) G_GNUC_WARN_UNUSED_RESULT;

JSC_API JSCCheckSyntaxResult
jsc_context_check_syntax             (JSCContext         *context,
                                      const char         *code,
                                      gssize              length,
                                      JSCCheckSyntaxMode  mode,
                                      const char         *uri,
                                      unsigned            line_number,
                                      JSCException      **exception);

JSC_API JSCValue *
jsc_context_get_global_object        (JSCContext         *context);

JSC_API void
jsc_context_set_value                (JSCContext         *context,
                                      const char         *name,
                                      JSCValue           *value);

JSC_API JSCValue *
jsc_context_get_value                (JSCContext         *context,
                                      const char         *name);

JSC_API JSCClass *
jsc_context_register_class           (JSCContext         *context,
                                      const char         *name,
                                      JSCClass           *parent_class,
                                      JSCClassVTable     *vtable,
                                      GDestroyNotify      destroy_notify);

G_END_DECLS

#endif /* JSCContext_h */