ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/clientfile.pm
(Generate patch)

Comparing COMP/SCRAM/src/clientfile.pm (file contents):
Revision 1.2 by williamc, Mon Mar 1 11:01:42 1999 UTC vs.
Revision 1.9 by williamc, Wed Mar 24 16:36:41 1999 UTC

# Line 12 | Line 12 | $scramdir="$ENV{INTwork}/SCRAM";
12   $Arch=1;
13   push @ARCHBLOCK, $Arch;
14  
15 < sub BuildClientFile($projectfile) {
15 > sub BuildClientFile {
16          my $projectfile=shift;
17        my $archdir=".SCRAM/$ENV{SCRAM_ARCH}";
18        my $clientfile="$archdir/clientsettings";
19        use Utilities::AddDir;
17          use ToolBox;
18  
19 <        adddir($archdir);
23 <        initialiseclient($clientfile) or return; # get out if it already exists
19 >        openclientfile('new') and return;
20          $toolbox=ToolBox->new();
25        open ( CLIENT, ">$ENV{LOCALTOP}/$clientfile" ) ||
26                die "clientfile: Cannot open clientsettings file "
27                        ."$clientfile $!\n";
28        open (INSTALLLOG, ">$archdir/installation_log")
29                        || die "clientfile: Cannot open log file $!\n";
21          print CLIENT "# Machine Generated File - do not edit\n";
22          _ParseProjectReqs($projectfile);
23 +        &closeclientfile;
24 + }
25 +
26 + sub closeclientfile {
27          close INSTALLLOG;
28          close CLIENT;
29 +        close CLIENT2;
30   }
31  
32 < sub _ParseProjectReqs($reqfile) {
32 > sub openclientfile {
33 >        my $action=shift;
34 >        my $archdir=".SCRAM/$ENV{SCRAM_ARCH}";
35 >        my $clientfile="$archdir/clientsettings";
36 >        use Utilities::AddDir;
37 >
38 >        AddDir::adddir($archdir);
39 >        if ( $action=~/add/i ) {
40 >          $actionop='>>';
41 >          initialiseclient($clientfile);
42 >        }
43 >        else { #default is new
44 >          $actionop='>';
45 >          initialiseclient($clientfile) or return 1; # get out if it already exists
46 >        }
47 >        open ( CLIENT, "$actionop$ENV{LOCALTOP}/$clientfile" ) ||
48 >                die "clientfile: Cannot open clientsettings file "
49 >                        ."$clientfile $!\n";
50 >        open ( CLIENT2, "$actionop$ENV{LOCALTOP}/".$clientfile."_reqs" ) ||
51 >                die "clientfile: Cannot open clientsettings file "
52 >                        ."$clientfile $!\n";
53 >        open (INSTALLLOG, "$actionop$archdir/installation_log")
54 >                        || die "clientfile: Cannot open log file $!\n";
55 >        return 0;
56 > }
57 >
58 > sub _ParseProjectReqs {
59          my $reqfile=shift;
60          use Utilities::Switcher;
61  
# Line 70 | Line 92 | sub Require_start {
92   #
93   #---------------------------------------------------------------------------
94  
95 < sub _gettool($toolurl) {
95 > sub _gettool {
96   # set the $toolfile variable
97          my $toolurl=shift;
98          my @toolpath= split /:/, $ENV{SCRAM_BootStrapFiles};
# Line 117 | Line 139 | sub _tool {
139                  'System' => \&system_body,
140                  'Splice' => 'none',
141                  'Splice_starttag' => \&splice_start,
120                'INCLUDE' => 'none' ,
121                'INCLUDE_StartTag' => \&_dirchecktest ,
122                'LIBDIR_StartTag' => \&_dirchecktest ,
123                'LIBDIR' => 'none',
142                  'Client' => 'none',
143                  'LIB' => 'none',
144                  'LIB_StartTag' => \&lib_start,
# Line 129 | Line 147 | sub _tool {
147                  'Architecture' => 'none',
148                  'Function' => 'none',
149                  'Function_StartTag' => \&Function_start,
150 <                'Function_EndTag' => \&Function_end
150 >                'Function_EndTag' => \&Function_end,
151 >                'External' => 'none',
152 >                'External_StartTag' => \&External_client,
153            };
154                 # 'INCLUDE_StartTag' => \&INCLUDE_start ,
155  
# Line 145 | Line 165 | sub _tool {
165   # multiple defaults can be specified > colon seperated
166   #
167  
168 + sub External_client {
169 +        my $name=shift;
170 +        my @vars=@_;
171 +        my $hashref;
172 +
173 +        $hashref=$toolswitch->SetupValueHash( \@vars );
174 +        $toolswitch->checkparam( $hashref, $name, 'ref' );
175 +        print CLIENT2 <<ENDTEXT;
176 + ifdef $toolname
177 + $$hashref{ref}=true
178 + endif
179 + ENDTEXT
180 + }
181 +
182   sub Arch_Start {
183          my $name=shift;
184          my @vars=@_;
# Line 160 | Line 194 | sub Arch_End {
194          my $name=shift;
195          my @vars=@_;
196  
197 <        $Arch=pop @ARCHBLOCK;
197 >        pop @ARCHBLOCK;
198 >        $Arch=$ARCHBLOCK[$#ARCHBLOCK];
199   }
200  
201   sub lib_start {
# Line 170 | Line 205 | sub lib_start {
205  
206          $hashref=$toolswitch->SetupValueHash( \@vars );
207          $toolswitch->checkparam($hashref, $name, 'name');
208 <        push @{$Envtype{lib}}, $$hashref{'name'};
209 <        outclient($name,$$hashref{'name'},"D");
208 >        if ( $Arch ) {
209 >          push @{$Envtype{lib}}, $$hashref{'name'};
210 >          outclient($name,$$hashref{'name'},"D");
211 >        }
212   }
213  
214   sub Env_start {
# Line 556 | Line 593 | sub initialiseclient {
593          if ( ! (-f "$ENV{LOCALTOP}/$clientfile" ) ) {
594            copy ( "$ENV{RELEASETOP}/$clientfile","$ENV{LOCALTOP}/$clientfile" );
595          }
596 +        if ( ! (-f "$ENV{LOCALTOP}/".$clientfile."_reqs" ) ) {
597 +          copy ( "$ENV{RELEASETOP}/".$clientfile."_reqs","$ENV{LOCALTOP}/".$clientfile."_reqs" );
598 +        }
599          # now read it in to memory for future reference
600          open (CLIENTFILEIN, "<$ENV{LOCALTOP}/$clientfile") or return 1;
601            ($name, $version, $var, @rest ) = split /:/;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines