core: Add cstring_to_symbol.

* src/mes.c (make_symbol): Rename from lookup_symbol_.  Update
callers.
(cstring_to_symbol): New function.
* src/reader.c (reader_read_identifier_or_number): Use it.
This commit is contained in:
Jan Nieuwenhuizen 2018-10-14 07:38:51 +02:00
parent 479624fc82
commit bcb58f0326
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
4 changed files with 10 additions and 7 deletions

View File

@ -146,8 +146,8 @@ exec ${GUILE-guile} --no-auto-compile -L $(dirname $0) -C $(dirname $0) -e '(mes
(format #f "g_cells[cell_~a].string = MAKE_STRING (scm_~a.string);\n" (function.name f) (function.name f))
(format #f "g_cells[cell_~a].car = MAKE_STRING (scm_~a.car);\n" (function.name f) (function.name f)))
(if %gcc?
(format #f "a = acons (lookup_symbol_ (scm_~a.string), ~a, a);\n\n" (function.name f) (function-cell-name f))
(format #f "a = acons (lookup_symbol_ (scm_~a.car), ~a, a);\n\n" (function.name f) (function-cell-name f)))))
(format #f "a = acons (make_symbol (scm_~a.string), ~a, a);\n\n" (function.name f) (function-cell-name f))
(format #f "a = acons (make_symbol (scm_~a.car), ~a, a);\n\n" (function.name f) (function-cell-name f)))))
(define (disjoin . predicates)
(lambda (. arguments)

View File

@ -128,9 +128,6 @@
(define (symbol->keyword s)
(core:make-cell <cell:keyword> (symbol->list s) 0))
(define (list->symbol lst)
(core:lookup-symbol lst))
(define (symbol->list s)
(core:car s))

View File

@ -415,7 +415,7 @@ list_of_char_equal_p (SCM a, SCM b) ///((internal))
}
SCM
lookup_symbol_ (SCM s)
list_to_symbol (SCM s)
{
SCM x = g_symbols;
while (x)
@ -585,6 +585,12 @@ cstring_to_list (char const* s)
return string_to_list (s, strlen (s));
}
SCM
cstring_to_symbol (char const *s)
{
return list_to_symbol (cstring_to_list (s));
}
// extra lib
SCM
assert_defined (SCM x, SCM e) ///((internal))

View File

@ -103,7 +103,7 @@ reader_read_identifier_or_number (int c)
}
unreadchar (c);
buf[i] = 0;
return lookup_symbol_ (cstring_to_list (buf));
return cstring_to_symbol (buf);
}
SCM