The structure HTML_render_state is accessed in 1/apacs, 3/tc, 3/twot, 5/wt, 5/fm, 5/ptf, 5/tf, 5/df, 6/rw and here.
+
The structure HTML_render_state is accessed in 1/apacs, 3/tc, 3/twot, 5/wt, 5/fm, 5/ptf, 5/tf, 5/df and here.
§3. The initial state is as follows:
diff --git a/docs/inweb/5-ptf.html b/docs/inweb/5-ptf.html
index ccb6b37..cd29411 100644
--- a/docs/inweb/5-ptf.html
+++ b/docs/inweb/5-ptf.html
@@ -131,7 +131,7 @@ function togglePopup(material_id) {
returnTRUE;}
-
The structure PlainText_render_state is accessed in 1/apacs, 3/tc, 3/twot, 5/wt, 5/fm, 5/tf, 5/hf, 5/df, 6/rw and here.
+
The structure PlainText_render_state is accessed in 1/apacs, 3/tc, 3/twot, 5/wt, 5/fm, 5/tf, 5/hf, 5/df and here.
§2.1. Render chapter header2.1 =
diff --git a/docs/inweb/5-tf.html b/docs/inweb/5-tf.html
index f42bcdc..d9012db 100644
--- a/docs/inweb/5-tf.html
+++ b/docs/inweb/5-tf.html
@@ -95,7 +95,7 @@ generic as possible, but with special features depending on Trees::traverse_from(tree->root, &TeX::render_visit, (void *) &trs, 0);}
-
The structure TeX_render_state is accessed in 1/apacs, 3/tc, 3/twot, 5/wt, 5/fm, 5/ptf, 5/hf, 5/df, 6/rw and here.
+
The structure TeX_render_state is accessed in 1/apacs, 3/tc, 3/twot, 5/wt, 5/fm, 5/ptf, 5/hf, 5/df and here.
§4. For the reason why footnotes are omitted, see below: they aren't really.
diff --git a/docs/inweb/5-tu.html b/docs/inweb/5-tu.html
index bf569c3..6d6f013 100644
--- a/docs/inweb/5-tu.html
+++ b/docs/inweb/5-tu.html
@@ -315,13 +315,13 @@ we also look out for {}^3\sqr
@@ -448,14 +448,14 @@ we also look out for {}^3\sqr
if (Str::get_at(text, i) == '\\') {
-Str::clear(macro);
+Str::clear(macro);i++;while ((i < Str::len(text)) && (Characters::isalpha(Str::get_at(text, i))))
-PUT_TO(macro, Str::get_at(text, i++));
-if (Str::eq(macro, I"exists")) PUT((wchar_t) 0x2204);
-elseif (Str::eq(macro, I"forall")) { PUT((wchar_t) 0x00AC); PUT((wchar_t) 0x2200); }
+PUT_TO(macro, Str::get_at(text, i++));
+if (Str::eq(macro, I"exists")) PUT((wchar_t) 0x2204);
+elseif (Str::eq(macro, I"forall")) { PUT((wchar_t) 0x00AC); PUT((wchar_t) 0x2200); }else {
-PRINT("Don't know how to apply '\\not' to '\\%S'\n", macro);
+PRINT("Don't know how to apply '\\not' to '\\%S'\n", macro); } } else {PRINT("Don't know how to apply '\\not' here\n");
diff --git a/docs/inweb/5-wt.html b/docs/inweb/5-wt.html
index 0e8897c..fa74d8f 100644
--- a/docs/inweb/5-wt.html
+++ b/docs/inweb/5-wt.html
@@ -299,7 +299,7 @@ function togglePopup(material_id) {
CLASS_DEFINITION} weave_verbatim_node;
-
The structure weave_document_node is accessed in 3/tc, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_head_node is accessed in 5/tf, 5/hf, 5/df and here.
The structure weave_body_node is private to this section.
The structure weave_tail_node is accessed in 5/tf, 5/hf, 5/df and here.
The structure weave_chapter_header_node is accessed in 5/ptf, 5/tf, 5/df and here.
The structure weave_chapter_footer_node is accessed in 5/ptf, 5/tf, 5/df and here.
The structure weave_section_header_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_section_footer_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_section_purpose_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_subheading_node is accessed in 1/pc, 2/lc, 2/tp, 2/pn, 3/ta, 3/tw, 3/tt, 4/as, 4/cl, 4/is, 5/ptf, 5/tf, 5/hf, 5/df, 6/cs and here.
The structure weave_bar_node is private to this section.
The structure weave_pagebreak_node is private to this section.
The structure weave_linebreak_node is private to this section.
The structure weave_paragraph_heading_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_endnote_node is private to this section.
The structure weave_figure_node is accessed in 1/fm, 1/pp, 1/wp, 8/ws, 4/cl, 5/tf, 5/hf, 5/df, 6/rw and here.
The structure weave_extract_node is accessed in 5/hf and here.
The structure weave_audio_node is accessed in 8/ws, 5/tf, 5/hf, 5/df and here.
The structure weave_video_node is accessed in 1/fm, 1/pp, 1/wp, 8/ws, 4/cl, 5/tf, 5/hf, 5/df, 6/rw and here.
The structure weave_download_node is accessed in 5/hf, 5/df and here.
The structure weave_material_node is accessed in 5/tf, 5/hf, 5/df and here.
The structure weave_embed_node is accessed in 1/fm, 1/pp, 1/wp, 8/ws, 4/cl, 5/ptf, 5/tf, 5/hf, 5/df, 6/rw and here.
The structure weave_pmac_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_vskip_node is accessed in 5/tf, 5/df and here.
The structure weave_chapter_node is accessed in 5/ptf, 5/tf, 5/df and here.
The structure weave_section_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_code_line_node is private to this section.
The structure weave_function_usage_node is accessed in 1/wp, 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_commentary_node is accessed in 1/pc, 2/lc, 2/tp, 2/pn, 3/ta, 3/tw, 3/tt, 4/as, 4/cl, 4/is, 5/ptf, 5/tf, 5/hf, 5/df, 6/cs and here.
The structure weave_carousel_slide_node is accessed in 2/tgs, 5/hf, 5/df and here.
The structure weave_toc_node is accessed in 5/tf, 5/df and here.
The structure weave_toc_line_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_chapter_title_page_node is private to this section.
The structure weave_defn_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_inline_node is private to this section.
The structure weave_locale_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_source_code_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_url_node is accessed in 2/trs, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/rw and here.
The structure weave_footnote_cue_node is accessed in 2/tp, 3/tw, 3/twot, 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_begin_footnote_text_node is accessed in 2/tp, 3/tw, 3/twot, 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_display_line_node is accessed in 1/pc, 2/lc, 2/tp, 2/pn, 3/ta, 3/tw, 3/tt, 4/as, 4/cl, 4/is, 5/ptf, 5/tf, 5/hf, 5/df, 6/cs and here.
The structure weave_function_defn_node is accessed in 1/wp, 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_item_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_grammar_index_node is private to this section.
The structure weave_maths_node is accessed in 2/trs, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/rw and here.
The structure weave_verbatim_node is accessed in 2/trs, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/rw and here.
+
The structure weave_document_node is accessed in 3/tc, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_head_node is accessed in 5/tf, 5/hf, 5/df and here.
The structure weave_body_node is private to this section.
The structure weave_tail_node is accessed in 5/tf, 5/hf, 5/df and here.
The structure weave_chapter_header_node is accessed in 5/ptf, 5/tf, 5/df and here.
The structure weave_chapter_footer_node is accessed in 5/ptf, 5/tf, 5/df and here.
The structure weave_section_header_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_section_footer_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_section_purpose_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_subheading_node is accessed in 1/pc, 2/lc, 2/tp, 2/pn, 3/ta, 3/tw, 3/tt, 4/as, 4/cl, 4/is, 5/ptf, 5/tf, 5/hf, 5/df, 6/cs and here.
The structure weave_bar_node is private to this section.
The structure weave_pagebreak_node is private to this section.
The structure weave_linebreak_node is private to this section.
The structure weave_paragraph_heading_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_endnote_node is private to this section.
The structure weave_figure_node is accessed in 1/fm, 1/pp, 1/wp, 8/ws, 4/cl, 5/tf, 5/hf, 5/df, 6/rw and here.
The structure weave_extract_node is accessed in 5/hf and here.
The structure weave_audio_node is accessed in 8/ws, 5/tf, 5/hf, 5/df and here.
The structure weave_video_node is accessed in 1/fm, 1/pp, 1/wp, 8/ws, 4/cl, 5/tf, 5/hf, 5/df, 6/rw and here.
The structure weave_download_node is accessed in 5/hf, 5/df and here.
The structure weave_material_node is accessed in 5/tf, 5/hf, 5/df and here.
The structure weave_embed_node is accessed in 1/fm, 1/pp, 1/wp, 8/ws, 4/cl, 5/ptf, 5/tf, 5/hf, 5/df, 6/rw and here.
The structure weave_pmac_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_vskip_node is accessed in 5/tf, 5/df and here.
The structure weave_chapter_node is accessed in 5/ptf, 5/tf, 5/df and here.
The structure weave_section_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_code_line_node is private to this section.
The structure weave_function_usage_node is accessed in 1/wp, 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_commentary_node is accessed in 1/pc, 2/lc, 2/tp, 2/pn, 3/ta, 3/tw, 3/tt, 4/as, 4/cl, 4/is, 5/ptf, 5/tf, 5/hf, 5/df, 6/cs and here.
The structure weave_carousel_slide_node is accessed in 2/tgs, 5/hf, 5/df and here.
The structure weave_toc_node is accessed in 5/tf, 5/df and here.
The structure weave_toc_line_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_chapter_title_page_node is private to this section.
The structure weave_defn_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_inline_node is private to this section.
The structure weave_locale_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_source_code_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_url_node is accessed in 2/trs, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_footnote_cue_node is accessed in 2/tp, 3/tw, 3/twot, 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_begin_footnote_text_node is accessed in 2/tp, 3/tw, 3/twot, 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_display_line_node is accessed in 1/pc, 2/lc, 2/tp, 2/pn, 3/ta, 3/tw, 3/tt, 4/as, 4/cl, 4/is, 5/ptf, 5/tf, 5/hf, 5/df, 6/cs and here.
The structure weave_function_defn_node is accessed in 1/wp, 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_item_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_grammar_index_node is private to this section.
The structure weave_maths_node is accessed in 2/trs, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df and here.
The structure weave_verbatim_node is accessed in 2/trs, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df and here.
§2.
diff --git a/docs/inweb/6-gs.html b/docs/inweb/6-gs.html
index 1a7e3dc..2c6acf9 100644
--- a/docs/inweb/6-gs.html
+++ b/docs/inweb/6-gs.html
@@ -61,7 +61,7 @@ function togglePopup(material_id) {
WRITE_TO(header, "# This gitignore was automatically written by inweb -gitignore\n");WRITE_TO(header, "# and is not intended for human editing\n\n");WRITE_TO(STDOUT, "(Read script from %f)\n", prototype);
-Preprocessor::preprocess(prototype, F, header, L, NULL_GENERAL_POINTER);
+Preprocessor::preprocess(prototype, F, header, L, NULL_GENERAL_POINTER, '#');}
§2. Our one non-standard macro simply includes a file of standing material which
diff --git a/docs/inweb/6-mkf.html b/docs/inweb/6-mkf.html
index 547a784..bf56953 100644
--- a/docs/inweb/6-mkf.html
+++ b/docs/inweb/6-mkf.html
@@ -86,7 +86,8 @@ special loop construct.
WRITE_TO(header, "# and is not intended for human editing\n\n");WRITE_TO(STDOUT, "(Read script from %f)\n", prototype);
-Preprocessor::preprocess(prototype, F, header, L, STORE_POINTER_makefile_specifics(specifics));
+Preprocessor::preprocess(prototype, F, header, L,
+STORE_POINTER_makefile_specifics(specifics), '#');}
§1.1. We will allow a makescript to declare "components" (webs, really), so we need
diff --git a/docs/inweb/6-rw.html b/docs/inweb/6-rw.html
index 5a09eaf..9eee223 100644
--- a/docs/inweb/6-rw.html
+++ b/docs/inweb/6-rw.html
@@ -50,277 +50,38 @@ function togglePopup(material_id) {
§1. This is a very simple generator for README.md files, written in Markdown
-syntax, but with a few macro expansions of our own. The prototype file, which
-uses these extra macros, is expanded to the final file, which does not.
-
-
-
As we scan through the prototype file, we keep track of this:
+
§1. This is a simple use of Preprocessor (in foundation). Note that we use a
+non-standard comment syntax (i.e., / at start of line, not #) to avoid
+colliding with Markdown's heading syntax.
§5. So much for creating macros. Now we can write the actual expander. As can
-be seen, it passes material straight through, except for instances of the
-notation @name, possibly followed by a bracketed list of parameters.
-
§6. If we run into the notation @something, it's possible that something is
-the name of a parameter somewhere in the current stack, either on the top
-frame or on frames lower down. The first match wins... and if there are no
-matches, then it must be a macro name.
-
§7. So, then: suppose we have to expand @example(5, gold rings). Then the
-macro_name below is set to example, and the current stack frame contains the
-values 5 and gold rings.
-
§8. An "asset" here is something for which we might want to write the version
+
§3. An "asset" here is something for which we might want to write the version
number of, or some similar metadata for. Assets are usually webs, but can
also be a few other rather Inform-specific things; those have a more limited
range of bibliographic data, just the version and date (and we will not
@@ -337,19 +98,19 @@ assume that the version complies with any format).
CLASS_DEFINITION} writeme_asset;
-voidReadme::write_var(text_stream *OUT, text_stream *program, text_stream *datum) {
-writeme_asset *A = Readme::find_asset(program);
+voidReadme::write_var(text_stream *OUT, text_stream *program, text_stream *datum) {
+writeme_asset *A = Readme::find_asset(program);if (A->if_web) WRITE("%S", Bibliographic::get_datum(A->if_web, datum));elseif (Str::eq(datum, I"Build Date")) WRITE("%S", A->date);elseif (Str::eq(datum, I"Version Number")) WRITE("%S", A->version);}
The structure writeme_asset is accessed in 2/trs, 4/prp, 5/wt, 6/cs, 6/cln and here.
-
§9. That just leaves the business of inspecting assets to obtain their metadata.
+
§4. That just leaves the business of inspecting assets to obtain their metadata.
-writeme_asset *Readme::find_asset(text_stream *program) {
+writeme_asset *Readme::find_asset(text_stream *program) {writeme_asset *A;LOOP_OVER(A, writeme_asset) if (Str::eq(program, A->name)) returnA;A = CREATE(writeme_asset);
@@ -358,70 +119,70 @@ assume that the version complies with any format).
A->date = Str::new();A->version = Str::new();A->next_is_version = FALSE;
-Read in the asset9.1;
+Read in the asset4.1;returnA;}
§1. All-in-one webs. A program written for use with Inweb is called a "web". Inweb was primarily
designed for large, multisection webs, but it can also be used in a much
@@ -811,28 +811,7 @@ not .mkscript
-
§26. Ctags. Each time a web is tangled, Inweb writes a tags file to the web's home
-directory, containing a list of Universal ctags
-for any structures, functions or constant definitions found in the web. You
-need do nothing to make this happen, and can ignore the file if it's of no
-use. If you are editing a web in certain text editors, though, such as
-BBEdit for MacOS, then this
-should make code completion and definition lookup features work.
-
-
-
You can however write the file elsewhere:
-
-
-
-$inweb/Tangled/inweb W -tangle -ctags-to secret_lair/my_nifty.ctags
-
-
or not at all:
-
-
-
-$inweb/Tangled/inweb W -tangle -no-ctags
-
-
§27. README files. Repositories at Github customarily have README.mk files, in Markdown
+
§26. README files. Repositories at Github customarily have README.mk files, in Markdown
syntax, explaining what they are. These of course should probably include
current version numbers, and it's a pain keeping that up to date. For
really complicated repositories, containing multiple webs, some automation
@@ -840,63 +819,22 @@ is essential, and once again Inweb can oblige.
-$inweb/Tangled/inweb W -write-me W/README.mk
+$inweb/Tangled/inweb W -prototype W/W.rmscript -write-me W/README.mk
-
expands a script called READMEscript.txt into README.mk. Alternatively,
-the script can be specified explicitly:
+
The same conventions and notations are used here as for makefiles and gitignores
+(see above), except that the comment character is no longer #, since a #
+at the start of a line means a heading in Markdown. Instead, a line is a comment
+if its first non-whitespace character is a forward-slash /.
-
-$inweb/Tangled/inweb W -prototype MySpecialThang.txt -write-me W/README.mk
-
-
§28. Everything in the script is copied over verbatim except where the @ character
-is used, which was chosen because it isn't significant in Github's form of
-Markdown. @name(args) is like a function call (or, in more traditional
-language, a macro): it expands out to something depending on the arguments.
-args is a comma-separated list of fragments of text, which can themselves
-contain further uses of @. (If these fragments of text need to contain
-commas or brackets, they can be put into single quotes: @thus(4,',') has
-two arguments, 4 and ,.) Three functions are built in:
-
-
-
(a) @version(A) expands to the version number of A, which is normally the
-path to a web; it then produces the value of the [[Version Number]] for
-that web. But A can also be the filename of an Inform extension, provided
-that it ends in .i7x, or a few other Inform-specific things for which
-Inweb is able to deduce a version number.
-
(b) @purpose(A) is the same, but for the [[Purpose]] of a web. It's
-blank for everything else.
-
(c) @var(A,D) is more general, and reads the bibliographic datum D from
-the web indicated by A. In fact, @version(A) is an abbreviation for
-@var(A,Version Number) and @purpose(A) for @var(A,Purpose), so this
-is really the only one needed.
+
● The special makefile macros are not available, though set and repeat are;
+
● The special macro {bibliographic datum: ... of: ...} expands to the value
+of the named bibliographic datum for the program named. Version Number is
+especially useful, and is available even for some Inform assets which are not
+webs and do not therefore have bibliographic data of their own — interpreter
+templates and Inform 7 extensions, for example.
-
§29. It is also possible to define new functions. For example:
-
-
-
- @define book(title, path, topic)
- * @title - @topic. Ebook in Indoc format, stored at path @path.
- @end
-
-
The definition lies between @define and @end commands. This one takes
-three parameters, and inside the definition, their values can be referred
-to as @title, @path and @topic. Functions are free to use other
-functions:
-
However, each function needs to have been defined before any line on which
-it is actually expanded. A definition of one function A can refer to another
-function B not yet defined; but any actual use of A must be made after
-both A and B have been defined. So, basically, declare before use.
-
-
-
§30. Semantic version numbering and build metadata. When Inweb reads in a web, it also looks for a file called build.txt in
+
§27. Semantic version numbering and build metadata. When Inweb reads in a web, it also looks for a file called build.txt in
the web's directory; if that isn't there, it looks for the same file in the
current working directory; if that's not there either, never mind.
§31. A special advancing mechanism exists to update build numbers and dates.
+
§28. A special advancing mechanism exists to update build numbers and dates.
Running Inweb with -advance-build W checks the build date for web W:
if it differs from today, then it is changed to today, and the build code
is advanced by one.
@@ -939,6 +877,27 @@ is advanced by one.
without need of a web.
+
§29. Ctags. Each time a web is tangled, Inweb writes a tags file to the web's home
+directory, containing a list of Universal ctags
+for any structures, functions or constant definitions found in the web. You
+need do nothing to make this happen, and can ignore the file if it's of no
+use. If you are editing a web in certain text editors, though, such as
+BBEdit for MacOS, then this
+should make code completion and definition lookup features work.
+
+
+
You can however write the file elsewhere:
+
+
+
+$inweb/Tangled/inweb W -tangle -ctags-to secret_lair/my_nifty.ctags
+
+
or not at all:
+
+
+
+$inweb/Tangled/inweb W -tangle -no-ctags
+
diff --git a/foundation-module/Chapter 4/Preprocessor.w b/foundation-module/Chapter 4/Preprocessor.w
index 8ada442..a493179 100644
--- a/foundation-module/Chapter 4/Preprocessor.w
+++ b/foundation-module/Chapter 4/Preprocessor.w
@@ -21,7 +21,7 @@ pointer to any data those special meanings need to use.
=
void Preprocessor::preprocess(filename *prototype, filename *F, text_stream *header,
- linked_list *special_macros, general_pointer specifics) {
+ linked_list *special_macros, general_pointer specifics, wchar_t comment_char) {
struct text_stream processed_file;
if (STREAM_OPEN_TO_FILE(&processed_file, F, ISO_ENC) == FALSE)
Errors::fatal_with_file("unable to write tangled file", F);
@@ -53,6 +53,7 @@ typedef struct preprocessor_state {
struct preprocessor_variable_set *stack_frame;
struct linked_list *known_macros; /* of |preprocessor_macro| */
struct general_pointer specifics;
+ wchar_t comment_character;
} preprocessor_state;
typedef struct preprocessor_loop {
@@ -73,6 +74,7 @@ typedef struct preprocessor_loop {
PPS.stack_frame = PPS.global_variables;
PPS.known_macros = Preprocessor::list_of_reserved_macros(special_macros);
PPS.specifics = specifics;
+ PPS.comment_character = comment_char;
@ Conceptually, each loop runs a variable with a given name through a series
of textual values in sequence, and we store that data here:
@@ -95,17 +97,24 @@ parametrised names: but then, nor should you.
=
void Preprocessor::scan_line(text_stream *line, text_file_position *tfp, void *X) {
preprocessor_state *PPS = (preprocessor_state *) X;
- match_results mr = Regexp::create_mr();
@;
@;
Preprocessor::expand(line, tfp, PPS);
@;
}
+@ A line is a comment to the preprocessor if its first non-whitespace character
+is the special comment character: often |#|, but not necessarily.
+
@ =
- if (Regexp::match(&mr, line, L" *#%c*")) { Regexp::dispose_of(&mr); return; }
+ LOOP_THROUGH_TEXT(pos, line) {
+ wchar_t c = Str::get(pos);
+ if (c == PPS->comment_character) return;
+ if (Characters::is_whitespace(c) == FALSE) break;
+ }
@ =
+ match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, line, L" *{define: *(%C+) (%c*)} *")) @;
if (Regexp::match(&mr, line, L" *{end-define} *")) @;
if (PPS->defining) @;
@@ -635,6 +644,11 @@ linked_list *Preprocessor::list_of_reserved_macros(linked_list *special_macros)
return L;
}
+void Preprocessor::do_not_suppress_whitespace(preprocessor_macro *mm) {
+ mm->suppress_newline_after_expanding = FALSE;
+ mm->suppress_whitespace_when_expanding = FALSE;
+}
+
void Preprocessor::new_loop_macro(linked_list *L, text_stream *name,
text_stream *parameter_specification,
void (*expander)(preprocessor_macro *, preprocessor_state *, text_stream **, preprocessor_loop *, text_file_position *),
@@ -657,18 +671,16 @@ void Preprocessor::new_loop_macro(linked_list *L, text_stream *name,
mm = Preprocessor::new_macro(L, subname, parameter_specification, expander, tfp);
mm->begins_loop = TRUE;
mm->loop_name = Str::duplicate(name);
- mm->suppress_newline_after_expanding = FALSE;
- mm->suppress_whitespace_when_expanding = FALSE;
mm->span = TRUE;
+ Preprocessor::do_not_suppress_whitespace(mm);
Str::clear(subname);
WRITE_TO(subname, "end-%S-span", name);
mm = Preprocessor::new_macro(L, subname, NULL, Preprocessor::end_loop_expander, tfp);
mm->ends_loop = TRUE;
mm->loop_name = Str::duplicate(name);
- mm->suppress_newline_after_expanding = FALSE;
- mm->suppress_whitespace_when_expanding = FALSE;
mm->span = TRUE;
+ Preprocessor::do_not_suppress_whitespace(mm);
DISCARD_TEXT(subname)
}
diff --git a/inweb.mk b/inweb.mk
index 80401f6..d153271 100644
--- a/inweb.mk
+++ b/inweb.mk
@@ -111,7 +111,7 @@ test:
.PHONY: commit
commit:
$(INWEB) -advance-build-file $(ME)/build.txt
- $(INWEB) -prototype inweb/scripts/READMEscript.txt -write-me inweb/README.md
+ $(INWEB) -prototype inweb/scripts/inweb.rmscript -write-me inweb/README.md
cd $(ME); git commit -a
.PHONY: pages
@@ -130,7 +130,7 @@ pages:
rm -f $(ME)/docs/docs-assets/*.png
rm -f $(ME)/docs/docs-assets/*.gif
cp -f $(ME)/docs-src/Octagram.png $(ME)/docs/docs-assets/Octagram.png
- $(INWEB) -prototype inweb/scripts/READMEscript.txt -write-me inweb/README.md
+ $(INWEB) -prototype inweb/scripts/inweb.rmscript -write-me inweb/README.md
mkdir -p $(ME)/docs/inweb
rm -f $(ME)/docs/inweb/*.html
mkdir -p $(ME)/docs/goldbach
diff --git a/scripts/inweb.mkscript b/scripts/inweb.mkscript
index 720f1e3..3926b3d 100644
--- a/scripts/inweb.mkscript
+++ b/scripts/inweb.mkscript
@@ -131,7 +131,7 @@ test:
.PHONY: commit
commit:
$(INWEB) -advance-build-file $(ME)/build.txt
- $(INWEB) -prototype inweb/scripts/READMEscript.txt -write-me inweb/README.md
+ $(INWEB) -prototype inweb/scripts/inweb.rmscript -write-me inweb/README.md
cd $(ME); git commit -a
# Weaving the web for GitHub Pages:
@@ -152,7 +152,7 @@ pages:
rm -f $(ME)/docs/docs-assets/*.png
rm -f $(ME)/docs/docs-assets/*.gif
cp -f $(ME)/docs-src/Octagram.png $(ME)/docs/docs-assets/Octagram.png
- $(INWEB) -prototype inweb/scripts/READMEscript.txt -write-me inweb/README.md
+ $(INWEB) -prototype inweb/scripts/inweb.rmscript -write-me inweb/README.md
mkdir -p $(ME)/docs/inweb
rm -f $(ME)/docs/inweb/*.html
mkdir -p $(ME)/docs/goldbach
diff --git a/scripts/READMEscript.txt b/scripts/inweb.rmscript
similarity index 93%
rename from scripts/READMEscript.txt
rename to scripts/inweb.rmscript
index 7cfb57b..98b3e0f 100644
--- a/scripts/READMEscript.txt
+++ b/scripts/inweb.rmscript
@@ -1,6 +1,6 @@
-# Inweb @var(inweb,Version Number)
+# Inweb {bibliographic datum: Version Number of: inweb}
-v@var(inweb,Semantic Version Number) '@var(inweb,Version Name)' (@var(inweb,Build Date))
+v{bibliographic datum: Semantic Version Number of: inweb} '{bibliographic datum: Version Name of: inweb}' ({bibliographic datum: Build Date of: inweb})
## About Inweb
@@ -85,4 +85,4 @@ If you have also built Intest as "work/intest", then you can try these:
### Colophon
This README.mk file was generated automatically by Inweb, and should not
-be edited. To make changes, edit scripts/READMEscript.txt and re-generate.
+be edited. To make changes, edit inweb.rmscript and re-generate.