Optional
These commands are optional and only supported when the
source_highlight
library are successfully found; see the output printed by the
cmake command
.
Purpose
These commands will display the specified
input file
as program source code with highlighting.
Letter Case
Upper case letters versus lower case letters does not matter
when determining the language corresponding to the file extension.
For example, the R programming language would correspond to
filename
equal to my_file.R or my_file.r.
srcfile
The value of
filename
specifies the name
of the file that is displayed.
Leading and trailing white space in
filename
is ignored.
The
filename
must have a
file extension
.
The file extension, without the period '.',
is used to determine the source code language.
srcthisfile
The $srcthisfile command uses the input file,
where the command occurs, for
filename
.
indent
If
indent
is present,
it is a positive integer and specifies
the number of spaces to indent the output.
(It is best if the
indent
is a multiple of the tabsize
.)
displays the entire file highlight.h,
with a four space indentation as follows:
# ifndef HIGHLIGHT_INCLUDED
# define HIGHLIGHT_INCLUDED
/* ---------------------------------------------------------------------------- OMhelp: Language Independent Embedded Documentation Copyright (C) 1998-2019 Bradley M. Bell OMhelp is distributed under the terms of the GNU General Public License Version 2. ---------------------------------------------------------------------------- */ # ifdef __cplusplus
extern "C" {
# endif// BEGIN PROTOTYPEextern char* highlight(
const char* input_text_cstr ,
const char* input_lang_cstr ,
const char* output_lang_cstr ,
int indent ,
int tabsize
);
extern char* file_ext2lang(const char* file_ext_cstr);
// END PROTOTYPE # ifdef __cplusplus
}
# endif # endif
Note that a newline was automatically added at the beginning of the file.
start
If
start
is present,
it specifies a sequence of characters after which output should start.
In this case none of the characters in the file before,
and including,
this starting sequence are displayed.
escape
If the escape
character is present in
start
,
there must be three decimal digits following it.
In this case the escape character together with the three following
characters, represent the single character with ascii code equal
to the decimal value of the three decimal digits.
stop
If
start
is present,
stop
must also be present.
It specifies
a sequence of characters just before which output should stop.
In this case none of the characters in the file following,
and including,
this stopping sequences are displayed.
escape
If the escape
character is present in
stop
,
there must be three decimal digits following it.
In this case the escape character together with the three following
characters, represent the single character with ascii code equal
to the decimal value of the three decimal digits.
Note that the newline after // BEGIN PROOTYPE,
and the newline before // END PROTOTYPE,
are included in the output.
Also note that the previous tabsize
command is still in effect.
skip
If
skip
is present,
it is a positive integer that specifies the number of
start
matches to skip.
This is very useful when the $srcfile command
refers to the same file as the command is in.
The skip option can be used to skip the match on the command
and go forward to the location that you wish to display.
Tab Stops
The tabsize
command
enables you to match the indentation of the
srcfile and srcthisfile commands
with one of the tabbing columns.
Input File: omh/srcfile.omh