[Nickle] nickle: Branch 'master' - 5 commits

Keith Packard keithp at keithp.com
Mon Jan 28 22:09:01 PST 2008


 TODO             |    4 ++--
 command.5c       |   51 +++++++++++++++++++++++++++++++--------------------
 configure.in     |    2 +-
 debian/changelog |    6 ++++++
 float.c          |    3 +++
 scope.c          |    2 +-
 6 files changed, 44 insertions(+), 24 deletions(-)

New commits:
commit b739d5a6f5816100b56b5278f4a99ab4ee937222
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Jan 29 17:08:53 2008 +1100

    Silent underflow on conversion to machine double

diff --git a/configure.in b/configure.in
index 8bfc146..87853cf 100644
--- a/configure.in
+++ b/configure.in
@@ -7,7 +7,7 @@ dnl for licensing information.
 AC_PREREQ(2.59)
 
 AC_INIT([nickle],
-	2.65,
+	2.66,
 	[http://nickle.org],
 	nickle)
 
diff --git a/debian/changelog b/debian/changelog
index 9c6763a..90392c0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+nickle (2.66-1) unstable; urgency=low
+  * Support autoload/autoimport of nested namespaces.
+  * Allow 'print' to find unpublished names
+  
+ -- Keith Packard <keithp at keithp.com>  Sun, 13 Jan 2008 17:39:49 -0800
+
 nickle (2.65-1) unstable; urgency=low
   * Add new '+' type operator for subtyping struct/union
   * Eliminate segfault when pretty printing func declarations
diff --git a/float.c b/float.c
index 12e49d6..2b65ab8 100644
--- a/float.c
+++ b/float.c
@@ -1172,6 +1172,9 @@ DoublePart (Value av, char *error)
 	e = MAX_NICKLE_INT;
     if (e > 1023)
     {
+	if (av->floats.exp->sign == Negative)
+	    return 0.0;
+	
 	RaiseStandardException (exception_invalid_argument, error,
 				2, NewInt (0), av);
 	return 0.0;
commit 9f26613cfa6ce6dd58edf671390d3379fbaf1a34
Author: Keith Packard <keithp at keithp.com>
Date:   Fri Jan 25 19:44:19 2008 -0800

    Fix autoimport for nested namespaces

diff --git a/command.5c b/command.5c
index 3e69c5a..574c458 100644
--- a/command.5c
+++ b/command.5c
@@ -150,25 +150,32 @@ extend namespace Command {
 	    return r + ".5c";
 	}
 	
-	void import_if_needed(string name)
+	void import_if_needed(string[*] name)
 	{
 	    if (do_import)
 	    {
-		string imp = File::sprintf("import %s;\n", name);
+		file	f = File::string_write ();
+		File::fprintf (f, "import ");
+		for (int i = 0; i < dim (name); i++) {
+		    if (i != 0)
+			File::fprintf (f, "::");
+		    File::fprintf (f, "%s", name[i]);
+		}
+		File::fprintf (f, ";\n");
+		string imp = File::string_string (f);
 		lex_string(imp);
 	    }
 	}
 
 	for (int i = 0; i < dim(args); i++) {
 	    string[*]	name = args[i];
-	    if (valid_name (name)) {
-		for (int i = 0; i < dim(name); i++)
-		    import_if_needed(name[i]);
+	    import_if_needed(name);
+
+	    if (valid_name (name))
 		continue;
-	    }
+
 	    for (int j = dim(name) - 1; j >= 0; j--)
 	    {
-		import_if_needed(name[j]);
 		string[*] subname = (string[j+1]) { [k] = name[k] };
 		if (!valid_name (subname))
 		{
commit d9959cfa510ebc56ed6d66cd529c85529b780886
Author: Keith Packard <keithp at keithp.com>
Date:   Sun Jan 13 17:34:02 2008 -0800

    Notice that some TODO items were done a long time ago

diff --git a/TODO b/TODO
index c4fe10f..8f265c1 100644
--- a/TODO
+++ b/TODO
@@ -3,12 +3,10 @@ TO DO
 + Allow poll() as a substitute for select().
 + Allow nick to be built without all the async IO and
   gettimeofday() and the like.
-+ Build a small test suite.
 + Build regression tests for everything on the DONE list.
 + Finish the manual.
 + Fix output formatting length problems.
 + Tagless GC.
-+ Null-safe strings.
 
 TO THINK ABOUT
 
@@ -37,6 +35,8 @@ NOT TO DO
 
 DONE
 
++ Build a small test suite.
++ Null-safe strings.
 + Move std math functions out of math, or import math.
 + Implement library autoload mechanism.
 + Write fixed position (scale=n) math library in nickle ala bc/dc.
commit a8439dbfd270b47bc62b0e6d9a8bf37471ba470d
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Jan 8 23:27:53 2008 -0800

    Support autoload/autoimport of nested namespaces.
    
    While nested namespaces could be loaded, the filenames would reference only
    the last element making it hard to actually use them. This change
    glues the namespace elements together with '-' when building filenames.

diff --git a/command.5c b/command.5c
index c4f69c1..3e69c5a 100644
--- a/command.5c
+++ b/command.5c
@@ -126,22 +126,26 @@ extend namespace Command {
 	if (do_import)
 	    autotype = "autoimport";
 
-	string make_filename(string m)
+	string make_filename(string[*] m)
 	{
 	    string r = "";
-	    bool last_lower = false;
-	    for (int i = 0; i < String::length(m); i++)
-	    {
-		int c = m[i];
-		bool cur_lower = Ctype::islower(c);
-		if (Ctype::isupper(c))
+	    for (int j = 0; j < dim (m); j++) {
+		if (j > 0)
+		    r = r + "-";
+		bool last_lower = false;
+		for (int i = 0; i < String::length(m[j]); i++)
 		{
-		    c = Ctype::tolower(c);
-		    if (last_lower)
-			r = r + "-";
+		    int c = m[j][i];
+		    bool cur_lower = Ctype::islower(c);
+		    if (Ctype::isupper(c))
+		    {
+			c = Ctype::tolower(c);
+			if (last_lower)
+			    r = r + "-";
+		    }
+		    r = r + String::new(c);
+		    last_lower = cur_lower;
 		}
-		r = r + String::new(c);
-		last_lower = cur_lower;
 	    }
 	    return r + ".5c";
 	}
@@ -168,7 +172,7 @@ extend namespace Command {
 		string[*] subname = (string[j+1]) { [k] = name[k] };
 		if (!valid_name (subname))
 		{
-		    string f = make_filename(name[j]);
+		    string f = make_filename(subname);
 		    if (!lex_library (f)) 
 		    {
 			File::fprintf (stderr,
commit e324f392b2bf13f99a2e39dfde7b7f4913be7dfb
Author: Keith Packard <keithp at keithp.com>
Date:   Tue Jan 8 13:14:16 2008 -0800

    Search for unpublished names with NamespaceLocate

diff --git a/scope.c b/scope.c
index 7a44fc6..97bc192 100644
--- a/scope.c
+++ b/scope.c
@@ -257,7 +257,7 @@ NamespaceLocate (Value		names,
 	}
 	namelist = NamespaceFindNamelist (namespace, 
 					  AtomId (StringChars (&string->string)),
-					  search, False);
+					  search, True);
 	search = False;
 	if (!namelist)
 	{


More information about the Nickle mailing list