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;
}
Exemple #2
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;
}
Exemple #3
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;
}