comparison mk-opts.pl @ 4049:a35a3c5d4740

[project @ 2002-08-16 08:54:31 by jwe]
author jwe
date Fri, 16 Aug 2002 08:54:31 +0000
parents 7b0c139ac8af
children 6481f41a79f3
comparison
equal deleted inserted replaced
4048:c9991c59cf5c 4049:a35a3c5d4740
372 $s =~ s/\n\s*/\n /g; 372 $s =~ s/\n\s*/\n /g;
373 print "$s\n"; 373 print "$s\n";
374 } 374 }
375 } 375 }
376 376
377 print " }\n"; 377 print " reset = true;
378 }\n";
378 379
379 print "\n void copy (const ${class_name}& opt)\n {\n"; 380 print "\n void copy (const ${class_name}& opt)\n {\n";
380 381
381 for ($i = 0; $i < $opt_num; $i++) 382 for ($i = 0; $i < $opt_num; $i++)
382 { 383 {
383 print " $optvar[$i] = opt.$optvar[$i];\n"; 384 print " $optvar[$i] = opt.$optvar[$i];\n";
384 } 385 }
385 386
386 print " }\n"; 387 print " reset = opt.reset;
388 }\n";
387 389
388 print "\n void set_default_options (void) { init (); }\n"; 390 print "\n void set_default_options (void) { init (); }\n";
389 391
390 for ($i = 0; $i < $opt_num; $i++) 392 for ($i = 0; $i < $opt_num; $i++)
391 { 393 {
392 if ($set_expr[$i]) 394 if ($set_expr[$i])
393 { 395 {
394 &emit_set_decl ($i); 396 &emit_set_decl ($i);
395 397
396 print "\n { $optvar[$i] = $set_expr[$i]; }\n"; 398 print "\n { $optvar[$i] = $set_expr[$i]; reset = true; }\n";
397 } 399 }
398 elsif ($set_body[$i]) 400 elsif ($set_body[$i])
399 { 401 {
400 &emit_set_decl ($i); 402 &emit_set_decl ($i);
401 403
402 $s = &substopt ($set_body[$i], $optvar[$i], $opt[$i], $type[$i]); 404 $s = &substopt ($set_body[$i], $optvar[$i], $opt[$i], $type[$i]);
403 chop ($s); 405 chop ($s);
404 $s =~ s/^/ /g; 406 $s =~ s/^/ /g;
405 $s =~ s/\n/\n /g; 407 $s =~ s/\n/\n /g;
406 print "\n {\n$s\n }\n"; 408 print "\n {\n$s\n reset = true;\n }\n";
407 } 409 }
408 elsif ($set_code[$i]) 410 elsif ($set_code[$i])
409 { 411 {
410 $s = &substopt ($set_code[$i], $optvar[$i], $opt[$i], $type[$i]); 412 $s = &substopt ($set_code[$i], $optvar[$i], $opt[$i], $type[$i]);
411 chop ($s); 413 chop ($s);
425 for ($i = 0; $i < $opt_num; $i++) 427 for ($i = 0; $i < $opt_num; $i++)
426 { 428 {
427 print " $type[$i] $optvar[$i];\n"; 429 print " $type[$i] $optvar[$i];\n";
428 } 430 }
429 431
430 print "};\n\n#endif\n"; 432 print "\nprotected:\n\n bool reset;\n};\n\n#endif\n";
431 } 433 }
432 434
433 sub emit_set_decl 435 sub emit_set_decl
434 { 436 {
435 local ($i) = @_; 437 local ($i) = @_;