ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/scripts/filepp
(Generate patch)

Comparing trunk/scripts/filepp (file contents):
Revision 30 by tim, Sat Oct 2 04:40:48 2004 UTC vs.
Revision 59 by tim, Mon Oct 11 14:51:57 2004 UTC

# Line 21 | Line 21
21   #  Filename     :  $RCSfile: filepp,v $
22   #  Author       :  $Author: tim $
23   #  Maintainer   :  Darren Miller: darren@cabaret.demon.co.uk
24 < #  File version :  $Revision: 1.2 $
25 < #  Last changed :  $Date: 2004-10-02 04:40:48 $
24 > #  File version :  $Revision: 1.4 $
25 > #  Last changed :  $Date: 2004-10-11 14:51:57 $
26   #  Description  :  Main program
27   #  Licence      :  GNU copyleft
28   #
# Line 32 | Line 32 | use strict "subs";
32  
33   use strict "vars";
34   use strict "subs";
35 #use Graph;
35   # Used to all filepp to work with any char, not just ascii,
36   # feel free to remove this if it causes you problems
37 < use bytes;
37 > #use bytes;
38  
39   # version number of program
40   my $VERSION = '1.7.1';
41  
42   # list of paths to search for modules, normal Perl list + module dir
43 < push(@INC, "/home/maul/gezelter/tim/code/OOPSE-2.0/scripts/filepp-1.7.1/modules/f90dpend/");
43 > #push(@INC, "/home/maul/gezelter/tim/code/OOPSE-2.0/scripts/filepp-1.7.1/modules/f90dpend/");
44  
45   # index of keywords supported and functions to deal with them
46   my %Keywords = (
# Line 296 | Line 295 | my %f90ModList = ();
295   #
296   my %f90ModList = ();
297  
298 < #
298 > # suffix of fortran object file
299   my $objExt = '.o';
300 +
301 + # suffix of fortran 90 module
302 + my $modSuffix = "mod";
303 +
304 + # case of basename of fortran 90 module
305 + my $modBasenameCase = "lower";
306   ##############################################################################
307   # SetDebug - controls debugging level
308   ##############################################################################
# Line 2438 | Line 2443 | sub Module{
2443      if ($modulename !~ /^procedure/){
2444          
2445          $modulename =~ s/\s+$//;
2446 <        $parsedModList{uc($modulename) . ".mod"} =  Filepp::GetDefine('__FILE__');
2446 >        $parsedModList{GetModBasename($modulename) .  "." . $modSuffix}
2447 >                    =  Filepp::GetDefine('__FILE__');
2448          
2449          #$modulefile = Filepp::GetDefine('__BASE_FILE__');
2450          #print $modulefile;
# Line 2462 | Line 2468 | sub Use{
2468      $f90module =~ s/\s+$//;
2469      $f90module = uc($f90module);
2470      
2471 <    print " " . $objDir . $f90module . '.mod \\', "\n";
2466 <    #addModule($f90module);
2471 >    print " " . $objDir . GetModBasename($f90module) . "." . $modSuffix . "\\\n";
2472   }
2473  
2474   ##############################################################################
# Line 2502 | Line 2507 | sub AddModule {
2507  
2508   }
2509  
2510 <
2510 > ##############################################################################
2511 > # Generate rules for fortran 90 module
2512 > ##############################################################################
2513   sub printModule {
2514          my $modname;
2515          my $objname;
# Line 2513 | Line 2520 | sub printModule {
2520          }
2521   }
2522  
2523 + ##############################################################################
2524 + # Get the object file name
2525 + ##############################################################################
2526   sub GetObjFile {
2527          use File::Basename;
2528          my $fullname = shift;
# Line 2522 | Line 2532 | sub GetObjFile {
2532          ($filename, $dir, $suffix) = fileparse($fullname, '\.[^.]*');  
2533          return $filename . $objExt;
2534   }
2535 +
2536   ##############################################################################
2537 + # Get the base name of fortran 90 module
2538 + ##############################################################################
2539 + sub GetModBasename {
2540 +        my $modname = shift;
2541 +        
2542 +        if ($modBasenameCase eq "lower") {
2543 +            $modname = lc($modname);
2544 +            
2545 +        } elsif ($modBasenameCase eq "upper") {
2546 +            $modname = uc($modname);
2547 +        } elsif ($modBasenameCase eq "mixed") {
2548 +            $modname = ucfirst(lc($modname));
2549 +        }
2550 +        
2551 +        return $modname;
2552 + }
2553 +
2554 + ##############################################################################
2555   # Main routine
2556   ##############################################################################
2557  
# Line 2717 | Line 2746 | while($ARGV[$i]) {
2746          }
2747          UseModule($ARGV[++$i]);
2748      }
2749 <
2749 >    
2750 >    #case of basename of fortran module
2751 >    elsif($ARGV[$i] eq "-mc") {
2752 >        my $tempVar = lc($ARGV[++$i]);
2753 >        if ($modBasenameCase ne 'lower' && $modBasenameCase ne 'upper'
2754 >                                        && $modBasenameCase ne 'mixed'){
2755 >            Error("Valid argument for `-om' are lower, upper or mixed");
2756 >        }
2757 >        $modBasenameCase = $tempVar;
2758 >    }
2759 >    
2760 >    #the suffix of fortran module
2761 >    elsif($ARGV[$i] eq "-ms") {
2762 >        $modSuffix = $ARGV[++$i];
2763 >    }
2764 >    
2765      # set macro prefix
2766      elsif($ARGV[$i] eq "-mp") {
2767          if($i+1 >= $argc) {
# Line 2735 | Line 2779 | while($ARGV[$i]) {
2779      # module files will be built in a separate directory from the sources.
2780      elsif($ARGV[$i] eq "-od") {
2781          $objDir = $ARGV[++$i];
2782 <    }    
2782 >    }
2783 >    
2784      # turn on overwrite mode
2785      elsif($ARGV[$i] eq "-ov") {
2786          $overwrite = 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines