[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

debian-installer and brltty



Hi Mario and others,

I would like to help on #219928 if I can, but I do not use brltty.
Here is a patch to put most .o files into libbrlapi.so so that mklibs
can find all symbols.  The Programs/main.c file contained global functions
(which have been moved into a new mainlib.c file) and global variables
(moved to config.c).  With this patch, mklibs only reports 4 non-weak
symbols: brl_fd, chars_per_sec, blite_fd and SendToAlva.  These symbols
are defined in drivers, and I did not yet try to fix them.
Moreover brltty is now linked against libbrlapi.so (creating a new
library is certainly a better idea, but remember, I do not know what
am I doing ;)), so this library must be installed along with brltty.

Do you believe that brltty problems can be fixed that way?  If yes, I will
try to finish this patch.  If no, never mind, do you have better plans?

Denis
diff -ur brltty-3.3.1.orig/Programs/Makefile.in brltty-3.3.1/Programs/Makefile.in
--- brltty-3.3.1.orig/Programs/Makefile.in	2003-09-01 16:16:35.000000000 +0200
+++ brltty-3.3.1/Programs/Makefile.in	2003-11-14 23:13:19.000000000 +0100
@@ -86,7 +86,9 @@
 
 ###############################################################################
 
-API_LIB_OBJS = api_client.o api_common.o
+API_LIB_OBJS = $(SYSTEM_OBJECT) $(CTB_OBJECTS) $(SPEECH_OBJECT) $(API_OBJECTS) $(SCREEN_OBJECTS) $(TUNE_OBJECTS) $(BRAILLE_DRIVER_OBJECT) $(SPEECH_DRIVER_OBJECT) \
+mainlib.o config.o options.o misc.o sysmisc.o brl.o route.o cut.o
+
 API_NAME = $(LIB_PFX)brlapi
 API_LIB = $(API_NAME).$(LIB_EXT)
 API_ARC = $(API_NAME).$(ARC_EXT)
@@ -114,10 +116,10 @@
 
 ###############################################################################
 
-BRLTTY_OBJECTS = main.o config.o options.o misc.o sysmisc.o $(SYSTEM_OBJECT) route.o cut.o $(CTB_OBJECTS) brl.o $(SPEECH_OBJECT) $(API_OBJECTS) $(SCREEN_OBJECTS) $(TUNE_OBJECTS) $(BRAILLE_DRIVER_OBJECT) $(SPEECH_DRIVER_OBJECT)
+BRLTTY_OBJECTS = main.o
 
-brltty: $(BRLTTY_OBJECTS)
-	$(CC) $(LDFLAGS) -o $@ $(BRLTTY_OBJECTS) $(LDLIBS)
+brltty: $(BRLTTY_OBJECTS) $(API_LIB)
+	$(CC) $(LDFLAGS) -o $@ $(BRLTTY_OBJECTS) $(LDLIBS) -L. -lbrlapi
 
 main.o:
 	$(CC) $(CFLAGS) -c $(SRC_DIR)/main.c
diff -ur brltty-3.3.1.orig/Programs/config.c brltty-3.3.1/Programs/config.c
--- brltty-3.3.1.orig/Programs/config.c	2003-09-01 16:16:35.000000000 +0200
+++ brltty-3.3.1/Programs/config.c	2003-11-14 23:28:39.000000000 +0100
@@ -57,6 +57,18 @@
 
 char COPYRIGHT[] = "Copyright (C) 1995-2003 by The BRLTTY Team - all rights reserved.";
 
+/*
+ * Misc param variables
+ */
+Preferences prefs;                /* environment (i.e. global) parameters */
+BrailleDisplay brl;                        /* For the Braille routines */
+short fwinshift;                /* Full window horizontal distance */
+short hwinshift;                /* Half window horizontal distance */
+short vwinshift;                /* Window vertical distance */
+
+int refreshInterval = DEFAULT_REFRESH_INTERVAL;
+int messageDelay = DEFAULT_MESSAGE_DELAY;
+
 #define DEVICE_DIRECTORY "/dev"
 #define TABLE_EXTENSION ".tbl"
 #define TEXT_TABLE_PREFIX "text."
