/[ascend]/trunk/base/generic/compiler/statement.h
ViewVC logotype

Contents of /trunk/base/generic/compiler/statement.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 301 - (show annotations) (download) (as text)
Mon Feb 20 07:39:14 2006 UTC (18 years, 4 months ago) by johnpye
File MIME type: text/x-chdr
File size: 66642 byte(s)
Documentation and indentation changes
1 /*
2 * Statement list module
3 * by Tom Epperly
4 * August 8, 1989
5 * Version: $Revision: 1.26 $
6 * Version control file: $RCSfile: statement.h,v $
7 * Date last modified: $Date: 1998/04/21 23:49:51 $
8 * Last modified by: $Author: ballan $
9 *
10 * This file is part of the Ascend Language Interpreter.
11 *
12 * Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
13 *
14 * The Ascend Language Interpreter is free software; you can redistribute
15 * it and/or modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 *
19 * The Ascend Language Interpreter is distributed in hope that it will be
20 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with the program; if not, write to the Free Software Foundation,
26 * Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named
27 * COPYING.
28 */
29
30 /** @file
31 * Statement list module.
32 * <pre>
33 * When #including statement.h, make sure these files are #included first:
34 * #include "utilities/ascConfig.h"
35 * #include "fractions.h"
36 * #include "compiler.h"
37 * #include "dimen.h"
38 * #include "types.h"
39 * #include "stattypes.h"
40 * </pre>
41 */
42
43 #ifndef __STATEMENT_H_SEEN__
44 #define __STATEMENT_H_SEEN__
45
46 extern void AddContext(struct StatementList *slist ,unsigned int c);
47 /**<
48 *
49 * Adds the given context flags, c, to the statements in the list
50 * using the | operator, so that existing context
51 * bits are preserved (other than context_MODEL).
52 * Handles NULL slist gracefully.<br><br>
53 *
54 * This function is recursive. Those statements which contain another
55 * statement list will have those lists visited with this function,
56 * adding the flags we have here. Context is a cumulative notion,
57 * after all. Careless use will make this a tad expensive for
58 * deeply nested code.<br><br>
59 *
60 * All the create functions below return a statement (if successful)
61 * which will have a context value of context_MODEL (0).<br><br>
62 *
63 * VRR. Added the context flags for statements inside WHEN, SELECT and
64 * CONDITIONAL. 2/3/97 and SWITCH 29/3/97
65 */
66
67
68 extern unsigned int SlistHasWhat(struct StatementList *slist);
69 /**<
70 * Returns an unsigned with the low bits set according to whether or
71 * not there is a statement of the indicated class in the slist given.
72 * The value is determined by examining the list, not by looking up
73 * some attribute.<br><br>
74 * The return type is valid as a contains field.
75 */
76
77 extern struct Statement *CreateALIASES(struct VariableList *vl,
78 struct Name *n);
79 /**<
80 * Create an ALIASES statement.
81 * Initializes the reference count to one.
82 * The statement's module is set to the current open module.
83 * The statement's line number is set to the current line number.
84 *
85 * @param vl variable list
86 * @param n instance name
87 */
88
89 extern struct Statement *CreateARR(struct VariableList *aname,
90 struct VariableList *il,
91 struct VariableList *setname,
92 int intset,
93 struct Set *setvals);
94 /**<
95 * Create a compound ALIASES-IS_A statement.
96 * VariableListLength(avlname) and VariableListLength(setname) should
97 * be 1.
98 * setvals may be NULL, rest may must be supplied.
99 * Initializes the reference count to one.
100 * The statement's module is set to the current open module.
101 * The statement's line number is set to the current line number.
102 *
103 * @param aname avlname lhs name (in varlist form) of array being made.
104 * @param il rhs varlist of things to alias.
105 * @param setname name (in varlist form) of set instance to create which
106 * indexes avlname.
107 * @param intset symbol (0) or integer (1) set instance.
108 * @param setvals set expression for subscripts. Must evaluate to match
109 * count of items il evaluates to if setvals != NULL.
110 */
111
112 extern struct Statement *CreateISA(struct VariableList *vl,
113 symchar *t,
114 struct Set *ta,
115 symchar *st);
116 /**<
117 * Initializes the reference count to one.
118 * The statement's module is set to the current open module.
119 * The statement's line number is set to the current line number.
120 *
121 * @param vl variable list
122 * @param t instance type
123 * @param ta arguments for type t
124 * @param st set type
125 */
126
127 extern struct Statement *CreateWILLBE(struct VariableList *vl,
128 symchar *t,
129 struct Set *ta,
130 symchar *st,
131 struct Expr *cv);
132 /**<
133 * Initializes the reference count to one.
134 * The statement's module is set to the current open module.
135 * The statement's line number is set to the current line number.
136 *
137 * @param vl variable list
138 * @param t instance type
139 * @param ta arguments for type t
140 * @param st set type (possibly)
141 * @param cv WILL_BE value specification.
142 */
143
144 extern struct Statement *CreateIRT(struct VariableList *vl,
145 symchar *t,
146 struct Set *ta);
147 /**<
148 * Create an IS_REFINED_TO statement node.
149 * The statement's module is set to the current open module.
150 * The statement's line number is set to the current line number.
151 *
152 * @param vl variable list
153 * @param t instance type
154 * @param ta arguments for type t
155 */
156
157 extern struct Statement *CreateAA(struct VariableList *vl);
158 /**<
159 * Create an ARE_ALIKE statement node.
160 * The statement's module is set to the current open module.
161 * The statement's line number is set to the current line number.
162 *
163 * @param vl variable list
164 */
165
166 extern struct Statement *CreateATS(struct VariableList *vl);
167 /**<
168 * Create an ARE_THE_SAME statement node.
169 * The statement's module is set to the current open module.
170 * The statement's line number is set to the current line number.
171 *
172 * @param vl variable list
173 */
174
175 extern struct Statement *CreateFIX(struct VariableList *vl);
176 /**<
177 Create a 'FIX' statement node. The statements module/line number
178 are stored, and the variable list is also stored.
179 */
180
181 extern struct Statement *CreateWBTS(struct VariableList *vl);
182 /**<
183 * Create an WILL_BE_THE_SAME statement node.
184 * The statement's module is set to the current open module.
185 * The statement's line number is set to the current line number.
186 *
187 * @param vl variable list
188 */
189
190 extern struct Statement *CreateWNBTS(struct VariableList *vl);
191 /**<
192 * Create an WILL_NOT_BE_THE_SAME statement node.
193 * The statement's module is set to the current open module.
194 * The statement's line number is set to the current line number.
195 *
196 * @param vl variable list
197 */
198
199 extern struct Statement *CreateFOR(symchar *index,
200 struct Expr *expr,
201 struct StatementList *stmts,
202 enum ForOrder order,
203 enum ForKind kind);
204 /**<
205 * Create a FOR statement node.
206 * The statement's module is set to the current open module.
207 * The statement's line number is set to the current line number.
208 * The statement list is checked for presence of relations,
209 * default assignments, and structural assignments and marked
210 * as needed.
211 * The context bit context_FOR will be set on the statements
212 * in the list stmts that have a context field.
213 */
214
215 extern struct Statement *CreateREL(struct Name *n,
216 struct Expr *relation);
217 /**<
218 * The statement's module is set to the current open module.
219 * The statement's line number is set to the current line number.
220 */
221
222 extern struct Statement *CreateLOGREL(struct Name *n,
223 struct Expr *logrel);
224 /**<
225 * The statement's module is set to the current open module.
226 * The statement's line number is set to the current line number.
227 */
228
229
230 extern struct Statement *CreateEXTERN(int mode,
231 struct Name *n,
232 CONST char *funcname,
233 struct VariableList *vl,
234 struct Name *data,
235 struct Name *scope);
236 /**<
237 Create a blackbox or glassbox function statement or an external method statement.
238 @return The created statement
239
240 @param mode 0 = procedural; 1 = glassbox declarative; 2 = blackbox declarative
241 @param n Name of the relation (not used in procedural calls)
242 @param vl Parameters supplied for the external function/method
243 @param data Data arguments, only used in black/glass box functions, else set NULL.
244 @param scope scope at which external relations are to be embedded. Applicable only to glassboxes.
245 */
246
247 extern struct Statement *CreateFlow(enum FlowControl fc,
248 CONST char *msgtext);
249 /**<
250 * Create a BREAK, CONTINUE, FALL_THROUGH, RETURN, STOP as
251 * indicated by fc. If msgtext is not NULL, it is
252 * converted to a bracechar and stored as the message.
253 */
254
255 extern struct Statement *CreateREF(struct VariableList *vl,
256 symchar *ref_name,
257 symchar *st,
258 int mode);
259 /**<
260 * Creates a new REFERENCE type statement. ref_name is the name of
261 * the type or prototype being referred to.
262 * Initializes the reference count to one.
263 * The statement's module is set to the current open module.
264 * The statement's line number is set to the current line number.<br><br>
265 *
266 * NOT IMPLEMENTED.
267 *
268 * @param mode 0 = copy semantics (_IS_);
269 * 1 = pure reference semantics; (_REFERS_)
270 */
271
272 extern void SetRelationName(struct Statement *stat, struct Name *n);
273 /**<
274 * This procedure provides a mechanism for unnamed relations to be named.
275 * It should only be called on relation statements that are unnamed. It
276 * will name the relation with the name provided.
277 */
278
279 extern void SetLogicalRelName(struct Statement *stat, struct Name *n);
280 /**<
281 * This procedure provides a mechanism for unnamed relations to be named.
282 * It should only be called on logcial relation statements that are unnamed.
283 * It will name the logical relation with the name provided.
284 */
285
286
287 extern struct Statement *CreateRUN(struct Name *n, struct Name *type);
288 /**<
289 * Create a run statement with procedure name n, and/or class type.
290 * If type is non NULL, then so called 'class access is to be used to
291 * access the procedure. This is equivalent to the "::" in some object
292 * oriented languages.
293 * The statement's module is set to the current open module.
294 * The statement's line number is set to the current line number.
295 */
296
297 extern struct Statement *CreateCALL(symchar *n, struct Set *arglist);
298 /**<
299 * Create a CALL statement with name n and arguments argList.
300 * argList may be NULL.
301 * The statement's module is set to the current open module.
302 * The statement's line number is set to the current line number.
303 */
304
305 extern struct Statement *CreateASSERT(struct Expr *ex);
306 /**
307 @param ex test expression.
308
309 Create a ASSERT statement with test expression 'ex'. If the expression
310 evaluates to false, an error message will be shown. Implemented for use
311 in 'self_test' functionality.
312 */
313
314 extern struct Statement *CreateIF(struct Expr *ex,
315 struct StatementList *ifblock,
316 struct StatementList *elseblock);
317 /**<
318 * Create an IF-THEN-ELSE structure. If the else block is omitted,
319 * pass in NULL for elseblock.
320 * The statement's module is set to the current open module.
321 * The statement's line number is set to the current line number.
322 */
323
324 extern struct Statement *CreateWhile(struct Expr *test,
325 struct StatementList *body);
326 /**<
327 * Create a WHILE-DO structure.
328 * The statement's module is set to the current open module.
329 * The statement's line number is set to the current line number.
330 */
331
332 extern struct Statement *CreateWHEN(struct Name *wname,
333 struct VariableList *vlist,
334 struct WhenList *wl);
335 /**<
336 * Crease a WHEN statement structure.
337 * The statement's module is set to the current open module.
338 * The statement's line number is set to the current line number.
339 */
340
341 extern struct Statement *CreateFNAME(struct Name *name);
342 /**<
343 * Crease a FNAME statement structure.
344 * The statement's module is set to the current open module.
345 * The statement's line number is set to the current line number.
346 * Name is the name of a model or a relation inside a WHEN statement
347 */
348
349 extern struct Statement *CreateSWITCH(struct VariableList *v,
350 struct SwitchList *sw);
351 /**<
352 * Crease a SWITCH statement structure.
353 * The statement's module is set to the current open module.
354 * The statement's line number is set to the current line number.
355 */
356
357 extern struct Statement *CreateCOND(struct StatementList *stat);
358 /**<
359 * Create a CONDITIONAL statement structure.
360 * The statement's module is set to the current open module.
361 * The statement's line number is set to the current line number.
362 */
363
364 extern struct Statement *CreateSELECT(struct VariableList *v,
365 struct SelectList *sel);
366 /**<
367 * Crease a SELECT statement structure.
368 * The statement's module is set to the current open module.
369 * The statement's line number is set to the current line number.
370 */
371
372 extern struct Statement *CreateASSIGN(struct Name *n,
373 struct Expr *rhs);
374 /**<
375 * Create a default assignment statement node.
376 * The statement's module is set to the current open module.
377 * The statement's line number is set to the current line number.
378 */
379
380 extern struct Statement *CreateCASSIGN(struct Name *n, struct Expr *rhs);
381 /**<
382 * Create a structural assignment statement node.
383 * The statement's module is set to the current open module.
384 * The statement's line number is set to the current line number.
385 */
386
387 #ifdef NDEBUG
388 #define StatementType(s) ((s)->t)
389 #else
390 #define StatementType(s) StatementTypeF(s)
391 #endif
392 /**<
393 * Return the statement type of s.
394 * @param s CONST struct Statement*, the statement to query.
395 * @return The type as an enum stat_t.
396 * @see StatementTypeF()
397 */
398 extern enum stat_t StatementTypeF(CONST struct Statement *s);
399 /**<
400 * Implementation function for StatementType(). Do not call this
401 * function directly - use StatementType() instead.
402 */
403
404 #ifdef NDEBUG
405 #define StatementModule(s) ((s)->mod)
406 #else
407 #define StatementModule(s) StatementModuleF(s)
408 #endif
409 /**<
410 * Return the module that statement s was defined in.
411 * @param s CONST struct Statement*, the statement to query.
412 * @return The defining module as a struct module_t*.
413 * @see StatementModuleF()
414 */
415 extern struct module_t *StatementModuleF(CONST struct Statement *s);
416 /**<
417 * Return the module that statement s was defined in.
418 * Implementation function for StatementModule(). Do not call this
419 * function directly - use StatementModule() instead.
420 */
421
422 #ifdef NDEBUG
423 #define StatementLineNum(s) ((s)->linenum)
424 #else
425 #define StatementLineNum(s) StatementLineNumF(s)
426 #endif
427 /**<
428 * Return the line number where statement s was defined.
429 * @param s CONST struct Statement*, the statement to query.
430 * @return The line number as an unsigned long.
431 * @see StatementLineNumF()
432 */
433 extern unsigned long StatementLineNumF(CONST struct Statement *s);
434 /**<
435 * Return the line number where statement s was defined.
436 * Implementation function for StatementLineNum(). Do not call this
437 * function directly - use StatementLineNum() instead.
438 */
439
440 #ifdef NDEBUG
441 #define CopyStatement(s) if ((s)->ref_count<MAXREFCOUNT) (((s)->ref_count)++)
442 #else
443 #define CopyStatement(s) CopyStatementF(s)
444 #endif
445 /**<
446 * Make a new reference to statement s. This does not actually make a new
447 * copy in memory of the data in s: it only increases the reference count.
448 * If you need to modify the statement, you should use CopyToModify which
449 * is defined below.
450 * You don't need to worry about the count overflowing unless the user is
451 * utterly insane.
452 * @param s CONST struct Statement*, the statement to query.
453 * @return The new reference as a struct Statement*.
454 * @see CopyStatementF()
455 */
456 extern struct Statement *CopyStatementF(struct Statement *s);
457 /**<
458 * Implementation function for CopyStatement(). Do not call this
459 * function directly - use CopyStatement() instead.
460 */
461
462 extern void DestroyStatement(struct Statement *s);
463 /**<
464 * Delete a reference to statement s. This make not actually deallocate
465 * the memory associated with s if there are still other references to
466 * the statement. If there aren't any, remaining references it deallocates
467 * the memory.
468 */
469
470 extern struct Statement *CopyToModify(struct Statement *s);
471 /**<
472 * This will always make a new separate copy of the statement, so that
473 * it can be modified. The statement reference count is initialize to
474 * one.
475 */
476
477 #ifndef NDEBUG
478 #define GetStatContext(s) ((s)->context)
479 #else
480 #define GetStatContext(s) GetStatContextF(s)
481 #endif
482 /**<
483 * Returns the context bits of the statement.
484 * If statement is of a type that doesn't have context bits,
485 * returns context_MODEL and issues warning message.
486 * @param s CONST struct Statement*, the statement to query.
487 * @return The context as an unsigned int.
488 * @see GetStatContextF()
489 */
490 extern unsigned int GetStatContextF(CONST struct Statement *s);
491 /**<
492 * Implementation function for GetStatContext(). Do not call this
493 * function directly - use GetStatContext() instead.
494 */
495
496 #define StatInFOR(stat) (GetStatContext(stat)&context_FOR)
497 /**<
498 * Returns a nonzero value (context_FOR) if the statement is inside
499 * the statement list of a FOR statement.
500 */
501
502 #define StatInMETH(stat) (GetStatContext(stat)&context_METH)
503 /**<
504 * Returns a nonzero value (context_METH) if the statement is inside
505 * the statement list of a method.
506 */
507
508 #define StatWrong(stat) (GetStatContext(stat)&context_WRONG)
509 /**<
510 * Returns a nonzero value (context_WRONG) if the statement is probably
511 * incorrect in all situations.
512 */
513
514 #define StatInCOND(stat) (GetStatContext(stat)&context_COND)
515 /**<
516 * Returns a nonzero value (context_COND) if the statement is inside
517 * the statement list of a CONDITIONAL statement.
518 */
519
520 #define StatInWHEN(stat) (GetStatContext(stat)&context_WHEN)
521 /**<
522 * Returns a nonzero value (context_WHEN) if the statement is inside
523 * the statement list of a WHEN statement.
524 */
525
526 #define StatInSELECT(stat) (GetStatContext(stat)&context_SELECT)
527 /**<
528 * Returns a nonzero value (context_SELECT) if the statement is inside
529 * the statement list of a SELECT statement.
530 */
531
532 #define StatInIF(stat) (GetStatContext(stat)&context_IF)
533 /**<
534 * Returns a nonzero value (context_IF) if the statement is inside
535 * the thenblock or elseblock of an IF statement.
536 */
537
538 #define StatInSWITCH(stat) (GetStatContext(stat)&context_SWITCH)
539 /**<
540 * Returns a nonzero value (context_SWITCH) if the statement is inside
541 * the statement list of a SWITCH statement.
542 */
543
544 #define StatModelParameter(stat) (GetStatContext(stat)&context_MODPARAM)
545 /**<
546 * Returns a nonzero value (context_MODPARAM) if the statement is
547 * in a parameterized type list. (or at least came from there).
548 */
549
550 extern void SetStatContext(struct Statement *s, unsigned int bits);
551 /**<
552 * Sets the context field of a statement to the value, bits, given.
553 * E.g. to turn on the FOR context bit,
554 * This function should only be used at parse time, and probably not
555 * then -- see MarkStatContext for the proper interface.
556 * Calling it on a statement type without a context field causes
557 * an exit(2) and an error message.
558 */
559
560 extern void MarkStatContext(struct Statement *s, unsigned int bits);
561 /**<
562 * Adds the context bits given in bits to the context field of the
563 * statement given.
564 * E.g. to turn on the FOR context bit,
565 * MarkStatContext(s,context_FOR);
566 * This function should only be used at parse time.
567 * Unfortunately, until we have proof that the parser is err tight,
568 * we might also use this function at points in instantiation where
569 * we have proved that a statement is always going to be impossible.
570 */
571
572 extern struct VariableList *GetStatVarList(CONST struct Statement *s);
573 /**<
574 * Returns the variable list of a
575 * IS_A, IS_REFINED_TO, WILL_BE, WILL_BE_THE_SAME,
576 * ARE_ALIKE, ARE_THE_SAME, ALIASES or ALIASES-ISA(ARR) statement.
577 * It must be passed one of these types of statement.
578 * Other statements will return NULL or crash.
579 */
580
581 /*== StateIs functions ==*/
582
583 #ifdef NDEBUG
584 #define GetStatType(s) ((s)->v.i.type)
585 #else
586 #define GetStatType(s) GetStatTypeF(s)
587 #endif
588 /**<
589 * Return the type field of an IS_A, WILL_BE, or IS_REFINED_TO statement.
590 * It must be passed one of these types of statement.
591 * Other statements will return NULL or crash.
592 * See also GetStatTypeDesc(), type_desc.h.
593 * @param s CONST struct Statement*, the statement to query.
594 * @return The type field as a symchar*.
595 * @see GetStatTypeF()
596 */
597 extern symchar *GetStatTypeF(CONST struct Statement *s);
598 /**<
599 * Implementation function for GetStatType(). Do not call this
600 * function directly - use GetStatType() instead.
601 */
602
603 #ifdef NDEBUG
604 #define GetStatTypeArgs(s) ((s)->v.i.typeargs)
605 #else
606 #define GetStatTypeArgs(s) GetStatTypeArgsF(s)
607 #endif
608 /**<
609 * Return the typeargs field of an IS_A, WILL_BE or IS_REFINED_TO statement.
610 * It must be passed one of these types of statement.
611 * Proper WILL_BE statements should always return NULL.
612 * Other statements will return NULL or crash.
613 * @param s CONST struct Statement*, the statement to query.
614 * @return The typergs field as a CONST struct Set*.
615 * @see GetStatTypeArgsF()
616 */
617 extern CONST struct Set *GetStatTypeArgsF(CONST struct Statement *s);
618 /**<
619 * Implementation function for GetStatTypeArgs(). Do not call this
620 * function directly - use GetStatTypeArgs() instead.
621 */
622
623 extern unsigned int GetStatNeedsArgs(CONST struct Statement *s);
624 /**<
625 * Returns the number of arguments required to satisfy the type of the
626 * ISA or IRT statement given. Note that this number is not necessarily
627 * the number of arguments actually in the statement as the user wrote it.
628 * The number comes from the typedescription in the statement.
629 */
630
631 #ifdef NDEBUG
632 #define GetStatSetType(s) ((s)->v.i.settype)
633 #else
634 #define GetStatSetType(s) GetStatSetTypeF(s)
635 #endif
636 /**<
637 * Return the type of set for an IS_A, WILL_BE.
638 * Often this will be NULL, which
639 * means that there is no "OF" part to the IS_A/WILL_BE.
640 * @param s CONST struct Statement*, the statement to query.
641 * @return The type as a symchar*.
642 * @see GetStatSetTypeF()
643 */
644 extern symchar *GetStatSetTypeF(CONST struct Statement *s);
645 /**<
646 * Implementation function for GetStatSetType(). Do not call this
647 * function directly - use GetStatSetType() instead.
648 */
649
650 #ifdef NDEBUG
651 #define GetStatCheckValue(s) ((s)->v.i.checkvalue)
652 #else
653 #define GetStatCheckValue(s) GetStatCheckValueF(s)
654 #endif
655 /**<
656 * Return the value expression for a WILLBE. Often this will be NULL,
657 * which means that there is no WITH_VALUE part to the WILL_BE.
658 * @param s CONST struct Statement*, the statement to query.
659 * @return The expression as a CONST struct Expr*.
660 * @see GetStatCheckValueF()
661 */
662 extern CONST struct Expr *GetStatCheckValueF(CONST struct Statement *s);
663 /**<
664 * Implementation function for GetStatCheckValue(). Do not call this
665 * function directly - use GetStatCheckValue() instead.
666 */
667
668 /* * * StateAlias functions * * */
669
670 #ifdef NDEBUG
671 #define AliasStatName(s) ((s)->v.ali.u.nptr)
672 #else
673 #define AliasStatName(s) AliasStatNameF(s)
674 #endif
675 /**<
676 * Return the Name RHS from a simple ALIASES statement.
677 * See stattypes.h for meaning of Name.
678 * @param s CONST struct Statement*, the statement to query.
679 * @return The name as a CONST struct Name*.
680 * @see AliasStatNameF()
681 */
682 extern CONST struct Name *AliasStatNameF(CONST struct Statement *s);
683 /**<
684 * Implementation function for AliasStatName(). Do not call this
685 * function directly - use AliasStatName() instead.
686 */
687
688 #ifdef NDEBUG
689 #define ArrayStatAvlNames(s) ((s)->v.ali.u.avlname)
690 #else
691 #define ArrayStatAvlNames(s) ArrayStatAvlNamesF(s)
692 #endif
693 /**<
694 * Return the LHS (new array(s)) being defined from an ARR statement.
695 * See stattypes.h for meaning of vlist.
696 * syntax is currently:
697 * <pre>
698 * AvlNames ALIASES (VarList)
699 * WHERE SetName IS_A set OF IntSet WITH_VALUE (SetValues);
700 * </pre>
701 * while the standard ALIASES statement is just:
702 * <pre>
703 * VarList ALIASES Name;
704 * </pre>
705 * @param s CONST struct Statement*, the statement to query.
706 * @return The LHS as a CONST struct VariableList*.
707 * @see ArrayStatAvlNamesF()
708 */
709 extern CONST struct VariableList *ArrayStatAvlNamesF(CONST struct Statement *s);
710 /**<
711 * Implementation function for ArrayStatAvlNames(). Do not call this
712 * function directly - use ArrayStatAvlNames() instead.
713 */
714
715 #ifdef NDEBUG
716 #define ArrayStatSetName(s) ((s)->v.ali.c.setname)
717 #else
718 #define ArrayStatSetName(s) ArrayStatSetNameF(s)
719 #endif
720 /**<
721 * Return the name of set for an ARR statement.
722 * @param s CONST struct Statement*, the statement to query.
723 * @return The name as a CONST struct VariableList*.
724 * @see ArrayStatSetNameF()
725 */
726 extern CONST struct VariableList *ArrayStatSetNameF(CONST struct Statement *s);
727 /**<
728 * Implementation function for ArrayStatSetName(). Do not call this
729 * function directly - use ArrayStatSetName() instead.
730 */
731
732 #ifdef NDEBUG
733 #define ArrayStatIntSet(s) ((s)->v.ali.c.intset)
734 #else
735 #define ArrayStatIntSet(s) ArrayStatIntSetF(s)
736 #endif
737 /**<
738 * Return 0 or 1 corresponding to set being defined as symbol or integer.
739 * It must be passed an ARR statement.
740 * Other statements will return goop or crash.
741 * @param s CONST struct Statement*, the statement to query.
742 * @return The type code as an int.
743 * @see ArrayStatIntSetF()
744 */
745 extern int ArrayStatIntSetF(CONST struct Statement *s);
746 /**<
747 * Implementation function for ArrayStatIntSet(). Do not call this
748 * function directly - use ArrayStatIntSet() instead.
749 */
750
751 #ifdef NDEBUG
752 #define ArrayStatSetValues(s) ((s)->v.ali.c.setvals)
753 #else
754 #define ArrayStatSetValues(s) ArrayStatSetValuesF(s)
755 #endif
756 /**<
757 * Return the user proposed set of values to use for array names.
758 * It must be passed an ARR statement. May be empty/NULL set.
759 * (this is the list after WITH_VALUE)
760 * Other statements will return goop or crash.
761 * @param s CONST struct Statement*, the statement to query.
762 * @return The set as a CONST struct Set*.
763 * @see ArrayStatSetValuesF()
764 */
765 extern CONST struct Set *ArrayStatSetValuesF(CONST struct Statement *s);
766 /**<
767 * Implementation function for ArrayStatSetValues(). Do not call this
768 * function directly - use ArrayStatSetValues() instead.
769 */
770
771 /* * * StateFOR functions * * */
772
773 #ifdef NDEBUG
774 #define ForStatIndex(s) ((s)->v.f.index)
775 #else
776 #define ForStatIndex(s) ForStatIndexF(s)
777 #endif
778 /**<
779 * Return the FOR index variable identifier.
780 * @param s CONST struct Statement*, the statement to query.
781 * @return The identifier as a symchar*.
782 * @see ForStatIndexF()
783 */
784 extern symchar *ForStatIndexF(CONST struct Statement *s);
785 /**<
786 * Implementation function for ForStatIndex(). Do not call this
787 * function directly - use ForStatIndex() instead.
788 */
789
790 #ifdef NDEBUG
791 #define ForStatExpr(s) ((s)->v.f.e)
792 #else
793 #define ForStatExpr(s) ForStatExprF(s)
794 #endif
795 /**<
796 * Return the expression of values that the index variable takes.
797 * @param s CONST struct Statement*, the statement to query.
798 * @return The expression as a struct Expr*.
799 * @see ForStatExprF()
800 */
801 extern struct Expr *ForStatExprF(CONST struct Statement *s);
802 /**<
803 * Implementation function for ForStatExpr(). Do not call this
804 * function directly - use ForStatExpr() instead.
805 */
806
807 #ifdef NDEBUG
808 #define ForStatStmts(s) ((s)->v.f.stmts)
809 #else
810 #define ForStatStmts(s) ForStatStmtsF(s)
811 #endif
812 /**<
813 * Return the list of statements that are in the body of the FOR construct.
814 * @param s CONST struct Statement*, the statement to query.
815 * @return The list as a struct StatementList*.
816 * @see ForStatStmtsF()
817 */
818 extern struct StatementList *ForStatStmtsF(CONST struct Statement *s);
819 /**<
820 * Implementation function for ForStatStmts(). Do not call this
821 * function directly - use ForStatStmts() instead.
822 */
823
824 #ifdef NDEBUG
825 #define ForLoopKind(s) ((s)->v.f.kind)
826 #else
827 #define ForLoopKind(s) ForLoopKindF(s)
828 #endif
829 /**<
830 * Return the kind of the FOR construct.
831 * @param s CONST struct Statement*, the statement to query.
832 * @return The kind as an enum ForKind.
833 * @see ForLoopKindF()
834 */
835 extern enum ForKind ForLoopKindF(CONST struct Statement *s);
836 /**<
837 * Implementation function for ForLoopKind(). Do not call this
838 * function directly - use ForLoopKind() instead.
839 */
840
841 #ifdef NDEBUG
842 #define ForLoopOrder(s) ((s)->v.f.order)
843 #else
844 #define ForLoopOrder(s) ForLoopOrderF(s)
845 #endif
846 /**<
847 * Return the order of the FOR construct. For declarative this should
848 * always be random.
849 * @param s CONST struct Statement*, the statement to query.
850 * @return The order as an enum ForOrder.
851 * @see ForLoopOrderF()
852 */
853 extern enum ForOrder ForLoopOrderF(CONST struct Statement *s);
854 /**<
855 * Implementation function for ForLoopOrder(). Do not call this
856 * function directly - use ForLoopOrder() instead.
857 */
858
859 #ifdef NDEBUG
860 #define ForContains(s) ((s)->v.f.contains)
861 #define ForContainsRelations(s) ((s)->v.f.contains & contains_REL)
862 #define ForContainsLogRelations(s) ((s)->v.f.contains & contains_LREL)
863 #define ForContainsDefaults(s) ((s)->v.f.contains & contains_DEF)
864 #define ForContainsCAssigns(s) ((s)->v.f.contains & contains_CAS)
865 #define ForContainsWhen(s) ((s)->v.f.contains & contains_WHEN)
866 #define ForContainsAlike(s) ((s)->v.f.contains & contains_AA)
867 #define ForContainsAlias(s) ((s)->v.f.contains & contains_ALI)
868 #define ForContainsArray(s) ((s)->v.f.contains & contains_ARR)
869 #define ForContainsIsa(s) ((s)->v.f.contains & contains_ISA)
870 #define ForContainsIrt(s) ((s)->v.f.contains & contains_IRT)
871 #define ForContainsAts(s) ((s)->v.f.contains & contains_ATS)
872 #define ForContainsWbts(s) ((s)->v.f.contains & contains_WBTS)
873 #define ForContainsWnbts(s) ((s)->v.f.contains & contains_WNBTS)
874 #define ForContainsWillbe(s) ((s)->v.f.contains & contains_WILLBE)
875 #define ForContainsSelect(s) ((s)->v.f.contains & contains_SELECT)
876 #define ForContainsConditional(s) ((s)->v.f.contains & contains_COND)
877 #define ForContainsIllegal(s) ((s)->v.f.contains & contains_ILL)
878 #else
879 #define ForContains(s) ForContainsF(s)
880 #define ForContainsRelations(s) ForContainsRelationsF(s)
881 #define ForContainsLogRelations(s) ForContainsLogRelationsF(s)
882 #define ForContainsDefaults(s) ForContainsDefaultsF(s)
883 #define ForContainsCAssigns(s) ForContainsCAssignsF(s)
884 #define ForContainsWhen(s) ForContainsWhenF(s)
885 #define ForContainsAlike(s) ForContainsAlikeF(s)
886 #define ForContainsAlias(s) ForContainsAliasF(s)
887 #define ForContainsArray(s) ForContainsArrayF(s)
888 #define ForContainsIsa(s) ForContainsIsaF(s)
889 #define ForContainsIrt(s) ForContainsIrtF(s)
890 #define ForContainsAts(s) ForContainsAtsF(s)
891 #define ForContainsWbts(s) ForContainsWbtsF(s)
892 #define ForContainsWnbts(s) ForContainsWnbtsF(s)
893 #define ForContainsWillbe(s) ForContainsWillbeF(s)
894 #define ForContainsSelect(s) ForContainsSelectF(s)
895 #define ForContainsConditional(s) ForContainsConditionalF(s)
896 #define ForContainsIllegal(s) ForContainsIllegalF(s)
897 #endif
898 extern unsigned ForContainsF(CONST struct Statement *s);
899 extern unsigned ForContainsRelationsF(CONST struct Statement *s);
900 extern unsigned ForContainsLogRelationsF(CONST struct Statement *s);
901 extern unsigned ForContainsDefaultsF(CONST struct Statement *s);
902 extern unsigned ForContainsCAssignsF(CONST struct Statement *s);
903 extern unsigned ForContainsWhenF(CONST struct Statement *s);
904 extern unsigned ForContainsAlikeF(CONST struct Statement *s);
905 extern unsigned ForContainsAliasF(CONST struct Statement *s);
906 extern unsigned ForContainsArrayF(CONST struct Statement *s);
907 extern unsigned ForContainsIsaF(CONST struct Statement *s);
908 extern unsigned ForContainsIrtF(CONST struct Statement *s);
909 extern unsigned ForContainsAtsF(CONST struct Statement *s);
910 extern unsigned ForContainsWbtsF(CONST struct Statement *s);
911 extern unsigned ForContainsWnbtsF(CONST struct Statement *s);
912 extern unsigned ForContainsWillbeF(CONST struct Statement *s);
913 extern unsigned ForContainsSelectF(CONST struct Statement *s);
914 extern unsigned ForContainsConditionalF(CONST struct Statement *s);
915 extern unsigned ForContainsIllegalF(CONST struct Statement *s);
916 /**<
917 * <pre>
918 * macro ForContains(s)
919 * unsigned ForContainsF(s)
920 * macro ForContainsRelations(s)
921 * unsigned ForContainsRelationsF(s)
922 * macro ForContainsLogRelations(s)
923 * unsigned ForContainsLogRelationsF(s)
924 * macro ForContainsDefaults(s)
925 * unsigned ForContainsDefaultsF(s)
926 * macro ForContainsCAssigns(s)
927 * unsigned ForContainsCAssignsF(s)
928 * macro ForContainsWhen(s)
929 * unsigned ForContainsWhenF(s)
930 * macro ForContainsIllegal(s)
931 * unsigned ForContainsIllegalF(s)
932 * etc....
933 * const struct Statement *s;
934 *
935 * Respectively:
936 * Returns the entire contains field.
937 * Return true if the FOR statement given contains itself or in any of
938 * its nested statements a relation.
939 * Return true if the FOR statement given contains itself or in any of
940 * its nested statements a default statement.
941 * Return true if the FOR statement given contains itself or in any of
942 * its nested statements a constant/structural variable assignment.
943 * Return true if the FOR statement given contains itself or in any of
944 * its nested statements a WHEN statement.
945 * Likewise for:
946 * ARE_ALIKE
947 * ALIASES
948 * CREATE ARRAY
949 * IS_A
950 * IS_REFINED_TO
951 * ARE_THE_SAME
952 * WILL_BE_THE_SAME
953 * WILL_BE
954 * SELECT
955 * CONDITIONAL.
956 * Return true if the FOR statement given contains itself or in any of
957 * its nested statements an illegal instruction.
958 * </pre>
959 * @todo Rework documentation for individual functions.
960 */
961
962 /* * * StateAssign functions * * */
963
964 /*
965 * Assign has been split into Assign (structural) and Default
966 * (variable) assignment types.
967 */
968 #ifdef NDEBUG
969 #define DefaultStatVar(sptr) ((sptr)->v.asgn.nptr)
970 #else
971 #define DefaultStatVar(sptr) DefaultStatVarF(sptr)
972 #endif
973 /**<
974 * Return the name structure which is the left hand side of the
975 * default assignment.
976 * @param sptr CONST struct Statement*, the statement to query.
977 * @return The name as a struct Name*.
978 * @see DefaultStatVarF()
979 */
980 extern struct Name *DefaultStatVarF(CONST struct Statement *s);
981 /**<
982 * Implementation function for DefaultStatVar(). Do not call this
983 * function directly - use DefaultStatVar() instead.
984 */
985
986 #ifdef NDEBUG
987 #define DefaultStatRHS(s) ((s)->v.asgn.rhs)
988 #else
989 #define DefaultStatRHS(s) DefaultStatRHSF(s)
990 #endif
991 /**<
992 * Return the right hand side expression of the default assignment.
993 * @param s CONST struct Statement*, the statement to query.
994 * @return The expression as a struct Expr*.
995 * @see DefaultStatRHSF()
996 */
997 extern struct Expr *DefaultStatRHSF(CONST struct Statement *s);
998 /**<
999 * Implementation function for DefaultStatRHS(). Do not call this
1000 * function directly - use DefaultStatRHS() instead.
1001 */
1002
1003 #ifdef NDEBUG
1004 #define AssignStatVar(sptr) ((sptr)->v.asgn.nptr)
1005 #else
1006 #define AssignStatVar(sptr) AssignStatVarF(sptr)
1007 #endif
1008 /**<
1009 * Return the name structure which is the left hand side of the
1010 * structural assignment.
1011 * @param sptr CONST struct Statement*, the statement to query.
1012 * @return The name as a struct Name*.
1013 * @see AssignStatVarF()
1014 */
1015 extern struct Name *AssignStatVarF(CONST struct Statement *s);
1016 /**<
1017 * Implementation function for AssignStatVar(). Do not call this
1018 * function directly - use AssignStatVar() instead.
1019 */
1020
1021 #ifdef NDEBUG
1022 #define AssignStatRHS(s) ((s)->v.asgn.rhs)
1023 #else
1024 #define AssignStatRHS(s) AssignStatRHSF(s)
1025 #endif
1026 /**<
1027 * Return the right hand side expression of the structural assignment.
1028 * @param s CONST struct Statement*, the statement to query.
1029 * @return The expression as a struct Expr*.
1030 * @see AssignStatRHSF()
1031 */
1032 extern struct Expr *AssignStatRHSF(CONST struct Statement *s);
1033 /**<
1034 * Implementation function for AssignStatRHS(). Do not call this
1035 * function directly - use AssignStatRHS() instead.
1036 */
1037
1038 /* * * StateRelation functions * * */
1039
1040 #ifdef NDEBUG
1041 #define RelationStatName(s) ((s)->v.rel.nptr)
1042 #else
1043 #define RelationStatName(s) RelationStatNameF(s)
1044 #endif
1045 /**<
1046 * Return the name of the relation.
1047 * @param s CONST struct Statement*, the statement to query.
1048 * @return The name as a struct Name*.
1049 * @see RelationStatNameF()
1050 */
1051 extern struct Name *RelationStatNameF(CONST struct Statement *s);
1052 /**<
1053 * Implementation function for RelationStatName(). Do not call this
1054 * function directly - use RelationStatName() instead.
1055 */
1056
1057 #ifdef NDEBUG
1058 #define RelationStatExpr(s) ((s)->v.rel.relation)
1059 #else
1060 #define RelationStatExpr(s) RelationStatExprF(s)
1061 #endif
1062 /**<
1063 * Return the relation expression.
1064 * @param s CONST struct Statement*, the statement to query.
1065 * @return The expression as a struct Expr*.
1066 * @see RelationStatExprF()
1067 */
1068 extern struct Expr *RelationStatExprF(CONST struct Statement *s);
1069 /**<
1070 * Implementation function for RelationStatExpr(). Do not call this
1071 * function directly - use RelationStatExpr() instead.
1072 */
1073
1074 #ifdef NDEBUG
1075 #define LogicalRelStatName(s) ((s)->v.lrel.nptr)
1076 #else
1077 #define LogicalRelStatName(s) LogicalRelStatNameF(s)
1078 #endif
1079 /**<
1080 * Return the name of the logical relation.
1081 * @param s CONST struct Statement*, the statement to query.
1082 * @return The name as a struct Name*.
1083 * @see LogicalRelStatNameF()
1084 */
1085 extern struct Name *LogicalRelStatNameF(CONST struct Statement *s);
1086 /**<
1087 * Implementation function for LogicalRelStatName(). Do not call this
1088 * function directly - use LogicalRelStatName() instead.
1089 */
1090
1091 #ifdef NDEBUG
1092 #define LogicalRelStatExpr(s) ((s)->v.lrel.logrel)
1093 #else
1094 #define LogicalRelStatExpr(s) LogicalRelStatExprF(s)
1095 #endif
1096 /**<
1097 * Return the logical relation expression.
1098 * @param s CONST struct Statement*, the statement to query.
1099 * @return The expression as a struct Expr*.
1100 * @see RelationStatExprF()
1101 */
1102 extern struct Expr *LogicalRelStatExprF(CONST struct Statement *s);
1103 /**<
1104 * Implementation function for LogicalRelStatExpr(). Do not call this
1105 * function directly - use LogicalRelStatExpr() instead.
1106 */
1107
1108 /* * * StateExternal functions * * */
1109
1110 #ifdef NDEBUG
1111 #define ExternalStatMode(s) ((s)->v.ext.mode)
1112 #else
1113 #define ExternalStatMode(s) ExternalStatModeF(s)
1114 #endif
1115 /**<
1116 * Return the external statement's mode.
1117 * 0 = Procedural, 1 = Glassbox Declarative, 2 = Blackbox Declarative.
1118 * @param s CONST struct Statement*, the statement to query.
1119 * @return The mode as an int.
1120 * @see ExternalStatModeF()
1121 */
1122 extern int ExternalStatModeF(CONST struct Statement *s);
1123 /**<
1124 * Implementation function for ExternalStatMode(). Do not call this
1125 * function directly - use ExternalStatMode() instead.
1126 */
1127
1128 #ifdef NDEBUG
1129 #define ExternalStatName(s) ((s)->v.ext.nptr)
1130 #else
1131 #define ExternalStatName(s) ExternalStatNameF(s)
1132 #endif
1133 /**<
1134 * Return the external statement's name.
1135 * @param s CONST struct Statement*, the statement to query.
1136 * @return The name as a struct Name*.
1137 * @see ExternalStatNameF()
1138 */
1139 extern struct Name *ExternalStatNameF(CONST struct Statement *s);
1140 /**<
1141 * Implementation function for ExternalStatName(). Do not call this
1142 * function directly - use ExternalStatName() instead.
1143 */
1144
1145 #ifdef NDEBUG
1146 #define ExternalStatData(s) ((s)->v.ext.data)
1147 #else
1148 #define ExternalStatData(s) ExternalStatDataF(s)
1149 #endif
1150 /**<
1151 * Return the external statement's name of its additional data.
1152 * @param s CONST struct Statement*, the statement to query.
1153 * @return The name as a struct Name*.
1154 * @see ExternalStatDataF()
1155 */
1156 extern struct Name *ExternalStatDataF(CONST struct Statement *s);
1157 /**<
1158 * Implementation function for ExternalStatData(). Do not call this
1159 * function directly - use ExternalStatData() instead.
1160 */
1161
1162 #ifdef NDEBUG
1163 #define ExternalStatScope(s) ((s)->v.ext.scope)
1164 #else
1165 #define ExternalStatScope(s) ExternalStatScopeF(s)
1166 #endif
1167 /**<
1168 * Return the external statement's name of its scope. This may be NULL.
1169 * If it is NULL, then the external relation (at this time assumed to be
1170 * a glassbox), will added at the scope that it was found; otherwise it
1171 * will be added at the given scope.
1172 * @param s CONST struct Statement*, the statement to query.
1173 * @return The name as a struct Name*.
1174 * @see ExternalStatScopeF()
1175 */
1176 extern struct Name *ExternalStatScopeF(CONST struct Statement *s);
1177 /**<
1178 * Implementation function for ExternalStatScope(). Do not call this
1179 * function directly - use ExternalStatScope() instead.
1180 */
1181
1182 #ifdef NDEBUG
1183 #define ExternalStatVlist(s) ((s)->v.ext.vl)
1184 #else
1185 #define ExternalStatVlist(s) ExternalStatVlistF(s)
1186 #endif
1187 /**<
1188 * Return the external statement's variable list -- the argument list.
1189 * @param s CONST struct Statement*, the statement to query.
1190 * @return The list as a struct VariableList*.
1191 * @see ExternalStatVlistF()
1192 */
1193 extern struct VariableList *ExternalStatVlistF(CONST struct Statement *s);
1194 /**<
1195 * Implementation function for ExternalStatVlist(). Do not call this
1196 * function directly - use ExternalStatVlist() instead.
1197 */
1198
1199 #ifdef NDEBUG
1200 #define ExternalStatFuncName(s) ((s)->v.ext.extcall)
1201 #else
1202 #define ExternalStatFuncName(s) ExternalStatFuncNameF(s)
1203 #endif
1204 /**<
1205 * Return the external statement's function call
1206 * name. -- the name invoked with.
1207 * @param s CONST struct Statement*, the statement to query.
1208 * @return The name as a CONST char*.
1209 * @see ExternalStatFuncNameF()
1210 */
1211 extern CONST char *ExternalStatFuncNameF(CONST struct Statement *s);
1212 /**<
1213 * Implementation function for ExternalStatFuncName(). Do not call this
1214 * function directly - use ExternalStatFuncName() instead.
1215 */
1216
1217 /* * * StateReference functions * * */
1218
1219 #ifdef NDEBUG
1220 #define ReferenceStatMode(s) ((s)->v.ref.mode)
1221 #else
1222 #define ReferenceStatMode(s) ReferenceStatModeF(s)
1223 #endif
1224 /**<
1225 * Return the mode of the refernce statement. Mode at the moment:
1226 * 0 => copy/clone semantics; 1 => pure reference semantics, such as in
1227 * languages with pointers. Value semantics is handled by ISA statements
1228 * @param s CONST struct Statement*, the statement to query.
1229 * @return The mode as an int.
1230 * @see ReferenceStatModeF()
1231 */
1232 extern int ReferenceStatModeF(CONST struct Statement *s);
1233 /**<
1234 * Implementation function for ReferenceStatMode(). Do not call this
1235 * function directly - use ReferenceStatMode() instead.
1236 */
1237
1238 #ifdef NDEBUG
1239 #define ReferenceStatName(s) ((s)->v.ref.ref_name)
1240 #else
1241 #define ReferenceStatName(s) ReferenceStatNameF(s)
1242 #endif
1243 /**<
1244 * Return the name of the thing being referred to. This name is a simple
1245 * such as a type description. Later this may become accept a fully qulafied
1246 * id., and will depend upon the semantics of how it was invoked.
1247 * This name may alternatively be called the *referee*
1248 * @param s CONST struct Statement*, the statement to query.
1249 * @return The name as a symchar*.
1250 * @see ReferenceStatNameF()
1251 */
1252 extern symchar *ReferenceStatNameF(CONST struct Statement *s);
1253 /**<
1254 * Implementation function for ReferenceStatName(). Do not call this
1255 * function directly - use ReferenceStatName() instead.
1256 */
1257
1258 #ifdef NDEBUG
1259 #define ReferenceStatSetType(s) ((s)->v.ref.settype)
1260 #else
1261 #define ReferenceStatSetType(s) ReferenceStatSetTypeF(s)
1262 /**<
1263 * Return the type of set for a REF statement. This may be NULL, which
1264 * means that there is no "OF" part to the _IS_ statement.<br>
1265 * Eg: foo[thing] _IS_ set OF barobject; -- not NULL <br>
1266 * foo_other _IS_ bar_other; -- NULL.
1267 * @param s CONST struct Statement*, the statement to query.
1268 * @return The type as a symchar*.
1269 * @see ReferenceStatSetTypeF()
1270 */
1271 extern symchar *ReferenceStatSetTypeF(CONST struct Statement *s);
1272 #endif
1273 /**<
1274 * Implementation function for ReferenceStatSetType(). Do not call this
1275 * function directly - use ReferenceStatSetType() instead.
1276 */
1277
1278 #ifdef NDEBUG
1279 #define ReferenceStatVlist(s) ((s)->v.ref.vl)
1280 #else
1281 #define ReferenceStatVlist(s) ReferenceStatVlistF(s)
1282 #endif
1283 /**<
1284 * Return the list of variables/models that refer to the given reference.
1285 * @param s CONST struct Statement*, the statement to query.
1286 * @return The list as a struct VariableList*.
1287 * @see ReferenceStatVlistF()
1288 */
1289 extern struct VariableList *ReferenceStatVlistF(CONST struct Statement *s);
1290 /**<
1291 * Implementation function for ReferenceStatVlist(). Do not call this
1292 * function directly - use ReferenceStatVlist() instead.
1293 */
1294
1295 /* * * StateRun functions * * */
1296
1297 #ifdef NDEBUG
1298 #define RunStatName(s) ((s)->v.r.proc_name)
1299 #else
1300 #define RunStatName(s) RunStatNameF(s)
1301 #endif
1302 /**<
1303 * Returns the name pointer of a run statement.
1304 * @param s CONST struct Statement*, the statement to query.
1305 * @return The name as a struct Name*.
1306 * @see RunStatNameF()
1307 */
1308 extern struct Name *RunStatNameF(CONST struct Statement *s);
1309 /**<
1310 * Implementation function for RunStatName(). Do not call this
1311 * function directly - use RunStatName() instead.
1312 */
1313
1314 #ifdef NDEBUG
1315 #define RunStatAccess(s) ((s)->v.r.type_name)
1316 #else
1317 #define RunStatAccess(s) RunStatAccessF(s)
1318 #endif
1319 /**<
1320 * Returns the type access of a RUN statement. This is to allow the
1321 * use of syntax such as: RUN A::b where 'B' is a class/model/atom, and b
1322 * is a name of procedure within that class/atom/model.
1323 * @param s CONST struct Statement*, the statement to query.
1324 * @return The type access as a struct Name*.
1325 * @see RunStatAccessF()
1326 */
1327 extern struct Name *RunStatAccessF(CONST struct Statement *s);
1328 /**<
1329 * Implementation function for RunStatAccess(). Do not call this
1330 * function directly - use RunStatAccess() instead.
1331 */
1332
1333 #ifdef NDEBUG
1334 # define FixStatVars(s) ((s)->v.fx.vars)
1335 #else
1336 # define FixStatVars(s) FixStatVarsF(s)
1337 #endif
1338 /**<
1339 Returns the variable list for a FIX statement
1340 @param s CONST struct Statement*, the statement to query.
1341 @return struct VariableList*, the list of variables
1342 @see FixStatAccessF
1343 */
1344
1345 extern struct VariableList *FixStatVarsF(CONST struct Statement *s);
1346 /**<
1347 Implementation function for FixStatVars(). Do not call this directory, use FixStatVars instead.
1348 */
1349
1350 /* * * StateCall functions * * */
1351
1352 #ifdef NDEBUG
1353 #define CallStatArgs(s) ((s)->v.call.args)
1354 #else
1355 #define CallStatArgs(s) CallStatArgsF(s)
1356 #endif
1357 /**<
1358 * Return the call statement's argument list.
1359 * @param s CONST struct Statement*, the statement to query.
1360 * @return The list as a struct Set*.
1361 * @see CallStatArgsF()
1362 */
1363 extern struct Set *CallStatArgsF(CONST struct Statement *s);
1364 /**<
1365 * Implementation function for CallStatArgs(). Do not call this
1366 * function directly - use CallStatArgs() instead.
1367 */
1368
1369 #ifdef NDEBUG
1370 #define CallStatId(s) ((s)->v.call.id)
1371 #else
1372 #define CallStatId(s) CallStatIdF(s)
1373 #endif
1374 /**<
1375 * Return the call statement's function id.
1376 * @param s CONST struct Statement*, the statement to query.
1377 * @return The id as a symchar*.
1378 * @see CallStatIdF()
1379 */
1380 extern symchar *CallStatIdF(CONST struct Statement *s);
1381 /**<
1382 * Implementation function for CallStatId(). Do not call this
1383 * function directly - use CallStatId() instead.
1384 */
1385
1386 /* * * StateWhile functions * * */
1387
1388 #ifdef NDEBUG
1389 #define WhileStatExpr(s) ((s)->v.loop.test)
1390 #else
1391 #define WhileStatExpr(s) WhileStatExprF(s)
1392 #endif
1393 /**<
1394 * Return the WHILE expression.
1395 * @param s CONST struct Statement*, the statement to query.
1396 * @return The expression as a struct Expr*.
1397 * @see WhileStatExprF()
1398 */
1399 extern struct Expr *WhileStatExprF(CONST struct Statement *s);
1400 /**<
1401 * Implementation function for WhileStatExpr(). Do not call this
1402 * function directly - use WhileStatExpr() instead.
1403 */
1404
1405 #ifdef NDEBUG
1406 #define WhileStatBlock(s) ((s)->v.loop.block)
1407 #else
1408 #define WhileStatBlock(s) WhileStatBlockF(s)
1409 #endif
1410 /**<
1411 * Return the block of a while statement.
1412 * @param s CONST struct Statement*, the statement to query.
1413 * @return The block as a struct StatementList*.
1414 * @see WhileStatBlockF()
1415 */
1416 extern struct StatementList *WhileStatBlockF(CONST struct Statement *s);
1417 /**<
1418 * Implementation function for WhileStatBlock(). Do not call this
1419 * function directly - use WhileStatBlock() instead.
1420 */
1421
1422 /* * * stateflow * * */
1423
1424 #define FlowStatControl(s) ((s)->v.flow.fc)
1425 /**<
1426 * Return the type of flow control.
1427 * @todo Needs a function wrapper.
1428 */
1429
1430 #define FlowStatMessage(s) ((s)->v.flow.message)
1431 /**<
1432 * Return the message of the flow control.
1433 * @todo Needs a function wrapper.
1434 */
1435
1436 /* * * StateASSERT functions * * */
1437
1438 /** Return the ASSERT expression
1439 @param s the expression to test
1440 @see AssertStatExprF()
1441 */
1442 #ifdef NDEBUG
1443 # define AssertStatExpr(s) ((s)->v.asserts.test)
1444 #else
1445 # define AssertStatExpr(s) AssertStatExprF(s)
1446 #endif
1447
1448 /** Internal implemention of ASSERT expression
1449 @see IfStatExprF()
1450 */
1451 extern struct Expr *AssertStatExprF(CONST struct Statement *s);
1452
1453 /* * * StateIf functions * * */
1454
1455 #ifdef NDEBUG
1456 #define IfStatExpr(s) ((s)->v.ifs.test)
1457 #else
1458 #define IfStatExpr(s) IfStatExprF(s)
1459 #endif
1460 /**<
1461 * Return the IF expression.
1462 * @param s the statement to query.
1463 * @return The expression as a struct Expr*.
1464 * @see IfStatExprF()
1465 */
1466 extern struct Expr *IfStatExprF(CONST struct Statement *s);
1467 /**<
1468 * Implementation function for IfStatExpr(). Do not call this
1469 * function directly - use IfStatExpr() instead.
1470 */
1471
1472 #ifdef NDEBUG
1473 #define IfStatThen(s) ((s)->v.ifs.thenblock)
1474 #else
1475 #define IfStatThen(s) IfStatThenF(s)
1476 #endif
1477 /**<
1478 * Return the then block of an if statement.
1479 * @param s CONST struct Statement*, the statement to query.
1480 * @return The block as a struct StatementList*.
1481 * @see IfStatThenF()
1482 */
1483 extern struct StatementList *IfStatThenF(CONST struct Statement *s);
1484 /**<
1485 * Implementation function for IfStatThen(). Do not call this
1486 * function directly - use IfStatThen() instead.
1487 */
1488
1489 #ifdef NDEBUG
1490 #define IfStatElse(s) ((s)->v.ifs.elseblock)
1491 #else
1492 #define IfStatElse(s) IfStatElseF(s)
1493 #endif
1494 /**<
1495 * Return the else block of an if statement. This is NULL if the else
1496 * was omitted.
1497 * @param s CONST struct Statement*, the statement to query.
1498 * @return The block as a struct StatementList*.
1499 * @see IfStatElseF()
1500 */
1501 extern struct StatementList *IfStatElseF(CONST struct Statement *s);
1502 /**<
1503 * Implementation function for IfStatElse(). Do not call this
1504 * function directly - use IfStatElse() instead.
1505 */
1506
1507 /* * * StateWhen functions * * */
1508
1509 #ifdef NDEBUG
1510 #define WhenStatName(s) ((s)->v.w.nptr)
1511 #else
1512 #define WhenStatName(s) WhenStatNameF(s)
1513 #endif
1514 /**<
1515 * Return the name of a WHEN node.
1516 * @param s CONST struct Statement*, the statement to query.
1517 * @return The name as a struct Name*.
1518 * @see WhenStatNameF()
1519 */
1520 extern struct Name *WhenStatNameF(CONST struct Statement *s);
1521 /**<
1522 * Implementation function for WhenStatName(). Do not call this
1523 * function directly - use WhenStatName() instead.
1524 */
1525
1526 extern void SetWhenName(struct Statement *s, struct Name *n);
1527 /**<
1528 * This procedure provides a mechanism for unnamed whens to be named.
1529 */
1530
1531 #ifdef NDEBUG
1532 #define WhenStatVL(s) ((s)->v.w.vl)
1533 #else
1534 #define WhenStatVL(s) WhenStatVLF(s)
1535 #endif
1536 /**<
1537 * Return the variable list part of a WHEN statement.
1538 * @param s CONST struct Statement*, the statement to query.
1539 * @return The list as a struct VariableList*.
1540 * @see WhenStatVLF()
1541 */
1542 extern struct VariableList *WhenStatVLF(CONST struct Statement *s);
1543 /**<
1544 * Implementation function for WhenStatVL(). Do not call this
1545 * function directly - use WhenStatVL() instead.
1546 */
1547
1548 #ifdef NDEBUG
1549 #define WhenStatCases(s) ((s)->v.w.cases)
1550 #else
1551 #define WhenStatCases(s) WhenStatCasesF(s)
1552 #endif
1553 /**<
1554 * Return the list of cases of a WHEN statement. To obtain the
1555 * statement list in each of the CASEs, see when.h
1556 * @param s CONST struct Statement*, the statement to query.
1557 * @return The list as a struct WhenList*.
1558 * @see WhenStatCasesF()
1559 */
1560 extern struct WhenList *WhenStatCasesF(CONST struct Statement *s);
1561 /**<
1562 * Implementation function for WhenStatCases(). Do not call this
1563 * function directly - use WhenStatCases() instead.
1564 */
1565
1566 extern int CompareWhenStatements(CONST struct Statement *s1,
1567 CONST struct Statement *s2);
1568 /**<
1569 * Compare functions for WHEN statements. It includes the decomposition
1570 * of the WHEN in the list of variables and the list of CASEs. Also,
1571 * each case is decomposed in the set of values and the list of statements.
1572 * It is done here since we are comparing the statement rather than only a
1573 * WhenList structure (when.[ch]).
1574 * It is called for the function CompareStatements and it follows the
1575 * same pattern for the comparation.
1576 */
1577
1578 /* * * StateFname functions * * */
1579
1580 #ifdef NDEBUG
1581 #define FnameStat(s) ((s)->v.n.wname)
1582 #else
1583 #define FnameStat(s) FnameStatF(s)
1584 #endif
1585 /**<
1586 * Return the name of a model or relation (inside WHEN statement)
1587 * @param s CONST struct Statement*, the statement to query.
1588 * @return The name as a struct Name*.
1589 * @see FnameStatF()
1590 */
1591 extern struct Name *FnameStatF(CONST struct Statement *s);
1592 /**<
1593 * Implementation function for FnameStat(). Do not call this
1594 * function directly - use FnameStat() instead.
1595 */
1596
1597 /* * * StateCOND functions * * */
1598
1599 #ifdef NDEBUG
1600 #define CondStatList(s) ((s)->v.cond.stmts)
1601 #else
1602 #define CondStatList(s) CondStatListF(s)
1603 #endif
1604 /**<
1605 * Return the list of statements in a Conditional statement.
1606 * @param s CONST struct Statement*, the statement to query.
1607 * @return The list as a struct StatementList*.
1608 * @see CondStatListF()
1609 */
1610 extern struct StatementList *CondStatListF(CONST struct Statement *s);
1611 /**<
1612 * Implementation function for CondStatList(). Do not call this
1613 * function directly - use CondStatList() instead.
1614 */
1615
1616 #ifdef NDEBUG
1617 #define CondContains(s) ((s)->v.cond.contains)
1618 #define CondContainsRelations(s) ((s)->v.cond.contains & contains_REL)
1619 #define CondContainsLogRelations(s) ((s)->v.cond.contains & contains_LREL)
1620 #else
1621 #define CondContains(s) CondContainsF(s)
1622 #define CondContainsRelations(s) CondContainsRelationsF(s)
1623 #define CondContainsLogRelations(s) CondContainsLogRelationsF(s)
1624 #endif
1625 extern unsigned CondContainsF(CONST struct Statement *s);
1626 extern unsigned CondContainsRelationsF(CONST struct Statement *s);
1627 extern unsigned CondContainsLogRelationsF(CONST struct Statement *s);
1628 /**<
1629 * <pre>
1630 * macro CondContains(s)
1631 * unsigned CondContainsF(s)
1632 * macro CondContainsRelations(s)
1633 * unsigned CondContainsRelationsF(s)
1634 * macro CondContainsLogRelations(s)
1635 * unsigned CondContainsLogRelationsF(s)
1636 * const struct Statement *s;
1637 *
1638 * Respectively:
1639 * Returns the entire contains field.
1640 * Return true if the Cond statement given contains a relation.
1641 * Return true if the Cond statement given contains a logical relation.
1642 * </pre>
1643 * @todo Rework documentation for individual functions.
1644 */
1645
1646 /* * * StateSelect functions * * */
1647
1648 #ifdef NDEBUG
1649 #define SelectStatVL(s) ((s)->v.se.vl)
1650 #else
1651 #define SelectStatVL(s) SelectStatVLF(s)
1652 #endif
1653 /**<
1654 * Return the set part of a SELECT statement.
1655 * @param s CONST struct Statement*, the statement to query.
1656 * @return The set part as a struct VariableList*.
1657 * @see SelectStatVLF()
1658 */
1659 extern struct VariableList *SelectStatVLF(CONST struct Statement *s);
1660 /**<
1661 * Implementation function for SelectStatVL(). Do not call this
1662 * function directly - use SelectStatVL() instead.
1663 */
1664
1665 #ifdef NDEBUG
1666 #define SelectStatNumberStats(s) ((s)->v.se.n_statements)
1667 #else
1668 #define SelectStatNumberStats(s) SelectStatNumberStatsF(s)
1669 #endif
1670 /**<
1671 * Return the number of statements inside a SELECT statement.
1672 * @param s CONST struct Statement*, the statement to query.
1673 * @return The statement count as an int.
1674 * @see SelectStatNumberStatsF()
1675 */
1676 extern int SelectStatNumberStatsF(CONST struct Statement *s);
1677 /**<
1678 * Implementation function for SelectStatNumberStats(). Do not call this
1679 * function directly - use SelectStatNumberStats() instead.
1680 */
1681
1682 #ifdef NDEBUG
1683 #define SelectStatCases(s) ((s)->v.se.cases)
1684 #else
1685 #define SelectStatCases(s) SelectStatCasesF(s)
1686 #endif
1687 /**<
1688 * Return the list of cases of a SELECT statement. To obtain the
1689 * statement list in each of the CASEs, see select.h
1690 * @param s CONST struct Statement*, the statement to query.
1691 * @return The list as a struct SelectList*.
1692 * @see SelectStatCasesF()
1693 */
1694 extern struct SelectList *SelectStatCasesF(CONST struct Statement *s);
1695 /**<
1696 * Implementation function for SelectStatCases(). Do not call this
1697 * function directly - use SelectStatCases() instead.
1698 */
1699
1700 extern int CompareSelectStatements(CONST struct Statement *s1,
1701 CONST struct Statement *s2);
1702
1703 /**<
1704 * Compare functions for SELECT statements. It includes the decomposition
1705 * of the SELECT in the list of variables and the list of CASEs. Also,
1706 * each case is decomposed in the set of values and the list of statements.
1707 * It is done here since we are comparing the statement rather than only a
1708 * SelectList structure (select.[ch]).<br><br>
1709 *
1710 * It is called for the function CompareStatements and it follows the
1711 * same pattern for the comparation.
1712 *
1713 */
1714
1715 #ifdef NDEBUG
1716 #define SelectContains(s) ((s)->v.se.contains)
1717 #define SelectContainsRelations(s) ((s)->v.se.contains & contains_REL)
1718 #define SelectContainsLogRelations(s) ((s)->v.se.contains & contains_LREL)
1719 #define SelectContainsDefaults(s) ((s)->v.se.contains & contains_DEF)
1720 #define SelectContainsCAssigns(s) ((s)->v.se.contains & contains_CAS)
1721 #define SelectContainsWhen(s) ((s)->v.se.contains & contains_WHEN)
1722 #define SelectContainsAlike(s) ((s)->v.se.contains & contains_AA)
1723 #define SelectContainsAlias(s) ((s)->v.se.contains & contains_ALI)
1724 #define SelectContainsArray(s) ((s)->v.se.contains & contains_ARR)
1725 #define SelectContainsIsa(s) ((s)->v.se.contains & contains_ISA)
1726 #define SelectContainsIrt(s) ((s)->v.se.contains & contains_IRT)
1727 #define SelectContainsAts(s) ((s)->v.se.contains & contains_ATS)
1728 #define SelectContainsWbts(s) ((s)->v.se.contains & contains_WBTS)
1729 #define SelectContainsWnbts(s) ((s)->v.se.contains & contains_WNBTS)
1730 #define SelectContainsWillbe(s) ((s)->v.se.contains & contains_WILLBE)
1731 #define SelectContainsSelect(s) ((s)->v.se.contains & contains_SELECT)
1732 #define SelectContainsConditional(s) ((s)->v.se.contains & contains_COND)
1733 #define SelectContainsIllegal(s) ((s)->v.se.contains & contains_ILL)
1734 #else
1735 #define SelectContains(s) SelectContainsF(s)
1736 #define SelectContainsRelations(s) SelectContainsRelationsF(s)
1737 #define SelectContainsLogRelations(s) SelectContainsLogRelationsF(s)
1738 #define SelectContainsDefaults(s) SelectContainsDefaultsF(s)
1739 #define SelectContainsCAssigns(s) SelectContainsCAssignsF(s)
1740 #define SelectContainsWhen(s) SelectContainsWhenF(s)
1741 #define SelectContainsAlike(s) SelectContainsAlikeF(s)
1742 #define SelectContainsAlias(s) SelectContainsAliasF(s)
1743 #define SelectContainsArray(s) SelectContainsArrayF(s)
1744 #define SelectContainsIsa(s) SelectContainsIsaF(s)
1745 #define SelectContainsIrt(s) SelectContainsIrtF(s)
1746 #define SelectContainsAts(s) SelectContainsAtsF(s)
1747 #define SelectContainsWbts(s) SelectContainsWbtsF(s)
1748 #define SelectContainsWnbts(s) SelectContainsWnbtsF(s)
1749 #define SelectContainsWillbe(s) SelectContainsWillbeF(s)
1750 #define SelectContainsSelect(s) SelectContainsSelectF(s)
1751 #define SelectContainsConditional(s) SelectContainsConditionalF(s)
1752 #define SelectContainsIllegal(s) SelectContainsIllegalF(s)
1753 #endif
1754 extern unsigned SelectContainsF(CONST struct Statement *s);
1755 extern unsigned SelectContainsRelationsF(CONST struct Statement *s);
1756 extern unsigned SelectContainsLogRelationsF(CONST struct Statement *s);
1757 extern unsigned SelectContainsDefaultsF(CONST struct Statement *s);
1758 extern unsigned SelectContainsCAssignsF(CONST struct Statement *s);
1759 extern unsigned SelectContainsWhenF(CONST struct Statement *s);
1760 extern unsigned SelectContainsAlikeF(CONST struct Statement *s);
1761 extern unsigned SelectContainsAliasF(CONST struct Statement *s);
1762 extern unsigned SelectContainsArrayF(CONST struct Statement *s);
1763 extern unsigned SelectContainsIsaF(CONST struct Statement *s);
1764 extern unsigned SelectContainsIrtF(CONST struct Statement *s);
1765 extern unsigned SelectContainsAtsF(CONST struct Statement *s);
1766 extern unsigned SelectContainsWbtsF(CONST struct Statement *s);
1767 extern unsigned SelectContainsWnbtsF(CONST struct Statement *s);
1768 extern unsigned SelectContainsWillbeF(CONST struct Statement *s);
1769 extern unsigned SelectContainsSelectF(CONST struct Statement *s);
1770 extern unsigned SelectContainsConditionalF(CONST struct Statement *s);
1771 extern unsigned SelectContainsIllegalF(CONST struct Statement *s);
1772 /**<
1773 * <pre>
1774 * macro SelectContains(s)
1775 * unsigned SelectContainsF(s)
1776 * macro SelectContainsRelations(s)
1777 * unsigned SelectContainsRelationsF(s)
1778 * macro SelectContainsLogRelations(s)
1779 * unsigned SelectContainsLogRelationsF(s)
1780 * macro SelectContainsDefaults(s)
1781 * unsigned SelectContainsDefaultsF(s)
1782 * macro SelectContainsCAssigns(s)
1783 * unsigned SelectContainsCAssignsF(s)
1784 * macro SelectContainsWhen(s)
1785 * unsigned SelectContainsWhenF(s)
1786 * macro SelectContainsIllegal(s)
1787 * unsigned SelectContainsIllegalF(s)
1788 * etc....
1789 * const struct Statement *s;
1790 *
1791 * Respectively:
1792 * Returns the entire contains field.
1793 * Return true if the SELECT statement given contains itself or in any of
1794 * its nested statements a relation.
1795 * Return true if the SELECT statement given contains itself or in any of
1796 * its nested statements a default statement.
1797 * Return true if the SELECT statement given contains itself or in any of
1798 * its nested statements a constant/structural variable assignment.
1799 * Return true if the SELECT statement given contains itself or in any of
1800 * its nested statements a WHEN statement.
1801 * Likewise for:
1802 * ARE_ALIKE
1803 * ALIASES
1804 * CREATE ARRAY
1805 * IS_A
1806 * IS_REFINED_TO
1807 * ARE_THE_SAME
1808 * WILL_BE_THE_SAME
1809 * WILL_BE
1810 * SELECT
1811 * CONDITIONAL.
1812 * Return true if the Select statement given contains itself or in any of
1813 * its nested statements an illegal instruction.
1814 * </pre>
1815 * @todo Rework documentation for individual functions.
1816 */
1817
1818 /*==============================*/
1819
1820 /* * * StateSwitch functions * * */
1821
1822 #ifdef NDEBUG
1823 #define SwitchStatVL(s) ((s)->v.sw.vl)
1824 #else
1825 #define SwitchStatVL(s) SwitchStatVLF(s)
1826 #endif
1827 /**<
1828 * Return the set part of a SWITCH statement.
1829 * @param s CONST struct Statement*, the statement to query.
1830 * @return The set part as a struct VariableList*.
1831 * @see SwitchStatVLF()
1832 */
1833 extern struct VariableList *SwitchStatVLF(CONST struct Statement *s);
1834 /**<
1835 * Implementation function for SwitchStatVL(). Do not call this
1836 * function directly - use SwitchStatVL() instead.
1837 */
1838
1839 #ifdef NDEBUG
1840 #define SwitchStatCases(s) ((s)->v.sw.cases)
1841 #else
1842 #define SwitchStatCases(s) SwitchStatCasesF(s)
1843 #endif
1844 /**<
1845 * Return the list of cases of a SWITCH statement. To obtain the
1846 * statement list in each of the CASEs, see switch.h
1847 * @param s CONST struct Statement*, the statement to query.
1848 * @return The list as a struct SwitchList*.
1849 * @see SwitchStatCasesF()
1850 */
1851 extern struct SwitchList *SwitchStatCasesF(CONST struct Statement *s);
1852 /**<
1853 * Implementation function for SwitchStatCases(). Do not call this
1854 * function directly - use SwitchStatCases() instead.
1855 */
1856
1857 extern int CompareSwitchStatements(CONST struct Statement *s1,
1858 CONST struct Statement *s2);
1859 /**<
1860 * Compare functions for SWITCH statements. It includes the decomposition
1861 * of the Switch in the list of variables and the list of CASEs. Also,
1862 * each case is decomposed in the set of values and the list of statements.
1863 * It is done here since we are comparing the statement rather than only a
1864 * SwitchList structure (switch.[ch]).<br><br>
1865 *
1866 * It is called for the function CompareStatements and it follows the
1867 * same pattern for the comparation.
1868 */
1869
1870 /*====================================*/
1871
1872 extern int CompareStatements(CONST struct Statement *s1,
1873 CONST struct Statement *s2);
1874 /**<
1875 * Returns -1,0,1 as s1 is <, ==, > s2.
1876 * s1 < s2 if type(s1) < type(s2), exception: NULL > all statements.
1877 * For statements of the same type, compared according to
1878 * the number of arguments or alphabetically, as appropriate.
1879 * We are comparing statement contents, not statement memory location
1880 * or origin.<br><br>
1881 * Special notes:
1882 * For a less picky version (when it comes to type compatibility)
1883 * see CompareISStatements below.
1884 */
1885
1886 extern int CompareISStatements(CONST struct Statement *s1,
1887 CONST struct Statement *s2);
1888 /**<
1889 * s1 and s2 must be StateIS or some of the StateARE based statements, i.e.
1890 * IS_A WILL_BE IS_REFINED_TO WILL_BE_THE_SAME statements, or
1891 * s1 and s2 must be relations.
1892 * FOR loops containing only these kinds are also allowed.
1893 * Returns -1,0,1 as s1 is <, ==, > s2.
1894 * s1 < s2 if StatementType(s1) < StatementType(s2),
1895 * exception: NULL > all statements.<br><br>
1896 *
1897 * For statements of the same StatementType, compared according to
1898 * the number of arguments or alphabetically, as appropriate
1899 * after type compatibility is checked. In particular,
1900 * if MoreRefined(GetStateType(s1),GetStatType(s2)) returns
1901 * the type from s2, the two potentially type differing statements
1902 * which OTHERWISE are identical are considered identical.
1903 * If s1 is more refined than s2, the statements are considered
1904 * incompatible. If s1 has a WITH_VALUE clause that does not match
1905 * s2, the statements are incompatible.<br><br>
1906 *
1907 * We are comparing statement contents, not statement memory location
1908 * or origin.<br><br>
1909 *
1910 * Special notes:
1911 * For a more picky version (when it comes to type compatibility)
1912 * see CompareStatements above.
1913 */
1914
1915 #endif /* __STATEMENT_H_SEEN__ */
1916

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22