[maemo-commits] [maemo-commits] r8434 - in projects/haf/trunk/hildon-theme-tools: . src

From: www-data at stage.maemo.org www-data at stage.maemo.org
Date: Wed Nov 29 10:13:37 EET 2006
Author: mdk
Date: 2006-11-29 10:13:36 +0200 (Wed, 29 Nov 2006)
New Revision: 8434

Added:
   projects/haf/trunk/hildon-theme-tools/src/hildon-theme-rc-parser
Modified:
   projects/haf/trunk/hildon-theme-tools/ChangeLog
   projects/haf/trunk/hildon-theme-tools/src/Makefile.am
   projects/haf/trunk/hildon-theme-tools/src/colourizer.c
   projects/haf/trunk/hildon-theme-tools/src/outliner.c
   projects/haf/trunk/hildon-theme-tools/src/regenerator.c
   projects/haf/trunk/hildon-theme-tools/src/slicer.c
Log:
Adding the new perl script to parse the rc files.
Some more error info in tools.


Modified: projects/haf/trunk/hildon-theme-tools/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-theme-tools/ChangeLog	2006-11-28 22:53:36 UTC (rev 8433)
+++ projects/haf/trunk/hildon-theme-tools/ChangeLog	2006-11-29 08:13:36 UTC (rev 8434)
@@ -1,3 +1,13 @@
+2006-11-29  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
+	
+	* src/hildon-theme-rc-parser:
+	* src/Makefile.am: Adding the new perl script to parse the rc files.
+	
+	* src/colourizer.c:
+	* src/outliner.c:
+	* src/regenerator.c:
+	* src/slicer.c: Some more error info.
+
 2006-11-27  Michael Dominic Kostrzewa  <michael.kostrzewa at nokia.com> 
 
 	* scripts/hildon-theme-install: Adding the default text color for

Modified: projects/haf/trunk/hildon-theme-tools/src/Makefile.am
===================================================================
--- projects/haf/trunk/hildon-theme-tools/src/Makefile.am	2006-11-28 22:53:36 UTC (rev 8433)
+++ projects/haf/trunk/hildon-theme-tools/src/Makefile.am	2006-11-29 08:13:36 UTC (rev 8434)
@@ -3,6 +3,8 @@
 					  hildon-theme-regenerator 	\
 					  hildon-theme-outliner
 
+dist_bin_SCRIPTS			= hildon-theme-rc-parser
+
 # Slicer
 hildon_theme_slicer_CFLAGS 		= $(GTK_CFLAGS)
 hildon_theme_slicer_LDADD 		= $(GTK_LIBS)

Modified: projects/haf/trunk/hildon-theme-tools/src/colourizer.c
===================================================================
--- projects/haf/trunk/hildon-theme-tools/src/colourizer.c	2006-11-28 22:53:36 UTC (rev 8433)
+++ projects/haf/trunk/hildon-theme-tools/src/colourizer.c	2006-11-29 08:13:36 UTC (rev 8434)
@@ -104,7 +104,7 @@
 
         if (template_file == NULL || image_file == NULL) {
                 show_usage ();
-                goto Error;
+                g_error ("Not enough arguments given!");
         }
 
         /* Check the template file... */

