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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2781 - (show annotations) (download) (as text)
Fri Jun 20 05:12:07 2014 UTC (4 years, 2 months ago) by jpye
File MIME type: text/x-csrc
File size: 2206 byte(s)
remove RCS comments per warnings from clang 3.4
1 /*
2 * Set output routines
3 * by Tom Epperly
4 * Version: $Revision: 1.9 $
5 * Version control file: $RCSfile: setio.c,v $
6 * Date last modified: $Date: 1997/12/02 12:00:23 $
7 * Last modified by: $Author: ballan $
8 *
9 * This file is part of the Ascend Language Interpreter.
10 *
11 * Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
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
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 */
26
27 #include <ascend/general/platform.h>
28 #include <ascend/general/dstring.h>
29
30 #include "functype.h"
31 #include "expr_types.h"
32 #include "sets.h"
33 #include "setio.h"
34 #include "exprio.h"
35
36 void WriteSetNode(FILE *f, CONST struct Set *s)
37 {
38 if (SetType(s)) {
39 WriteExpr(f,GetLowerExpr(s));
40 PUTC('.',f);
41 PUTC('.',f);
42 WriteExpr(f,GetUpperExpr(s));
43 } else {
44 WriteExpr(f,GetSingleExpr(s));
45 }
46 }
47
48 void WriteSet(FILE *f, CONST struct Set *s)
49 {
50 while(s!=NULL) {
51 WriteSetNode(f,s);
52 s = NextSet(s);
53 if (s!=NULL) {
54 PUTC(',',f);
55 PUTC(' ',f);
56 }
57 }
58 }
59
60 /*
61 * These functions are similar to those above, but write to
62 * a dynamic string, rather than to a FILE *.
63 */
64 void WriteSetNode2Str(Asc_DString *dstring, CONST struct Set *s)
65 {
66 if (SetType(s)) {
67 WriteExpr2Str(dstring,GetLowerExpr(s));
68 Asc_DStringAppend(dstring,"..",-1);
69 WriteExpr2Str(dstring,GetUpperExpr(s));
70 }
71 else
72 WriteExpr2Str(dstring,GetSingleExpr(s));
73 }
74
75 void WriteSet2Str(Asc_DString *dstring, CONST struct Set *s)
76 {
77 while(s!=NULL) {
78 WriteSetNode2Str(dstring,s);
79 s = NextSet(s);
80 if (s!=NULL)
81 Asc_DStringAppend(dstring,",",-1);
82 }
83 }
84
85

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