Heraia  0.1.8
heraia.c
Go to the documentation of this file.
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /*
3  * heraia.c
4  * heraia - an hexadecimal file editor and analyser based on ghex
5  *
6  * (C) Copyright 2005 - 2018 Olivier Delhomme
7  * e-mail : heraia@delhomme.org
8  * URL : http://heraia.tuxfamily.org
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2, or (at your option)
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23  */
24 /** @file heraia.c
25  * This is the main program file.
26  * Initialization is done here and then hand is passed to gtk's main thread
27  */
28 /**
29  * @author Olivier DELHOMME,
30  * Sébastien TRICAUD,
31  * Grégory AUDET,
32  * Aurélie DERAISME.
33  * @version 0.1.8
34  * @date 2005-2018
35  */
36 
37 
38 #include "heraia_types.h"
39 
40 
41 static gboolean version(void);
42 static gboolean usage(int status);
43 static window_prop_t *init_window_properties(gint x, gint y, guint height, guint width, gboolean displayed);
45 static heraia_struct_t *heraia_init_main_struct(gchar *heraia_path);
47 static GList *init_heraia_location_list(gchar *heraia_path);
48 static gboolean manage_command_line_options(Options *opt, int argc, char **argv);
49 static void print_lirairies_versions(void);
50 
51 /**
52  * libheraia_main_struct is a global variable that points
53  * to the main structure and is intended for the library use ONLY !
54  * It should not be used anywhere else or for any other purpose
55  */
57 
58 
59 /**
60  * This is intended to be called by the library or any program that will use
61  * the library in order to get the pointer to the main structure heraia_struct_t.
62  * @return heraia_struct_t *, a pointer to the main structure
63  */
65 {
66  return libheraia_main_struct;
67 }
68 
69 
70 /**
71  * prints program name, version, author, date and licence
72  * to the standard output
73  */
74 static gboolean version(void)
75 {
76  fprintf (stdout, Q_("heraia written by %s\n %s - Version %s\n License %s\n"), HERAIA_AUTHORS, HERAIA_DATE, HERAIA_VERSION, HERAIA_LICENSE);
77  return TRUE;
78 }
79 
80 
81 /**
82  * Function that informs the user about the command line options
83  * available with heraia
84  * @param status : integer that indicate wether to display help (!=0) or
85  * an error message (0)
86  * @return
87  * - TRUE -> help message has been printed
88  * - FALSE -> error message has been printed
89  */
90 static gboolean usage(int status)
91 {
92  if (status == 0)
93  {
94  fprintf (stderr, Q_("Try `heraia --help' for more information.\n"));
95 
96  return FALSE;
97  }
98  else
99  {
100  version();
101  fprintf(stdout, Q_("\nheraia is a simple hexadecimal file editor and file analyser"));
102  fprintf(stdout, Q_("\nUsage :\n heraia [options] filename(s)\n"));
103  fprintf(stdout, Q_("\nOptions :\n"));
104  fprintf(stdout, Q_(" -h, --help\tThis help.\n"));
105  fprintf(stdout, Q_(" -v, --version\tProgram version information.\n"));
106  fprintf(stdout, Q_(" -t, --tests=TESTS\tRuns some tests.\n"));
107  fprintf(stdout, Q_(" TESTS might be :\n"));
108  fprintf(stdout, Q_(" %d for coverage tests\n"), COVERAGE_TESTS);
109  fprintf(stdout, Q_(" %d for loading files tests\n"), LOADING_TESTS);
110 
111  return TRUE;
112  }
113 }
114 
115 
116 /**
117  * Inits the properties of a window with defined values
118  * @param x,y are x,y coordinates on the screen
119  * @param height represents the height of the window
120  * @param width represents the width of the window. x+height,y+width is
121  * window's right bottom corner
122  * @param displayed says wether the window is displayed or not
123  * @return a new allocated window_prop_t * structure.
124  */
125 static window_prop_t *init_window_properties(gint x, gint y, guint height, guint width, gboolean displayed)
126 {
127  window_prop_t *window_p;
128 
129  /* Malloc the window properties struct */
130  window_p = (window_prop_t *) g_malloc0(sizeof(window_prop_t));
131 
132  /* Sets the default values */
133  window_p->x = x;
134  window_p->y = y;
135  window_p->height = height;
136  window_p->width = width;
137  window_p->displayed = displayed;
138 
139  return window_p;
140 }
141 
142 
143 /**
144  * Inits the window property structure
145  * @param main_struct : main structure
146  * @return main structure with an initiated window property structure
147  */
149 {
150  all_window_prop_t *win_prop = NULL;
151  window_prop_t *about_box = NULL;
152  window_prop_t *data_interpretor = NULL;
153  window_prop_t *log_box = NULL;
154  window_prop_t *main_dialog = NULL;
155  window_prop_t *plugin_list = NULL;
156  window_prop_t *ldt = NULL;
157  window_prop_t *main_pref_window = NULL;
158  window_prop_t *goto_window = NULL;
159  window_prop_t *result_window = NULL;
160  window_prop_t *find_window = NULL;
161  window_prop_t *fr_window = NULL;
162  window_prop_t *fdft_window = NULL;
163 
164  /* Global struct */
165  win_prop = (all_window_prop_t *) g_malloc0(sizeof(all_window_prop_t));
166 
167  /* Initial states for the dialog boxes (default values) */
171  main_dialog = init_window_properties(0, 0, WPT_DEFAULT_HEIGHT, WPT_DEFAULT_WIDTH, TRUE);
172  plugin_list = init_window_properties(0, 0, WPT_DEFAULT_HEIGHT, WPT_DEFAULT_WIDTH, FALSE);
174  main_pref_window = init_window_properties(0, 0, WPT_DEFAULT_HEIGHT, WPT_DEFAULT_WIDTH, FALSE);
175  goto_window = init_window_properties(0, 0, WPT_DEFAULT_HEIGHT, WPT_DEFAULT_WIDTH, FALSE);
176  result_window = init_window_properties(0, 0, WPT_DEFAULT_HEIGHT, WPT_DEFAULT_WIDTH, FALSE);
177  find_window = init_window_properties(0, 0, WPT_DEFAULT_HEIGHT, WPT_DEFAULT_WIDTH, FALSE);
179  fdft_window = init_window_properties(0, 0, WPT_DEFAULT_HEIGHT, WPT_DEFAULT_WIDTH, FALSE);
180 
181  /* Attach to the struct */
182  win_prop->about_box = about_box;
183  win_prop->data_interpretor = data_interpretor;
184  win_prop->log_box = log_box;
185  win_prop->main_dialog = main_dialog;
186  win_prop->plugin_list = plugin_list;
187  win_prop->ldt = ldt;
188  win_prop->main_pref_window = main_pref_window;
189  win_prop->goto_window = goto_window;
190  win_prop->result_window = result_window;
191  win_prop->find_window = find_window;
192  win_prop->fr_window = fr_window;
193  win_prop->fdft_window = fdft_window;
194 
195  /* attach it to the main struct so that it can be read everywhere */
196  main_struct->win_prop = win_prop;
197 
198  return main_struct;
199 }
200 
201 
202 /**
203  * Initialize the main structure (main_struct)
204  * @param heraia_path is the path used to invoke heraia : '/usr/bin/heraia'
205  * invocation would lead to '/usr/bin'
206  * @return a pointer to a newly initialized main structure
207  */
208 static heraia_struct_t *heraia_init_main_struct(gchar *heraia_path)
209 {
210  heraia_struct_t *main_struct = NULL;
211  xml_t *xmls = NULL;
212 
213  main_struct = (heraia_struct_t *) g_malloc0(sizeof(heraia_struct_t));
214 
215  if (main_struct == NULL)
216  {
217  fprintf(stderr, Q_("Main structure could not be initialiazed !"));
218  fprintf(stderr, Q_("Do you have a memory problem ?\n"));
219  return NULL;
220  }
221 
222  /* preference file name initialisation */
223  main_struct->prefs = init_preference_struct(g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), "heraia", NULL), "main_preferences");
224  verify_preference_file(main_struct->prefs);
225 
226  /**
227  * First, in this early stage of the development we want to toggle debugging
228  * mode ON which is enabled by default in the configure.ac file !
229  */
230  main_struct->debug = ENABLE_DEBUG;
231 
232  main_struct->current_doc = NULL;
233  main_struct->plugins_list = NULL;
234  main_struct->location_list = init_heraia_location_list(heraia_path); /* location list initilization */
235 
236  /* xml_t structure initialisation */
237  xmls = (xml_t *) g_malloc0(sizeof(xml_t));
238  xmls->main = NULL;
239  main_struct->xmls = xmls;
240 
241  /* data interpretor structure initialization */
242  main_struct->current_DW = (data_window_t *) g_malloc0 (sizeof(data_window_t));
243  main_struct->current_DW->diw = NULL;
244  main_struct->current_DW->tab_displayed = 0; /* the first tab */
245 
246  /* init window property structure */
247  main_struct = init_window_property_struct(main_struct);
248 
249  /* documents */
250  main_struct->documents = g_ptr_array_new();
251 
252  /* find and replace stuff */
253  main_struct->find_doc = NULL;
254  main_struct->fr_find_doc = NULL;
255  main_struct->fr_replace_doc = NULL;
256  main_struct->results = g_ptr_array_new();
257  main_struct->fdft = NULL;
258 
259  /* init global variable for the library */
260  libheraia_main_struct = main_struct;
261 
262  return main_struct;
263 }
264 
265 
266 /**
267  * Function that initializes the plugin system if any :
268  * - loads any plugin where expected to be found
269  * - inits the plugin window
270  * @param main_struct : main structure (heraia_struct_t *)
271  * @return HERAIA_NO_PLUGINS if no plugins where found or HERAIA_NOERR in
272  * case of no errors
273  */
275 {
276 
277  /* Checking for plugins */
278  if (plugin_capable() == TRUE)
279  {
280  log_message(main_struct, G_LOG_LEVEL_INFO, Q_("Enabling plugins"));
281  load_plugins(main_struct);
282 
283  /* the plugin_list_window (here the plugins may be loaded !) */
284  log_message(main_struct, G_LOG_LEVEL_DEBUG, Q_("Inits the plugin list window"));
286 
287  return HERAIA_NOERR;
288  }
289  else
290  {
291  log_message(main_struct, G_LOG_LEVEL_WARNING, Q_("Plugins will be disabled"));
292  return HERAIA_NO_PLUGINS;
293  }
294 }
295 
296 
297 /**
298  * Here we want to init the location list where we might look for
299  * in the future. These can be viewed as default paths
300  * @warning when adding new locations, keep in ming that the list is a
301  prepended list in reverse order.
302  * @return a new allocatde GList containing all locations
303  */
304 static GList *init_heraia_location_list(gchar *heraia_path)
305 {
306  gchar *path = NULL;
307  gchar *abs_path = NULL; /* absolute path */
308  const gchar* const *system_dirs;
309  guint i = 0;
310  GList *location_list = NULL;
311 
312  /* Heraia's binary path */
313  path = g_get_current_dir();
314  location_list = g_list_prepend(location_list, path);
315 
316  /* System data dirs */
317  system_dirs = g_get_system_data_dirs();
318  i = 0;
319  while(system_dirs[i] != NULL)
320  {
321  path = g_build_path(G_DIR_SEPARATOR_S, system_dirs[i], "heraia", NULL);
322  location_list = g_list_prepend(location_list, path);
323  i++;
324  }
325 
326  /* System config dirs */
327  system_dirs = g_get_system_config_dirs();
328  i = 0;
329  while(system_dirs[i] != NULL)
330  {
331  path = g_build_path(G_DIR_SEPARATOR_S, system_dirs[i], "heraia", NULL);
332  location_list = g_list_prepend(location_list, path);
333  i++;
334  }
335 
336  /* The user path */
337  path = g_build_path(G_DIR_SEPARATOR_S, g_get_home_dir(), "heraia", NULL);
338  location_list = g_list_prepend(location_list, path);
339 
340  /* A global user data path */
341  path = g_build_path(G_DIR_SEPARATOR_S, g_get_user_data_dir(), "heraia", NULL);
342  location_list = g_list_prepend(location_list, path);
343 
344  /* A global config data path */
345  path = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), "heraia", NULL);
346  location_list = g_list_prepend(location_list, path);
347 
348  /* An absolute path (from where is executed heraia itself) */
349  path = g_build_path(G_DIR_SEPARATOR_S, heraia_path, "..", "share", "heraia", NULL);
350  location_list = g_list_prepend(location_list, path);
351 
352  /* the first location of the program in the path */
353  abs_path = g_find_program_in_path("heraia");
354  if (abs_path != NULL)
355  {
356  path = g_build_path(G_DIR_SEPARATOR_S, g_path_get_dirname(abs_path), "..", "share", "heraia", NULL);
357  location_list = g_list_prepend(location_list, path);
358  g_free(abs_path);
359  }
360 
361  return location_list;
362 }
363 
364 
365 /**
366  * Inits internationalisation (don't know wether it works or not!)
367  */
369 {
370  gchar *result = NULL;
371  gchar *codeset = NULL;
372  gchar *text_domain = NULL;
373 
374  /* gtk_set_locale(); */
375  result = bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
376  codeset = bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
377  text_domain = textdomain(GETTEXT_PACKAGE);
378 
379  if (ENABLE_DEBUG == TRUE)
380  {
381  fprintf(stdout, Q_("Gettext package : %s\n"), GETTEXT_PACKAGE);
382  fprintf(stdout, Q_("Locale dir : %s\n"), LOCALEDIR);
383  fprintf(stdout, Q_("Bindtextdomain : %s\n"), result);
384  fprintf(stdout, Q_("Code set : %s\n"), codeset);
385  fprintf(stdout, Q_("Text domain : %s\n"), text_domain);
386  }
387 }
388 
389 
390 /**
391  * Does some self tests for code coverage in heraia
392  *
393  * This function does some calls to functions that are not called
394  * on a normal test procedure
395  *
396  * @param main_struct : main structure (heraia_struct_t *)
397  * @return gboolean as an exit value for the program
398  */
399 static gboolean do_heraia_coverage_tests(heraia_struct_t *main_struct)
400 {
401  heraia_struct_t *tmp_struct;
402  gboolean exit_value = FALSE;
403 
404  exit_value = version();
405  exit_value = usage(0);
406  exit_value = usage(1);
407 
408  tmp_struct = get_main_struct();
409  if (tmp_struct != main_struct)
410  {
411  fprintf(stderr, Q_("WARNING : tmp_struct is not equal to main_struct!\n"));
412  }
413 
414  exit_value = test_decode_functions();
415  if (exit_value != TRUE)
416  {
417  fprintf(stderr, Q_("WARNING : Error while testing decode functions\n"));
418  }
419 
420  return TRUE;
421 }
422 
423 
424 /**
425  * Does some loading tests in heraia
426  * @param main_struct : main structure (heraia_struct_t *)
427  * @return gboolean as an exit value for the program
428  */
429 static gboolean do_heraia_loading_tests(heraia_struct_t *main_struct)
430 {
431  return TRUE;
432 }
433 
434 
435 /**
436  * Manages all the command line options and populates the
437  * Options *opt structure accordingly
438  * @param opt (Options *opt) filled here with the parameters found in **argv
439  * @param argc : number of command line arguments
440  * @param argv : array of string (char *) that contains arguments
441  * @return gboolean that seems to always be TRUE
442  */
443 static gboolean manage_command_line_options(Options *opt, int argc, char **argv)
444 {
445  int exit_value = TRUE;
446  int c = 0;
447  gchar *filename = NULL;
448  int tests = 0;
449 
450  while ((c = getopt_long(argc, argv, "vht", long_options, NULL)) != -1)
451  {
452  switch (c)
453  {
454  case 0: /* long options handler */
455  break;
456 
457  case 'v':
458  exit_value = version();
459  opt->usage = TRUE; /* We do not want to continue after */
460  break;
461 
462  case 'h':
463  exit_value = usage(1);
464  opt->usage = TRUE;
465  break;
466 
467  case 't':
468  if (optarg)
469  {
470  if (sscanf(optarg, "%d", &tests) < 1)
471  {
472  /* Tests done by default */
473  opt->tests = COVERAGE_TESTS;
474  }
475  else
476  {
477  opt->tests = tests;
478  }
479  }
480  else
481  {
482  opt->tests = COVERAGE_TESTS;
483  }
484  exit_value = TRUE;
485  break;
486 
487  default:
488  exit_value = usage(0);
489  opt->usage = TRUE;
490  }
491  }
492 
493  while (optind < argc)
494  {
495  filename = (char *) malloc (sizeof(char) * strlen(argv[optind]) + 1);
496  strcpy(filename, argv[optind]);
497  opt->filenames = g_list_prepend(opt->filenames, filename);
498  optind++;
499  }
500 
501  return exit_value;
502 }
503 
504 
505 /**
506  * Inits the Options struct that contains all
507  * stuff needed to managed command line options
508  * within heraia
509  * @return returns a newly allocated Options structure
510  * initialized to default values
511  */
513 {
514  Options *opt = NULL; /**< Structure to manage prgram's options */
515 
516  opt = (Options *) g_malloc0(sizeof(Options));
517 
518  opt->filenames = NULL; /* At first we do not have any filename */
519  opt->usage = FALSE;
520  opt->tests = NO_TESTS;
521 
522  return opt;
523 }
524 
525 
526 /**
527  * Prints on stdout the librairies versions. To be used for debugging.
528  * Takes no parameters and returns nothing.
529  */
530 static void print_lirairies_versions(void)
531 {
532  fprintf(stdout, Q_("GTK version : %d.%d.%d\n"), GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
533  fprintf(stdout, Q_("GLIB version : %d.%d.%d\n"), glib_major_version, glib_minor_version, glib_micro_version);
534 }
535 
536 
537 /**
538  * main program
539  * options :
540  * - --version
541  * - --help
542  * - --tests
543  */
544 int main(int argc, char **argv)
545 {
546  Options *opt; /**< A structure to manage the command line options */
547  gboolean exit_value = TRUE;
548  heraia_struct_t *main_struct = NULL;
549  GList *list = NULL;
550  gchar *heraia_path = NULL;
551 
552  if (argv != NULL && argv[0] != NULL)
553  {
554  heraia_path = g_path_get_dirname(argv[0]);
555  }
556  else
557  {
558  return -1;
559  }
560 
562 
563  /* init of gtk */
564  exit_value = gtk_init_check(&argc, &argv);
565 
566  opt = init_options_struct();
567 
568  main_struct = heraia_init_main_struct(heraia_path);
569 
571 
572  if (main_struct->debug == TRUE)
573  {
575  fprintf(stdout, Q_("Main struct initialized !\n"));
576  }
577 
578  /* Command line options evaluation */
579  exit_value = manage_command_line_options(opt, argc, argv);
580 
581  if (opt->usage != TRUE)
582  {
583  if (main_struct->debug == TRUE)
584  {
585  fprintf(stderr, Q_("Beginning things\n"));
586  libheraia_test(); /* testing libheraia */
587  }
588 
589 
590 
591  if (load_heraia_ui(main_struct) == TRUE)
592  {
593 
594  log_message(main_struct, G_LOG_LEVEL_INFO, Q_("Main interface loaded"));
595  log_message(main_struct, G_LOG_LEVEL_DEBUG, Q_("Preference file is %s"), main_struct->prefs->filename);
596  log_message(main_struct, G_LOG_LEVEL_DEBUG, Q_("data interpretor's tab is %d"), main_struct->current_DW->tab_displayed);
597 
598  init_heraia_plugin_system(main_struct);
599 
600  if (opt->filenames != NULL)
601  {
602  list = g_list_first(opt->filenames);
603  while (list != NULL)
604  {
605  load_file_to_analyse(main_struct, list->data);
606  list = g_list_next(list);
607  }
608  }
609 
610  log_message(main_struct, G_LOG_LEVEL_DEBUG, Q_("main_struct : %p"), main_struct);
611 
612  init_heraia_interface(main_struct);
613 
614  /* tests or main loop */
615  switch (opt->tests)
616  {
617  case COVERAGE_TESTS:
618  exit_value = do_heraia_coverage_tests(main_struct);
619  break;
620 
621  case LOADING_TESTS:
622  exit_value = do_heraia_loading_tests(main_struct);
623  break;
624 
625  default:
626  /* gtk main loop */
627  gtk_main();
628  exit_value = TRUE;
629  }
630  }
631  else
632  {
633  fprintf(stderr, Q_("File heraia.gtkbuilder not found !\n"));
634  if (main_struct->debug == TRUE)
635  {
636  list = main_struct->location_list;
637  while (list)
638  {
639  /* here heraia_path is used only as a normal gchar* */
640  heraia_path = (gchar *) list->data;
641  fprintf(stdout, "\t%s\n", heraia_path);
642  list = g_list_next(list);
643  }
644  }
645  }
646  }
647 
649 
650  return !exit_value; /* Apparently gtk TRUE and FALSE are inverted compared to bash ! */
651 }
window_prop_t * find_window
find window
Definition: libheraia.h:270
GPtrArray * results
An array of pointers (doc_t *) for each tab in the result window.
Definition: libheraia.h:348
This is the main structure.
Definition: libheraia.h:332
Window properties.
Definition: libheraia.h:243
window_prop_t * data_interpretor
data interpretor window
Definition: libheraia.h:262
doc_t * fr_find_doc
find and replace window, find document and hexwidget
Definition: libheraia.h:345
static void print_lirairies_versions(void)
Prints on stdout the librairies versions.
Definition: heraia.c:530
void init_heraia_interface(heraia_struct_t *main_struct)
Here we might init some call backs and menu options and display the interface (main && sub-windows) This ...
Definition: heraia_ui.c:1650
static gboolean version(void)
prints program name, version, author, date and licence to the standard output
Definition: heraia.c:74
gint x
x position (upper left corner)
Definition: libheraia.h:245
window_prop_t * result_window
result window properties
Definition: libheraia.h:269
gint tab_displayed
keeps the last displayed tab's number before closing
Definition: libheraia.h:209
int main(int argc, char **argv)
main program options :
Definition: heraia.c:544
void plugin_list_window_init_interface(heraia_struct_t *main_struct)
the function to init the plugin_list_window interface
Definition: plugin_list.c:597
prefs_t * init_preference_struct(gchar *pathname, gchar *filename)
Look out if the preference structure exists or not.
Definition: user_prefs.c:130
window_prop_t * fr_window
find and replace window
Definition: libheraia.h:271
void log_message(heraia_struct_t *main_struct, GLogLevelFlags log_level, const char *format,...)
A function that helps logging a message a the specified level.
Definition: log.c:195
#define WPT_DEFAULT_HEIGHT
Defines the default height for a window (set in window_prop_t)
Definition: libheraia.h:233
static gboolean do_heraia_loading_tests(heraia_struct_t *main_struct)
Does some loading tests in heraia.
Definition: heraia.c:429
window_prop_t * main_dialog
heraia's main window
Definition: libheraia.h:264
gboolean displayed
TRUE if displayed, FALSE otherwise.
Definition: libheraia.h:249
gboolean plugin_capable(void)
Says whether the system can handle plugins (or not)
Definition: plugin.c:43
gchar * filename
user preference file file name
Definition: libheraia.h:282
window_prop_t * plugin_list
plugin description window
Definition: libheraia.h:265
gboolean usage
to know if we displayed the usage message
Definition: heraia.h:71
static void init_international_languages(void)
Inits internationalisation (don't know wether it works or not!)
Definition: heraia.c:368
all_window_prop_t * win_prop
Keeps window properties.
Definition: libheraia.h:342
static window_prop_t * init_window_properties(gint x, gint y, guint height, guint width, gboolean displayed)
Inits the properties of a window with defined values.
Definition: heraia.c:125
window_prop_t * main_pref_window
main preference window
Definition: libheraia.h:267
window_prop_t * fdft_window
find data from type window
Definition: libheraia.h:272
#define WPT_DEFAULT_WIDTH
Defines the default width for a window (set in window_prop_t)
Definition: libheraia.h:234
Data interpretor window structure.
Definition: libheraia.h:206
fdft_t * fdft
Keeps comboboxes created for the fdft window.
Definition: libheraia.h:347
#define COVERAGE_TESTS
In order to do some coverage tests.
Definition: heraia.h:58
#define LOADING_TESTS
Definition: heraia.h:59
xml_t * xmls
All the xmls used in the program, loaded at running time.
Definition: libheraia.h:337
#define HERAIA_LICENSE
defines heraia's license (at least GPL v2)
Definition: heraia.h:47
static GList * init_heraia_location_list(gchar *heraia_path)
Here we want to init the location list where we might look for in the future.
Definition: heraia.c:304
static heraia_struct_t * init_window_property_struct(heraia_struct_t *main_struct)
Inits the window property structure.
Definition: heraia.c:148
#define ENABLE_DEBUG
Definition: config.h:5
void load_plugins(heraia_struct_t *main_struct)
looks at the plugins dir(s) and loads the needed plugins (all ;-) (one at a time !!) ...
Definition: plugin.c:258
static struct option const long_options[]
Definition: heraia.h:75
static Options * init_options_struct(void)
Inits the Options struct that contains all stuff needed to managed command line options within heraia...
Definition: heraia.c:512
gboolean debug
Used to tell the program wether we want to display debug messages or not.
Definition: libheraia.h:334
#define H_DI_DISPLAYED
window_prop_t * ldt
list data types window
Definition: libheraia.h:266
int libheraia_test(void)
A simple test function.
Definition: libheraia.c:56
window_prop_t * about_box
Definition: libheraia.h:261
prefs_t * prefs
All datas related to main preferences.
Definition: libheraia.h:343
void libheraia_finalize(void)
Definition: libheraia.c:67
static gboolean do_heraia_coverage_tests(heraia_struct_t *main_struct)
Does some self tests for code coverage in heraia.
Definition: heraia.c:399
gint y
y position (upper left corner)
Definition: libheraia.h:246
void libheraia_initialize(void)
Python specific.
Definition: libheraia.c:62
GtkBuilder * main
the main interface xml description
Definition: libheraia.h:222
Structure to keep window properties for each window.
Definition: libheraia.h:259
#define NO_TESTS
defines that no tests should be done (this is the default behaviour)
Definition: heraia.h:57
static gboolean manage_command_line_options(Options *opt, int argc, char **argv)
Manages all the command line options and populates the Options *opt structure accordingly.
Definition: heraia.c:443
#define HERAIA_NOERR
No error occured, everything is fine.
Definition: heraia_errors.h:47
gint HERAIA_ERROR
Defines heraia error type (this should be used !)
Definition: libheraia.h:78
GList * plugins_list
A list of plugins.
Definition: libheraia.h:340
data_window_t * current_DW
data_interpretor pointer
Definition: libheraia.h:338
window_prop_t * log_box
log window
Definition: libheraia.h:263
static heraia_struct_t * heraia_init_main_struct(gchar *heraia_path)
Initialize the main structure (main_struct)
Definition: heraia.c:208
gboolean test_decode_functions(void)
test decode functions No parameters
Definition: tests.c:66
guint height
y+height (bottom right corner)
Definition: libheraia.h:247
Structure that contains all the xml definitions loaded at running time using GtkBuilder.
Definition: libheraia.h:220
GtkWidget * diw
data interpretor window
Definition: libheraia.h:208
doc_t * current_doc
This is a pointer to the current edited document.
Definition: libheraia.h:335
heraia_struct_t * get_main_struct(void)
This is intended to be called by the library or any program that will use the library in order to get...
Definition: heraia.c:64
window_prop_t * goto_window
goto dialog window
Definition: libheraia.h:268
#define HERAIA_VERSION
defines heraia's current version and release date of this version (00.00.20XX means a development ver...
Definition: heraia.h:48
#define HERAIA_DATE
defines heraia's creation date
Definition: heraia.h:46
doc_t * find_doc
find document and hexwidget for find window
Definition: libheraia.h:344
guint width
x+width (bottom right corner)
Definition: libheraia.h:248
GPtrArray * documents
An array of doc_t in order to be able to open more than one doc.
Definition: libheraia.h:336
static gboolean usage(int status)
Function that informs the user about the command line options available with heraia.
Definition: heraia.c:90
#define HERAIA_NO_PLUGINS
When no plugin are found.
Definition: heraia_errors.h:49
As there seems to be huge differences between the linux and the windows developpement platform such a...
static HERAIA_ERROR init_heraia_plugin_system(heraia_struct_t *main_struct)
Function that initializes the plugin system if any :
Definition: heraia.c:274
void verify_preference_file(prefs_t *prefs)
Verify preference file presence and creates it if it does not already exists.
Definition: user_prefs.c:113
Structure Options gives a way to store program options passed from the command line.
Definition: heraia.h:68
GList * location_list
this is the location list where we store some paths
Definition: libheraia.h:339
gint8 tests
to know if the users wants to do self tests
Definition: heraia.h:72
doc_t * fr_replace_doc
find and replace window, replace document and hexwidget
Definition: libheraia.h:346
static heraia_struct_t * libheraia_main_struct
libheraia_main_struct is a global variable that points to the main structure and is intended for the ...
Definition: heraia.c:56
#define GETTEXT_PACKAGE
Definition: config.h:11
GList * filenames
the filename to open
Definition: heraia.h:70
#define HERAIA_AUTHORS
defines heraia's main authors
Definition: heraia.h:45
gboolean load_file_to_analyse(heraia_struct_t *main_struct, gchar *filename)
Loads the file 'filename' to analyse and populates the corresponfing structure 'main_struct' as neede...
Definition: heraia_io.c:40
int load_heraia_ui(heraia_struct_t *main_struct)
Loads, if possible, the gtkbuilder xml file and then connects the signals and inits the following win...
Definition: heraia_ui.c:1869