Thanks to Karl's work, it is now possible to compile Gnomesword with the much smaller diff below (against branch 2.4.x). Now abbreviations for modules show up correctly everywhere. Also, it is possible to build with editor support, although activating it currently crashes Gnomesword for me. I believe some of the problems with locale and possibly this crash are because because Gnome is not finding it's own locale information. Any ideas on that would be helpful.
I've heard from Ben Morgan that he has successfully compiled on Windows as well, and he has identified an issue with running on Win2k which could possibly be fixed with a compiler define. He has also updated the wiki page http://www.crosswire.org/wiki/index.php/Gnomesword_for_Windows with two or three dependencies I left out, and he has also identified several unnecessary ones (I'm not sure that's made it to the wiki). I also got xml2po and iconv working (I will post instructions later) so the compile finishes without errors (previously it had problems with the help directory). Matthew diff follows: Index: src/backend/module_manager.cc =================================================================== --- src/backend/module_manager.cc (revision 2383) +++ src/backend/module_manager.cc (working copy) @@ -41,6 +41,8 @@ #include <iostream> #include <string> +#include <stdio.h> + #include "module_manager.hh" #include "backend/sword_main.hh" #include "main/mod_mgr.h" Index: src/gnome2/bibletext.c =================================================================== --- src/gnome2/bibletext.c (revision 2383) +++ src/gnome2/bibletext.c (working copy) @@ -33,6 +33,7 @@ #include "gui/html.h" #endif +#include <stdio.h> #include "gui/gnomesword.h" #include "gui/bibletext.h" @@ -740,7 +741,7 @@ #endif /* !USE_GTKMOZEMBED */ if (dict_key && len && *dict_key) { - ReadAloud(0, dict_key); + //ReadAloud(0, dict_key); g_free(dict_key); } else gui_generic_warning("No selection made"); Index: src/gnome2/bibletext_dialog.c =================================================================== --- src/gnome2/bibletext_dialog.c (revision 2383) +++ src/gnome2/bibletext_dialog.c (working copy) @@ -31,6 +31,8 @@ #include "gui/html.h" #endif +#include <stdio.h> + #include "gui/bibletext_dialog.h" #include "gui/display_info.h" #include "gui/font_dialog.h" @@ -1419,7 +1421,7 @@ #endif /* !USE_GTKMOZEMBED */ if (dict_key && len && *dict_key) { - ReadAloud(0, dict_key); + //ReadAloud(0, dict_key); g_free(dict_key); } else gui_generic_warning("No selection made"); Index: src/gnome2/commentary.c =================================================================== --- src/gnome2/commentary.c (revision 2383) +++ src/gnome2/commentary.c (working copy) @@ -406,7 +406,7 @@ #endif /* !USE_GTKMOZEMBED */ if (dict_key && len && *dict_key) { - ReadAloud(0, dict_key); + //ReadAloud(0, dict_key); g_free(dict_key); } else gui_generic_warning("No selection made"); Index: src/gnome2/commentary_dialog.c =================================================================== --- src/gnome2/commentary_dialog.c (revision 2383) +++ src/gnome2/commentary_dialog.c (working copy) @@ -923,7 +923,7 @@ #endif /* !USE_GTKMOZEMBED */ if (dict_key && len && *dict_key) { - ReadAloud(0, dict_key); + //ReadAloud(0, dict_key); g_free(dict_key); } else gui_generic_warning("No selection made"); Index: src/gnome2/gbs.c =================================================================== --- src/gnome2/gbs.c (revision 2383) +++ src/gnome2/gbs.c (working copy) @@ -488,7 +488,7 @@ #endif /* !USE_GTKMOZEMBED */ if (dict_key && len && *dict_key) { - ReadAloud(0, dict_key); + //ReadAloud(0, dict_key); g_free(dict_key); } else gui_generic_warning("No selection made"); Index: src/main/display.cc =================================================================== --- src/main/display.cc (revision 2383) +++ src/main/display.cc (working copy) @@ -37,8 +37,7 @@ #include <ctype.h> #include <assert.h> -#include <sys/socket.h> -#include <netinet/in.h> + #include <errno.h> #ifdef USE_GTKMOZEMBED @@ -1095,202 +1094,7 @@ } } -// -// Read aloud some text, i.e. the current verse. -// Text is cleaned of '"', <tokens>, "&symbols;", and *n/*x strings, -// then scribbled out the local static socket with (SayText "..."). -// Non-zero verse param is prefixed onto supplied text. -// -void ReadAloud(unsigned int verse, const char *suppliedtext) -{ - static int tts_socket = -1; // no initial connection. - static int use_counter = -2; // to shortcircuit early uses. - if (settings.readaloud || // read anything, or - (verse == 0)) { // read what's handed us. - gchar *s, *t; - - // setup for communication. - if (tts_socket < 0) { - struct sockaddr_in service; - - if ((tts_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0) { - char msg[256]; - sprintf(msg, "ReadAloud disabled:\nsocket failed, %s", - strerror(errno)); - settings.readaloud = 0; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM - (widgets.readaloud_item), - settings.readaloud); - gui_generic_warning(msg); - return; - } - - // festival's port (1314) on localhost (127.0.0.1). - memset(&service, 0, sizeof service); - service.sin_family = AF_INET; - service.sin_port = htons(1314); - service.sin_addr.s_addr = htonl(0x7f000001); - if (connect(tts_socket, (const sockaddr *)&service, - sizeof(service)) != 0) { - system("festival --server &"); - sleep(2); // give festival a moment to init. - - if (connect(tts_socket, (const sockaddr *)&service, - sizeof(service)) != 0) { - // it still didn't work -- missing. - char msg[256]; - sprintf(msg, "%s\n%s, %s", - "TTS \"festival\" not started -- perhaps not installed", - "TTS connect failed", strerror(errno)); - close(tts_socket); - tts_socket = -1; - settings.readaloud = 0; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM - (widgets.readaloud_item), - settings.readaloud); - gui_generic_warning(msg); - return; - } - } - } - - // avoid speaking the first *2* times. - // (2 Display() calls are made during startup.) - // though speaking may be intended, startup speech is annoying. - if (verse && (++use_counter < 1)) - return; - - GString *text = g_string_new(NULL); - if (verse != 0) - g_string_printf(text, "%d. ... %s", verse, suppliedtext); - // use of ". ..." is to induce proper pauses. - else - g_string_printf(text, "%s", suppliedtext); - GS_message(("ReadAloud: dirty: %s\n", text->str)); - - // clean: no <span> surrounding strongs/morph. - // i wish there was a regexp form of strstr(). - for (s = strstr(text->str, "<span class=\"strongs\">"); - s; - s = strstr(s, "<span class=\"strongs\">")) { - if (t = strstr(s, "</span>")) { - t += 6; - while (s <= t) - *(s++) = ' '; - } else { - GS_message(("ReadAloud: Unmatched <span strong></span> in %s\n", s)); - goto out; - } - } - for (s = strstr(text->str, "<span class=\"morph\">"); - s; - s = strstr(s, "<span class=\"morph\">")) { - if (t = strstr(s, "</span>")) { - t += 6; - while (s <= t) - *(s++) = ' '; - } else { - GS_message(("ReadAloud: Unmatched <span morph></span> in %s\n", s)); - goto out; - } - } - - // clean: no quotes (conflict w/festival syntax). - for (s = strchr(text->str, '"'); s; s = strchr(s, '"')) - *s = ' '; - - // clean: no <tokens>. - for (s = strchr(text->str, '<'); s; s = strchr(s, '<')) { - if (t = strchr(s, '>')) { - while (s <= t) - *(s++) = ' '; - } else { - GS_message(("ReadAloud: Unmatched <> in %s\n", s)); - goto out; - } - } - - // clean: no <...> sequences. (Strong's ref, "<1234>".) - for (s = strstr(text->str, "<"); s; s = strstr(s, "<")) { - if (t = strstr(s, ">")) { - t += 3; - while (s <= t) - *(s++) = ' '; - } else { - GS_message(("ReadAloud: Unmatched <> in %s\n", s)); - goto out; - } - } - - // clean: no other &symbols;. - for (s = strchr(text->str, '&'); s; s = strchr(s, '&')) { - if (t = strchr(s, ';')) { - while (s <= t) - *(s++) = ' '; - } else { - GS_message(("ReadAloud: Incomplete &xxx; in %s\n", s)); - goto out; - } - } - - // clean: no note/xref strings. - for (s = strstr(text->str, "*n"); s; s = strstr(s, "*n")) { - *(s++) = ' '; - *(s++) = ' '; - } - for (s = strstr(text->str, "*x"); s; s = strstr(s, "*x")) { - *(s++) = ' '; - *(s++) = ' '; - } - - // festival *pronounces* brackets and asterisks -- idiots. - for (s = strchr(text->str, '['); s; s = strchr(s, '[')) - *s = ' '; - for (s = strchr(text->str, ']'); s; s = strchr(s, ']')) - *s = ' '; - for (s = strchr(text->str, '*'); s; s = strchr(s, '*')) - *s = ' '; - // in case it isn't obvious, i'd really like a standard - // function that walks a string for multiple individual chars. - GS_message(("ReadAloud: clean: %s\n", text->str)); - - // scribble clean text to the socket. - if ((write(tts_socket, "(SayText \"", 10) < 0) || - (write(tts_socket, text->str, strlen(text->str)) < 0) || - (write(tts_socket, "\")\r\n", 4) < 0)) - { - char msg[256]; - sprintf(msg, "TTS disappeared?\nTTS write failed: %s", - strerror(errno)); - shutdown(tts_socket, SHUT_RDWR); - close(tts_socket); - tts_socket = -1; - settings.readaloud = 0; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM - (widgets.readaloud_item), - settings.readaloud); - gui_generic_warning(msg); - } - - out: - g_string_free(text, TRUE); - return; - - } else { - - // Reading aloud is disabled. - // If we had been reading, shut it down. - if (tts_socket >= 0) { - shutdown(tts_socket, SHUT_RDWR); - close(tts_socket); - tts_socket = -1; - } - use_counter++; - return; - } -} - char GTKChapDisp::Display(SWModule &imodule) { VerseKey *key = (VerseKey *)(SWKey *)imodule; @@ -1476,7 +1280,7 @@ if (key->Verse() == curVerse) { swbuf.append("</font>"); - ReadAloud(curVerse, cVerse.GetText()); + //ReadAloud(curVerse, cVerse.GetText()); } if (settings.versestyle) { @@ -1949,7 +1753,7 @@ if (key->Verse() == curVerse) { swbuf.append("</font>"); - ReadAloud(curVerse, cVerse.GetText()); + //ReadAloud(curVerse, cVerse.GetText()); } if (versestyle) { Index: src/main/sword.cc =================================================================== --- src/main/sword.cc (revision 2383) +++ src/main/sword.cc (working copy) @@ -52,7 +52,7 @@ #include <time.h> #include <dirent.h> -#include <sys/mman.h> +//#include <sys/mman.h> #include "gui/main_window.h" #include "gui/font_dialog.h" Index: src/main/url.cc =================================================================== --- src/main/url.cc (revision 2383) +++ src/main/url.cc (working copy) @@ -25,7 +25,7 @@ #include <sys/types.h> #include <sys/stat.h> -#include <sys/wait.h> +//#include <sys/wait.h> #include <unistd.h> #include <string.h> #include <ctype.h> @@ -252,7 +252,7 @@ // reap zombies. int state; - (void) wait(&state); + //(void) wait(&state); #endif } else { gnome_appbar_set_status(GNOME_APPBAR(widgets.appbar), _______________________________________________ sword-devel mailing list: [email protected] http://www.crosswire.org/mailman/listinfo/sword-devel Instructions to unsubscribe/change your settings at above page
