FreeWRL / FreeX3D
4.3.0
CRoutes.h
1
/*
2
3
4
VRML-parsing routines in C.
5
6
*/
7
8
/****************************************************************************
9
This file is part of the FreeWRL/FreeX3D Distribution.
10
11
Copyright 2009 CRC Canada. (http://www.crc.gc.ca)
12
13
FreeWRL/FreeX3D is free software: you can redistribute it and/or modify
14
it under the terms of the GNU Lesser Public License as published by
15
the Free Software Foundation, either version 3 of the License, or
16
(at your option) any later version.
17
18
FreeWRL/FreeX3D is distributed in the hope that it will be useful,
19
but WITHOUT ANY WARRANTY; without even the implied warranty of
20
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
GNU General Public License for more details.
22
23
You should have received a copy of the GNU General Public License
24
along with FreeWRL/FreeX3D. If not, see <http://www.gnu.org/licenses/>.
25
****************************************************************************/
26
27
28
#ifndef __FREEWRL_CROUTES_H__
29
#define __FREEWRL_CROUTES_H__
30
31
/* grab the OpenCL defines here - not many will use it,but the CRStruct needs it */
32
/* we could do the include in all the referencing files, which would be cleaner... */
33
#ifdef HAVE_OPENCL
34
#include "../opencl/OpenCL_Utils.h"
35
#endif
36
37
/* C routes */
38
typedef
struct
_CRnodeStruct
{
39
struct
X3D_Node
*routeToNode;
40
int
foffset;
41
}
CRnodeStruct
;
42
43
44
struct
CRStruct
{
45
struct
X3D_Node
* routeFromNode;
46
int
fnptr;
47
int
tonode_count;
48
CRnodeStruct
*tonodes;
49
int
isActive;
50
int
len;
51
void (*interpptr)(
void
*);
/* pointer to an interpolator to run */
52
int
direction_flag;
/* if non-zero indicates script in/out,
53
proto in/out */
54
void
*extra;
/* used to pass a parameter (eg, 1 = addChildren..) */
55
int
intTimeStamp;
/* used for ROUTE loop breaking */
56
#ifdef HAVE_OPENCL
57
cl_kernel CL_Interpolator;
58
#endif
//HAVE_OPENCL
59
60
};
61
62
struct
brouteEnd
{
63
int
weak;
//0-normal strong node* end 1=weak and not loaded 2=weak and loaded(so node* available now, but may vanish back to 1)
64
char
*cnode;
// char* node name if its a weak reference -used for routing to IMPORT nodes, which show up late, and can leave
65
char
*cfield;
// char* field name ditto
66
struct
X3D_Node
* node;
//if its a strong reference
67
//int builtin; //flag 1 = builtin node, 0= script, proto with user fields (Q. what about routing to Script.url?)
68
//int Ofs; //integer offset for builtin field, in bytes from node*
69
int
ifield;
//integer routable field index - for scripts,protos the index of user field, for builtins the index into OFFESTS[] array
70
int
builtIn;
//TRUE if ifield is index into builtin fields, FALSE if index into user fields in script, broto etc
71
int
ftype
;
//field type
72
};
73
74
struct
brotoRoute
75
{
76
struct
brouteEnd
from;
77
struct
brouteEnd
to;
78
int
lastCommand;
//0-none or delete 1-add
79
int
ft;
80
//struct X3D_Node* fromNode;
81
//int fromOfs;
82
//struct X3D_Node* toNode;
83
//int toOfs;
84
};
85
86
#define REINITIALIZE_SORTED_NODES_FIELD(aaa,bbb) \
87
/* has this changed size? */
\
88
{\
89
int nc = aaa.n; \
90
if (nc != bbb.n) {\
91
\
92
FREE_IF_NZ(bbb.p); \
93
bbb.p = MALLOC(void *, sizeof (struct X3DNode *) * nc); \
94
} \
95
\
96
/* copy the nodes over; we will sort the sorted list */
\
97
memcpy(bbb.p, aaa.p, sizeof (struct X3DNode *) * nc); \
98
bbb.n = nc; \
99
}
100
101
102
struct
CRStruct
*getCRoutes();
103
104
/* function protos */
105
void
getSpecificRoute (
int
routeNo,
struct
X3D_Node
**fromNode,
int
*fromOffset,
struct
X3D_Node
**toNode,
int
*toOffset);
106
107
void
do_first(
void
);
108
void
delete_first(
struct
X3D_Node
*);
109
110
unsigned
long
upper_power_of_two(
unsigned
long
v);
111
112
void
mark_event (
struct
X3D_Node
*from,
int
fromoffset);
113
void
mark_event_check (
struct
X3D_Node
*from,
int
fromoffset,
char
*fn,
int
line);
114
void
Multimemcpy (
struct
X3D_Node
*toNode,
struct
X3D_Node
*fromNode,
void
*tn,
void
*fn,
size_t
multitype);
115
116
void
CRoutes_js_new (
int
num,
int
scriptType);
117
118
void
AddRemoveSFNodeFieldChild(
119
struct
X3D_Node
*parent,
120
struct
X3D_Node
**tn,
//target SFNode field
121
struct
X3D_Node
*node,
//node to set,add or remove from parent
122
int
ar,
//0=set,1=add,2=remove
123
char
*file,
124
int
line);
125
126
void
initializeAnyScripts();
127
void
cleanupDie(
int
num,
const
char
*msg);
128
129
#endif
/* __FREEWRL_CROUTES_H__ */
CRStruct
Definition
CRoutes.h:44
X3D_Node
Definition
Structs.h:2589
_CRnodeStruct
Definition
CRoutes.h:38
brotoRoute
Definition
CRoutes.h:75
brouteEnd
Definition
CRoutes.h:62
ftype
Definition
Component_Followers.c:195
src
lib
vrml_parser
CRoutes.h
Generated by
1.11.0