FreeWRL / FreeX3D 4.3.0
jsNative.h
1/*
2
3
4CProto.h - this is the object representing a PROTO definition and being
5capable of instantiating it.
6
7We keep a vector of pointers to all that pointers which point to "inner
8memory" and need therefore be updated when copying. Such pointers include
9field-destinations and parts of ROUTEs. Those pointers are then simply
10copied, their new positions put in the new vector, and afterwards are all
11pointers there updated.
12
13*/
14
15/****************************************************************************
16 This file is part of the FreeWRL/FreeX3D Distribution.
17
18 Copyright 2009 CRC Canada. (http://www.crc.gc.ca)
19
20 FreeWRL/FreeX3D is free software: you can redistribute it and/or modify
21 it under the terms of the GNU Lesser Public License as published by
22 the Free Software Foundation, either version 3 of the License, or
23 (at your option) any later version.
24
25 FreeWRL/FreeX3D is distributed in the hope that it will be useful,
26 but WITHOUT ANY WARRANTY; without even the implied warranty of
27 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 GNU General Public License for more details.
29
30 You should have received a copy of the GNU General Public License
31 along with FreeWRL/FreeX3D. If not, see <http://www.gnu.org/licenses/>.
32****************************************************************************/
33
34
35#ifndef __FREEWRL_JS_NATIVE_H__
36#define __FREEWRL_JS_NATIVE_H__
37
38
39typedef struct _BrowserNative {
40 /* int magic; does this really do anything ??? */
41 /* and, this really does nothing SV *sv_js; */
42 int dummyEntry;
43} BrowserNative;
44
45typedef struct _AnyNative {
46 int type;
47 int gc;
48 int *valueChanged;
49 union anyVrml *v;
50} AnyNative;
51
52typedef struct _SFNodeNative {
53 int valueChanged;
54 struct X3D_Node *handle;
55 char *X3DString;
56 int fieldsExpanded;
57} SFNodeNative;
58
59typedef struct _SFRotationNative {
60 int valueChanged;
61 struct SFRotation v;
62} SFRotationNative;
63
64typedef struct _SFColorNative {
65 int valueChanged;
66 struct SFColor v;
67} SFColorNative;
68
69typedef struct _SFColorRGBANative {
70 int valueChanged;
71 struct SFColorRGBA v;
72} SFColorRGBANative;
73
74typedef struct _SFVec2fNative {
75 int valueChanged;
76 struct SFVec2f v;
77} SFVec2fNative;
78
79typedef struct _SFVec3fNative {
80 int valueChanged;
81 struct SFColor v;
82} SFVec3fNative;
83
84typedef struct _SFVec4fNative {
85 int valueChanged;
86 struct SFVec4f v;
87} SFVec4fNative;
88
89typedef struct _SFVec2dNative {
90 int valueChanged;
91 struct SFVec2d v;
92} SFVec2dNative;
93
94typedef struct _SFVec3dNative {
95 int valueChanged;
96 struct SFVec3d v;
97} SFVec3dNative;
98
99typedef struct _SFVec4dNative {
100 int valueChanged;
101 struct SFVec4d v;
102} SFVec4dNative;
103
104typedef struct _SFImageNative {
105 int valueChanged;
106} SFImageNative;
107
108
109/*
110 * Adds additional (touchable) property to instance of a native
111 * type.
112 */
113extern JSBool
114addGlobalECMANativeProperty(void *cx,
115 void *glob,
116 char *name);
117
118extern JSBool
119addGlobalAssignProperty(void *cx,
120 void *glob,
121 char *name,
122 char *str);
123
124extern JSBool
125addSFNodeProperty(void *cx,
126 void *glob,
127 char *nodeName,
128 char *name,
129 char *str);
130
131extern void *AnyNativeNew(int type, union anyVrml* source, int *valueChanged);
132extern void AnyNativeAssign(void *top, void *fromp);
133
134extern void * SFNodeNativeNew(void);
135extern JSBool SFNodeNativeAssign(void *top, void *fromp);
136//int SFNodeNativeAssign(void* top, void* fromp);
137int SFNodeNativeEquals(void* top, void* fromp);
138
139extern void *SFRotationNativeNew(void);
140extern void SFRotationNativeAssign(void *top, void *fromp);
141extern void SFRotationNativeSet(void *p, struct Uni_String *sv);
142
143
144extern void* SFVec2fNativeNew(void);
145extern void SFVec2fNativeAssign(void* top, void* fromp);
146extern void SFVec2fNativeSet(void* p, struct Uni_String* sv);
147extern void *SFVec3fNativeNew(void);
148extern void SFVec3fNativeAssign(void *top, void *fromp);
149extern void SFVec3fNativeSet(void *p, struct Uni_String *sv);
150extern void* SFVec4fNativeNew(void);
151extern void SFVec4fNativeAssign(void* top, void* fromp);
152
153
154extern void* SFVec2dNativeNew(void);
155extern void SFVec2dNativeAssign(void* top, void* fromp);
156extern void SFVec2dNativeSet(void* p, struct Uni_String* sv);
157extern void* SFVec3dNativeNew(void);
158extern void SFVec3dNativeAssign(void* top, void* fromp);
159extern void* SFVec4dNativeNew(void);
160extern void SFVec4dNativeAssign(void* top, void* fromp);
161
162extern void * SFImageNativeNew(void);
163extern void SFImageNativeAssign(void *top, void *fromp);
164extern void SFImageNativeSet(void *p, struct Uni_String *sv);
165
166extern void *SFColorNativeNew(void);
167extern void SFColorNativeAssign(void *top, void *fromp);
168extern void SFColorNativeSet(void *p, struct Uni_String *sv);
169extern void * SFColorRGBANativeNew(void);
170extern void SFColorRGBANativeAssign(void *top, void *fromp);
171
172void * SFImageNativeNew(void);
173void SFImageNativeAssign(void *top, void *fromp);
174
175
176#endif /* __FREEWRL_JS_NATIVE_H__ */