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

Comparing COMP/SCRAM/src/Scram/ScramFunctions.pm (file contents):
Revision 1.2 by williamc, Mon Aug 28 08:35:15 2000 UTC vs.
Revision 1.7 by williamc, Wed Sep 13 15:46:18 2000 UTC

# Line 18 | Line 18
18   # areatoolbox(ConfigArea) : return the toolbox of the specified area
19   # setuptoolsinarea($area[,$toolname[,$toolversion[,toolfile]) : setup
20   # arch()                : get/set the architecture string
21 + # scramobjectinterface(Class)  : print out the interface of a scram class
22 + # webget(area,url)      : get the url into the cache of the specified area
23  
24   package Scram::ScramFunctions;
25   use URL::URLcache;
# Line 31 | Line 33 | sub new {
33          $self={};
34          bless $self, $class;
35          # -- default settings
36 <        $self->{cachedir}=$ENV{HOME}."/.SCRAM/globalcache";
36 >        $self->{cachedir}=$ENV{HOME}."/.scramrc/globalcache";
37          $self->{scramprojectsdbdir}=$ENV{SCRAM_LOOKUPDB};
38          return $self;
39   }
# Line 98 | Line 100 | sub satellite {
100          my $version=shift;
101          my $installarea=shift;
102  
103 <        my $areaname="";
103 >        my $areaname=undef;
104          if ( @_ ) {
105            $areaname=shift;
106          }
# Line 109 | Line 111 | sub satellite {
111            $self->error("Unable to Find Project $name $version");
112          }
113  
114 +        # -- fix for old broken areas
115 +        if ( (! defined $relarea->version()) || ($relarea->version() eq "") ) {
116 +           $relarea->version($version);
117 +        }
118 +
119          # -- create satellite
120          my $area=$relarea->satellite($installarea,$areaname);
121          $area->archname($self->arch());
# Line 130 | Line 137 | sub satellite {
137  
138          # -- copy RequirementsDoc
139          if ( ! -f $area->requirementsdoc() ) {
140 +          use File::Copy;
141            copy( $relarea->requirementsdoc() , $area->requirementsdoc());
142          }
143  
144          return $area;
145   }
146  
147 + sub webget {
148 +        my $self=shift;
149 +        my $area=shift;
150 +        my $url=shift;
151 +
152 +        my $handler=URL::URLhandler->new($area->cache());
153 +        return ($handler->get($url));
154 + }
155 +
156   sub addareatoDB {
157          my $self=shift;
158          my $area=shift;
# Line 227 | Line 244 | sub arch {
244            :$self->{arch};
245   }
246  
247 + sub scramobjectinterface {
248 +        my $self=shift;
249 +        my $class=shift;
250 +
251 +        my $file;
252 +        ($file=$class."\.pm")=~s/::/\//g;
253 +        $file=$ENV{TOOL_HOME}."/".$file;
254 +
255 +        if ( ! -f $file ) {
256 +          $self->error("Unable to find $class in ".$ENV{TOOL_HOME});    
257 +        }
258 +        print "--------------------- $class ------------------\n";
259 +        my $fh=FileHandle->new();
260 +        $fh->open("<$file");
261 +        while ( <$fh> ) {
262 +           if ( $_=~/#\s*Interface/g ) {
263 +                $intregion=1;
264 +                next;
265 +           }
266 +           if ( $intregion ) { # if we are in the interface documentation
267 +            if ( ( $_!~/^#/ ) || ( $_=~/^#\s?-{40}/ ) ) { #moving out of Int doc
268 +                $intregion=0;
269 +                next;
270 +            }
271 +            print $_;
272 +            if ( $_=~/^#\s*(.*)\((.*)\)?:(.*)/ ) {
273 +             $interface=$1;
274 +             $args=$2;
275 +             $rest=$3;
276 +             next if ($interface eq "");
277 +             push @interfaces,$interface;
278 +             $interfaceargs{$interface}=$args;
279 +            }
280 +           }
281 +        }
282 +        print "\n";
283 +        undef $fh;
284 + }
285 +
286   # -------------- Support Routines ------------------------------
287  
288  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines