コード例 #1
0
ファイル: slsmg-module.c プロジェクト: GalaxyTab4/workbench
int init_slsmg_module_ns (char *ns_name)
{
   static int inited = 0;

   SLang_NameSpace_Type *ns = SLns_create_namespace (ns_name);
   if (ns == NULL)
     return -1;

   if ((-1 == SLns_add_intrin_fun_table (ns, Smg_Intrinsics, "__SLSMG__"))
       || (-1 == SLns_add_iconstant_table (ns, Smg_Constants, NULL)))
     return -1;

   if ((-1 == SLns_add_intrinsic_variable(ns, "SLsmg_Display_Eight_Bit", (VOID_STAR)&SLsmg_Display_Eight_Bit, SLANG_INT_TYPE, 0))
       || (-1 == SLns_add_intrinsic_variable(ns, "SLsmg_Tab_Width", (VOID_STAR)&SLsmg_Tab_Width, SLANG_INT_TYPE, 0))
       || (-1 == SLns_add_intrinsic_variable(ns, "SLsmg_Newline_Behavior", (VOID_STAR)&SLsmg_Newline_Behavior, SLANG_INT_TYPE, 0))
       || (-1 == SLns_add_intrinsic_variable(ns, "SLsmg_Backspace_Moves", (VOID_STAR)&SLsmg_Backspace_Moves, SLANG_INT_TYPE, 0))
       || (-1 == SLns_add_intrinsic_variable(ns, "SLsmg_Screen_Rows", (VOID_STAR)&SLtt_Screen_Rows, SLANG_INT_TYPE, 0))
       || (-1 == SLns_add_intrinsic_variable(ns, "SLsmg_Screen_Cols", (VOID_STAR)&SLtt_Screen_Cols, SLANG_INT_TYPE, 0)))
     return -1;

   if (inited == 0)
     {
	inited = 1;
	SLtt_get_terminfo ();
     }

   Smg_Initialized = 0;
   return 0;
}
コード例 #2
0
ファイル: socket-module.c プロジェクト: hankem/S-Lang
int init_socket_module_ns (char *ns_name)
{
   SLang_NameSpace_Type *ns;

   if (SocketError == -1)
     {
	if (-1 == (SocketError = SLerr_new_exception (SL_RunTime_Error, "SocketError", "Socket Error")))
	  return -1;
	if (-1 == (SocketHerrnoError = SLerr_new_exception (SocketError, "SocketHError", "Socket h_errno Error")))
	  return -1;
     }
   if (Socket_Type_Id == -1)
     {
	(void) SLfile_create_clientdata_id (&Socket_Type_Id);
     }

   if (NULL == (ns = SLns_create_namespace (ns_name)))
     return -1;

   if ((-1 == SLns_add_intrin_fun_table (ns, Module_Intrinsics, NULL))
       || (-1 == SLns_add_iconstant_table (ns, Module_IConstants, NULL)))
     return -1;

   if (-1 == SLns_add_intrinsic_variable(ns, "h_errno", (VOID_STAR)&Module_H_Errno, SLANG_INT_TYPE, 1))
     return -1;

   return 0;
}
コード例 #3
0
ファイル: math.c プロジェクト: hankem/ISIS
int init_math_module_ns (char *ns_name)
{
   SLang_NameSpace_Type *ns;
   SLang_NameSpace_Type *pub_ns;

   if (NULL == (ns = SLns_create_namespace (ns_name)))
     return isis_trace_return(-1);

   if (NULL == (pub_ns = SLns_create_namespace (Isis_Public_Namespace_Name)))
     return isis_trace_return(-1);

   if (-1 == SLns_add_intrin_fun_table (ns, Math_Intrinsics, NULL))
     return isis_trace_return(-1);

   return 0;
}
コード例 #4
0
ファイル: sltest.c プロジェクト: parke/slang
static void fake_import (char *ns_name)
{
   SLang_NameSpace_Type *ns = SLns_create_namespace (ns_name);
   if (ns == NULL)
     return;

   (void) SLns_add_intrin_fun_table (ns, Intrinsics, NULL);
}
コード例 #5
0
int init_miscio_module_ns (char *ns_name)
{
   SLang_NameSpace_Type *ns;
   SLang_NameSpace_Type *pub_ns;

   if (NULL == (ns = SLns_create_namespace (ns_name)))
     return isis_trace_return(-1);

   if (NULL == (pub_ns = SLns_create_namespace (Isis_Public_Namespace_Name)))
     return isis_trace_return(-1);

   if ((-1 == SLns_add_intrin_fun_table (ns, Misc_Intrinsics, NULL))
       || (-1 == SLns_add_intrin_var_table (pub_ns, Misc_Intrin_Vars, NULL))
       || (-1 == SLadd_intrin_var_table (Global_Intrin_Vars, NULL))
       || (-1 == SLns_add_iconstant_table (ns, Misc_Intrin_Const, NULL)))
     return isis_trace_return(-1);

   return 0;
}
コード例 #6
0
ファイル: fork-module.c プロジェクト: ebichu/dd-wrt
int init_fork_module_ns (char *ns_name)
{
   SLang_NameSpace_Type *ns = SLns_create_namespace (ns_name);
   if (ns == NULL)
     return -1;

   if ((-1 == SLns_add_intrin_fun_table (ns, Module_Intrinsics, NULL))
       || (-1 == SLns_add_iconstant_table (ns, Module_IConstants, NULL)))
     return -1;

   return 0;
}
コード例 #7
0
ファイル: varray-module.c プロジェクト: hankem/S-Lang
int init_varray_module_ns (char *ns_name)
{
   SLang_NameSpace_Type *ns;

   if (NULL == (ns = SLns_create_namespace (ns_name)))
     return -1;

   if (-1 == SLns_add_intrin_fun_table (ns, Module_Intrinsics, NULL))
     return -1;

   return 0;
}
コード例 #8
0
int init_slsmg_module_ns (char *ns_name)
{
   SLang_NameSpace_Type *ns;
   static int inited = 0;

   if (inited == 0)
     {
#if defined(VMS) || defined(REAL_UNIX_SYSTEM)
	int status;
	char *term = getenv ("TERM");

	if (term == NULL)
	  {
	     SLang_verror (SL_Application_Error, "The TERM environment variable is not set");
	     return -1;
	  }
	status = SLtt_initialize (term);
	if (status == -1)
	  {
	     SLang_verror (SL_RunTime_Error, "Cannot deduce properties for '%s' terminal", term);
	     return -1;
	  }
	if (status < 0)
	  {
	     SLang_verror (SL_RunTime_Error, "The terminal '%s' lacks sufficient capabilities for controlling it", term);
	     return -1;
	  }
#else
	SLtt_get_terminfo ();
#endif
	inited = 1;
     }

   ns = SLns_create_namespace (ns_name);
   if (ns == NULL)
     return -1;

   if ((-1 == SLns_add_intrin_fun_table (ns, Smg_Intrinsics, "__SLSMG__"))
       || (-1 == SLns_add_iconstant_table (ns, Smg_Constants, NULL)))
     return -1;

   if ((-1 == SLns_add_intrinsic_variable(ns, "SLsmg_Display_Eight_Bit", (VOID_STAR)&SLsmg_Display_Eight_Bit, SLANG_INT_TYPE, 0))
       || (-1 == SLns_add_intrinsic_variable(ns, "SLsmg_Tab_Width", (VOID_STAR)&SLsmg_Tab_Width, SLANG_INT_TYPE, 0))
       || (-1 == SLns_add_intrinsic_variable(ns, "SLsmg_Newline_Behavior", (VOID_STAR)&SLsmg_Newline_Behavior, SLANG_INT_TYPE, 0))
       || (-1 == SLns_add_intrinsic_variable(ns, "SLsmg_Backspace_Moves", (VOID_STAR)&SLsmg_Backspace_Moves, SLANG_INT_TYPE, 0))
       || (-1 == SLns_add_intrinsic_variable(ns, "SLsmg_Screen_Rows", (VOID_STAR)&SLtt_Screen_Rows, SLANG_INT_TYPE, 0))
       || (-1 == SLns_add_intrinsic_variable(ns, "SLsmg_Screen_Cols", (VOID_STAR)&SLtt_Screen_Cols, SLANG_INT_TYPE, 0)))
     return -1;

   Smg_Initialized = 0;
   return 0;
}
コード例 #9
0
int init_select_module_ns (char *ns_name)
{
   SLang_NameSpace_Type *ns;

   ns = SLns_create_namespace (ns_name);
   if (ns == NULL)
     return -1;

   if (-1 == SLns_add_intrin_fun_table (ns, Select_Intrinsics, "__SELECT__"))
     return -1;

   return 0;
}
コード例 #10
0
int init_fcntl_module_ns (char *ns_name)
{
   SLang_NameSpace_Type *ns;

   ns = SLns_create_namespace (ns_name);
   if (ns == NULL)
     return -1;

   if ((-1 == SLns_add_intrin_fun_table (ns, Fcntl_Intrinsics, "__FCNTL__"))
       || (-1 == SLns_add_iconstant_table (ns, Fcntl_Consts, NULL)))
     return -1;

   return 0;
}
コード例 #11
0
ファイル: pgplot-module.c プロジェクト: hankem/ISIS
int init_pgplot_module_ns (char *ns_name)
{
   SLang_NameSpace_Type *ns;

   if (NULL == (ns = SLns_create_namespace (ns_name)))
     return -1;

   if ((-1 == SLns_add_intrin_fun_table (ns, Module_Intrinsics, "__PGPLOT__"))
       || (-1 == SLns_add_iconstant_table (ns, Module_IConstants, NULL))
       || (-1 == SLns_add_intrin_var_table (ns, Module_Variables, NULL)))
     return -1;

   return setenv_pgplot_dir ();
}
コード例 #12
0
ファイル: iconv-module.c プロジェクト: parke/slang
int init_iconv_module_ns (char *ns_name)
{
   SLang_NameSpace_Type *ns = SLns_create_namespace (ns_name);
   if (ns == NULL)
     return -1;

   if (-1 == register_iconv_type ())
     return -1;

   if (-1 == SLns_add_intrin_fun_table (ns, ICONV_Intrinsics, "__ICONV__"))
     return -1;

   return 0;
}
コード例 #13
0
ファイル: smg-module.c プロジェクト: GalaxyTab4/workbench
int init_smg_module_ns (char *ns_name)
{
   SLang_NameSpace_Type *ns = SLns_create_namespace (ns_name);
   if (ns == NULL)
     return -1;

   if ((-1 == SLns_add_intrin_fun_table (ns, Smg_Intrinsics, "__SMG__"))
       || (-1 == SLns_add_intrin_var_table (ns, Smg_Variables, NULL))
       || (-1 == SLns_add_iconstant_table (ns, Smg_Constants, NULL)))
     return -1;

   SLtt_get_terminfo ();
   Smg_Initialized = 0;
   return 0;
}
コード例 #14
0
int init_chksum_module_ns (char *ns_name)
{
   SLang_NameSpace_Type *ns;

   ns = SLns_create_namespace (ns_name);
   if (ns == NULL)
     return -1;

   if (-1 == register_chksum_type ())
     return -1;

   if (-1 == SLns_add_intrin_fun_table (ns, Intrinsics, NULL))
     return -1;

   return 0;
}
コード例 #15
0
ファイル: onig-module.c プロジェクト: balagopalraj/clearlinux
int init_onig_module_ns (char *ns_name)
{
   SLang_NameSpace_Type *ns = SLns_create_namespace (ns_name);
   if (ns == NULL)
     return -1;

   if (-1 == setup_onig ())
     return -1;
   if (-1 == register_onig_type ())
     return -1;

   if ((-1 == SLns_add_intrin_fun_table (ns, Onig_Intrinsics, "__ONIG__"))
       || (-1 == SLns_add_iconstant_table (ns, Onig_Consts, NULL)))
     return -1;

   return 0;
}
コード例 #16
0
int init_termios_module_ns (char *ns_name)
{
    SLang_NameSpace_Type *ns;

    ns = SLns_create_namespace (ns_name);
    if (ns == NULL)
        return -1;

    if (-1 == register_termios_type ())
        return -1;

    if ((-1 == SLns_add_intrin_fun_table (ns, Termios_Intrinsics, "__TERMIOS__"))
            || (-1 == SLns_add_iconstant_table (ns, Termios_Consts, NULL)))
        return -1;

    return 0;
}
コード例 #17
0
ファイル: crypto-module.c プロジェクト: amitschang/slcrypto
int init_crypto_module_ns (char *ns_name){
  SLang_NameSpace_Type *ns = SLns_create_namespace(ns_name);
  if (ns == NULL)
    return -1;
  
  if (-1 == register_classes ())
    return -1;
  
  if (
      (-1 == SLns_add_intrin_fun_table (ns, Module_Intrinsics, NULL)) ||
      (-1 == SLns_add_iconstant_table (ns, Module_IConstants, NULL))
      )
    return -1;
  
  SSL_library_init();
  OpenSSL_add_all_algorithms();
  
  return 0;
}
コード例 #18
0
ファイル: png-module.c プロジェクト: Distrotech/slang
int init_png_module_ns (char *ns_name)
{
   unsigned short x;

   SLang_NameSpace_Type *ns = SLns_create_namespace (ns_name);
   if (ns == NULL)
     return -1;

   x = 0xFF;
   Is_Little_Endian = (*(unsigned char *)&x == 0xFF);

   if (
       (-1 == SLns_add_intrin_var_table (ns, Module_Variables, NULL))
       || (-1 == SLns_add_intrin_fun_table (ns, Module_Intrinsics, NULL))
       || (-1 == SLns_add_iconstant_table (ns, Module_IConstants, NULL))
       )
     return -1;

   return 0;
}