not needed
[prop.git] / prop-src / FOO
blobf09bc5b5edac09dd900e94b2778525d5e3fcfae9
1 ///////////////////////////////////////////////////////////////////////////////
2 //  This file is generated automatically using Prop (version 2.3.5),
3 //  last updated on Jun 18, 1997.
4 //  The original source file is "timespace.pcc".
5 ///////////////////////////////////////////////////////////////////////////////
7 #define PROP_REWRITING_USED
8 #define PROP_QUARK_USED
9 #include <propdefs.h>
10 #line 1 "timespace.pcc"
11 ///////////////////////////////////////////////////////////////////////////////
13 //  This file implements the time and space complexity
14 //  datatypes.  These datatypes are used to represent time and space
15 //  complexity in the SETL-like extension language. 
17 ///////////////////////////////////////////////////////////////////////////////
18 #include <math.h>
19 #include <iostream.h>
20 #include "basics.h"
21 #include "timespace.h"
23 ///////////////////////////////////////////////////////////////////////////////
25 //  Instantiate the time and space datatypes
27 ///////////////////////////////////////////////////////////////////////////////
28 #line 18 "timespace.pcc"
29 #line 18 "timespace.pcc"
30 ///////////////////////////////////////////////////////////////////////////////
32 // Interface specification of datatype Complexity
34 ///////////////////////////////////////////////////////////////////////////////
35 #line 18 "timespace.pcc"
38 ///////////////////////////////////////////////////////////////////////////////
40 // Interface specification of datatype Time
42 ///////////////////////////////////////////////////////////////////////////////
43 #line 18 "timespace.pcc"
46 ///////////////////////////////////////////////////////////////////////////////
48 // Interface specification of datatype Space
50 ///////////////////////////////////////////////////////////////////////////////
51 #line 18 "timespace.pcc"
54 ///////////////////////////////////////////////////////////////////////////////
56 // Instantiation of datatype Complexity
58 ///////////////////////////////////////////////////////////////////////////////
59 #line 18 "timespace.pcc"
62 ///////////////////////////////////////////////////////////////////////////////
64 // Instantiation of datatype Time
66 ///////////////////////////////////////////////////////////////////////////////
67 #line 18 "timespace.pcc"
70 ///////////////////////////////////////////////////////////////////////////////
72 // Instantiation of datatype Space
74 ///////////////////////////////////////////////////////////////////////////////
75 #line 18 "timespace.pcc"
78 #line 18 "timespace.pcc"
79 #line 18 "timespace.pcc"
82 ///////////////////////////////////////////////////////////////////////////////
84 //  Pretty print the complexity 
86 ///////////////////////////////////////////////////////////////////////////////
87 ostream& operator << (ostream& f, Complexity c)
88 {  
89 #line 26 "timespace.pcc"
90 #line 36 "timespace.pcc"
92    switch (c->tag__) {
93       case a_Complexity::tag_Var: {
94 #line 27 "timespace.pcc"
95         f << _Var(c)->Var; 
96 #line 27 "timespace.pcc"
97          } break;
98       case a_Complexity::tag_Add: {
99 #line 28 "timespace.pcc"
100         f << '(' << _Add(c)->_1 << " + " << _Add(c)->_2 << ')'; 
101 #line 28 "timespace.pcc"
102          } break;
103       case a_Complexity::tag_Mul: {
104 #line 29 "timespace.pcc"
105         f << '(' << _Mul(c)->_1 << " * " << _Mul(c)->_2 << ')'; 
106 #line 29 "timespace.pcc"
107          } break;
108       case a_Complexity::tag_Div: {
109 #line 30 "timespace.pcc"
110         f << '(' << _Div(c)->_1 << " / " << _Div(c)->_2 << ')'; 
111 #line 30 "timespace.pcc"
112          } break;
113       case a_Complexity::tag_Power: {
114 #line 31 "timespace.pcc"
115         f << '(' << _Power(c)->_1 << " ^ " << _Power(c)->_2 << ')'; 
116 #line 31 "timespace.pcc"
117          } break;
118       case a_Complexity::tag_Log: {
119 #line 32 "timespace.pcc"
120         f << "log " << _Log(c)->Log; 
121 #line 32 "timespace.pcc"
122          } break;
123       case a_Complexity::tag_Const: {
124 #line 33 "timespace.pcc"
125         f << _Const(c)->Const; 
126 #line 33 "timespace.pcc"
127          } break;
128       case a_Complexity::tag_BigOh: {
129 #line 34 "timespace.pcc"
130         f << "O(" << _BigOh(c)->BigOh << ')'; 
131 #line 34 "timespace.pcc"
132          } break;
133       case a_Complexity::tag_Omega: {
134 #line 35 "timespace.pcc"
135         f << "Omega(" << _Omega(c)->Omega << ')'; 
136 #line 35 "timespace.pcc"
137          } break;
138       default: {
139 #line 36 "timespace.pcc"
140         f << "o(" << _LittleOh(c)->LittleOh << ')'; 
141 #line 36 "timespace.pcc"
142          } break;
143    }
145 #line 37 "timespace.pcc"
146 #line 37 "timespace.pcc"
148    return f;
151 ///////////////////////////////////////////////////////////////////////////////
153 //  Pretty print the time complexity 
155 ///////////////////////////////////////////////////////////////////////////////
156 ostream& operator << (ostream& f, Time t)
157 {  return f << "Time(" << t << ")"; }
159 ///////////////////////////////////////////////////////////////////////////////
161 //  Pretty print the space complexity 
163 ///////////////////////////////////////////////////////////////////////////////
164 ostream& operator << (ostream& f, Space s)
165 {  return f << "Space(" << s << ")"; }
167 ///////////////////////////////////////////////////////////////////////////////
169 //  Function to simplify a complexity expression
171 ///////////////////////////////////////////////////////////////////////////////
172 Complexity simplify (Complexity c)
173 {  
174 #line 63 "timespace.pcc"
175 #line 69 "timespace.pcc"
176    extern void  _t_i_m_e_s_p_a_c_eco_X1_rewrite(Complexity & );
177    _t_i_m_e_s_p_a_c_eco_X1_rewrite(c);
178 #line 69 "timespace.pcc"
179 #line 69 "timespace.pcc"
181    return c;
183 #line 72 "timespace.pcc"
184 class _t_i_m_e_s_p_a_c_eco_X1 : public BURS {
185 private:
186    _t_i_m_e_s_p_a_c_eco_X1(const _t_i_m_e_s_p_a_c_eco_X1&);               // no copy constructor
187    void operator = (const _t_i_m_e_s_p_a_c_eco_X1&); // no assignment
188 public:
189    struct _t_i_m_e_s_p_a_c_eco_X1_StateRec * stack__, * stack_top__;
190 public:
191    void labeler(const char *, int&, int);
192    void labeler(Quark, int&, int);
193           void  labeler(Complexity & redex, int&, int);
194    inline virtual void  operator () (Complexity & redex) { int s; labeler(redex,s,0); }
195 private: 
196    public:
197       inline _t_i_m_e_s_p_a_c_eco_X1() {}
199 void  _t_i_m_e_s_p_a_c_eco_X1_rewrite(Complexity &  _x_) 
200 {  _t_i_m_e_s_p_a_c_eco_X1 _r_;
201    _r_(_x_);
204 ///////////////////////////////////////////////////////////////////////////////
206 // This macro can be redefined by the user for debugging
208 ///////////////////////////////////////////////////////////////////////////////
209 #ifndef DEBUG__t_i_m_e_s_p_a_c_eco_X1
210 #define DEBUG__t_i_m_e_s_p_a_c_eco_X1(repl,redex,file,line,rule) repl
211 #else
212 static const char * _t_i_m_e_s_p_a_c_eco_X1_file_name = "timespace.pcc";
213 #endif
215 static const TreeTables::Offset _t_i_m_e_s_p_a_c_eco_X1_accept_base [ 7 ] = {
216    0, 0, 1, 3, 5, 7, 9
218 static const TreeTables::ShortRule _t_i_m_e_s_p_a_c_eco_X1_accept_vector [ 11 ] = {
219    -1, 0, -1, 1, -1, 2, -1, 3, -1, 4, -1
221 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_theta_1[2][2] = {
222    { 0, 0 },
223    { 0, 2 }
227 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_theta_2[2][2] = {
228    { 0, 0 },
229    { 0, 3 }
233 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_theta_3[2][2] = {
234    { 0, 0 },
235    { 0, 4 }
239 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_theta_4[2][2] = {
240    { 0, 0 },
241    { 0, 5 }
245 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_theta_5[2] = {
246    0, 6
250 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_mu_1_0[7] = {
251    0, 1, 0, 0, 0, 0, 0
255 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_mu_1_1[7] = {
256    0, 1, 0, 0, 0, 0, 0
260 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_mu_2_0[7] = {
261    0, 1, 0, 0, 0, 0, 0
265 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_mu_2_1[7] = {
266    0, 1, 0, 0, 0, 0, 0
270 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_mu_3_0[7] = {
271    0, 1, 0, 0, 0, 0, 0
275 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_mu_3_1[7] = {
276    0, 1, 0, 0, 0, 0, 0
280 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_mu_4_0[7] = {
281    0, 1, 0, 0, 0, 0, 0
285 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_mu_4_1[7] = {
286    0, 1, 0, 0, 0, 0, 0
290 static const TreeTables::ShortState _t_i_m_e_s_p_a_c_eco_X1_mu_5_0[7] = {
291    0, 1, 0, 0, 0, 0, 0
295 inline void  _t_i_m_e_s_p_a_c_eco_X1::labeler(char const * redex,int& s__,int)
297    {
298 s__ = 0;
299    }
302 inline void  _t_i_m_e_s_p_a_c_eco_X1::labeler(Quark redex,int& s__,int)
304    {
305 s__ = 0;
306    }
309 void  _t_i_m_e_s_p_a_c_eco_X1::labeler (Complexity & redex, int& s__, int r__)
311 replacement__:
312    switch(redex->tag__) {
313       case a_Complexity::tag_Var: { 
314          int s0__;
315          labeler(_Var(redex)->Var, s0__, r__);
316          s__ = 0;} break;
317       case a_Complexity::tag_Add: { 
318          int s0__;
319          int s1__;
320          labeler(_Add(redex)->_1, s0__, r__);
321          labeler(_Add(redex)->_2, s1__, r__);
322          s__ = _t_i_m_e_s_p_a_c_eco_X1_theta_1[_t_i_m_e_s_p_a_c_eco_X1_mu_1_0[s0__]][_t_i_m_e_s_p_a_c_eco_X1_mu_1_1[s1__]]; } break;
323       case a_Complexity::tag_Mul: { 
324          int s0__;
325          int s1__;
326          labeler(_Mul(redex)->_1, s0__, r__);
327          labeler(_Mul(redex)->_2, s1__, r__);
328          s__ = _t_i_m_e_s_p_a_c_eco_X1_theta_2[_t_i_m_e_s_p_a_c_eco_X1_mu_2_0[s0__]][_t_i_m_e_s_p_a_c_eco_X1_mu_2_1[s1__]]; } break;
329       case a_Complexity::tag_Div: { 
330          int s0__;
331          int s1__;
332          labeler(_Div(redex)->_1, s0__, r__);
333          labeler(_Div(redex)->_2, s1__, r__);
334          s__ = _t_i_m_e_s_p_a_c_eco_X1_theta_3[_t_i_m_e_s_p_a_c_eco_X1_mu_3_0[s0__]][_t_i_m_e_s_p_a_c_eco_X1_mu_3_1[s1__]]; } break;
335       case a_Complexity::tag_Power: { 
336          int s0__;
337          int s1__;
338          labeler(_Power(redex)->_1, s0__, r__);
339          labeler(_Power(redex)->_2, s1__, r__);
340          s__ = _t_i_m_e_s_p_a_c_eco_X1_theta_4[_t_i_m_e_s_p_a_c_eco_X1_mu_4_0[s0__]][_t_i_m_e_s_p_a_c_eco_X1_mu_4_1[s1__]]; } break;
341       case a_Complexity::tag_Log: { 
342          int s0__;
343          labeler(_Log(redex)->Log, s0__, r__);
344          s__ = _t_i_m_e_s_p_a_c_eco_X1_theta_5[_t_i_m_e_s_p_a_c_eco_X1_mu_5_0[s0__]]; } break;
345       case a_Complexity::tag_Const: { 
346          int s0__;
347          s0__ = 0; // double
348          s__ = 1;} break;
349       case a_Complexity::tag_BigOh: { 
350          int s0__;
351          labeler(_BigOh(redex)->BigOh, s0__, r__);
352          s__ = 0;} break;
353       case a_Complexity::tag_Omega: { 
354          int s0__;
355          labeler(_Omega(redex)->Omega, s0__, r__);
356          s__ = 0;} break;
357       default: { 
358          int s0__;
359          labeler(_LittleOh(redex)->LittleOh, s0__, r__);
360          s__ = 0;} break;
361    }
362    const TreeTables::ShortRule * o__ = _t_i_m_e_s_p_a_c_eco_X1_accept_vector + _t_i_m_e_s_p_a_c_eco_X1_accept_base[s__];
363 accept__:
364    switch (*o__) {
365       case 4: if (equality_of(_Const(_Log(redex)->Log)->Const,))
366       {
367 #line 68 "timespace.pcc"
368          { redex = DEBUG__t_i_m_e_s_p_a_c_eco_X1(Const(log(_Const(_Log(redex)->Log)->Const)),redex,_t_i_m_e_s_p_a_c_eco_X1_file_name,68,"Log Const i | equality_of(redex!Log!Const,): ...");
369            r__ = 1; goto replacement__; }
370 #line 69 "timespace.pcc"
372       else { ++o__; goto accept__; } break;
373       case 3: if ((equality_of(_Const(_Power(redex)->_1)->Const,) && equality_of(_Const(_Power(redex)->_2)->Const,)))
374       {
375 #line 67 "timespace.pcc"
376          { redex = DEBUG__t_i_m_e_s_p_a_c_eco_X1(Const(exp((log(_Const(_Power(redex)->_1)->Const) * _Const(_Power(redex)->_2)->Const))),redex,_t_i_m_e_s_p_a_c_eco_X1_file_name,67,"Power (Const i, Const j) | (equality_of(redex!Power.1!Const,) && equality_of(redex!Power.2!Const,)): ...");
377            r__ = 1; goto replacement__; }
378 #line 68 "timespace.pcc"
380       else { ++o__; goto accept__; } break;
381       case 2: if ((equality_of(_Const(_Div(redex)->_1)->Const,) && equality_of(_Const(_Div(redex)->_2)->Const,)))
382       {
383 #line 66 "timespace.pcc"
384          { redex = DEBUG__t_i_m_e_s_p_a_c_eco_X1(Const((_Const(_Div(redex)->_1)->Const / _Const(_Div(redex)->_2)->Const)),redex,_t_i_m_e_s_p_a_c_eco_X1_file_name,66,"Div (Const i, Const j) | (equality_of(redex!Div.1!Const,) && equality_of(redex!Div.2!Const,)): ...");
385            r__ = 1; goto replacement__; }
386 #line 67 "timespace.pcc"
388       else { ++o__; goto accept__; } break;
389       case 1: if ((equality_of(_Const(_Mul(redex)->_1)->Const,) && equality_of(_Const(_Mul(redex)->_2)->Const,)))
390       {
391 #line 65 "timespace.pcc"
392          { redex = DEBUG__t_i_m_e_s_p_a_c_eco_X1(Const((_Const(_Mul(redex)->_1)->Const * _Const(_Mul(redex)->_2)->Const)),redex,_t_i_m_e_s_p_a_c_eco_X1_file_name,65,"Mul (Const i, Const j) | (equality_of(redex!Mul.1!Const,) && equality_of(redex!Mul.2!Const,)): ...");
393            r__ = 1; goto replacement__; }
394 #line 66 "timespace.pcc"
396       else { ++o__; goto accept__; } break;
397       case 0: if ((equality_of(_Const(_Add(redex)->_1)->Const,) && equality_of(_Const(_Add(redex)->_2)->Const,)))
398       {
399 #line 64 "timespace.pcc"
400          { redex = DEBUG__t_i_m_e_s_p_a_c_eco_X1(Const((_Const(_Add(redex)->_1)->Const + _Const(_Add(redex)->_2)->Const)),redex,_t_i_m_e_s_p_a_c_eco_X1_file_name,64,"Add (Const i, Const j) | (equality_of(redex!Add.1!Const,) && equality_of(redex!Add.2!Const,)): ...");
401            r__ = 1; goto replacement__; }
402 #line 65 "timespace.pcc"
404       else { ++o__; goto accept__; } break;
405    }
406    
410 ------------------------------- Statistics -------------------------------
411 Merge matching rules         = yes
412 Number of DFA nodes merged   = 0
413 Number of ifs generated      = 0
414 Number of switches generated = 1
415 Number of labels             = 0
416 Number of gotos              = 0
417 Adaptive matching            = disabled
418 Fast string matching         = disabled
419 Inline downcasts             = disabled
420 --------------------------------------------------------------------------