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