libltt compiles
[lttv.git] / ltt / branches / poly / ltt / type.c
index d759f325d4a121bba3a78174671bce4bb10d093b..df1b8ea805d52c4edc90e064d52b9d2f1455c93c 100644 (file)
@@ -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
 
@@ -74,30 +80,30 @@ gchar *ltt_eventtype_description(LttEventType *et)
 
 /*****************************************************************************
  *Function name
- *    ltt_eventtype_facility : get the facility which contains the event type
+ *    ltt_eventtype_id : get the id of the event type
  *Input params
- *    et                     : an  event type   
+ *    et               : an  event type   
  *Return value
- *    LttFacility *          : the facility
+ *    unsigned         : the id
  ****************************************************************************/
 
-LttFacility *ltt_eventtype_facility(LttEventType *et)
+guint8 ltt_eventtype_id(LttEventType *et)
 {
-  return et->facility;
+  return et->index;
 }
 
 /*****************************************************************************
  *Function name
- *    ltt_eventtype_id : get the id of the event type
+ *    ltt_type_name  : get the name of the type
  *Input params
- *    et               : an  event type   
+ *    t              : a type
  *Return value
- *    unsigned         : the id
+ *    GQuark         : the name of the type
  ****************************************************************************/
 
-guint8 ltt_eventtype_id(LttEventType *et)
+GQuark ltt_type_name(LttType *t)
 {
-  return et->index;
+  return g_quark_from_static_string(typeNames[t->type_class]);
 }
 
 /*****************************************************************************
@@ -113,6 +119,7 @@ GQuark ltt_field_name(LttField *f)
 {
   return f->name;
 }
+
 /*****************************************************************************
  *Function name
  *    ltt_type_class : get the type class of the type
@@ -141,9 +148,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:
@@ -231,7 +238,8 @@ unsigned ltt_type_element_number(LttType *t)
   unsigned ret = 0;
 
   if(likely(t->type_class == LTT_ENUM))
-    ret = g_hash_table_size(t->enum_map);
+    // Permits non full enums ret = g_hash_table_size(t->enum_map);
+    ret = (unsigned)(t->highest_value - t->lowest_value);
 
   return ret;
 }
This page took 0.023927 seconds and 4 git commands to generate.