#!/bin/perl # # Generate static initialisers for a resident image # # Consume each line of input # @functions = (); while() { # Ignore comments # next if(/^#/); # ='' # if(/^=\s*(\w\w*)/) { $base = $1; next; } # : # :: # if(/^\s*(\w\w*)::?(\w\w*)/) { push(@functions,"_M_$1_$2"); next; } # # if(/\w\w*/) { push(@functions,$&); next; } } @functions = sort(@functions); # Print out list of functions # #$n = 0; #foreach $fn (@functions) { # print "Function $n $fn\n"; # $n++; #} open(STDOUT,">$ARGV[0]"); # Print table of names # print <$ARGV[1]"); # Microsoft LIB # if($ARGV[2] eq "m") { print "LIBRARY $base\n"; print "EXPORTS\n"; foreach $fn (@functions) { print "${fn}\n"; } } # Watcom WLIB # if($ARGV[2] eq "w") { foreach $fn (@functions) { print "++_${fn}.$base\n"; } } close(STDOUT);