static void check_intrin_long_qualifier (char *name, long *def) { long q; if (-1 == SLang_get_long_qualifier (name, &q, *def)) return; SLang_push_long (q); } #include "assoc.c" #include "list.c" static void fake_import (char *); static SLang_Intrin_Fun_Type Intrinsics [] = { MAKE_INTRINSIC_S("fake_import", fake_import, VOID_TYPE), MAKE_INTRINSIC_I("exit", c_exit, VOID_TYPE), MAKE_INTRINSIC_2("check_intrin_int_qualifier", check_intrin_int_qualifier, VOID_TYPE, SLANG_STRING_TYPE, SLANG_INT_TYPE), MAKE_INTRINSIC_2("check_intrin_long_qualifier", check_intrin_long_qualifier, VOID_TYPE, SLANG_STRING_TYPE, SLANG_LONG_TYPE), MAKE_INTRINSIC_2("check_intrin_double_qualifier", check_intrin_double_qualifier, VOID_TYPE, SLANG_STRING_TYPE, SLANG_DOUBLE_TYPE), MAKE_INTRINSIC_2("check_intrin_string_qualifier", check_intrin_string_qualifier, VOID_TYPE, SLANG_STRING_TYPE, SLANG_STRING_TYPE), MAKE_INTRINSIC_1("test_char_return", test_char_return, SLANG_CHAR_TYPE, SLANG_CHAR_TYPE), MAKE_INTRINSIC_1("test_short_return", test_short_return, SLANG_SHORT_TYPE, SLANG_SHORT_TYPE), MAKE_INTRINSIC_1("test_int_return", test_int_return, SLANG_INT_TYPE, SLANG_INT_TYPE), MAKE_INTRINSIC_1("test_long_return", test_long_return, SLANG_LONG_TYPE, SLANG_LONG_TYPE), /* MAKE_INTRINSIC_1("test_float_return", test_float_return, SLANG_FLOAT_TYPE, SLANG_FLOAT_TYPE), */ #if SLANG_HAS_FLOAT MAKE_INTRINSIC_1("test_double_return", test_double_return, SLANG_DOUBLE_TYPE, SLANG_DOUBLE_TYPE), #endif MAKE_INTRINSIC_0("test_pop_mmt", test_pop_mmt, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("get_c_struct", get_c_struct, VOID_TYPE), MAKE_INTRINSIC_0("set_c_struct", set_c_struct, VOID_TYPE),
MAKE_INTRINSIC_0("getgid", getgid_cmd, SLANG_INT_TYPE), #endif #ifdef HAVE_GETEGID MAKE_INTRINSIC_0("getegid", getegid_cmd, SLANG_INT_TYPE), #endif #ifdef HAVE_GETEUID MAKE_INTRINSIC_0("geteuid", geteuid_cmd, SLANG_INT_TYPE), #endif #ifdef HAVE_GETUID MAKE_INTRINSIC_0("getuid", getuid_cmd, SLANG_INT_TYPE), #endif #ifdef HAVE_GETGID MAKE_INTRINSIC_0("getgid", getgid_cmd, SLANG_INT_TYPE), #endif #ifdef HAVE_SETGID MAKE_INTRINSIC_I("setgid", setgid_cmd, SLANG_INT_TYPE), #endif #ifdef HAVE_GETPGID MAKE_INTRINSIC_I("getpgid", getpgid_cmd, SLANG_INT_TYPE), #endif #ifdef HAVE_SETPGID MAKE_INTRINSIC_II("setpgid", setpgid_cmd, SLANG_INT_TYPE), #endif #ifdef HAVE_GETPGRP MAKE_INTRINSIC_0("getpgrp", getpgrp_cmd, SLANG_INT_TYPE), #endif #ifdef HAVE_SETPGRP /* MAKE_INTRINSIC_0("setpgrp", setpgrp_cmd, SLANG_INT_TYPE), */ #endif #ifdef HAVE_SETUID MAKE_INTRINSIC_I("setuid", setuid_cmd, SLANG_INT_TYPE),
#define V SLANG_VOID_TYPE #define I SLANG_INT_TYPE #define U SLANG_UINT_TYPE #define F SLANG_FLOAT_TYPE #define D SLANG_DOUBLE_TYPE #define S SLANG_STRING_TYPE static SLang_Intrin_Fun_Type Misc_Intrinsics [] = { MAKE_INTRINSIC("print_array", print_array, V, 0), MAKE_INTRINSIC_1("_isis_set_pager", isis_set_pager, V, S), MAKE_INTRINSIC("_isis_get_pager", isis_get_pager, V, 0), MAKE_INTRINSIC_2("_find_file_in_path", find_file_in_path, V, S, S), MAKE_INTRINSIC("_readcol", _readcol, V, 0), MAKE_INTRINSIC_I("_isis_set_errno", set_errno, V), SLANG_END_INTRIN_FUN_TABLE }; static char *Pivs = ISIS_VERSION_STRING; static char *Install_Prefix = INSTALL_PREFIX ; static char *Install_Prefix_Input = INSTALL_PREFIX_INPUT ; static SLang_Intrin_Var_Type Global_Intrin_Vars [] = { MAKE_VARIABLE("_isis_version_string", &Pivs, SLANG_STRING_TYPE, 1), MAKE_VARIABLE("_isis_version", &Isis_Version, SLANG_UINT_TYPE, 1), MAKE_VARIABLE("_isis_srcdir", &Isis_Srcdir, SLANG_STRING_TYPE, 1), MAKE_VARIABLE("_isis_install_prefix", &Install_Prefix, SLANG_STRING_TYPE, 1), MAKE_VARIABLE("_isis_install_prefix_sans_subdir", &Install_Prefix_Input, SLANG_STRING_TYPE, 1), MAKE_VARIABLE("Isis_Batch_Mode", &Isis_Batch_Mode, SLANG_INT_TYPE, 1),
MAKE_INTRINSIC_1("__datatype", datatype_intrinsic, SLANG_VOID_TYPE, SLANG_SLTYPE_INT_TYPE), MAKE_INTRINSIC_0("_eqs", eqs_intrinsic, SLANG_INT_TYPE), MAKE_INTRINSIC_S("get_doc_string_from_file", get_doc_string_intrin, SLANG_VOID_TYPE), MAKE_INTRINSIC_S("add_doc_file", add_doc_file_intrin, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("get_doc_files", get_doc_files_intrin, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("set_doc_files", set_doc_files_intrin, SLANG_VOID_TYPE), MAKE_INTRINSIC_SS("autoload", autoload_intrinsic, SLANG_VOID_TYPE), MAKE_INTRINSIC_S("is_defined", is_defined_intrin, SLANG_INT_TYPE), MAKE_INTRINSIC_0("string", _pSLstring_intrinsic, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("uname", uname_cmd, SLANG_VOID_TYPE), MAKE_INTRINSIC_S("getenv", intrin_getenv_cmd, SLANG_VOID_TYPE), #ifdef HAVE_PUTENV MAKE_INTRINSIC_0("putenv", intrin_putenv, SLANG_VOID_TYPE), #endif MAKE_INTRINSIC_0("evalfile", load_file, SLANG_INT_TYPE), MAKE_INTRINSIC_I("char", char_cmd, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("eval", load_string, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("dup", do_dup, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("integer", intrin_integer, SLANG_VOID_TYPE), MAKE_INTRINSIC_S("system", system_intrinsic, SLANG_INT_TYPE), MAKE_INTRINSIC_S("system_intr", system_intr_intrinsic, SLANG_INT_TYPE), MAKE_INTRINSIC_0("_apropos", intrin_apropos, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("_get_namespaces", intrin_get_namespaces, SLANG_VOID_TYPE), MAKE_INTRINSIC_S("_trace_function", _pSLang_trace_fun, SLANG_VOID_TYPE), #if SLANG_HAS_FLOAT MAKE_INTRINSIC_0("atof", intrin_atof, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("double", intrin_double, SLANG_VOID_TYPE), #endif MAKE_INTRINSIC_0("atoi", atoi_intrin, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("atol", atol_intrin, SLANG_VOID_TYPE), #ifdef HAVE_LONG_LONG
static void use_frame_namespace (int *depth) { _pSLang_use_frame_namespace (*depth); } #endif static SLang_Intrin_Fun_Type Intrin_Funs [] = { MAKE_INTRINSIC_0("_set_bos_handler", set_bos_handler, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("_set_eos_handler", set_eos_handler, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("_set_bof_handler", set_bof_handler, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("_set_eof_handler", set_eof_handler, SLANG_VOID_TYPE), #if SLANG_HAS_DEBUGGER_SUPPORT MAKE_INTRINSIC_0("_set_frame_variable", set_frame_variable, SLANG_VOID_TYPE), MAKE_INTRINSIC_IS("_get_frame_variable", get_frame_variable, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("_get_frame_depth", get_frame_depth, SLANG_INT_TYPE), MAKE_INTRINSIC_I("_get_frame_info", get_frame_info, SLANG_VOID_TYPE), MAKE_INTRINSIC_I("_use_frame_namespace", use_frame_namespace, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("_set_debug_hook", set_debug_hook_intrin, SLANG_VOID_TYPE), #endif SLANG_END_INTRIN_FUN_TABLE }; int _pSLang_init_boseos (void) { return SLadd_intrin_fun_table (Intrin_Funs, NULL); } #endif /* SLANG_HAS_BOSEOS */
static void smg_define_color (int *obj, char *fg, char *bg) { SLtt_set_color (*obj, NULL, fg, bg); } #define I SLANG_INT_TYPE #define S SLANG_STRING_TYPE static SLang_Intrin_Fun_Type Smg_Intrinsics [] = { MAKE_INTRINSIC_0("slsmg_suspend_smg", smg_suspend_smg, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("slsmg_resume_smg", smg_resume_smg, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("slsmg_erase_eol", smg_erase_eol, SLANG_VOID_TYPE), MAKE_INTRINSIC_II("slsmg_gotorc", smg_gotorc, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("slsmg_erase_eos", smg_erase_eos, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("slsmg_reverse_video", smg_reverse_video, SLANG_VOID_TYPE), MAKE_INTRINSIC_I("slsmg_set_color", smg_set_color, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("slsmg_normal_video", smg_normal_video, SLANG_VOID_TYPE), MAKE_INTRINSIC_S("slsmg_write_string", smg_write_string, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("slsmg_cls", smg_cls, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("slsmg_refresh", smg_refresh, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("slsmg_reset_smg", smg_reset_smg, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("slsmg_init_smg", smg_init_smg, SLANG_VOID_TYPE), MAKE_INTRINSIC_SI("slsmg_write_nstring", smg_write_nstring, SLANG_VOID_TYPE), MAKE_INTRINSIC_6("slsmg_write_wrapped_string", smg_write_wrapped_string, SLANG_VOID_TYPE, S,I,I,I,I,I), MAKE_INTRINSIC_0("slsmg_char_at", smg_char_at, SLANG_INT_TYPE), MAKE_INTRINSIC_II("slsmg_set_screen_start", smg_set_screen_start, SLANG_VOID_TYPE), MAKE_INTRINSIC_I("slsmg_draw_hline", smg_draw_hline, SLANG_VOID_TYPE), MAKE_INTRINSIC_I("slsmg_draw_vline", smg_draw_vline, SLANG_VOID_TYPE), MAKE_INTRINSIC_III("slsmg_draw_object", smg_draw_object, SLANG_VOID_TYPE), MAKE_INTRINSIC_4("slsmg_draw_box", smg_draw_box, SLANG_VOID_TYPE,I,I,I,I),
MAKE_INTRINSIC_0("prod", array_prod, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("sum", array_sum, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("sumsq", array_sumsq, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("cumsum", array_cumsum, SLANG_VOID_TYPE), #endif MAKE_INTRINSIC_0("array_swap", array_swap, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("array_reverse", array_reverse, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("min", array_min, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("max", array_max, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("maxabs", array_maxabs, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("minabs", array_minabs, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("any", array_any, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("all", array_all, SLANG_VOID_TYPE), MAKE_INTRINSIC_0("__get_innerprod_block_size", get_innerprod_block_size, SLANG_INT_TYPE), MAKE_INTRINSIC_I("__set_innerprod_block_size", set_innerprod_block_size, SLANG_VOID_TYPE), SLANG_END_INTRIN_FUN_TABLE }; int SLang_init_array (void) { if (-1 == SLadd_intrin_fun_table (Array_Fun_Table, "__SLARRAY__")) return -1; #if SLANG_HAS_FLOAT _pSLang_Matrix_Multiply = do_inner_product; #endif return 0; } int SLang_init_array_extra (void)
data = (char **)at->data; num = at->num_elements; for (i = 0; i < num; i++) { if (-1 == SLrline_add_to_history (rli, data[i])) break; } SLang_free_array (at); } static SLang_Intrin_Fun_Type Intrinsics [] = { MAKE_INTRINSIC_S("rline_call", rline_call_intrinsic, VOID_TYPE), MAKE_INTRINSIC_S("rline_ins", rline_ins_intrinsic, VOID_TYPE), MAKE_INTRINSIC_I("rline_del", rline_del_intrinsic, VOID_TYPE), MAKE_INTRINSIC_0("rline_bolp", rline_bolp_intrinsic, INT_TYPE), MAKE_INTRINSIC_0("rline_eolp", rline_eolp_intrinsic, INT_TYPE), MAKE_INTRINSIC_0("rline_get_point", rline_get_point_intrinsic, INT_TYPE), MAKE_INTRINSIC_I("rline_set_point", rline_set_point_intrinsic, VOID_TYPE), MAKE_INTRINSIC_0("rline_get_edit_width", rline_get_edit_width_intrinsic, INT_TYPE), MAKE_INTRINSIC_0("rline_get_line", rline_get_line_intrinsic, VOID_TYPE), MAKE_INTRINSIC_S("rline_set_line", rline_set_line_intrinsic, VOID_TYPE), MAKE_INTRINSIC_S("rline_setkey", rline_setkey_intrinsic, VOID_TYPE), MAKE_INTRINSIC_S("rline_unsetkey", rline_unsetkey_intrinsic, VOID_TYPE), MAKE_INTRINSIC_0("rline_getkey", rline_getkey_intrinsic, INT_TYPE), MAKE_INTRINSIC_0("rline_set_history", rline_set_history_intrinsic, VOID_TYPE), MAKE_INTRINSIC_0("rline_get_history", rline_get_history_intrinsic, VOID_TYPE), MAKE_INTRINSIC_I("rline_input_pending", rline_input_pending_intrinsic, INT_TYPE), MAKE_INTRINSIC_0("rline_set_completion_callback", rline_set_completion_callback, VOID_TYPE), MAKE_INTRINSIC_0("rline_set_list_completions_callback", rline_set_list_completions_callback, VOID_TYPE),
} /* * Not implemented: * Obsolete: * pgbeg */ #define V SLANG_VOID_TYPE #define I SLANG_INT_TYPE #define S SLANG_STRING_TYPE #define D SLANG_DOUBLE_TYPE #define R SLANG_REF_TYPE static SLang_Intrin_Fun_Type Module_Intrinsics [] = { MAKE_INTRINSIC_4("_pgarro", _pgarro, V, D, D, D, D), MAKE_INTRINSIC_I("_pgask", _pgask, V), MAKE_INTRINSIC_0("_pgaxis", _pgaxis, V), MAKE_INTRINSIC_7("_pgband", _pgband, I, I, I, D, D, R, R, R), MAKE_INTRINSIC_0("_pgbbuf", _pgbbuf, V), MAKE_INTRINSIC_I("_pgbin", _pgbin, V), MAKE_INTRINSIC_6("_pgbox", _pgbox, V, S, D, I, S, D, I), MAKE_INTRINSIC_3("_pgcirc", _pgcirc, V, D, D, D), MAKE_INTRINSIC_0("_pgclos", _pgclos, V), MAKE_INTRINSIC_1("_pgconb", _pgconb, V, D), MAKE_INTRINSIC_3("_pgconl", _pgconl, V, S, I, I), MAKE_INTRINSIC_0("_pgconf", _pgconf, V), MAKE_INTRINSIC_0("_pgcons", _pgcons, V), MAKE_INTRINSIC_1("_pgcont", _pgcont, V, I), /* MAKE_INTRINSIC_0("_pgconx", _pgconx, V), */ MAKE_INTRINSIC_2("_pgctab", _pgctab, V, D, D),