diff --git a/.gitignore b/.gitignore
index c25dffe..d2b8821 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,7 +23,7 @@ Examples/goldbach/Woven
Tests/Test Cases/_Scan_Actual/
Tests/Test Cases/_Tangled_Actual/
Tests/Test Cases/_Tangled_Console/
-Tests/Test Cases/_Woven_Actual/
-Tests/Test Cases/_Woven_Console/
Tests/Test Painter/_Results_Actual/
+Tests/Test Weave Tree/_Results_Actual/
+Tests/Test Weave Tree/_Results_Console/
diff --git a/Chapter 5/HTML Formats.w b/Chapter 5/HTML Formats.w
index f352fe2..b3e64d7 100644
--- a/Chapter 5/HTML Formats.w
+++ b/Chapter 5/HTML Formats.w
@@ -293,11 +293,13 @@ int HTMLFormat::render_visit(tree_node *N, void *state, int L) {
if (first_in_para) {
HTMLFormat::cp(OUT);
}
- TEMPORARY_TEXT(csname);
- WRITE_TO(csname, "%S-Colours", C->styling->language_name);
- hrs->colours = Swarm::ensure_colour_scheme(hrs->wv,
- csname, C->styling->language_name);
- DISCARD_TEXT(csname);
+ if (C->styling) {
+ TEMPORARY_TEXT(csname);
+ WRITE_TO(csname, "%S-Colours", C->styling->language_name);
+ hrs->colours = Swarm::ensure_colour_scheme(hrs->wv,
+ csname, C->styling->language_name);
+ DISCARD_TEXT(csname);
+ }
TEMPORARY_TEXT(cl);
WRITE_TO(cl, "%S", hrs->colours->prefix);
if (C->plainly) WRITE_TO(cl, "undisplayed-code");
diff --git a/Patterns/TestingInweb/pattern.txt b/Patterns/TestingInweb/pattern.txt
index bba578b..d075da3 100644
--- a/Patterns/TestingInweb/pattern.txt
+++ b/Patterns/TestingInweb/pattern.txt
@@ -1,2 +1,3 @@
name: TestingInweb
format: Debugging
+default range: sections
diff --git a/README.md b/README.md
index 1a2ef87..fae08c1 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Inweb 7
-v7-alpha.1+1A27 'Escape to Danger' (22 April 2020)
+v7-alpha.1+1A28 'Escape to Danger' (23 April 2020)
## About Inweb
diff --git a/Tangled/inweb.c b/Tangled/inweb.c
index afb64b3..f36bc18 100644
--- a/Tangled/inweb.c
+++ b/Tangled/inweb.c
@@ -4169,29 +4169,29 @@ void HTMLFormat__render_EPUB(weave_format *self, text_stream *OUT, heterogeneou
void HTMLFormat__render_inner(weave_format *self, text_stream *OUT, heterogeneous_tree *tree, int EPUB_mode) ;
#line 148 "inweb/Chapter 5/HTML Formats.w"
int HTMLFormat__render_visit(tree_node *N, void *state, int L) ;
-#line 614 "inweb/Chapter 5/HTML Formats.w"
+#line 616 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__subheading(weave_format *self, text_stream *OUT, weave_order *wv, int level, text_stream *comment, text_stream *head) ;
-#line 631 "inweb/Chapter 5/HTML Formats.w"
+#line 633 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__paragraph_heading(weave_format *self, text_stream *OUT, weave_order *wv, section *S, paragraph *P, text_stream *heading_text, int weight, int no_skip) ;
-#line 652 "inweb/Chapter 5/HTML Formats.w"
+#line 654 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__source_code(weave_format *self, text_stream *OUT, weave_order *wv, text_stream *matter, text_stream *colouring, colour_scheme *cs) ;
-#line 674 "inweb/Chapter 5/HTML Formats.w"
+#line 676 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__embed(weave_format *self, text_stream *OUT, weave_order *wv, text_stream *service, text_stream *ID, int w, int h) ;
-#line 700 "inweb/Chapter 5/HTML Formats.w"
+#line 702 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__para_macro(weave_format *self, text_stream *OUT, weave_order *wv, para_macro *pmac, int defn) ;
-#line 715 "inweb/Chapter 5/HTML Formats.w"
+#line 717 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__change_colour(weave_format *self, text_stream *OUT, weave_order *wv, int col, int in_code, colour_scheme *cs) ;
-#line 736 "inweb/Chapter 5/HTML Formats.w"
+#line 738 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__commentary_text(weave_format *self, text_stream *OUT, weave_order *wv, text_stream *id) ;
-#line 755 "inweb/Chapter 5/HTML Formats.w"
+#line 757 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__escape_text(text_stream *OUT, text_stream *id) ;
-#line 765 "inweb/Chapter 5/HTML Formats.w"
+#line 767 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__locale(weave_format *self, text_stream *OUT, weave_order *wv, paragraph *par1, paragraph *par2) ;
-#line 779 "inweb/Chapter 5/HTML Formats.w"
+#line 781 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__tail(weave_format *self, text_stream *OUT, weave_order *wv, section *this_S) ;
-#line 821 "inweb/Chapter 5/HTML Formats.w"
+#line 823 "inweb/Chapter 5/HTML Formats.w"
int HTMLFormat__begin_weaving_EPUB(weave_format *wf, web *W, weave_pattern *pattern) ;
-#line 836 "inweb/Chapter 5/HTML Formats.w"
+#line 838 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__end_weaving_EPUB(weave_format *wf, web *W, weave_pattern *pattern) ;
#line 9 "inweb/Chapter 5/Debugging Format.w"
void Debugging__create(void) ;
@@ -25750,7 +25750,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
text_stream *OUT = hrs->OUT;
if (N->type == weave_document_node_type)
{
-#line 611 "inweb/Chapter 5/HTML Formats.w"
+#line 613 "inweb/Chapter 5/HTML Formats.w"
;
}
@@ -25768,7 +25768,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_body_node_type)
{
-#line 611 "inweb/Chapter 5/HTML Formats.w"
+#line 613 "inweb/Chapter 5/HTML Formats.w"
;
}
@@ -25785,7 +25785,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_verbatim_node_type)
{
-#line 573 "inweb/Chapter 5/HTML Formats.w"
+#line 575 "inweb/Chapter 5/HTML Formats.w"
weave_verbatim_node *C = RETRIEVE_POINTER_weave_verbatim_node(N->content);
WRITE("%S", C->content);
@@ -25794,7 +25794,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_chapter_header_node_type)
{
-#line 611 "inweb/Chapter 5/HTML Formats.w"
+#line 613 "inweb/Chapter 5/HTML Formats.w"
;
}
@@ -25802,7 +25802,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_chapter_footer_node_type)
{
-#line 611 "inweb/Chapter 5/HTML Formats.w"
+#line 613 "inweb/Chapter 5/HTML Formats.w"
;
}
@@ -25945,11 +25945,13 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
if (first_in_para) {
HTMLFormat__cp(OUT);
}
- TEMPORARY_TEXT(csname);
- WRITE_TO(csname, "%S-Colours", C->styling->language_name);
- hrs->colours = Swarm__ensure_colour_scheme(hrs->wv,
- csname, C->styling->language_name);
- DISCARD_TEXT(csname);
+ if (C->styling) {
+ TEMPORARY_TEXT(csname);
+ WRITE_TO(csname, "%S-Colours", C->styling->language_name);
+ hrs->colours = Swarm__ensure_colour_scheme(hrs->wv,
+ csname, C->styling->language_name);
+ DISCARD_TEXT(csname);
+ }
TEMPORARY_TEXT(cl);
WRITE_TO(cl, "%S", hrs->colours->prefix);
if (C->plainly) WRITE_TO(cl, "undisplayed-code");
@@ -26017,7 +26019,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_embed_node_type)
{
-#line 368 "inweb/Chapter 5/HTML Formats.w"
+#line 370 "inweb/Chapter 5/HTML Formats.w"
weave_embed_node *C = RETRIEVE_POINTER_weave_embed_node(N->content);
HTMLFormat__embed(hrs->wv->format, OUT, hrs->wv, C->service, C->ID, C->w, C->h);
@@ -26026,7 +26028,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_pmac_node_type)
{
-#line 372 "inweb/Chapter 5/HTML Formats.w"
+#line 374 "inweb/Chapter 5/HTML Formats.w"
weave_pmac_node *C = RETRIEVE_POINTER_weave_pmac_node(N->content);
HTMLFormat__para_macro(hrs->wv->format, OUT, hrs->wv, C->pmac, C->defn);
@@ -26035,7 +26037,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_vskip_node_type)
{
-#line 376 "inweb/Chapter 5/HTML Formats.w"
+#line 378 "inweb/Chapter 5/HTML Formats.w"
weave_vskip_node *C = RETRIEVE_POINTER_weave_vskip_node(N->content);
if (C->in_comment) {
HTMLFormat__exit_current_paragraph(OUT);
@@ -26049,7 +26051,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_apres_defn_node_type)
{
-#line 611 "inweb/Chapter 5/HTML Formats.w"
+#line 613 "inweb/Chapter 5/HTML Formats.w"
;
}
@@ -26057,7 +26059,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_chapter_node_type)
{
-#line 611 "inweb/Chapter 5/HTML Formats.w"
+#line 613 "inweb/Chapter 5/HTML Formats.w"
;
}
@@ -26065,7 +26067,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_section_node_type)
{
-#line 385 "inweb/Chapter 5/HTML Formats.w"
+#line 387 "inweb/Chapter 5/HTML Formats.w"
weave_section_node *C = RETRIEVE_POINTER_weave_section_node(N->content);
LOG("It was %d\n", C->allocation_id);
@@ -26074,7 +26076,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_code_line_node_type)
{
-#line 389 "inweb/Chapter 5/HTML Formats.w"
+#line 391 "inweb/Chapter 5/HTML Formats.w"
for (tree_node *M = N->child; M; M = M->next)
Trees__traverse_from(M, &HTMLFormat__render_visit, (void *) hrs, L+1);
WRITE("\n");
@@ -26085,7 +26087,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_function_usage_node_type)
{
-#line 395 "inweb/Chapter 5/HTML Formats.w"
+#line 397 "inweb/Chapter 5/HTML Formats.w"
weave_function_usage_node *C = RETRIEVE_POINTER_weave_function_usage_node(N->content);
HTML__begin_link_with_class(OUT, TL_IS_538, C->url);
HTMLFormat__change_colour(NULL, OUT, hrs->wv, FUNCTION_COLOUR, FALSE, hrs->colours);
@@ -26098,7 +26100,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_commentary_node_type)
{
-#line 403 "inweb/Chapter 5/HTML Formats.w"
+#line 405 "inweb/Chapter 5/HTML Formats.w"
weave_commentary_node *C = RETRIEVE_POINTER_weave_commentary_node(N->content);
if (C->in_code) HTML_OPEN_WITH("span", "class=\"comment\"");
HTMLFormat__commentary_text(hrs->wv->format, OUT, hrs->wv, C->text);
@@ -26109,7 +26111,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_carousel_slide_node_type)
{
-#line 409 "inweb/Chapter 5/HTML Formats.w"
+#line 411 "inweb/Chapter 5/HTML Formats.w"
weave_carousel_slide_node *C = RETRIEVE_POINTER_weave_carousel_slide_node(N->content);
Swarm__ensure_plugin(hrs->wv, TL_IS_539);
TEMPORARY_TEXT(carousel_id)
@@ -26141,12 +26143,12 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
if (C->caption_command == CAROUSEL_ABOVE_CMD) {
{
-#line 470 "inweb/Chapter 5/HTML Formats.w"
+#line 472 "inweb/Chapter 5/HTML Formats.w"
if (C->caption_command != CAROUSEL_UNCAPTIONED_CMD)
WRITE("
%S
\n", caption_class, C->caption);
}
-#line 438 "inweb/Chapter 5/HTML Formats.w"
+#line 440 "inweb/Chapter 5/HTML Formats.w"
;
WRITE("%d / %d
\n", slide_count_class, hrs->slide_number, hrs->slide_of);
} else {
@@ -26158,12 +26160,12 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
WRITE("\n");
if (C->caption_command != CAROUSEL_ABOVE_CMD)
{
-#line 470 "inweb/Chapter 5/HTML Formats.w"
+#line 472 "inweb/Chapter 5/HTML Formats.w"
if (C->caption_command != CAROUSEL_UNCAPTIONED_CMD)
WRITE("%S
\n", caption_class, C->caption);
}
-#line 447 "inweb/Chapter 5/HTML Formats.w"
+#line 449 "inweb/Chapter 5/HTML Formats.w"
;
WRITE("\n");
if (hrs->slide_number == hrs->slide_of) {
@@ -26191,7 +26193,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_toc_node_type)
{
-#line 474 "inweb/Chapter 5/HTML Formats.w"
+#line 476 "inweb/Chapter 5/HTML Formats.w"
HTMLFormat__exit_current_paragraph(OUT);
HTML_OPEN_WITH("ul", "class=\"toc\"");
for (tree_node *M = N->child; M; M = M->next) {
@@ -26209,7 +26211,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_toc_line_node_type)
{
-#line 487 "inweb/Chapter 5/HTML Formats.w"
+#line 489 "inweb/Chapter 5/HTML Formats.w"
weave_toc_line_node *C = RETRIEVE_POINTER_weave_toc_line_node(N->content);
TEMPORARY_TEXT(TEMP)
Colonies__paragraph_URL(TEMP, C->para, hrs->wv->weave_to);
@@ -26225,7 +26227,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_chapter_title_page_node_type)
{
-#line 498 "inweb/Chapter 5/HTML Formats.w"
+#line 500 "inweb/Chapter 5/HTML Formats.w"
weave_chapter_title_page_node *C = RETRIEVE_POINTER_weave_chapter_title_page_node(N->content);
LOG("It was %d\n", C->allocation_id);
@@ -26234,7 +26236,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_defn_node_type)
{
-#line 502 "inweb/Chapter 5/HTML Formats.w"
+#line 504 "inweb/Chapter 5/HTML Formats.w"
weave_defn_node *C = RETRIEVE_POINTER_weave_defn_node(N->content);
HTML_OPEN_WITH("span", "class=\"definition-keyword\"");
WRITE("%S", C->keyword);
@@ -26246,7 +26248,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_source_code_node_type)
{
-#line 509 "inweb/Chapter 5/HTML Formats.w"
+#line 511 "inweb/Chapter 5/HTML Formats.w"
weave_source_code_node *C = RETRIEVE_POINTER_weave_source_code_node(N->content);
int starts = FALSE;
if (N == N->parent->child) starts = TRUE;
@@ -26258,7 +26260,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_url_node_type)
{
-#line 516 "inweb/Chapter 5/HTML Formats.w"
+#line 518 "inweb/Chapter 5/HTML Formats.w"
weave_url_node *C = RETRIEVE_POINTER_weave_url_node(N->content);
HTML__begin_link_with_class(OUT, (C->external)?TL_IS_546:TL_IS_547, C->url);
WRITE("%S", C->content);
@@ -26269,7 +26271,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_footnote_cue_node_type)
{
-#line 522 "inweb/Chapter 5/HTML Formats.w"
+#line 524 "inweb/Chapter 5/HTML Formats.w"
weave_footnote_cue_node *C = RETRIEVE_POINTER_weave_footnote_cue_node(N->content);
text_stream *fn_plugin_name = hrs->wv->pattern->footnotes_plugin;
if (Str__len(fn_plugin_name) > 0)
@@ -26282,7 +26284,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_begin_footnote_text_node_type)
{
-#line 530 "inweb/Chapter 5/HTML Formats.w"
+#line 532 "inweb/Chapter 5/HTML Formats.w"
weave_begin_footnote_text_node *C = RETRIEVE_POINTER_weave_begin_footnote_text_node(N->content);
text_stream *fn_plugin_name = hrs->wv->pattern->footnotes_plugin;
if (Str__len(fn_plugin_name) > 0)
@@ -26298,7 +26300,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_display_line_node_type)
{
-#line 541 "inweb/Chapter 5/HTML Formats.w"
+#line 543 "inweb/Chapter 5/HTML Formats.w"
weave_display_line_node *C = RETRIEVE_POINTER_weave_display_line_node(N->content);
HTMLFormat__exit_current_paragraph(OUT);
HTML_OPEN("blockquote"); WRITE("\n"); INDENT;
@@ -26312,7 +26314,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_function_defn_node_type)
{
-#line 550 "inweb/Chapter 5/HTML Formats.w"
+#line 552 "inweb/Chapter 5/HTML Formats.w"
weave_function_defn_node *C = RETRIEVE_POINTER_weave_function_defn_node(N->content);
Swarm__ensure_plugin(hrs->wv, TL_IS_548);
HTMLFormat__change_colour(NULL, OUT, hrs->wv, FUNCTION_COLOUR, FALSE, hrs->colours);
@@ -26334,7 +26336,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_item_node_type)
{
-#line 567 "inweb/Chapter 5/HTML Formats.w"
+#line 569 "inweb/Chapter 5/HTML Formats.w"
weave_item_node *C = RETRIEVE_POINTER_weave_item_node(N->content);
HTMLFormat__go_to_depth(OUT, C->depth);
if (Str__len(C->label) > 0) WRITE("(%S) ", C->label);
@@ -26345,7 +26347,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_grammar_index_node_type)
{
-#line 611 "inweb/Chapter 5/HTML Formats.w"
+#line 613 "inweb/Chapter 5/HTML Formats.w"
;
}
@@ -26353,7 +26355,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_inline_node_type)
{
-#line 577 "inweb/Chapter 5/HTML Formats.w"
+#line 579 "inweb/Chapter 5/HTML Formats.w"
HTML_OPEN_WITH("span", "class=\"extract\"");
for (tree_node *M = N->child; M; M = M->next)
Trees__traverse_from(M, &HTMLFormat__render_visit, (void *) hrs, L+1);
@@ -26365,7 +26367,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_locale_node_type)
{
-#line 584 "inweb/Chapter 5/HTML Formats.w"
+#line 586 "inweb/Chapter 5/HTML Formats.w"
weave_locale_node *C = RETRIEVE_POINTER_weave_locale_node(N->content);
TEMPORARY_TEXT(TEMP)
Colonies__paragraph_URL(TEMP, C->par1, hrs->wv->weave_to);
@@ -26382,7 +26384,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
else if (N->type == weave_maths_node_type)
{
-#line 596 "inweb/Chapter 5/HTML Formats.w"
+#line 598 "inweb/Chapter 5/HTML Formats.w"
weave_maths_node *C = RETRIEVE_POINTER_weave_maths_node(N->content);
text_stream *plugin_name = hrs->wv->pattern->mathematics_plugin;
if (Str__len(plugin_name) == 0) {
@@ -26404,7 +26406,7 @@ int HTMLFormat__render_visit(tree_node *N, void *state, int L) {
return TRUE;
}
-#line 614 "inweb/Chapter 5/HTML Formats.w"
+#line 616 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__subheading(weave_format *self, text_stream *OUT, weave_order *wv,
int level, text_stream *comment, text_stream *head) {
HTMLFormat__exit_current_paragraph(OUT);
@@ -26419,7 +26421,7 @@ void HTMLFormat__subheading(weave_format *self, text_stream *OUT, weave_order *w
}
}
-#line 629 "inweb/Chapter 5/HTML Formats.w"
+#line 631 "inweb/Chapter 5/HTML Formats.w"
section *page_section = NULL;
void HTMLFormat__paragraph_heading(weave_format *self, text_stream *OUT,
@@ -26442,14 +26444,14 @@ void HTMLFormat__paragraph_heading(weave_format *self, text_stream *OUT,
HTML_CLOSE("b");
}
-#line 652 "inweb/Chapter 5/HTML Formats.w"
+#line 654 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__source_code(weave_format *self, text_stream *OUT, weave_order *wv,
text_stream *matter, text_stream *colouring, colour_scheme *cs) {
int current_colour = -1, colour_wanted = PLAIN_COLOUR;
for (int i=0; i < Str__len(matter); i++) {
colour_wanted = Str__get_at(colouring, i);
{
-#line 667 "inweb/Chapter 5/HTML Formats.w"
+#line 669 "inweb/Chapter 5/HTML Formats.w"
if (colour_wanted != current_colour) {
if (current_colour >= 0) HTML_CLOSE("span");
HTMLFormat__change_colour(NULL, OUT, wv, colour_wanted, TRUE, cs);
@@ -26457,7 +26459,7 @@ void HTMLFormat__source_code(weave_format *self, text_stream *OUT, weave_order *
}
}
-#line 656 "inweb/Chapter 5/HTML Formats.w"
+#line 658 "inweb/Chapter 5/HTML Formats.w"
;
if (Str__get_at(matter, i) == '<') WRITE("<");
else if (Str__get_at(matter, i) == '>') WRITE(">");
@@ -26468,7 +26470,7 @@ void HTMLFormat__source_code(weave_format *self, text_stream *OUT, weave_order *
current_colour = -1;
}
-#line 674 "inweb/Chapter 5/HTML Formats.w"
+#line 676 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__embed(weave_format *self, text_stream *OUT, weave_order *wv,
text_stream *service, text_stream *ID, int w, int h) {
text_stream *CH = TL_IS_549;
@@ -26494,7 +26496,7 @@ void HTMLFormat__embed(weave_format *self, text_stream *OUT, weave_order *wv,
WRITE("\n");
}
-#line 700 "inweb/Chapter 5/HTML Formats.w"
+#line 702 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__para_macro(weave_format *self, text_stream *OUT, weave_order *wv,
para_macro *pmac, int defn) {
paragraph *P = pmac->defining_paragraph;
@@ -26509,7 +26511,7 @@ void HTMLFormat__para_macro(weave_format *self, text_stream *OUT, weave_order *w
WRITE(">%s", (defn)?" =":"");
}
-#line 715 "inweb/Chapter 5/HTML Formats.w"
+#line 717 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__change_colour(weave_format *self, text_stream *OUT, weave_order *wv,
int col, int in_code, colour_scheme *cs) {
char *cl = "plain";
@@ -26530,7 +26532,7 @@ void HTMLFormat__change_colour(weave_format *self, text_stream *OUT, weave_order
HTML_OPEN_WITH("span", "class=\"%S%s\"", cs->prefix, cl);
}
-#line 736 "inweb/Chapter 5/HTML Formats.w"
+#line 738 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__commentary_text(weave_format *self, text_stream *OUT, weave_order *wv,
text_stream *id) {
for (int i=0; i < Str__len(id); i++) {
@@ -26559,7 +26561,7 @@ void HTMLFormat__escape_text(text_stream *OUT, text_stream *id) {
}
}
-#line 765 "inweb/Chapter 5/HTML Formats.w"
+#line 767 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__locale(weave_format *self, text_stream *OUT, weave_order *wv,
paragraph *par1, paragraph *par2) {
TEMPORARY_TEXT(TEMP)
@@ -26573,7 +26575,7 @@ void HTMLFormat__locale(weave_format *self, text_stream *OUT, weave_order *wv,
HTML__end_link(OUT);
}
-#line 779 "inweb/Chapter 5/HTML Formats.w"
+#line 781 "inweb/Chapter 5/HTML Formats.w"
void HTMLFormat__tail(weave_format *self, text_stream *OUT, weave_order *wv, section *this_S) {
HTMLFormat__exit_current_paragraph(OUT);
chapter *C = this_S->owning_chapter;
@@ -26613,7 +26615,7 @@ void HTMLFormat__tail(weave_format *self, text_stream *OUT, weave_order *wv, sec
}
}
-#line 821 "inweb/Chapter 5/HTML Formats.w"
+#line 823 "inweb/Chapter 5/HTML Formats.w"
int HTMLFormat__begin_weaving_EPUB(weave_format *wf, web *W, weave_pattern *pattern) {
TEMPORARY_TEXT(T)
WRITE_TO(T, "%S", Bibliographic__get_datum(W->md, TL_IS_556));
diff --git a/Tests/Test Cases/_Scan_Ideal/twinprimes.txt b/Tests/Test Cases/_Scan_Ideal/twinprimes.txt
index a5aeab0..1ef49fa 100644
--- a/Tests/Test Cases/_Scan_Ideal/twinprimes.txt
+++ b/Tests/Test Cases/_Scan_Ideal/twinprimes.txt
@@ -4,7 +4,7 @@ Scan of source lines for '0'
0000002 COMMENT_BODY........
0000003 PURPOSE............. Implied Purpose: This example of using inweb is a whole web in a single short file, to look for twin primes, a classic problem in number theory.
0000004 COMMENT_BODY........
-0000005 PB_PARAGRAPH_START.. @h The conjecture.
+0000005 HEADING_START....... @h The conjecture.
0000006 COMMENT_BODY........ It is widely believed that there are an infinite number of twin primes, that
0000007 COMMENT_BODY........ is, prime numbers occurring in pairs different by 2. Twins are known to exist
0000008 COMMENT_BODY........ at least as far out as $10^{388,342}$ (as of 2016), and there are infinitely
@@ -35,7 +35,7 @@ Scan of source lines for '0'
0000033 CODE_BODY........... if ((isprime(i)) && (isprime(i+2)))
0000034 CODE_BODY........... printf("%d and %d\n", i, i+2);
0000035 CODE_BODY...........
-0000036 PB_PARAGRAPH_START.. @h Primality.
+0000036 HEADING_START....... @h Primality.
0000037 COMMENT_BODY........ This simple and slow test tries to divide by every whole number at least
0000038 COMMENT_BODY........ 2 and up to the square root: if none divide exactly, the number is prime.
0000039 COMMENT_BODY........ A common error with this algorithm is to check where $m^2 < n$, rather
diff --git a/Tests/Test Cases/_Woven_Ideal/conditional.html b/Tests/Test Cases/_Woven_Ideal/conditional.html
deleted file mode 100644
index 918985a..0000000
--- a/Tests/Test Cases/_Woven_Ideal/conditional.html
+++ /dev/null
@@ -1,539 +0,0 @@
-
-
-
- Complete Program
-
-
-
-
-
-
-
-
-
-A minimal example of a C program written for inweb.
-
-§1.
-
-
- # include < stdio . h >
-
- int main ( int argc , char * argv []) {
- printf ( "Hello world!\n" );
- }
-
-
-
-
-§2.
-
-
-
- define PEACH 1
- enum A_COM from 1
- enum B_COM
- enum C_COM
-
-
-
- # include "nonexistent.h"
-
- typedef struct bong {
- int f ;
- } bong ;
-
- void banana ( int n ) {
- }
-
-
-
-
-This paragraph is used only if PLATFORM_WINDOWS is defined.
-
-The structure bong is private to this section.
-
-§3.
-
-
- # include "existent.h"
-
- typedef struct bong {
- unsigned int f ;
- } bong ;
-
-
-
-
-This paragraph is used only if POSIX is defined and if PLATFORM_WINDOWS is undefined.
-
-The structure bong is private to this section.
-
-
-
-
-
-
-
-
diff --git a/Tests/Test Cases/_Woven_Ideal/empty.html b/Tests/Test Cases/_Woven_Ideal/empty.html
deleted file mode 100644
index a739376..0000000
--- a/Tests/Test Cases/_Woven_Ideal/empty.html
+++ /dev/null
@@ -1,490 +0,0 @@
-
-
-
- Complete Program
-
-
-
-
-
-
-
-
-
-A minimal example of a C program written for inweb.
-
-§1. Blah. Lorum.
-Ipsum. But
as well.
-
-
-
-
-
- Green.
- Blue.
-
-
-is my essential palette.
-
-
-
-
-
-
diff --git a/Tests/Test Cases/_Woven_Ideal/hellow.html b/Tests/Test Cases/_Woven_Ideal/hellow.html
deleted file mode 100644
index 3d4ae36..0000000
--- a/Tests/Test Cases/_Woven_Ideal/hellow.html
+++ /dev/null
@@ -1,488 +0,0 @@
-
-
-
- Complete Program
-
-
-
-
-
-
-
-
-
-A minimal example of a C program written for inweb.
-
-§1.
-
-
- # include < stdio . h >
-
- int main ( int argc , char * argv []) {
- printf ( "Hello world!\n" );
- }
-
-
-
-
-
-
-
-
diff --git a/Tests/Test Cases/_Woven_Ideal/perl.html b/Tests/Test Cases/_Woven_Ideal/perl.html
deleted file mode 100644
index 8d1c2e9..0000000
--- a/Tests/Test Cases/_Woven_Ideal/perl.html
+++ /dev/null
@@ -1,510 +0,0 @@
-
-
-
- Complete Program
-
-
-
-
-
-
-
-
-
-A test Perl script for inweb.
-
-§1.
-
-
- print recolour ( "Santa likes red and green socks.\n" );
-
-
-
-
-§2.
-
-
- sub recolour {
- my $ text = $ _ [0];
- <Change the hues 2.1 >;
- return $ text ;
- }
-
-
-
-
-§2.1.
-<Change the hues 2.1 > =
-
-
-
-
- $ text =~ s / red / blue /;
- $ text =~ s / green / purple /;
-
-
-
-
-This code is used in §2 .
-
-
-
-
-
diff --git a/Tests/Test Cases/_Woven_Ideal/plain.html b/Tests/Test Cases/_Woven_Ideal/plain.html
deleted file mode 100644
index 131f86d..0000000
--- a/Tests/Test Cases/_Woven_Ideal/plain.html
+++ /dev/null
@@ -1,514 +0,0 @@
-
-
-
- Complete Program
-
-
-
-
-
-
-
-
-
-Tangling and weaving some text file.
-
-§1.
-
-
- <Titling 1.1 >
- No one would have believed in the last years of the
- nineteenth century that this world was being watched keenly
- and closely by intelligences greater than man's and yet as
- mortal as his own; that as men busied themselves about their
- various concerns they were scrutinised and studied, perhaps
- almost as narrowly as a man with a microscope might scrutinise
- the transient creatures that swarm and multiply in a drop of water.
-
-
-
-
-§1.1.
-<Titling 1.1 > =
-
-
-
-
- Book One
- The Coming of the Martians
-
-
-
-
-This code is used in §1 .
-
-§2.
-
-
- With infinite complacency men went to and fro over this globe about
- their little affairs, serene in their assurance of their empire over matter.
-
-
-
-
-
-
-
-
diff --git a/Tests/Test Cases/_Woven_Ideal/twinprimes.html b/Tests/Test Cases/_Woven_Ideal/twinprimes.html
deleted file mode 100644
index 0eb7437..0000000
--- a/Tests/Test Cases/_Woven_Ideal/twinprimes.html
+++ /dev/null
@@ -1,576 +0,0 @@
-
-
-
- Complete Program
-
-
-
-
-
-
-
-
-
-The Twin Primes Conjecture This example of using inweb is a whole web in a single short file, to look for twin primes, a classic problem in number theory.
-
-
-
-§1. The conjecture. It is widely believed that there are an infinite number of twin primes, that
-is, prime numbers occurring in pairs different by 2. Twins are known to exist
-at least as far out as \(10^{388,342}\) (as of 2016), and there are infinitely
-many pairs of primes closer together than about 250 (Zhang, 2013; Tao, Maynard,
-and many others, 2014).
-
-
-This program finds a few small pairs of twins, by the simplest method possible,
-and should print output like so:
-
-
-
- 3 and 5
- 5 and 7
- 11 and 13
- ...
-
-
-
-
-
-
- define RANGE 100
-
-
-
- # include < stdio . h >
-
- int main ( int argc , char * argv []) {
- for ( int i =1; i < RANGE ; i ++)
- <Test for twin prime at i 1.1 >;
- }
-
-
-
-
-§1.1.
-<Test for twin prime at i 1.1 > =
-
-
-
-
- if (( isprime ( i )) && ( isprime ( i +2)))
- printf ( "%d and %d\n" , i , i +2);
-
-
-
-
-This code is used in §1 .
-
-§2. Primality. This simple and slow test tries to divide by every whole number at least
-2 and up to the square root: if none divide exactly, the number is prime.
-A common error with this algorithm is to check where \(m^2 < n\), rather
-than \(m^2 \leq n\), thus wrongly considering 4, 9, 25, 49, ... as prime:
-Cambridge folklore has it that this bug occurred on the first computation
-of the EDSAC computer on 6 May 1949.
-
-
-
-
- define TRUE 1
- define FALSE 0
-
-
-
- int isprime ( int n ) {
- if ( n <= 1 ) return FALSE ;
- for ( int m = 2 ; m * m <= n ; m ++)
- if ( n % m == 0 )
- return FALSE ;
- return TRUE ;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Tests/Test Weave Tree/_Results_Ideal/sp.txt b/Tests/Test Weave Tree/_Results_Ideal/sp.txt
new file mode 100644
index 0000000..0495575
--- /dev/null
+++ b/Tests/Test Weave Tree/_Results_Ideal/sp.txt
@@ -0,0 +1,159 @@
+document weave order 0
+ head banner
+ body
+ chapter
+ chapter header
+ section
+ section header
+ section purpose
+ paragraph P1
+ material discussion
+ commentary
+ commentary
+ commentary
+ item depth 1 label
+ commentary
+ item depth 1 label
+ commentary
+ vskip (in comment)
+ commentary
+ inline
+ source_code
+ _xxxxxxxxxxx_
+ commentary <, to say the least: see >
+ url content url
+ commentary <\n>
+ commentary
+ url content url
+ commentary <.\n>
+ figure -1 by 720
+ vskip (in comment)
+ commentary
+ mathematics <10^{18}>
+ commentary <, but by rather better\n>
+ commentary
+ footnote_cue [1]
+ commentary < Which is awesome.>
+ footnote_cue [2]
+ commentary < And >
+ mathematics
+ commentary <, that's for sure.\n>
+ mathematics < \int_0^1 \cos x {\rm d}x > (displayed)
+ commentary <\n>
+ commentary
+ material footnotes
+ footnote [1]
+ footnote_cue [1]
+ commentary < And don't just take my word for it.\n>
+ footnote [2]
+ footnote_cue [2]
+ commentary < Really!\n>
+ paragraph P2
+ material discussion
+ commentary
+ carousel slide caption
+ figure -1 by -1
+ carousel slide caption <>
+ figure -1 by -1
+ carousel slide caption
+ figure -1 by -1
+ vskip (in comment)
+ commentary
+ paragraph P3
+ material definition
+ code line
+ defn
+ source_code
+ _nnnnnpnnn_
+ material code: C
+ code line
+ source_code <#include >
+ _piiiiiiippiiiiipip_
+ vskip
+ code line
+ source_code
+ _rrrpffffprrrpiiiipprrrrppiiiippppp_
+ code line
+ source_code < for (int i=4; i
+ _pppprrrpprrrpippppipnnnnnppipipppp_
+ commentary < stepping in twos to stay even> (code)
+ code line
+ source_code < >
+ _pppppppp_
+ pmac
+ source_code <;>
+ _c_
+ code line
+ source_code <}>
+ _c_
+ paragraph P3.1
+ material discussion
+ commentary
+ material code: ConsoleText
+ code line
+ source_code < $ goldbach/Tangled/goldbach -fish 1>
+ _ppppepfffffffffffffffffffffffffiiiiiipp_
+ code line
+ source_code < 4 = 2+2>
+ _ppppppppppp_
+ code line
+ source_code < 6 = 3+3 >
+ _pppppppppppppp_
+ url content url
+ code line
+ source_code < 8 = 3+5>
+ _ppppppppppp_
+ code line
+ source_code < 10 = 3+7 = 5+5>
+ _pppppppppppppppppp_
+ code line
+ source_code < 12 = 5+7>
+ _pppppppppppp_
+ code line
+ source_code < 14 = 3+11 = 7+7>
+ _ppppppppppppppppppp_
+ code line
+ source_code < ...>
+ _ppppppp_
+ material discussion
+ commentary
+ commentary
+ mathematics <2 \leq j \leq i/2>
+ commentary < to avoid counting pairs\n>
+ commentary
+ mathematics <8 = 3+5 = 5+3>
+ commentary <, but that's hardly two different ways).\n>
+ material paragraph macro
+ code line
+ pmac (definition)
+ material code: C
+ code line
+ source_code < printf("%d", i);>
+ _ppppiiiiiipssssppipp_
+ code line
+ source_code < for (int j=2; j<=i/2; j++)>
+ _pppprrrpprrrpippppippippppippp_
+ code line
+ source_code < if ((>
+ _pppppppprrppp_
+ function usage
+ source_code <(j)) && (>
+ _pippppppp_
+ function usage
+ source_code <(i-j)))>
+ _pipippp_
+ code line
+ source_code < printf(" = %d+%d", j, i-j);>
+ _ppppppppppppiiiiiipssssssssssppippipipp_
+ code line
+ source_code < printf("\n");>
+ _ppppiiiiiipsssspp_
+ material endnotes
+ endnote
+ commentary
+ commentary
+ locale P3
+ commentary <.>
+ section footer
+ chapter footer
+ tail rennab
diff --git a/Tests/Test Weave Tree/_Results_Ideal/tsoe.txt b/Tests/Test Weave Tree/_Results_Ideal/tsoe.txt
new file mode 100644
index 0000000..de3e76a
--- /dev/null
+++ b/Tests/Test Weave Tree/_Results_Ideal/tsoe.txt
@@ -0,0 +1,149 @@
+document weave order 0
+ head banner
+ body
+ chapter
+ chapter header
+ section
+ section header
+ section purpose
+ toc -
+ toc line - P1'Storage'
+ toc line - P2'Primality'
+ paragraph P1'Storage'
+ material discussion
+ commentary
+ commentary
+ commentary
+ commentary
+ commentary
+ vskip (in comment)
+ commentary
+ commentary
+ commentary
+ commentary
+ material code: C
+ code line
+ source_code
+ _rrrpiiiiiiiiiiiiiipnnnnnpppnpp_
+ code line
+ source_code
+ _rrrpiiiiiiiiiiiiiiipppnnnnnp_
+ paragraph P2'Primality'
+ material discussion
+ commentary
+ material definition
+ code line
+ defn
+ source_code
+ _nnnnpn_
+ code line
+ defn
+ source_code
+ _nnnnnpn_
+ material code: C
+ code line
+ source_code
+ _rrrp_
+ function defn
+ commentary
+ commentary < - >
+ locale P3.1
+ source_code <(int n) {>
+ _prrrpippp_
+ code line
+ source_code < if (n <= 1) return FALSE;>
+ _pppprrppippppnpprrrrrrpnnnnnp_
+ code line
+ source_code < if (n > RANGE) { printf("Out of range!\n"); return FALSE; }>
+ _pppprrppipppnnnnnppppiiiiiipsssssssssssssssssppprrrrrrpnnnnnppp_
+ code line
+ source_code < if (!sieve_performed) >
+ _pppprrpppiiiiiiiiiiiiiiipp_
+ pmac
+ source_code <;>
+ _p_
+ code line
+ source_code < return still_in_sieve[n];>
+ _pppprrrrrrpiiiiiiiiiiiiiipipp_
+ code line
+ source_code <}>
+ _p_
+ paragraph P2.1
+ material discussion
+ commentary
+ inline
+ source_code
+ _xxxxx_
+ commentary < is composite\n>
+ commentary
+ inline
+ source_code
+ _xxxxx_
+ commentary <. Thus,\n>
+ commentary
+ commentary
+ material paragraph macro
+ code line
+ pmac (definition)
+ material code: C
+ code line
+ source_code < >
+ _pppp_
+ pmac
+ source_code <;>
+ _p_
+ code line
+ source_code < for (int n=2; n*n <= RANGE; n++)>
+ _pppprrrpprrrpippppipippppnnnnnppippp_
+ code line
+ source_code < if (still_in_sieve[n])>
+ _pppppppprrppiiiiiiiiiiiiiipipp_
+ code line
+ source_code < >
+ _pppppppppppp_
+ pmac
+ source_code <;>
+ _p_
+ code line
+ source_code < sieve_performed = TRUE;>
+ _ppppiiiiiiiiiiiiiiipppnnnnp_
+ material endnotes
+ endnote
+ commentary
+ commentary
+ locale P2'Primality'
+ commentary <.>
+ paragraph P2.1.1
+ material paragraph macro
+ code line
+ pmac (definition)
+ material code: C
+ code line
+ source_code < still_in_sieve[1] = FALSE;>
+ _ppppiiiiiiiiiiiiiippppppnnnnnp_
+ code line
+ source_code < for (int n=2; n <= RANGE; n++) still_in_sieve[n] = TRUE;>
+ _pppprrrpprrrpippppippppnnnnnppippppiiiiiiiiiiiiiipippppnnnnp_
+ material endnotes
+ endnote
+ commentary
+ commentary
+ locale P2.1
+ commentary <.>
+ paragraph P2.1.2
+ material paragraph macro
+ code line
+ pmac (definition)
+ material code: C
+ code line
+ source_code < for (int m= n+n; m <= RANGE; m += n) still_in_sieve[m] = FALSE;>
+ _pppprrrpprrrpippipippippppnnnnnppippppippiiiiiiiiiiiiiipippppnnnnnp_
+ material endnotes
+ endnote
+ commentary
+ commentary
+ locale P2.1
+ commentary <.>
+ section footer
+ chapter footer
+ tail rennab
diff --git a/Tests/Test Weave Tree/sp.txt b/Tests/Test Weave Tree/sp.txt
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/Test Weave Tree/tsoe.txt b/Tests/Test Weave Tree/tsoe.txt
new file mode 100644
index 0000000..e69de29
diff --git a/Tests/Test Weave Tree/variations/Contents.w b/Tests/Test Weave Tree/variations/Contents.w
new file mode 100644
index 0000000..5631f98
--- /dev/null
+++ b/Tests/Test Weave Tree/variations/Contents.w
@@ -0,0 +1,8 @@
+Title: The Goldbach Variations
+Author: Anonymous
+Purpose: This makes no sense as any kind of program, and exists only for testing the weaver.
+Language: C
+
+Sections
+ Summing Primes
+ The Sieve of Eratosthenes
diff --git a/Tests/Test Weave Tree/variations/Sections/Summing Primes.w b/Tests/Test Weave Tree/variations/Sections/Summing Primes.w
new file mode 100755
index 0000000..4752090
--- /dev/null
+++ b/Tests/Test Weave Tree/variations/Sections/Summing Primes.w
@@ -0,0 +1,70 @@
+Summing Primes.
+
+Here we verify the conjecture for small numbers.
+
+@ So, this is a program to see if even numbers from 4 to 100 can all be written
+as a sum of two primes. Christian Goldbach asked Euler in 1742 if every even
+number greater than 2 can be written this way. This remains open, though --
+
+(a) every even number is a sum of at most six primes (Ramaré, 1995), and
+(b) every odd number is a sum of at most five (Tao, 2012).
+
+Besides which, |printf(k+1)|, to say the least: see http://www.google.com
+or for that matter see //The Sieve of Eratosthenes//.
+
+= (figure Letter.jpg at height 10cm)
+
+Computer verification has been made up to around $10^{18}$, but by rather better
+methods.[1] Which is awesome.[2] And $i
+
+int main(int argc, char *argv[]) {
+ for (int i=4; i;
+}
+
+@ This ought to print:
+= (hyperlinked text as ConsoleText)
+ $ goldbach/Tangled/goldbach -fish 1
+ 4 = 2+2
+ 6 = 3+3 https://www.wikipedia.org
+ 8 = 3+5
+ 10 = 3+7 = 5+5
+ 12 = 5+7
+ 14 = 3+11 = 7+7
+ ...
+=
+We'll print each different pair of primes adding up to i. We
+only check in the range $2 \leq j \leq i/2$ to avoid counting pairs
+twice over (thus $8 = 3+5 = 5+3$, but that's hardly two different ways).
+
+@ =
+ printf("%d", i);
+ for (int j=2; j<=i/2; j++)
+ if ((isprime(j)) && (isprime(i-j)))
+ printf(" = %d+%d", j, i-j);
+ printf("\n");
diff --git a/Tests/Test Weave Tree/variations/Sections/The Sieve of Eratosthenes.w b/Tests/Test Weave Tree/variations/Sections/The Sieve of Eratosthenes.w
new file mode 100755
index 0000000..34f8bc5
--- /dev/null
+++ b/Tests/Test Weave Tree/variations/Sections/The Sieve of Eratosthenes.w
@@ -0,0 +1,52 @@
+The Sieve of Eratosthenes.
+
+A fairly fast way to determine if small numbers are prime, given storage.
+
+@h Storage.
+This technique, still essentially the best sieve for finding prime
+numbers, is attributed to Eratosthenes of Cyrene and dates from the 200s BC.
+Since composite numbers are exactly those numbers which are multiples of
+something, the idea is to remove everything which is a multiple: whatever
+is left, must be prime.
+
+This is very fast (and can be done more quickly than the implementation
+below), but (a) uses storage to hold the sieve, and (b) has to start right
+back at 2 - so it can't efficiently test just, say, the eight-digit numbers
+for primality.
+
+=
+int still_in_sieve[RANGE + 1];
+int sieve_performed = FALSE;
+
+@h Primality.
+We provide this as a function which determines whether a number is prime:
+
+@d TRUE 1
+@d FALSE 0
+
+=
+int isprime(int n) {
+ if (n <= 1) return FALSE;
+ if (n > RANGE) { printf("Out of range!\n"); return FALSE; }
+ if (!sieve_performed) @;
+ return still_in_sieve[n];
+}
+
+@ We save a little time by noting that if a number up to |RANGE| is composite
+then one of its factors must be smaller than the square root of |RANGE|. Thus,
+in a sieve of size 10000, one only needs to remove multiples of 2 up to 100,
+for example.
+
+@ =
+ @;
+ for (int n=2; n*n <= RANGE; n++)
+ if (still_in_sieve[n])
+ @;
+ sieve_performed = TRUE;
+
+@ =
+ still_in_sieve[1] = FALSE;
+ for (int n=2; n <= RANGE; n++) still_in_sieve[n] = TRUE;
+
+@ =
+ for (int m= n+n; m <= RANGE; m += n) still_in_sieve[m] = FALSE;
diff --git a/Tests/inweb.intest b/Tests/inweb.intest
index 549e5e8..8dea216 100644
--- a/Tests/inweb.intest
+++ b/Tests/inweb.intest
@@ -1,5 +1,6 @@
-cases [Inweb] 'inweb/Tests/Test Cases'
-cases [Painter] 'inweb/Tests/Test Painter'
+-cases [Tree] 'inweb/Tests/Test Weave Tree'
-recipe [Inweb]
set: $INWEB = inweb/Tangled/inweb
@@ -18,18 +19,6 @@
match text: $TA $TI
or: 'produced the wrong tangled code'
- mkdir: $PATH/_Woven_Actual
- mkdir: $PATH/_Woven_Ideal
- mkdir: $PATH/_Woven_Console
- set: $WA = $PATH/_Woven_Actual/$CASE.html
- set: $WI = $PATH/_Woven_Ideal/$CASE.html
- set: $WC = $PATH/_Woven_Console/$CASE.txt
- step: $INWEB $WEB -weave-to $WA >$WC 2>&1
- or: 'failed inweb' $WC
- show: $WA
- match text: $WA $WI
- or: 'produced the wrong woven code'
-
mkdir: $PATH/_Scan_Actual
mkdir: $PATH/_Scan_Ideal
set: $SA = $PATH/_Scan_Actual/$CASE.txt
@@ -64,3 +53,24 @@
pass: 'passed'
-end
+
+-recipe [Tree]
+ set: $INWEB = inweb/Tangled/inweb
+ set: $LANGUAGES = inweb/Dialects
+ set: $INTERNAL = Internal
+
+ mkdir: $PATH/_Results_Actual
+ mkdir: $PATH/_Results_Ideal
+ mkdir: $PATH/_Results_Console
+ set: $A = $PATH/_Results_Actual/$CASE.txt
+ set: $I = $PATH/_Results_Ideal/$CASE.txt
+ set: $C = $PATH/_Results_Console/$CASE.txt
+ step: $INWEB $PATH/variations -weave S/$CASE -weave-as TestingInweb -weave-to $A >$C 2>&1
+ or: 'failed inweb' $C
+ show: $A
+ match text: $A $I
+ or: 'produced the wrong weave tree'
+
+ pass: 'passed'
+
+-end
diff --git a/build.txt b/build.txt
index fad787d..64378d9 100644
--- a/build.txt
+++ b/build.txt
@@ -1,3 +1,3 @@
Prerelease: alpha.1
-Build Date: 22 April 2020
-Build Number: 1A27
+Build Date: 23 April 2020
+Build Number: 1A28
diff --git a/scripts/gitignorescript.txt b/scripts/gitignorescript.txt
index 089b016..19d6556 100644
--- a/scripts/gitignorescript.txt
+++ b/scripts/gitignorescript.txt
@@ -23,6 +23,6 @@ Examples/goldbach/Woven
Tests/Test Cases/_Scan_Actual/
Tests/Test Cases/_Tangled_Actual/
Tests/Test Cases/_Tangled_Console/
-Tests/Test Cases/_Woven_Actual/
-Tests/Test Cases/_Woven_Console/
Tests/Test Painter/_Results_Actual/
+Tests/Test Weave Tree/_Results_Actual/
+Tests/Test Weave Tree/_Results_Console/