[Commit] nickle ChangeLog, 1.117, 1.118 foreign.c, 1.2, 1.3 scanf.5c, 1.20, 1.21 value.h, 1.110, 1.111

Keith Packard commit at keithp.com
Thu Dec 23 14:07:19 PST 2004


Committed by: keithp

Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv10880

Modified Files:
	ChangeLog foreign.c scanf.5c value.h 
Log Message:
2004-12-23  Keith Packard  <keithp at keithp.com>

	* foreign.c: (ForeignMark), (NewForeign):
	* value.h:
	Change foreign API to include mark so that foreign objects can
	use nickle allocator if they like.  Note this is an ABI incompatible
	change.
	
	* scanf.5c:
	EOF not handled correctly in '%s' scanf formats


Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/nickle/ChangeLog,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- ChangeLog	19 Dec 2004 03:01:01 -0000	1.117
+++ ChangeLog	23 Dec 2004 22:07:16 -0000	1.118
@@ -1,3 +1,14 @@
+2004-12-23  Keith Packard  <keithp at keithp.com>
+
+	* foreign.c: (ForeignMark), (NewForeign):
+	* value.h:
+	Change foreign API to include mark so that foreign objects can
+	use nickle allocator if they like.  Note this is an ABI incompatible
+	change.
+	
+	* scanf.5c:
+	EOF not handled correctly in '%s' scanf formats
+
 2004-12-18  Keith Packard  <keithp at keithp.com>
 
 	* Makefile.am:

Index: foreign.c
===================================================================
RCS file: /local/src/CVS/nickle/foreign.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- foreign.c	17 Dec 2004 02:05:20 -0000	1.2
+++ foreign.c	23 Dec 2004 22:07:16 -0000	1.3
@@ -32,6 +32,10 @@
 static void
 ForeignMark (void *object)
 {
+    Foreign *foreign = object;
+
+    if (foreign->mark)
+	(*foreign->mark) (foreign->data);
 }
 
 static int
@@ -77,7 +81,7 @@
 }
 
 Value
-NewForeign (const char *id, void *data, void (*free) (void *data))
+NewForeign (const char *id, void *data, void (*mark) (void *data), void (*free) (void *data))
 {
     ENTER ();
     Value   ret;
@@ -86,5 +90,6 @@
     ret->foreign.id = id;
     ret->foreign.data = data;
     ret->foreign.free = free;
+    ret->foreign.mark = mark;
     RETURN (ret);
 }

Index: scanf.5c
===================================================================
RCS file: /local/src/CVS/nickle/scanf.5c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- scanf.5c	8 Jun 2004 09:30:54 -0000	1.20
+++ scanf.5c	23 Dec 2004 22:07:16 -0000	1.21
@@ -105,9 +105,16 @@
 
 	    whitespace();
 	    s = "";
-	    while (Ctype::isgraph (c = File::getc(f)) && !File::end(f))
+	    while (!File::end (f)) 
+	    {
+		c = File::getc(f);
+		if (!Ctype::isgraph (c))
+		{
+		    File::ungetc (c, f);
+		    break;
+		}
 		s = s + String::new(c);
-	    File::ungetc (c, f);
+	    }
 	    return s;
 	}
 

Index: value.h
===================================================================
RCS file: /local/src/CVS/nickle/value.h,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- value.h	17 Dec 2004 02:05:20 -0000	1.110
+++ value.h	23 Dec 2004 22:07:16 -0000	1.111
@@ -585,6 +585,7 @@
     BaseValue	    base;
     const char	    *id;
     void	    *data;
+    void	    (*mark)(void *);
     void	    (*free)(void *);
 } Foreign;
 
@@ -966,7 +967,7 @@
 Value	NewValueFloat (Value av, unsigned prec);
 Value	NewDoubleFloat (double d);
 Value	NewContinuation (ContinuationPtr continuation, InstPtr pc);
-Value	NewForeign (const char *id, void *data, void (*free)(void *data));
+Value	NewForeign (const char *id, void *data, void (*mark)(void *data), void (*free)(void *data));
 
 unsigned    FpartLength (Fpart *a);
 




More information about the Commit mailing list