libutap  0.93
Uppaal Timed Automata Parser
system.cpp
Go to the documentation of this file.
1 // -*- mode: C++; c-file-style: "stroustrup"; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2 
3 /* libutap - Uppaal Timed Automata Parser.
4  Copyright (C) 2002-2006 Uppsala University and Aalborg University.
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public License
8  as published by the Free Software Foundation; either version 2.1 of
9  the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful, but
12  WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library; if not, write to the Free Software
18  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  USA
20 */
21 
22 #include "utap/builder.h"
23 #include "utap/system.h"
24 #include "utap/statement.h"
25 #include "libparser.h"
26 
27 #include <stack>
28 #include <algorithm>
29 #include <cstdio>
30 #include <cstring>
31 #include <climits>
32 #include <cassert>
33 #include <sstream>
34 
35 using namespace UTAP;
36 using namespace Constants;
37 
38 using std::list;
39 using std::stack;
40 using std::vector;
41 using std::map;
42 using std::pair;
43 using std::make_pair;
44 using std::min;
45 using std::max;
46 using std::set;
47 using std::string;
48 using std::ostream;
49 using std::deque;
50 
51 static const char *const unsupported
52 = "Internal error: Feature not supported in this mode.";
53 static const char *const invalid_type = "$Invalid_type";
54 
55 string state_t::toString() const
56 {
57  std::string str = "LOCATION (";
58  str += uid.getName() + ", " + invariant.toString() + ")";
59  return str;
60 }
61 
62 string edge_t::toString() const
63 {
64  std::string str = "EDGE (" + src->toString() + " " + dst->toString() + ")\n";
65  str += "\t" + guard.toString() + ", " + sync.toString() + ", " + assign.toString();
66  return str;
67 }
68 
70 {
71  delete body;
72 }
73 
74 string function_t::toString() const
75 {
76  string str = "";
77  string type = uid.getType().get(0).toDeclarationString(); //return type
78  str += type + " " + uid.getName();
79  str += "(";
80  for (uint32_t i = 1; i < uid.getType().size(); ++i) // parameters
81  {
82  if (!uid.getType().getLabel(i).empty())
83  {
84  str += uid.getType().get(i).toDeclarationString();
85  str += " ";
86  str += uid.getType().getLabel(i);
87  str += ", ";
88  }
89  }
90  if (uid.getType().size()>1)
91  str = str.substr(0, str.size()-2);
92  str += ")\n{\n";
93 
94  std::list<variable_t>::const_iterator itr;
95  for (itr = variables.begin(); itr != variables.end(); ++itr) // variables
96  {
97  str += " " + itr->toString();
98  str += ";\n";
99  }
100  str += body->toString(INDENT);
101  str += "}";
102  return str;
103 }
104 
105 string variable_t::toString() const
106 {
107  string str = "";
108  string type = "";
109  if (uid.getType().isArray())
110  {
111  type = uid.getType().toDeclarationString();
112  size_t i = type.find('[');
113  str += type.substr(0, (int)i);
114  str += " ";
115  str += uid.getName();
116  str += type.substr((int)i , type.size() - (int)i);
117  }
118  else
119  {
120  str += uid.getType().toDeclarationString() + " "
121  + uid.getName();
122  }
123  if (!expr.empty())
124  {
125  str += " = " + expr.toString();
126  }
127  return str;
128 }
129 
130 bool declarations_t::addFunction(type_t type, const string& name, function_t *&fun)
131 {
132  bool duplicate = frame.getIndexOf(name) != -1;
133  functions.push_back(function_t());
134  fun = &functions.back();
135  fun->uid = frame.addSymbol(name, type, fun); // Add symbol
136  return !duplicate;
137 }
138 
139 string declarations_t::toString(bool global) const
140 {
141  string str = "";
142  str += getConstants();
143  str += "\n";
144  str += getTypeDefinitions();
145  str += "\n";
146  str += getVariables(global);
147  str += "\n";
148  str += getFunctions();
149  return str;
150 }
151 
153 {
154  list<variable_t>::const_iterator v_itr = variables.begin();
155  string str = "";
156  int i = 0;
157  // constants
158  if (!variables.empty()){
159  while (v_itr != variables.end())
160  {
161  if (i == 0)
162  {
163  str += "// constants\n";
164  i++;
165  }
166  if (v_itr->uid.getType().getKind() == CONSTANT)
167  {
168  str += v_itr->toString();
169  str += ";\n";
170  }
171  ++v_itr;
172  }
173  }
174  return str;
175 }
176 
178 {
179  string str = "";
180  // type definitions
181  int j = 0;
182  for (uint32_t i = 0; i < frame.getSize(); ++i)
183  {
184  if (frame[i].getType().getKind() == TYPEDEF)
185  {
186  if (j==0)
187  {
188  str += "// type definitions\n";
189  j++;
190  }
191  str += frame[i].getType().toDeclarationString() + ";\n";
192  }
193  }
194  return str;
195 }
196 
197 string declarations_t::getVariables(bool global) const
198 {
199  list<variable_t>::const_iterator v_itr = variables.begin();
200  string str = "";
201  int i = 0;
202  // variables
203  if (!variables.empty()){
204  if (global) ++v_itr; // the first variable is "t(0)"
205  while (v_itr != variables.end())
206  {
207  if (i == 0)
208  {
209  str += "// variables\n";
210  i++;
211  }
212  if (v_itr->uid.getType().getKind() != CONSTANT)
213  {
214  str += v_itr->toString();
215  str += ";\n";
216  }
217  ++v_itr;
218  }
219  }
220  return str;
221 }
222 
224 {
225  list<function_t>::const_iterator f_itr;
226  string str = "";
227  // functions
228  if (!functions.empty()){
229  str += "// functions\n";
230  for (f_itr = functions.begin(); f_itr != functions.end(); ++f_itr)
231  {
232  str += f_itr->toString();
233  str += "\n\n";
234  }
235  }
236  return str;
237 }
238 
239 std::string instance_t::writeMapping() const
240 {
241  std::string str = "";
242  std::map<symbol_t, expression_t>::const_iterator itr;
243  for (itr = mapping.begin(); itr != mapping.end(); ++itr)
244  {
245  str += itr->first.getName() + " = " + itr->second.toString() + "\n";
246  }
247  return str;
248 }
249 
250 std::string instance_t::writeParameters() const
251 {
252  std::string str = "";
253  for (uint32_t i = 0; i < parameters.getSize(); ++i)
254  {
255  str += parameters[i].getType().toDeclarationString()
256  + " " + parameters[i].getName() + ", ";
257  }
258  if (parameters.getSize() > 0)
259  {
260  str = str.substr(0, str.size() -2);
261  }
262  return str;
263 }
264 
265 std::string instance_t::writeArguments() const
266 {
267  std::string str = "";
268  std::map<symbol_t, expression_t>::const_iterator itr;
269  for (uint32_t i = 0; i < parameters.getSize(); ++i)
270  {
271  for (itr = mapping.begin(); itr != mapping.end(); ++ itr)
272  {
273  if ( itr->first == parameters[i])
274  {
275  str += itr->second.toString();
276  str += ", ";
277  }
278  }
279  }
280  if (parameters.getSize() > 0)
281  {
282  str = str.substr(0, str.size() -2);
283  }
284  return str;
285 }
286 
288 {
289  bool duplicate = frame.getIndexOf(name) != -1;
290 
291  states.push_back(state_t());
292  state_t &state = states.back();
293  state.uid = frame.addSymbol(name, type_t::createPrimitive(LOCATION), &state);
294  state.locNr = states.size() - 1;
295  state.invariant = inv;
296  state.exponentialRate = er;
297 
298  if (duplicate)
299  {
300  throw TypeException(boost::format("$Duplicate_definition_of %1%") % name);
301  }
302 
303  return state;
304 }
305 
306 // FIXME: like for unnamed locations, a name is autegenerated
307 // this name may conflict with user-defined names
309 {
310  bool duplicate = frame.getIndexOf(name) != -1;
311 
312  branchpoints.push_back(branchpoint_t());
313  branchpoint_t &branchpoint = branchpoints.back();
314  branchpoint.uid = frame.addSymbol(name, type_t::createPrimitive(BRANCHPOINT), &branchpoint);
315  branchpoint.bpNr = branchpoints.size() - 1;
316 
317  if (duplicate)
318  {
319  throw TypeException(boost::format("$Duplicate_definition_of %1%") % name);
320  }
321 
322  return branchpoint;
323 }
324 
325 edge_t &template_t::addEdge(symbol_t src, symbol_t dst, bool control, const string& actname)
326 {
327  int32_t nr = edges.empty() ? 0 : edges.back().nr + 1;
328  edges.push_back(edge_t());
329  if (src.getType().isLocation())
330  {
331  edges.back().src = static_cast<state_t*>(src.getData());
332  edges.back().srcb = 0;
333  }
334  else
335  {
336  edges.back().src = 0;
337  edges.back().srcb = static_cast<branchpoint_t*>(src.getData());
338  }
339  if (dst.getType().isLocation())
340  {
341  edges.back().dst = static_cast<state_t*>(dst.getData());
342  edges.back().dstb = 0;
343  }
344  else
345  {
346  edges.back().dst = 0;
347  edges.back().dstb = static_cast<branchpoint_t*>(dst.getData());
348  }
349 
350  edges.back().control = control;
351  edges.back().actname = actname;
352  edges.back().nr = nr;
353  return edges.back();
354 }
355 
356 //LSC
358 {
359  //bool duplicate = frame.getIndexOf(name) != -1;
360 
361  instances.push_back(instanceLine_t());
362  instanceLine_t &instance = instances.back();
363  //instance.uid = frame.addSymbol(name, type_t::createPrimitive(INSTANCELINE), &instance);
364  instance.instanceNr = instances.size() - 1;
365 
366 // if (duplicate)
367 // {
368 // throw TypeException(boost::format("$Duplicate_definition_of %1%") % name);
369 // }
370 
371  return instance;
372 }
373 
375  int loc, bool pch)
376 {
377  int32_t nr = messages.empty() ? 0 : messages.back().nr + 1;
378  messages.push_back(message_t());
379  messages.back().src = static_cast<instanceLine_t*>(src.getData());
380  messages.back().dst = static_cast<instanceLine_t*>(dst.getData());
381  messages.back().location = loc;
382  messages.back().isInPrechart = pch;
383  messages.back().nr = nr;
384  return messages.back();
385 }
386 
387 update_t &template_t::addUpdate(symbol_t anchor, int loc, bool pch)
388 {
389  int32_t nr = updates.empty() ? 0 : updates.back().nr + 1;
390  updates.push_back(update_t());
391  updates.back().anchor = static_cast<instanceLine_t*>(anchor.getData());
392  updates.back().location = loc;
393  updates.back().isInPrechart = pch;
394  updates.back().nr = nr;
395  return updates.back();
396 }
397 
398 condition_t &template_t::addCondition(vector<symbol_t> anchors, int loc,
399  bool pch, bool isHot)
400 {
401  int32_t nr = conditions.empty() ? 0 : conditions.back().nr + 1;
402  conditions.push_back(condition_t());
403 
404  for (unsigned int i(0); i<anchors.size(); ++i){
405  conditions.back().anchors.push_back(static_cast<instanceLine_t*>(anchors[i].getData()));//TODO
406  }
407  conditions.back().location = loc;
408  conditions.back().isInPrechart = pch;
409  conditions.back().nr = nr;
410  conditions.back().isHot = isHot;
411  return conditions.back();
412 }
413 
414 
415 static deque<int> messages_nr(deque<message_t> messages)
416 {
417  deque<message_t>::iterator itr;
418  deque<int> d;
419 
420  for (itr = messages.begin(); itr != messages.end(); ++itr)
421  {
422  d.push_back(itr->nr);
423  }
424  return d;
425 }
426 
427 static deque<int> conditions_nr(deque<condition_t> conditions)
428 {
429  deque<condition_t>::iterator itr;
430  deque<int> d;
431 
432  for (itr = conditions.begin(); itr != conditions.end(); ++itr)
433  {
434  d.push_back(itr->nr);
435  }
436  return d;
437 }
438 
439 static deque<int> updates_nr(deque<update_t> updates)
440 {
441  deque<update_t>::iterator itr;
442  deque<int> d;
443 
444  for (itr = updates.begin(); itr != updates.end(); ++itr)
445  {
446  d.push_back(itr->nr);
447  }
448  return d;
449 }
450 
460 const vector<simregion_t> template_t::getSimregions()
461 {
462  // cout <<"=======LSC: getSimregions=======\n";
466  deque<int> m_nr = messages_nr(messages);
467  deque<int> c_nr = conditions_nr(conditions);
468  deque<int> u_nr = updates_nr(updates);
469 
470  deque<int>::iterator m_itr;
471  deque<int>::iterator c_itr;
472  deque<int>::iterator u_itr;
473 
474  vector<simregion_t> simregions;
475  simregion_t s;
476  instanceLine_t *source;
477  instanceLine_t *target;
478  int y;
479  int nr = 0;
480 
484  for (m_itr = m_nr.begin(); m_itr!=m_nr.end(); ++m_itr)
485  {
486  simregion_t s = simregion_t();
487  s.setMessage(messages, *m_itr);
488 
489  source = s.message->src;
490  target = s.message->dst;
491  y = s.message->location;
496  if (getCondition(target, y, s.condition))
497  {
498  for (c_itr = c_nr.begin(); c_itr != c_nr.end(); ++c_itr)
499  {
500  if (*c_itr == s.condition->nr)
501  {
502  c_nr.erase(c_itr);
503  break;
504  }
505  }
506  }
507  else if (getCondition(source, y, s.condition))
508  {
509  for (c_itr = c_nr.begin(); c_itr != c_nr.end(); ++c_itr)
510  {
511  if (*c_itr == s.condition->nr)
512  {
513  c_nr.erase(c_itr);
514  break;
515  }
516  }
517  }
518  if (getUpdate(target, y, s.update))
519  {
520  for (u_itr = u_nr.begin(); u_itr != u_nr.end(); ++u_itr)
521  {
522  if (*u_itr == s.update->nr)
523  {
524  u_nr.erase(u_itr);
525  break;
526  }
527  }
528  }
529  else if (getUpdate(source, y, s.update))
530  {
531  for (u_itr = u_nr.begin(); u_itr != u_nr.end(); ++u_itr)
532  {
533  if (*u_itr == s.update->nr)
534  {
535  u_nr.erase(u_itr);
536  break;
537  }
538  }
539  }
540  s.nr = nr;
541  simregions.push_back(s);
542  nr++;
543  }
544 
548  for (c_itr = c_nr.begin(); c_itr != c_nr.end(); ++c_itr)
549  {
550  s = simregion_t();
551  s.setCondition(conditions, *c_itr);
552 
553  y = s.condition->location;
554  if (getUpdate(s.condition->anchors, y, s.update))
555  {
556  for (u_itr = u_nr.begin(); u_itr != u_nr.end(); ++u_itr)
557  {
558  if (*u_itr == s.update->nr)
559  {
560  u_nr.erase(u_itr);
561  break;
562  }
563  }
564  }
565  s.nr = nr;
566  simregions.push_back(s);
567  nr++;
568  }
569 
573  for (u_itr = u_nr.begin(); u_itr != u_nr.end(); ++u_itr)
574  {
575  s = simregion_t();
576  s.setUpdate(updates, *u_itr);
577  s.nr = nr;
578  simregions.push_back(s);
579  nr++;
580  }
581 
582  /*// cout << "-----unordered simregions-----\n";
583  for (unsigned int i = 0; i < simregions.size(); ++i){
584  // cout << simregions[i].toString() << " " << simregions[i].nr<< "\n";
585  } //test OK*/
586 
587  return simregions;
588 }
589 
594 bool template_t::getCondition(instanceLine_t* instance, int y, condition_t*& simCondition)
595 {
596  deque<condition_t>::iterator i;
597  vector<instanceLine_t*>::iterator j;
598 
599  for (i = conditions.begin(); i != conditions.end(); ++i)
600  {
601  condition_t& condition = *i;
602  if (condition.location == y)
603  {
604  vector<instanceLine_t*>& anchors = condition.anchors;
605  for (j = anchors.begin(); j != anchors.end(); ++j)
606  {
607  instanceLine_t* instancej = *j;
608  if (instancej->instanceNr == instance->instanceNr)
609  {
610  simCondition = &condition;
611  return true;
612  }
613  }
614  }
615  }
616  return false;
617 }
618 
623 bool template_t::getUpdate(instanceLine_t* instance, int y, update_t*& simUpdate)
624 {
625  deque<update_t>::iterator i;
626  for (i = updates.begin(); i != updates.end(); ++i)
627  {
628  update_t& update = *i;
629  if (update.location == y)
630  {
631  if (update.anchor->instanceNr == instance->instanceNr)
632  {
633  simUpdate = &update;
634  return true;
635  }
636  }
637  }
638  return false;
639 }
640 
645 bool template_t::getUpdate(const vector<instanceLine_t*>& instances, int y, update_t*& simUpdate)
646 {
647  vector<instanceLine_t*>::const_iterator j;
648  update_t update;
649 
650  for (j = instances.begin(); j != instances.end(); ++j)
651  {
652  if (getUpdate(*j, y, simUpdate))
653  return true;
654  }
655  return false;
656 }
657 
659  const vector<expression_t> &arguments1)
660 {
661  unbound = params.getSize();
662  parameters = params;
663  parameters.add(inst.parameters);
664  mapping = inst.mapping;
665  arguments = arguments1.size();
666  templ = inst.templ;
667 
668  for (size_t i = 0; i < arguments1.size(); i++)
669  {
670  mapping[inst.parameters[i]] = arguments1[i];
671  }
672 }
677 vector<simregion_t> instanceLine_t::getSimregions(const vector<simregion_t>& simregions)
678 {
679  vector<simregion_t> i_simregions;
680  vector<simregion_t>::const_iterator itr;
681  vector<simregion_t>::iterator itr1;
682  vector<instanceLine_t*>::const_iterator it;
683  instanceLine_t* instance;
684  //get the simregions anchored to this instance
685  for (itr = simregions.begin(); itr != simregions.end(); ++itr) {
686  message_t* m = itr->message;
687  if (m->nr != -1 && (m->src->instanceNr == this->instanceNr
688  || m->dst->instanceNr == this->instanceNr) ) {
689  i_simregions.push_back(*itr);
690  continue;
691  }
692 
693  update_t* u = itr->update;
694  if ( u->nr != -1 && u->anchor->instanceNr == this->instanceNr ) {
695  i_simregions.push_back(*itr);
696  continue;
697  }
698 
699  condition_t* c = itr->condition;
700  if (c->nr != -1) {
701  for (it = c->anchors.begin(); it !=c->anchors.end(); ++it) {
702  instance = *it;
703  if (instance->instanceNr == this->instanceNr) {
704  i_simregions.push_back(*itr);
705  break;
706  }
707  }
708  }
709  }
710  //ordering the simregions by location number
711  sort(i_simregions.begin(), i_simregions.end(), compare_simregion());
712 
713 // std::cout << "--------instance--------\n";
714 // for (unsigned int i=0; i< i_simregions.size(); ++i) {
715 // std::cout << i_simregions[i].toString() << " " << i_simregions[i].getLoc()
716 // << " " << i_simregions[i].isInPrechart()<<"\n";
717 // } //test OK
718 
719  return i_simregions;
720 }
721 
722 
724 {
725  if (this->message->nr != -1)
726  {
727  return this->message->location;
728  }
729  if (this->condition->nr != -1)
730  {
731  return this->condition->location;
732  }
733  if (this->update->nr != -1)
734  {
735  return this->update->location;
736  }
737  return -1;//should not happen
738 }
739 
741 {
742  if (this->message && this->message->nr != -1)
743  {
744  return this->message->isInPrechart;
745  }
746  if (this->condition && this->condition->nr != -1)
747  {
748  return this->condition->isInPrechart;
749  }
750  if (this->update && this->update->nr != -1)
751  {
752  return this->update->isInPrechart;
753  }
754  return false;//should not happen
755 }
756 
757 void simregion_t::setMessage(std::deque<message_t>& messages, int nr) {
758  std::deque<message_t>::iterator i;
759  for (i = messages.begin(); i != messages.end(); ++i) {
760  if (i->nr == nr){
761  this->message = &(*i);
762  return;
763  }
764  }
765 }
766 
767 void simregion_t::setCondition(std::deque<condition_t>& conditions, int nr) {
768  std::deque<condition_t>::iterator i;
769  for (i = conditions.begin(); i != conditions.end(); ++i) {
770  if (i->nr == nr){
771  this->condition = &(*i);
772  return;
773  }
774  }
775 }
776 
777 void simregion_t::setUpdate(std::deque<update_t>& updates, int nr) {
778  std::deque<update_t>::iterator i;
779  for (i = updates.begin(); i != updates.end(); ++i) {
780  if (i->nr == nr){
781  this->update = &(*i);
782  return;
783  }
784  }
785 }
786 
787 std::string simregion_t::toString() const {
788  std::string s="s(";
789  if (message->nr != -1) {
790  s += ("m:" + message->label.toString() + " ");
791  }
792  if (condition->nr != -1) {
793  std::string b = (condition->isHot) ? " HOT " : "";
794  s += ("c:" + b + (condition->label.toString()) + " ");
795  }
796  if (update->nr != -1) {
797  s += ("u:" + update->label.toString() + " ");
798  }
799  s = s.substr(0, s.size()-1);
800  s += ")";
801  return s;
802 }
803 
804 
806  std::vector<simregion_t>::iterator sim;
807  for (sim = simregions.begin(); sim != simregions.end(); ++sim) {
808  if (sim->nr == s.nr) {
809  simregions.erase(sim);
810  return;
811  }
812  }
813 }
815  std::vector<simregion_t>::iterator sim;
816  for (sim = simregions.begin(); sim != simregions.end(); ++sim) {
817  if (sim->nr == s.nr) {
818  return true;
819  }
820  }
821  return false;
822 }
823 
834 bool cut_t::isInPrechart(const simregion_t& fSimregion) const {
835  std::vector<simregion_t>::const_iterator sim;
836  std::vector<simregion_t>::const_iterator fsim;
837  for (sim = simregions.begin(); sim != simregions.end(); ++sim)
838  {
839  if (! sim->isInPrechart())
840  {
841  return false;
842  }
843  }
844  if (!fSimregion.isInPrechart())
845  {
846  return false;
847  }
848  return true;
849 }
850 
852 {
853  std::vector<simregion_t>::const_iterator sim;
854  for (sim = simregions.begin(); sim != simregions.end(); ++sim)
855  {
856  if (! sim->isInPrechart())
857  {
858  return false;
859  }
860  }
861  return true;
862 }
863 
864 bool cut_t::equals(const cut_t& y) const {
865  std::vector<simregion_t>::const_iterator s;
866  std::vector<simregion_t>::iterator sim;
867  int xsize = simregions.size();
868  int ysize = y.simregions.size();
869  if ( xsize != ysize)
870  return false;
871  std::vector<simregion_t> ycopy = std::vector<simregion_t>(y.simregions);
872  for (s = simregions.begin(); s != simregions.end(); ++s)
873  {
874  for (sim = ycopy.begin(); sim != ycopy.end(); ++sim)
875  {
876  if (sim->nr == s->nr)
877  {
878  ycopy.erase(sim);
879  break;
880  }
881  }
882  }
883  return (ycopy.empty()) ? true : false;
884 }
885 
886 
891 {
892  if (this->isTA)
893  {
894  return false;
895  }
896  return (strcasecmp(this->mode.c_str(), "invariant") == 0);
897 }
898 
900 {
901  std::ostringstream stream;
902  stream << "chan priority ";
903  string head_s = head.toString();
904  if (head_s.size() == 0) head_s = "default";
905 
906  stream << head_s;
907  std::list<entry>::const_iterator itr;
908  for (itr = tail.begin(); itr != tail.end(); ++itr)
909  {
910  if (itr->first == '<') stream << " ";
911  stream << itr->first << " ";
912  stream << itr->second.toString();
913  }
914  return stream.str();
915 }
916 
918 {
921 #ifdef ENABLE_CORA
923 #endif
924 
925  hasUrgentTrans = false;
926  hasPriorities = false;
927  hasStrictInv = false;
928  stopsClock = false;
930  hasGuardOnRecvBroadcast = false;
932  modified = false;
933 }
934 
936 
937 {
938  // TODO
939  // clone ref (functions)
940  // redirect pointers (edges)
941  // clone frame_t - can be problematic
942 
943  throw TypeException("TODO");
944 }
945 
947 {
948 
949 }
950 
952 {
953  return templates;
954 }
955 
957 {
958  return processes;
959 }
960 
962 {
963  return global;
964 }
965 
972  const bool isTA, const string& typeLSC, const string& mode)
973 {
974  type_t type = (isTA) ? type_t::createInstance(params) :
976 
977  templates.push_back(template_t());
978  template_t &templ = templates.back();
979  templ.parameters = params;
981  templ.frame.add(params);
982  templ.templ = &templ;
983  templ.uid = global.frame.addSymbol(name, type, (instance_t*)&templ);
984  templ.arguments = 0;
985  templ.unbound = params.getSize();
986  templ.isTA = isTA;
987  templ.dynamic = false;
988  //LSC
989  templ.type = typeLSC;
990  templ.mode = mode;
991  return templ;
992 }
993 
995  frame_t params)
996 {
997  type_t type = type_t::createInstance (params);
998  dynamicTemplates.push_back(template_t());
999  template_t &templ = dynamicTemplates.back();
1000  templ.parameters = params;
1002  templ.frame.add (params);
1003  templ.templ = &templ;
1004  templ.uid = global.frame.addSymbol(name,type,(instance_t*)&templ);
1005  templ.arguments = 0;
1006  templ.unbound = params.getSize();
1007  templ.isTA = true;
1008  templ.dynamic = true;
1009  templ.dynindex = dynamicTemplates.size()-1;
1010  templ.isDefined = false;
1011  return templ;
1012 }
1013 
1014 std::vector<template_t*> & TimedAutomataSystem::getDynamicTemplates()
1015 {
1016  if (dynamicTemplatesVec.size () != dynamicTemplates.size()) {
1017  dynamicTemplatesVec.clear ();
1018  std::list<template_t>::iterator it;
1019  for (it = dynamicTemplates.begin(); it!=dynamicTemplates.end(); ++it) {
1020  dynamicTemplatesVec.push_back(&(*it));
1021  }
1022  }
1023  return dynamicTemplatesVec;
1024 }
1025 
1027 {
1028  std::list<template_t>::iterator it;
1029  for (it = dynamicTemplates.begin(); it!=dynamicTemplates.end(); ++it) {
1030  if (it->uid.getName() == name)
1031  return &(*it);
1032  }
1033  return NULL;
1034 
1035 }
1036 
1038  const string& name, instance_t &inst, frame_t params,
1039  const vector<expression_t> &arguments)
1040 {
1041  type_t type = type_t::createInstance(params);
1042 
1043  instances.push_back(instance_t());
1044  instance_t &instance = instances.back();
1045  instance.uid = global.frame.addSymbol(name, type, &instance);
1046  instance.unbound = params.getSize();
1047  instance.parameters = params;
1048  instance.parameters.add(inst.parameters);
1049  instance.mapping = inst.mapping;
1050  instance.arguments = arguments.size();
1051  instance.templ = inst.templ;
1052 
1053  for (size_t i = 0; i < arguments.size(); i++)
1054  {
1055  instance.mapping[inst.parameters[i]] = arguments[i];
1056  }
1057 
1058  return instance;
1059 }
1060 
1062  const string& name, instance_t &inst, frame_t params,
1063  const vector<expression_t> &arguments)
1064 {
1065  type_t type = type_t::createLscInstance(params);
1066 
1067  lscInstances.push_back(instance_t());
1068  instance_t &instance = lscInstances.back();
1069  instance.uid = global.frame.addSymbol(name, type, &instance);
1070  instance.unbound = params.getSize();
1071  instance.parameters = params;
1072  instance.parameters.add(inst.parameters);
1073  instance.mapping = inst.mapping;
1074  instance.arguments = arguments.size();
1075  instance.templ = inst.templ;
1076 
1077  for (size_t i = 0; i < arguments.size(); i++)
1078  {
1079  instance.mapping[inst.parameters[i]] = arguments[i];
1080  }
1081 
1082  return instance;
1083 }
1084 
1086 {
1087  getGlobals().frame.remove(instance.uid);
1088  std::list<instance_t>::iterator itr;
1089  for (itr = processes.begin(); itr != processes.end(); ++itr)
1090  {
1091  if (itr->uid == instance.uid) {
1092  processes.erase(itr);
1093  break;
1094  }
1095  }
1096 }
1097 
1099 {
1100  type_t type;
1101  processes.push_back(instance);
1102  instance_t &process = processes.back();
1103  if (process.unbound == 0)
1104  {
1105  type = type_t::createProcess(process.templ->frame);
1106  }
1107  else
1108  {
1109  type = type_t::createProcessSet(instance.uid.getType());
1110  }
1111  process.uid = global.frame.addSymbol(
1112  instance.uid.getName(), type, &process);
1113 }
1114 
1116 {
1117  context->ganttChart.push_back(g);
1118 }
1119 
1121  queries.push_back(query);
1122 }
1123 
1125  return queries.empty();
1126 }
1127 
1129  return queries;
1130 }
1131 
1132 // Add a regular variable
1134  declarations_t *context, type_t type, const string& name, expression_t initial)
1135 {
1136  variable_t *var;
1137  var = addVariable(context->variables, context->frame, type, name);
1138  var->expr = initial;
1139  return var;
1140 }
1141 
1143  function_t *function, frame_t frame, type_t type, const string& name,
1144  expression_t initial)
1145 {
1146  variable_t *var;
1147  var = addVariable(function->variables, frame, type, name);
1148  var->expr = initial;
1149  return var;
1150 }
1151 
1152 // Add a regular variable
1154  list<variable_t> &variables, frame_t frame, type_t type, const string& name)
1155 {
1156  bool duplicate = frame.getIndexOf(name) != -1;
1157  variable_t *var;
1158 
1159  // Add variable
1160  variables.push_back(variable_t());
1161  var = &variables.back();
1162 
1163  // Add symbol
1164  var->uid = frame.addSymbol(name, type, var);
1165 
1166  if (duplicate)
1167  {
1168  throw TypeException(boost::format("$Duplicate_definition_of %1%") % name);
1169  }
1170 
1171  return var;
1172 }
1173 
1175 {
1176  std::list<UTAP::variable_t>::iterator v_itr;
1177  for (v_itr = from->variables.begin(); v_itr != from->variables.end(); ++v_itr)
1178  {
1179  to->variables.push_back(*v_itr);
1180  to->frame.add(v_itr->uid);
1181  }
1182 }
1183 
1185 {
1186 //TODO to be implemented and to be used in Translator::procBegin (see Translator.cpp)
1187 }
1188 
1190  declarations_t *context, expression_t guard, expression_t measure)
1191 {
1192  progress_t p;
1193  p.guard = guard;
1194  p.measure = measure;
1195  context->progress.push_back(p);
1196 }
1197 
1198 static void visit(SystemVisitor &visitor, frame_t frame)
1199 {
1200  for (size_t i = 0; i < frame.getSize(); i++)
1201  {
1202  type_t type = frame[i].getType();
1203 
1204  if (type.getKind() == TYPEDEF)
1205  {
1206  visitor.visitTypeDef(frame[i]);
1207  continue;
1208  }
1209 
1210  void *data = frame[i].getData();
1211  type = type.stripArray();
1212 
1213  if ((type.is(Constants::INT)
1214  || type.is(Constants::DOUBLE)
1215  || type.is(Constants::BOOL)
1216  || type.is(CLOCK)
1217  || type.is(CHANNEL)
1218  || type.is(SCALAR)
1219  || type.getKind() == RECORD)
1220  && data != NULL) // <--- ignore parameters
1221  {
1222  visitor.visitVariable(*static_cast<variable_t*>(data));
1223  }
1224  else if (type.is(LOCATION))
1225  {
1226  visitor.visitState(*static_cast<state_t*>(data));
1227  }
1228  else if (type.is(FUNCTION))
1229  {
1230  visitor.visitFunction(*static_cast<function_t*>(data));
1231  }
1232  else if (type.is(INSTANCELINE))
1233  {
1234  visitor.visitInstanceLine(*static_cast<instanceLine_t*>(data));
1235  }
1236  }
1237 }
1238 
1240 {
1241  visitor.visitSystemBefore(this);
1242  visit(visitor, global.frame);
1243 
1244  auto visit_template = [&visitor](template_t& t) {
1245  if (visitor.visitTemplateBefore(t))
1246  {
1247  visit(visitor, t.frame);
1248  for (auto& edge: t.edges)
1249  visitor.visitEdge(edge);
1250  for (auto& message: t.messages)
1251  visitor.visitMessage(message);
1252  for (auto& update: t.updates)
1253  visitor.visitUpdate(update);
1254  for (auto& condition: t.conditions)
1255  visitor.visitCondition(condition);
1256  visitor.visitTemplateAfter(t);
1257  }
1258  };
1259 
1260  for (auto& t: templates)
1261  visit_template(t);
1262 
1263  for (auto& t: dynamicTemplates)
1264  visit_template(t);
1265 
1266  for (size_t i = 0; i < global.frame.getSize(); i++)
1267  {
1268  auto frame = global.frame[i];
1269  type_t type = frame.getType();
1270  void *data = frame.getData();
1271  type = type.stripArray();
1272 
1273  if (type.is(PROCESS) || type.is(PROCESSSET))
1274  {
1275  visitor.visitProcess(*static_cast<instance_t*>(data));
1276  }
1277  else if (type.is(INSTANCE))
1278  {
1279  visitor.visitInstance(*static_cast<instance_t*>(data));
1280  }
1281  else if (type.is(LSCINSTANCE))
1282  {
1283  visitor.visitInstance(*static_cast<instance_t*>(data));
1284  }
1285  }
1286 
1287  for (auto& iodecl: global.iodecl)
1288  visitor.visitIODecl(iodecl);
1289 
1290  // Maybe not ideal place for this:
1291  for (auto& progress: global.progress)
1292  visitor.visitProgressMeasure(progress);
1293 
1294  for (auto& gantt: global.ganttChart)
1295  visitor.visitGanttChart(gantt);
1296 
1297  visitor.visitSystemAfter(this);
1298 }
1299 
1301 {
1302  beforeUpdate = e;
1303 }
1304 
1306 {
1307  return beforeUpdate;
1308 }
1309 
1311 {
1312  afterUpdate = e;
1313 }
1314 
1316 {
1317  return afterUpdate;
1318 }
1319 
1321 {
1322  hasPriorities |= true;
1323  chan_priority_t priorities;
1324  priorities.head = chan;
1325  chanPriorities.push_back(priorities);
1326 }
1327 
1329 {
1330  assert(separator == ',' || separator == '<');
1331  chan_priority_t::tail_t& tail = chanPriorities.back().tail;
1332  tail.push_back(chan_priority_t::entry(separator, chan));
1333 }
1334 
1335 const std::list<chan_priority_t>& TimedAutomataSystem::getChanPriorities() const
1336 {
1337  return chanPriorities;
1338 }
1339 
1341 {
1342  return chanPriorities;
1343 }
1344 
1345 void TimedAutomataSystem::setProcPriority(const char* name, int priority)
1346 {
1347  hasPriorities |= (priority != 0);
1348  procPriority[name] = priority;
1349 }
1350 
1351 int TimedAutomataSystem::getProcPriority(const char* name) const
1352 {
1353  assert(procPriority.find(name) != procPriority.end());
1354  return procPriority.find(name)->second;
1355 }
1356 
1358 {
1359  return hasPriorities;
1360 }
1361 
1363 {
1364  hasStrictInv = true;
1365 }
1366 
1368 {
1369  return hasStrictInv;
1370 }
1371 
1373 {
1374  stopsClock = true;
1375 }
1376 
1378 {
1379  return stopsClock;
1380 }
1381 
1383 {
1385 }
1386 
1388 {
1390 }
1391 
1393  uint32_t position, uint32_t offset, uint32_t line, const std::string& path)
1394 {
1395  positions.add(position, offset, line, path);
1396 }
1397 
1399 {
1400  return positions.find(position);
1401 }
1402 
1403 void TimedAutomataSystem::addError(position_t position, const std::string& msg,
1404  const std::string& context)
1405 {
1406  errors.emplace_back(positions.find(position.start),
1407  positions.find(position.end),
1408  position, msg, context);
1409 }
1410 
1411 void TimedAutomataSystem::addWarning(position_t position, const std::string& msg,
1412  const std::string& context)
1413 {
1414  warnings.emplace_back(positions.find(position.start),
1415  positions.find(position.end),
1416  position, msg, context);
1417 }
1418 
1419 // Returns the errors
1420 const vector<UTAP::error_t> &TimedAutomataSystem::getErrors() const
1421 {
1422  return errors;
1423 }
1424 
1425 // Returns the warnings
1426 const vector<UTAP::error_t> &TimedAutomataSystem::getWarnings() const
1427 {
1428  return warnings;
1429 }
1430 
1432 {
1433  return !errors.empty();
1434 }
1435 
1437 {
1438  return !warnings.empty();
1439 }
1440 
1442 {
1443  errors.clear();
1444 }
1445 
1447 {
1448  warnings.clear();
1449 }
1450 
1452 {
1453  return modified;
1454 }
1455 
1457 {
1458  modified = mod;
1459 }
1460 
1462 {
1463  global.iodecl.push_back(iodecl_t());
1464  return &global.iodecl.back();
1465 }
const std::vector< simregion_t > getSimregions()
returns the simregions of an LSC scenario.
Definition: system.cpp:460
bool hasWarnings() const
Definition: system.cpp:1436
symbol_t uid
The symbol of the variables.
Definition: system.h:45
std::list< instance_t > instances
Definition: system.h:599
void recordStrictInvariant()
Record that the system has some strict invariant.
Definition: system.cpp:1362
int location
Definition: system.h:216
Partial instance of a template.
Definition: system.h:329
std::string toString() const
Definition: system.cpp:55
#define INDENT
Definition: statement.h:25
void recordStopWatch()
Record that the system stops a clock.
Definition: system.cpp:1372
struct template_t * templ
Definition: system.h:336
void addProgressMeasure(declarations_t *, expression_t guard, expression_t measure)
Definition: system.cpp:1189
message_t * message
Definition: system.h:225
std::list< variable_t > variables
Variables.
Definition: system.h:166
instanceLine_t * anchor
Pointer to anchor instance line.
Definition: system.h:217
symbol_t uid
The symbol of the location.
Definition: system.h:58
edge_t & addEdge(symbol_t src, symbol_t dst, bool type, const std::string &actname)
Add edge to template.
Definition: system.cpp:325
virtual void visitProgressMeasure(progress_t &)
Definition: system.h:463
instance_t & addInstance(const std::string &name, instance_t &instance, frame_t params, const std::vector< expression_t > &arguments)
Definition: system.cpp:1037
bool hasErrors() const
Definition: system.cpp:1431
void addPosition(uint32_t position, uint32_t offset, uint32_t line, const std::string &path)
Definition: system.cpp:1392
void erase(simregion_t s)
Definition: system.cpp:805
void addQuery(const query_t &query)
Definition: system.cpp:1120
bool hasPriorityDeclaration() const
Returns true if system has some priority declaration.
Definition: system.cpp:1357
bool hasStrictLowControlledGuards
Definition: system.h:585
bool isInPrechart() const
Definition: system.cpp:851
virtual void visitInstanceLine(instanceLine_t &)
Definition: system.h:465
uint32_t getSize() const
Returns the number of symbols in this frame.
Definition: symbols.cpp:328
std::string toString() const
Definition: system.cpp:899
bool hasStrictInvariants() const
Returns true if system has some strict invariant.
Definition: system.cpp:1367
size_t unbound
Definition: system.h:335
static const char *const invalid_type
Definition: system.cpp:53
bool contains(simregion_t s)
Definition: system.cpp:814
bool getUpdate(instanceLine_t *instance, int y, update_t *&simUpdate)
gets the update on the given instance at y location, returns false if there isn&#39;t any ...
Definition: system.cpp:623
symbol_t uid
Definition: system.h:73
expression_t guard
Definition: system.h:124
std::vector< simregion_t > getSimregions(const std::vector< simregion_t > &simregions)
return the simregions anchored to this instance, ordered by location number
Definition: system.cpp:677
virtual void visitSystemAfter(TimedAutomataSystem *)
Definition: system.h:452
instance_t & addLscInstance(const std::string &name, instance_t &instance, frame_t params, const std::vector< expression_t > &arguments)
Definition: system.cpp:1061
void addGantt(declarations_t *, gantt_t &)
Definition: system.cpp:1115
std::list< template_t > dynamicTemplates
Definition: system.h:595
condition_t & addCondition(std::vector< symbol_t > anchors, int loc, bool pch, bool isHot)
Add condition to template.
Definition: system.cpp:398
int nr
Placement in input file.
Definition: system.h:215
Information about a location.
Definition: system.h:56
std::string getFunctions() const
Definition: system.cpp:223
void setBeforeUpdate(expression_t)
Definition: system.cpp:1300
std::string writeParameters() const
Definition: system.cpp:250
std::list< template_t > templates
Definition: system.h:593
sync_use_t
Synchronization usage options: I/O (with ? or !) or CSP (plain)
Definition: common.h:270
std::vector< simregion_t > simregions
Definition: system.h:264
A reference to a symbol.
Definition: symbols.h:107
static type_t createInstance(frame_t, position_t=position_t())
Creates a new instance type.
Definition: type.cpp:483
std::string getName() const
Returns the name (identifier) of this symbol.
Definition: symbols.cpp:228
expression_t getAfterUpdate()
Definition: system.cpp:1315
static deque< int > conditions_nr(deque< condition_t > conditions)
Definition: system.cpp:427
void addError(position_t, const std::string &msg, const std::string &ctx="")
Definition: system.cpp:1403
std::string getTypeDefinitions() const
Definition: system.cpp:177
int32_t locNr
Location number in template.
Definition: system.h:62
void addWarning(position_t, const std::string &msg, const std::string &ctx="")
Definition: system.cpp:1411
std::list< entry > tail_t
Definition: system.h:429
bool equals(const cut_t &y) const
Definition: system.cpp:864
int nr
Placement in input file.
Definition: system.h:202
static vector< edge_t > edges
Definition: tracer.cpp:140
frame_t parameters
The parameters.
Definition: system.h:332
int32_t instanceNr
InstanceLine number in template.
Definition: system.h:348
static type_t createPrimitive(Constants::kind_t, position_t=position_t())
Create a primitive type.
Definition: type.cpp:527
virtual void visitUpdate(update_t &)
Definition: system.h:468
bool isModified() const
Definition: system.cpp:1451
bool getCondition(instanceLine_t *instance, int y, condition_t *&simCondition)
gets the condition on the given instance, at y location, returns false if there isn&#39;t any ...
Definition: system.cpp:594
std::vector< template_t * > dynamicTemplatesVec
Definition: system.h:596
Information about an edge.
Definition: system.h:85
expression_t exponentialRate
Definition: system.h:60
expression_t beforeUpdate
Definition: system.h:610
static type_t createLscInstance(frame_t, position_t=position_t())
Creates a new lsc instance type.
Definition: type.cpp:494
std::string getVariables(bool global) const
Definition: system.cpp:197
static vector< string > variables
Definition: tracer.cpp:153
virtual ~TimedAutomataSystem()
Definition: system.cpp:946
update_t & addUpdate(symbol_t anchor, int loc, bool pch)
Add update to template.
Definition: system.cpp:387
Information about an update.
Definition: system.h:213
std::string toString() const
Definition: system.cpp:787
const std::vector< error_t > & getErrors() const
Definition: system.cpp:1420
virtual void visitFunction(function_t &)
Definition: system.h:460
static const char *const unsupported
Definition: system.cpp:52
virtual void visitVariable(variable_t &)
Definition: system.h:453
declarations_t global
Definition: system.h:608
expression_t head
First expression in priority declaration.
Definition: system.h:431
void copyFunctionsFromTo(template_t *from, template_t *to) const
Definition: system.cpp:1184
instanceLine_t & addInstanceLine()
Add another instance line to template.
Definition: system.cpp:357
std::list< instance_t > & getProcesses()
Returns the processes of the system.
Definition: system.cpp:956
message_t & addMessage(symbol_t src, symbol_t dst, int loc, bool pch)
Add message to template.
Definition: system.cpp:374
virtual bool visitTemplateBefore(template_t &)
Definition: system.h:454
Gantt chart entry.
Definition: system.h:148
void remove(symbol_t s)
removes the given symbol
Definition: symbols.cpp:405
Information about an instance line.
Definition: system.h:346
void setMessage(std::deque< message_t > &messages, int nr)
Definition: system.cpp:757
void beginChanPriority(expression_t chan)
Definition: system.cpp:1320
virtual void visitMessage(message_t &)
Definition: system.h:466
virtual void visitInstance(instance_t &)
Definition: system.h:458
int getLoc() const
May be empty.
Definition: system.cpp:723
virtual void visitSystemBefore(TimedAutomataSystem *)
Definition: system.h:451
void addChanPriority(char separator, expression_t chan)
Definition: system.cpp:1328
static frame_t createFrame()
Creates and returns a new root-frame.
Definition: symbols.cpp:474
void setProcPriority(const char *name, int priority)
Sets process priority for process name.
Definition: system.cpp:1345
expression_t invariant
The invariant.
Definition: system.h:59
template_t * getDynamicTemplate(const std::string &name)
Definition: system.cpp:1026
std::list< gantt_t > ganttChart
Definition: system.h:170
void recordStrictLowerBoundOnControllableEdges()
Record that the system has guards on controllable edges with strict lower bounds. ...
Definition: system.cpp:1387
queries_t & getQueries()
Returns the queries enclosed in the model.
Definition: system.cpp:1128
Base type for variables, clocks, etc.
Definition: system.h:43
type_t stripArray() const
Removes any leading prefixes, RANGE, REF, LABEL and ARRAY types and returns the result.
Definition: type.cpp:297
void setModified(bool mod)
Definition: system.cpp:1456
size_t arguments
Definition: system.h:334
const std::vector< error_t > & getWarnings() const
Definition: system.cpp:1426
void setUpdate(std::deque< update_t > &updates, int nr)
Definition: system.cpp:777
std::string writeMapping() const
Definition: system.cpp:239
Channel priority information.
Definition: system.h:426
update_t * update
May be empty.
Definition: system.h:227
bool addFunction(type_t type, const std::string &, function_t *&)
Add function declaration.
Definition: system.cpp:130
std::vector< instanceLine_t * > anchors
Pointer to anchor instance lines.
Definition: system.h:204
bool isInPrechart() const
Definition: system.cpp:740
void setAfterUpdate(expression_t)
Definition: system.cpp:1310
bool isInvariant()
return true if the LSC is of invariant mode
Definition: system.cpp:890
Exception indicating a type error.
Definition: builder.h:39
virtual void visitGanttChart(gantt_t &)
Definition: system.h:464
static type_t createProcessSet(type_t instance, position_t=position_t())
Creates a new processset type.
Definition: type.cpp:516
Information about a branchpoint.
Definition: system.h:71
virtual void visitEdge(edge_t &)
Definition: system.h:457
A reference to a frame.
Definition: symbols.h:183
std::list< iodecl_t > iodecl
Definition: system.h:169
virtual void visitProcess(instance_t &)
Definition: system.h:459
iodecl_t * addIODecl()
Definition: system.cpp:1461
expression_t expr
The initialiser.
Definition: system.h:46
A reference to a type.
Definition: type.h:93
uint32_t end
Definition: position.h:36
std::map< symbol_t, expression_t > mapping
The arguments.
Definition: system.h:333
type_t getType() const
Returns the type of this symbol.
Definition: symbols.cpp:205
static deque< int > messages_nr(deque< message_t > messages)
Definition: system.cpp:415
state_t & addLocation(const std::string &, expression_t inv, expression_t er)
Add another location to template.
Definition: system.cpp:287
virtual void visitTemplateAfter(template_t &)
Definition: system.h:455
std::map< std::string, int > procPriority
Definition: system.h:589
void add(uint32_t position, uint32_t offset, uint32_t line, const std::string &path)
Add information about a line to the container.
Definition: position.cpp:30
symbol_t uid
The symbol of the function.
Definition: system.h:112
Information about a message.
Definition: system.h:188
void addProcess(instance_t &instance)
Definition: system.cpp:1098
std::string toString() const
Definition: system.cpp:105
bool hasStopWatch() const
Returns true if the system stops any clock.
Definition: system.cpp:1377
void accept(SystemVisitor &)
Definition: system.cpp:1239
A reference to an expression.
Definition: expression.h:70
variable_t * addVariable(declarations_t *, type_t type, const std::string &, expression_t initial)
instanceLine_t * dst
Pointer to destination instance line.
Definition: system.h:193
Information about a function.
Definition: system.h:110
variable_t * addVariableToFunction(function_t *, frame_t, type_t, const std::string &, expression_t initital)
Definition: system.cpp:1142
void addParameters(instance_t &inst, frame_t params, const std::vector< expression_t > &arguments)
Definition: system.cpp:658
std::vector< template_t * > & getDynamicTemplates()
Definition: system.cpp:1014
expression_t afterUpdate
Definition: system.h:611
virtual void visitIODecl(iodecl_t &)
Definition: system.h:462
condition_t * condition
May be empty.
Definition: system.h:226
uint32_t start
Definition: position.h:36
void copyVariablesFromTo(template_t *from, template_t *to) const
Definition: system.cpp:1174
template_t & addTemplate(const std::string &, frame_t params, const bool isTA=true, const std::string &type="", const std::string &mode="")
Creates and returns a new template.
Definition: system.cpp:971
void setCondition(std::deque< condition_t > &conditions, int nr)
Definition: system.cpp:767
void * getData()
Returns the user data of this symbol.
Definition: symbols.cpp:216
std::list< instance_t > processes
Definition: system.h:605
std::list< progress_t > progress
Progress measures.
Definition: system.h:168
std::string toString(bool global=false) const
The following methods are used to write the declarations in an XML file.
Definition: system.cpp:139
instanceLine_t * src
Pointer to source instance line.
Definition: system.h:192
branchpoint_t & addBranchpoint(const std::string &)
Add another branchpoint to template.
Definition: system.cpp:308
static deque< int > updates_nr(deque< update_t > updates)
Definition: system.cpp:439
expression_t getBeforeUpdate()
Definition: system.cpp:1305
std::pair< char, expression_t > entry
Definition: system.h:428
static void visit(SystemVisitor &visitor, frame_t frame)
Definition: system.cpp:1198
bool is(Constants::kind_t kind) const
Returns true if the type has kind kind or if type is a prefix, RANGE or REF type and the getChild()...
Definition: type.cpp:176
symbol_t addSymbol(const std::string &name, type_t, void *user=NULL)
Adds a symbol of the given name and type to the frame.
Definition: symbols.cpp:352
std::string writeArguments() const
Definition: system.cpp:265
int getProcPriority(const char *name) const
Returns process priority for process name.
Definition: system.cpp:1351
int32_t bpNr
Definition: system.h:74
std::list< template_t > & getTemplates()
Returns the templates of the system.
Definition: system.cpp:951
bool isLocation() const
Shortcut for is(LOCATION).
Definition: type.h:217
Definition: lexer.cc:817
std::list< instance_t > lscInstances
Definition: system.h:601
template_t & addDynamicTemplate(const std::string &, frame_t params)
Definition: system.cpp:994
const std::list< chan_priority_t > & getChanPriorities() const
Definition: system.cpp:1335
virtual void visitState(state_t &)
Definition: system.h:456
declarations_t & getGlobals()
Returns the global declarations of the system.
Definition: system.cpp:961
std::string getConstants() const
Definition: system.cpp:152
void removeProcess(instance_t &instance)
Definition: system.cpp:1085
int nr
Placement in input file.
Definition: system.h:190
std::vector< query_t > queries_t
Definition: system.h:442
int32_t getIndexOf(const std::string &name) const
Returns the index of the symbol with the given name.
Information about a condition.
Definition: system.h:200
static type_t createProcess(frame_t, position_t=position_t())
Creates a new process type.
Definition: type.cpp:505
Constants::kind_t getKind() const
Returns the kind of type object.
Definition: type.cpp:120
bool hasStrictLowerBoundOnControllableEdges() const
Returns true if the system has guards on controllable edges with strict lower bounds.
Definition: system.cpp:1382
const Positions::line_t & findPosition(uint32_t position) const
Definition: system.cpp:1398
expression_t measure
Definition: system.h:125
std::string toString() const
Definition: system.cpp:74
std::list< chan_priority_t > & getMutableChanPriorities()
Definition: system.cpp:1340
virtual void visitTypeDef(symbol_t)
Definition: system.h:461
std::string toString() const
Definition: system.cpp:62
virtual void visitCondition(condition_t &)
Definition: system.h:467
void add(symbol_t)
Add all symbols from the given frame.
Definition: symbols.cpp:367
std::list< chan_priority_t > chanPriorities
Definition: system.h:588
symbol_t uid
The name.
Definition: system.h:331