Пример #1
0
}

static SLCONST char *get_import_module_path (void)
{
   char *path;
   if (Module_Path != NULL)
     return Module_Path;
   if (NULL != (path = _pSLsecure_getenv (MODULE_PATH_ENV_NAME)))
     return path;
   return MODULE_INSTALL_DIR;
}

static SLang_Intrin_Fun_Type Module_Intrins [] =
{
   MAKE_INTRINSIC_0("import", import_module_intrin, SLANG_VOID_TYPE),
   MAKE_INTRINSIC_S("set_import_module_path", set_import_module_path, SLANG_VOID_TYPE),
   MAKE_INTRINSIC_0("get_import_module_path", get_import_module_path, SLANG_STRING_TYPE),
   SLANG_END_INTRIN_FUN_TABLE
};

#endif				       /* SLANG_HAS_DYNAMIC_LINKING */

int SLang_set_module_load_path (SLFUTURE_CONST char *path)
{
#if SLANG_HAS_DYNAMIC_LINKING
   if (NULL == (path = SLang_create_slstring (path)))
     return -1;
   SLang_free_slstring ((char *) Module_Path);
   Module_Path = path;
   return 0;
#else
Пример #2
0
}

static int path_is_absolute_path (char *s)
{
   return SLpath_is_absolute_path (s);
}

#if 0
static void set_path_delimiter (int *d)
{
   (void) SLpath_set_delimiter (*d);
}
#endif
static SLang_Intrin_Fun_Type Path_Name_Table [] =
{
   MAKE_INTRINSIC_S("set_slang_load_path", set_load_path, SLANG_VOID_TYPE),
   MAKE_INTRINSIC_0("get_slang_load_path", get_load_path, SLANG_STRING_TYPE),
   MAKE_INTRINSIC_0("path_get_delimiter", get_path_delimiter, SLANG_VOID_TYPE),
   /* MAKE_INTRINSIC_I("path_set_delimiter", set_path_delimiter, SLANG_VOID_TYPE), */
   MAKE_INTRINSIC_SS("path_concat", path_concat, SLANG_VOID_TYPE),
   MAKE_INTRINSIC_S("path_extname", path_extname, SLANG_VOID_TYPE),
   MAKE_INTRINSIC_S("path_dirname", path_dirname, SLANG_VOID_TYPE),
   MAKE_INTRINSIC_S("path_basename", path_basename, SLANG_VOID_TYPE),
   MAKE_INTRINSIC_S("path_basename_sans_extname", path_basename_sans_extname, SLANG_VOID_TYPE),
   MAKE_INTRINSIC_S("path_sans_extname", path_sans_extname, SLANG_VOID_TYPE),
   MAKE_INTRINSIC_S("path_is_absolute", path_is_absolute_path, SLANG_INT_TYPE),
   SLANG_END_INTRIN_FUN_TABLE
};

int SLang_init_ospath (void)
{
Пример #3
0
}
#endif

static void clear_error_intrin (void)
{
   (void) _pSLerr_clear_error (1);
}

static void set_argv_intrinsic (void);
static SLang_Intrin_Fun_Type SLang_Basic_Table [] = /*{{{*/
{
   MAKE_INTRINSIC_0("__is_callable", is_callable_intrinsic, SLANG_INT_TYPE),
   MAKE_INTRINSIC_0("__is_numeric", is_numeric_intrinsic, SLANG_INT_TYPE),
   MAKE_INTRINSIC_0("__is_datatype_numeric", is_datatype_numeric_intrinsic, SLANG_INT_TYPE),
   MAKE_INTRINSIC_1("__is_initialized", _pSLang_is_ref_initialized, SLANG_INT_TYPE, SLANG_REF_TYPE),
   MAKE_INTRINSIC_S("__get_reference", intrin_get_reference, SLANG_VOID_TYPE),
   MAKE_INTRINSIC_1("__uninitialize", uninitialize_ref_intrin, SLANG_VOID_TYPE, SLANG_REF_TYPE),
   MAKE_INTRINSIC_0("__is_same", is_same_intrinsic, SLANG_INT_TYPE),
   MAKE_INTRINSIC_0("__class_type", class_type_intrinsic, SLANG_INT_TYPE),
   MAKE_INTRINSIC_0("__class_id", class_id_intrinsic, SLANG_INT_TYPE),
   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),
Пример #4
0
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),
Пример #5
0
   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("slsmg_get_column", smg_get_column, SLANG_INT_TYPE),
   MAKE_INTRINSIC_0("slsmg_get_row", smg_get_row, SLANG_INT_TYPE),
Пример #6
0
static void set_username_cmd (char *s)
{
   (void) set_username (s);
}
static void set_realname_cmd (char *s)
{
   (void) set_realname (s);
}
static void set_hostname_cmd (char *s)
{
   (void) set_hostname (s);
}

