#!/usr/bin/perl # # This scripts makes sources(*.c) for BAKA-DOS onto $TDIR-directory # from original files. # Make sure definitions of 'subroutine', 'function_real',,, in propath.h # # Source Directory chdir("unix"); # Target Directory(seen from Source directory) $TDIR = "../"; # # *.c # @FILEs = <*.c>; foreach $file(@FILEs){ print "$file ----------\n"; open(ip, "$file"); open(wp, ">$TDIR/$file") || die("Can't open $TDIR/$file\n"); while(){ chop; $l = $_; # function_real foo_(..) -> function_real FOO(...) # subroutine foo_(..) -> subroutine FOO(...) # @FTYPEs = ( "function_real", "function_int", "function_char", "subroutine" ); foreach $ftype(@FTYPEs){ if ($l =~ /^(.*)$ftype *([a-z0-9_]*)_\((.*)$/){ $fname = $2; $fname =~ tr/a-z/A-Z/; $l = "$1"."$ftype $fname($3"; print "$l\n"; } } print wp "$l \n"; } close ip; close wp; } # # *.for, # @FILEs = <*.for>; foreach $file(@FILEs){ print "$file ----------\n"; open(ip, "$file"); open(wp, ">$TDIR/$file") || die("Can't open $TDIR/$file\n"); while(){ chop; $l = $_; # function_real foo_(..) -> function_real FOO(...) # subroutine foo_(..) -> subroutine FOO(...) # @FTYPEs = ( ); foreach $ftype(@FTYPEs){ if ($l =~ /^(.*)$ftype *([a-z0-9_]*)_\((.*)$/){ $fname = $2; $fname =~ tr/a-z/A-Z/; $l = "$1"."$ftype $fname($3"; print "$l\n"; } } print wp "$l \n"; } close ip; close wp; } # # *.h, # @FILEs = <*.h>; foreach $file(@FILEs){ print "$file ----------\n"; open(ip, "$file"); open(wp, ">$TDIR/$file") || die("Can't open $TDIR/$file\n"); while(){ chop; $l = $_; # function_real foo_(..) -> function_real FOO(...) # subroutine foo_(..) -> subroutine FOO(...) # @FTYPEs = ( ); foreach $ftype(@FTYPEs){ if ($l =~ /^(.*)$ftype *([a-z0-9_]*)_\((.*)$/){ $fname = $2; $fname =~ tr/a-z/A-Z/; $l = "$1"."$ftype $fname($3"; print "$l\n"; } } print wp "$l \n"; } close ip; close wp; }