This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: non-hobbitable code


Finally got my self pulled together. These patches should be all that
is to get keywords to work with hobbit. I haven't checked them against
the latest hobbit and I have reported some parts of it earlier to
Bernard Urban, so it might not patch cleanly.

Let me know of any problems.

Index: hobbit4d/defs.scm
===================================================================
RCS file: /nmc/Repository/tools/guile/guile-hobbit/hobbit4d/defs.scm,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.4.1
diff -u -r1.1.1.2 -r1.1.1.2.4.1
--- hobbit4d/defs.scm	1998/03/27 10:42:46	1.1.1.2
+++ hobbit4d/defs.scm	1998/07/07 16:07:02	1.1.1.2.4.1
@@ -531,11 +531,18 @@
 (define-public *intern-symbol-function* 'intern_symb)
 (define-public *makfromstr-function* 'makfromstr)
 (define-public *string->number-function* 'scm_string_to_number)
+(define-public *keyword-dash-symbol-function* 'scm_keyword_dash_symbol)
+(define-public *make-keyword-from-dash-symbol-function* 'scm_make_keyword_from_dash_symbol)
 (define-public *c-eval-fun* 'scm_eval)
 
 (define-public *internal-c-functions*
-  (list *intern-function* *makfromstr-function*
-	 *intern-symbol-function* *string->number-function* *c-eval-fun*))
+  (list *intern-function*
+	*makfromstr-function*
+	*intern-symbol-function*
+	*string->number-function*
+	*keyword-dash-symbol-function*
+	*make-keyword-from-dash-symbol-function*
+	*c-eval-fun*))
 
 (define-public *prohibited-funs* '())
 
Index: hobbit4d/guile-hobbit.scm
===================================================================
RCS file: /nmc/Repository/tools/guile/guile-hobbit/hobbit4d/guile-hobbit.scm,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.4.2
diff -u -r1.1.1.2 -r1.1.1.2.4.2
--- hobbit4d/guile-hobbit.scm	1998/04/08 13:15:56	1.1.1.2
+++ hobbit4d/guile-hobbit.scm	1998/07/10 12:02:03	1.1.1.2.4.2
@@ -1251,6 +1263,8 @@
 		       (report-warning
 	"exact arithmetic assumed but a nonexact number encountered: " term))
 		   (make-number-constant term) )))
+	 ((keyword? term)
+	     (make-keyword-constant term))
 	 ((symbol? term)
 	    (cond ((or (memq term *local-parameters*)
 		       (memq term *local-vars*)
@@ -1717,6 +1731,19 @@
 	    (make-pair-constant-aux (car term))
 	    (make-pair-constant-aux (cdr term)) )
       (type-const-pass (list 'quote term)) ))
+
+(define (make-keyword-constant kw)
+  (let ((name (make-constant-name))
+	(str (symbol->string (keyword-dash-symbol kw))) )
+    (set! *new-constant-list*
+	  (cons `(set! ,name
+		       (,*make-keyword-from-dash-symbol-function*
+			(car (,*intern-symbol-function*
+			      (,*actual-c-string* ,str)
+			      ,(string-length str) ))))
+		*new-constant-list*))
+     (protect-constant name)
+    name))
 
 (define (make-symbol-constant symb)
   (let ((tmp (assq symb *symbol-constant-table*)))

Index: hobbit4d/guile-hobbit.scm
===================================================================
RCS file: /nmc/Repository/tools/guile/guile-hobbit/hobbit4d/guile-hobbit.scm,v
retrieving revision 1.1.1.2.2.1
retrieving revision 1.1.1.2.2.1.2.1
diff -u -r1.1.1.2.2.1 -r1.1.1.2.2.1.2.1
--- hobbit4d/guile-hobbit.scm	1998/08/11 09:08:59	1.1.1.2.2.1
+++ hobbit4d/guile-hobbit.scm	1999/01/04 11:41:43	1.1.1.2.2.1.2.1
@@ -1310,6 +1310,8 @@
 		      (type-const-pass (cadr term)) )
 		   ((symbol? (cadr term))
 		      (make-symbol-constant (cadr term)) )
+		   ((keyword? (cadr term))
+		      (make-keyword-constant (cadr term)) )
 		   ((pair? (cadr term))
 		      (make-pair-constant (cadr term)) )
 		   (else



---------------------------+--------------------------------------------------
Christian Lynbech          | Telebit Communications A/S                       
Fax:   +45 8628 8186       | Fabrik 11, DK-8260 Viby J
Phone: +45 8628 8177 + 28  | email: chl@tbit.dk --- URL: http://www.telebit.dk
---------------------------+--------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - petonic@hal.com (Michael A. Petonic)