/[ascend]/trunk/models/z-context.a4c
ViewVC logotype

Contents of /trunk/models/z-context.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download) (as text)
Fri Oct 29 20:54:12 2004 UTC (19 years, 10 months ago) by aw0a
File MIME type: text/x-ascend
File size: 3827 byte(s)
Setting up web subdirectory in repository
1 REQUIRE "system.a4l";
2 (* => system.a4l, basemodel.a4l *)
3 PROVIDE "z-context.a4c";
4 (*
5 * This file is part of the ASCEND Modeling Library and is released
6 * under the GNU Public License as described at the end of this file.
7 *)
8
9 MODEL fail_context;
10
11 a IS_A real;
12
13 METHODS
14
15 METHOD fail_foo;
16 b IS_A real; (* illegal IS_A. we do not yet have method variables *)
17 END fail_foo;
18
19 METHOD fail_when;
20 WHEN (i) (* illegal when. use SWITCH. also, i not defined. *)
21 CASE TRUE:
22 USE b;
23 END WHEN;
24 END fail_when;
25
26 METHOD fail_select;
27 SELECT (i) (* illegal select until we have local variables. use SWITCH *)
28 CASE TRUE: (* also, i not defined *)
29 USE b;
30 END SELECT;
31 END fail_select;
32
33 METHOD fail_rel;
34 a = b; (* relations not legal (no local data structures) and b not defined *)
35 END fail_rel;
36
37 END fail_context;
38
39 MODEL fail_switchcontext;
40 is IS_A boolean;
41 SWITCH (is) (* illegal in declarative. use when or select *)
42 CASE TRUE: USE j; (* j not defined *)
43 END SWITCH;
44 END fail_switchcontext;
45
46 MODEL fail_ifcontext;
47 is IS_A boolean;
48 IF (is) THEN (* if illegal in declarative. use when instead. *)
49 USE j;
50 END IF;
51 END fail_ifcontext;
52
53 MODEL fail_selectcontext;
54 is IS_A boolean;
55 SELECT (is) (* is must be a constant, not a variable *)
56 CASE TRUE: USE j; (* j undefined *)
57 END SELECT;
58 END fail_selectcontext;
59
60 MODEL pass (
61 a IS_A integer_constant;
62 b WILL_BE set OF integer_constant;
63 c[b] IS_A integer_constant;
64 ) WHERE (
65 FOR i IN b CHECK
66 a==c[i];
67 END FOR;
68 );
69
70 FOR j IN b CREATE
71 x[j] IS_A real;
72 END FOR;
73 METHODS
74 METHOD doo;
75 FOR j IN b DO
76 x[j] := 1;
77 END FOR;
78 END doo;
79 END pass;
80
81 MODEL failcheck (
82 a IS_A integer_constant;
83 b WILL_BE set OF integer_constant;
84 c[b] IS_A integer_constant;
85 ) WHERE (
86 FOR i IN b CHECK
87 a==c[i];
88 END FOR;
89 FOR j IN b CREATE
90 x[j] IS_A real;
91 END FOR;
92 FOR j IN b DO
93 x[j] := 1;
94 END FOR;
95 );
96
97 FOR j IN b CREATE
98 x[j] IS_A real;
99 END FOR;
100 METHODS
101 METHOD doo;
102 FOR j IN b DO
103 x[j] := 1;
104 END FOR;
105 END doo;
106 END failcheck;
107
108 MODEL faildo (
109 a IS_A integer_constant;
110 b WILL_BE set OF integer_constant;
111 c[b] IS_A integer_constant;
112 ) WHERE (
113 FOR i IN b CHECK
114 a==c[i];
115 END FOR;
116 );
117
118 FOR j IN b CREATE
119 x[j] IS_A real;
120 END FOR;
121 METHODS
122 METHOD doo;
123 FOR i IN b CHECK
124 a==c[i];
125 END FOR;
126 FOR j IN b CREATE
127 x[j] IS_A real;
128 END FOR;
129 END doo;
130 END faildo;
131
132 MODEL failcreate (
133 a IS_A integer_constant;
134 b WILL_BE set OF integer_constant;
135 c[b] IS_A integer_constant;
136 ) WHERE (
137 FOR i IN b CHECK
138 a==c[i];
139 END FOR;
140 );
141 FOR j IN b DO
142 x[j] IS_A real;
143 END FOR;
144 FOR j IN b CHECK
145 x[j] IS_A real;
146 END FOR;
147 FOR j IN b EXPECT
148 x[j] IS_A real;
149 END FOR;
150 METHODS
151 METHOD doo;
152 FOR j IN b DO
153 x[j] := 1;
154 END FOR;
155 END doo;
156 END failcreate;
157
158
159 (*
160 * z-context.a4c
161 * by Benjamin Allan
162 * Part of the ASCEND Library
163 * $Date: 1998/06/17 19:39:34 $
164 * $Revision: 1.3 $
165 * $Author: mthomas $
166 * $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/z-context.a4c,v $
167 *
168 * This file is part of the ASCEND Modeling Library.
169 *
170 * Copyright (C) 1998 Carnegie Mellon University
171 *
172 * The ASCEND Modeling Library is free software; you can redistribute
173 * it and/or modify it under the terms of the GNU General Public
174 * License as published by the Free Software Foundation; either
175 * version 2 of the License, or (at your option) any later version.
176 *
177 * The ASCEND Modeling Library is distributed in hope that it
178 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
179 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
180 * See the GNU General Public License for more details.
181 *
182 * You should have received a copy of the GNU General Public License
183 * along with the program; if not, write to the Free Software
184 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check
185 * the file named COPYING.
186 *)

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