extern int fmt_norm;
-/*
- * Hash function for component name. The function should be
- * case independent and probably shouldn't involve a routine
- * call. This function is pretty good but will not work on
- * single character component names.
- */
-#define CHASH(nm) (((((nm)[0]) - ((nm)[1])) & 0x1f) + (((nm)[2]) & 0x5f))
-
-/*
- * Find a component in the hash table.
- */
-#define FINDCOMP(comp,name) \
- for (comp = wantcomp[CHASH(name)]; \
- comp && strcmp(comp->c_name,name); \
- comp = comp->c_next) \
- ;
-
/*
* This structure defines one formatting instruction.
*/
char f_u_char; /* literal character */
int f_u_value; /* literal value */
} f_un;
+ short f_flags; /* misc. flags */
};
#define f_skip f_width /* instr to skip (false "if") */
#define f_value f_un.f_u_value
/*
+ * f_flags bits
+ */
+
+#define FF_STRALLOC (1<<0) /* String has been allocated */
+#define FF_COMPREF (1<<1) /* Component reference */
+
+/*
* prototypes used by the format engine
*/
* strings that you want to compile and operate on the
* same message, this should be set to false.
*
- * Returns the number of components referenced by the format instructions.
+ * Returns the total number of components referenced by all format instructions
+ * since the last reset of the hash table.
*/
int fmt_compile (char *fstring, struct format **fmt, int reset);