data_interpretor.c File Reference

Here one may find tools to manage the data_interpretor window. More...

#include <libheraia.h>
Include dependency graph for data_interpretor.c:

Go to the source code of this file.

Functions

static void interpret (doc_t *doc, decode_t *decode_struct, decode_parameters_t *decode_parameters, guint length)
 Here we do interpret a something according to the decode_it function and we write down the result in a widget designated "entry".
static void connect_data_interpretor_signals (heraia_struct_t *main_struct)
 Connects data interpretor window's signals to the right functions.
static void refresh_one_row (doc_t *doc, decode_generic_t *row, guint nb_cols, decode_parameters_t *decode_parameters)
 This function refreshes one row of the tab.
static void refresh_one_tab (doc_t *doc, data_window_t *dw, tab_t *tab, decode_parameters_t *decode_parameters)
 This function refreshes one entire tab (row by row).
static void refresh_all_tabs (doc_t *doc, data_window_t *dw, decode_parameters_t *decode_parameters)
 Refreshes all tabs.
static void add_default_tabs (heraia_struct_t *main_struct)
 Inits data interpretor with default tabs Must be called only once at bootime.
guint which_endianness (heraia_struct_t *main_struct)
 Determines which endianness is selected that is to say which radio button is active in the window.
guint which_stream_size (heraia_struct_t *main_struct)
 returns stream size as selected in the spin button
void refresh_data_interpretor_window (GtkWidget *widget, gpointer data)
 Refreshes the data interpretor window with the new values.
void data_interpretor_init_interface (heraia_struct_t *main_struct)
 Inits the data interpretor structure and window with default values.
tab_tadd_new_tab_in_data_interpretor (GtkNotebook *notebook, guint index, const gchar *label, guint nb_cols,...)
 Adds a new tab in the data interpretor window.
void add_new_row_to_tab (tab_t *tab, decode_generic_t *row)
 Adds a row to a particular tab.
gint di_get_selected_tab (heraia_struct_t *main_struct)
 Gets the selected tab (if any) from data interpretor's notebook.
void di_set_selected_tab (heraia_struct_t *main_struct, gint selected_tab)
 Sets the selected tab (if possible) to data interpretor's notebook.
gint di_get_stream_size (heraia_struct_t *main_struct)
 Gets the stream_size (if any) from data interpretor's window.
void di_set_stream_size (heraia_struct_t *main_struct, gint stream_size)
 Sets the stream size (if possible) to data interpretor's notebook.
gint di_get_endianness (heraia_struct_t *main_struct)
 Gets the endianness as selected in the radio group button.
void di_set_endianness (heraia_struct_t *main_struct, gint endianness)
 Sets the endianness as stated by the second parameter.

Detailed Description

Here one may find tools to manage the data_interpretor window.

Definition in file data_interpretor.c.


Function Documentation

static void add_default_tabs ( heraia_struct_t main_struct  )  [static]

Inits data interpretor with default tabs Must be called only once at bootime.

Parameters:
main_struct : main structure

Adding a tab for numbers

Adding a tab for floting numbers

Adding a tab for date and time

Adding a tab for binary based conversions

Definition at line 450 of file data_interpretor.c.

References add_new_row_to_tab(), add_new_tab_in_data_interpretor(), heraia_struct_t::current_DW, decode_16bits_signed(), decode_16bits_unsigned(), decode_32bits_signed(), decode_32bits_unsigned(), decode_64bits_signed(), decode_64bits_unsigned(), decode_8bits_signed(), decode_8bits_unsigned(), decode_C_date(), decode_dos_date(), decode_double_normal(), decode_double_scientific(), decode_filetime_date(), decode_float_normal(), decode_float_scientific(), decode_HFS_date(), decode_packed_BCD(), decode_to_bits(), heraia_get_widget(), xml_t::main, data_window_t::nb_tabs, new_decode_generic_t(), data_window_t::tabs, and heraia_struct_t::xmls.

Referenced by data_interpretor_init_interface().

Here is the call graph for this function:

Here is the caller graph for this function:

void add_new_row_to_tab ( tab_t tab,
decode_generic_t row 
)

Adds a row to a particular tab.

Parameters:
tab : the tab to which we want to add the row
row : the row we want to add (make sure it has been initialized)

< the vbox to which we want to pack

< couple from which we want to pack the entry

Definition at line 407 of file data_interpretor.c.

References decode_t::entry, tab_t::nb_rows, tab_t::rows, and tab_t::vboxes.

Referenced by add_default_tabs().

Here is the caller graph for this function:

tab_t* add_new_tab_in_data_interpretor ( GtkNotebook *  notebook,
guint  index,
const gchar *  label,
guint  nb_cols,
  ... 
)

Adds a new tab in the data interpretor window.

Parameters:
notebook : the notebook to which we want to add this new tab
index : index of this new tab. If you rely on this make sure it's a primary key !
label : label of the tab
nb_cols : number of columns (including the first column of labels)
... : nb_cols arguments that will be the labels of the columns
Returns:
a newly malloced tab_t variable that remember everything about that new tab.

