2 |
7u83 |
1 |
/*
|
7 |
7u83 |
2 |
* Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
|
|
|
3 |
* All rights reserved.
|
|
|
4 |
*
|
|
|
5 |
* Redistribution and use in source and binary forms, with or without
|
|
|
6 |
* modification, are permitted provided that the following conditions are met:
|
|
|
7 |
*
|
|
|
8 |
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
9 |
* this list of conditions and the following disclaimer.
|
|
|
10 |
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
11 |
* this list of conditions and the following disclaimer in the documentation
|
|
|
12 |
* and/or other materials provided with the distribution.
|
|
|
13 |
* 3. Neither the name of The TenDRA Project nor the names of its contributors
|
|
|
14 |
* may be used to endorse or promote products derived from this software
|
|
|
15 |
* without specific, prior written permission.
|
|
|
16 |
*
|
|
|
17 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
|
|
18 |
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
|
19 |
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
20 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
|
|
|
21 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
22 |
* EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
23 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
24 |
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
25 |
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
26 |
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
27 |
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
28 |
*
|
|
|
29 |
* $Id$
|
|
|
30 |
*/
|
|
|
31 |
/*
|
2 |
7u83 |
32 |
Crown Copyright (c) 1997
|
7 |
7u83 |
33 |
|
2 |
7u83 |
34 |
This TenDRA(r) Computer Program is subject to Copyright
|
|
|
35 |
owned by the United Kingdom Secretary of State for Defence
|
|
|
36 |
acting through the Defence Evaluation and Research Agency
|
|
|
37 |
(DERA). It is made available to Recipients with a
|
|
|
38 |
royalty-free licence for its use, reproduction, transfer
|
|
|
39 |
to other parties and amendment for any purpose not excluding
|
|
|
40 |
product development provided that any such use et cetera
|
|
|
41 |
shall be deemed to be acceptance of the following conditions:-
|
7 |
7u83 |
42 |
|
2 |
7u83 |
43 |
(1) Its Recipients shall ensure that this Notice is
|
|
|
44 |
reproduced upon any copies or amended versions of it;
|
7 |
7u83 |
45 |
|
2 |
7u83 |
46 |
(2) Any amended version of it shall be clearly marked to
|
|
|
47 |
show both the nature of and the organisation responsible
|
|
|
48 |
for the relevant amendment or amendments;
|
7 |
7u83 |
49 |
|
2 |
7u83 |
50 |
(3) Its onward transfer from a recipient to another
|
|
|
51 |
party shall be deemed to be that party's acceptance of
|
|
|
52 |
these conditions;
|
7 |
7u83 |
53 |
|
2 |
7u83 |
54 |
(4) DERA gives no warranty or assurance as to its
|
|
|
55 |
quality or suitability for any purpose and DERA accepts
|
|
|
56 |
no liability whatsoever in relation to any use to which
|
|
|
57 |
it may be put.
|
|
|
58 |
*/
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
/*** action.c --- Action ADT.
|
|
|
62 |
*
|
|
|
63 |
** Author: Steve Folkes <smf@hermes.mod.uk>
|
|
|
64 |
*
|
|
|
65 |
*** Commentary:
|
|
|
66 |
*
|
|
|
67 |
* This file implements the action manipulation routines.
|
|
|
68 |
*
|
|
|
69 |
*** Change Log:
|
|
|
70 |
* $Log: action.c,v $
|
|
|
71 |
* Revision 1.1.1.1 1998/01/17 15:57:46 release
|
|
|
72 |
* First version to be checked into rolling release.
|
|
|
73 |
*
|
|
|
74 |
* Revision 1.2 1994/12/15 09:57:54 smf
|
|
|
75 |
* Brought into line with OSSG C Coding Standards Document, as per
|
|
|
76 |
* "CR94_178.sid+tld-update".
|
|
|
77 |
*
|
|
|
78 |
* Revision 1.1.1.1 1994/07/25 16:04:29 smf
|
|
|
79 |
* Initial import of SID 1.8 non shared files.
|
|
|
80 |
*
|
|
|
81 |
**/
|
|
|
82 |
|
|
|
83 |
/****************************************************************************/
|
|
|
84 |
|
|
|
85 |
#include "action.h"
|
|
|
86 |
#include "basic.h"
|
|
|
87 |
#include "name.h"
|
|
|
88 |
#include "rule.h"
|
|
|
89 |
#include "type.h"
|
|
|
90 |
|
|
|
91 |
/*--------------------------------------------------------------------------*/
|
|
|
92 |
|
7 |
7u83 |
93 |
#if FS_WEAK_PROTOTYPES
|
|
|
94 |
#pragma TenDRA keyword KW_WEAK_PROTOTYPE for weak
|
|
|
95 |
#else
|
|
|
96 |
#define KW_WEAK_PROTOTYPE
|
|
|
97 |
#endif
|
|
|
98 |
|
2 |
7u83 |
99 |
ActionP
|
7 |
7u83 |
100 |
action_create(void)
|
2 |
7u83 |
101 |
{
|
7 |
7u83 |
102 |
ActionP action = ALLOCATE(ActionT);
|
2 |
7u83 |
103 |
|
7 |
7u83 |
104 |
types_init(action_param(action));
|
|
|
105 |
types_init(action_result(action));
|
|
|
106 |
action->code = NIL(GenericP);
|
|
|
107 |
return(action);
|
2 |
7u83 |
108 |
}
|
|
|
109 |
|
|
|
110 |
#ifdef FS_FAST
|
|
|
111 |
#undef action_param
|
|
|
112 |
#endif /* defined (FS_FAST) */
|
|
|
113 |
TypeTupleP
|
7 |
7u83 |
114 |
action_param(ActionP action)
|
2 |
7u83 |
115 |
{
|
7 |
7u83 |
116 |
return(&(action->param));
|
2 |
7u83 |
117 |
}
|
|
|
118 |
#ifdef FS_FAST
|
7 |
7u83 |
119 |
#define action_param(a) (&((a)->param))
|
2 |
7u83 |
120 |
#endif /* defined (FS_FAST) */
|
|
|
121 |
|
|
|
122 |
#ifdef FS_FAST
|
|
|
123 |
#undef action_result
|
|
|
124 |
#endif /* defined (FS_FAST) */
|
|
|
125 |
TypeTupleP
|
7 |
7u83 |
126 |
action_result(ActionP action)
|
2 |
7u83 |
127 |
{
|
7 |
7u83 |
128 |
return(&(action->result));
|
2 |
7u83 |
129 |
}
|
|
|
130 |
#ifdef FS_FAST
|
7 |
7u83 |
131 |
#define action_result(a) (&((a)->result))
|
2 |
7u83 |
132 |
#endif /* defined (FS_FAST) */
|
|
|
133 |
|
|
|
134 |
#ifdef FS_FAST
|
|
|
135 |
#undef action_get_code
|
|
|
136 |
#endif /* defined (FS_FAST) */
|
|
|
137 |
GenericP
|
7 |
7u83 |
138 |
action_get_code(ActionP action)
|
2 |
7u83 |
139 |
{
|
7 |
7u83 |
140 |
return(action->code);
|
2 |
7u83 |
141 |
}
|
|
|
142 |
#ifdef FS_FAST
|
7 |
7u83 |
143 |
#define action_get_code(a) ((a)->code)
|
2 |
7u83 |
144 |
#endif /* defined (FS_FAST) */
|
|
|
145 |
|
|
|
146 |
#ifdef FS_FAST
|
|
|
147 |
#undef action_set_code
|
|
|
148 |
#endif /* defined (FS_FAST) */
|
|
|
149 |
void
|
7 |
7u83 |
150 |
action_set_code(ActionP action, GenericP code)
|
2 |
7u83 |
151 |
{
|
|
|
152 |
action->code = code;
|
|
|
153 |
}
|
|
|
154 |
#ifdef FS_FAST
|
7 |
7u83 |
155 |
#define action_set_code(a, c) ((a)->code = (c))
|
2 |
7u83 |
156 |
#endif /* defined (FS_FAST) */
|
|
|
157 |
|
|
|
158 |
void
|
7 |
7u83 |
159 |
action_iter_for_table(ActionP action, BoolT full,
|
|
|
160 |
void(*proc)KW_WEAK_PROTOTYPE(EntryP, GenericP),
|
|
|
161 |
GenericP closure)
|
2 |
7u83 |
162 |
{
|
|
|
163 |
if (full) {
|
7 |
7u83 |
164 |
types_iter_for_table(action_param(action), proc, closure);
|
|
|
165 |
types_iter_for_table(action_result(action), proc, closure);
|
2 |
7u83 |
166 |
}
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
/*
|
|
|
170 |
* Local variables(smf):
|
|
|
171 |
* eval: (include::add-path-entry "../os-interface" "../library")
|
|
|
172 |
* eval: (include::add-path-entry "../generated")
|
|
|
173 |
* end:
|
|
|
174 |
**/
|