static SLang_Intrin_Fun_Type User_Intrinsics [] =
{
   MAKE_INTRINSIC_S("get_passwd_info", get_passwd_cmd, VOID_TYPE),
   MAKE_INTRINSIC_0("get_username", get_username_cmd, SLANG_STRING_TYPE),
   MAKE_INTRINSIC_0("get_hostname", get_hostname_cmd, SLANG_STRING_TYPE),
   MAKE_INTRINSIC_0("get_realname", get_realname_cmd, SLANG_STRING_TYPE),

   MAKE_INTRINSIC_S("set_username", set_username_cmd, SLANG_VOID_TYPE),
   MAKE_INTRINSIC_S("set_hostname", set_hostname_cmd, SLANG_VOID_TYPE),
   MAKE_INTRINSIC_S("set_realname", set_realname_cmd, SLANG_VOID_TYPE),

   MAKE_INTRINSIC_0(NULL, NULL, 0)
};

int jed_init_userinfo (void)
{
   (void) get_user_info ();
Пример #7
0
   free_history (rli->root);
   rli->tail = rli->root = rli->last = NULL;

   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),
Пример #8
0
   MAKE_INTRINSIC_3("_pghi2d", _pghi2d, V, I, D, I),
   MAKE_INTRINSIC_4("_pghist", _pghist, V, D, D, I, I),
   MAKE_INTRINSIC_0("_pgiden", _pgiden, V),
   MAKE_INTRINSIC_0("_pgimag", _pgimag, V),
   MAKE_INTRINSIC_3("_pglab", _pglab, V, S, S, S),
   MAKE_INTRINSIC_2("_pglcur", _pglcur, V, R, R),

   MAKE_INTRINSIC_0("_pgldev", _pgldev, V),
   /* MAKE_INTRINSIC_0("_pglen", _pglen) */
   MAKE_INTRINSIC_0("_pgline", _pgline, V),
   MAKE_INTRINSIC_2("_pgmove", _pgmove, V, D, D),
   MAKE_INTRINSIC_5("_pgmtxt", _pgmtxt, V, S, D, D, D, S),
   MAKE_INTRINSIC_3("_pgncur", _pgncur, V, R, R, I),
   /* MAKE_INTRINSIC_0("_pgnumb", _pgnumb) */
   MAKE_INTRINSIC_3("_pgolin", _pgolin, V, R, R, I),
   MAKE_INTRINSIC_S("_pgopen", _pgopen, I),
   MAKE_INTRINSIC_0("_pgpage", _pgpage, V),
   MAKE_INTRINSIC_2("_pgpanl", _pgpanl, V, I, I),
   MAKE_INTRINSIC_2("_pgpap", _pgpap, V, D, D),
   /* MAKE_INTRINSIC_0("_pgpixl", _pgpixl), */
   MAKE_INTRINSIC_0("_pgpnts", _pgpnts, V),
   MAKE_INTRINSIC_0("_pgpoly", _pgpoly, V),

   MAKE_INTRINSIC_I("_pgpt", _pgpt, V),
   MAKE_INTRINSIC_5("_pgptxt", _pgptxt, V, D, D, D, D, S),
   MAKE_INTRINSIC_0("_pgqah", _pgqah, V),
   MAKE_INTRINSIC_0("_pgqcf", _pgqcf, I),
   MAKE_INTRINSIC_0("_pgqch", _pgqch, D),
   MAKE_INTRINSIC_0("_pgqci", _pgqci, I),
   MAKE_INTRINSIC_0("_pgqcir", _pgqcir, V),
   MAKE_INTRINSIC_0("_pgqclp", _pgqclp, I),
Пример #9
0
     }

   if (-1 == SLang_push_mmt (mmt))
     SLang_free_mmt (mmt);
}

static void init_readline_intrinsic (char *appname)
{
   (void) init_readline (appname);
}

static SLang_Intrin_Fun_Type Intrinsics [] =
{
   MAKE_INTRINSIC_0("__rline_init_tty", init_tty, VOID_TYPE),
   MAKE_INTRINSIC_0("__rline_reset_tty", reset_tty, VOID_TYPE),
   MAKE_INTRINSIC_S("slsh_readline_init", init_readline_intrinsic, VOID_TYPE),
   MAKE_INTRINSIC_S("slsh_readline_new", new_slrline_intrinsic, VOID_TYPE),
   MAKE_INTRINSIC_S("slsh_readline", readline_intrinsic, VOID_TYPE),
   MAKE_INTRINSIC_S("slsh_readline_noecho", readline_noecho_intrinsic, VOID_TYPE),
   MAKE_INTRINSIC_0("slsh_set_prompt_hook", set_prompt_hook, VOID_TYPE),
   MAKE_INTRINSIC_0("slsh_get_prompt_hook", get_prompt_hook, VOID_TYPE),
   SLANG_END_INTRIN_FUN_TABLE
};

static void destroy_rline (SLtype type, VOID_STAR f)
{
   SLang_RLine_Info_Type *rli;
   (void) type;

   rli = (SLang_RLine_Info_Type *) f;
   if (rli != NULL)