]> www.ginac.de Git - ginac.git/blob - ginac/container.pl
adapted to change symbol::getname() -> symbol::get_name()
[ginac.git] / ginac / container.pl
1 if (($#ARGV!=0) and ($#ARGV!=1)) {
2         die 'usage: container.pl type [maxargs] (type=lst or exprseq)';
3 }
4
5 if ($ARGV[0] eq 'lst') {
6         $type='lst';
7 } elsif ($ARGV[0] eq 'exprseq') {
8         $type='exprseq';
9 } else {
10         die 'only lst and exprseq supported';
11 }
12
13 if ($#ARGV==1) {
14         $maxargs=$ARGV[1];
15 } else {
16         $maxargs=15; # must be greater or equal than the value used in function.pl
17 }
18
19 if ($type eq 'exprseq') {
20
21         # settings for exprseq
22         $CONTAINER="exprseq";
23         $STLHEADER="vector";
24         $reserve=1;
25         $prepend=0;
26         $let_op=0;
27         $open_bracket='(';
28         $close_bracket=')';
29         
30 } elsif ($type eq 'lst') {
31  
32         # settings for lst
33         $CONTAINER="lst";
34         $STLHEADER="list";
35         $reserve=0;
36         $prepend=1;
37         $let_op=1;
38         $open_bracket='[';
39         $close_bracket=']';
40
41 } else {
42         die "invalid type $type";
43 }
44
45 $CONTAINER_UC=uc(${CONTAINER});
46 $STLT="ex".$STLHEADER;
47
48 if ($reserve) {
49         $RESERVE_IMPLEMENTATION="#define RESERVE(s,size) (s).reserve(size)";
50 } else {
51         $RESERVE_IMPLEMENTATION="#define RESERVE(s,size) // no reserve needed for ${STLHEADER}";
52 }
53
54 if ($prepend) {
55         $PREPEND_INTERFACE=<<END_OF_PREPEND_INTERFACE;
56         virtual ${CONTAINER} & prepend(const ex & b);
57 END_OF_PREPEND_INTERFACE
58
59         $PREPEND_IMPLEMENTATION=<<END_OF_PREPEND_IMPLEMENTATION;
60 ${CONTAINER} & ${CONTAINER}::prepend(const ex & b)
61 {
62         ensure_if_modifiable();
63         seq.push_front(b);
64         return *this;
65 }
66 END_OF_PREPEND_IMPLEMENTATION
67 } else {
68         $PREPEND_INTERFACE="    // no prepend possible for ${CONTAINER}";
69         $PREPEND_IMPLEMENTATION="";
70 }
71
72 if ($let_op) {
73         $LET_OP_IMPLEMENTATION=<<END_OF_LET_OP_IMPLEMENTATION
74 ex & ${CONTAINER}::let_op(int i)
75 {
76         GINAC_ASSERT(i>=0);
77         GINAC_ASSERT(i<nops());
78
79         ${STLT}::iterator it=seq.begin();
80         for (int j=0; j<i; j++) {
81                 ++it;
82         }
83         return *it;
84 }
85 END_OF_LET_OP_IMPLEMENTATION
86 } else {
87         $LET_OP_IMPLEMENTATION="// ${CONTAINER}::let_op() will be implemented by user elsewhere";
88 }
89
90 sub generate_seq {
91         my ($seq_template,$n,$separator)=@_;
92         my ($res,$N);
93         
94         $res='';
95         for ($N=1; $N<=$n; $N++) {
96                 $res .= eval('"' . $seq_template . '"');
97                 if ($N!=$n) {
98                         $res .= $separator;
99                 }
100         }
101         return $res;
102 }
103
104 sub generate_from_to {
105         my ($template,$seq_template1,$seq_separator1,$seq_template2,
106             $seq_separator2,$from,$to)=@_;
107         my ($res,$N,$SEQ);
108
109         $res='';
110         for ($N=$from; $N<=$to; $N++) {
111                 $SEQ1=generate_seq($seq_template1,$N,$seq_separator1);
112                 $SEQ2=generate_seq($seq_template2,$N,$seq_separator2);
113                 $res .= eval('"' . $template . '"');
114                 $SEQ1=''; # to avoid main::SEQ1 used only once warning
115                 $SEQ2=''; # same as above
116         }
117         return $res;
118 }
119
120 sub generate {
121         my ($template,$seq_template1,$seq_separator1,$seq_template2,
122             $seq_separator2)=@_;
123         return generate_from_to($template,$seq_template1,$seq_separator1,
124                                                         $seq_template2,$seq_separator2,1,$maxargs);
125 }
126
127 $constructors_interface=generate(
128 '       explicit ${CONTAINER}(${SEQ1});'."\n",
129 'const ex & param${N}',', ','','');
130
131 $constructors_implementation=generate(
132         <<'END_OF_CONSTRUCTORS_IMPLEMENTATION','const ex & param${N}',', ','    seq.push_back(param${N});',"\n");
133 ${CONTAINER}::${CONTAINER}(${SEQ1}) : basic(TINFO_${CONTAINER})
134 {
135         debugmsg(\"${CONTAINER} ctor from ${N}*ex\",LOGLEVEL_CONSTRUCT);
136         RESERVE(seq,${N});
137 ${SEQ2}
138 }
139 END_OF_CONSTRUCTORS_IMPLEMENTATION
140
141 $interface=<<END_OF_INTERFACE;
142 /** \@file ${CONTAINER}.h
143  *
144  *  Definition of GiNaC's ${CONTAINER}. */
145
146 /*
147  *  This file was generated automatically by container.pl.
148  *  Please do not modify it directly, edit the perl script instead!
149  *  container.pl options: \$CONTAINER=${CONTAINER}
150  *                        \$STLHEADER=${STLHEADER}
151  *                        \$reserve=${reserve}
152  *                        \$prepend=${prepend}
153  *                        \$let_op=${let_op}
154  *                        \$open_bracket=${open_bracket}
155  *                        \$close_bracket=${close_bracket}
156  *                        \$maxargs=${maxargs}
157  *
158  *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
159  *
160  *  This program is free software; you can redistribute it and/or modify
161  *  it under the terms of the GNU General Public License as published by
162  *  the Free Software Foundation; either version 2 of the License, or
163  *  (at your option) any later version.
164  *
165  *  This program is distributed in the hope that it will be useful,
166  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
167  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
168  *  GNU General Public License for more details.
169  *
170  *  You should have received a copy of the GNU General Public License
171  *  along with this program; if not, write to the Free Software
172  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
173  */
174
175 #ifndef __GINAC_${CONTAINER_UC}_H__
176 #define __GINAC_${CONTAINER_UC}_H__
177
178 #include <${STLHEADER}>
179
180 // CINT needs <algorithm> to work properly with <vector> and <list> 
181 #include <algorithm>
182
183 #include "basic.h"
184 #include "ex.h"
185
186 namespace GiNaC {
187
188
189 // Cint does not like ${STLHEADER}<..,default_alloc> but malloc_alloc is
190 // unstandardized and not supported by newer GCCs.
191 #if defined(__GNUC__) && ((__GNUC__ == 2) && (__GNUC_MINOR__ < 97))
192 typedef std::${STLHEADER}<ex,malloc_alloc> ${STLT};
193 #else
194 typedef std::${STLHEADER}<ex> ${STLT};
195 #endif
196
197 class ${CONTAINER} : public basic
198 {
199         GINAC_DECLARE_REGISTERED_CLASS(${CONTAINER}, basic)
200
201 public:
202         ${CONTAINER}(${STLT} const & s, bool discardable=0);
203         ${CONTAINER}(${STLT} * vp); // vp will be deleted
204 ${constructors_interface}
205
206 public:
207         void print(const print_context & c, unsigned level = 0) const;
208         bool info(unsigned inf) const;
209         unsigned nops() const;
210         ex & let_op(int i);
211         ex expand(unsigned options=0) const;
212         bool has(const ex & other) const;
213         ex eval(int level=0) const;
214         ex evalf(int level=0) const;
215         ex normal(lst &sym_lst, lst &repl_lst, int level=0) const;
216         ex derivative(const symbol & s) const;
217         ex subs(const lst & ls, const lst & lr) const;
218 protected:
219         bool is_equal_same_type(const basic & other) const;
220         unsigned return_type(void) const;
221
222         // new virtual functions which can be overridden by derived classes
223 public:
224         virtual ${CONTAINER} & append(const ex & b);
225 ${PREPEND_INTERFACE}
226 protected:
227         virtual void printseq(const print_context & c, char openbracket, char delim,
228                               char closebracket, unsigned this_precedence,
229                               unsigned upper_precedence = 0) const;
230         virtual ex this${CONTAINER}(${STLT} const & v) const;
231         virtual ex this${CONTAINER}(${STLT} * vp) const;
232
233 protected:
234         bool is_canonical() const;
235         ${STLT} evalchildren(int level) const;
236         ${STLT} evalfchildren(int level) const;
237         ${STLT} normalchildren(int level) const;
238         ${STLT} diffchildren(const symbol & s) const;
239         ${STLT} * subschildren(const lst & ls, const lst & lr) const;
240
241 protected:
242         ${STLT} seq;
243         static unsigned precedence;
244 };
245
246 // utility functions
247 inline const ${CONTAINER} &ex_to_${CONTAINER}(const ex &e)
248 {
249         return static_cast<const ${CONTAINER} &>(*e.bp);
250 }
251
252 inline ${CONTAINER} &ex_to_nonconst_${CONTAINER}(const ex &e)
253 {
254         return static_cast<${CONTAINER} &>(*e.bp);
255 }
256
257 } // namespace GiNaC
258
259 #endif // ndef __GINAC_${CONTAINER_UC}_H__
260
261 END_OF_INTERFACE
262
263 $implementation=<<END_OF_IMPLEMENTATION;
264 /** \@file ${CONTAINER}.cpp
265  *
266  *  Implementation of GiNaC's ${CONTAINER}. */
267
268 /*
269  *  This file was generated automatically by container.pl.
270  *  Please do not modify it directly, edit the perl script instead!
271  *  container.pl options: \$CONTAINER=${CONTAINER}
272  *                        \$STLHEADER=${STLHEADER}
273  *                        \$reserve=${reserve}
274  *                        \$prepend=${prepend}
275  *                        \$let_op=${let_op}
276  *                        \$open_bracket=${open_bracket}
277  *                        \$close_bracket=${close_bracket}
278  *                        \$maxargs=${maxargs}
279  *
280  *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
281  *
282  *  This program is free software; you can redistribute it and/or modify
283  *  it under the terms of the GNU General Public License as published by
284  *  the Free Software Foundation; either version 2 of the License, or
285  *  (at your option) any later version.
286  *
287  *  This program is distributed in the hope that it will be useful,
288  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
289  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
290  *  GNU General Public License for more details.
291  *
292  *  You should have received a copy of the GNU General Public License
293  *  along with this program; if not, write to the Free Software
294  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
295  */
296
297 #include <iostream>
298 #include <stdexcept>
299
300 #include "${CONTAINER}.h"
301 #include "ex.h"
302 #include "print.h"
303 #include "archive.h"
304 #include "debugmsg.h"
305
306 namespace GiNaC {
307
308 GINAC_IMPLEMENT_REGISTERED_CLASS(${CONTAINER}, basic)
309
310 ${RESERVE_IMPLEMENTATION}
311
312 //////////
313 // default ctor, dtor, copy ctor assignment operator and helpers
314 //////////
315
316 // public
317
318 ${CONTAINER}::${CONTAINER}() : basic(TINFO_${CONTAINER})
319 {
320         debugmsg("${CONTAINER} default ctor",LOGLEVEL_CONSTRUCT);
321 }
322
323 // protected
324
325 void ${CONTAINER}::copy(${CONTAINER} const & other)
326 {
327         inherited::copy(other);
328         seq=other.seq;
329 }
330
331 void ${CONTAINER}::destroy(bool call_parent)
332 {
333         seq.clear();
334         if (call_parent) inherited::destroy(call_parent);
335 }
336
337 //////////
338 // other ctors
339 //////////
340
341 // public
342
343 ${CONTAINER}::${CONTAINER}(${STLT} const & s, bool discardable) :  basic(TINFO_${CONTAINER})
344 {
345         debugmsg("${CONTAINER} ctor from ${STLT}", LOGLEVEL_CONSTRUCT);
346         if (discardable) {
347                 seq.swap(const_cast<${STLT} &>(s));
348         } else {
349                 seq=s;
350         }
351 }
352
353 ${CONTAINER}::${CONTAINER}(${STLT} * vp) : basic(TINFO_${CONTAINER})
354 {
355         debugmsg("${CONTAINER} ctor from ${STLT} *",LOGLEVEL_CONSTRUCT);
356         GINAC_ASSERT(vp!=0);
357         seq.swap(*vp);
358         delete vp;
359 }
360
361 ${constructors_implementation}
362
363 //////////
364 // archiving
365 //////////
366
367 /** Construct object from archive_node. */
368 ${CONTAINER}::${CONTAINER}(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
369 {
370         debugmsg("${CONTAINER} ctor from archive_node", LOGLEVEL_CONSTRUCT);
371         for (unsigned int i=0; true; i++) {
372                 ex e;
373                 if (n.find_ex("seq", e, sym_lst, i))
374                         seq.push_back(e);
375                 else
376                         break;
377         }
378 }
379
380 /** Unarchive the object. */
381 ex ${CONTAINER}::unarchive(const archive_node &n, const lst &sym_lst)
382 {
383         return (new ${CONTAINER}(n, sym_lst))->setflag(status_flags::dynallocated);
384 }
385
386 /** Archive the object. */
387 void ${CONTAINER}::archive(archive_node &n) const
388 {
389         inherited::archive(n);
390         ${STLT}::const_iterator i = seq.begin(), iend = seq.end();
391         while (i != iend) {
392                 n.add_ex("seq", *i);
393                 i++;
394         }
395 }
396
397 //////////
398 // functions overriding virtual functions from bases classes
399 //////////
400
401 // public
402
403 void ${CONTAINER}::print(const print_context & c, unsigned level) const
404 {
405         debugmsg("${CONTAINER} print", LOGLEVEL_PRINT);
406
407         if (is_of_type(c, print_tree)) {
408
409                 c.s << std::string(level, ' ') << class_name()
410                     << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec
411                     << ", nops=" << nops()
412                     << std::endl;
413                 unsigned delta_indent = static_cast<const print_tree &>(c).delta_indent;
414                 for (${STLT}::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit)
415                         cit->print(c, level + delta_indent);
416                 c.s << std::string(level + delta_indent,' ') << "=====" << std::endl;
417
418         } else {
419                 // always print brackets around seq, ignore upper_precedence
420                 printseq(c, '${open_bracket}', ',', '${close_bracket}', precedence, precedence+1);
421         }
422 }
423
424 // ${CONTAINER}::info() will be implemented by user elsewhere";
425
426 unsigned ${CONTAINER}::nops() const
427 {
428         return seq.size();
429 }
430
431 ${LET_OP_IMPLEMENTATION}
432
433 ex ${CONTAINER}::expand(unsigned options) const
434 {
435         ${STLT} s;
436         RESERVE(s,seq.size());
437         for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
438                 s.push_back((*it).expand(options));
439         }
440
441         return this${CONTAINER}(s);
442 }
443
444 // a ${CONTAINER} 'has' an expression if it is this expression itself or a child 'has' it
445
446 bool ${CONTAINER}::has(const ex & other) const
447 {
448         GINAC_ASSERT(other.bp!=0);
449         if (is_equal(*other.bp)) return true;
450         for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
451                 if ((*it).has(other)) return true;
452         }
453         return false;
454 }
455
456 ex ${CONTAINER}::eval(int level) const
457 {
458         if (level==1) {
459                 return this->hold();
460         }
461         return this${CONTAINER}(evalchildren(level));
462 }
463
464 ex ${CONTAINER}::evalf(int level) const
465 {
466         return this${CONTAINER}(evalfchildren(level));
467 }
468
469 /** Implementation of ex::normal() for ${CONTAINER}s. It normalizes the arguments
470  *  and replaces the ${CONTAINER} by a temporary symbol.
471  *  \@see ex::normal */
472 ex ${CONTAINER}::normal(lst &sym_lst, lst &repl_lst, int level) const
473 {
474         ex n=this${CONTAINER}(normalchildren(level));
475         return n.bp->basic::normal(sym_lst,repl_lst,level);
476 }
477
478 ex ${CONTAINER}::derivative(const symbol & s) const
479 {
480         return this${CONTAINER}(diffchildren(s));
481 }
482
483 ex ${CONTAINER}::subs(const lst & ls, const lst & lr) const
484 {
485         ${STLT} * vp=subschildren(ls,lr);
486         if (vp==0)
487                 return inherited::subs(ls, lr);
488
489         return this${CONTAINER}(vp);
490 }
491
492 // protected
493
494 int ${CONTAINER}::compare_same_type(const basic & other) const
495 {
496         GINAC_ASSERT(is_of_type(other,${CONTAINER}));
497         ${CONTAINER} const & o=static_cast<${CONTAINER} const &>
498                                                                         (const_cast<basic &>(other));
499         int cmpval;
500         ${STLT}::const_iterator it1=seq.begin();
501         ${STLT}::const_iterator it2=o.seq.begin();
502
503         for (; (it1!=seq.end())&&(it2!=o.seq.end()); ++it1, ++it2) {
504                 cmpval=(*it1).compare(*it2);
505                 if (cmpval!=0) return cmpval;
506         }
507
508         if (it1==seq.end()) {
509                 return (it2==o.seq.end() ? 0 : -1);
510         }
511
512         return 1;
513 }
514
515 bool ${CONTAINER}::is_equal_same_type(const basic & other) const
516 {
517         GINAC_ASSERT(is_of_type(other,${CONTAINER}));
518         ${CONTAINER} const & o=static_cast<${CONTAINER} const &>
519                                                                         (const_cast<basic &>(other));
520         if (seq.size()!=o.seq.size()) return false;
521
522         ${STLT}::const_iterator it1=seq.begin();
523         ${STLT}::const_iterator it2=o.seq.begin();
524
525         for (; it1!=seq.end(); ++it1, ++it2) {
526                 if (!(*it1).is_equal(*it2)) return false;
527         }
528
529         return true;
530 }
531
532 unsigned ${CONTAINER}::return_type(void) const
533 {
534         return return_types::noncommutative_composite;
535 }
536
537 //////////
538 // new virtual functions which can be overridden by derived classes
539 //////////
540
541 // public
542
543 ${CONTAINER} & ${CONTAINER}::append(const ex & b)
544 {
545         ensure_if_modifiable();
546         seq.push_back(b);
547         return *this;
548 }
549
550 ${PREPEND_IMPLEMENTATION}
551
552 // protected
553
554 void ${CONTAINER}::printseq(const print_context & c, char openbracket, char delim,
555                             char closebracket, unsigned this_precedence,
556                             unsigned upper_precedence) const
557 {
558         if (this_precedence <= upper_precedence)
559                 c.s << openbracket;
560
561         if (seq.size() != 0) {
562                 ${STLT}::const_iterator it = seq.begin(), itend = seq.end();
563                 --itend;
564                 while (it != itend) {
565                         it->print(c, this_precedence);
566                         c.s << delim;
567                         it++;
568                 }
569                 it->print(c, this_precedence);
570         }
571
572         if (this_precedence <= upper_precedence)
573                 c.s << closebracket;
574 }
575
576 ex ${CONTAINER}::this${CONTAINER}(${STLT} const & v) const
577 {
578         return ${CONTAINER}(v);
579 }
580
581 ex ${CONTAINER}::this${CONTAINER}(${STLT} * vp) const
582 {
583         return ${CONTAINER}(vp);
584 }
585
586 //////////
587 // non-virtual functions in this class
588 //////////
589
590 // public
591
592 // none
593
594 // protected
595
596 bool ${CONTAINER}::is_canonical() const
597 {
598         if (seq.size()<=1) { return 1; }
599
600         ${STLT}::const_iterator it=seq.begin();
601         ${STLT}::const_iterator it_last=it;
602         for (++it; it!=seq.end(); it_last=it, ++it) {
603                 if ((*it_last).compare(*it)>0) {
604                         if ((*it_last).compare(*it)>0) {
605                                 std::cout << *it_last << ">" << *it << "\\n";
606                                 return 0;
607                         }
608                 }
609         }
610         return 1;
611 }
612
613
614 ${STLT} ${CONTAINER}::evalchildren(int level) const
615 {
616         ${STLT} s;
617         RESERVE(s,seq.size());
618
619         if (level==1) {
620                 return seq;
621         }
622         if (level == -max_recursion_level) {
623                 throw(std::runtime_error("max recursion level reached"));
624         }
625         --level;
626         for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
627                 s.push_back((*it).eval(level));
628         }
629         return s;
630 }
631
632 ${STLT} ${CONTAINER}::evalfchildren(int level) const
633 {
634         ${STLT} s;
635         RESERVE(s,seq.size());
636
637         if (level==1) {
638                 return seq;
639         }
640         if (level == -max_recursion_level) {
641                 throw(std::runtime_error("max recursion level reached"));
642         }
643         --level;
644         for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
645                 s.push_back((*it).evalf(level));
646         }
647         return s;
648 }
649
650 ${STLT} ${CONTAINER}::normalchildren(int level) const
651 {
652         ${STLT} s;
653         RESERVE(s,seq.size());
654
655         if (level==1) {
656                 return seq;
657         }
658         if (level == -max_recursion_level) {
659                 throw(std::runtime_error("max recursion level reached"));
660         }
661         --level;
662         for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
663                 s.push_back((*it).normal(level));
664         }
665         return s;
666 }
667
668 ${STLT} ${CONTAINER}::diffchildren(const symbol & y) const
669 {
670         ${STLT} s;
671         RESERVE(s,seq.size());
672         for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
673                 s.push_back((*it).diff(y));
674         }
675         return s;
676 }
677
678 /* obsolete subschildren
679 ${STLT} ${CONTAINER}::subschildren(const lst & ls, const lst & lr) const
680 {
681         ${STLT} s;
682         RESERVE(s,seq.size());
683         for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
684                 s.push_back((*it).subs(ls,lr));
685         }
686         return s;
687 }
688 */
689
690 ${STLT} * ${CONTAINER}::subschildren(const lst & ls, const lst & lr) const
691 {
692         // returns a NULL pointer if nothing had to be substituted
693         // returns a pointer to a newly created epvector otherwise
694         // (which has to be deleted somewhere else)
695
696         ${STLT}::const_iterator last=seq.end();
697         ${STLT}::const_iterator cit=seq.begin();
698         while (cit!=last) {
699                 const ex & subsed_ex=(*cit).subs(ls,lr);
700                 if (!are_ex_trivially_equal(*cit,subsed_ex)) {
701
702                         // something changed, copy seq, subs and return it
703                         ${STLT} *s=new ${STLT};
704                         RESERVE(*s,seq.size());
705
706                         // copy parts of seq which are known not to have changed
707                         ${STLT}::const_iterator cit2=seq.begin();
708                         while (cit2!=cit) {
709                                 s->push_back(*cit2);
710                                 ++cit2;
711                         }
712                         // copy first changed element
713                         s->push_back(subsed_ex);
714                         ++cit2;
715                         // copy rest
716                         while (cit2!=last) {
717                                 s->push_back((*cit2).subs(ls,lr));
718                                 ++cit2;
719                         }
720                         return s;
721                 }
722                 ++cit;
723         }
724         
725         return 0; // nothing has changed
726 }
727
728 //////////
729 // static member variables
730 //////////
731
732 // protected
733
734 unsigned ${CONTAINER}::precedence = 10;
735
736 } // namespace GiNaC
737
738 END_OF_IMPLEMENTATION
739
740 print "Creating interface file ${CONTAINER}.h...";
741 open OUT,">${CONTAINER}.h" or die "cannot open ${CONTAINER}.h";
742 print OUT $interface;
743 close OUT;
744 print "ok.\n";
745
746 print "Creating implementation file ${CONTAINER}.cpp...";
747 open OUT,">${CONTAINER}.cpp" or die "cannot open ${CONTAINER}.cpp";
748 print OUT $implementation;
749 close OUT;
750 print "ok.\n";
751
752 print "done.\n";