projects
/
lttv.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libltt compiles
[lttv.git]
/
ltt
/
branches
/
poly
/
ltt
/
type.c
diff --git
a/ltt/branches/poly/ltt/type.c
b/ltt/branches/poly/ltt/type.c
index 0961eb141d32b8dd244e0f00738a46c708c69446..df1b8ea805d52c4edc90e064d52b9d2f1455c93c 100644
(file)
--- a/
ltt/branches/poly/ltt/type.c
+++ b/
ltt/branches/poly/ltt/type.c
@@
-1,19
+1,20
@@
/* This file is part of the Linux Trace Toolkit viewer
/* This file is part of the Linux Trace Toolkit viewer
- * Copyright (C) 2003-2004 Xiangxiu Yang, Mathieu Desnoyers
+ * Copyright (C) 2003-2004 Xiangxiu Yang
+ * 2005 Mathieu Desnoyers
*
*
- * This
program is free software; you can redistribute it and/or modify
- *
it under the terms of the GNU General Public License Version 2 as
- *
published by the Free Software Foundation;
+ * This
library is free software; you can redistribute it and/or
+ *
modify it under the terms of the GNU Lesser General Public
+ *
License Version 2.1 as published by the Free Software Foundation.
*
*
- * This
program
is distributed in the hope that it will be useful,
+ * This
library
is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- *
GNU
General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU
+ *
Lesser
General Public License for more details.
*
*
- * You should have received a copy of the GNU
General Public License
- *
along with this program; if not, write to the Free Softwar
e
- * F
oundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA.
+ * You should have received a copy of the GNU
Lesser General Public
+ *
License along with this library; if not, write to th
e
+ * F
ree Software Foundation, Inc., 59 Temple Place - Suite 330,
+ *
Boston,
MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
*/
#ifdef HAVE_CONFIG_H
@@
-32,13
+33,19
@@
static unsigned intSizes[] = {
sizeof(int8_t), sizeof(int16_t), sizeof(int32_t), sizeof(int64_t),
sizeof(short) };
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;
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
#define FLOAT_SIZES_NUMBER 7
@@
-73,30
+80,30
@@
gchar *ltt_eventtype_description(LttEventType *et)
/*****************************************************************************
*Function name
/*****************************************************************************
*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
*Input params
- * et
: an event type
+ * et : an event type
*Return value
*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
}
/*****************************************************************************
*Function name
- * ltt_
eventtype_id : get the id of the event
type
+ * ltt_
type_name : get the name of the
type
*Input params
*Input params
- *
et : an event type
+ *
t : a type
*Return value
*Return value
- *
unsigned : the id
+ *
GQuark : the name of the type
****************************************************************************/
****************************************************************************/
-
guint8 ltt_eventtype_id(LttEventType *e
t)
+
GQuark ltt_type_name(LttType *
t)
{
{
- return
et->index
;
+ return
g_quark_from_static_string(typeNames[t->type_class])
;
}
/*****************************************************************************
}
/*****************************************************************************
@@
-112,6
+119,7
@@
GQuark ltt_field_name(LttField *f)
{
return f->name;
}
{
return f->name;
}
+
/*****************************************************************************
*Function name
* ltt_type_class : get the type class of the type
/*****************************************************************************
*Function name
* ltt_type_class : get the type class of the type
@@
-140,15
+148,19
@@
LttTypeEnum ltt_type_class(LttType *t)
* returns 0 if erroneous, and show a critical warning message.
****************************************************************************/
* returns 0 if erroneous, and show a critical warning message.
****************************************************************************/
-
size_
t ltt_type_size(LttTrace * trace, LttType *t)
+
guin
t ltt_type_size(LttTrace * trace, LttType *t)
{
{
-
size_
t size;
+
guin
t size;
switch(t->type_class) {
switch(t->type_class) {
-
+ case LTT_INT_FIXED:
+ case LTT_UINT_FIXED:
+ case LTT_CHAR:
+ case LTT_UCHAR:
+ case LTT_SHORT:
+ case LTT_USHORT:
case LTT_INT:
case LTT_UINT:
case LTT_INT:
case LTT_UINT:
- case LTT_SEQUENCE:
case LTT_ENUM:
if(likely(t->size < INT_SIZES_NUMBER))
size = intSizes[t->size];
case LTT_ENUM:
if(likely(t->size < INT_SIZES_NUMBER))
size = intSizes[t->size];
@@
-166,11
+178,13
@@
size_t ltt_type_size(LttTrace * trace, LttType *t)
case LTT_ULONG:
case LTT_SIZE_T:
case LTT_SSIZE_T:
case LTT_ULONG:
case LTT_SIZE_T:
case LTT_SSIZE_T:
+ case LTT_SEQUENCE:
case LTT_OFF_T:
case LTT_STRING:
case LTT_ARRAY:
case LTT_STRUCT:
case LTT_UNION:
case LTT_OFF_T:
case LTT_STRING:
case LTT_ARRAY:
case LTT_STRUCT:
case LTT_UNION:
+ case LTT_NONE:
goto error;
break;
}
goto error;
break;
}
@@
-213,23
+227,23
@@
LttType *ltt_type_element_type(LttType *t)
/*****************************************************************************
*Function name
/*****************************************************************************
*Function name
- * ltt_type_element_number : obtain the number of elements for
arrays
+ * ltt_type_element_number : obtain the number of elements for
enums
*Input params
*Input params
- * t : a type
+ * t : a type
*Return value
* unsigned : the number of elements for arrays
****************************************************************************/
*Return value
* unsigned : the number of elements for arrays
****************************************************************************/
-#if 0
unsigned ltt_type_element_number(LttType *t)
{
unsigned ret = 0;
unsigned ltt_type_element_number(LttType *t)
{
unsigned ret = 0;
- if(likely(t->type_class == LTT_ARRAY))
- ret = t->element_number;
+ if(likely(t->type_class == LTT_ENUM))
+ // Permits non full enums ret = g_hash_table_size(t->enum_map);
+ ret = (unsigned)(t->highest_value - t->lowest_value);
return ret;
}
return ret;
}
-#endif //0
+
/*****************************************************************************
*Function name
* ltt_type_member_number : obtain the number of data members for structure
/*****************************************************************************
*Function name
* ltt_type_member_number : obtain the number of data members for structure
@@
-371,7
+385,7
@@
int ltt_field_size(LttField * f)
guint ltt_eventtype_num_fields(LttEventType *event_type)
{
guint ltt_eventtype_num_fields(LttEventType *event_type)
{
- if(unlikely(!event_type)) return
NULL
;
+ if(unlikely(!event_type)) return
0
;
return event_type->fields->len;
return event_type->fields->len;
This page took
0.026063 seconds
and
4
git commands to generate.