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:
parent
0068fe533d
commit
96ca5b4e4b
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -332,7 +332,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) {
|
||||
|
|
30
src/mes.c
30
src/mes.c
|
@ -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))
|
||||
|
@ -2147,50 +2153,50 @@ g_cells[cell_getenv_] = scm_getenv_;
|
|||
//mes.environment
|
||||
scm_cons.string = cstring_to_list (fun_cons.name);
|
||||
g_cells[cell_cons].string = MAKE_STRING (scm_cons.string);
|
||||
a = acons (lookup_symbol_ (scm_cons.string), cell_cons, a);
|
||||
a = acons (list_to_symbol (scm_cons.string), cell_cons, a);
|
||||
|
||||
scm_car.string = cstring_to_list (fun_car.name);
|
||||
g_cells[cell_car].string = MAKE_STRING (scm_car.string);
|
||||
a = acons (lookup_symbol_ (scm_car.string), cell_car, a);
|
||||
a = acons (list_to_symbol (scm_car.string), cell_car, a);
|
||||
|
||||
scm_cdr.string = cstring_to_list (fun_cdr.name);
|
||||
g_cells[cell_cdr].string = MAKE_STRING (scm_cdr.string);
|
||||
a = acons (lookup_symbol_ (scm_cdr.string), cell_cdr, a);
|
||||
a = acons (list_to_symbol (scm_cdr.string), cell_cdr, a);
|
||||
|
||||
scm_list.string = cstring_to_list (fun_list.name);
|
||||
g_cells[cell_list].string = MAKE_STRING (scm_list.string);
|
||||
a = acons (lookup_symbol_ (scm_list.string), cell_list, a);
|
||||
a = acons (list_to_symbol (scm_list.string), cell_list, a);
|
||||
|
||||
scm_null_p.string = cstring_to_list (fun_null_p.name);
|
||||
g_cells[cell_null_p].string = MAKE_STRING (scm_null_p.string);
|
||||
a = acons (lookup_symbol_ (scm_null_p.string), cell_null_p, a);
|
||||
a = acons (list_to_symbol (scm_null_p.string), cell_null_p, a);
|
||||
|
||||
scm_eq_p.string = cstring_to_list (fun_eq_p.name);
|
||||
g_cells[cell_eq_p].string = MAKE_STRING (scm_eq_p.string);
|
||||
a = acons (lookup_symbol_ (scm_eq_p.string), cell_eq_p, a);
|
||||
a = acons (list_to_symbol (scm_eq_p.string), cell_eq_p, a);
|
||||
|
||||
//math.environment
|
||||
scm_minus.string = cstring_to_list (fun_minus.name);
|
||||
g_cells[cell_minus].string = MAKE_STRING (scm_minus.string);
|
||||
a = acons (lookup_symbol_ (scm_minus.string), cell_minus, a);
|
||||
a = acons (list_to_symbol (scm_minus.string), cell_minus, a);
|
||||
|
||||
scm_plus.string = cstring_to_list (fun_plus.name);
|
||||
g_cells[cell_plus].string = MAKE_STRING (scm_plus.string);
|
||||
a = acons (lookup_symbol_ (scm_plus.string), cell_plus, a);
|
||||
a = acons (list_to_symbol (scm_plus.string), cell_plus, a);
|
||||
|
||||
//lib.environment
|
||||
scm_display_.string = cstring_to_list (fun_display_.name);
|
||||
g_cells[cell_display_].string = MAKE_STRING (scm_display_.string);
|
||||
a = acons (lookup_symbol_ (scm_display_.string), cell_display_, a);
|
||||
a = acons (list_to_symbol (scm_display_.string), cell_display_, a);
|
||||
|
||||
scm_display_error_.string = cstring_to_list (fun_display_error_.name);
|
||||
g_cells[cell_display_error_].string = MAKE_STRING (scm_display_error_.string);
|
||||
a = acons (lookup_symbol_ (scm_display_error_.string), cell_display_error_, a);
|
||||
a = acons (list_to_symbol (scm_display_error_.string), cell_display_error_, a);
|
||||
|
||||
//posix.environment
|
||||
scm_getenv_.string = cstring_to_list (fun_getenv_.name);
|
||||
g_cells[cell_getenv_].string = MAKE_STRING (scm_getenv_.string);
|
||||
a = acons (lookup_symbol_ (scm_getenv_.string), cell_getenv_, a);
|
||||
a = acons (list_to_symbol (scm_getenv_.string), cell_getenv_, a);
|
||||
|
||||
#if !POSIX
|
||||
#undef function
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue