Compiler/Simple file inclusion pre processor: Difference between revisions
Compiler/Simple file inclusion pre processor (view source)
Revision as of 11:01, 25 July 2021
, 2 years ago→{{header|AWK}}: Use @include, as in GAWK
(Added AWK) |
(→{{header|AWK}}: Use @include, as in GAWK) |
||
Line 469:
=={{header|AWK}}==
AWK does not have file-inclusion as standard, however some implementations, particularly GNU Awk do provide file inclusion.
<br>This include pre-processor differs from GAWK syntax in that the include directive
<br>The source can be a named file or read from stdin. If it is read from stdin, <code>-v sec=sourceName</code> can be specified on the AWK command line to name the file. The pre-processed source is writen to stdout.
<lang awk># include.awk: simple file inclusion pre-processor
Line 490:
{
if( $1 == "
{
# must include a file
Line 512:
{
# get the file name from the
fileName = includeLine;
sub( /^ *
sub( / *$/, "", fileName );
sub( / *#.*$/, "", fileName );
Line 544:
{
# I/O error
printf( "
fileName );
|