summaryrefslogtreecommitdiffstats
path: root/kdeprint/descriptions/readppd
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /kdeprint/descriptions/readppd
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdeprint/descriptions/readppd')
-rwxr-xr-xkdeprint/descriptions/readppd83
1 files changed, 83 insertions, 0 deletions
diff --git a/kdeprint/descriptions/readppd b/kdeprint/descriptions/readppd
new file mode 100755
index 000000000..2c7621a36
--- /dev/null
+++ b/kdeprint/descriptions/readppd
@@ -0,0 +1,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";
+ }
+ }
+
+
+}