ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/TemplateStash.pm
Revision: 1.1.2.1
Committed: Fri Feb 15 14:58:01 2008 UTC (17 years, 2 months ago) by muzaffar
Content type: text/plain
Branch: forBinLess_SCRAM
CVS Tags: V2_2_2, V2_2_2_pre4, V2_2_2_pre3, V2_2_2_pre2, V2_2_2_pre1, V2_2_2-pre1, V2_2_1, forV2_2_1, V2_2_0, sm100112, V2_1_4, V2_1_3, V2_1_2, V2_1_1, V2_1_0, V2_0_6, V2_0_5, V2_0_4, V2_0_4_relcand2, V2_0_4_relcand1, V2_0_3, V2_0_3_relcand3, V2_0_3_relcand2, V2_0_3_relcand1, V2_0_2, V2_0_2_relcand1, V2_0_1, V1_2_1b, V1_2_1a, V2_0_1_relcand4, V2_0_1_relcand3, V2_0_1_relcand2, V2_0_1_relcand1, V2_0_0_relcand4, V1_2_3, V2_0_0, V1_2_2, V1_2_2_relcand2, V1_2_2_relcand1, V2_0_0_relcand3, V2_0_0_relcand2, V2_0_0_relcand1, V1_2_1, V1_2_0, V1_2_0-cand11, V1_2_0-cand10, V1_2_0-cand9, V1_2_0-cand8, V1_2_0-cand7, V1_2_0-cand6, V1_2_0-cand5, V1_2_0-cand4, V1_2_0-cand3, V1_2_0-cand2, V1_2_0-cand1
Branch point for: SCRAM_V2_0
Changes since 1.1: +59 -0 lines
Log Message:
binary independent scram in forBinLess_SCRAM branch

File Contents

# User Rev Content
1 muzaffar 1.1.2.1 package BuildSystem::TemplateStash;
2     require 5.004;
3     use Exporter;
4     @ISA=qw(Exporter);
5    
6     sub new()
7     {
8     my $class=shift;
9     my $self={};
10     $self->{stash}[0]={};
11     $self->{index}=0;
12     bless($self, $class);
13     return $self;
14     }
15    
16     sub pushstash ()
17     {
18     my $self=shift;
19     push @{$self->{stash}},{};
20     $self->{index}=$self->{index}+1;
21     }
22    
23     sub popstash ()
24     {
25     my $self=shift;
26     if($self->{index}>0){pop @{$self->{stash}};$self->{index}=$self->{index}-1;}
27     }
28    
29     sub stash()
30     {
31     my $self=shift;
32     my ($stash)=@_;
33     if($stash)
34     {
35     $self->{stash}=[];
36     $self->{stash}[0]=$stash;
37     $self->{index}=0;
38     }
39     else{return $self;}
40     }
41    
42     sub set()
43     {
44     my $self=shift;
45     my $key=shift || return;
46     my $c=$self->{index};
47     $self->{stash}[$c]{$key}=shift;
48     }
49    
50     sub get()
51     {
52     my $self=shift;
53     my $key=shift || return "";
54     my $c=$self->{index};
55     for(my $i=$c;$i>=0;$i--){if(exists $self->{stash}[$i]{$key}){return $self->{stash}[$i]{$key};}}
56     return "";
57     }
58    
59     1;