1: /* formatsbr.h - definitions for fmtscan () */
   2: 
   3: /*
   4:  * This structure describes an "interesting" component.  It holds
   5:  * the name & text from the component (if found) and one piece of
   6:  * auxilary info.  The structure for a particular component is located
   7:  * by hashing the name and using it as an index into the ptr array
   8:  * "wantcomp".  All format entries that reference a particular component
   9:  * point to its comp struct (so we only have to do component specific
  10:  * processing once.  e.g., parse an address.).
  11:  */
  12: struct comp {
  13:     char        *c_name;    /* component name (in lower case) */
  14:     struct  comp    *c_next;    /* hash chain linkage */
  15:     char        *c_text;    /* component text (if found) */
  16:     short       c_flags;    /* misc. flags (from formatsbr) */
  17:     short       c_type;     /* type info (from fmtcompile) */
  18:     union {
  19:         struct tws  *c_u_tws;
  20:         struct mailname *c_u_mn;
  21:     } c_un;
  22: #define c_tws c_un.c_u_tws
  23: #define c_mn c_un.c_u_mn
  24: };
  25: 
  26: /* c_type bits */
  27: #define CT_ADDR     1   /* referenced as address */
  28: #define CT_DATE     2   /* referenced as date */
  29: #define CT_MYMBOX   4   /* "mymbox" test being done */
  30: #define CT_ADDRPARSE    8   /* address parse being done */
  31: 
  32: extern int fmt_norm;
  33: 
  34: struct  comp    *wantcomp[128]; /* hash table for deciding if a
  35: 				 * component is "interesting" */
  36: 
  37: /*
  38:  * Hash function for component name.  The function should be
  39:  * case independent and probably shouldn't involve a routine
  40:  * call.  This function is pretty good but will not work on
  41:  * single character component names.
  42:  */
  43: #define CHASH(nm)   (((nm[0]-nm[1])&0x1f)+(nm[2]&0x5f))
  44: 
  45: #define FINDCOMP(comp,name) \
  46:         for (comp = wantcomp[CHASH(name)]; \
  47:              comp && ! uleq(comp->c_name,name); \
  48:              comp = comp->c_next) ;
  49: 
  50: 
  51: /*
  52:  * This structure defines one formatting instruction.
  53:  */
  54: struct format {
  55:     unsigned char   f_type;
  56:     char        f_fill;
  57:     short       f_width;    /* output field width */
  58: #define f_skip f_width          /* instr to skip (false "if") */
  59:     union {
  60:         struct comp *f_u_comp;  /* associated component */
  61:         char        *f_u_text;  /* literal text */
  62:         char        f_u_char;   /* literal character */
  63:         int     f_u_value;  /* literal value */
  64:     } f_un;
  65: #define f_comp f_un.f_u_comp
  66: #define f_text f_un.f_u_text
  67: #define f_char f_un.f_u_char
  68: #define f_value f_un.f_u_value
  69: };
  70: 
  71: int fmtscan ();
  72: char   *new_fs ();

Defined variables

Defined struct's

Defined macros

CT_ADDR defined in line 27; used 4 times
CT_ADDRPARSE defined in line 30; used 2 times
CT_DATE defined in line 28; used 4 times
CT_MYMBOX defined in line 29; used 1 times
c_mn defined in line 23; used 21 times
c_tws defined in line 22; used 29 times
f_char defined in line 67; used 2 times
f_comp defined in line 65; used 44 times
f_skip defined in line 58; used 10 times
f_text defined in line 66; used 10 times
f_value defined in line 68; used 11 times

Usage of this include

Last modified: 1986-04-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1133
Valid CSS Valid XHTML 1.0 Strict