< tab structure that will remember everything !

< va_list arguments passed to create a new tab with those columns

< used to fetch arguments

< used to remember the columns labels (the arguments in GtkWidgets)

< used to remember vboxes (in order to be able to pack things later

< notebook tab's child container

< used for hpaned creation

< in case that we have more than 2 arguments

< used for vbox creation

< used for label creation in the new vboxes

Definition at line 318 of file data_interpretor.c.

References tab_t::col_labels, tab_t::index, tab_t::label, tab_t::nb_cols, tab_t::nb_rows, tab_t::rows, and tab_t::vboxes.

Referenced by add_default_tabs().

Here is the caller graph for this function:

static void connect_data_interpretor_signals ( heraia_struct_t main_struct  )  [static]

Connects data interpretor window's signals to the right functions.

Parameters:
main_struct : main structure

Definition at line 253 of file data_interpretor.c.

References delete_dt_window_event(), destroy_dt_window(), heraia_get_widget(), xml_t::main, refresh_data_interpretor_window(), and heraia_struct_t::xmls.

Referenced by data_interpretor_init_interface().

Here is the call graph for this function:

Here is the caller graph for this function:

void data_interpretor_init_interface ( heraia_struct_t main_struct  ) 

Inits the data interpretor structure and window with default values.

Warning:
Should be called only once at program's beginning

Definition at line 285 of file data_interpretor.c.

References add_default_tabs(), connect_data_interpretor_signals(), heraia_struct_t::current_DW, data_window_t::diw, heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.

Referenced by load_heraia_ui().

Here is the call graph for this function:

Here is the caller graph for this function:

gint di_get_endianness ( heraia_struct_t main_struct  ) 

Gets the endianness as selected in the radio group button.

Parameters:
main_struct : main structure
Returns:
a gint that represents the endianness (H_DI_LITTLE_ENDIAN, H_DI_MIDDLE_ENDIAN, H_DI_BIG_ENDIAN) or -1 if nothing was correct

Definition at line 615 of file data_interpretor.c.

References gtk_radio_button_get_active_from_widget(), H_DI_BIG_ENDIAN, H_DI_LITTLE_ENDIAN, H_DI_MIDDLE_ENDIAN, heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.

Referenced by save_di_preferences(), and which_endianness().

Here is the call graph for this function:

Here is the caller graph for this function:

gint di_get_selected_tab ( heraia_struct_t main_struct  ) 

Gets the selected tab (if any) from data interpretor's notebook.

Parameters:
main_struct : main structure
Returns:
A gint that represents the selected tab : >=0 if any < 0 otherwise

< data interpretor's notebook

< Selected tab in data interpretor's window

Definition at line 529 of file data_interpretor.c.

References heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.

Referenced by save_di_preferences().

Here is the call graph for this function:

Here is the caller graph for this function:

gint di_get_stream_size ( heraia_struct_t main_struct  ) 

Gets the stream_size (if any) from data interpretor's window.

Parameters:
main_struct : main structure
Returns:
A gint that represents the stream size : >=0 if any < 0 otherwise

< data interpretor's spin button

< stream size sat by the user

Definition at line 572 of file data_interpretor.c.

References heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.

Referenced by save_di_preferences(), and which_stream_size().

Here is the call graph for this function:

Here is the caller graph for this function:

void di_set_endianness ( heraia_struct_t main_struct,
gint  endianness 
)

Sets the endianness as stated by the second parameter.

Parameters:
main_struct : main structure
endianness : the endianness to be sat. Must be one of the following : (H_DI_LITTLE_ENDIAN, H_DI_MIDDLE_ENDIAN, H_DI_BIG_ENDIAN)

Definition at line 665 of file data_interpretor.c.

References gtk_radio_button_set_active(), H_DI_BIG_ENDIAN, H_DI_LITTLE_ENDIAN, H_DI_MIDDLE_ENDIAN, heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.

Referenced by load_di_preferences().

Here is the call graph for this function:

Here is the caller graph for this function:

void di_set_selected_tab ( heraia_struct_t main_struct,
gint  selected_tab 
)

Sets the selected tab (if possible) to data interpretor's notebook.

Parameters:
main_struct : main structure
selected_tab : the saved selected tab

< data interpretor's notebook

Definition at line 550 of file data_interpretor.c.

References heraia_struct_t::current_DW, heraia_get_widget(), xml_t::main, data_window_t::tab_displayed, and heraia_struct_t::xmls.

Referenced by load_di_preferences().

Here is the call graph for this function:

Here is the caller graph for this function:

void di_set_stream_size ( heraia_struct_t main_struct,
gint  stream_size 
)

Sets the stream size (if possible) to data interpretor's notebook.

Parameters:
main_struct : main structure
stream_size : the saved stream_size

< data interpretor's spin button

Definition at line 593 of file data_interpretor.c.

References heraia_get_widget(), xml_t::main, and heraia_struct_t::xmls.

Referenced by load_di_preferences().

Here is the call graph for this function:

Here is the caller graph for this function:

static void interpret ( doc_t doc,
decode_t decode_struct,
decode_parameters_t decode_parameters,
guint  length 
) [static]

Here we do interpret a something according to the decode_it function and we write down the result in a widget designated "entry".

Warning:
We are assuming that main_struct != NULL and main_struct->xml != NULL
Parameters:
main_struct : main structure
decode : a decode_t structure that contains function, entry and error message
decode_parameters : structure that passes some arguments to the decoding functions
length : the length of the data to be decoded (guint)

used to test different results of function calls

the character under the cursor

decoded text

A DecodeFunc which is a function to be called to decode the stream

Definition at line 97 of file data_interpretor.c.

References decode_parameters_t::endianness, decode_t::entry, decode_t::err_msg, decode_t::func, ghex_get_data(), and doc_t::hex_widget.

Referenced by refresh_one_row().

Here is the call graph for this function:

Here is the caller graph for this function:

static void refresh_all_tabs ( doc_t doc,
data_window_t dw,
decode_parameters_t decode_parameters 
) [static]

Refreshes all tabs.

Parameters:
dw : current data window
decode_parameters : structure that passes some arguments to the decoding functions

Definition at line 199 of file data_interpretor.c.

References refresh_one_tab(), and data_window_t::tabs.

Referenced by refresh_data_interpretor_window().

Here is the call graph for this function:

Here is the caller graph for this function:

void refresh_data_interpretor_window ( GtkWidget *  widget,
gpointer  data 
)

Refreshes the data interpretor window with the new values.

Parameters:
widget : the widget caller (may be NULL here)
data : a gpointer to the main structure : main_struct, this must NOT be NULL !
Todo:
if speed is a matter, think about taking off this decode_parameters structure from here.

data interpretor window structure

Endianness is computed only once here

stream size is computed only once here

Definition at line 223 of file data_interpretor.c.

References heraia_struct_t::current_doc, heraia_struct_t::current_DW, window_prop_t::displayed, all_window_prop_t::main_dialog, new_decode_parameters_t(), refresh_all_tabs(), which_endianness(), which_stream_size(), and heraia_struct_t::win_prop.

Referenced by connect_data_interpretor_signals(), on_DIMenu_activate(), and refresh_event_handler().

Here is the call graph for this function:

Here is the caller graph for this function:

static void refresh_one_row ( doc_t doc,
decode_generic_t row,
guint  nb_cols,
decode_parameters_t decode_parameters 
) [static]

This function refreshes one row of the tab.

Parameters:
dw : current data window
row : the row that we want to refresh
nb_cols : number of columns in this particular row (this IS the same for all rows in that tab
decode_parameters : structure that passes some arguments to the decoding functions

< entry, function and message

Definition at line 152 of file data_interpretor.c.

References decode_generic_t::data_size, decode_generic_t::decode_array, decode_generic_t::fixed_size, interpret(), and decode_parameters_t::stream_size.

Referenced by refresh_one_tab().

Here is the call graph for this function:

Here is the caller graph for this function:

static void refresh_one_tab ( doc_t doc,
data_window_t dw,
tab_t tab,
decode_parameters_t decode_parameters 
) [static]

This function refreshes one entire tab (row by row).

Parameters:
dw : current data window
tab : the tab to refresh
decode_parameters : structure that passes some arguments to the decoding functions

< the row we want to refresh

Definition at line 179 of file data_interpretor.c.

References tab_t::nb_cols, refresh_one_row(), and tab_t::rows.

Referenced by refresh_all_tabs().

Here is the call graph for this function:

Here is the caller graph for this function:

guint which_endianness ( heraia_struct_t main_struct  ) 

Determines which endianness is selected that is to say which radio button is active in the window.

Parameters:
main_struct : main structure
Returns:
Something of the following, depending on what selected the user :
  • H_DI_LITTLE_ENDIAN for little endian encoding (default answer)
  • H_DI_BIG_ENDIAN for big endian encoding
  • H_DI_MIDDLE_ENDIAN for middle endian encoding

Definition at line 47 of file data_interpretor.c.

References di_get_endianness(), and H_DI_LITTLE_ENDIAN.

Referenced by fdft_search_direction(), fr_get_search_string(), and refresh_data_interpretor_window().

Here is the call graph for this function:

Here is the caller graph for this function:

guint which_stream_size ( heraia_struct_t main_struct  ) 

returns stream size as selected in the spin button

Parameters:
main_struct : main structure
Returns:
returns the value of the spin button or 1 if this value is not valid

Definition at line 69 of file data_interpretor.c.

References di_get_stream_size().

Referenced by fdft_search_direction(), and refresh_data_interpretor_window().

Here is the call graph for this function:

Here is the caller graph for this function:

Generated on Mon May 2 21:04:55 2011 for Heraia by  doxygen 1.6.3