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; |
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 |
|
} |
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; |
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 |
|
|