1 |
jds |
54 |
/* |
2 |
aw0a |
1 |
* Logical Relation Output Routines |
3 |
|
|
* by Vicente Rico-Ramirez |
4 |
|
|
* Version: $Revision: 1.8 $ |
5 |
|
|
* Version control file: $RCSfile: logrel_io.h,v $ |
6 |
|
|
* Date last modified: $Date: 1997/07/29 15:52:45 $ |
7 |
|
|
* Last modified by: $Author: rv2a $ |
8 |
|
|
* |
9 |
|
|
* This file is part of the Ascend Language Interpreter. |
10 |
|
|
* |
11 |
|
|
* Copyright (C) 1997 Carnegie Mellon University |
12 |
|
|
* |
13 |
|
|
* The Ascend Language Interpreter is free software; you can redistribute |
14 |
|
|
* it and/or modify it under the terms of the GNU General Public License as |
15 |
|
|
* published by the Free Software Foundation; either version 2 of the |
16 |
|
|
* License, or (at your option) any later version. |
17 |
|
|
* |
18 |
|
|
* The Ascend Language Interpreter is distributed in hope that it will be |
19 |
|
|
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
21 |
|
|
* General Public License for more details. |
22 |
|
|
* |
23 |
|
|
* You should have received a copy of the GNU General Public License along |
24 |
|
|
* with the program; if not, write to the Free Software Foundation, Inc., 675 |
25 |
|
|
* Mass Ave, Cambridge, MA 02139 USA. Check the file named COPYING. |
26 |
|
|
*/ |
27 |
jds |
54 |
|
28 |
|
|
/** @file |
29 |
|
|
* Logical Relation Output Routines. |
30 |
|
|
* <pre> |
31 |
|
|
* When #including logrel)io.h, make sure these files are #included first: |
32 |
|
|
* #include <stdio.h> |
33 |
|
|
* #include "utilities/ascConfig.h" |
34 |
|
|
* #include "instance_enum.h" |
35 |
|
|
* #include "compiler.h" |
36 |
|
|
* #include "exprs.h" |
37 |
|
|
* #include "logrelation.h" |
38 |
|
|
* </pre> |
39 |
|
|
*/ |
40 |
|
|
|
41 |
johnpye |
1066 |
#ifndef ASC_LOGRELATION_IO_H |
42 |
|
|
#define ASC_LOGRELATION_IO_H |
43 |
aw0a |
1 |
|
44 |
johnpye |
1066 |
/** addtogroup compiler Compiler |
45 |
|
|
@{ |
46 |
|
|
*/ |
47 |
|
|
|
48 |
jds |
54 |
extern int LogExprNeedParentheses(enum Expr_enum parent, |
49 |
|
|
enum Expr_enum child, |
50 |
|
|
int rhs); |
51 |
|
|
/**< |
52 |
|
|
* <!-- int LogExprNeedParentheses(parent,child,rhs); --> |
53 |
|
|
* <!-- enum Expr_enum parent_op; --> |
54 |
|
|
* <!-- enum Expr_enum child_op; --> |
55 |
|
|
* <!-- int rhs; --> |
56 |
aw0a |
1 |
* Given a unary or binary expression, will determine whether, the |
57 |
|
|
* child expression needs parentheses. "rhs" tells if we are looking |
58 |
|
|
* at the left or right side of a binary token. |
59 |
|
|
*/ |
60 |
|
|
|
61 |
jds |
54 |
extern void WriteLogRel(FILE *f, |
62 |
|
|
CONST struct Instance *lrelinst, |
63 |
|
|
CONST struct Instance *ref); |
64 |
|
|
/**< |
65 |
|
|
* <!-- WriteLogRel(f,lrelinst,ref); --> |
66 |
|
|
* <!-- FILE *f; --> |
67 |
|
|
* <!-- const struct Instance *lrelinst; --> |
68 |
|
|
* <!-- const struct Instance *ref; --> |
69 |
aw0a |
1 |
* Write the logical relation in infix to the file indicated. |
70 |
|
|
*/ |
71 |
|
|
|
72 |
johnpye |
1063 |
ASC_DLLSPEC char *WriteLogRelToString(CONST struct Instance *lrelinst, |
73 |
jds |
54 |
CONST struct Instance *ref); |
74 |
|
|
/**< |
75 |
|
|
* <!-- s = WriteLogRelToString(lrelinst,ref); --> |
76 |
|
|
* <!-- char *f; --> |
77 |
|
|
* <!-- const struct Instance *lrelinst; --> |
78 |
|
|
* <!-- const struct Instance *ref; --> |
79 |
aw0a |
1 |
* Write the logical relation in infix to a char. |
80 |
|
|
*/ |
81 |
|
|
|
82 |
jds |
54 |
extern void WriteLogRelPostfix(FILE *f, |
83 |
|
|
CONST struct Instance *lrelinst, |
84 |
|
|
CONST struct Instance *ref); |
85 |
|
|
/**< |
86 |
|
|
* <!-- void WriteLogRelPostfix(f,lrelinst,ref) --> |
87 |
|
|
* <!-- FILE *f; --> |
88 |
|
|
* <!-- const struct Instance *lrelinst; --> |
89 |
|
|
* <!-- const struct Instance *ref; --> |
90 |
aw0a |
1 |
* Write the logical relation in postfix to the file indicated. |
91 |
|
|
*/ |
92 |
|
|
|
93 |
johnpye |
1063 |
ASC_DLLSPEC char *WriteLogRelPostfixToString(CONST struct Instance *lrelinst, |
94 |
jds |
54 |
CONST struct Instance *ref); |
95 |
|
|
/**< |
96 |
|
|
* <!-- void WriteRelationPostfixString(lrelinst,ref) --> |
97 |
|
|
* <!-- char *f; --> |
98 |
|
|
* <!-- const struct Instance *lrelinst; --> |
99 |
|
|
* <!-- const struct Instance *ref; --> |
100 |
aw0a |
1 |
* Write the logical relation in postfix to a char |
101 |
|
|
*/ |
102 |
|
|
|
103 |
jds |
54 |
extern void WriteLogRelInfix(FILE *f, |
104 |
|
|
CONST struct Instance *lrelinst, |
105 |
|
|
CONST struct Instance *ref); |
106 |
|
|
/**< |
107 |
|
|
* <!-- void WriteLogRelInfix(f,lrelinst,ref) --> |
108 |
|
|
* <!-- FILE *f; --> |
109 |
|
|
* <!-- const struct Instance *lrelinst; --> |
110 |
|
|
* <!-- const struct Instance *ref; --> |
111 |
aw0a |
1 |
* Write the logical relation in infix to the file indicated. |
112 |
|
|
*/ |
113 |
|
|
|
114 |
jds |
54 |
extern void WriteLogRelationsInTree(FILE *f, struct Instance *lrelinst); |
115 |
|
|
/**< |
116 |
aw0a |
1 |
* Search for logical relations in an instance and write them to the |
117 |
|
|
* file given in various formats. |
118 |
|
|
*/ |
119 |
|
|
|
120 |
jds |
54 |
extern void SaveLogRelBoolVars(FILE *f, CONST struct logrelation *lr); |
121 |
|
|
/**< |
122 |
aw0a |
1 |
* Given a logical relation will save its variable list in the ASCEND |
123 |
|
|
* condensed format. |
124 |
|
|
*/ |
125 |
|
|
|
126 |
|
|
|
127 |
jds |
54 |
extern void SaveLogRel(FILE *f, CONST struct Instance *lrelinst); |
128 |
|
|
/**< |
129 |
aw0a |
1 |
* Given a logical relation will save it in the ASCEND condensed |
130 |
|
|
* format. |
131 |
|
|
*/ |
132 |
|
|
|
133 |
johnpye |
1066 |
/* @} */ |
134 |
aw0a |
1 |
|
135 |
johnpye |
1066 |
#endif /* ASC_LOGRELATION_IO_H */ |
136 |
|
|
|