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.  
     Enter all the start hooks in start_hooks.  
     For each hook in hook_array, if it is a start hook, store its position.  
     Copy input file to stdout, substituting @hook directives with the
     corresponding hook documentation sequences.  
             A leading '*' means to output the documentation string without
             further processing.  
                 Print header.  Function-valued hooks have a parameter list, 
                 unlike POD-valued ones.  
                     Print the parameter list, with the parameter names
                     enclosed in @var{}.  
                       Type names like 'int' are followed by a space, sometimes
                       also by '*'.  'void' should appear only in "(void)".  
                 POD-valued hooks sometimes come in groups with common
                 documentation.
                     Print each documentation paragraph in turn.  
                         Find paragraph end.  
                         Print paragraph, emitting @Fcode as @code.  
                         Emit function indices for next paragraph.  
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.  
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.  
                 Output default definitions of target hooks.  

References fatal().

int main ( )
static int s_hook_eq_p ( )
static
static hashval_t s_hook_hash ( )
static
static char* upstrdup ( )
static
   Return an upper-case copy of IN.  

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
}