2 ##############################################################################
3 # Time-stamp: <Sat Oct 28 1995 22:41:09 Stardate: [-31]6509.51 hwloidl>
7 # Various auxiliary Perl subroutines that are mainly used in gran-extr and
9 # This module contains the following `exported' routines:
10 # - mk_global_local_names
12 # The following routines should be local:
16 ##############################################################################
18 # ----------------------------------------------------------------------------
19 # Usage: do mk_global_local_names (<file_name>);
20 # Returns: (<file_name>,<local_file_name>, <global_file_name>)
22 # Take a filename and create names for local and global variants.
23 # E.g.: foo.dat -> foo-local.dat and foo-global.dat
24 # ----------------------------------------------------------------------------
26 sub mk_global_local_names {
27 local ($file_name) = @_;
29 $file_name .= ".dat" unless $file_name =~ /\.dat$/;
30 $global_file_name = $file_name;
31 $global_file_name =~ s/\.dat/\-global\.dat/ ;
32 $local_file_name = $file_name;
33 $local_file_name =~ s/\.dat/\-local\.dat/ ;
35 return ( ($file_name, $global_file_name, $local_file_name) );
39 # ----------------------------------------------------------------------------
40 # Usage: do dat2ps(<dat_file_name>);
41 # Returns: (<ps_file_name>);
42 # ----------------------------------------------------------------------------
45 local ($dat_name) = @_;
47 $dat_name =~ s/\.dat$/\.ps/;
51 # ----------------------------------------------------------------------------
52 # ----------------------------------------------------------------------------
58 $i = rindex($in_str,"/");
62 $str = substr($in_str,$i+1) ;
68 # ----------------------------------------------------------------------------
74 $i = rindex($in_str,"/");
78 $str = substr($in_str,0,$i+1) ;
84 # ----------------------------------------------------------------------------
87 # ----------------------------------------------------------------------------