[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Usage: (extract file-name marker-fmt [ caveat ] [ default ])
This function is used to help construct output files that may contain
text that is carried from one version of the output to the next.
The first two arguments are required, the second are optional:
file-name
argument is used to name the file that
contains the demarcated text.
marker-fmt
is a formatting string that is used to construct
the starting and ending demarcation strings. The sprintf function is
given the marker-fmt
with two arguments. The first is either
"START" or "END". The second is either "DO NOT CHANGE THIS COMMENT"
or the optional caveat
argument.
caveat
is presumed to be absent if it is the empty string
(""
). If absent, "DO NOT CHANGE THIS COMMENT" is used
as the second string argument to the marker-fmt
.
default
argument is supplied and no pre-existing text
is found, then this text will be inserted between the START and END
markers.
[+ (extract "fname" "// %s - SOMETHING - %s" "" "example default") +] |
// START - SOMETHING - DO NOT CHANGE THIS COMMENT example default // END - SOMETHING - DO NOT CHANGE THIS COMMENT |
example default
" string can then be carried forward to
the next generation of the output, provided the output
is not named "fname
" and the old output is renamed to
"fname
" before AutoGen-eration begins.
[+ AutoGen5 Template -*- Mode: text -*- h=%s-fsm.h c=%s-fsm.c (shellf "[ -f %1$s-fsm.h ] && mv -f %1$s-fsm.h .fsm.head [ -f %1$s-fsm.c ] && mv -f %1$s-fsm.c .fsm.code" (base-name)) +] |
This code will move the two previously produced output files to files named ".fsm.head" and ".fsm.code". At the end of the 'c' output processing, I delete them.
Arguments:
file-name - name of file with text
marker-fmt - format for marker text
caveat - Optional - warn about changing marker
default - Optional - default initial text
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |