Definition in file ghex_heraia_interface.c.
#include <libheraia.h>
Go to the source code of this file.
Functions | |
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'. | |
gchar * | heraia_hex_document_get_filename (Heraia_Document *doc) |
Retrieves the filename of a document which ever it is ! | |
HERAIA_ERROR | heraia_hex_document_save (heraia_window_t *main_window) |
Saves an open and edited document. | |
HERAIA_ERROR | heraia_hex_document_save_as (heraia_window_t *main_window, gchar *filename) |
Saves an opened and edited document to a new file. | |
static void | change_endianness (guint len, guint endianness, guchar *result) |
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. | |
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. | |
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. | |
guint64 | ghex_file_size (GtkHex *gh) |
Returns the file size of an opened GtkHex document. | |
guint64 | ghex_get_cursor_position (data_window_t *data_window) |
Retrieves the cursor's position from the current hexwidget. |
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.
We do assume that 'result' really contains 'len' bytes of data previously gmalloc'ed
len | : len bytes to change endianness | |
endianness | : H_DI_BIG_ENDIAN or H_DI_MIDDLE_ENDIAN we consider that there is nothing to do with H_DI_LITTLE_ENDIAN | |
[in,out] | result | : contains the bytes to be swaped and at the end, contains the result. |
Definition at line 178 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().
guint64 ghex_file_size | ( | GtkHex * | gh | ) |
Returns the file size of an opened GtkHex document.
gh | : an opened GtkHex document |
Definition at line 284 of file ghex_heraia_interface.c.
Referenced by ghex_memcpy(), populate_stats_histos(), and set_spinbutton_max_range().
guint64 ghex_get_cursor_position | ( | data_window_t * | data_window | ) |
Retrieves the cursor's position from the current hexwidget.
data_window | : data interpretor window structure |
Definition at line 302 of file ghex_heraia_interface.c.
References data_window_t::current_hexwidget.
Referenced by refresh_file_labels().
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.
data_window | : data interpretor window structure | |
length | : can be anything but MUST be strictly less than the size allocated to *c | |
endianness | : H_DI_BIG_ENDIAN, H_DI_MIDDLE_ENDIAN or H_DI_LITTLE_ENDIAN | |
c | : a previously g_malloc'ed gchar * string that will contain copied bytes. |
Definition at line 258 of file ghex_heraia_interface.c.
References data_window_t::current_hexwidget, and ghex_memcpy().
Referenced by interpret(), refresh_all_ud_data_interpretor(), and refresh_hex_datas_entry().
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.
gh | : A GtkHex document. | |
pos | : position where we want to begin to copy bytes | |
len | : number of bytes we want to copy | |
endianness | : endianness we want to apply to the bytes we want to copy | |
[out] | result | : a previously g_malloc'ed gchar * string that will contain copied bytes. |
Definition at line 216 of file ghex_heraia_interface.c.
References change_endianness(), and ghex_file_size().
Referenced by ghex_get_data().
gchar * heraia_hex_document_get_filename | ( | Heraia_Document * | doc | ) |
Retrieves the filename of a document which ever it is !
doc | : an existing Heraia_Document |
Definition at line 71 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'.
main_window | : main structure | |
filename | : a char * representing an existing file named "filename" |
Definition at line 38 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, HERAIA_FILE_ERROR, and HERAIA_NOERR.
Referenced by load_file_to_analyse().
HERAIA_ERROR heraia_hex_document_save | ( | heraia_window_t * | main_window | ) |
Saves an open and edited document.
main_window | : main structure, |
Definition at line 83 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.
main_window | : main structure | |
filename | : the new filename where to save the file |
< to make libghex happy !
Definition at line 109 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().