Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/MLRISC/cm/makeallcm
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/cm/makeallcm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 775 - (view) (download)

1 : leunga 775 #!/usr/bin/perl
2 :     ## usage: makeallcm
3 :     ##
4 :     ## This script looks at ALL.cm and create all the CM files.
5 :     ##
6 :    
7 :     $SPECIAL_CM{"smlnj-lib.cm"} = 1;
8 :     $SPECIAL_CM{"ml-yacc-lib.cm"} = 1;
9 :    
10 :     makeallcm("ALL.cm");
11 :    
12 :     sub makeallcm
13 :     { my($cmfile) = @_;
14 :     $new = 1;
15 :     open(MLRISC,$cmfile) || die ("$!: $cmfile\n");
16 :    
17 :     while (<MLRISC>)
18 :     { push @FOOTER, $_;
19 :     next if $_ =~ /\(\*.*\*\)/;
20 :     next if $_ =~ /^\s*$/;
21 :     ($comment=1, next) if $_ =~ /^\s*\(\*.*/;
22 :     ($comment=0, next) if $_ =~ /^.*\*\)/;
23 :     next if $comment;
24 :     if (/^(.*):$/)
25 :     { finish();
26 :     $outfile = $1;
27 :     open(OUT,">$outfile") || die("$!: $outfile\n");
28 :     print STDERR "[$outfile]";
29 :     print OUT <<"END";
30 :     (* This file is created by makeallcm *)
31 :     Library
32 :     is
33 :     END
34 :     next;
35 :     }
36 :     if (/^\s*(.*\.cm)\s*$/)
37 :     { push @CMFILES, $1;
38 :     next;
39 :     }
40 :     if ($new) { dumpCMfiles(); }
41 :     print OUT $_;
42 :     }
43 :     finish();
44 :     }
45 :     sub finish
46 :     { close(OUT);
47 :     @CMFILES=();
48 :     $new = 1;
49 :     if ($outfile)
50 :     { system("perl makecm $outfile");
51 :     }
52 :     }
53 :    
54 :     sub dumpCMfiles()
55 :     { print OUT <<"END";
56 :     #if defined(NEW_CM)
57 :     #if SMLNJ_VERSION * 100 + SMLNJ_MINOR_VERSION >= 11030
58 :     \$/basis.cm
59 :     #if defined(UNSHARED_MLRISC)
60 :     END
61 :     foreach $f (@CMFILES)
62 :     { if ($SPECIAL_CM{$f})
63 :     { print OUT "\t\$/$f\n";
64 :     } else
65 :     { print OUT "\t$f\n";
66 :     }
67 :     }
68 :     print OUT "#else\n";
69 :     foreach $f (@CMFILES) { print OUT "\t\$/$f\n"; }
70 :     print OUT "#endif\n";
71 :     print OUT "#else\n";
72 :     print OUT "\tbasis.cm\n";
73 :     foreach $f (@CMFILES) { print OUT "\t$f\n"; }
74 :     print OUT "#endif\n#else\n";
75 :     foreach $f (@CMFILES) { print OUT "\t$f\n"; }
76 :     print OUT "#endif\n";
77 :     @CMFILES=();
78 :     $new = 0;
79 :     }

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0