#ifndef _FORMAT_H_ee493d0f_ #define _FORMAT_H_ee493d0f_ #include "message.h" #include "profile.h" struct format; typedef struct format FORMAT; /* Look up a format in the profile, tagged by the second arg; third arg is fallback program text in case no other program can be found. Fourth and further args specify extensions; they take the form of keys, which are EXT_xxx constants defined here. The list must be terminated with a key value of EXT_END. */ extern FORMAT *format_program(PROFILE *, const char *, const char *, ...); #define EXT_END 0 #define EXT_WIDTH 1 #define EXT_HEIGHT 2 #define EXT_UNIXFROM 3 #define EXT_HDRRESET 4 #define EXT_HDRGET 5 #define EXT_HDRMATCH 6 #define EXT_BODYLINE 7 #define EXT_OUTSTRING 8 #define EXT_FILTER 9 #define EXT_DUMPBODY 10 #define EXT__BIT(x) (1U<<((x)-1)) /* EXT_xxx constant to bitmask bit */ typedef unsigned short int EXT__T; /* type to hold EXT__BIT bitmask */ /* Run a format program. If third arg is non-nil, when the program exits a string is expected on TOS and this function is called with it; if an error occurs and the fourth arg is non-nil, it is called with a string describing the error. Fifth arg is a cookie passed to callbacks. Sixth and later args specify options. These options can be: */ /* Must be present at end of list */ #define FOPT_END 0 /* Following arg: fd to use for @outstring/@filter/@dumpbody; if not specified, those will produce run-time errors */ #define FOPT_OUTFD 1 /* Following args: int (N), then FMT_STACK[N]. Pre-loads stack from the FMT_STACK structures; [0] pushed first, then [1], etc, to [N-1]. */ #define FOPT_STACK 2 extern void format_run(FORMAT *, MESSAGE *, void (*)(const char *, void *), void (*)(const char *, void *), void *, ...); typedef struct fmt_stack FMT_STACK; struct fmt_stack { unsigned char type; #define FOS_T_INTEGER 1 #define FOS_T_STRING 2 union { int i; char *s; /* will be strdup()ed */ } u; } ; #endif