Removed some unnecessary #include directives
[pspp] / src / groff-font.c
index 331da33d38dbd07ec4239f35e2a07b05cadc066a..e5811ef40de411a824d048d2d77b6a030e969f66 100644 (file)
@@ -14,8 +14,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA. */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
 
 #include <config.h>
 #include "font.h"
 #include "alloc.h"
 #include "error.h"
 #include "filename.h"
+#include "getline.h"
 #include "hash.h"
 #include "pool.h"
 #include "str.h"
 #include "version.h"
 
+#include "gettext.h"
+#define _(msgid) gettext (msgid)
+
 int font_number_to_index (int);
 
 int space_index;
@@ -48,13 +52,7 @@ static void add_kern (struct font_desc * font, int ch1, int ch2, int adjust);
 /* Typical whitespace characters for tokenizing. */
 static const char whitespace[] = " \t\n\r\v";
 
-void
-groff_init (void)
-{
-  space_index = font_char_name_to_index ("space");
-}
-
-/* Some notes on the groff_font(8) manpage:
+/* Some notes on the groff_font manpage:
 
    DESC file format: A typical PostScript `res' would be 72000, with
    `hor' and `vert' set to 1 to indicate that all those positions are
@@ -68,7 +66,7 @@ groff_init (void)
 
 /* Reads a Groff font description file and converts it to a usable
    binary format in memory.  Installs the binary format in the global
-   font table.  See groff_font(8) for a description of the font
+   font table.  See groff_font for a description of the font
    description format supported.  Returns nonzero on success. */
 struct font_desc *
 groff_read_font (const char *fn)
@@ -394,10 +392,15 @@ lose:
 static int
 font_msg (int class, const char *format,...)
 {
+  struct error error;
   va_list args;
 
+  error.class = class;
+  err_location (&error.where);
+  error.title = _("installation error: Groff font error: ");
+
   va_start (args, format);
-  tmsg (class, format, args, _("installation error: Groff font error: "));
+  err_vmsg (&error, format, args);
   va_end (args);
 
   return 0;
@@ -408,7 +411,7 @@ font_msg (int class, const char *format,...)
 static void
 scan_badchars (char *line, int len)
 {
-  unsigned char *cp = line;
+  char *cp = line;
 
   /* Same bad characters as Groff. */
   static unsigned char badchars[32] =
@@ -419,12 +422,15 @@ scan_badchars (char *line, int len)
     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   };
 
-  for (; len--; cp++)
-    if (badchars[*cp >> 3] & (1 << (*cp & 7)))
-      {
-       font_msg (SE, _("Bad character \\%3o."), *cp);
-       *cp = ' ';
-      }
+  for (; len--; cp++) 
+    {
+      int c = (unsigned char) *cp;
+      if (badchars[c >> 3] & (1 << (c & 7)))
+        {
+          font_msg (SE, _("Bad character \\%3o."), *cp);
+          *cp = ' ';
+        } 
+    }
 }
 \f
 /* Character name hashing. */
@@ -447,6 +453,20 @@ static struct
   }
 hash;
 
+void
+groff_init (void)
+{
+  space_index = font_char_name_to_index ("space");
+}
+
+void
+groff_done (void)
+{
+  free (hash.tab) ;
+  pool_destroy(hash.ar);
+}
+
+
 /* Searches for NAME in the global character code table, returns the
    index if found; otherwise inserts NAME and returns the new
    index. */