Subversion Repositories DevTools

Rev

Rev 255 | Rev 287 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 255 Rev 285
Line 29... Line 29...
29
#-------------------------------------------------------------------------------
29
#-------------------------------------------------------------------------------
30
# Function        : ConfigurationFile::New
30
# Function        : ConfigurationFile::New
31
#
31
#
32
# Description     : Create and open a configuration file
32
# Description     : Create and open a configuration file
33
#
33
#
34
# Inputs          : $name - Name of the file to create.
34
# Inputs          : $name   - Name of the file to create.
-
 
35
#                   @opts   - List of options
-
 
36
#                               --NoEof     - Supress EOF at the end of the file
-
 
37
#                               --Type=xxx  - Control the comment markers
-
 
38
#                               --NoTime    - Supress the time stamp
35
#
39
#
36
# Returns         : Package handle
40
# Returns         : Package handle
37
#
41
#
38
sub New
42
sub New
39
{
43
{
Line 47... Line 51...
47
            NAME        => $name,                   # Name of the file
51
            NAME        => $name,                   # Name of the file
48
            EOF         => 1,                       # Print EOF on closure
52
            EOF         => 1,                       # Print EOF on closure
49
            TYPE        => 'perl',                  # vi style file type
53
            TYPE        => 'perl',                  # vi style file type
50
            CMT         => '#',                     # Line comments begin with
54
            CMT         => '#',                     # Line comments begin with
51
            TIME        => '',                      # Inserted timestamp
55
            TIME        => '',                      # Inserted timestamp
-
 
56
            DO_TIME     => 1,                       # Insert timestamp in header
52
       };
57
       };
53
 
58
 
54
    #
59
    #
55
    #   Parse arguments
60
    #   Parse arguments
56
    #
61
    #
Line 63... Line 68...
63
            $self->{'TYPE'} = $1;
68
            $self->{'TYPE'} = $1;
64
            $self->{'CMT'} = 'REM' if ( $1 eq 'bat' );
69
            $self->{'CMT'} = 'REM' if ( $1 eq 'bat' );
65
            $self->{'CMT'} = '//'  if ( $1 eq 'CSharp' );
70
            $self->{'CMT'} = '//'  if ( $1 eq 'CSharp' );
66
            $self->{'CMT'} = '//'  if ( $1 eq 'C++' );
71
            $self->{'CMT'} = '//'  if ( $1 eq 'C++' );
67
 
72
 
-
 
73
        } elsif ( /^--NoTime/ ) {
-
 
74
            $self->{'DO_TIME'} = 0;
-
 
75
            
68
        } else {
76
        } else {
69
            ::Error("ConfigurationFile::New: Bad option: $_");
77
            ::Error("ConfigurationFile::New: Bad option: $_");
70
        }
78
        }
71
    }
79
    }
72
 
80
 
Line 172... Line 180...
172
 
180
 
173
    #
181
    #
174
    #   Process HERE document to remove leading write space
182
    #   Process HERE document to remove leading write space
175
    #   Simply to make the source look nice
183
    #   Simply to make the source look nice
176
    #
184
    #
-
 
185
 
-
 
186
    my $ts = '';
-
 
187
    if ( $self->{'DO_TIME'} )
-
 
188
    {
-
 
189
        $ts = <<HERE_TARGET;
-
 
190
        $self->{'CMT'}         on $self->{'TIME'}
-
 
191
HERE_TARGET
-
 
192
    }
-
 
193
 
177
    my $var;
194
    my $var;
178
    ($var = <<HERE_TARGET) =~ s/^\s+//gm;
195
    ($var = <<HERE_TARGET) =~ s/^\s+//gm;
179
 
196
 
180
    $self->{'CMT'} -*- mode: $self->{'TYPE'}; tabs: 8; -*-
197
    $self->{'CMT'} -*- mode: $self->{'TYPE'}; tabs: 8; -*-
181
    $self->{'CMT'} -- $desc
198
    $self->{'CMT'} -- $desc
Line 187... Line 204...
187
    $self->{'CMT'}       about the current sandbox.  You not must modify, nor move or
204
    $self->{'CMT'}       about the current sandbox.  You not must modify, nor move or
188
    $self->{'CMT'}       delete this file.  To do so may result in a system failure,
205
    $self->{'CMT'}       delete this file.  To do so may result in a system failure,
189
    $self->{'CMT'}       in additional to any changes made shall be overwritten.
206
    $self->{'CMT'}       in additional to any changes made shall be overwritten.
190
    $self->{'CMT'}
207
    $self->{'CMT'}
191
    $self->{'CMT'} Created by $by
208
    $self->{'CMT'} Created by $by
192
    $self->{'CMT'}         on $self->{'TIME'}
209
    $ts
193
    $self->{'CMT'}
210
    $self->{'CMT'}
194
    $trailing
211
    $trailing
195
 
212
 
196
HERE_TARGET
213
HERE_TARGET
197
 
214
 
Line 217... Line 234...
217
 
234
 
218
    #
235
    #
219
    #   Process HERE document to remove leading write space
236
    #   Process HERE document to remove leading write space
220
    #   Simply to make the source look nice
237
    #   Simply to make the source look nice
221
    #
238
    #
-
 
239
    my $ts = '';
-
 
240
    if ( $self->{'DO_TIME'} )
-
 
241
    {
-
 
242
        $ts = <<HERE_TARGET;
-
 
243
        $self->{'CMT'}         on $self->{'TIME'}
-
 
244
HERE_TARGET
-
 
245
    }
-
 
246
 
222
    my $var;
247
    my $var;
223
    ($var = <<HERE_TARGET) =~ s/^\s+//gm;
248
    ($var = <<HERE_TARGET) =~ s/^\s+//gm;
224
 
249
 
225
    $self->{'CMT'} -*- mode: $self->{'TYPE'}; tabs: 8; -*-
250
    $self->{'CMT'} -*- mode: $self->{'TYPE'}; tabs: 8; -*-
226
    $self->{'CMT'} -- $desc
251
    $self->{'CMT'} -- $desc
227
    $self->{'CMT'}
252
    $self->{'CMT'}
228
    $self->{'CMT'} -- Do not edit this file. --
253
    $self->{'CMT'} -- Do not edit this file. --
229
    $self->{'CMT'}
254
    $self->{'CMT'}
230
    $self->{'CMT'} Created by $by
255
    $self->{'CMT'} Created by $by
231
    $self->{'CMT'}         on $self->{'TIME'}
256
    $ts
232
    $self->{'CMT'}
257
    $self->{'CMT'}
233
    $trailing
258
    $trailing
234
 
259
 
235
HERE_TARGET
260
HERE_TARGET
236
 
261