Added: projects/haf/trunk/hildon-theme-tools/src/hildon-theme-rc-parser
===================================================================
--- projects/haf/trunk/hildon-theme-tools/src/hildon-theme-rc-parser	2006-11-28 22:53:36 UTC (rev 8433)
+++ projects/haf/trunk/hildon-theme-tools/src/hildon-theme-rc-parser	2006-11-29 08:13:36 UTC (rev 8434)
@@ -0,0 +1,86 @@
+#! /usr/bin/perl
+
+# GPL license, Copyright (c) 2006 by Nokia Corporation                       
+#                                                                            
+# Authors:                                                                   
+#      Michael Dominic K. <michael.kostrzewa at nokia.com>
+#      Marius Vollmer <marius.vollmer at nokia.com>
+#                                                                            
+# This program is free software; you can redistribute it and/or modify it    
+# under the terms of the GNU General Public License as published by the      
+# Free Software Foundation, version 2.                                                                   
+#                                                                            
+# This program is distributed in the hope that it will be useful, but        
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   
+# for more details.                                                          
+#                                                                            
+# You should have received a copy of the GNU General Public License along    
+# with this program; if not, write to the Free Software Foundation, Inc., 59 
+# Temple Place - Suite 330, Boston, MA 02111-1307, USA.                      
+
+use File::Basename;
+
+sub show_banner 
+{
+        print "RC processor tool by Michael Dominic K. and Marius Vollmer\n";
+        print "Copyright 2006 by Nokia Corporation.\n\n";
+}
+
+sub show_usage 
+{
+        my $program_name = basename($0);
+        print "Usage: $program_name <input rc file> <output rc file>\n\n";
+        print "This tool will process the supplied input rc file and include all\n";
+        print "the sub-rc files referrenced from it - producing a flat gtkrc.\n\n";
+}
+
+sub process_gtkrc
+{
+        my $file_name = "$_[0]";
+        my $file;
+
+        if (not open ($file, "< $file_name")) {
+                print STDERR "ERROR: Failed to open \"$file_name\" rc file.\n";
+                return 0;
+        }
+    
+        while (<$file>)
+        {
+                if (/^include "(.*)"$/) {
+                        if (not process_gtkrc ($1)) {
+                                print STDERR ("ERROR: Failed to include \"$1\" in \"$file_name\"\n");
+                                return 0;
+                        }
+                } else {
+                        print TARGET $_;
+                }
+        }
+
+        close ($file);
+        return 1;
+}
+
+# Show our nice welcome info
+show_banner;
+
+# Check if we have enough arguments
+if ($#ARGV + 1 < 2) {
+        show_usage ();
+        print STDERR "ERROR: Not enough arguments specified.";
+        exit 128;
+}
+
+# Open the output file
+if (not open (TARGET, "> $ARGV[1]")) {
+        print STDERR "ERROR: Could not open the output file \"$ARGV[1]\"\n";
+        exit 128;
+}
+
+
+# Recursively process the rc file
+if (not process_gtkrc ($ARGV[0])) {
+        exit 128;
+} else {
+        exit 0;
+}


Property changes on: projects/haf/trunk/hildon-theme-tools/src/hildon-theme-rc-parser
___________________________________________________________________
Name: svn:executable
   + *

Modified: projects/haf/trunk/hildon-theme-tools/src/outliner.c
===================================================================
--- projects/haf/trunk/hildon-theme-tools/src/outliner.c	2006-11-28 22:53:36 UTC (rev 8433)
+++ projects/haf/trunk/hildon-theme-tools/src/outliner.c	2006-11-29 08:13:36 UTC (rev 8434)
@@ -117,7 +117,7 @@
 
         if (template_file == NULL || output_image_file == NULL) {
                 show_usage ();
-                goto Error;
+                g_error ("Not enough arguments given!");
         }
 
         /* Check the template file... */

Modified: projects/haf/trunk/hildon-theme-tools/src/regenerator.c
===================================================================
--- projects/haf/trunk/hildon-theme-tools/src/regenerator.c	2006-11-28 22:53:36 UTC (rev 8433)
+++ projects/haf/trunk/hildon-theme-tools/src/regenerator.c	2006-11-29 08:13:36 UTC (rev 8434)
@@ -120,7 +120,7 @@
 
         if (template_file == NULL || output_image_file == NULL) {
                 show_usage ();
-                goto Error;
+                g_error ("Not enough arguments given!");
         }
 
         /* Check the template file... */

Modified: projects/haf/trunk/hildon-theme-tools/src/slicer.c
===================================================================
--- projects/haf/trunk/hildon-theme-tools/src/slicer.c	2006-11-28 22:53:36 UTC (rev 8433)
+++ projects/haf/trunk/hildon-theme-tools/src/slicer.c	2006-11-29 08:13:36 UTC (rev 8434)
@@ -122,7 +122,7 @@
 
         if (template_file == NULL || image_file == NULL) {
                 show_usage ();
-                goto Error;
+                g_error ("Not enough arguments given!");
         }
 
         /* Check the template file... */


More information about the maemo-commits mailing list