[= autogen template h

# $Id: agfunc.tpl,v 2.5 1999/07/07 19:42:33 bkorb Exp $

=]
/*
 *  Tables of Text Functions for AutoGen
 *
[=_eval "# *  " _DNE=]
 *
 *  copyright 1992-1999 Bruce Korb
 *
[=_eval AutoGen "# *  " _gpl=]
 */
#ifndef AUTOGEN_FUNC_H
#define AUTOGEN_FUNC_H

#define FUNC_CT    [=_eval macfunc _count =]

extern tpLoadProc   apLoadProc[   FUNC_CT ];
extern tpHdlrProc   apHdlrProc[   FUNC_CT ];
extern char*        apzFuncNames[ FUNC_CT ];
extern tpLoadProc*  papLoadProc;

/*
 *  Enumerate all the function types, whether they have
 *  implementation functions or not.
 */
typedef enum {[=
_FOR macfunc , =]
    FTYP_[=name _up "#%-12s" _printf=] /* [=what=] */[=
/macfunc =]
} teFuncType;

/*
 *  All of the function procedures.
 */[=

# The only functions with callable procedures are the ones that
  do *not* have the 'dummy' attribute.

=][=

_FOR macfunc =][=
  _IF not_callable _exist ! =]
tHdlrProc mFunc_[=name _cap=];[=
  _ENDIF =][=

  _IF load_func _exist =]
tLoadProc mLoad_[=name=];[=
  _ENDIF =][=
/macfunc =]
tLoadProc mLoad_Macro;
tLoadProc mLoad_Context;
tHdlrProc mFunc_Bogus;

#ifdef AGFUNC_PRIVATE  /* agFunc.c use only */

/*
 *  Pointers to the procedure to call when the function type
 *  is encountered.  Member functions of the block functions
 *  (IF, CASE and FOR) are redirected to Bogus.
 */
tpHdlrProc  apHdlrProc[ [=_eval macfunc _count =] ] = {[=
_FOR macfunc , =]
    /* [=name #%-12s _printf=]*/ &mFunc_[=
    _IF not_callable _exist
      =]Bogus[=
    _ELSE
      =][=name _cap=][=
    _ENDIF =][=
/macfunc =]
};

/*
 *  Pointers for the load processing (template scanning phase)
 */
tpLoadProc  apLoadProc[ [=_eval macfunc _count =] ] = {[=
_FOR macfunc , =]
    /* [=name #%-12s _printf=]*/ &mLoad_[=
  _IF load_func _exist      =][=name=][=
  _ELIF not_callable _exist =]Context[=
  _ELSE  default proc       =]Macro[=
  _ENDIF =][=
/macfunc =]
};
tpLoadProc* papLoadProc = apLoadProc;


/*
 *  Define all the strings that are used to determine
 *  the function enumeration number.
 *  These strings are *NOT* NUL terminated.
 */[=

_FOR macfunc =][=
  _IF unnamed _exist ! =][=

#  We specify the length of each string because we do not need
   the terminating NUL.  The specified length will cause the
   NUL to be stripped from the stored string.

=]
tSCC zFuncStr_[=name _cap #[ + "#%-9s" _printf =][=
    _eval name _len =] ] = [=
    name _up _str=];[=

  _ENDIF "unnamed does not apply" =][=
/macfunc=]

[=

#  The number of named functions is the number of functions
   less the number of functions that go unnamed.

=]
#define   NAMED_FUNC_CT  [=_eval macfunc _count
                  macfunc.unnamed _count -=]

typedef struct name_type tNameType;
struct name_type {
    size_t      cmpLen;  /* compare length (sans NUL) */
    tCC*        pName;   /* ptr to name */
    teFuncType  fType;   /* function type enum */
    int         unused;
};


tNameType nameTypeTable[ NAMED_FUNC_CT ] = {[=

_FOR macfunc =][=
  _IF unnamed _exist ! =]
  { [= _eval name _len
    =], zFuncStr_[=name _cap #, + #%-9s _printf
    =] FTYP_[=name _up #, + #%-9s _printf
    =] 0 },[=
  _ENDIF =][=
/macfunc=]
};

char*  apzFuncNames[ FUNC_CT ] = {
[=_OUTPUT push-new _outfile #.tmp + =][=
_FOR macfunc "\n"
=][=name _str=][=
/macfunc=][=
_OUTPUT pop=][=
_EVAL _outfile "file=%s.tmp
${top_builddir}/columns/columns --sep=, -c6 --indent=4 --input=$file
rm -f $file" _printf _shell
=] };

#endif /* AGFUNC_PRIVATE */
#endif /* AUTOGEN_FUNC_H */
