eliot-dev
[Top][All Lists]
Advanced

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

[Eliot-dev] eliot dic/compdic.cpp test/regression.pl [cppdic]


From: eliot-dev
Subject: [Eliot-dev] eliot dic/compdic.cpp test/regression.pl [cppdic]
Date: Fri, 14 Dec 2007 10:15:31 +0000

CVSROOT:        /cvsroot/eliot
Module name:    eliot
Branch:         cppdic
Changes by:     Olivier Teulière <ipkiss>      07/12/14 10:15:30

Modified files:
        dic            : compdic.cpp 
        test           : regression.pl 

Log message:
         - Handle any line ending in the list of words (\n, \r or \r\n)
         - The regression.pl script can now be called from any directory. It 
still looks for the dictionary in ~/ods4.dawg and the text interface in utils/, 
but symbolic links can do the trick if needed

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/eliot/dic/compdic.cpp?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.2.16&r2=1.1.2.17
http://cvs.savannah.gnu.org/viewcvs/eliot/test/regression.pl?cvsroot=eliot&only_with_tag=cppdic&r1=1.1.6.1&r2=1.1.6.2

Patches:
Index: dic/compdic.cpp
===================================================================
RCS file: /cvsroot/eliot/eliot/dic/Attic/compdic.cpp,v
retrieving revision 1.1.2.16
retrieving revision 1.1.2.17
diff -u -b -r1.1.2.16 -r1.1.2.17
--- dic/compdic.cpp     12 Dec 2007 08:08:12 -0000      1.1.2.16
+++ dic/compdic.cpp     14 Dec 2007 10:15:30 -0000      1.1.2.17
@@ -325,14 +325,19 @@
         edges.push_back(newEdge);
 
         // End of a word?
-        // TODO: handle \r as well
-        if (*global_input == L'\n')
+        if (*global_input == L'\n' || *global_input == L'\r')
         {
             ioHeaderInfo.nwords++;
+            *global_endstring = L'\0';
             // Mark edge as word
             edges.back().term = 1;
-            // Skip \n
-            *global_endstring = *global_input++;
+
+            // Skip \r and/or \n
+            while (global_input != global_endofinput &&
+                   (*global_input == L'\n' || *global_input == L'\r'))
+            {
+                ++global_input;
+            }
             // At the end of input?
             if (global_input == global_endofinput)
                 break;

Index: test/regression.pl
===================================================================
RCS file: /cvsroot/eliot/eliot/test/regression.pl,v
retrieving revision 1.1.6.1
retrieving revision 1.1.6.2
diff -u -b -r1.1.6.1 -r1.1.6.2
--- test/regression.pl  20 Nov 2007 12:54:04 -0000      1.1.6.1
+++ test/regression.pl  14 Dec 2007 10:15:30 -0000      1.1.6.2
@@ -3,6 +3,16 @@
 use strict;
 use warnings;
 
+use Cwd 'abs_path';
+
+my $root_path = $0;
+$root_path =~ s/regression.pl/../;
+$root_path = abs_path($root_path);
+
+# Change to the test/ directory, because some scenarii expect
+# to find saved games in there
+chdir("$root_path/test");
+
 my $driver_file = "driver";
 # Look for ~/ods4.dawg
 my $ods = "$ENV{HOME}/ods4.dawg";
@@ -21,13 +31,13 @@
 
 # Find the text interface
 my $eliottxt;
-if (-x "../utils/eliottxt")
+if (-x "$root_path/utils/eliottxt")
 {
-    $eliottxt = "../utils/eliottxt";
+    $eliottxt = "$root_path/utils/eliottxt";
 }
-elsif (-x "../utils/eliottxt.exe")
+elsif (-x "$root_path/utils/eliottxt.exe")
 {
-    $eliottxt = "../utils/eliottxt.exe";
+    $eliottxt = "$root_path/utils/eliottxt.exe";
 }
 else
 {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]