]> diplodocus.org Git - nmh/blobdiff - h/fmt_scan.h
For FreeBSD builds, also search the ports tree for includes and libs.
[nmh] / h / fmt_scan.h
index 4d768b7bbe0e69ea3a233610b8a9ed35b19d86c6..2bcc265f242b2594c76127eabfe2d52f9cab855b 100644 (file)
@@ -89,7 +89,7 @@ struct format {
 
 typedef char * (*formataddr_cb)(char *, char *);
 typedef char * (*concataddr_cb)(char *, char *);
 
 typedef char * (*formataddr_cb)(char *, char *);
 typedef char * (*concataddr_cb)(char *, char *);
-typedef void (*trace_cb)(void *, struct format *, int, char *, char *);
+typedef void (*trace_cb)(void *, struct format *, int, char *, const char *);
 
 struct fmt_callbacks {
     formataddr_cb      formataddr;
 
 struct fmt_callbacks {
     formataddr_cb      formataddr;
@@ -138,11 +138,11 @@ int fmt_compile (char *fstring, struct format **fmt, int reset);
  * Interpret a sequence of compiled format instructions.  Arguments are:
  *
  * format      - Array of format instructions generated by fmt_compile()
  * Interpret a sequence of compiled format instructions.  Arguments are:
  *
  * format      - Array of format instructions generated by fmt_compile()
- * scanl       - Passed-in character array that will contain the output
- *               of the format instructions.  Is always terminated with
- *               a newline (\n).
- * max         - Maximum number of bytes to be written to "scanl" (in other
- *               words, the buffer size).  Includes the trailing NUL.
+ * scanl       - Passed-in charstring_t object (created with
+ *               charstring_create() and later destroyed with
+ *               charstring_free()) that will contain the output of the
+ *               format instructions.  Is always terminated with a
+ *               newline (\n).
  * width       - Maximum number of displayed characters.  Does not include
  *               characters marked as nonprinting or (depending on the
  *               encoding) bytes in a multibyte encoding that exceed the
  * width       - Maximum number of displayed characters.  Does not include
  *               characters marked as nonprinting or (depending on the
  *               encoding) bytes in a multibyte encoding that exceed the
@@ -169,8 +169,8 @@ int fmt_compile (char *fstring, struct format **fmt, int reset);
  * execute, which is currently always NULL.
  */
 
  * execute, which is currently always NULL.
  */
 
-struct format *fmt_scan (struct format *format, char *scanl, size_t max,
-                        int width, int *dat, struct fmt_callbacks *callbacks);
+struct format *fmt_scan (struct format *format, charstring_t scanl, int width,
+                        int *dat, struct fmt_callbacks *callbacks);
 
 /*
  * Free a format structure and/or component hash table.  Arguments are:
 
 /*
  * Free a format structure and/or component hash table.  Arguments are:
@@ -267,6 +267,25 @@ int fmt_addcomptext(char *component, char *text);
 
 void fmt_appendcomp(int bucket, char *component, char *text);
 
 
 void fmt_appendcomp(int bucket, char *component, char *text);
 
+/*
+ * Iterate over the complete hash table of component structures.
+ *
+ * Arguments are:
+ *
+ * comp                - Pointer to the current component structure.  The next
+ *               component in the hash table after this component.  To
+ *               start (or restart) the iteration of the hash table
+ *               this argument should be NULL.
+ * bucket      - Pointer to hash bucket.  Will be managed by this function,
+ *               the caller should not modify this value.
+ *
+ * Returns the next component in the hash table.  This value should be
+ * passed into the next call to fmt_nextcomp().  Returns NULL at the end
+ * of the hash table.
+ */
+
+struct comp *fmt_nextcomp(struct comp *comp, unsigned int *bucket);
+
 /*
  * The implementation of the %(formataddr) function.  This is available for
  * programs to provide their own local implementation if they wish to do
 /*
  * The implementation of the %(formataddr) function.  This is available for
  * programs to provide their own local implementation if they wish to do