kground.c (3102B)
1 /* 2 ** kground.c 3 ** Bindings in the ground environment 4 ** See Copyright Notice in klisp.h 5 */ 6 7 #include <assert.h> 8 #include <stdio.h> 9 #include <stdlib.h> 10 #include <stdbool.h> 11 #include <stdint.h> 12 #include <math.h> 13 14 #include "kstate.h" 15 #include "kobject.h" 16 #include "kground.h" 17 18 #include "kghelpers.h" 19 #include "kgbooleans.h" 20 #include "kgeqp.h" 21 #include "kgequalp.h" 22 #include "kgsymbols.h" 23 #include "kgcontrol.h" 24 #include "kgpairs_lists.h" 25 #include "kgpair_mut.h" 26 #include "kgenvironments.h" 27 #include "kgenv_mut.h" 28 #include "kgcombiners.h" 29 #include "kgcontinuations.h" 30 #include "kgencapsulations.h" 31 #include "kgpromises.h" 32 #include "kgkd_vars.h" 33 #include "kgks_vars.h" 34 #include "kgnumbers.h" 35 #include "kgstrings.h" 36 #include "kgchars.h" 37 #include "kgports.h" 38 #include "kgbytevectors.h" 39 #include "kgvectors.h" 40 #include "kgtables.h" 41 #include "kgsystem.h" 42 #include "kgerrors.h" 43 #include "kgkeywords.h" 44 #include "kglibraries.h" 45 #include "kgthreads.h" 46 47 #if KUSE_LIBFFI 48 # include "kgffi.h" 49 #endif 50 51 /* for initing cont names */ 52 #include "ktable.h" 53 #include "kstring.h" 54 #include "keval.h" 55 #include "krepl.h" 56 57 /* XXX lock? */ 58 /* 59 ** This is called once to save the names of the types of continuations 60 ** used in the ground environment & repl 61 ** TODO the repl should init its own names! 62 */ 63 void kinit_cont_names(klisp_State *K) 64 { 65 /* TEMP repl ones should be done in the interpreter, and not in 66 the init state */ 67 kinit_repl_cont_names(K); 68 69 kinit_eval_cont_names(K); 70 kinit_kghelpers_cont_names(K); 71 72 kinit_booleans_cont_names(K); 73 kinit_combiners_cont_names(K); 74 kinit_environments_cont_names(K); 75 kinit_env_mut_cont_names(K); 76 kinit_pairs_lists_cont_names(K); 77 kinit_continuations_cont_names(K); 78 kinit_control_cont_names(K); 79 kinit_promises_cont_names(K); 80 kinit_ports_cont_names(K); 81 #if KUSE_LIBFFI 82 kinit_ffi_cont_names(K); 83 #endif 84 kinit_error_cont_names(K); 85 kinit_libraries_cont_names(K); 86 } 87 88 /* 89 ** This is called once to bind all symbols in the ground environment 90 */ 91 void kinit_ground_env(klisp_State *K) 92 { 93 /* 94 ** Initialize the combiners/vars for all supported modules 95 */ 96 kinit_booleans_ground_env(K); 97 kinit_eqp_ground_env(K); 98 kinit_equalp_ground_env(K); 99 kinit_symbols_ground_env(K); 100 kinit_control_ground_env(K); 101 kinit_pairs_lists_ground_env(K); 102 kinit_pair_mut_ground_env(K); 103 kinit_environments_ground_env(K); 104 kinit_env_mut_ground_env(K); 105 kinit_combiners_ground_env(K); 106 kinit_continuations_ground_env(K); 107 kinit_encapsulations_ground_env(K); 108 kinit_promises_ground_env(K); 109 kinit_kgkd_vars_ground_env(K); 110 kinit_kgks_vars_ground_env(K); 111 kinit_numbers_ground_env(K); 112 kinit_strings_ground_env(K); 113 kinit_chars_ground_env(K); 114 kinit_ports_ground_env(K); 115 kinit_bytevectors_ground_env(K); 116 kinit_vectors_ground_env(K); 117 kinit_tables_ground_env(K); 118 kinit_system_ground_env(K); 119 kinit_error_ground_env(K); 120 kinit_keywords_ground_env(K); 121 kinit_libraries_ground_env(K); 122 kinit_threads_ground_env(K); 123 #if KUSE_LIBFFI 124 kinit_ffi_ground_env(K); 125 #endif 126 }