heraia/trunk/src/ghex_heraia_interface.c File Reference

#include "heraia_types.h"

Include dependency graph for ghex_heraia_interface.c:

Go to the source code of this file.

Functions

HERAIA_ERROR heraia_hex_document_new (heraia_window_t *main_window, char *filename)
gchar * heraia_hex_document_get_filename (Heraia_Document *doc)
HERAIA_ERROR heraia_hex_document_save (heraia_window_t *main_window)
HERAIA_ERROR heraia_hex_document_save_as (heraia_window_t *main_window, gchar *filename)
static void change_endianness (guint len, guint endianness, guchar *result)
gboolean ghex_memcpy (GtkHex *gh, guint pos, guint len, guint endianness, guchar *result)
gboolean ghex_get_data (data_window_t *data_window, guint length, guint endianness, guchar *c)
guint64 ghex_file_size (GtkHex *gh)


Function Documentation

static void change_endianness ( guint  len,
guint  endianness,
guchar *  result 
) [static]

Deals with the endianness of 'len' bytes located in 'result' for BIG_ENDIAN we only swap bytes if we have two or more of them if we have only one byte, we reverse its order if endianness is MIDDLE_ENDIAN we swap only four or more bytes Here we might have funny things with len corresponding to 24 or 56 bits for example Assumption is made that the default order is LITTLE_ENDIAN (which may not be true on some systems !) We fo assume that 'result' really contains 'len' bytes of data previously gmalloc'ed

Definition at line 148 of file ghex_heraia_interface.c.

References H_DI_BIG_ENDIAN, H_DI_MIDDLE_ENDIAN, reverse_byte_order(), and swap_bytes().

Referenced by ghex_memcpy().

Here is the call graph for this function:

guint64 ghex_file_size ( GtkHex *  gh  ) 

Returns the file size of an opened GtkHex document.

Definition at line 236 of file ghex_heraia_interface.c.

Referenced by ghex_memcpy(), populate_stats_histos(), and set_spinbutton_max_range().

gboolean ghex_get_data ( data_window_t data_window,
guint  length,
guint  endianness,
guchar *  c 
)

Gets the data from the hexwidget, a wrapper to the ghex_memcpy function. guchar *c MUST have been pre allocated BEFORE the call. endianness == H_DI_BIG_ENDIAN, H_DI_MIDDLE_ENDIAN or H_DI_LITTLE_ENDIAN length can be anything but MUST be strictly less than the size allocated to *c

Definition at line 214 of file ghex_heraia_interface.c.

References data_window_t::current_hexwidget, and ghex_memcpy().

Referenced by interpret_as_date(), interpret_as_number(), refresh_all_ud_data_interpretor(), and refresh_hex_datas_entry().

Here is the call graph for this function:

gboolean ghex_memcpy ( GtkHex *  gh,
guint  pos,
guint  len,
guint  endianness,
guchar *  result 
)

Returns 'len' number of bytes located at 'pos' in the GtkHex document and puts it in the result variable

We assume that a previous g_malloc has been done in order to use the function. Here we need the "swap_bytes" function defined in the decode.h header in order to take the endianness into account

Definition at line 178 of file ghex_heraia_interface.c.

References change_endianness(), and ghex_file_size().

Referenced by ghex_get_data().

Here is the call graph for this function:

gchar* heraia_hex_document_get_filename ( Heraia_Document doc  ) 

Retrieves the filename of a document which ever it is !

Definition at line 55 of file ghex_heraia_interface.c.

Referenced by on_save_activate().

HERAIA_ERROR heraia_hex_document_new ( heraia_window_t main_window,
char *  filename 
)

Removes the old document if it exists and adds a new one from the filename 'filename'

Definition at line 31 of file ghex_heraia_interface.c.

References connect_cursor_moved_signal(), heraia_window_t::current_doc, heraia_window_t::current_DW, data_window_t::current_hexwidget, and HERAIA_NOERR.

Referenced by load_file_to_analyse().

Here is the call graph for this function:

HERAIA_ERROR heraia_hex_document_save ( heraia_window_t main_window  ) 

Saves an open and edited document

Definition at line 64 of file ghex_heraia_interface.c.

References heraia_window_t::current_doc, HERAIA_FILE_ERROR, and HERAIA_NOERR.

Referenced by on_save_activate().

HERAIA_ERROR heraia_hex_document_save_as ( heraia_window_t main_window,
gchar *  filename 
)

Saves an opened and edited document to a new file

Definition at line 86 of file ghex_heraia_interface.c.

References heraia_window_t::current_doc, heraia_window_t::filename, HERAIA_FILE_ERROR, and HERAIA_NOERR.

Referenced by on_save_as_activate().


Generated on Sun Aug 24 19:27:06 2008 for Heraia by  doxygen 1.5.6