Added test cases using new weave tree
This commit is contained in:
parent
34f4ac213d
commit
7ace51464f
22 changed files with 542 additions and 3206 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -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/
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
name: TestingInweb
|
||||
format: Debugging
|
||||
default range: sections
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
128
Tangled/inweb.c
128
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("<div class=\"%S\">%S</div>\n", caption_class, C->caption);
|
||||
|
||||
}
|
||||
#line 438 "inweb/Chapter 5/HTML Formats.w"
|
||||
#line 440 "inweb/Chapter 5/HTML Formats.w"
|
||||
;
|
||||
WRITE("<div class=\"%S\">%d / %d</div>\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("</div>\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("<div class=\"%S\">%S</div>\n", caption_class, C->caption);
|
||||
|
||||
}
|
||||
#line 447 "inweb/Chapter 5/HTML Formats.w"
|
||||
#line 449 "inweb/Chapter 5/HTML Formats.w"
|
||||
;
|
||||
WRITE("</div>\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));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,539 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Complete Program</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Language" content="en-gb">
|
||||
<link href="inweb.css" rel="stylesheet" rev="stylesheet" type="text/css"><style type="text/css">
|
||||
/* This is a CSS file for pages woven by the literate programming tool inweb */
|
||||
|
||||
/* We'll start with syntax colouring, since everyone likes to toy with this: */
|
||||
|
||||
.cwebmacrotext { color: #000000; font-weight: bold; } /* The name of a web macro */
|
||||
.functiontext { color: #C00000; } /* When a C function is being defined */
|
||||
.string { color: #408040; } /* A double-quoted C literal string */
|
||||
.character { color: #204020; } /* A single-quoted C literal character */
|
||||
.constant { color: #204020; } /* A named constant */
|
||||
.element { color: #40407f; } /* A C structure element */
|
||||
.identifier { color: #4040ff; } /* An identifier */
|
||||
.reserved { color: #600000; } /* A reserved word */
|
||||
|
||||
/* Comments at the end of lines are rendered like so: */
|
||||
|
||||
.comment {
|
||||
font: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
color: #404040;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
/* The name of a web macro when being used: */
|
||||
|
||||
.cwebmacro {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
color: #000000; font-weight: bold;
|
||||
}
|
||||
|
||||
.cwebmacronumber {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
font-size: 80%;
|
||||
text-decoration: none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* And when being defined: */
|
||||
|
||||
.cwebmacrodefn {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
color: #000000; font-weight: bold;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
/* Now some generalities: */
|
||||
|
||||
body {
|
||||
background-color: #ffffff;
|
||||
margin: 8px;
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
background-color: transparent;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* Forms of paragraph: */
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* Where an inweb paragraph begins: */
|
||||
|
||||
p.inwebparagraph {
|
||||
width: 60em;
|
||||
line-height: 150%;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
/* If a web macro definition begins in its own paragraph, this is it: */
|
||||
|
||||
p.macrodefinition {
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
/* The endnotes at the foot of code: "The function foo_bar is used in ..." */
|
||||
|
||||
p.endnote {
|
||||
font-size: 0.8em;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 30px;
|
||||
text-decoration:none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* The Purpose slug: */
|
||||
|
||||
p.purpose {
|
||||
width: 60em;
|
||||
line-height: 150%;
|
||||
font-size: 1em;
|
||||
font-style:italic;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* Blocks of code appear in these */
|
||||
|
||||
pre {
|
||||
font-family: Monaco, monospace;
|
||||
}
|
||||
|
||||
pre.display {
|
||||
padding: 3px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-left: 30px;
|
||||
margin-right: 10px;
|
||||
background: #f8f8f8;
|
||||
border-width: 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: #ccc;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.displaydefn {
|
||||
padding: 3px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 10px;
|
||||
background: #f8f8f8;
|
||||
border-width: 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: #ccc;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.definitions {
|
||||
padding-top: 0px;
|
||||
margin-top: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 10px;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/* The following are for breadcrumbs of links: */
|
||||
|
||||
ul, li {
|
||||
list-style-type:none;
|
||||
padding:0;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.crumbs {
|
||||
border:1px solid #dedede;
|
||||
height:3.45em;
|
||||
}
|
||||
|
||||
.crumbs li {
|
||||
float:left;
|
||||
line-height:2.3em;
|
||||
padding-left:.75em;
|
||||
color:#333;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.crumbs li a {
|
||||
display:block;
|
||||
padding:0 15px 0 0;
|
||||
background:url(crumbs.gif) no-repeat right center;
|
||||
}
|
||||
|
||||
.crumbs li a:link, #crumbs li a:visited {
|
||||
text-decoration:none;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.crumbs li a:hover, #crumbs li a:focus {
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
/* This is for items in lists from inweb source: */
|
||||
|
||||
ul.items {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
ul.items li {
|
||||
margin-top: 1px;
|
||||
margin-bottom: 1px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* And this is for each section's table of contents: */
|
||||
|
||||
ul.toc {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
ul.toc li {
|
||||
float:left;
|
||||
margin-left: 15px;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
ul.toc li a {
|
||||
display:block;
|
||||
}
|
||||
|
||||
ul.toc li a:link, ul.toc li a:visited {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
ul.toc li a:hover, ul.toc li a:focus {
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
hr.tocbar {
|
||||
clear: both;
|
||||
margin-top:3px;
|
||||
margin-bottom:3px;
|
||||
color:#333;
|
||||
border:0
|
||||
background-color:#333;
|
||||
}
|
||||
|
||||
/* This is for cross-reference links ("This code is used in ...") */
|
||||
|
||||
p.endnote:link, p.endnote:visited, p.endnote:hover, p.endnote:focus {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
p.endnote a:link, p.endnote a:visited {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
p.endnote a:hover, p.endnote a:focus {
|
||||
text-decoration:none;
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
/* Now for the index page */
|
||||
|
||||
p.heading {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
font-size: 20
|
||||
}
|
||||
p.chapter {
|
||||
font-size: 14
|
||||
}
|
||||
p.tight {
|
||||
font-size: 12
|
||||
}
|
||||
p.tightin {
|
||||
padding-left: 25px;
|
||||
font-size: 12
|
||||
}
|
||||
.chapterlist li {
|
||||
padding-top: 8px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
.chaptertitle {
|
||||
font-weight: bold;
|
||||
}
|
||||
.chapterlist .sectionlist li {
|
||||
padding-left: 48px;
|
||||
}
|
||||
span.definitionkeyword {
|
||||
color:#801010;
|
||||
font-weight:bold;
|
||||
}
|
||||
span.extract {
|
||||
font-size: 15px;
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 3px;
|
||||
background-color: #eef;
|
||||
width: 100%;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
nav[role="navigation"] {
|
||||
width: 180px;
|
||||
position: fixed;
|
||||
overflow: scroll;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background: #FAFAFA;
|
||||
border-right: 1px solid #e6e6e6;
|
||||
padding: 20px 30px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul {
|
||||
border-top: 1px solid #e6e6e6;
|
||||
font-weight: 400;
|
||||
margin-bottom: 30px;
|
||||
list-style: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul ul {
|
||||
list-style: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li {
|
||||
border-bottom: 1px solid #e6e6e6
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li.active {
|
||||
border-bottom: 1px solid #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li.active a {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:visited {
|
||||
color: #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:active {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:hover {
|
||||
color: #dd2c0d
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
padding: 10px 10px 2px 2px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li span.selectedlink {
|
||||
color: #f25;
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li span.unlink {
|
||||
color: #f25;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
padding: 10px 10px 2px 2px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:visited {
|
||||
color: #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:active {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:hover {
|
||||
color: #dd2c0d
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul {
|
||||
margin-bottom: 10px;
|
||||
border-top: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li {
|
||||
border-bottom: none;
|
||||
padding: 0.1em
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li.active {
|
||||
border-bottom: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li.active a {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul a:link {
|
||||
color: #dd2c0d;
|
||||
text-decoration: none;
|
||||
text-transform: none;
|
||||
letter-spacing: 0;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
margin-left: 15px;
|
||||
padding: 0 0 3px;
|
||||
border-bottom: none;
|
||||
font-weight: 300
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul a:hover {
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
nav[role="navigation"] h2 {
|
||||
font-size: 0.95em;
|
||||
text-transform: lowercase;
|
||||
font-variant: small-caps;
|
||||
color: #999;
|
||||
padding-bottom: 0.5em
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 {
|
||||
margin-top: 0em
|
||||
}
|
||||
|
||||
main {
|
||||
max-width: 1024px;
|
||||
min-width: 320px;
|
||||
margin-left: 250px;
|
||||
min-height: 100%;
|
||||
height: auto !important;
|
||||
height: 100%
|
||||
}
|
||||
|
||||
#logo {
|
||||
text-indent: -9999px;
|
||||
height: 48px;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 0.5em;
|
||||
padding-bottom: 10px
|
||||
}
|
||||
|
||||
#logo a {
|
||||
display: block;
|
||||
width: 190px;
|
||||
height: 48px;
|
||||
background-image: url("/assets/images/swift.svg");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 190px 48px;
|
||||
background-position-x: -8px
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!--Weave of 'Complete Program' generated by 7-->
|
||||
<ul class="crumbs"><li><b>hellow</b></li></ul><p class="purpose">A minimal example of a C program written for inweb.</p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP1"></a><b>§1. </b></p>
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">#</span><span class="identifier">include</span><span class="plain"> <</span><span class="identifier">stdio</span><span class="plain">.</span><span class="identifier">h</span><span class="plain">></span>
|
||||
|
||||
<span class="reserved">int</span><span class="plain"> </span><span class="functiontext">main</span><span class="plain">(</span><span class="reserved">int</span><span class="plain"> </span><span class="identifier">argc</span><span class="plain">, </span><span class="reserved">char</span><span class="plain"> *</span><span class="identifier">argv</span><span class="plain">[]) {</span>
|
||||
<span class="identifier">printf</span><span class="plain">(</span><span class="string">"Hello world!\n"</span><span class="plain">);</span>
|
||||
<span class="plain">}</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP2"></a><b>§2. </b></p>
|
||||
|
||||
|
||||
<pre class="definitions">
|
||||
<span class="definitionkeyword">define</span> <span class="constant">PEACH</span><span class="plain"> </span><span class="constant">1</span>
|
||||
<span class="definitionkeyword">enum</span> <span class="constant">A_COM</span><span class="definitionkeyword"> from </span><span class="constant">1</span>
|
||||
<span class="definitionkeyword">enum</span> <span class="constant">B_COM</span>
|
||||
<span class="definitionkeyword">enum</span> <span class="constant">C_COM</span>
|
||||
</pre>
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">#</span><span class="identifier">include</span><span class="plain"> </span><span class="string">"nonexistent.h"</span>
|
||||
|
||||
<span class="reserved">typedef</span><span class="plain"> </span><span class="reserved">struct</span><span class="plain"> </span><span class="reserved">bong</span><span class="plain"> {</span>
|
||||
<span class="reserved">int</span><span class="plain"> </span><span class="identifier">f</span><span class="plain">;</span>
|
||||
<span class="plain">} </span><span class="reserved">bong</span><span class="plain">;</span>
|
||||
|
||||
<span class="reserved">void</span><span class="plain"> </span><span class="functiontext">banana<button class="popup" onclick="togglePopup('usagePopup0')">...<span class="popuptext" id="usagePopup0">Usage of <b>banana</b>:<br>none</span></button></span><span class="plain">(</span><span class="reserved">int</span><span class="plain"> </span><span class="identifier">n</span><span class="plain">) {</span>
|
||||
<span class="plain">}</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<p class="endnote">This paragraph is used only if PLATFORM_WINDOWS is defined.</p>
|
||||
|
||||
<p class="endnote">The structure bong is private to this section.</p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP3"></a><b>§3. </b></p>
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">#</span><span class="identifier">include</span><span class="plain"> </span><span class="string">"existent.h"</span>
|
||||
|
||||
<span class="reserved">typedef</span><span class="plain"> </span><span class="reserved">struct</span><span class="plain"> </span><span class="reserved">bong</span><span class="plain"> {</span>
|
||||
<span class="reserved">unsigned</span><span class="plain"> </span><span class="reserved">int</span><span class="plain"> </span><span class="identifier">f</span><span class="plain">;</span>
|
||||
<span class="plain">} </span><span class="reserved">bong</span><span class="plain">;</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<p class="endnote">This paragraph is used only if POSIX is defined and if PLATFORM_WINDOWS is undefined.</p>
|
||||
|
||||
<p class="endnote">The structure bong is private to this section.</p>
|
||||
|
||||
<!--End of weave-->
|
||||
<script>
|
||||
function togglePopup(material_id) {
|
||||
var popup = document.getElementById(material_id);
|
||||
popup.classList.toggle("show");
|
||||
}
|
||||
</script>
|
||||
|
||||
<link href="Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,490 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Complete Program</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Language" content="en-gb">
|
||||
<link href="inweb.css" rel="stylesheet" rev="stylesheet" type="text/css"><style type="text/css">
|
||||
/* This is a CSS file for pages woven by the literate programming tool inweb */
|
||||
|
||||
/* We'll start with syntax colouring, since everyone likes to toy with this: */
|
||||
|
||||
.cwebmacrotext { color: #000000; font-weight: bold; } /* The name of a web macro */
|
||||
.functiontext { color: #C00000; } /* When a C function is being defined */
|
||||
.string { color: #408040; } /* A double-quoted C literal string */
|
||||
.character { color: #204020; } /* A single-quoted C literal character */
|
||||
.constant { color: #204020; } /* A named constant */
|
||||
.element { color: #40407f; } /* A C structure element */
|
||||
.identifier { color: #4040ff; } /* An identifier */
|
||||
.reserved { color: #600000; } /* A reserved word */
|
||||
|
||||
/* Comments at the end of lines are rendered like so: */
|
||||
|
||||
.comment {
|
||||
font: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
color: #404040;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
/* The name of a web macro when being used: */
|
||||
|
||||
.cwebmacro {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
color: #000000; font-weight: bold;
|
||||
}
|
||||
|
||||
.cwebmacronumber {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
font-size: 80%;
|
||||
text-decoration: none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* And when being defined: */
|
||||
|
||||
.cwebmacrodefn {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
color: #000000; font-weight: bold;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
/* Now some generalities: */
|
||||
|
||||
body {
|
||||
background-color: #ffffff;
|
||||
margin: 8px;
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
background-color: transparent;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* Forms of paragraph: */
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* Where an inweb paragraph begins: */
|
||||
|
||||
p.inwebparagraph {
|
||||
width: 60em;
|
||||
line-height: 150%;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
/* If a web macro definition begins in its own paragraph, this is it: */
|
||||
|
||||
p.macrodefinition {
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
/* The endnotes at the foot of code: "The function foo_bar is used in ..." */
|
||||
|
||||
p.endnote {
|
||||
font-size: 0.8em;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 30px;
|
||||
text-decoration:none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* The Purpose slug: */
|
||||
|
||||
p.purpose {
|
||||
width: 60em;
|
||||
line-height: 150%;
|
||||
font-size: 1em;
|
||||
font-style:italic;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* Blocks of code appear in these */
|
||||
|
||||
pre {
|
||||
font-family: Monaco, monospace;
|
||||
}
|
||||
|
||||
pre.display {
|
||||
padding: 3px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-left: 30px;
|
||||
margin-right: 10px;
|
||||
background: #f8f8f8;
|
||||
border-width: 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: #ccc;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.displaydefn {
|
||||
padding: 3px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 10px;
|
||||
background: #f8f8f8;
|
||||
border-width: 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: #ccc;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.definitions {
|
||||
padding-top: 0px;
|
||||
margin-top: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 10px;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/* The following are for breadcrumbs of links: */
|
||||
|
||||
ul, li {
|
||||
list-style-type:none;
|
||||
padding:0;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.crumbs {
|
||||
border:1px solid #dedede;
|
||||
height:3.45em;
|
||||
}
|
||||
|
||||
.crumbs li {
|
||||
float:left;
|
||||
line-height:2.3em;
|
||||
padding-left:.75em;
|
||||
color:#333;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.crumbs li a {
|
||||
display:block;
|
||||
padding:0 15px 0 0;
|
||||
background:url(crumbs.gif) no-repeat right center;
|
||||
}
|
||||
|
||||
.crumbs li a:link, #crumbs li a:visited {
|
||||
text-decoration:none;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.crumbs li a:hover, #crumbs li a:focus {
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
/* This is for items in lists from inweb source: */
|
||||
|
||||
ul.items {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
ul.items li {
|
||||
margin-top: 1px;
|
||||
margin-bottom: 1px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* And this is for each section's table of contents: */
|
||||
|
||||
ul.toc {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
ul.toc li {
|
||||
float:left;
|
||||
margin-left: 15px;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
ul.toc li a {
|
||||
display:block;
|
||||
}
|
||||
|
||||
ul.toc li a:link, ul.toc li a:visited {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
ul.toc li a:hover, ul.toc li a:focus {
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
hr.tocbar {
|
||||
clear: both;
|
||||
margin-top:3px;
|
||||
margin-bottom:3px;
|
||||
color:#333;
|
||||
border:0
|
||||
background-color:#333;
|
||||
}
|
||||
|
||||
/* This is for cross-reference links ("This code is used in ...") */
|
||||
|
||||
p.endnote:link, p.endnote:visited, p.endnote:hover, p.endnote:focus {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
p.endnote a:link, p.endnote a:visited {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
p.endnote a:hover, p.endnote a:focus {
|
||||
text-decoration:none;
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
/* Now for the index page */
|
||||
|
||||
p.heading {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
font-size: 20
|
||||
}
|
||||
p.chapter {
|
||||
font-size: 14
|
||||
}
|
||||
p.tight {
|
||||
font-size: 12
|
||||
}
|
||||
p.tightin {
|
||||
padding-left: 25px;
|
||||
font-size: 12
|
||||
}
|
||||
.chapterlist li {
|
||||
padding-top: 8px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
.chaptertitle {
|
||||
font-weight: bold;
|
||||
}
|
||||
.chapterlist .sectionlist li {
|
||||
padding-left: 48px;
|
||||
}
|
||||
span.definitionkeyword {
|
||||
color:#801010;
|
||||
font-weight:bold;
|
||||
}
|
||||
span.extract {
|
||||
font-size: 15px;
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 3px;
|
||||
background-color: #eef;
|
||||
width: 100%;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
nav[role="navigation"] {
|
||||
width: 180px;
|
||||
position: fixed;
|
||||
overflow: scroll;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background: #FAFAFA;
|
||||
border-right: 1px solid #e6e6e6;
|
||||
padding: 20px 30px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul {
|
||||
border-top: 1px solid #e6e6e6;
|
||||
font-weight: 400;
|
||||
margin-bottom: 30px;
|
||||
list-style: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul ul {
|
||||
list-style: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li {
|
||||
border-bottom: 1px solid #e6e6e6
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li.active {
|
||||
border-bottom: 1px solid #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li.active a {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:visited {
|
||||
color: #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:active {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:hover {
|
||||
color: #dd2c0d
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
padding: 10px 10px 2px 2px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li span.selectedlink {
|
||||
color: #f25;
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li span.unlink {
|
||||
color: #f25;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
padding: 10px 10px 2px 2px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:visited {
|
||||
color: #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:active {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:hover {
|
||||
color: #dd2c0d
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul {
|
||||
margin-bottom: 10px;
|
||||
border-top: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li {
|
||||
border-bottom: none;
|
||||
padding: 0.1em
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li.active {
|
||||
border-bottom: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li.active a {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul a:link {
|
||||
color: #dd2c0d;
|
||||
text-decoration: none;
|
||||
text-transform: none;
|
||||
letter-spacing: 0;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
margin-left: 15px;
|
||||
padding: 0 0 3px;
|
||||
border-bottom: none;
|
||||
font-weight: 300
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul a:hover {
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
nav[role="navigation"] h2 {
|
||||
font-size: 0.95em;
|
||||
text-transform: lowercase;
|
||||
font-variant: small-caps;
|
||||
color: #999;
|
||||
padding-bottom: 0.5em
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 {
|
||||
margin-top: 0em
|
||||
}
|
||||
|
||||
main {
|
||||
max-width: 1024px;
|
||||
min-width: 320px;
|
||||
margin-left: 250px;
|
||||
min-height: 100%;
|
||||
height: auto !important;
|
||||
height: 100%
|
||||
}
|
||||
|
||||
#logo {
|
||||
text-indent: -9999px;
|
||||
height: 48px;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 0.5em;
|
||||
padding-bottom: 10px
|
||||
}
|
||||
|
||||
#logo a {
|
||||
display: block;
|
||||
width: 190px;
|
||||
height: 48px;
|
||||
background-image: url("/assets/images/swift.svg");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 190px 48px;
|
||||
background-position-x: -8px
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!--Weave of 'Complete Program' generated by 7-->
|
||||
<ul class="crumbs"><li><b>test</b></li></ul><p class="purpose">A minimal example of a C program written for inweb.</p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP1"></a><b>§1. </b>Blah. Lorum.
|
||||
Ipsum. But <code class="display"><span class="extract">identifier</span></code> as well.
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">Green.</span>
|
||||
<span class="plain">Blue.</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph">is my essential palette.
|
||||
</p>
|
||||
|
||||
<!--End of weave-->
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,488 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Complete Program</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Language" content="en-gb">
|
||||
<link href="inweb.css" rel="stylesheet" rev="stylesheet" type="text/css"><style type="text/css">
|
||||
/* This is a CSS file for pages woven by the literate programming tool inweb */
|
||||
|
||||
/* We'll start with syntax colouring, since everyone likes to toy with this: */
|
||||
|
||||
.cwebmacrotext { color: #000000; font-weight: bold; } /* The name of a web macro */
|
||||
.functiontext { color: #C00000; } /* When a C function is being defined */
|
||||
.string { color: #408040; } /* A double-quoted C literal string */
|
||||
.character { color: #204020; } /* A single-quoted C literal character */
|
||||
.constant { color: #204020; } /* A named constant */
|
||||
.element { color: #40407f; } /* A C structure element */
|
||||
.identifier { color: #4040ff; } /* An identifier */
|
||||
.reserved { color: #600000; } /* A reserved word */
|
||||
|
||||
/* Comments at the end of lines are rendered like so: */
|
||||
|
||||
.comment {
|
||||
font: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
color: #404040;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
/* The name of a web macro when being used: */
|
||||
|
||||
.cwebmacro {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
color: #000000; font-weight: bold;
|
||||
}
|
||||
|
||||
.cwebmacronumber {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
font-size: 80%;
|
||||
text-decoration: none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* And when being defined: */
|
||||
|
||||
.cwebmacrodefn {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
color: #000000; font-weight: bold;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
/* Now some generalities: */
|
||||
|
||||
body {
|
||||
background-color: #ffffff;
|
||||
margin: 8px;
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
background-color: transparent;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* Forms of paragraph: */
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* Where an inweb paragraph begins: */
|
||||
|
||||
p.inwebparagraph {
|
||||
width: 60em;
|
||||
line-height: 150%;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
/* If a web macro definition begins in its own paragraph, this is it: */
|
||||
|
||||
p.macrodefinition {
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
/* The endnotes at the foot of code: "The function foo_bar is used in ..." */
|
||||
|
||||
p.endnote {
|
||||
font-size: 0.8em;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 30px;
|
||||
text-decoration:none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* The Purpose slug: */
|
||||
|
||||
p.purpose {
|
||||
width: 60em;
|
||||
line-height: 150%;
|
||||
font-size: 1em;
|
||||
font-style:italic;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* Blocks of code appear in these */
|
||||
|
||||
pre {
|
||||
font-family: Monaco, monospace;
|
||||
}
|
||||
|
||||
pre.display {
|
||||
padding: 3px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-left: 30px;
|
||||
margin-right: 10px;
|
||||
background: #f8f8f8;
|
||||
border-width: 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: #ccc;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.displaydefn {
|
||||
padding: 3px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 10px;
|
||||
background: #f8f8f8;
|
||||
border-width: 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: #ccc;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.definitions {
|
||||
padding-top: 0px;
|
||||
margin-top: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 10px;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/* The following are for breadcrumbs of links: */
|
||||
|
||||
ul, li {
|
||||
list-style-type:none;
|
||||
padding:0;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.crumbs {
|
||||
border:1px solid #dedede;
|
||||
height:3.45em;
|
||||
}
|
||||
|
||||
.crumbs li {
|
||||
float:left;
|
||||
line-height:2.3em;
|
||||
padding-left:.75em;
|
||||
color:#333;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.crumbs li a {
|
||||
display:block;
|
||||
padding:0 15px 0 0;
|
||||
background:url(crumbs.gif) no-repeat right center;
|
||||
}
|
||||
|
||||
.crumbs li a:link, #crumbs li a:visited {
|
||||
text-decoration:none;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.crumbs li a:hover, #crumbs li a:focus {
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
/* This is for items in lists from inweb source: */
|
||||
|
||||
ul.items {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
ul.items li {
|
||||
margin-top: 1px;
|
||||
margin-bottom: 1px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* And this is for each section's table of contents: */
|
||||
|
||||
ul.toc {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
ul.toc li {
|
||||
float:left;
|
||||
margin-left: 15px;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
ul.toc li a {
|
||||
display:block;
|
||||
}
|
||||
|
||||
ul.toc li a:link, ul.toc li a:visited {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
ul.toc li a:hover, ul.toc li a:focus {
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
hr.tocbar {
|
||||
clear: both;
|
||||
margin-top:3px;
|
||||
margin-bottom:3px;
|
||||
color:#333;
|
||||
border:0
|
||||
background-color:#333;
|
||||
}
|
||||
|
||||
/* This is for cross-reference links ("This code is used in ...") */
|
||||
|
||||
p.endnote:link, p.endnote:visited, p.endnote:hover, p.endnote:focus {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
p.endnote a:link, p.endnote a:visited {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
p.endnote a:hover, p.endnote a:focus {
|
||||
text-decoration:none;
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
/* Now for the index page */
|
||||
|
||||
p.heading {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
font-size: 20
|
||||
}
|
||||
p.chapter {
|
||||
font-size: 14
|
||||
}
|
||||
p.tight {
|
||||
font-size: 12
|
||||
}
|
||||
p.tightin {
|
||||
padding-left: 25px;
|
||||
font-size: 12
|
||||
}
|
||||
.chapterlist li {
|
||||
padding-top: 8px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
.chaptertitle {
|
||||
font-weight: bold;
|
||||
}
|
||||
.chapterlist .sectionlist li {
|
||||
padding-left: 48px;
|
||||
}
|
||||
span.definitionkeyword {
|
||||
color:#801010;
|
||||
font-weight:bold;
|
||||
}
|
||||
span.extract {
|
||||
font-size: 15px;
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 3px;
|
||||
background-color: #eef;
|
||||
width: 100%;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
nav[role="navigation"] {
|
||||
width: 180px;
|
||||
position: fixed;
|
||||
overflow: scroll;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background: #FAFAFA;
|
||||
border-right: 1px solid #e6e6e6;
|
||||
padding: 20px 30px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul {
|
||||
border-top: 1px solid #e6e6e6;
|
||||
font-weight: 400;
|
||||
margin-bottom: 30px;
|
||||
list-style: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul ul {
|
||||
list-style: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li {
|
||||
border-bottom: 1px solid #e6e6e6
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li.active {
|
||||
border-bottom: 1px solid #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li.active a {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:visited {
|
||||
color: #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:active {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:hover {
|
||||
color: #dd2c0d
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
padding: 10px 10px 2px 2px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li span.selectedlink {
|
||||
color: #f25;
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li span.unlink {
|
||||
color: #f25;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
padding: 10px 10px 2px 2px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:visited {
|
||||
color: #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:active {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:hover {
|
||||
color: #dd2c0d
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul {
|
||||
margin-bottom: 10px;
|
||||
border-top: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li {
|
||||
border-bottom: none;
|
||||
padding: 0.1em
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li.active {
|
||||
border-bottom: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li.active a {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul a:link {
|
||||
color: #dd2c0d;
|
||||
text-decoration: none;
|
||||
text-transform: none;
|
||||
letter-spacing: 0;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
margin-left: 15px;
|
||||
padding: 0 0 3px;
|
||||
border-bottom: none;
|
||||
font-weight: 300
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul a:hover {
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
nav[role="navigation"] h2 {
|
||||
font-size: 0.95em;
|
||||
text-transform: lowercase;
|
||||
font-variant: small-caps;
|
||||
color: #999;
|
||||
padding-bottom: 0.5em
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 {
|
||||
margin-top: 0em
|
||||
}
|
||||
|
||||
main {
|
||||
max-width: 1024px;
|
||||
min-width: 320px;
|
||||
margin-left: 250px;
|
||||
min-height: 100%;
|
||||
height: auto !important;
|
||||
height: 100%
|
||||
}
|
||||
|
||||
#logo {
|
||||
text-indent: -9999px;
|
||||
height: 48px;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 0.5em;
|
||||
padding-bottom: 10px
|
||||
}
|
||||
|
||||
#logo a {
|
||||
display: block;
|
||||
width: 190px;
|
||||
height: 48px;
|
||||
background-image: url("/assets/images/swift.svg");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 190px 48px;
|
||||
background-position-x: -8px
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!--Weave of 'Complete Program' generated by 7-->
|
||||
<ul class="crumbs"><li><b>hellow</b></li></ul><p class="purpose">A minimal example of a C program written for inweb.</p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP1"></a><b>§1. </b></p>
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">#</span><span class="identifier">include</span><span class="plain"> <</span><span class="identifier">stdio</span><span class="plain">.</span><span class="identifier">h</span><span class="plain">></span>
|
||||
|
||||
<span class="reserved">int</span><span class="plain"> </span><span class="functiontext">main</span><span class="plain">(</span><span class="reserved">int</span><span class="plain"> </span><span class="identifier">argc</span><span class="plain">, </span><span class="reserved">char</span><span class="plain"> *</span><span class="identifier">argv</span><span class="plain">[]) {</span>
|
||||
<span class="identifier">printf</span><span class="plain">(</span><span class="string">"Hello world!\n"</span><span class="plain">);</span>
|
||||
<span class="plain">}</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<!--End of weave-->
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,510 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Complete Program</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Language" content="en-gb">
|
||||
<link href="inweb.css" rel="stylesheet" rev="stylesheet" type="text/css"><style type="text/css">
|
||||
/* This is a CSS file for pages woven by the literate programming tool inweb */
|
||||
|
||||
/* We'll start with syntax colouring, since everyone likes to toy with this: */
|
||||
|
||||
.cwebmacrotext { color: #000000; font-weight: bold; } /* The name of a web macro */
|
||||
.functiontext { color: #C00000; } /* When a C function is being defined */
|
||||
.string { color: #408040; } /* A double-quoted C literal string */
|
||||
.character { color: #204020; } /* A single-quoted C literal character */
|
||||
.constant { color: #204020; } /* A named constant */
|
||||
.element { color: #40407f; } /* A C structure element */
|
||||
.identifier { color: #4040ff; } /* An identifier */
|
||||
.reserved { color: #600000; } /* A reserved word */
|
||||
|
||||
/* Comments at the end of lines are rendered like so: */
|
||||
|
||||
.comment {
|
||||
font: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
color: #404040;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
/* The name of a web macro when being used: */
|
||||
|
||||
.cwebmacro {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
color: #000000; font-weight: bold;
|
||||
}
|
||||
|
||||
.cwebmacronumber {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
font-size: 80%;
|
||||
text-decoration: none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* And when being defined: */
|
||||
|
||||
.cwebmacrodefn {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
color: #000000; font-weight: bold;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
/* Now some generalities: */
|
||||
|
||||
body {
|
||||
background-color: #ffffff;
|
||||
margin: 8px;
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
background-color: transparent;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* Forms of paragraph: */
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* Where an inweb paragraph begins: */
|
||||
|
||||
p.inwebparagraph {
|
||||
width: 60em;
|
||||
line-height: 150%;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
/* If a web macro definition begins in its own paragraph, this is it: */
|
||||
|
||||
p.macrodefinition {
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
/* The endnotes at the foot of code: "The function foo_bar is used in ..." */
|
||||
|
||||
p.endnote {
|
||||
font-size: 0.8em;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 30px;
|
||||
text-decoration:none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* The Purpose slug: */
|
||||
|
||||
p.purpose {
|
||||
width: 60em;
|
||||
line-height: 150%;
|
||||
font-size: 1em;
|
||||
font-style:italic;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* Blocks of code appear in these */
|
||||
|
||||
pre {
|
||||
font-family: Monaco, monospace;
|
||||
}
|
||||
|
||||
pre.display {
|
||||
padding: 3px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-left: 30px;
|
||||
margin-right: 10px;
|
||||
background: #f8f8f8;
|
||||
border-width: 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: #ccc;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.displaydefn {
|
||||
padding: 3px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 10px;
|
||||
background: #f8f8f8;
|
||||
border-width: 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: #ccc;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.definitions {
|
||||
padding-top: 0px;
|
||||
margin-top: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 10px;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/* The following are for breadcrumbs of links: */
|
||||
|
||||
ul, li {
|
||||
list-style-type:none;
|
||||
padding:0;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.crumbs {
|
||||
border:1px solid #dedede;
|
||||
height:3.45em;
|
||||
}
|
||||
|
||||
.crumbs li {
|
||||
float:left;
|
||||
line-height:2.3em;
|
||||
padding-left:.75em;
|
||||
color:#333;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.crumbs li a {
|
||||
display:block;
|
||||
padding:0 15px 0 0;
|
||||
background:url(crumbs.gif) no-repeat right center;
|
||||
}
|
||||
|
||||
.crumbs li a:link, #crumbs li a:visited {
|
||||
text-decoration:none;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.crumbs li a:hover, #crumbs li a:focus {
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
/* This is for items in lists from inweb source: */
|
||||
|
||||
ul.items {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
ul.items li {
|
||||
margin-top: 1px;
|
||||
margin-bottom: 1px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* And this is for each section's table of contents: */
|
||||
|
||||
ul.toc {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
ul.toc li {
|
||||
float:left;
|
||||
margin-left: 15px;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
ul.toc li a {
|
||||
display:block;
|
||||
}
|
||||
|
||||
ul.toc li a:link, ul.toc li a:visited {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
ul.toc li a:hover, ul.toc li a:focus {
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
hr.tocbar {
|
||||
clear: both;
|
||||
margin-top:3px;
|
||||
margin-bottom:3px;
|
||||
color:#333;
|
||||
border:0
|
||||
background-color:#333;
|
||||
}
|
||||
|
||||
/* This is for cross-reference links ("This code is used in ...") */
|
||||
|
||||
p.endnote:link, p.endnote:visited, p.endnote:hover, p.endnote:focus {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
p.endnote a:link, p.endnote a:visited {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
p.endnote a:hover, p.endnote a:focus {
|
||||
text-decoration:none;
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
/* Now for the index page */
|
||||
|
||||
p.heading {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
font-size: 20
|
||||
}
|
||||
p.chapter {
|
||||
font-size: 14
|
||||
}
|
||||
p.tight {
|
||||
font-size: 12
|
||||
}
|
||||
p.tightin {
|
||||
padding-left: 25px;
|
||||
font-size: 12
|
||||
}
|
||||
.chapterlist li {
|
||||
padding-top: 8px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
.chaptertitle {
|
||||
font-weight: bold;
|
||||
}
|
||||
.chapterlist .sectionlist li {
|
||||
padding-left: 48px;
|
||||
}
|
||||
span.definitionkeyword {
|
||||
color:#801010;
|
||||
font-weight:bold;
|
||||
}
|
||||
span.extract {
|
||||
font-size: 15px;
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 3px;
|
||||
background-color: #eef;
|
||||
width: 100%;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
nav[role="navigation"] {
|
||||
width: 180px;
|
||||
position: fixed;
|
||||
overflow: scroll;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background: #FAFAFA;
|
||||
border-right: 1px solid #e6e6e6;
|
||||
padding: 20px 30px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul {
|
||||
border-top: 1px solid #e6e6e6;
|
||||
font-weight: 400;
|
||||
margin-bottom: 30px;
|
||||
list-style: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul ul {
|
||||
list-style: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li {
|
||||
border-bottom: 1px solid #e6e6e6
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li.active {
|
||||
border-bottom: 1px solid #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li.active a {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:visited {
|
||||
color: #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:active {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:hover {
|
||||
color: #dd2c0d
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
padding: 10px 10px 2px 2px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li span.selectedlink {
|
||||
color: #f25;
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li span.unlink {
|
||||
color: #f25;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
padding: 10px 10px 2px 2px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:visited {
|
||||
color: #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:active {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:hover {
|
||||
color: #dd2c0d
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul {
|
||||
margin-bottom: 10px;
|
||||
border-top: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li {
|
||||
border-bottom: none;
|
||||
padding: 0.1em
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li.active {
|
||||
border-bottom: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li.active a {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul a:link {
|
||||
color: #dd2c0d;
|
||||
text-decoration: none;
|
||||
text-transform: none;
|
||||
letter-spacing: 0;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
margin-left: 15px;
|
||||
padding: 0 0 3px;
|
||||
border-bottom: none;
|
||||
font-weight: 300
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul a:hover {
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
nav[role="navigation"] h2 {
|
||||
font-size: 0.95em;
|
||||
text-transform: lowercase;
|
||||
font-variant: small-caps;
|
||||
color: #999;
|
||||
padding-bottom: 0.5em
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 {
|
||||
margin-top: 0em
|
||||
}
|
||||
|
||||
main {
|
||||
max-width: 1024px;
|
||||
min-width: 320px;
|
||||
margin-left: 250px;
|
||||
min-height: 100%;
|
||||
height: auto !important;
|
||||
height: 100%
|
||||
}
|
||||
|
||||
#logo {
|
||||
text-indent: -9999px;
|
||||
height: 48px;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 0.5em;
|
||||
padding-bottom: 10px
|
||||
}
|
||||
|
||||
#logo a {
|
||||
display: block;
|
||||
width: 190px;
|
||||
height: 48px;
|
||||
background-image: url("/assets/images/swift.svg");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 190px 48px;
|
||||
background-position-x: -8px
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!--Weave of 'Complete Program' generated by 7-->
|
||||
<ul class="crumbs"><li><b>perl</b></li></ul><p class="purpose">A test Perl script for inweb.</p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP1"></a><b>§1. </b></p>
|
||||
|
||||
<pre class="display">
|
||||
<span class="identifier">print</span><span class="plain"> </span><span class="identifier">recolour</span><span class="plain">(</span><span class="string">"Santa likes red and green socks.\n"</span><span class="plain">);</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP2"></a><b>§2. </b></p>
|
||||
|
||||
<pre class="display">
|
||||
<span class="identifier">sub</span><span class="plain"> </span><span class="identifier">recolour</span><span class="plain"> {</span>
|
||||
<span class="identifier">my</span><span class="plain"> $</span><span class="identifier">text</span><span class="plain"> = $</span><span class="identifier">_</span><span class="plain">[0];</span>
|
||||
<<span class="cwebmacro">Change the hues</span> <span class="cwebmacronumber">2.1</span>><span class="plain">;</span>
|
||||
<span class="identifier">return</span><span class="plain"> $</span><span class="identifier">text</span><span class="plain">;</span>
|
||||
<span class="plain">}</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP2_1"></a><b>§2.1. </b><code class="display">
|
||||
<<span class="cwebmacrodefn">Change the hues</span> <span class="cwebmacronumber">2.1</span>> =
|
||||
</code></p>
|
||||
|
||||
|
||||
<pre class="displaydefn">
|
||||
<span class="plain">$</span><span class="identifier">text</span><span class="plain"> =~ </span><span class="identifier">s</span><span class="plain">/</span><span class="identifier">red</span><span class="plain">/</span><span class="identifier">blue</span><span class="plain">/;</span>
|
||||
<span class="plain">$</span><span class="identifier">text</span><span class="plain"> =~ </span><span class="identifier">s</span><span class="plain">/</span><span class="identifier">green</span><span class="plain">/</span><span class="identifier">purple</span><span class="plain">/;</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<p class="endnote">This code is used in <a href="#SP2">§2</a>.</p>
|
||||
|
||||
<!--End of weave-->
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,514 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Complete Program</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Language" content="en-gb">
|
||||
<link href="inweb.css" rel="stylesheet" rev="stylesheet" type="text/css"><style type="text/css">
|
||||
/* This is a CSS file for pages woven by the literate programming tool inweb */
|
||||
|
||||
/* We'll start with syntax colouring, since everyone likes to toy with this: */
|
||||
|
||||
.cwebmacrotext { color: #000000; font-weight: bold; } /* The name of a web macro */
|
||||
.functiontext { color: #C00000; } /* When a C function is being defined */
|
||||
.string { color: #408040; } /* A double-quoted C literal string */
|
||||
.character { color: #204020; } /* A single-quoted C literal character */
|
||||
.constant { color: #204020; } /* A named constant */
|
||||
.element { color: #40407f; } /* A C structure element */
|
||||
.identifier { color: #4040ff; } /* An identifier */
|
||||
.reserved { color: #600000; } /* A reserved word */
|
||||
|
||||
/* Comments at the end of lines are rendered like so: */
|
||||
|
||||
.comment {
|
||||
font: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
color: #404040;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
/* The name of a web macro when being used: */
|
||||
|
||||
.cwebmacro {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
color: #000000; font-weight: bold;
|
||||
}
|
||||
|
||||
.cwebmacronumber {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
font-size: 80%;
|
||||
text-decoration: none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* And when being defined: */
|
||||
|
||||
.cwebmacrodefn {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
color: #000000; font-weight: bold;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
/* Now some generalities: */
|
||||
|
||||
body {
|
||||
background-color: #ffffff;
|
||||
margin: 8px;
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
background-color: transparent;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* Forms of paragraph: */
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* Where an inweb paragraph begins: */
|
||||
|
||||
p.inwebparagraph {
|
||||
width: 60em;
|
||||
line-height: 150%;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
/* If a web macro definition begins in its own paragraph, this is it: */
|
||||
|
||||
p.macrodefinition {
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
/* The endnotes at the foot of code: "The function foo_bar is used in ..." */
|
||||
|
||||
p.endnote {
|
||||
font-size: 0.8em;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 30px;
|
||||
text-decoration:none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* The Purpose slug: */
|
||||
|
||||
p.purpose {
|
||||
width: 60em;
|
||||
line-height: 150%;
|
||||
font-size: 1em;
|
||||
font-style:italic;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* Blocks of code appear in these */
|
||||
|
||||
pre {
|
||||
font-family: Monaco, monospace;
|
||||
}
|
||||
|
||||
pre.display {
|
||||
padding: 3px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-left: 30px;
|
||||
margin-right: 10px;
|
||||
background: #f8f8f8;
|
||||
border-width: 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: #ccc;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.displaydefn {
|
||||
padding: 3px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 10px;
|
||||
background: #f8f8f8;
|
||||
border-width: 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: #ccc;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.definitions {
|
||||
padding-top: 0px;
|
||||
margin-top: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 10px;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/* The following are for breadcrumbs of links: */
|
||||
|
||||
ul, li {
|
||||
list-style-type:none;
|
||||
padding:0;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.crumbs {
|
||||
border:1px solid #dedede;
|
||||
height:3.45em;
|
||||
}
|
||||
|
||||
.crumbs li {
|
||||
float:left;
|
||||
line-height:2.3em;
|
||||
padding-left:.75em;
|
||||
color:#333;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.crumbs li a {
|
||||
display:block;
|
||||
padding:0 15px 0 0;
|
||||
background:url(crumbs.gif) no-repeat right center;
|
||||
}
|
||||
|
||||
.crumbs li a:link, #crumbs li a:visited {
|
||||
text-decoration:none;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.crumbs li a:hover, #crumbs li a:focus {
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
/* This is for items in lists from inweb source: */
|
||||
|
||||
ul.items {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
ul.items li {
|
||||
margin-top: 1px;
|
||||
margin-bottom: 1px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* And this is for each section's table of contents: */
|
||||
|
||||
ul.toc {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
ul.toc li {
|
||||
float:left;
|
||||
margin-left: 15px;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
ul.toc li a {
|
||||
display:block;
|
||||
}
|
||||
|
||||
ul.toc li a:link, ul.toc li a:visited {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
ul.toc li a:hover, ul.toc li a:focus {
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
hr.tocbar {
|
||||
clear: both;
|
||||
margin-top:3px;
|
||||
margin-bottom:3px;
|
||||
color:#333;
|
||||
border:0
|
||||
background-color:#333;
|
||||
}
|
||||
|
||||
/* This is for cross-reference links ("This code is used in ...") */
|
||||
|
||||
p.endnote:link, p.endnote:visited, p.endnote:hover, p.endnote:focus {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
p.endnote a:link, p.endnote a:visited {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
p.endnote a:hover, p.endnote a:focus {
|
||||
text-decoration:none;
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
/* Now for the index page */
|
||||
|
||||
p.heading {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
font-size: 20
|
||||
}
|
||||
p.chapter {
|
||||
font-size: 14
|
||||
}
|
||||
p.tight {
|
||||
font-size: 12
|
||||
}
|
||||
p.tightin {
|
||||
padding-left: 25px;
|
||||
font-size: 12
|
||||
}
|
||||
.chapterlist li {
|
||||
padding-top: 8px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
.chaptertitle {
|
||||
font-weight: bold;
|
||||
}
|
||||
.chapterlist .sectionlist li {
|
||||
padding-left: 48px;
|
||||
}
|
||||
span.definitionkeyword {
|
||||
color:#801010;
|
||||
font-weight:bold;
|
||||
}
|
||||
span.extract {
|
||||
font-size: 15px;
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 3px;
|
||||
background-color: #eef;
|
||||
width: 100%;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
nav[role="navigation"] {
|
||||
width: 180px;
|
||||
position: fixed;
|
||||
overflow: scroll;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background: #FAFAFA;
|
||||
border-right: 1px solid #e6e6e6;
|
||||
padding: 20px 30px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul {
|
||||
border-top: 1px solid #e6e6e6;
|
||||
font-weight: 400;
|
||||
margin-bottom: 30px;
|
||||
list-style: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul ul {
|
||||
list-style: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li {
|
||||
border-bottom: 1px solid #e6e6e6
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li.active {
|
||||
border-bottom: 1px solid #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li.active a {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:visited {
|
||||
color: #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:active {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:hover {
|
||||
color: #dd2c0d
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
padding: 10px 10px 2px 2px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li span.selectedlink {
|
||||
color: #f25;
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li span.unlink {
|
||||
color: #f25;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
padding: 10px 10px 2px 2px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:visited {
|
||||
color: #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:active {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:hover {
|
||||
color: #dd2c0d
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul {
|
||||
margin-bottom: 10px;
|
||||
border-top: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li {
|
||||
border-bottom: none;
|
||||
padding: 0.1em
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li.active {
|
||||
border-bottom: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li.active a {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul a:link {
|
||||
color: #dd2c0d;
|
||||
text-decoration: none;
|
||||
text-transform: none;
|
||||
letter-spacing: 0;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
margin-left: 15px;
|
||||
padding: 0 0 3px;
|
||||
border-bottom: none;
|
||||
font-weight: 300
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul a:hover {
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
nav[role="navigation"] h2 {
|
||||
font-size: 0.95em;
|
||||
text-transform: lowercase;
|
||||
font-variant: small-caps;
|
||||
color: #999;
|
||||
padding-bottom: 0.5em
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 {
|
||||
margin-top: 0em
|
||||
}
|
||||
|
||||
main {
|
||||
max-width: 1024px;
|
||||
min-width: 320px;
|
||||
margin-left: 250px;
|
||||
min-height: 100%;
|
||||
height: auto !important;
|
||||
height: 100%
|
||||
}
|
||||
|
||||
#logo {
|
||||
text-indent: -9999px;
|
||||
height: 48px;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 0.5em;
|
||||
padding-bottom: 10px
|
||||
}
|
||||
|
||||
#logo a {
|
||||
display: block;
|
||||
width: 190px;
|
||||
height: 48px;
|
||||
background-image: url("/assets/images/swift.svg");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 190px 48px;
|
||||
background-position-x: -8px
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!--Weave of 'Complete Program' generated by 7-->
|
||||
<ul class="crumbs"><li><b>plain</b></li></ul><p class="purpose">Tangling and weaving some text file.</p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP1"></a><b>§1. </b></p>
|
||||
|
||||
<pre class="display">
|
||||
<<span class="cwebmacro">Titling</span> <span class="cwebmacronumber">1.1</span>>
|
||||
<span class="plain">No one would have believed in the last years of the</span>
|
||||
<span class="plain">nineteenth century that this world was being watched keenly</span>
|
||||
<span class="plain">and closely by intelligences greater than man's and yet as</span>
|
||||
<span class="plain">mortal as his own; that as men busied themselves about their</span>
|
||||
<span class="plain">various concerns they were scrutinised and studied, perhaps</span>
|
||||
<span class="plain">almost as narrowly as a man with a microscope might scrutinise</span>
|
||||
<span class="plain">the transient creatures that swarm and multiply in a drop of water.</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP1_1"></a><b>§1.1. </b><code class="display">
|
||||
<<span class="cwebmacrodefn">Titling</span> <span class="cwebmacronumber">1.1</span>> =
|
||||
</code></p>
|
||||
|
||||
|
||||
<pre class="displaydefn">
|
||||
<span class="plain">Book One</span>
|
||||
<span class="plain">The Coming of the Martians</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<p class="endnote">This code is used in <a href="#SP1">§1</a>.</p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP2"></a><b>§2. </b></p>
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">With infinite complacency men went to and fro over this globe about</span>
|
||||
<span class="plain">their little affairs, serene in their assurance of their empire over matter.</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<!--End of weave-->
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,576 +0,0 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Complete Program</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="Content-Language" content="en-gb">
|
||||
<link href="inweb.css" rel="stylesheet" rev="stylesheet" type="text/css"><style type="text/css">
|
||||
/* This is a CSS file for pages woven by the literate programming tool inweb */
|
||||
|
||||
/* We'll start with syntax colouring, since everyone likes to toy with this: */
|
||||
|
||||
.cwebmacrotext { color: #000000; font-weight: bold; } /* The name of a web macro */
|
||||
.functiontext { color: #C00000; } /* When a C function is being defined */
|
||||
.string { color: #408040; } /* A double-quoted C literal string */
|
||||
.character { color: #204020; } /* A single-quoted C literal character */
|
||||
.constant { color: #204020; } /* A named constant */
|
||||
.element { color: #40407f; } /* A C structure element */
|
||||
.identifier { color: #4040ff; } /* An identifier */
|
||||
.reserved { color: #600000; } /* A reserved word */
|
||||
|
||||
/* Comments at the end of lines are rendered like so: */
|
||||
|
||||
.comment {
|
||||
font: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
color: #404040;
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
/* The name of a web macro when being used: */
|
||||
|
||||
.cwebmacro {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
color: #000000; font-weight: bold;
|
||||
}
|
||||
|
||||
.cwebmacronumber {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
font-size: 80%;
|
||||
text-decoration: none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* And when being defined: */
|
||||
|
||||
.cwebmacrodefn {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
text-decoration: none;
|
||||
color: #000000; font-weight: bold;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
/* Now some generalities: */
|
||||
|
||||
body {
|
||||
background-color: #ffffff;
|
||||
margin: 8px;
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, Verdana, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
background-color: transparent;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
/* Forms of paragraph: */
|
||||
|
||||
p {
|
||||
margin: 0;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
/* Where an inweb paragraph begins: */
|
||||
|
||||
p.inwebparagraph {
|
||||
width: 60em;
|
||||
line-height: 150%;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
/* If a web macro definition begins in its own paragraph, this is it: */
|
||||
|
||||
p.macrodefinition {
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
/* The endnotes at the foot of code: "The function foo_bar is used in ..." */
|
||||
|
||||
p.endnote {
|
||||
font-size: 0.8em;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
margin-left: 30px;
|
||||
text-decoration:none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* The Purpose slug: */
|
||||
|
||||
p.purpose {
|
||||
width: 60em;
|
||||
line-height: 150%;
|
||||
font-size: 1em;
|
||||
font-style:italic;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* Blocks of code appear in these */
|
||||
|
||||
pre {
|
||||
font-family: Monaco, monospace;
|
||||
}
|
||||
|
||||
pre.display {
|
||||
padding: 3px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-left: 30px;
|
||||
margin-right: 10px;
|
||||
background: #f8f8f8;
|
||||
border-width: 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: #ccc;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.displaydefn {
|
||||
padding: 3px;
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 10px;
|
||||
background: #f8f8f8;
|
||||
border-width: 1px;
|
||||
border-style: solid solid solid solid;
|
||||
border-color: #ccc;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
pre.definitions {
|
||||
padding-top: 0px;
|
||||
margin-top: 0px;
|
||||
margin-left: 0px;
|
||||
margin-right: 10px;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/* The following are for breadcrumbs of links: */
|
||||
|
||||
ul, li {
|
||||
list-style-type:none;
|
||||
padding:0;
|
||||
margin:0;
|
||||
}
|
||||
|
||||
.crumbs {
|
||||
border:1px solid #dedede;
|
||||
height:3.45em;
|
||||
}
|
||||
|
||||
.crumbs li {
|
||||
float:left;
|
||||
line-height:2.3em;
|
||||
padding-left:.75em;
|
||||
color:#333;
|
||||
font-size: 1.5em;
|
||||
}
|
||||
|
||||
.crumbs li a {
|
||||
display:block;
|
||||
padding:0 15px 0 0;
|
||||
background:url(crumbs.gif) no-repeat right center;
|
||||
}
|
||||
|
||||
.crumbs li a:link, #crumbs li a:visited {
|
||||
text-decoration:none;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.crumbs li a:hover, #crumbs li a:focus {
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
/* This is for items in lists from inweb source: */
|
||||
|
||||
ul.items {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
ul.items li {
|
||||
margin-top: 1px;
|
||||
margin-bottom: 1px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
/* And this is for each section's table of contents: */
|
||||
|
||||
ul.toc {
|
||||
margin-top: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
ul.toc li {
|
||||
float:left;
|
||||
margin-left: 15px;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
ul.toc li a {
|
||||
display:block;
|
||||
}
|
||||
|
||||
ul.toc li a:link, ul.toc li a:visited {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
ul.toc li a:hover, ul.toc li a:focus {
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
hr.tocbar {
|
||||
clear: both;
|
||||
margin-top:3px;
|
||||
margin-bottom:3px;
|
||||
color:#333;
|
||||
border:0
|
||||
background-color:#333;
|
||||
}
|
||||
|
||||
/* This is for cross-reference links ("This code is used in ...") */
|
||||
|
||||
p.endnote:link, p.endnote:visited, p.endnote:hover, p.endnote:focus {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
p.endnote a:link, p.endnote a:visited {
|
||||
text-decoration:none;
|
||||
color:#000;
|
||||
}
|
||||
|
||||
p.endnote a:hover, p.endnote a:focus {
|
||||
text-decoration:none;
|
||||
color:#dd2c0d;
|
||||
}
|
||||
|
||||
/* Now for the index page */
|
||||
|
||||
p.heading {
|
||||
margin-top: 2px;
|
||||
margin-bottom: 2px;
|
||||
font-size: 20
|
||||
}
|
||||
p.chapter {
|
||||
font-size: 14
|
||||
}
|
||||
p.tight {
|
||||
font-size: 12
|
||||
}
|
||||
p.tightin {
|
||||
padding-left: 25px;
|
||||
font-size: 12
|
||||
}
|
||||
.chapterlist li {
|
||||
padding-top: 8px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
.chaptertitle {
|
||||
font-weight: bold;
|
||||
}
|
||||
.chapterlist .sectionlist li {
|
||||
padding-left: 48px;
|
||||
}
|
||||
span.definitionkeyword {
|
||||
color:#801010;
|
||||
font-weight:bold;
|
||||
}
|
||||
span.extract {
|
||||
font-size: 15px;
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 3px;
|
||||
background-color: #eef;
|
||||
width: 100%;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
nav[role="navigation"] {
|
||||
width: 180px;
|
||||
position: fixed;
|
||||
overflow: scroll;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background: #FAFAFA;
|
||||
border-right: 1px solid #e6e6e6;
|
||||
padding: 20px 30px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul {
|
||||
border-top: 1px solid #e6e6e6;
|
||||
font-weight: 400;
|
||||
margin-bottom: 30px;
|
||||
list-style: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul ul {
|
||||
list-style: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li {
|
||||
border-bottom: 1px solid #e6e6e6
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li.active {
|
||||
border-bottom: 1px solid #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li.active a {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:visited {
|
||||
color: #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:active {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 a:hover {
|
||||
color: #dd2c0d
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:link {
|
||||
color: #333;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
padding: 10px 10px 2px 2px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li span.selectedlink {
|
||||
color: #f25;
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li span.unlink {
|
||||
color: #f25;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
padding: 10px 10px 2px 2px
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:visited {
|
||||
color: #333
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:active {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li a:hover {
|
||||
color: #dd2c0d
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul {
|
||||
margin-bottom: 10px;
|
||||
border-top: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li {
|
||||
border-bottom: none;
|
||||
padding: 0.1em
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li.active {
|
||||
border-bottom: none
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul li.active a {
|
||||
font-weight: 700
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul a:link {
|
||||
color: #dd2c0d;
|
||||
text-decoration: none;
|
||||
text-transform: none;
|
||||
letter-spacing: 0;
|
||||
font-size: 12px;
|
||||
display: block;
|
||||
margin-left: 15px;
|
||||
padding: 0 0 3px;
|
||||
border-bottom: none;
|
||||
font-weight: 300
|
||||
}
|
||||
|
||||
nav[role="navigation"] ul li ul a:hover {
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
nav[role="navigation"] h2 {
|
||||
font-size: 0.95em;
|
||||
text-transform: lowercase;
|
||||
font-variant: small-caps;
|
||||
color: #999;
|
||||
padding-bottom: 0.5em
|
||||
}
|
||||
|
||||
nav[role="navigation"] h1 {
|
||||
margin-top: 0em
|
||||
}
|
||||
|
||||
main {
|
||||
max-width: 1024px;
|
||||
min-width: 320px;
|
||||
margin-left: 250px;
|
||||
min-height: 100%;
|
||||
height: auto !important;
|
||||
height: 100%
|
||||
}
|
||||
|
||||
#logo {
|
||||
text-indent: -9999px;
|
||||
height: 48px;
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 0.5em;
|
||||
padding-bottom: 10px
|
||||
}
|
||||
|
||||
#logo a {
|
||||
display: block;
|
||||
width: 190px;
|
||||
height: 48px;
|
||||
background-image: url("/assets/images/swift.svg");
|
||||
background-repeat: no-repeat;
|
||||
background-size: 190px 48px;
|
||||
background-position-x: -8px
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!--Weave of 'Complete Program' generated by 7-->
|
||||
<ul class="crumbs"><li><b>The Twin Primes Conjecture</b></li></ul><p class="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.</p>
|
||||
|
||||
<ul class="toc"><li><a href="#SP1">§1. The conjecture</a></li><li><a href="#SP2">§2. Primality</a></li></ul><hr class="tocbar">
|
||||
|
||||
<p class="inwebparagraph"><a id="SP1"></a><b>§1. The conjecture. </b>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).
|
||||
</p>
|
||||
|
||||
<p class="inwebparagraph">This program finds a few small pairs of twins, by the simplest method possible,
|
||||
and should print output like so:
|
||||
</p>
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">3 and 5</span>
|
||||
<span class="plain">5 and 7</span>
|
||||
<span class="plain">11 and 13</span>
|
||||
<span class="plain">...</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
|
||||
<pre class="definitions">
|
||||
<span class="definitionkeyword">define</span> <span class="constant">RANGE</span><span class="plain"> </span><span class="constant">100</span><span class="plain"> </span><span class="comment"> the upper limit to the numbers we will consider</span>
|
||||
</pre>
|
||||
|
||||
<pre class="display">
|
||||
<span class="plain">#</span><span class="identifier">include</span><span class="plain"> <</span><span class="identifier">stdio</span><span class="plain">.</span><span class="identifier">h</span><span class="plain">></span>
|
||||
|
||||
<span class="reserved">int</span><span class="plain"> </span><span class="functiontext">main</span><span class="plain">(</span><span class="reserved">int</span><span class="plain"> </span><span class="identifier">argc</span><span class="plain">, </span><span class="reserved">char</span><span class="plain"> *</span><span class="identifier">argv</span><span class="plain">[]) {</span>
|
||||
<span class="reserved">for</span><span class="plain"> (</span><span class="reserved">int</span><span class="plain"> </span><span class="identifier">i</span><span class="plain">=1; </span><span class="identifier">i</span><span class="plain"><</span><span class="constant">RANGE</span><span class="plain">; </span><span class="identifier">i</span><span class="plain">++)</span>
|
||||
<<span class="cwebmacro">Test for twin prime at i</span> <span class="cwebmacronumber">1.1</span>><span class="plain">;</span>
|
||||
<span class="plain">}</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP1_1"></a><b>§1.1. </b><code class="display">
|
||||
<<span class="cwebmacrodefn">Test for twin prime at i</span> <span class="cwebmacronumber">1.1</span>> =
|
||||
</code></p>
|
||||
|
||||
|
||||
<pre class="displaydefn">
|
||||
<span class="reserved">if</span><span class="plain"> ((</span><span class="functiontext"><a href="#SP2">isprime</a></span><span class="plain">(</span><span class="identifier">i</span><span class="plain">)) && (</span><span class="functiontext"><a href="#SP2">isprime</a></span><span class="plain">(</span><span class="identifier">i</span><span class="plain">+2)))</span>
|
||||
<span class="identifier">printf</span><span class="plain">(</span><span class="string">"%d and %d\n"</span><span class="plain">, </span><span class="identifier">i</span><span class="plain">, </span><span class="identifier">i</span><span class="plain">+2);</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<p class="endnote">This code is used in <a href="#SP1">§1</a>.</p>
|
||||
|
||||
<p class="inwebparagraph"><a id="SP2"></a><b>§2. Primality. </b>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.
|
||||
</p>
|
||||
|
||||
|
||||
<pre class="definitions">
|
||||
<span class="definitionkeyword">define</span> <span class="constant">TRUE</span><span class="plain"> </span><span class="constant">1</span>
|
||||
<span class="definitionkeyword">define</span> <span class="constant">FALSE</span><span class="plain"> </span><span class="constant">0</span>
|
||||
</pre>
|
||||
|
||||
<pre class="display">
|
||||
<span class="reserved">int</span><span class="plain"> </span><span class="functiontext">isprime<button class="popup" onclick="togglePopup('usagePopup0')">...<span class="popuptext" id="usagePopup0">Usage of <b>isprime</b>:<br><a href="#SP1_1">§1.1</a></span></button></span><span class="plain">(</span><span class="reserved">int</span><span class="plain"> </span><span class="identifier">n</span><span class="plain">) {</span>
|
||||
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">n</span><span class="plain"> <= </span><span class="constant">1</span><span class="plain">) </span><span class="reserved">return</span><span class="plain"> </span><span class="constant">FALSE</span><span class="plain">;</span>
|
||||
<span class="reserved">for</span><span class="plain"> (</span><span class="reserved">int</span><span class="plain"> </span><span class="identifier">m</span><span class="plain"> = </span><span class="constant">2</span><span class="plain">; </span><span class="identifier">m</span><span class="plain">*</span><span class="identifier">m</span><span class="plain"> <= </span><span class="identifier">n</span><span class="plain">; </span><span class="identifier">m</span><span class="plain">++)</span>
|
||||
<span class="reserved">if</span><span class="plain"> (</span><span class="identifier">n</span><span class="plain"> % </span><span class="identifier">m</span><span class="plain"> == </span><span class="constant">0</span><span class="plain">)</span>
|
||||
<span class="reserved">return</span><span class="plain"> </span><span class="constant">FALSE</span><span class="plain">;</span>
|
||||
<span class="reserved">return</span><span class="plain"> </span><span class="constant">TRUE</span><span class="plain">;</span>
|
||||
<span class="plain">}</span>
|
||||
</pre>
|
||||
|
||||
<p class="inwebparagraph"></p>
|
||||
|
||||
<!--End of weave-->
|
||||
<script>
|
||||
MathJax = {
|
||||
tex: {
|
||||
inlineMath: '$', '$'], ['\\(', '\\)'
|
||||
},
|
||||
svg: {
|
||||
fontCache: 'global'
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" id="MathJax-script" async
|
||||
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js">
|
||||
</script>
|
||||
|
||||
<script>
|
||||
function togglePopup(material_id) {
|
||||
var popup = document.getElementById(material_id);
|
||||
popup.classList.toggle("show");
|
||||
}
|
||||
</script>
|
||||
|
||||
<link href="Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
|
||||
</body>
|
||||
</html>
|
||||
|
159
Tests/Test Weave Tree/_Results_Ideal/sp.txt
Normal file
159
Tests/Test Weave Tree/_Results_Ideal/sp.txt
Normal file
|
@ -0,0 +1,159 @@
|
|||
document weave order 0
|
||||
head banner <Weave of 'Summing Primes' generated by Inweb>
|
||||
body
|
||||
chapter <Sections>
|
||||
chapter header <Sections>
|
||||
section <Summing Primes>
|
||||
section header <Summing Primes>
|
||||
section purpose <Here we verify the conjecture for small numbers.>
|
||||
paragraph P1
|
||||
material discussion
|
||||
commentary <So, this is a program to see if even numbers from 4 to 100 can all be written\n>
|
||||
commentary <as a sum of two primes. Christian Goldbach asked Euler in 1742 if every even\n>
|
||||
commentary <number greater than 2 can be written this way. This remains open, though --\n>
|
||||
item depth 1 label <a>
|
||||
commentary <every even number is a sum of at most six primes (Ramaré, 1995), and\n>
|
||||
item depth 1 label <b>
|
||||
commentary <every odd number is a sum of at most five (Tao, 2012).\n>
|
||||
vskip (in comment)
|
||||
commentary <Besides which, >
|
||||
inline
|
||||
source_code <printf(k+1)>
|
||||
_xxxxxxxxxxx_
|
||||
commentary <, to say the least: see >
|
||||
url content <http://www.google.com> url <http://www.google.com>
|
||||
commentary <\n>
|
||||
commentary <or for that matter see >
|
||||
url content <The Sieve of Eratosthenes> url <S-tsoe.html>
|
||||
commentary <.\n>
|
||||
figure <Letter.jpg> -1 by 720
|
||||
vskip (in comment)
|
||||
commentary <Computer verification has been made up to around >
|
||||
mathematics <10^{18}>
|
||||
commentary <, but by rather better\n>
|
||||
commentary <methods.>
|
||||
footnote_cue [1]
|
||||
commentary < Which is awesome.>
|
||||
footnote_cue [2]
|
||||
commentary < And >
|
||||
mathematics <i<j>
|
||||
commentary <, that's for sure.\n>
|
||||
mathematics < \int_0^1 \cos x {\rm d}x > (displayed)
|
||||
commentary <\n>
|
||||
commentary <Which is really the point.\n>
|
||||
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 <And now...\n>
|
||||
carousel slide caption <This is numero 1>
|
||||
figure <img1.jpg> -1 by -1
|
||||
carousel slide caption <>
|
||||
figure <img2.jpg> -1 by -1
|
||||
carousel slide caption <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.>
|
||||
figure <img3.jpg> -1 by -1
|
||||
vskip (in comment)
|
||||
commentary <So there, really!\n>
|
||||
paragraph P3
|
||||
material definition
|
||||
code line
|
||||
defn <define>
|
||||
source_code <RANGE 100>
|
||||
_nnnnnpnnn_
|
||||
material code: C
|
||||
code line
|
||||
source_code <#include <stdio.h>>
|
||||
_piiiiiiippiiiiipip_
|
||||
vskip
|
||||
code line
|
||||
source_code <int main(int argc, char *argv[]) {>
|
||||
_rrrpffffprrrpiiiipprrrrppiiiippppp_
|
||||
code line
|
||||
source_code < for (int i=4; i<RANGE; i=i+2) >
|
||||
_pppprrrpprrrpippppipnnnnnppipipppp_
|
||||
commentary < stepping in twos to stay even> (code)
|
||||
code line
|
||||
source_code < >
|
||||
_pppppppp_
|
||||
pmac <Solve Goldbach's conjecture for i>
|
||||
source_code <;>
|
||||
_c_
|
||||
code line
|
||||
source_code <}>
|
||||
_c_
|
||||
paragraph P3.1
|
||||
material discussion
|
||||
commentary <This ought to print:\n>
|
||||
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 <https://www.wikipedia.org> url <https://www.wikipedia.org>
|
||||
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 <We'll print each different pair of primes adding up to i. We\n>
|
||||
commentary <only check in the range >
|
||||
mathematics <2 \leq j \leq i/2>
|
||||
commentary < to avoid counting pairs\n>
|
||||
commentary <twice over (thus >
|
||||
mathematics <8 = 3+5 = 5+3>
|
||||
commentary <, but that's hardly two different ways).\n>
|
||||
material paragraph macro
|
||||
code line
|
||||
pmac <Solve Goldbach's conjecture for i> (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 <isprime>
|
||||
source_code <(j)) && (>
|
||||
_pippppppp_
|
||||
function usage <isprime>
|
||||
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 <This code is >
|
||||
commentary <used in >
|
||||
locale P3
|
||||
commentary <.>
|
||||
section footer <Summing Primes>
|
||||
chapter footer <Sections>
|
||||
tail rennab <End of weave>
|
149
Tests/Test Weave Tree/_Results_Ideal/tsoe.txt
Normal file
149
Tests/Test Weave Tree/_Results_Ideal/tsoe.txt
Normal file
|
@ -0,0 +1,149 @@
|
|||
document weave order 0
|
||||
head banner <Weave of 'The Sieve of Eratosthenes' generated by Inweb>
|
||||
body
|
||||
chapter <Sections>
|
||||
chapter header <Sections>
|
||||
section <The Sieve of Eratosthenes>
|
||||
section header <The Sieve of Eratosthenes>
|
||||
section purpose <A fairly fast way to determine if small numbers are prime, given storage.>
|
||||
toc - <S/tsoe>
|
||||
toc line - <S1, Storage> P1'Storage'
|
||||
toc line - <S2, Primality> P2'Primality'
|
||||
paragraph P1'Storage'
|
||||
material discussion
|
||||
commentary <This technique, still essentially the best sieve for finding prime\n>
|
||||
commentary <numbers, is attributed to Eratosthenes of Cyrene and dates from the 200s BC.\n>
|
||||
commentary <Since composite numbers are exactly those numbers which are multiples of\n>
|
||||
commentary <something, the idea is to remove everything which is a multiple: whatever\n>
|
||||
commentary <is left, must be prime.\n>
|
||||
vskip (in comment)
|
||||
commentary <This is very fast (and can be done more quickly than the implementation\n>
|
||||
commentary <below), but (a) uses storage to hold the sieve, and (b) has to start right\n>
|
||||
commentary <back at 2 - so it can't efficiently test just, say, the eight-digit numbers\n>
|
||||
commentary <for primality.\n>
|
||||
material code: C
|
||||
code line
|
||||
source_code <int still_in_sieve[RANGE + 1];>
|
||||
_rrrpiiiiiiiiiiiiiipnnnnnpppnpp_
|
||||
code line
|
||||
source_code <int sieve_performed = FALSE;>
|
||||
_rrrpiiiiiiiiiiiiiiipppnnnnnp_
|
||||
paragraph P2'Primality'
|
||||
material discussion
|
||||
commentary <We provide this as a function which determines whether a number is prime:\n>
|
||||
material definition
|
||||
code line
|
||||
defn <define>
|
||||
source_code <TRUE 1>
|
||||
_nnnnpn_
|
||||
code line
|
||||
defn <define>
|
||||
source_code <FALSE 0>
|
||||
_nnnnnpn_
|
||||
material code: C
|
||||
code line
|
||||
source_code <int >
|
||||
_rrrp_
|
||||
function defn <isprime>
|
||||
commentary <Summing Primes>
|
||||
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 <Perform the sieve>
|
||||
source_code <;>
|
||||
_p_
|
||||
code line
|
||||
source_code < return still_in_sieve[n];>
|
||||
_pppprrrrrrpiiiiiiiiiiiiiipipp_
|
||||
code line
|
||||
source_code <}>
|
||||
_p_
|
||||
paragraph P2.1
|
||||
material discussion
|
||||
commentary <We save a little time by noting that if a number up to >
|
||||
inline
|
||||
source_code <RANGE>
|
||||
_xxxxx_
|
||||
commentary < is composite\n>
|
||||
commentary <then one of its factors must be smaller than the square root of >
|
||||
inline
|
||||
source_code <RANGE>
|
||||
_xxxxx_
|
||||
commentary <. Thus,\n>
|
||||
commentary <in a sieve of size 10000, one only needs to remove multiples of 2 up to 100,\n>
|
||||
commentary <for example.\n>
|
||||
material paragraph macro
|
||||
code line
|
||||
pmac <Perform the sieve> (definition)
|
||||
material code: C
|
||||
code line
|
||||
source_code < >
|
||||
_pppp_
|
||||
pmac <Start with all numbers from 2 upwards in the sieve>
|
||||
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 <Shake out multiples of n>
|
||||
source_code <;>
|
||||
_p_
|
||||
code line
|
||||
source_code < sieve_performed = TRUE;>
|
||||
_ppppiiiiiiiiiiiiiiipppnnnnp_
|
||||
material endnotes
|
||||
endnote
|
||||
commentary <This code is >
|
||||
commentary <used in >
|
||||
locale P2'Primality'
|
||||
commentary <.>
|
||||
paragraph P2.1.1
|
||||
material paragraph macro
|
||||
code line
|
||||
pmac <Start with all numbers from 2 upwards in the sieve> (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 <This code is >
|
||||
commentary <used in >
|
||||
locale P2.1
|
||||
commentary <.>
|
||||
paragraph P2.1.2
|
||||
material paragraph macro
|
||||
code line
|
||||
pmac <Shake out multiples of n> (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 <This code is >
|
||||
commentary <used in >
|
||||
locale P2.1
|
||||
commentary <.>
|
||||
section footer <The Sieve of Eratosthenes>
|
||||
chapter footer <Sections>
|
||||
tail rennab <End of weave>
|
0
Tests/Test Weave Tree/sp.txt
Normal file
0
Tests/Test Weave Tree/sp.txt
Normal file
0
Tests/Test Weave Tree/tsoe.txt
Normal file
0
Tests/Test Weave Tree/tsoe.txt
Normal file
8
Tests/Test Weave Tree/variations/Contents.w
Normal file
8
Tests/Test Weave Tree/variations/Contents.w
Normal file
|
@ -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
|
70
Tests/Test Weave Tree/variations/Sections/Summing Primes.w
Executable file
70
Tests/Test Weave Tree/variations/Sections/Summing Primes.w
Executable file
|
@ -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<j$, that's for sure.
|
||||
$$ \int_0^1 \cos x {\rm d}x $$
|
||||
Which is really the point.
|
||||
|
||||
[1] And don't just take my word for it.
|
||||
|
||||
[2] Really!
|
||||
|
||||
@ And now...
|
||||
|
||||
= (carousel "This is numero 1" above)
|
||||
= (figure img1.jpg)
|
||||
= (carousel)
|
||||
= (figure img2.jpg)
|
||||
= (carousel "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." below)
|
||||
= (figure img3.jpg)
|
||||
= (carousel end)
|
||||
|
||||
So there, really!
|
||||
|
||||
@
|
||||
|
||||
@d RANGE 100
|
||||
|
||||
=
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
for (int i=4; i<RANGE; i=i+2) /* stepping in twos to stay even */
|
||||
@<Solve Goldbach's conjecture for 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).
|
||||
|
||||
@<Solve Goldbach's conjecture for i@> =
|
||||
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");
|
52
Tests/Test Weave Tree/variations/Sections/The Sieve of Eratosthenes.w
Executable file
52
Tests/Test Weave Tree/variations/Sections/The Sieve of Eratosthenes.w
Executable file
|
@ -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) @<Perform the sieve@>;
|
||||
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.
|
||||
|
||||
@<Perform the sieve@> =
|
||||
@<Start with all numbers from 2 upwards in the sieve@>;
|
||||
for (int n=2; n*n <= RANGE; n++)
|
||||
if (still_in_sieve[n])
|
||||
@<Shake out multiples of n@>;
|
||||
sieve_performed = TRUE;
|
||||
|
||||
@<Start with all numbers from 2 upwards in the sieve@> =
|
||||
still_in_sieve[1] = FALSE;
|
||||
for (int n=2; n <= RANGE; n++) still_in_sieve[n] = TRUE;
|
||||
|
||||
@<Shake out multiples of n@> =
|
||||
for (int m= n+n; m <= RANGE; m += n) still_in_sieve[m] = FALSE;
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Prerelease: alpha.1
|
||||
Build Date: 22 April 2020
|
||||
Build Number: 1A27
|
||||
Build Date: 23 April 2020
|
||||
Build Number: 1A28
|
||||
|
|
|
@ -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/
|
||||
|
|
Loading…
Reference in a new issue