diff -ur brltty-3.3.1.orig/Programs/main.c brltty-3.3.1/Programs/main.c
--- brltty-3.3.1.orig/Programs/main.c	2003-09-01 16:16:44.000000000 +0200
+++ brltty-3.3.1/Programs/main.c	2003-11-14 23:28:47.000000000 +0100
@@ -46,18 +46,8 @@
 #include "brltty.h"
 #include "defaults.h"
 
-int refreshInterval = DEFAULT_REFRESH_INTERVAL;
-int messageDelay = DEFAULT_MESSAGE_DELAY;
-
-/*
- * Misc param variables
- */
-Preferences prefs;                /* environment (i.e. global) parameters */
-BrailleDisplay brl;                        /* For the Braille routines */
-short fwinshift;                /* Full window horizontal distance */
-short hwinshift;                /* Half window horizontal distance */
-short vwinshift;                /* Window vertical distance */
 ScreenDescription scr;                        /* For screen state infos */
+
 static short dispmd = LIVE_SCRN;        /* freeze screen on/off */
 static short infmode = 0;                /* display screen image or info */
 
@@ -69,7 +59,7 @@
 static int contractedTrack = 0;
 #endif /* ENABLE_CONTRACTED_BRAILLE */
 
-static unsigned char statusCells[StatusCellCount];        /* status cell buffer */
+extern unsigned char statusCells[StatusCellCount];        /* status cell buffer */
 static unsigned int TickCount = 0;        /* incremented each main loop cycle */
 
 
@@ -148,12 +138,6 @@
   setTranslationTable(p->showAttributes);
 }
 
-void
-clearStatusCells (void) {
-   memset(statusCells, 0, sizeof(statusCells));
-   braille->writeStatus(&brl, statusCells);
-}
-
 static void
 setStatusCells (void) {
    memset(statusCells, 0, sizeof(statusCells));
@@ -247,18 +231,6 @@
    braille->writeStatus(&brl, statusCells);
 }
 
-void
-setStatusText (const char *text) {
-   int i;
-   memset(statusCells, 0, sizeof(statusCells));
-   for (i=0; i<sizeof(statusCells); ++i) {
-      unsigned char character = text[i];
-      if (!character) break;
-      statusCells[i] = textTable[character];
-   }
-   braille->writeStatus(&brl, statusCells);
-}
-
 static void
 showInfo (void) {
   /* Here we must be careful. Some displays (e.g. Braille Lite 18)
@@ -1861,66 +1833,3 @@
   terminateProgram(0);
   return 0;
 }
-
-void 
-message (const char *text, short flags) {
-   int length = strlen(text);
-
-#ifdef ENABLE_SPEECH_SUPPORT
-   if (prefs.alertTunes && !(flags & MSG_SILENT)) {
-      speech->mute();
-      speech->say(text, length);
-   }
-#endif /* ENABLE_SPEECH_SUPPORT */
-
-   if (braille && brl.buffer) {
-      while (length) {
-         int count;
-         int index;
-
-         /* strip leading spaces */
-         while (*text == ' ')  text++, length--;
-
-         if (length <= brl.x*brl.y) {
-            count = length; /* the whole message fits on the braille window */
-         } else {
-            /* split the message across multiple windows on space characters */
-            for (count=brl.x*brl.y-2; count>0 && text[count]!=' '; count--);
-            if (!count) count = brl.x * brl.y - 1;
-         }
-
-         memset(brl.buffer, ' ', brl.x*brl.y);
-         for (index=0; index<count; brl.buffer[index++]=*text++);
-         if (length -= count) {
-            while (index < brl.x*brl.y) brl.buffer[index++] = '-';
-            brl.buffer[brl.x*brl.y - 1] = '>';
-         }
-
-         /*
-          * Do Braille translation using text table. * Six-dot mode is
-          * ignored, since case can be important, and * blinking caps won't 
-          * work ... 
-          */
-         writeBrailleBuffer(&brl);
-
-         if (flags & MSG_WAITKEY)
-            getBrailleCommand(CMDS_MESSAGE);
-         else if (length || !(flags & MSG_NODELAY)) {
-            int i;
-            for (i=0; i<messageDelay; i+=refreshInterval) {
-               delay(refreshInterval);
-               if (readBrailleCommand(&brl, CMDS_MESSAGE) != EOF) break;
-            }
-         }
-      }
-   }
-}
-
-void
-showDotPattern (unsigned char dots, unsigned char duration) {
-  memset(statusCells, dots, sizeof(statusCells));
-  memset(brl.buffer, dots, brl.x*brl.y);
-  braille->writeStatus(&brl, statusCells);
-  braille->writeWindow(&brl);
-  drainBrailleOutput(&brl, duration);
-}
--- brltty-3.3.1.orig/Programs/mainlib.c	2003-08-30 00:41:58.000000000 +0200
+++ brltty-3.3.1/Programs/mainlib.c	2003-11-14 23:19:17.000000000 +0100
@@ -0,0 +1,130 @@
+/*
+ * BRLTTY - A background process providing access to the Linux console (when in
+ *          text mode) for a blind person using a refreshable braille display.
+ *
+ * Copyright (C) 1995-2003 by The BRLTTY Team. All rights reserved.
+ *
+ * BRLTTY comes with ABSOLUTELY NO WARRANTY.
+ *
+ * This is free software, placed under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation.  Please see the file COPYING for details.
+ *
+ * Web Page: http://mielke.cc/brltty/
+ *
+ * This software is maintained by Dave Mielke <dave@mielke.cc>.
+ */
+
+/*
+ * main.c - Main processing loop plus signal handling
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <errno.h>
+
+#include "misc.h"
+#include "message.h"
+#include "tunes.h"
+#include "contract.h"
+#include "route.h"
+#include "cut.h"
+#include "scr.h"
+#include "brl.h"
+#ifdef ENABLE_SPEECH_SUPPORT
+#include "spk.h"
+#endif /* ENABLE_SPEECH_SUPPORT */
+#include "brltty.h"
+#include "defaults.h"
+
+unsigned char statusCells[StatusCellCount];        /* status cell buffer */
+void 
+message (const char *text, short flags) {
+   int length = strlen(text);
+
+#ifdef ENABLE_SPEECH_SUPPORT
+   if (prefs.alertTunes && !(flags & MSG_SILENT)) {
+      speech->mute();
+      speech->say(text, length);
+   }
+#endif /* ENABLE_SPEECH_SUPPORT */
+
+   if (braille && brl.buffer) {
+      while (length) {
+         int count;
+         int index;
+
+         /* strip leading spaces */
+         while (*text == ' ')  text++, length--;
+
+         if (length <= brl.x*brl.y) {
+            count = length; /* the whole message fits on the braille window */
+         } else {
+            /* split the message across multiple windows on space characters */
+            for (count=brl.x*brl.y-2; count>0 && text[count]!=' '; count--);
+            if (!count) count = brl.x * brl.y - 1;
+         }
+
+         memset(brl.buffer, ' ', brl.x*brl.y);
+         for (index=0; index<count; brl.buffer[index++]=*text++);
+         if (length -= count) {
+            while (index < brl.x*brl.y) brl.buffer[index++] = '-';
+            brl.buffer[brl.x*brl.y - 1] = '>';
+         }
+
+         /*
+          * Do Braille translation using text table. * Six-dot mode is
+          * ignored, since case can be important, and * blinking caps won't 
+          * work ... 
+          */
+         writeBrailleBuffer(&brl);
+
+         if (flags & MSG_WAITKEY)
+            getBrailleCommand(CMDS_MESSAGE);
+         else if (length || !(flags & MSG_NODELAY)) {
+            int i;
+            for (i=0; i<messageDelay; i+=refreshInterval) {
+               delay(refreshInterval);
+               if (readBrailleCommand(&brl, CMDS_MESSAGE) != EOF) break;
+            }
+         }
+      }
+   }
+}
+
+void
+showDotPattern (unsigned char dots, unsigned char duration) {
+  memset(statusCells, dots, sizeof(statusCells));
+  memset(brl.buffer, dots, brl.x*brl.y);
+  braille->writeStatus(&brl, statusCells);
+  braille->writeWindow(&brl);
+  drainBrailleOutput(&brl, duration);
+}
+
+void
+clearStatusCells (void) {
+   memset(statusCells, 0, sizeof(statusCells));
+   braille->writeStatus(&brl, statusCells);
+}
+
+void
+setStatusText (const char *text) {
+   int i;
+   memset(statusCells, 0, sizeof(statusCells));
+   for (i=0; i<sizeof(statusCells); ++i) {
+      unsigned char character = text[i];
+      if (!character) break;
+      statusCells[i] = textTable[character];
+   }
+   braille->writeStatus(&brl, statusCells);
+}
+

Reply to: