Revamp of the Halibut error handling mechanism.
[sgt/halibut] / bk_info.c
index d8a3837..69cd1e2 100644 (file)
--- a/bk_info.c
+++ b/bk_info.c
@@ -1,5 +1,12 @@
 /*
- * info backend for Halibut
+ * Info backend for Halibut
+ *
+ * The Info file format isn't well-specified, and what specification
+ * there is is scattered all over the place.  Sources include:
+ *   (info), from GNU Texinfo.
+ *   (texinfo), also from GNU Texinfo.
+ *   (Emacs)Misc Help, and (emacs)Info Lookup, from GNU Emacs.
+ *   info.el, from GNU Emacs.
  * 
  * Possible future work:
  * 
  * 
  *  - might be helpful to diagnose duplicate node names!
  *
- *  - more flexibility in heading underlines, like text backend.
- *     + Given info.el's fontifier, we'd want the following defaults:
- *       \cfg{info-title-underline}{*}
- *       \cfg{info-chapter-underline}{=}
- *       \cfg{info-section-underline}{0}{-}
- *       \cfg{info-section-underline}{1}{.}
- *
  *  - Indices generated by makeinfo use a menu rather than a bunch of
  *    cross-references, which reduces visual clutter rather.  For
  *    singly-referenced items, it looks like:
  *    make things slightly less ugly by using the lower-case version
  *    when the user asks for \k.  Unfortunately, standalone Info seems
  *    to match node names case-sensitively, so we can't downcase that.
+ *
+ *  - The character encoding used in an Info file can be configured using
+ *    an Emacs local variables block at the end, like this:
+ *      Local Variables:
+ *      coding: iso-8859-1
+ *      End:
  */
 
 #include <stdio.h>
@@ -396,7 +402,7 @@ void info_backend(paragraph *sourceform, keywordlist *keywords,
            kw = *longname ? uadv(longname) : L"";
 
            if (!*longname) {
-               error(err_cfginsufarg, &p->fpos, p->origkeyword, 3);
+               err_cfginsufarg(&p->fpos, p->origkeyword, 3);
                continue;
            }
 
@@ -685,7 +691,7 @@ void info_backend(paragraph *sourceform, keywordlist *keywords,
      */
     fp = fopen(conf.filename, "w");
     if (!fp) {
-       error(err_cantopenw, conf.filename);
+       err_cantopenw(conf.filename);
        return;
     }
     fputs(intro_text.output.text, fp);
@@ -729,7 +735,7 @@ void info_backend(paragraph *sourceform, keywordlist *keywords,
                sprintf(fname, "%s-%d", conf.filename, filenum);
                fp = fopen(fname, "w");
                if (!fp) {
-                   error(err_cantopenw, fname);
+                   err_cantopenw(fname);
                    return;
                }
                sfree(fname);
@@ -1142,7 +1148,7 @@ static char *info_node_name_core(info_data *id, filepos *fpos)
     p = q = id->output.text;
     while (*p) {
        if (*p == ':' || *p == ',' || *p == '(' || *p == ')') {
-           error(err_infonodechar, fpos, *p);
+           err_infonodechar(fpos, *p);
        } else {
            *q++ = *p;
        }