GCC Middle and Back End API Reference
genhooks.c File Reference

Data Structures

struct  hook_desc
struct  s_hook

Functions

static void emit_findices ()
static char * upstrdup ()
static hashval_t s_hook_hash ()
static int s_hook_eq_p ()
static void emit_documentation ()
static void emit_init_macros ()
int main ()

Variables

static struct hook_desc hook_array []

Function Documentation

static void emit_documentation ( )
static
Read the documentation file with name IN_FNAME, perform substitutions
   to incorporate information from hook_array, and emit the result on stdout.
   Hooks defined with DEFHOOK / DEFHOOKPOD are emitted at the place of a
   matching @hook in the input file; if there is no matching @hook, the
   hook is emitted after the hook that precedes it in target.def .
   Usually, the emitted hook documentation starts with the hook
   signature, followed by the string from the doc field.
   The documentation is bracketed in @deftypefn / @deftypevr and a matching
   @end.
   While emitting the doc field, @Fcode is translated to @code, and an
   @findex entry is added to the affected paragraph.
   If the doc field starts with '*', the leading '*' is stripped, and the doc
   field is otherwise emitted unaltered; no function signature/
   @deftypefn/deftypevr/@end is emitted.
   In particular, a doc field of "*" means not to emit any ocumentation for
   this target.def / hook_array entry at all (there might be documentation
   for this hook in the file named IN_FNAME, though).
   A doc field of 0 is used to append the hook signature after the previous
   hook's signture, so that one description can be used for a group of hooks.
   When the doc field is "", @deftypefn/@deftypevr and the hook signature
   is emitted, but not the matching @end.  This allows all the free-form
   documentation to be placed in IN_FNAME, to work around GPL/GFDL
   licensing incompatibility issues.   

References hook_desc::doc, emit_findices(), fatal(), free(), s_hook::name, hook_desc::param, s_hook::pos, s_hook_eq_p(), s_hook_hash(), strlen(), strstr(), hook_desc::type, and upstrdup().

Referenced by main().

static void emit_findices ( )
static
For each @Fcode in the first paragraph of the documentation string DOC,
   print an @findex directive.  HOOK_NAME is the name of the hook this bit of
   documentation pertains to.   

References fatal(), strlen(), and strstr().

Referenced by emit_documentation().

static void emit_init_macros ( )
static
Emit #defines to stdout (this will be redirected to generate
   target-hook-def.h) which set target hooks initializer macros
   to their default values.  These should only be emitted for hooks
   whose type is given by DOCNAME.   

References fatal(), s_hook::name, and upstrdup().

Referenced by main().

int main ( )
static int s_hook_eq_p ( )
static

References s_hook::name.

Referenced by emit_documentation().

static hashval_t s_hook_hash ( )
static

References s_hook::name.

Referenced by emit_documentation().

static char* upstrdup ( )
static
Return an upper-case copy of IN.   

Referenced by emit_documentation(), and emit_init_macros().


Variable Documentation

struct hook_desc hook_array[]
static
Initial value:
{
#define HOOK_VECTOR_1(NAME, FRAGMENT) \
{ 0, 0, #NAME, 0, 0, HOOK_TYPE },
#define DEFHOOKPOD(NAME, DOC, TYPE, INIT) \
{ DOC, #TYPE, HOOK_PREFIX #NAME, 0, #INIT, HOOK_TYPE },
#define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) \
{ DOC, #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT, HOOK_TYPE },
#define DEFHOOK_UNDOC(NAME, DOC, TYPE, PARAMS, INIT) \
{ "*", #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT, HOOK_TYPE },
#include "target.def"
#include "c-family/c-target.def"
#include "common/common-target.def"
#undef DEFHOOK
}