static int register_classes (void) { SLang_Class_Type *cl,*cl2; if (SLssl_Type_Id != -1) return 0; if (NULL == (cl = SLclass_allocate_class ("SLssl_Type"))) return -1; (void) SLclass_set_destroy_function (cl, sl_destroy_ssl); if (-1 == SLclass_register_class (cl, SLANG_VOID_TYPE, sizeof (SLssl_Type), SLANG_CLASS_TYPE_MMT)) return -1; SLssl_Type_Id = SLclass_get_class_id (cl); if (NULL == (cl2 = SLclass_allocate_class ("SLsslctx_Type"))) return -1; (void) SLclass_set_destroy_function (cl2, sl_destroy_sslctx); if (-1 == SLclass_register_class (cl2, SLANG_VOID_TYPE, sizeof (SLsslctx_Type), SLANG_CLASS_TYPE_MMT)) return -1; SLsslctx_Type_Id = SLclass_get_class_id (cl2); return 0; }
static int register_iconv_type (void) { SLang_Class_Type *cl; if (ICONV_Type_Id != 0) return 0; if (NULL == (cl = SLclass_allocate_class ("ICONV_Type"))) return -1; if (-1 == SLclass_set_destroy_function (cl, destroy_iconv)) return -1; /* By registering as SLANG_VOID_TYPE, slang will dynamically allocate a * type. */ if (-1 == SLclass_register_class (cl, SLANG_VOID_TYPE, sizeof (ICONV_Type), SLANG_CLASS_TYPE_MMT)) return -1; ICONV_Type_Id = SLclass_get_class_id (cl); if (-1 == SLclass_patch_intrin_fun_table1 (ICONV_Intrinsics, DUMMY_ICONV_TYPE, ICONV_Type_Id)) return -1; return 0; }
static int register_termios_type (void) { SLang_Class_Type *cl; if (Termios_Type_Id != 0) return 0; if (NULL == (cl = SLclass_allocate_class ("Termios_Type"))) return -1; if (-1 == SLclass_set_destroy_function (cl, destroy_termios)) return -1; if (-1 == SLclass_set_deref_function (cl, termios_dereference)) return -1; /* By registering as SLANG_VOID_TYPE, slang will dynamically allocate a * type. */ if (-1 == SLclass_register_class (cl, SLANG_VOID_TYPE, sizeof (struct termios), SLANG_CLASS_TYPE_MMT)) return -1; Termios_Type_Id = SLclass_get_class_id (cl); if (-1 == SLclass_patch_intrin_fun_table1 (Termios_Intrinsics, DUMMY_TERMIOS_TYPE, Termios_Type_Id)) return -1; return 0; }
static int register_chksum_type (void) { SLang_Class_Type *cl; if (Chksum_Type_Id != 0) return 0; if (NULL == (cl = SLclass_allocate_class ("Chksum_Type"))) return -1; if (-1 == SLclass_set_destroy_function (cl, destroy_chksum_type)) return -1; if (-1 == SLclass_set_push_function (cl, push_chksum_type)) return -1; /* By registering as SLANG_VOID_TYPE, slang will dynamically allocate a * type. */ if (-1 == SLclass_register_class (cl, SLANG_VOID_TYPE, sizeof (Chksum_Object_Type *), SLANG_CLASS_TYPE_PTR)) return -1; Chksum_Type_Id = SLclass_get_class_id (cl); if (-1 == SLclass_patch_intrin_fun_table1 (Intrinsics, DUMMY_CHKSUM_TYPE, Chksum_Type_Id)) return -1; return 0; }
static int add_test_classes (void) { SLang_Class_Type *cl; cl = SLclass_allocate_class ("Test_Type"); if (cl == NULL) return -1; (void) SLclass_set_destroy_function (cl, test_type_destroy); (void) SLclass_set_sget_function (cl, test_type_sget); (void) SLclass_set_sput_function (cl, test_type_sput); (void) SLclass_set_push_function (cl, test_type_push); if (-1 == SLclass_register_class (cl, SLANG_VOID_TYPE, sizeof (Test_Type *), SLANG_CLASS_TYPE_PTR)) return -1; Test_Type_Id = SLclass_get_class_id (cl); return 0; }
static int register_rline_type (void) { SLang_Class_Type *cl; if (Rline_Type_Id != 0) return 0; if (NULL == (cl = SLclass_allocate_class ("RLine_Type"))) return -1; if (-1 == SLclass_set_destroy_function (cl, destroy_rline)) return -1; /* By registering as SLANG_VOID_TYPE, slang will dynamically allocate a * type. */ if (-1 == SLclass_register_class (cl, SLANG_VOID_TYPE, sizeof (SLang_RLine_Info_Type*), SLANG_CLASS_TYPE_MMT)) return -1; Rline_Type_Id = SLclass_get_class_id (cl); return 0; }