Oolite 1.91.0.7604-240417-a536cbe
Loading...
Searching...
No Matches
OOJSPropID.h
Go to the documentation of this file.
1/*
2
3OOJSPropID.h
4
5
6JavaScript support for Oolite
7Copyright (C) 2007-2013 David Taylor and Jens Ayton.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22MA 02110-1301, USA.
23
24*/
25
26#include <jsapi.h>
28
29/*
30 OOJSID(const char * [literal])
31 Macro to create a string-based jsid. The string is interned and converted
32 into a string by a helper the first time the macro is hit, then cached.
33*/
34
35#ifdef JS_USE_JSVAL_JSID_STRUCT_TYPES
36#define OOJSID(str) ({ static jsid idCache; static JSBool inited; if (EXPECT_NOT(!inited)) { OOJSInitJSIDCachePRIVATE(""str, &idCache); inited = JS_TRUE; } idCache; })
37#else
38#define OOJSID(str) ({ static jsid idCache = JSID_VOID; if (EXPECT_NOT(idCache == JSID_VOID)) OOJSInitJSIDCachePRIVATE(""str, &idCache); idCache; })
39#endif
40void OOJSInitJSIDCachePRIVATE(const char *name, jsid *idCache);
41
void OOJSInitJSIDCachePRIVATE(const char *name, jsid *idCache)