示例#1
0
文件: sltest.c 项目: parke/slang
   SLang_Array_Type *a;
   char *ro_str;
}
CStruct_Type;

static SLang_CStruct_Field_Type C_Struct [] =
{
   MAKE_CSTRUCT_FIELD(CStruct_Type, i, "i", SLANG_INT_TYPE, 0),
#if SLANG_HAS_FLOAT
   MAKE_CSTRUCT_FIELD(CStruct_Type, d, "d", SLANG_DOUBLE_TYPE, 0),
   MAKE_CSTRUCT_FIELD(CStruct_Type, c, "z", SLANG_COMPLEX_TYPE, 0),
#endif
   MAKE_CSTRUCT_FIELD(CStruct_Type, s, "s", SLANG_STRING_TYPE, 0),
   MAKE_CSTRUCT_FIELD(CStruct_Type, a, "a", SLANG_ARRAY_TYPE, 0),
   MAKE_CSTRUCT_FIELD(CStruct_Type, ro_str, "ro_str", SLANG_STRING_TYPE, 1),
   MAKE_CSTRUCT_INT_FIELD(CStruct_Type, l, "l", 0),
   MAKE_CSTRUCT_INT_FIELD(CStruct_Type, h, "h", 0),
   MAKE_CSTRUCT_INT_FIELD(CStruct_Type, b, "b", 0),
   SLANG_END_CSTRUCT_TABLE
};

static CStruct_Type C_Struct_Buf;
static void check_cstruct (void)
{
   static int first_time = 1;
   if (first_time)
     {
	C_Struct_Buf.ro_str = "read-only";
	first_time = 0;
     }
}
示例#2
0
#endif

#ifdef HAVE_GETRUSAGE
typedef struct
{
   struct rusage r;
   double ru_utimesecs;
   double ru_stimesecs;
}
RUsage_Type;

static SLang_CStruct_Field_Type RUsage_Struct [] =
{
   MAKE_CSTRUCT_FLOAT_FIELD(RUsage_Type, ru_utimesecs, "ru_utimesecs", 0),
   MAKE_CSTRUCT_FLOAT_FIELD(RUsage_Type, ru_stimesecs, "ru_stimesecs", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_maxrss, "ru_maxrss", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_minflt, "ru_minflt", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_majflt, "ru_majflt", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_inblock, "ru_inblock", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_oublock, "ru_oublock", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_nvcsw, "ru_nvcsw", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_nivcsw, "ru_nivcsw", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_ixrss, "ru_ixrss", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_idrss, "ru_idrss", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_isrss, "ru_isrss", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_nswap, "ru_nswap", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_msgsnd, "ru_msgsnd", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_msgrcv, "ru_msgrcv", 0),
   MAKE_CSTRUCT_INT_FIELD(RUsage_Type, r.ru_nsignals, "ru_nsignals", 0),
   SLANG_END_CSTRUCT_TABLE
};