/[ascend]/trunk/ascend/compiler/syntax.c
ViewVC logotype

Contents of /trunk/ascend/compiler/syntax.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2781 - (show annotations) (download) (as text)
Fri Jun 20 05:12:07 2014 UTC (3 years, 11 months ago) by jpye
File MIME type: text/x-csrc
File size: 2267 byte(s)
remove RCS comments per warnings from clang 3.4
1 /*
2 * Syntax Routines
3 * by Tom Epperly
4 * Created: 3/22/1990
5 * Version: $Revision: 1.11 $
6 * Version control file: $RCSfile: syntax.c,v $
7 * Date last modified: $Date: 1998/04/12 18:31:14 $
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 this program. If not, see <http://www.gnu.org/licenses/>.
26 */
27 #include <ascend/general/platform.h>
28
29
30
31 #include "functype.h"
32 #include "expr_types.h"
33 #include "exprs.h"
34 #include "syntax.h"
35 #ifndef NULL
36 #define NULL 0
37 #endif
38
39 unsigned NumberOfRelOps(struct Expr *ex)
40 {
41 register unsigned count=0;
42 while(ex!=NULL){
43 switch(ExprType(ex)){
44 case e_equal:
45 case e_notequal:
46 case e_less:
47 case e_greater:
48 case e_lesseq:
49 case e_greatereq:
50 case e_boolean_eq:
51 case e_boolean_neq:
52 count++;
53 break;
54 default:
55 break;
56 }
57 ex = NextExpr(ex);
58 }
59 return count;
60 }
61
62
63 /* broken. booleans? */
64 int IsRelation(struct Expr *ex)
65 {
66 while(ex!=NULL){
67 switch(ExprType(ex)){
68 case e_equal:
69 case e_notequal:
70 case e_less:
71 case e_greater:
72 case e_lesseq:
73 case e_greatereq:
74 case e_maximize:
75 case e_minimize:
76 return 1;
77 default:
78 break;
79 }
80 ex = NextExpr(ex);
81 }
82 return 0;
83 }
84
85
86
87 /*
88 * This function controls turning on/off the parse relations
89 * flag. By default it is on. This variable is defined in
90 * ascParse.y.
91
92 Looks like this function is disused -- JP
93
94 */
95 int GetParseRelnsFlag(void)
96 {
97 return g_parse_relns;
98 }
99
100 void SetParseRelnsFlag(int flag)
101 {
102 g_parse_relns = flag;
103 }
104

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