X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/11e2fb2dbbc074cce78d62fdf425e6bbf1918949..63621a81d16ab743de6b57d47578a9a2c670ad22:/h/fmt_scan.h diff --git a/h/fmt_scan.h b/h/fmt_scan.h index e35bfa20..2574c579 100644 --- a/h/fmt_scan.h +++ b/h/fmt_scan.h @@ -1,12 +1,10 @@ - -/* - * fmt_scan.h -- definitions for fmt_scan() +/* fmt_scan.h -- definitions for fmt_scan() */ /* * This structure describes an "interesting" component. It holds * the name & text from the component (if found) and one piece of - * auxilary info. The structure for a particular component is located + * auxiliary info. The structure for a particular component is located * by (open) hashing the name and using it as an index into the ptr array * "wantcomp". All format entries that reference a particular component * point to its comp struct (so we only have to do component specific @@ -114,6 +112,12 @@ struct fmt_callbacks { char *new_fs (char *form, char *format, char *default_fs); +/* + * Free memory allocated by new_fs(). It allocates to a static so + * no argument is necessary. + */ +void free_fs(void); + /* * Compile a format string into a set of format instructions. Arguments are: * @@ -123,7 +127,7 @@ char *new_fs (char *form, char *format, char *default_fs); * format engine. * reset - If set to true, the format compiler will reset the * component hash table. The component hash table contains - * all of the references to message components refered to in + * all of the references to message components referred to in * the format instructions. If you have multiple format * strings that you want to compile and operate on the * same message, this should be set to false. @@ -138,13 +142,13 @@ 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() - * 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 + * characters marked as non-printing or (depending on the * encoding) bytes in a multibyte encoding that exceed the * character's column width. * dat - An integer array that contains data used by certain format @@ -169,8 +173,8 @@ int fmt_compile (char *fstring, struct format **fmt, int reset); * 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: @@ -201,7 +205,7 @@ void fmt_freecomptext(void); * or NULL if the component is not found in the hash table. */ -struct comp *fmt_findcomp(char *component); +struct comp *fmt_findcomp(char *component) PURE; /* * Search for a component structure in the component hash table. @@ -209,7 +213,7 @@ struct comp *fmt_findcomp(char *component); * Identical to fmd_findcomp(), but is case-INSENSITIVE. */ -struct comp *fmt_findcasecomp(char *component); +struct comp *fmt_findcasecomp(char *component) PURE; /* * Add a component entry to the component hash table @@ -237,7 +241,7 @@ int fmt_addcompentry(char *component); * component buffer is a newline, it will be separated * from previous text by ",\n\t"; otherwise if the last * character of the previous text is a newline it will - * simply be seperated by a "\t". This unusual processing + * simply be separated by a "\t". This unusual processing * is designed to handle the case where you have multiple * headers with the same name (e.g.: multiple "cc:" headers, * even though that isn't technically allowed in the RFCs).