Files
sysprof/binparser.h
Soren Sandmann e44c9a0167 Update to new API
2006-08-26  Soren Sandmann <sandmann@daimi.au.dk>

	* elfparser.c: Update to new API

	* binparser.h: Delete commented out declarations. Add new
	functions.

	* binparser.c: Delete ParserFrame, replace with one current
	offset.
	(convert_uint): Make static
	(bin_parser_get_uint): Delete this function
	(bin_parser_get_string): Change this function to use current
	offset instead of frame offset.
	(bin_parser_goto): New function
	(bin_parser_align): New function
	(bin_parser_get_uint32): New function
	(bin_parser_begin): Delete this function
	(bin_parser_end): Delete this function
	(bin_parser_index): Delete this function
	(bin_record_get_string_indirect): Make this function use _goto()
	instead of _begin()/_end()
	(bin_parser_get_offset): Make this function return current offset
2006-08-26 23:01:07 +00:00

49 lines
1.5 KiB
C

#include <glib.h>
typedef struct BinField BinField;
typedef struct BinFormat BinFormat;
typedef struct BinParser BinParser;
typedef struct BinRecord BinRecord;
/* BinParser */
BinParser *bin_parser_new (const guchar *data,
gsize length);
const guchar *bin_parser_get_data (BinParser *parser);
gsize bin_parser_get_length (BinParser *parser);
gsize bin_parser_get_offset (BinParser *parser);
void bin_parser_align (BinParser *parser,
gsize byte_width);
void bin_parser_goto (BinParser *parser,
gsize offset);
const char *bin_parser_get_string (BinParser *parser);
guint32 bin_parser_get_uint32 (BinParser *parser);
/* Record */
BinRecord *bin_parser_get_record (BinParser *parser,
BinFormat *format,
gsize offset);
void bin_record_free (BinRecord *record);
guint64 bin_record_get_uint (BinRecord *record,
const char *name);
void bin_record_index (BinRecord *record,
int index);
gsize bin_record_get_offset (BinRecord *record);
const gchar *bin_record_get_string_indirect (BinRecord *record,
const char *name,
gsize str_table);
BinParser *bin_record_get_parser (BinRecord *record);
/* BinFormat */
BinFormat *bin_format_new (gboolean big_endian,
const char *name, BinField *field,
...);
gsize bin_format_get_size (BinFormat *format);
/* BinField */
BinField *bin_field_new_uint8 (void);
BinField *bin_field_new_uint16 (void);
BinField *bin_field_new_uint32 (void);
BinField *bin_field_new_uint64 (void);
BinField *bin_field_new_fixed_array (int n_elements,
int element_size);