@z --- demo0.web ---

This file is part of FWEB.  It and its tangled output demo0.tex are
included into the user manual fwebman.tex.  All web source files should
have header information such as this.

Author:  J. A. Krommes
Version: 1.23
Date:    April 1, 1992

@x-----------------------------------------------------------------------------

@c @% This command (invisible on output) sets the global language to C.
@* EXAMPLE. The `\.{@@*}'~begins a major module or section (one for which an
entry is made in the table of contents). We are now in the \TeX\ part of
the section, in which we can type arbitrary \TeX\ to explain what goes on in
the remainder of the section.

The next statement introduces the definition part of this section.
\modlabel{FirstMod} % Attach an identifying name to this section.

@m PRINT(word) printf("%s, world.\n",#word) /* An example of a \.{WEB}
	macro def'n.  They are compatible with ANSI~C, but have extensions
	(not illustrated here) that will be explained later.
	Long comments that extend over more than one line can be written
	like this, in the C commenting style. */ 

@a @% The @a command (invisible on output) introduces the code part of
   @% this (unnamed) module.
main()
{
PRINT(Hello); /* Bullets as subscripts indicate that the name is defined in
	the current section. */
init(); /* Example of a function call.  The subscript is inserted
	automatically, and indicates in which section the function is
	defined. */
@<Do the computations@>; /* Use of named modules makes the code readable.
	Again, the section number where this module is defined is inserted
	automatically. */
PRINT(Goodbye);
}

@ The `\.{@@\ }'~begins a minor section.  (No entry is made in the table of
contents.)  Here the named fragment |@<Do...@>| used in the previous module
is actually defined.  (The definition part of this section is empty.) The
name of this module is `Do the computations'; it can be abbreviated (using
an ellipsis) for simplicity in the source because it appeared earlier in
full; however, when it's printed the full name will be used for
readability.

@<Do the comp...@>=
{
/* Put arbitrary C code here. */
}

@ In general, function names don't carry as much information as do named
modules, since a module name can be arbitrarily long and complicated.  But
function calls have their place as well, as described later.

This function is actually accreted to the unnamed module begun in
\WEBsection{FirstMod}.  Examine the source listing to see how the section
number in the last sentence was generated automatically through the use of
\FWEB's \TeX\ macros \.{\\modlabel} and \.{\\WEBsection}.

@a 
void init(void)
{}

@* INDEX.  It's customary to make the index the last major module.
