summaryrefslogtreecommitdiffstats
path: root/tdeprint/descriptions/readppd
blob: 2c7621a36b261e34ee1f9b93deab1f5cf68c29ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#! /usr/bin/perl

$inui = 0;
$tag = "";
$linenr = 0;

$incomdata = 0;
$aftername = 0;
$aftercomment = 0;
$commentvalue = "";

while ( <STDIN> )
{
  $linenr = $linenr + 1;

     # *LanguageVersion: Check for English
     if (/^\*LanguageVersion:\s+([\w\-]+)\s*$/) {
          last if ($1 ne "English");
     }

     # *OpenUI *InputSlot/Media Source: PickOne
     if ($_ =~ "^*OpenUI") {
	  $inui = 1;
	  $_ =~ s/^\*OpenUI\s*//;
	  $tag = $_;
	  $tag =~ s%:.*$%%;
	  $tag =~ s%/.*%%;
	  chomp($tag);
	  $_ =~ s%\s*:.*$%%;
	  $_ =~ s%\s*\*%%;
	  $_ =~ s%^[^/]*/%%;
	  $_ =~ s%\"%\\\"%g;
	  chomp($_);
	  print "i18n(\"", $_, "\");\n";
	  next;
     }

     if ($_ =~ "^*CloseUI") {
	  $inui = 0;
	  $tag = "";
     }

     if ($inui) {
       if (substr($_, 0, length($tag)) eq $tag) {
	 $_ =~ s%\s*:.*$%%;
	 $_ =~ s%\*\S*\s*%%;
	 $_ =~ s%^[^/]*/%%;
	 $_ =~ s%\"%\\\"%g;
	 chomp($_);
	 print "i18n(\"", $_, "\");\n";
       }
     }

     # *% COMDATA #$VAR1 = {: Start looking for 'name','comment','type'
     if (/^\*\% COMDATA \#\$VAR1/) {
       $incomdata = 1;
     }

     # *% COMDATA #      'name': Continue looking for 'comment'
     if ($incomdata && /^\*\% COMDATA \#\s*\'name\'/) {
       $aftername    = 1;
       $aftercomment = 0;
     }

     # *% COMDATA #      'comment' => '*': Continue looking for 'type'
     if ($aftername && /^\*\% COMDATA \#\s*\'comment\'\s*\=\>\s*\'(.*)\'/) {
       $aftername    = 0;
       $aftercomment = 1;
       $commentvalue = $1;
     }

     # *% COMDATA #      'type' => '*':
     # Output comment if type is 'int', 'float' or 'string'
     if ($aftercomment && /^\*\% COMDATA \#\s*\'type\'\s*\=\>\s*\'(.*)\'/) {
       $aftername    = 0;
       $aftercomment = 0;
       if ($1 eq "int" || $1 eq "float" || $1 eq "string") {
         print "i18n(\"$commentvalue\");\n";
       }
     }
	
   
}