2019-06-08 14:36:22 +01:00
|
|
|
/* -*-comment-start: "//";comment-end:""-*-
|
|
|
|
* GNU Mes --- Maxwell Equations of Software
|
|
|
|
* Copyright © 2016,2017,2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
|
|
|
*
|
|
|
|
* This file is part of GNU Mes.
|
|
|
|
*
|
|
|
|
* GNU Mes is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* GNU Mes is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MES_BUILTINS_H
|
|
|
|
#define __MES_BUILTINS_H
|
|
|
|
|
2020-04-20 17:53:28 +01:00
|
|
|
/* src/builtins.c */
|
2020-04-19 09:49:48 +01:00
|
|
|
SCM make_builtin (SCM builtin_type, SCM name, SCM arity, SCM function);
|
2020-04-20 17:53:28 +01:00
|
|
|
SCM builtin_name (SCM builtin);
|
2020-04-19 09:49:48 +01:00
|
|
|
SCM builtin_arity (SCM builtin);
|
|
|
|
SCM builtin_p (SCM x);
|
|
|
|
SCM builtin_printer (SCM builtin);
|
core: Split-out core.c.
* src/mes.c (assoc_string, car, cdr, list, null_p, eq_p, values, acons,
length__, length, error, append2, append_reverse, reverse_x_, assq,
assoc): Move to ...
* src/core.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make (MES_SOURCES): Likewise.
* build-aux/snarf.sh: Likewise.
* include/mes/builtins.h: Update.
* src/builtins.c (mes_builtins): Update.
2020-07-19 07:49:23 +01:00
|
|
|
/* src/core.c */
|
|
|
|
SCM car (SCM x);
|
|
|
|
SCM cdr (SCM x);
|
|
|
|
SCM list (SCM x);
|
|
|
|
SCM null_p (SCM x);
|
|
|
|
SCM eq_p (SCM x, SCM y);
|
|
|
|
SCM values (SCM x);
|
|
|
|
SCM acons (SCM key, SCM value, SCM alist);
|
|
|
|
SCM length (SCM x);
|
|
|
|
SCM error (SCM key, SCM x);
|
|
|
|
SCM append2 (SCM x, SCM y);
|
|
|
|
SCM append_reverse (SCM x, SCM y);
|
|
|
|
SCM reverse_x_ (SCM x, SCM t);
|
|
|
|
SCM assq (SCM x, SCM a);
|
|
|
|
SCM assoc (SCM x, SCM a);
|
2020-05-17 19:42:48 +01:00
|
|
|
/* src/display.c */
|
|
|
|
SCM display_ (SCM x);
|
|
|
|
SCM display_error_ (SCM x);
|
|
|
|
SCM display_port_ (SCM x, SCM p);
|
|
|
|
SCM write_ (SCM x);
|
|
|
|
SCM write_error_ (SCM x);
|
|
|
|
SCM write_port_ (SCM x, SCM p);
|
core: Split-out eval-apply.c.
* src/mes.c (check_formals, check_apply, pairlis, set_car_x, set_cdr_x,
set_env_x, call_lambda, make_closure_, make_variable_, macro_get_handle,
get_macro, macro_set_x, push_cc, add_formals, formal_p,
expand_variable_, expand_variable, apply_builtin, eval_apply, apply):
Move to ..
* src/eval-apply.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make: Likewise.
* src/eval.c (assert_defined): Likewise.
2020-05-17 19:14:08 +01:00
|
|
|
/* src/eval-apply.c */
|
|
|
|
SCM pairlis (SCM x, SCM y, SCM a);
|
|
|
|
SCM set_car_x (SCM x, SCM e);
|
|
|
|
SCM set_cdr_x (SCM x, SCM e);
|
|
|
|
SCM set_env_x (SCM x, SCM e, SCM a);
|
|
|
|
SCM add_formals (SCM formals, SCM x);
|
|
|
|
SCM eval_apply ();
|
2020-04-20 17:53:28 +01:00
|
|
|
/* src/gc.c */
|
core: Split-out core.c.
* src/mes.c (assoc_string, car, cdr, list, null_p, eq_p, values, acons,
length__, length, error, append2, append_reverse, reverse_x_, assq,
assoc): Move to ...
* src/core.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make (MES_SOURCES): Likewise.
* build-aux/snarf.sh: Likewise.
* include/mes/builtins.h: Update.
* src/builtins.c (mes_builtins): Update.
2020-07-19 07:49:23 +01:00
|
|
|
SCM cons (SCM x, SCM y);
|
core: Remove struct definitions for builtins, drop snarfing.
After making a change to the list of builtin functions, run
cat src/*.i
and move the into
src/mes.c:mes_builtins ()
and, or also after changing the list of fixed symbols in src/mes.c:mes_symbols (), do
cat src/*.h > src/builtins.h
* build-aux/build.sh.in: Remove snarfing.
* build-aux/bootstrap.sh.in: Likewise.
* mes/module/mes/display.mes (display):
* mes/module/mes/type-0.mes (cell:type-alist): Remove <cell:function>.
(function?, builtin?): Remove.
* src/builtins.h: New file.
* src/mes.c (TFUNCTION): Remove.
(struct function): Remove.
(apply_builtin): Rewrite from call.
(mes_builtins): Rewrite.
(init_builtin, make_builtin_type, make_builtin, builtin_name,
builtin_arity, builtin, builtin_p, builtin_printer): New function.
2019-01-04 08:55:16 +00:00
|
|
|
SCM gc_check ();
|
|
|
|
SCM gc ();
|
2020-04-20 17:53:28 +01:00
|
|
|
/* src/hash.c */
|
core: Remove struct definitions for builtins, drop snarfing.
After making a change to the list of builtin functions, run
cat src/*.i
and move the into
src/mes.c:mes_builtins ()
and, or also after changing the list of fixed symbols in src/mes.c:mes_symbols (), do
cat src/*.h > src/builtins.h
* build-aux/build.sh.in: Remove snarfing.
* build-aux/bootstrap.sh.in: Likewise.
* mes/module/mes/display.mes (display):
* mes/module/mes/type-0.mes (cell:type-alist): Remove <cell:function>.
(function?, builtin?): Remove.
* src/builtins.h: New file.
* src/mes.c (TFUNCTION): Remove.
(struct function): Remove.
(apply_builtin): Rewrite from call.
(mes_builtins): Rewrite.
(init_builtin, make_builtin_type, make_builtin, builtin_name,
builtin_arity, builtin, builtin_p, builtin_printer): New function.
2019-01-04 08:55:16 +00:00
|
|
|
SCM hashq (SCM x, SCM size);
|
|
|
|
SCM hash (SCM x, SCM size);
|
|
|
|
SCM hashq_get_handle (SCM table, SCM key, SCM dflt);
|
|
|
|
SCM hashq_ref (SCM table, SCM key, SCM dflt);
|
|
|
|
SCM hash_ref (SCM table, SCM key, SCM dflt);
|
|
|
|
SCM hashq_set_x (SCM table, SCM key, SCM value);
|
|
|
|
SCM hash_set_x (SCM table, SCM key, SCM value);
|
|
|
|
SCM hash_table_printer (SCM table);
|
|
|
|
SCM make_hash_table (SCM x);
|
2020-04-20 17:53:28 +01:00
|
|
|
/* src/lib.c */
|
core: Split-out core.c.
* src/mes.c (assoc_string, car, cdr, list, null_p, eq_p, values, acons,
length__, length, error, append2, append_reverse, reverse_x_, assq,
assoc): Move to ...
* src/core.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make (MES_SOURCES): Likewise.
* build-aux/snarf.sh: Likewise.
* include/mes/builtins.h: Update.
* src/builtins.c (mes_builtins): Update.
2020-07-19 07:49:23 +01:00
|
|
|
SCM type_ (SCM x);
|
|
|
|
SCM car_ (SCM x);
|
|
|
|
SCM cdr_ (SCM x);
|
core: Remove struct definitions for builtins, drop snarfing.
After making a change to the list of builtin functions, run
cat src/*.i
and move the into
src/mes.c:mes_builtins ()
and, or also after changing the list of fixed symbols in src/mes.c:mes_symbols (), do
cat src/*.h > src/builtins.h
* build-aux/build.sh.in: Remove snarfing.
* build-aux/bootstrap.sh.in: Likewise.
* mes/module/mes/display.mes (display):
* mes/module/mes/type-0.mes (cell:type-alist): Remove <cell:function>.
(function?, builtin?): Remove.
* src/builtins.h: New file.
* src/mes.c (TFUNCTION): Remove.
(struct function): Remove.
(apply_builtin): Rewrite from call.
(mes_builtins): Rewrite.
(init_builtin, make_builtin_type, make_builtin, builtin_name,
builtin_arity, builtin, builtin_p, builtin_printer): New function.
2019-01-04 08:55:16 +00:00
|
|
|
SCM xassq (SCM x, SCM a);
|
|
|
|
SCM memq (SCM x, SCM a);
|
|
|
|
SCM equal2_p (SCM a, SCM b);
|
|
|
|
SCM last_pair (SCM x);
|
|
|
|
SCM pair_p (SCM x);
|
2020-05-17 23:40:50 +01:00
|
|
|
SCM char_to_integer (SCM x);
|
|
|
|
SCM integer_to_char (SCM x);
|
core: Split-out core.c.
* src/mes.c (assoc_string, car, cdr, list, null_p, eq_p, values, acons,
length__, length, error, append2, append_reverse, reverse_x_, assq,
assoc): Move to ...
* src/core.c: New file.
* build-aux/configure-lib.sh (mes_SOURCES): Add it.
* simple.make (MES_SOURCES): Likewise.
* build-aux/snarf.sh: Likewise.
* include/mes/builtins.h: Update.
* src/builtins.c (mes_builtins): Update.
2020-07-19 07:49:23 +01:00
|
|
|
/* src/math.c */
|
core: Remove struct definitions for builtins, drop snarfing.
After making a change to the list of builtin functions, run
cat src/*.i
and move the into
src/mes.c:mes_builtins ()
and, or also after changing the list of fixed symbols in src/mes.c:mes_symbols (), do
cat src/*.h > src/builtins.h
* build-aux/build.sh.in: Remove snarfing.
* build-aux/bootstrap.sh.in: Likewise.
* mes/module/mes/display.mes (display):
* mes/module/mes/type-0.mes (cell:type-alist): Remove <cell:function>.
(function?, builtin?): Remove.
* src/builtins.h: New file.
* src/mes.c (TFUNCTION): Remove.
(struct function): Remove.
(apply_builtin): Rewrite from call.
(mes_builtins): Rewrite.
(init_builtin, make_builtin_type, make_builtin, builtin_name,
builtin_arity, builtin, builtin_p, builtin_printer): New function.
2019-01-04 08:55:16 +00:00
|
|
|
SCM greater_p (SCM x);
|
|
|
|
SCM less_p (SCM x);
|
|
|
|
SCM is_p (SCM x);
|
|
|
|
SCM minus (SCM x);
|
|
|
|
SCM plus (SCM x);
|
|
|
|
SCM divide (SCM x);
|
|
|
|
SCM modulo (SCM a, SCM b);
|
|
|
|
SCM multiply (SCM x);
|
|
|
|
SCM logand (SCM x);
|
|
|
|
SCM logior (SCM x);
|
|
|
|
SCM lognot (SCM x);
|
|
|
|
SCM logxor (SCM x);
|
|
|
|
SCM ash (SCM n, SCM count);
|
2020-04-20 17:53:28 +01:00
|
|
|
/* src/module.c */
|
core: Remove struct definitions for builtins, drop snarfing.
After making a change to the list of builtin functions, run
cat src/*.i
and move the into
src/mes.c:mes_builtins ()
and, or also after changing the list of fixed symbols in src/mes.c:mes_symbols (), do
cat src/*.h > src/builtins.h
* build-aux/build.sh.in: Remove snarfing.
* build-aux/bootstrap.sh.in: Likewise.
* mes/module/mes/display.mes (display):
* mes/module/mes/type-0.mes (cell:type-alist): Remove <cell:function>.
(function?, builtin?): Remove.
* src/builtins.h: New file.
* src/mes.c (TFUNCTION): Remove.
(struct function): Remove.
(apply_builtin): Rewrite from call.
(mes_builtins): Rewrite.
(init_builtin, make_builtin_type, make_builtin, builtin_name,
builtin_arity, builtin, builtin_p, builtin_printer): New function.
2019-01-04 08:55:16 +00:00
|
|
|
SCM make_module_type ();
|
|
|
|
SCM module_printer (SCM module);
|
|
|
|
SCM module_variable (SCM module, SCM name);
|
|
|
|
SCM module_ref (SCM module, SCM name);
|
|
|
|
SCM module_define_x (SCM module, SCM name, SCM value);
|
2020-04-20 17:53:28 +01:00
|
|
|
/* src/posix.c */
|
2020-07-19 07:53:46 +01:00
|
|
|
SCM exit_ (SCM x);
|
core: Remove struct definitions for builtins, drop snarfing.
After making a change to the list of builtin functions, run
cat src/*.i
and move the into
src/mes.c:mes_builtins ()
and, or also after changing the list of fixed symbols in src/mes.c:mes_symbols (), do
cat src/*.h > src/builtins.h
* build-aux/build.sh.in: Remove snarfing.
* build-aux/bootstrap.sh.in: Likewise.
* mes/module/mes/display.mes (display):
* mes/module/mes/type-0.mes (cell:type-alist): Remove <cell:function>.
(function?, builtin?): Remove.
* src/builtins.h: New file.
* src/mes.c (TFUNCTION): Remove.
(struct function): Remove.
(apply_builtin): Rewrite from call.
(mes_builtins): Rewrite.
(init_builtin, make_builtin_type, make_builtin, builtin_name,
builtin_arity, builtin, builtin_p, builtin_printer): New function.
2019-01-04 08:55:16 +00:00
|
|
|
SCM peek_byte ();
|
|
|
|
SCM read_byte ();
|
|
|
|
SCM unread_byte (SCM i);
|
|
|
|
SCM peek_char ();
|
|
|
|
SCM read_char (SCM port);
|
|
|
|
SCM unread_char (SCM i);
|
|
|
|
SCM write_char (SCM i);
|
|
|
|
SCM write_byte (SCM x);
|
|
|
|
SCM getenv_ (SCM s);
|
|
|
|
SCM setenv_ (SCM s, SCM v);
|
|
|
|
SCM access_p (SCM file_name, SCM mode);
|
|
|
|
SCM current_input_port ();
|
|
|
|
SCM open_input_file (SCM file_name);
|
|
|
|
SCM open_input_string (SCM string);
|
|
|
|
SCM set_current_input_port (SCM port);
|
|
|
|
SCM current_output_port ();
|
|
|
|
SCM current_error_port ();
|
|
|
|
SCM open_output_file (SCM x);
|
|
|
|
SCM set_current_output_port (SCM port);
|
|
|
|
SCM set_current_error_port (SCM port);
|
|
|
|
SCM chmod_ (SCM file_name, SCM mode);
|
|
|
|
SCM isatty_p (SCM port);
|
|
|
|
SCM primitive_fork ();
|
|
|
|
SCM execl_ (SCM file_name, SCM args);
|
|
|
|
SCM waitpid_ (SCM pid, SCM options);
|
|
|
|
SCM current_time ();
|
|
|
|
SCM gettimeofday_ ();
|
|
|
|
SCM get_internal_run_time ();
|
|
|
|
SCM getcwd_ ();
|
|
|
|
SCM dup_ (SCM port);
|
|
|
|
SCM dup2_ (SCM old, SCM new);
|
|
|
|
SCM delete_file (SCM file_name);
|
2020-04-20 17:53:28 +01:00
|
|
|
/* src/reader.c */
|
core: Remove struct definitions for builtins, drop snarfing.
After making a change to the list of builtin functions, run
cat src/*.i
and move the into
src/mes.c:mes_builtins ()
and, or also after changing the list of fixed symbols in src/mes.c:mes_symbols (), do
cat src/*.h > src/builtins.h
* build-aux/build.sh.in: Remove snarfing.
* build-aux/bootstrap.sh.in: Likewise.
* mes/module/mes/display.mes (display):
* mes/module/mes/type-0.mes (cell:type-alist): Remove <cell:function>.
(function?, builtin?): Remove.
* src/builtins.h: New file.
* src/mes.c (TFUNCTION): Remove.
(struct function): Remove.
(apply_builtin): Rewrite from call.
(mes_builtins): Rewrite.
(init_builtin, make_builtin_type, make_builtin, builtin_name,
builtin_arity, builtin, builtin_p, builtin_printer): New function.
2019-01-04 08:55:16 +00:00
|
|
|
SCM read_input_file_env_ (SCM e, SCM a);
|
|
|
|
SCM read_input_file_env (SCM a);
|
|
|
|
SCM read_env (SCM a);
|
|
|
|
SCM reader_read_sexp (SCM c, SCM s, SCM a);
|
|
|
|
SCM reader_read_character ();
|
|
|
|
SCM reader_read_binary ();
|
|
|
|
SCM reader_read_octal ();
|
|
|
|
SCM reader_read_hex ();
|
|
|
|
SCM reader_read_string ();
|
2020-07-19 07:53:46 +01:00
|
|
|
/* src/stack.c */
|
|
|
|
SCM frame_printer (SCM frame);
|
|
|
|
SCM make_stack (SCM stack);
|
|
|
|
SCM stack_length (SCM stack);
|
|
|
|
SCM stack_ref (SCM stack, SCM index);
|
2020-04-20 17:53:28 +01:00
|
|
|
/* src/string.c */
|
core: Remove struct definitions for builtins, drop snarfing.
After making a change to the list of builtin functions, run
cat src/*.i
and move the into
src/mes.c:mes_builtins ()
and, or also after changing the list of fixed symbols in src/mes.c:mes_symbols (), do
cat src/*.h > src/builtins.h
* build-aux/build.sh.in: Remove snarfing.
* build-aux/bootstrap.sh.in: Likewise.
* mes/module/mes/display.mes (display):
* mes/module/mes/type-0.mes (cell:type-alist): Remove <cell:function>.
(function?, builtin?): Remove.
* src/builtins.h: New file.
* src/mes.c (TFUNCTION): Remove.
(struct function): Remove.
(apply_builtin): Rewrite from call.
(mes_builtins): Rewrite.
(init_builtin, make_builtin_type, make_builtin, builtin_name,
builtin_arity, builtin, builtin_p, builtin_printer): New function.
2019-01-04 08:55:16 +00:00
|
|
|
SCM string_equal_p (SCM a, SCM b);
|
|
|
|
SCM symbol_to_string (SCM symbol);
|
|
|
|
SCM symbol_to_keyword (SCM symbol);
|
|
|
|
SCM keyword_to_string (SCM keyword);
|
|
|
|
SCM string_to_symbol (SCM string);
|
|
|
|
SCM make_symbol (SCM string);
|
|
|
|
SCM string_to_list (SCM string);
|
|
|
|
SCM list_to_string (SCM list);
|
|
|
|
SCM read_string (SCM port);
|
|
|
|
SCM string_append (SCM x);
|
|
|
|
SCM string_length (SCM string);
|
|
|
|
SCM string_ref (SCM str, SCM k);
|
2020-04-20 17:53:28 +01:00
|
|
|
/* src/struct.c */
|
core: Remove struct definitions for builtins, drop snarfing.
After making a change to the list of builtin functions, run
cat src/*.i
and move the into
src/mes.c:mes_builtins ()
and, or also after changing the list of fixed symbols in src/mes.c:mes_symbols (), do
cat src/*.h > src/builtins.h
* build-aux/build.sh.in: Remove snarfing.
* build-aux/bootstrap.sh.in: Likewise.
* mes/module/mes/display.mes (display):
* mes/module/mes/type-0.mes (cell:type-alist): Remove <cell:function>.
(function?, builtin?): Remove.
* src/builtins.h: New file.
* src/mes.c (TFUNCTION): Remove.
(struct function): Remove.
(apply_builtin): Rewrite from call.
(mes_builtins): Rewrite.
(init_builtin, make_builtin_type, make_builtin, builtin_name,
builtin_arity, builtin, builtin_p, builtin_printer): New function.
2019-01-04 08:55:16 +00:00
|
|
|
SCM make_struct (SCM type, SCM fields, SCM printer);
|
|
|
|
SCM struct_length (SCM x);
|
|
|
|
SCM struct_ref (SCM x, SCM i);
|
|
|
|
SCM struct_set_x (SCM x, SCM i, SCM e);
|
2020-04-20 17:53:28 +01:00
|
|
|
/* src/vector.c */
|
2020-08-16 15:54:18 +01:00
|
|
|
SCM make_vector (SCM x);
|
core: Remove struct definitions for builtins, drop snarfing.
After making a change to the list of builtin functions, run
cat src/*.i
and move the into
src/mes.c:mes_builtins ()
and, or also after changing the list of fixed symbols in src/mes.c:mes_symbols (), do
cat src/*.h > src/builtins.h
* build-aux/build.sh.in: Remove snarfing.
* build-aux/bootstrap.sh.in: Likewise.
* mes/module/mes/display.mes (display):
* mes/module/mes/type-0.mes (cell:type-alist): Remove <cell:function>.
(function?, builtin?): Remove.
* src/builtins.h: New file.
* src/mes.c (TFUNCTION): Remove.
(struct function): Remove.
(apply_builtin): Rewrite from call.
(mes_builtins): Rewrite.
(init_builtin, make_builtin_type, make_builtin, builtin_name,
builtin_arity, builtin, builtin_p, builtin_printer): New function.
2019-01-04 08:55:16 +00:00
|
|
|
SCM vector_length (SCM x);
|
|
|
|
SCM vector_ref (SCM x, SCM i);
|
|
|
|
SCM vector_entry (SCM x);
|
|
|
|
SCM vector_set_x (SCM x, SCM i, SCM e);
|
|
|
|
SCM list_to_vector (SCM x);
|
|
|
|
SCM vector_to_list (SCM v);
|
2019-06-08 14:36:22 +01:00
|
|
|
|
2020-04-19 12:18:09 +01:00
|
|
|
#endif /* __MES_BUILTINS_H */
|