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

Annotation of /trunk/base/generic/compiler/syntax.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 301 - (hide annotations) (download) (as text)
Mon Feb 20 07:39:14 2006 UTC (18 years, 5 months ago) by johnpye
File MIME type: text/x-csrc
File size: 2588 byte(s)
Documentation and indentation changes
1 aw0a 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 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     #include "utilities/ascConfig.h"
31     #include "compiler/compiler.h"
32     #include "compiler/fractions.h"
33     #include "compiler/dimen.h"
34     #include "compiler/functype.h"
35     #include "compiler/types.h"
36     #include "compiler/exprs.h"
37     #include "compiler/syntax.h"
38     #ifndef NULL
39     #define NULL 0
40     #endif
41    
42     #ifndef lint
43     static CONST char SyntaxModuleRCSid[] = "$Id: syntax.c,v 1.11 1998/04/12 18:31:14 ballan Exp $";
44     #endif
45    
46     unsigned NumberOfRelOps(struct Expr *ex)
47     {
48     register unsigned count=0;
49     while(ex!=NULL){
50     switch(ExprType(ex)){
51     case e_equal:
52     case e_notequal:
53     case e_less:
54     case e_greater:
55     case e_lesseq:
56     case e_greatereq:
57     case e_boolean_eq:
58     case e_boolean_neq:
59     count++;
60     break;
61     default:
62     break;
63     }
64     ex = NextExpr(ex);
65     }
66     return count;
67     }
68    
69    
70     /* broken. booleans? */
71     int IsRelation(struct Expr *ex)
72     {
73     while(ex!=NULL){
74     switch(ExprType(ex)){
75     case e_equal:
76     case e_notequal:
77     case e_less:
78     case e_greater:
79     case e_lesseq:
80     case e_greatereq:
81     case e_maximize:
82     case e_minimize:
83     return 1;
84     default:
85     break;
86     }
87     ex = NextExpr(ex);
88     }
89     return 0;
90     }
91    
92    
93    
94     /*
95     * This function controls turning on/off the parse relations
96     * flag. By default it is on. This variable is defined in
97     * ascParse.y.
98 johnpye 301
99     Looks like this function is disused -- JP
100    
101 aw0a 1 */
102     int GetParseRelnsFlag(void)
103     {
104     return g_parse_relns;
105     }
106    
107     void SetParseRelnsFlag(int flag)
108     {
109     g_parse_relns = flag;
110     }
111    

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