Oolite
Loading...
Searching...
No Matches
OOJSEngineNativeWrappers.h
Go to the documentation of this file.
1/*
2
3OOJSEngineNativeWrappers.h (QuickJS-ng)
4
5Exception safety and profiling macros.
6
7Every JavaScript native callback that could concievably cause an
8Objective-C exception should begin with OOJS_NATIVE_ENTER() and end with
9OOJS_NATIVE_EXIT. Callbacks which have been carefully audited for potential
10exceptions, and support functions called from JavaScript native callbacks,
11may start with OOJS_PROFILE_ENTER and end with OOJS_PROFILE_EXIT to be
12included in profiling reports.
13
14Functions using either of these pairs _must_ return before
15OOJS_NATIVE_EXIT/OOJS_PROFILE_EXIT, or they will crash.
16
17For functions with a non-scalar return type, OOJS_PROFILE_EXIT should be
18replaced with OOJS_PROFILE_EXIT_VAL(returnValue). The returnValue is never
19used (and should be a constant expression), but is required to placate the
20compiler.
21
22For values with void return, use OOJS_PROFILE_EXIT_VOID. It is not
23necessary to insert a return statement before OOJS_PROFILE_EXIT_VOID.
24
25
26JavaScript support for Oolite
27Copyright (C) 2007-2013 David Taylor and Jens Ayton.
28
29This program is free software; you can redistribute it and/or
30modify it under the terms of the GNU General Public License
31as published by the Free Software Foundation; either version 2
32of the License, or (at your option) any later version.
33
34This program is distributed in the hope that it will be useful,
35but WITHOUT ANY WARRANTY; without even the implied warranty of
36MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37GNU General Public License for more details.
38
39You should have received a copy of the GNU General Public License
40along with this program; if not, write to the Free Software
41Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
42MA 02110-1301, USA.
43
44*/
45
46/* With QuickJS, the exception safety and profiling macros
47 (OOJS_NATIVE_ENTER()/OOJS_NATIVE_EXIT, OOJS_PROFILE_ENTER/OOJS_PROFILE_EXIT,
48 OOJS_BEGIN_FULL_NATIVE()/OOJS_END_FULL_NATIVE and friends) are defined in
49 OOJavaScriptEngine.h, as is OOJS_PROFILE; the profiler itself is in
50 OOJSEngineTimeManagement.m. This header remains so existing imports keep
51 working.
52*/
53