[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1202
Date       : Sun May 28 17:11:47 BST 2006

Changed paths:
   M /Trunk/XaraLX/Scripts/build-resources.pl
   M /Trunk/XaraLX/wxOil
   M /Trunk/XaraLX/wxOil/camresource.cpp
   M /Trunk/XaraLX/wxOil/xrc/EN/aboutres.xrc
   M /Trunk/XaraLX/wxOil/xrc/EN/aboutrsw.xrc
   M /Trunk/XaraLX/wxOil/xrc/EN/bmpdlg.xrc
   M /Trunk/XaraLX/wxOil/xrc/EN/help-strings.xrc
   M /Trunk/XaraLX/wxOil/xrc/EN/nev-strings.xrc
   M /Trunk/XaraLX/wxOil/xrc/EN/richard2-strings.xrc
   M /Trunk/XaraLX/wxOil/xrc/EN/will-strings.xrc

Fix .po file quoting
Fix illegal use of XML characters
Make build system faster for svnversion


Diff:
Index: Trunk/XaraLX/Scripts/build-resources.pl
===================================================================
--- Trunk/XaraLX/Scripts/build-resources.pl	(revision 1201)
+++ Trunk/XaraLX/Scripts/build-resources.pl	(revision 1202)
@@ -4,6 +4,7 @@
 # Call with a -f argument to force build of resources even if the system doesn't think it necessary
 
 use strict;
+use Fcntl ':mode';
 
 sub usage
 {
@@ -16,14 +17,15 @@
  buildresources.pl [options]
 
  Options:
-   -t TOPDIR                       - Build source directory (for out of tree builds)
-   -o OUTPUTDIR                    - Build output directory (defaults to "wxOil")
-   -f                              - Force rebuilding of resources
-   -x                              - setting of XARALANGUAGE
-   -n / --version x.y              - set version to x.y
-   --verbose                       - be very loud about it
-   --user                          - setting of USERNAME
-   --help                          - display this message
+   -t TOPDIR           - Build source directory (for out of tree builds)
+   -o OUTPUTDIR        - Build output directory (defaults to "wxOil")
+   -f                  - Force rebuilding of resources and svnversion
+   -x                  - setting of XARALANGUAGE
+   -n / --version x.y  - set version to x.y ; omit to prevent svnversion
+                         build
+   --verbose           - be very loud about it
+   --user              - setting of USERNAME
+   --help              - display this message
 
 EOF
 
@@ -84,68 +86,19 @@
 
 print STDERR "Testing for new resources and svn version
";
 
-# Firstly, let's find the svn version if one was specified (else we leave it)
-if ($version ne "")
-{
-    my $svnv;
-    $svnv=`svnversion $topdir`;
-    my $bdate;
-    $bdate= `date +"%d-%b-%y %H:%M"`;
-    chomp($bdate);
-    chomp($svnv);
-    my @svnversion;
-    my $camversionmajor;
-    my $camversionminor;
-    ($camversionmajor, $camversionminor)=split('.',$version);
-    push @svnversion, 'const TCHAR g_pszSvnVersion[] = wxT("'.$svnv.'");';
-    push @svnversion, 'const TCHAR g_pszAppVersion[] = wxT("'.$version.'");';
-    push @svnversion, "#define CAMELOT_VERSION_MAJOR $camversionmajor";
-    push @svnversion, "#define CAMELOT_VERSION_MINOR $camversionminor";
-    push @svnversion, "#define CAMELOT_VERSION $version";
-    push @svnversion, "#define CAMELOT_VERSION_STRING wxT(\"$version ($user)\")";
-    push @svnversion, "#define CAMELOT_BUILD_DATE _T(\"$bdate\")".
-
-    my $writeversion;
-    $writeversion=1;
-
-    my $i=0;
-    if (open(VERSION,"$outputdir/svnversion.h"))
-    {
-	$writeversion=$force;
-	while(<VERSION>)
-	{
-	    chomp;
-	    my $l;
-	    $l=$svnversion[$i++];
-	    # ignore differences in date, or every make would produce a new link!
-	    if (!((/CAMELOT_BUILD_DATE/) && ($l=~/CAMELOT_BUILD_DATE/)) && ($l ne $_))
-	    {
-		$writeversion=1;
-		last;
-	    }
-	}
-    }
-
-    # OK it's changed
-    if ($writeversion)
-    {
-	print STDERR "Writing svnversion.h
";
-	open (VERSION, ">$outputdir/svnversion.h") || die "Can't write svnversion.h: $!";
-	foreach $i (@svnversion)
-	{
-	    print VERSION "$i
";
-	}
-	close(VERSION);
-    }
-}
-
-
 # Resource system
 # get the timestamp
 my $omtime=0;
 $omtime=(stat("$outputdir/resources.h"))[9]; # this may fail, in which case it looks like it was generated at the epoch
 $omtime+=0;
 
+# And the same thing for svnversion - we look at the cached file states. When we rebuild the cache we check
+# to see if this would result in a different svnversion. The .h file might not change as not every cache file change
+# results in a new svnversion.
+my $svtime=0;
+$svtime=(stat("$outputdir/svnversion.cache"))[9]; # this may fail, in which case it looks like it was generated at the epoch
+$svtime+=0;
+
 opendir(DIR, "$topdir/wxOil/xrc") || die "Can't open $topdir/wxOil/xrc: $!";
 my @resfiles=sort grep { /^[^\#].*\.(png|ico|cur|bmp|res|xar)$/ } readdir(DIR);
 closedir(DIR);
@@ -155,6 +108,7 @@
 closedir(DIR);
 
 my $newer=0;
+my $svnewer=0;
 
 my $f;
 foreach $f (@xrcfiles)
@@ -163,26 +117,144 @@
     if ((stat($f))[9] > $omtime)
     {
 	$newer=1;
+	$svnewer=1;
     }
+    if ((stat($f))[9] > $svtime)
+    {
+	$svnewer=1;
+    }
 }
+
 foreach $f (@resfiles)
 {
     $f = "$topdir/wxOil/xrc/".$f;
     if ((stat($f))[9] > $omtime)
     {
 	$newer=1;
+	$svnewer=1;
     }
+    if ((stat($f))[9] > $svtime)
+    {
+	$svnewer=1;
+    }
 }
 
 if ((stat("$topdir/wxOil/xrc/$xaralanguage"))[9] > $omtime)
 {
+    $svnewer=1;
     $newer=1;
 }
+if ((stat("$topdir/wxOil/xrc/$xaralanguage"))[9] > $svtime)
+{
+    $svnewer=1;
+}
 if ((stat("$topdir/wxOil/xrc"))[9] > $omtime)
 {
+    $svnewer=1;
     $newer=1;
 }
+if ((stat("$topdir/wxOil/xrc"))[9] > $svtime)
+{
+    $svnewer=1;
+}
 
+# Firstly, let's find the svn version if one was specified (else we leave it)
+if ($version ne "")
+{
+    # First determine whether we need to do a rebuild of svnversion at all
+    # We look to see if any of the files passed on the command line are
+    # newer than svnversion.h
+
+    if (open(VCACHE,"$outputdir/svnversion.cache"))
+    {
+	while(<VCACHE>)
+	{
+	    next if /^\?/; # miss stuff not under version control
+	    # Note svn status prepends $topdir unless it's "." in which case it is not needed
+	    $f=substr($_, 40, -1);
+	    my @s;
+	    @s=stat($f);
+	    my $m;
+	    $m=$s[9]+0;
+	    next if (S_ISDIR($s[2])); # ignore directories
+	    print STDERR "Checking '$f' - mtime $m
" if ($verbose >1);
+	    if (($m == 0) || ($m > $svtime)) # catch case where file disappears
+	    {
+		$svnewer=1;
+		print STDERR "$f is NEWER, $m > $svtime 
" if ($verbose);
+	    }
+	}
+	close (VCACHE);
+    }
+    else
+    {
+	# No cache file
+	$svnewer = 1;
+    }
+
+    my $writeversion;
+    my @svnversion;
+    $writeversion=0;
+
+    if ($svnewer || $force)
+    {
+	print STDERR "Rebuilding svn version
";
+
+	# Generate the cache
+	system ("svn status -v $topdir > $outputdir/svnversion.cache");
+	
+	my $svnv;
+	$svnv=`svnversion $topdir`;
+	my $bdate;
+	$bdate= `date +"%d-%b-%y %H:%M"`;
+	chomp($bdate);
+	chomp($svnv);
+	my $camversionmajor;
+	my $camversionminor;
+	($camversionmajor, $camversionminor)=split('.',$version);
+	push @svnversion, 'const TCHAR g_pszSvnVersion[] = wxT("'.$svnv.'");';
+	push @svnversion, 'const TCHAR g_pszAppVersion[] = wxT("'.$version.'");';
+	push @svnversion, "#define CAMELOT_VERSION_MAJOR $camversionmajor";
+	push @svnversion, "#define CAMELOT_VERSION_MINOR $camversionminor";
+	push @svnversion, "#define CAMELOT_VERSION $version";
+	push @svnversion, "#define CAMELOT_VERSION_STRING wxT(\"$version ($user)\")";
+	push @svnversion, "#define CAMELOT_BUILD_DATE _T(\"$bdate\")";
+	
+	# in case it doesn't open
+	$writeversion=1;
+	
+	my $i=0;
+	if (open(VERSION,"$outputdir/svnversion.h"))
+	{
+	    $writeversion=$force;
+	    while(<VERSION>)
+	    {
+		chomp;
+		my $l;
+		$l=$svnversion[$i++];
+		# ignore differences in date, or every make would produce a new link!
+		if (!((/CAMELOT_BUILD_DATE/) && ($l=~/CAMELOT_BUILD_DATE/)) && ($l ne $_))
+		{
+		    $writeversion=1;
+		    last;
+		}
+	    }
+	}
+    }
+
+    # OK it's changed
+    if ($writeversion)
+    {
+	print STDERR "Writing svnversion.h
";
+	open (VERSION, ">$outputdir/svnversion.h") || die "Can't write svnversion.h: $!";
+	foreach my $i (@svnversion)
+	{
+	    print VERSION "$i
";
+	}
+	close(VERSION);
+    }
+}
+
 # If there are no newer files, and force isn't set, exit without even doing the checksum
 if (!$newer && !$force)
 {
@@ -198,7 +270,7 @@
 my $i;
 foreach $i (@all)
 {
-    print STDERR "Checksumming $i
" if ($verbose);
+    print STDERR "Checksumming $i
" if ($verbose>1);
     my $fh=new FileHandle "<$i";
     $context->add($i); # add the name of the file too
     $context->addfile($fh);
@@ -249,6 +321,10 @@
 {
     chomp;
     s/^\S+	//;
+    # escape slashes
+    s/\/\\/g;
+    # escape quotes
+    s/\"/\\"/g;
     my $s;
     $s="_(\"$_\");";
     push @strings, $s;
@@ -259,6 +335,7 @@
 open(DIALOGS,"$wxrc -g $outputdir/xrc/dialogs.xrc|") || die "Could not read dialogs for translation: $!";
 while (<DIALOGS>)
 {
+    # Note wxrc removes XML escaping
     chomp;
     print STDERR "Dialog: $_
" if ($verbose>2);
     push @strings,$_;
@@ -274,14 +351,22 @@
     $j=$i;
     next if ($j =~ /^_\(\"\"\)\;\s+$/);
     $j=~s/\r\n/\n/g;
-#    $j=~s/&amp;/\&/g;
+    # strings.lst is still XML escaped. We want to remove the XML escaping here - we add C escaping to BOTH
+    # later
+    # We should use proper XML unquoting here - AMB to fix
+    $j=~s/&lt;/\</g;
+    $j=~s/&gt;/\>/g;
+    $j=~s/&quot;/\"/g;
+    $j=~s/&amp;/\&/g;
     push @uniqstrings, $j;
 }
 
-open (XGETTEXT, "|".$xgettext.' --force-po -k_ -C -i - --no-location --copyright-holder "Xara Group Ltd" --msgid-bugs-address=bugs@xxxxxxxx -d xaralx -o '.$outputdir."/xrc/xaralx.po") || die "Can't run $xgettext: $!";
+my $n=1;
+open (XGETTEXT, "|".$xgettext.' --from-code ISO-8859-1 --force-po -k_ -C -i - --no-location --copyright-holder "Xara Group Ltd" --msgid-bugs-address=bugs@xxxxxxxx -d xaralx -o '.$outputdir."/xrc/xaralx.po") || die "Can't run $xgettext: $!";
 foreach $i (@uniqstrings)
 {
-    print STDERR "Translate: $i
" if ($verbose>2);
+    print STDERR "Line $n, translate: $i
" if ($verbose>2);
+    $n++;
     print XGETTEXT "$i
";
 }
 close (XGETTEXT);
Index: Trunk/XaraLX/wxOil/camresource.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camresource.cpp	(revision 1201)
+++ Trunk/XaraLX/wxOil/camresource.cpp	(revision 1202)
@@ -591,14 +591,26 @@
 					{
 						tc=_T('?');
 						UINT32 code=tc;
-						// It's an alphanumeric form of a unicode character
+						// It's an alphanumeric form of a unicode character in hex
 #if wxUSE_UNICODE
-						sscanf((const char*)seq.mb_str(wxConvUTF8), "#x%x;", &tc);
+						sscanf((const char*)seq.mb_str(wxConvUTF8), "#x%x;", &code);
 #else
-						sscanf((const char*)seq.c_str(), "#x%x;", &tc);						
+						sscanf((const char*)seq.c_str(), "#x%x;", &code);	
 #endif
 						tc=(TCHAR)(code);
 					}
+					else if ((seq.Length()>2) && (seq.GetChar(0)==_T('#')) && ((seq.GetChar(1)>=_T('0')) && (seq.GetChar(1)<=_T('9'))))
+					{
+						tc=_T('?');
+						UINT32 code=tc;
+						// It's an alphanumeric form of a unicode character in decimal
+#if wxUSE_UNICODE
+						sscanf((const char*)seq.mb_str(wxConvUTF8), "#%d;", &code);
+#else
+						sscanf((const char*)seq.c_str(), "#%d;", &code);						
+#endif
+						tc=(TCHAR)(code);
+					}
 					else
 					{
 						TRACE(_T("CamResource::ReadStringTableFile - Unknown XML escape sequence [&%s] in %s, %s"),seq.c_str(),name.c_str(),text.c_str());
Index: Trunk/XaraLX/wxOil/xrc/EN/nev-strings.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/nev-strings.xrc	(revision 1201)
+++ Trunk/XaraLX/wxOil/xrc/EN/nev-strings.xrc	(revision 1202)
@@ -133,7 +133,7 @@
 			<object class="sizeritem">
 				<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
 				<object class="wxStaticText" name="IDS_SPLASHBOX_COPYRIGHT">
-					<label>© Xara Ltd 1995</label>
+					<label>&#169; Xara Group Ltd 1995</label>
 				</object>
 			</object>
 			<object class="sizeritem">
Index: Trunk/XaraLX/wxOil/xrc/EN/help-strings.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/help-strings.xrc	(revision 1201)
+++ Trunk/XaraLX/wxOil/xrc/EN/help-strings.xrc	(revision 1202)
@@ -7,7 +7,7 @@
 			<object class="sizeritem">
 				<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
 				<object class="wxStaticText" name="IDS_MISSING_HELPDIR">
-					<label>The directory which contains the help file is not present, no help will be avialable.</label>
+					<label>The directory which contains the help file is not present, no help will be available.</label>
 				</object>
 			</object>
 			<object class="sizeritem">
Index: Trunk/XaraLX/wxOil/xrc/EN/aboutrsw.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/aboutrsw.xrc	(revision 1201)
+++ Trunk/XaraLX/wxOil/xrc/EN/aboutrsw.xrc	(revision 1202)
@@ -24,7 +24,7 @@
 		</object>
 		<object class="wxStaticText" name="IDC_STATIC">
 			 <pos>29,14d</pos> <size>131,8d</size>
-			<label>Copyright ? 1997 Xara Ltd.</label>
+			<label>Copyright &#169; 1997 Xara Ltd.</label>
 		</object>
 		<object class="wxCamDrawControl" name="IDC_STRIPE1">
 			 <pos>4,44d</pos> <size>196,1d</size>
Index: Trunk/XaraLX/wxOil/xrc/EN/will-strings.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/will-strings.xrc	(revision 1201)
+++ Trunk/XaraLX/wxOil/xrc/EN/will-strings.xrc	(revision 1202)
@@ -955,7 +955,7 @@
 			<object class="sizeritem">
 				<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
 				<object class="wxStaticText" name="IDS_REPLACEATTRSOP">
-					<label>&amp;Replace attributes;Replaces sepcified atributes;Replace attributes</label>
+					<label>&amp;Replace attributes;Replaces specified attributes;Replace attributes</label>
 				</object>
 			</object>
 			<object class="sizeritem">
Index: Trunk/XaraLX/wxOil/xrc/EN/bmpdlg.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/bmpdlg.xrc	(revision 1201)
+++ Trunk/XaraLX/wxOil/xrc/EN/bmpdlg.xrc	(revision 1202)
@@ -204,7 +204,7 @@
 		</object>
 		<object class="wxCheckBox" name="IDC_ANIMOPTS_LOOP">
 			 <pos>154,182d</pos> <size>85,10d</size>
-			<label>Loop Continously</label>
+			<label>Loop Continuously</label>
 		</object>
 		<object class="wxTextCtrl" name="IDC_BMPOPTS_NUMCOLS_EDIT">
 			 <pos>86,215d</pos> <size>40,14d</size>
Index: Trunk/XaraLX/wxOil/xrc/EN/aboutres.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/aboutres.xrc	(revision 1201)
+++ Trunk/XaraLX/wxOil/xrc/EN/aboutres.xrc	(revision 1202)
@@ -24,7 +24,7 @@
 		</object>
 		<object class="wxStaticText" name="IDC_STATIC">
 			 <pos>29,14d</pos> <size>131,8d</size>
-			<label>Copyright © 1994-2005 Xara Group Ltd.</label>
+			<label>Copyright &#169; 1994-2005 Xara Group Ltd.</label>
 		</object>
 		<object class="wxCamDrawControl" name="IDC_STRIPE1">
 			 <pos>4,40d</pos> <size>216,1d</size>
@@ -83,7 +83,7 @@
 		</object>
 		<object class="wxStaticText" name="IDC_STATIC">
 			 <pos>29,14d</pos> <size>131,8d</size>
-			<label>Copyright © 1994-2005 Xara Group Ltd.</label>
+			<label>Copyright &#169; 1994-2005 Xara Group Ltd.</label>
 		</object>
 		<object class="wxCamDrawControl" name="IDC_STRIPE1">
 			 <pos>4,40d</pos> <size>216,1d</size>
@@ -150,7 +150,7 @@
 		</object>
 		<object class="wxStaticText" name="IDC_STATIC">
 			 <pos>29,14d</pos> <size>131,8d</size>
-			<label>Copyright © 1994-2005 Xara Group Ltd.</label>
+			<label>Copyright &#169; 1994-2005 Xara Group Ltd.</label>
 		</object>
 		<object class="wxCamDrawControl" name="IDC_STRIPE1">
 			 <pos>4,40d</pos> <size>216,1d</size>
Index: Trunk/XaraLX/wxOil/xrc/EN/richard2-strings.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/richard2-strings.xrc	(revision 1201)
+++ Trunk/XaraLX/wxOil/xrc/EN/richard2-strings.xrc	(revision 1202)
@@ -1057,7 +1057,7 @@
 			<object class="sizeritem">
 				<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
 				<object class="wxStaticText" name="IDS_SGBITMAP_MONOCHROME">
-					<label>Monochome</label>
+					<label>Monochrome</label>
 				</object>
 			</object>
 			<object class="sizeritem">

Property changes on: Trunk/XaraLX/wxOil
___________________________________________________________________
Name: svn:ignore
   - Makefile
resources.h
svnversion.h
Makefile.in
.deps
libwxOil.a

   + Makefile
resources.h
svnversion.h
svnversion.cache
Makefile.in
.deps
libwxOil.a


Xara