- in the output, list delimiters are now { } and matrix delimiters are [ ]
[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 currently does not like ${STLHEADER}<..,default_alloc> but malloc_alloc is
190 // unstandardized and not supported by newer GCCs.  This ugly hack will go
191 // away soon!
192 #if (defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ < 97)) || (defined(G__GNUC) && (G__GNUC == 2) && (G__GNUC_MINOR < 97))
193 typedef std::${STLHEADER}<GiNaC::ex,malloc_alloc> ${STLT};
194 #else
195 typedef std::${STLHEADER}<ex> ${STLT};
196 #endif
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_func 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 ${PREPEND_INTERFACE}
228 protected:
229         virtual void printseq(const print_context & c, char openbracket, char delim,
230                               char closebracket, unsigned this_precedence,
231                               unsigned upper_precedence = 0) const;
232         virtual ex this${CONTAINER}(${STLT} const & v) const;
233         virtual ex this${CONTAINER}(${STLT} * vp) const;
234
235 protected:
236         bool is_canonical() const;
237         ${STLT} evalchildren(int level) const;
238         ${STLT} evalfchildren(int level) const;
239         ${STLT} normalchildren(int level) const;
240         ${STLT} diffchildren(const symbol & s) const;
241         ${STLT} * subschildren(const lst & ls, const lst & lr, bool no_pattern = false) const;
242
243 protected:
244         ${STLT} seq;
245 };
246
247 // utility functions
248 inline const ${CONTAINER} &ex_to_${CONTAINER}(const ex &e)
249 {
250         return static_cast<const ${CONTAINER} &>(*e.bp);
251 }
252
253 inline ${CONTAINER} &ex_to_nonconst_${CONTAINER}(const ex &e)
254 {
255         return static_cast<${CONTAINER} &>(*e.bp);
256 }
257
258 } // namespace GiNaC
259
260 #endif // ndef __GINAC_${CONTAINER_UC}_H__
261
262 END_OF_INTERFACE
263
264 $implementation=<<END_OF_IMPLEMENTATION;
265 /** \@file ${CONTAINER}.cpp
266  *
267  *  Implementation of GiNaC's ${CONTAINER}. */
268
269 /*
270  *  This file was generated automatically by container.pl.
271  *  Please do not modify it directly, edit the perl script instead!
272  *  container.pl options: \$CONTAINER=${CONTAINER}
273  *                        \$STLHEADER=${STLHEADER}
274  *                        \$reserve=${reserve}
275  *                        \$prepend=${prepend}
276  *                        \$let_op=${let_op}
277  *                        \$open_bracket=${open_bracket}
278  *                        \$close_bracket=${close_bracket}
279  *                        \$maxargs=${maxargs}
280  *
281  *  GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany
282  *
283  *  This program is free software; you can redistribute it and/or modify
284  *  it under the terms of the GNU General Public License as published by
285  *  the Free Software Foundation; either version 2 of the License, or
286  *  (at your option) any later version.
287  *
288  *  This program is distributed in the hope that it will be useful,
289  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
290  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
291  *  GNU General Public License for more details.
292  *
293  *  You should have received a copy of the GNU General Public License
294  *  along with this program; if not, write to the Free Software
295  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
296  */
297
298 #include <iostream>
299 #include <stdexcept>
300
301 #include "${CONTAINER}.h"
302 #include "ex.h"
303 #include "print.h"
304 #include "archive.h"
305 #include "debugmsg.h"
306
307 namespace GiNaC {
308
309 GINAC_IMPLEMENT_REGISTERED_CLASS(${CONTAINER}, basic)
310
311 ${RESERVE_IMPLEMENTATION}
312
313 //////////
314 // default ctor, dtor, copy ctor assignment operator and helpers
315 //////////
316
317 // public
318
319 ${CONTAINER}::${CONTAINER}() : basic(TINFO_${CONTAINER})
320 {
321         debugmsg("${CONTAINER} default ctor",LOGLEVEL_CONSTRUCT);
322 }
323
324 // protected
325
326 void ${CONTAINER}::copy(${CONTAINER} const & other)
327 {
328         inherited::copy(other);
329         seq=other.seq;
330 }
331
332 void ${CONTAINER}::destroy(bool call_parent)
333 {
334         seq.clear();
335         if (call_parent) inherited::destroy(call_parent);
336 }
337
338 //////////
339 // other ctors
340 //////////
341
342 // public
343
344 ${CONTAINER}::${CONTAINER}(${STLT} const & s, bool discardable) :  basic(TINFO_${CONTAINER})
345 {
346         debugmsg("${CONTAINER} ctor from ${STLT}", LOGLEVEL_CONSTRUCT);
347         if (discardable) {
348                 seq.swap(const_cast<${STLT} &>(s));
349         } else {
350                 seq=s;
351         }
352 }
353
354 ${CONTAINER}::${CONTAINER}(${STLT} * vp) : basic(TINFO_${CONTAINER})
355 {
356         debugmsg("${CONTAINER} ctor from ${STLT} *",LOGLEVEL_CONSTRUCT);
357         GINAC_ASSERT(vp!=0);
358         seq.swap(*vp);
359         delete vp;
360 }
361
362 ${constructors_implementation}
363
364 //////////
365 // archiving
366 //////////
367
368 /** Construct object from archive_node. */
369 ${CONTAINER}::${CONTAINER}(const archive_node &n, const lst &sym_lst) : inherited(n, sym_lst)
370 {
371         debugmsg("${CONTAINER} ctor from archive_node", LOGLEVEL_CONSTRUCT);
372         for (unsigned int i=0; true; i++) {
373                 ex e;
374                 if (n.find_ex("seq", e, sym_lst, i))
375                         seq.push_back(e);
376                 else
377                         break;
378         }
379 }
380
381 /** Unarchive the object. */
382 ex ${CONTAINER}::unarchive(const archive_node &n, const lst &sym_lst)
383 {
384         return (new ${CONTAINER}(n, sym_lst))->setflag(status_flags::dynallocated);
385 }
386
387 /** Archive the object. */
388 void ${CONTAINER}::archive(archive_node &n) const
389 {
390         inherited::archive(n);
391         ${STLT}::const_iterator i = seq.begin(), iend = seq.end();
392         while (i != iend) {
393                 n.add_ex("seq", *i);
394                 i++;
395         }
396 }
397
398 //////////
399 // functions overriding virtual functions from bases classes
400 //////////
401
402 // public
403
404 void ${CONTAINER}::print(const print_context & c, unsigned level) const
405 {
406         debugmsg("${CONTAINER} print", LOGLEVEL_PRINT);
407
408         if (is_of_type(c, print_tree)) {
409
410                 c.s << std::string(level, ' ') << class_name()
411                     << std::hex << ", hash=0x" << hashvalue << ", flags=0x" << flags << std::dec
412                     << ", nops=" << nops()
413                     << std::endl;
414                 unsigned delta_indent = static_cast<const print_tree &>(c).delta_indent;
415                 for (${STLT}::const_iterator cit=seq.begin(); cit!=seq.end(); ++cit)
416                         cit->print(c, level + delta_indent);
417                 c.s << std::string(level + delta_indent,' ') << "=====" << std::endl;
418
419         } else {
420                 // always print brackets around seq, ignore upper_precedence
421                 printseq(c, '${open_bracket}', ',', '${close_bracket}', precedence(), precedence()+1);
422         }
423 }
424
425 // ${CONTAINER}::info() will be implemented by user elsewhere";
426
427 unsigned ${CONTAINER}::nops() const
428 {
429         return seq.size();
430 }
431
432 ${LET_OP_IMPLEMENTATION}
433
434 ex ${CONTAINER}::map(map_func f) const
435 {
436         ${STLT} s;
437         RESERVE(s,seq.size());
438         for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
439                 s.push_back(f(*it));
440         }
441
442         return this${CONTAINER}(s);
443 }
444
445 ex ${CONTAINER}::expand(unsigned options) const
446 {
447         ${STLT} s;
448         RESERVE(s,seq.size());
449         for (${STLT}::const_iterator it=seq.begin(); it!=seq.end(); ++it) {
450                 s.push_back((*it).expand(options));
451         }
452
453         return this${CONTAINER}(s);
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, bool no_pattern) const
484 {
485         ${STLT} *vp = subschildren(ls, lr, no_pattern);
486         if (vp)
487                 return this${CONTAINER}(vp).bp->basic::subs(ls, lr, no_pattern);
488         else
489                 return basic::subs(ls, lr, no_pattern);
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 ${STLT} * ${CONTAINER}::subschildren(const lst & ls, const lst & lr, bool no_pattern) const
679 {
680         // returns a NULL pointer if nothing had to be substituted
681         // returns a pointer to a newly created epvector otherwise
682         // (which has to be deleted somewhere else)
683
684         ${STLT}::const_iterator last=seq.end();
685         ${STLT}::const_iterator cit=seq.begin();
686         while (cit!=last) {
687                 const ex & subsed_ex=(*cit).subs(ls,lr,no_pattern);
688                 if (!are_ex_trivially_equal(*cit,subsed_ex)) {
689
690                         // something changed, copy seq, subs and return it
691                         ${STLT} *s=new ${STLT};
692                         RESERVE(*s,seq.size());
693
694                         // copy parts of seq which are known not to have changed
695                         ${STLT}::const_iterator cit2=seq.begin();
696                         while (cit2!=cit) {
697                                 s->push_back(*cit2);
698                                 ++cit2;
699                         }
700                         // copy first changed element
701                         s->push_back(subsed_ex);
702                         ++cit2;
703                         // copy rest
704                         while (cit2!=last) {
705                                 s->push_back((*cit2).subs(ls,lr,no_pattern));
706                                 ++cit2;
707                         }
708                         return s;
709                 }
710                 ++cit;
711         }
712         
713         return 0; // nothing has changed
714 }
715
716 } // namespace GiNaC
717
718 END_OF_IMPLEMENTATION
719
720 print "Creating interface file ${CONTAINER}.h...";
721 open OUT,">${CONTAINER}.h" or die "cannot open ${CONTAINER}.h";
722 print OUT $interface;
723 close OUT;
724 print "ok.\n";
725
726 print "Creating implementation file ${CONTAINER}.cpp...";
727 open OUT,">${CONTAINER}.cpp" or die "cannot open ${CONTAINER}.cpp";
728 print OUT $implementation;
729 close OUT;
730 print "ok.\n";
731
732 print "done.\n";