[genius] Mon Sep 15 13:29:27 2014 Jiri (George) Lebl <jirka 5z com>
- From: George Lebl <jirka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [genius] Mon Sep 15 13:29:27 2014 Jiri (George) Lebl <jirka 5z com>
- Date: Mon, 15 Sep 2014 18:29:41 +0000 (UTC)
commit a6cba4e3cb6c60decf01734569e3433beeb1f1ea
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date: Mon Sep 15 13:29:30 2014 -0500
Mon Sep 15 13:29:27 2014 Jiri (George) Lebl <jirka 5z com>
* src/compil.c: new string decoding routine interacted with a stupid
optimization hence eating string constants from compiled files
starting with 'E'
* src/gnome-genius.c, src/plugin.c: move the examples reading and
plugin reading to happen later so that things display seemingly
quicker. plus some other very minor optimizations for startup
ChangeLog | 10 ++++
NEWS | 1 +
src/compil.c | 22 +++-----
src/gnome-genius.c | 143 +++++++++++++++++++++++++++-------------------------
src/plugin.c | 10 +++-
5 files changed, 103 insertions(+), 83 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 93cb6bc..a6c3cdc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Mon Sep 15 13:29:27 2014 Jiri (George) Lebl <jirka 5z com>
+
+ * src/compil.c: new string decoding routine interacted with a stupid
+ optimization hence eating string constants from compiled files
+ starting with 'E'
+
+ * src/gnome-genius.c, src/plugin.c: move the examples reading and
+ plugin reading to happen later so that things display seemingly
+ quicker. plus some other very minor optimizations for startup
+
Fri Sep 12 11:14:14 2014 Jiri (George) Lebl <jirka 5z com>
* examples/peano.gel: Add peano example in polar
diff --git a/NEWS b/NEWS
index cdbe512..2cedfb0 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Changes to 1.0.19
* New plotting functions: SurfacePlotDrawLine, SurfacePlotDrawPoints,
SurfacePlotClear, PlotWindowPresent
* New rotation animation in the surface plot window
+* Fix string constants from compiled library starting with 'E' (funky bug)
* A few fixes
* During making of these changes the author (Jiri) was partially supported by
diff --git a/src/compil.c b/src/compil.c
index 1bd008d..23d2c92 100644
--- a/src/compil.c
+++ b/src/compil.c
@@ -1,5 +1,5 @@
/* GENIUS Calculator
- * Copyright (C) 1997-2012 Jiri (George) Lebl
+ * Copyright (C) 1997-2014 Jiri (George) Lebl
*
* Author: Jiri (George) Lebl
*
@@ -36,9 +36,8 @@
#include "compil.h"
-/* first char 'A' then rest just ascii */
-/* first char 'B' then rest Base64 */
-/* first char 'E' then empty */
+/* first char '=' then rest Base64 */
+/* else just ascii */
char *
gel_decode_string (const char *s)
{
@@ -351,15 +350,12 @@ gel_decompile_node(char **ptrptr)
if G_UNLIKELY (p == NULL)
return NULL;
- if (*p=='E') {
- n = gel_makenum_string_constant ("");
- } else {
- p = gel_decode_string (p);
- if G_UNLIKELY (p == NULL)
- return NULL;
- n = gel_makenum_string_constant (p);
- g_free (p);
- }
+ p = gel_decode_string (p);
+ if G_UNLIKELY (p == NULL)
+ return NULL;
+ n = gel_makenum_string_constant (p);
+ g_free (p);
+
return n;
case GEL_FUNCTION_NODE:
p = strtok_r (NULL,";", ptrptr);
diff --git a/src/gnome-genius.c b/src/gnome-genius.c
index 1d2e345..7a880e3 100644
--- a/src/gnome-genius.c
+++ b/src/gnome-genius.c
@@ -5171,50 +5171,33 @@ main (int argc, char *argv[])
/* Show the window now before going on with the
* setup */
gtk_widget_show_now (genius_window);
- check_events ();
-
- gel_read_example_list ();
-
- if (gel_example_list != NULL) {
- GSList *li;
- int i;
- GtkWidget *menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (gtk_ui_manager_get_widget
(genius_ui, "/MenuBar/ExamplesMenu")));
-
- for (i = 0, li = gel_example_list;
- li != NULL;
- li = li->next, i++) {
- GtkWidget *item;
- GelExample *exam = li->data;
- char *s;
-
- s = g_strconcat (exam->category, ": ", exam->name, NULL);
- item = gtk_menu_item_new_with_label (s);
- g_free (s);
- g_signal_connect (item, "select",
- G_CALLBACK (simple_menu_item_select_cb),
- exam->name);
- g_signal_connect (item, "deselect",
- G_CALLBACK (simple_menu_item_deselect_cb),
- exam->name);
- gtk_widget_show (item);
- g_signal_connect (G_OBJECT (item), "activate",
- G_CALLBACK (open_example_cb), exam);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- example_count ++;
- }
- }
+ gel_output_printf (gel_main_out,
+ _("%sGenius %s%s\n"
+ "%s\n"
+ "This is free software with ABSOLUTELY NO WARRANTY.\n"
+ "For license details type `%swarranty%s'.\n"
+ "For help type `%smanual%s' or `%shelp%s'.%s\n\n"),
+ "\e[0;32m" /* green */,
+ "\e[0m" /* white on black */,
+ VERSION,
+ _(GENIUS_COPYRIGHT_STRING),
+ "\e[01;36m" /* cyan */,
+ "\e[0m" /* white on black */,
+ "\e[01;36m" /* cyan */,
+ "\e[0m" /* white on black */,
+ "\e[01;36m" /* cyan */,
+ "\e[0m" /* white on black */,
+ get_version_details ());
+ gel_output_flush (gel_main_out);
+ check_events ();
- /* if no exampleials, hide the menu */
- if (example_count == 0) {
- gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu"));
- } else {
- gtk_widget_show (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu"));
- gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu/NoExample"));
- }
+ gel_set_new_calcstate (curstate);
+ gel_set_new_errorout (geniuserror);
+ gel_set_new_infoout (geniusinfo);
+ /* Read plugins */
gel_read_plugin_list ();
-
if (gel_plugin_list != NULL) {
GSList *li;
int i;
@@ -5242,7 +5225,6 @@ main (int argc, char *argv[])
plugin_count ++;
}
}
-
/* if no plugins, hide the menu */
if (plugin_count == 0) {
gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/PluginsMenu"));
@@ -5252,32 +5234,8 @@ main (int argc, char *argv[])
}
- gel_output_printf (gel_main_out,
- _("%sGenius %s%s\n"
- "%s\n"
- "This is free software with ABSOLUTELY NO WARRANTY.\n"
- "For license details type `%swarranty%s'.\n"
- "For help type `%smanual%s' or `%shelp%s'.%s\n\n"),
- "\e[0;32m" /* green */,
- "\e[0m" /* white on black */,
- VERSION,
- _(GENIUS_COPYRIGHT_STRING),
- "\e[01;36m" /* cyan */,
- "\e[0m" /* white on black */,
- "\e[01;36m" /* cyan */,
- "\e[0m" /* white on black */,
- "\e[01;36m" /* cyan */,
- "\e[0m" /* white on black */,
- get_version_details ());
- gel_output_flush (gel_main_out);
- check_events ();
-
- gel_set_new_calcstate (curstate);
- gel_set_new_errorout (geniuserror);
- gel_set_new_infoout (geniusinfo);
-
+ /* Setup the helper */
setup_rl_fifos ();
-
fork_helper_setup_comm ();
/*init the context stack and clear out any stale dictionaries
@@ -5310,9 +5268,10 @@ main (int argc, char *argv[])
* Read init files
*/
file = g_build_filename (g_get_home_dir (), ".geniusinit",NULL);
- if(file)
- gel_load_file(NULL, file, FALSE);
- g_free(file);
+ if (file != NULL) {
+ gel_load_file (NULL, file, FALSE);
+ g_free (file);
+ }
gel_load_file (NULL, "geniusinit.gel", FALSE);
@@ -5341,6 +5300,52 @@ main (int argc, char *argv[])
/* Load all given files */
loadup_files_from_cmdline (argc, argv);
+ /* check events so that we setup the examples menu only
+ * once everything is shown */
+ check_events();
+
+ /* Read examples now */
+ gel_read_example_list ();
+ if (gel_example_list != NULL) {
+ GSList *li;
+ int i;
+ GtkWidget *menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (gtk_ui_manager_get_widget
(genius_ui, "/MenuBar/ExamplesMenu")));
+
+ for (i = 0, li = gel_example_list;
+ li != NULL;
+ li = li->next, i++) {
+ GtkWidget *item;
+ GelExample *exam = li->data;
+ char *s;
+
+ s = g_strconcat (exam->category, ": ", exam->name, NULL);
+ item = gtk_menu_item_new_with_label (s);
+ g_free (s);
+
+ g_signal_connect (item, "select",
+ G_CALLBACK (simple_menu_item_select_cb),
+ exam->name);
+ g_signal_connect (item, "deselect",
+ G_CALLBACK (simple_menu_item_deselect_cb),
+ exam->name);
+ gtk_widget_show (item);
+ g_signal_connect (G_OBJECT (item), "activate",
+ G_CALLBACK (open_example_cb), exam);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ example_count ++;
+ }
+ }
+ /* if no exampleials, hide the menu */
+ if (example_count == 0) {
+ gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu"));
+ } else {
+ gtk_widget_show (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu"));
+ gtk_widget_hide (gtk_ui_manager_get_widget (genius_ui, "/MenuBar/ExamplesMenu/NoExample"));
+ }
+
+ /*
+ * Main loop
+ */
gtk_main ();
/*
diff --git a/src/plugin.c b/src/plugin.c
index d8bf9a0..d803ee2 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -1,5 +1,5 @@
/* GENIUS Calculator
- * Copyright (C) 1997-2002,2006 Jiri (George) Lebl
+ * Copyright (C) 1997-2014 Jiri (George) Lebl
*
* Author: Jiri (George) Lebl
*
@@ -238,6 +238,10 @@ gel_save_plugins (void)
VeConfig *cfg;
char *path;
+ /* no plugins */
+ if (gel_plugin_list == NULL)
+ return;
+
if (genius_is_gui)
path = g_build_filename (g_get_home_dir (),
".gnome2", "genius", NULL);
@@ -287,6 +291,10 @@ gel_restore_plugins (void)
VeConfig *cfg;
char *path;
+ /* no plugins */
+ if (gel_plugin_list == NULL)
+ return;
+
if (genius_is_gui)
path = g_build_filename (g_get_home_dir (),
".gnome2", "genius", NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]