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; }
static int setup_onig (void) { static int inited = 0; if (inited) return 0; if ((-1 == slOnig_Error) && (-1 == (slOnig_Error = SLerr_new_exception (SL_RunTime_Error, "OnigError", "Onig Error")))) return -1; if (-1 == onig_init ()) { SLang_verror (slOnig_Error, "onig_init failed"); return -1; } onig_set_warn_func (&warn_func); onig_set_verb_warn_func (&verb_warn_func); onig_set_default_syntax (ONIG_SYNTAX_PERL); inited = 1; return 0; }
static int init_exceptions (void) { SLCONST BuiltIn_Exception_Table_Type *b; if (Exception_Root != NULL) return 0; Exception_Root = &Exception_Root_Buf; Next_Exception_Code = 1; b = BuiltIn_Exception_Table; while (b->errcode_ptr != NULL) { int err_code; err_code = SLerr_new_exception (*b->base_class_ptr, b->name, b->description); if (err_code == -1) return -1; *b->errcode_ptr = err_code; b++; } return 0; }
static void new_exception (char *name, int *baseclass, char *description) { (void) SLerr_new_exception (*baseclass, name, description); }