Oolite
Loading...
Searching...
No Matches
OOJSPropID.h
Go to the documentation of this file.
1/*
2
3OOJSPropID.h (QuickJS-ng)
4
5Oolite
6Copyright (C) 2004-2013 Giles C Williams and contributors
7
8This program is free software; you can redistribute it and/or
9modify it under the terms of the GNU General Public License
10as published by the Free Software Foundation; either version 2
11of the License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with this program; if not, write to the Free Software
20Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21MA 02110-1301, USA.
22
23*/
24
26#include <quickjs.h>
27
28/* Engine-neutral names for a property ID and a value (jsid and jsval with
29 SpiderMonkey). Declared here, rather than in OOJavaScriptEngine.h, so game
30 headers imported by OOJavaScriptEngine.h can use them.
31*/
32typedef JSAtom OOJSPropID;
33typedef JSValue OOJSVal;
34
35/*
36 OOJSID(const char * [literal])
37 Macro to create a property ID. The string is interned the first time the
38 macro is hit, then cached; the atom lives as long as the runtime.
39*/
40#define OOJSID(str) ({ static JSAtom idCache = JS_ATOM_NULL; if (EXPECT_NOT(idCache == JS_ATOM_NULL)) idCache = OOJSInternAtomPRIVATE(""str); idCache; })
41JSAtom OOJSInternAtomPRIVATE(const char* name);
jsid OOJSPropID
Definition OOJSPropID.h:31
jsval OOJSVal
JSAtom OOJSInternAtomPRIVATE(const char *name)