X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Fltt%2Ftype.c;h=1d1481de453653599d2c4fde6fd59f2af66545f3;hb=e55d936e22150fcd3fae5c6c12b330b096a0f9af;hp=d759f325d4a121bba3a78174671bce4bb10d093b;hpb=83e160f2269f77a175b026a4b008a6dd18533d93;p=lttv.git diff --git a/ltt/branches/poly/ltt/type.c b/ltt/branches/poly/ltt/type.c index d759f325..1d1481de 100644 --- a/ltt/branches/poly/ltt/type.c +++ b/ltt/branches/poly/ltt/type.c @@ -33,13 +33,19 @@ static unsigned intSizes[] = { sizeof(int8_t), sizeof(int16_t), sizeof(int32_t), sizeof(int64_t), sizeof(short) }; +static unsigned floatSizes[] = { + 0, 0, sizeof(float), sizeof(double), 0, sizeof(float), sizeof(double) }; + + typedef enum _intSizesNames { SIZE_INT8, SIZE_INT16, SIZE_INT32, SIZE_INT64, SIZE_SHORT, INT_SIZES_NUMBER } intSizesNames; +static char * typeNames[] = { + "int_fixed", "uint_fixed", "pointer", "char", "uchar", "short", "ushort", + "int", "uint", "long", "ulong", "size_t", "ssize_t", "off_t", "float", + "string", "enum", "array", "sequence", "struct", "union", "none" }; -static unsigned floatSizes[] = { - 0, 0, sizeof(float), sizeof(double), 0, sizeof(float), sizeof(double) }; #define FLOAT_SIZES_NUMBER 7 @@ -100,6 +106,20 @@ guint8 ltt_eventtype_id(LttEventType *et) return et->index; } +/***************************************************************************** + *Function name + * ltt_type_name : get the name of the type + *Input params + * t : a type + *Return value + * GQuark : the name of the type + ****************************************************************************/ + +GQuark ltt_type_name(LttType *t) +{ + return g_quark_from_static_string(typeNames[t->type_class]); +} + /***************************************************************************** *Function name * ltt_field_name : get the name of the field @@ -141,9 +161,9 @@ LttTypeEnum ltt_type_class(LttType *t) * returns 0 if erroneous, and show a critical warning message. ****************************************************************************/ -size_t ltt_type_size(LttTrace * trace, LttType *t) +guint ltt_type_size(LttTrace * trace, LttType *t) { - size_t size; + guint size; switch(t->type_class) { case LTT_INT_FIXED: