/[webpac]/trunk/parse_format.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/parse_format.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 22 - (hide annotations)
Sun Feb 23 00:01:08 2003 UTC (16 years, 9 months ago) by dpavlin
File size: 1301 byte(s)
*** empty log message ***

1 dpavlin 10 #-------------------------------------------------------------
2     #
3     # parse_format('format',$isis_row);
4     #
5    
6     use isis_sf;
7    
8     sub parse_format {
9     my $format = shift;
10     my $row = shift;
11    
12     my $out;
13     my $out_swish;
14    
15     my $prefix = "";
16     if ($format =~ s/^([^\d]+)//) {
17     $prefix = "pre: $1";
18     }
19    
20     my $display;
21     my $swish;
22    
23     while ($format) {
24     #print STDERR "#### $format\n";
25     if ($format =~ s/^(\d\d\d)(\w?)//) {
26     my $isis_tmp = isis_sf($row,$1,$2);
27     if ($isis_tmp) {
28     $display .= $prefix . $isis_tmp;
29     $swish .= $isis_tmp." ";
30     }
31     $prefix = "";
32 dpavlin 22 # this might be our local scpeciality -- fields 10 and 11
33     # (as opposed to 010 and 011) so they are strictly listed
34     # here
35     } elsif ($format =~ s/^(1[01])//) {
36     my $isis_tmp = isis_sf($row,$1,$2);
37     if ($isis_tmp) {
38     $display .= $prefix . $isis_tmp;
39     $swish .= $isis_tmp." ";
40     }
41     $prefix = "";
42 dpavlin 10 } elsif ($format =~ s/^([^\d]+)(\d{0,3})/$2/) {
43     $prefix .= $1;
44     } elsif ($format =~ s/^([^\d]+\d{0,2})//) {
45     $prefix .= $1;
46     } elsif ($format =~ s/^(\d{1,2})//) {
47     $prefix .= $1;
48     } else {
49     print STDERR "unparsed format: $format\n";
50     $prefix .= $format;
51     $format = "";
52     }
53     }
54     # add suffix
55     $display .= $prefix if ($display);
56    
57     return ($swish,$display);
58     }
59    
60     #-------------------------------------------------------------
61     1;

Properties

Name Value
cvs2svn:cvs-rev 1.2

  ViewVC Help
Powered by ViewVC 1.1.26