home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / self / contrib.lha / contrib / 491 / doc / objs / generateObject.pl < prev    next >
Encoding:
Perl Script  |  1993-06-26  |  2.8 KB  |  104 lines

  1. #!/usr/local/bin/perl
  2.  
  3. $className="";
  4. $parentName="";
  5. $readingClass=0;
  6.  
  7. sub generateClass {
  8.     local($className,$parentName,@slots) = @_;
  9.     
  10.     open(OUTFILE,">$className.fig");
  11.  
  12.     print OUTFILE "#FIG 2.1
  13. 80 2
  14. 6 279 24 554 174
  15. 6 279 24 554 174
  16. 2 2 0 1 7 0 0 21 0.000 0 0 0
  17.      554 174 279 174 279 24 554 24 554 174 9999 9999
  18. 1 4 0 1 6 0 0 21 0.000 1 0.000 287 35 7 7 284 29 291 41
  19. 2 2 0 1 -1 0 0 0 0.000 0 0 0
  20.      544 104 544 79 419 79 419 104 544 104 9999 9999
  21. 2 2 0 1 -1 0 0 0 0.000 0 0 0
  22.      409 104 409 79 289 79 289 104 409 104 9999 9999
  23. 2 2 0 1 -1 0 0 0 0.000 0 0 0
  24.      409 134 409 109 289 109 289 134 409 134 9999 9999
  25. 2 2 0 1 -1 0 0 0 0.000 0 0 0
  26.      409 164 409 139 289 139 289 164 409 164 9999 9999
  27. 2 2 0 1 -1 0 0 0 0.000 0 0 0
  28.      544 134 544 109 419 109 419 134 544 134 9999 9999
  29. 2 2 0 1 -1 0 0 0 0.000 0 0 0
  30.      544 164 544 139 419 139 419 164 544 164 9999 9999
  31. 2 4 0 1 -1 0 0 0 0.000 7 0 0
  32.      314 99 314 84 294 84 294 99 314 99 9999 9999
  33. 2 4 0 1 -1 0 0 0 0.000 7 0 0
  34.      314 129 314 114 294 114 294 129 314 129 9999 9999
  35. 2 4 0 1 -1 0 0 0 0.000 7 0 0
  36.      314 159 314 144 294 144 294 159 314 159 9999 9999
  37. 2 4 0 1 -1 0 0 0 0.000 7 0 0
  38.      539 159 539 144 519 144 519 159 539 159 9999 9999
  39. 2 4 0 1 -1 0 0 0 0.000 7 0 0
  40.      539 129 539 114 519 114 519 129 539 129 9999 9999
  41. 2 4 0 1 -1 0 0 0 0.000 7 0 0
  42.      539 99 539 84 519 84 519 99 539 99 9999 9999
  43. 2 4 0 1 -1 0 0 0 0.000 7 0 0
  44.      539 44 539 29 519 29 519 44 539 44 9999 9999
  45. 2 4 0 1 -1 0 0 0 0.000 7 0 0
  46.      539 69 539 54 519 54 519 69 539 69 9999 9999
  47. 2 2 0 1 -1 0 0 0 0.000 7 0 0
  48.      554 174 554 24 279 24 279 174 554 174 9999 9999
  49. 4 2 30 16 0 1 0 0.000 4 13 62 359 44 Name: 
  50. 4 2 30 16 0 1 0 0.000 4 13 69 359 64 Parent: 
  51. -6\n";
  52.  
  53.     print OUTFILE "4 0 30 16 0 4 0 0.000 4 16 76 364 44 $className\n";
  54.     print OUTFILE "4 0 30 16 0 2 0 0.000 4 16 143 364 64 $parentName\n";
  55.  
  56.     for($i=$#slots; $i<7; $i++) {
  57.     $slots[$i]="noSlot";
  58.     }
  59.  
  60.     print OUTFILE "4 0 20 10 0 -1 0 0.000 4 7 41 320 94 $slots[0]\n";
  61.     print OUTFILE "4 0 20 10 0 -1 0 0.000 4 7 41 430 94 $slots[1]\n";
  62.     print OUTFILE "4 0 20 10 0 -1 0 0.000 4 7 41 320 124 $slots[2]\n";
  63.     print OUTFILE "4 0 20 10 0 -1 0 0.000 4 7 41 430 124 $slots[3]\n";
  64.     print OUTFILE "4 0 20 10 0 -1 0 0.000 4 7 41 320 154 $slots[4]\n";
  65.     print OUTFILE "4 0 20 10 0 -1 0 0.000 4 7 41 430 154 $slots[5]\n";
  66.  
  67.     print OUTFILE "-6\n";
  68.     close(OUTFILE);
  69. }
  70.  
  71. @slots=();
  72.  
  73. while(<>) {
  74.     chop;
  75.     ($label,$value,$rest) = split;
  76.  
  77.     $label =~ y/A-Z/a-z/;
  78.  
  79.     if($label eq "start") {
  80.     if($readingClass) {
  81.         die "Didn't see 'end $className'\n";
  82.     }
  83.     $readingClass=1;
  84.     @slots=();
  85.     }
  86.         
  87.     $className=$value if($label eq "name");
  88.     $parentName=$value if($label eq "parent");
  89.     if($label eq "slot") {
  90.     push(@slots,$value);
  91.     };
  92.  
  93.     if($label eq "parentslot") {
  94.     push(@slots,$value);
  95.     };
  96.     
  97.     if($label eq "end") {
  98.     &generateClass($className,$parentName,@slots);
  99.     $readingClass=0;
  100.     }
  101. }
  102.  
  103.     
  104.