diff options
author | Ludovic Courtes | 2006-07-30 21:06:34 +0000 |
---|---|---|
committer | Ludovic Courtes | 2006-07-30 21:06:34 +0000 |
commit | 23494d8b3283195481aad17cf81f4afeeba9dc84 (patch) | |
tree | 79f5f006dd5f44ebde13590e4075379c1feb19c9 /src | |
parent | 87c848ecb4e6adcc475d0fb1dbbcd124e2bd18c3 (diff) | |
parent | 8aac71ff592e43cd42b768e7facc788be86b38f4 (diff) | |
download | skribilo-23494d8b3283195481aad17cf81f4afeeba9dc84.tar.gz skribilo-23494d8b3283195481aad17cf81f4afeeba9dc84.tar.lz skribilo-23494d8b3283195481aad17cf81f4afeeba9dc84.zip |
Introduced `type-name' as a replacement for `find-runtime-type'.
* src/guile/skribilo/lib.scm (type-name): New (formerly
`find-runtime-type').
* src/guile/skribilo/utils/compat.scm (find-runtime-type): New.
git-archimport-id: lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-35
Diffstat (limited to 'src')
-rw-r--r-- | src/guile/skribilo/lib.scm | 17 | ||||
-rw-r--r-- | src/guile/skribilo/utils/compat.scm | 12 |
2 files changed, 18 insertions, 11 deletions
diff --git a/src/guile/skribilo/lib.scm b/src/guile/skribilo/lib.scm index d538253..21b2a4d 100644 --- a/src/guile/skribilo/lib.scm +++ b/src/guile/skribilo/lib.scm @@ -27,7 +27,7 @@ skribe-warning skribe-warning/ast skribe-message - %procedure-arity) + type-name %procedure-arity) :export-syntax (new define-markup define-simple-markup define-simple-container define-processor-markup) @@ -146,6 +146,21 @@ (options (the-options opts))))) + +;;; +;;; TYPE-NAME +;;; +(define (type-name obj) + (cond ((string? obj) "string") + ((ast? obj) "ast") + ((list? obj) "list") + ((pair? obj) "pair") + ((number? obj) "number") + ((char? obj) "character") + ((keyword? obj) "keyword") + (else (with-output-to-string + (lambda () (write obj)))))) + ;;; ;;; SKRIBE-EVAL-LOCATION ... ;;; diff --git a/src/guile/skribilo/utils/compat.scm b/src/guile/skribilo/utils/compat.scm index 9032bcf..c8c3bd0 100644 --- a/src/guile/skribilo/utils/compat.scm +++ b/src/guile/skribilo/utils/compat.scm @@ -32,6 +32,7 @@ :autoload (skribilo ast) (ast?) :autoload (skribilo condition) (file-search-error? &file-search-error) :autoload (skribilo reader) (make-reader) + :autoload (skribilo lib) (type-name) :use-module (skribilo debug) :re-export (file-size) ;; re-exported from `(skribilo utils files)' :replace (gensym)) @@ -252,16 +253,7 @@ (hash-map->list (lambda (key val) val) h)) (define-public (find-runtime-type obj) - (cond ((string? obj) "string") - ((ast? obj) "ast") - ((list? obj) "list") - ((pair? obj) "pair") - ((number? obj) "number") - ((char? obj) "character") - ((keyword? obj) "keyword") - (else (with-output-to-string - (lambda () (write obj)))))) - + (type-name obj)) ;;; |