Added ctags support

This commit is contained in:
Graham Nelson 2021-08-11 12:01:50 +01:00
parent 7875f3e7e6
commit 69da61fe56
36 changed files with 975 additions and 244 deletions

1
.gitignore vendored
View file

@ -4,6 +4,7 @@
.DS_Store
Manual.html
debug-log.txt
tags
Woven/
Tangled/inweb
Tangled/inweb_dev*

View file

@ -18,6 +18,7 @@ see //foundation: A Brief Guide to Foundation//.
@e colour_scheme_CLASS
@e colouring_language_block_CLASS
@e colouring_rule_CLASS
@e defined_constant_CLASS
@e enumeration_set_CLASS
@e footnote_CLASS
@e hash_table_entry_CLASS
@ -106,6 +107,7 @@ DECLARE_CLASS(colony_member)
DECLARE_CLASS(colour_scheme)
DECLARE_CLASS(colouring_language_block)
DECLARE_CLASS(colouring_rule)
DECLARE_CLASS(defined_constant)
DECLARE_CLASS(enumeration_set)
DECLARE_CLASS(footnote)
DECLARE_CLASS(hash_table_entry_usage)

View file

@ -25,10 +25,12 @@ typedef struct inweb_instructions {
int structures_switch; /* |-structures|: print catalogue of structures within sections */
int advance_switch; /* |-advance-build|: advance build file for web */
int scan_switch; /* |-scan|: simply show the syntactic scan of the source */
int ctags_switch; /* |-ctags|: generate a set of Universal Ctags on each tangle */
struct filename *weave_to_setting; /* |-weave-to X|: the pathname X, if supplied */
struct pathname *weave_into_setting; /* |-weave-into X|: the pathname X, if supplied */
int sequential; /* give the sections sequential sigils */
struct filename *tangle_setting; /* |-tangle-to X|: the pathname X, if supplied */
struct filename *ctags_setting; /* |-ctags-to X|: the pathname X, if supplied */
struct filename *makefile_setting; /* |-makefile X|: the filename X, if supplied */
struct filename *gitignore_setting; /* |-gitignore X|: the filename X, if supplied */
struct filename *advance_setting; /* |-advance-build-file X|: advance build file X */
@ -82,11 +84,13 @@ inweb_instructions Configuration::read(int argc, char **argv) {
args.advance_switch = FALSE;
args.scan_switch = FALSE;
args.verbose_switch = FALSE;
args.ctags_switch = TRUE;
args.chosen_web = NULL;
args.chosen_file = NULL;
args.chosen_range = Str::new();
args.chosen_range_actually_chosen = FALSE;
args.tangle_setting = NULL;
args.ctags_setting = NULL;
args.weave_to_setting = NULL;
args.weave_into_setting = NULL;
args.makefile_setting = NULL;
@ -148,6 +152,8 @@ provides automatically.
@e TANGLE_CLSW
@e TANGLE_TO_CLSW
@e CTAGS_TO_CLSW
@e CTAGS_CLSW
@e COLONIAL_CLSG
@ -235,6 +241,10 @@ provides automatically.
L"tangle the web into machine-compilable form");
CommandLine::declare_switch(TANGLE_TO_CLSW, L"tangle-to", 2,
L"tangle, but to filename X");
CommandLine::declare_switch(CTAGS_TO_CLSW, L"ctags-to", 2,
L"tangle, but write Universal Ctags file to X not to 'tags'");
CommandLine::declare_boolean_switch(CTAGS_CLSW, L"ctags", 1,
L"write a Universal Ctags file when tangling", TRUE);
CommandLine::end_group();
CommandLine::begin_group(COLONIAL_CLSG,
@ -347,6 +357,12 @@ void Configuration::switch(int id, int val, text_stream *arg, void *state) {
case TANGLE_TO_CLSW:
args->tangle_setting = Filenames::from_text(arg);
Configuration::set_fundamental_mode(args, TANGLE_MODE); break;
case CTAGS_TO_CLSW:
args->ctags_setting = Filenames::from_text(arg);
break;
case CTAGS_CLSW:
args->ctags_switch = val;
break;
default: internal_error("unimplemented switch");
}

View file

@ -211,6 +211,7 @@ line , but otherwise we impose a sensible choice based on the target.
}
if (tn == NULL) tn = Tangler::primary_target(W);
Tangler::tangle(W, tn, tangle_to);
if (ins->ctags_switch) Ctags::write(W, ins->ctags_setting);
DISCARD_TEXT(tangle_leaf)
@ Here the target number is 0, and the tangle is of the main part of the web,

View file

@ -658,6 +658,7 @@ C preprocessor macros, Inform 6 |Constant|s, and so on.
L->text_operand2 = Str::new(); /* no value given */
}
Analyser::mark_reserved_word_at_line(L, L->text_operand, CONSTANT_COLOUR);
Ctags::note_defined_constant(L, L->text_operand);
comment_mode = FALSE;
L->is_commentary = FALSE;
Regexp::dispose_of(&mr);
@ -689,6 +690,7 @@ enumerated sort of |@d|.
if (inweb_mode == TANGLE_MODE)
Enumerations::define(L->text_operand2, L->text_operand, from, L);
Analyser::mark_reserved_word_at_line(L, L->text_operand, CONSTANT_COLOUR);
Ctags::note_defined_constant(L, L->text_operand);
comment_mode = FALSE;
L->is_commentary = FALSE;
Regexp::dispose_of(&mr);

186
Chapter 6/Ctags Support.w Normal file
View file

@ -0,0 +1,186 @@
[Ctags::] Ctags Support.
Constructing a suitable ctags file for a web.
@ On every tangle, Inweb writes a simple Universal Ctags file to the root
directory of the web: this can then be used by text editors (such as BBEdit
on MacOS) to provide code completion and jump-to-definition features when
editing the sections in the web.
A ctags file is essentially just a list of identifiers called "tagnames",
which are usually names of functions or data types, along with details of
where they are defined in a program. Ctags files are almost never written by
hand, but are instead generated by a tool such as the eponymous |ctags|. Here,
though, Inweb is going to do the generation, because it can make sense of the
web structure of source code in a way which the |ctags| parser cannot.
The original |ctags| dates to 1992, and was devised by Ken Arnold. This was
much extended as Exuberant Ctags, by Darren Hiebert, which was then forked and
re-maintained as Universal Ctags by Reza Jelveh and others. The result is
nearly standard now, though as with a lot of early Unix infrastructure (compare
|make|, for example), that standard design feels very antique: white space is
significant, filename extensions are not standard practice, and so on. See
//Universal Ctags -> https://ctags.io// for more.[1]
[1] If there is an exact specification for the file format we need to write
here, though, I have been unable to find it. There is a sketch "proposal" for one,
but it omits details of, e.g., exactly what characters must be escaped and how;
what characters can legally be part of a tagname; and so on.
@ As mentioned above, Ctags go back to an age before filenames necessarily had
extensions, and just as the defaukt make file is |makefile| and not |makefile.mk|,
so the default Ctags file is called |tags| and not |tags.ctag|.
=
void Ctags::write(web *W, filename *F) {
text_stream ctags_file;
pathname *P = NULL;
if (F) {
P = Filenames::up(F);
} else {
P = W->md->path_to_web;
F = Filenames::in(P, I"tags");
}
text_stream *OUT = &ctags_file;
if (STREAM_OPEN_TO_FILE(OUT, F, UTF8_ENC) == FALSE)
Errors::fatal_with_file("unable to write ctags file", F);
@<Write header@>;
@<List defined constants@>;
@<List structures@>;
@<List functions@>;
STREAM_CLOSE(OUT);
}
@ Unless you really want to monkey with identifiers or filenames containing
line break characters or tabs, a ctags file has a simple format to read or
write: there's one tag on each line, and each line has three or more fields
divided by tab characters. If we write | -> | for a tab, a line looks like:
= (text)
tagname -> filename -> /find/;" -> more
=
The stranded double-quote there is not a misprint. For example:
= (text)
Frogs::spawn -> pond/Chapter 1/Amphibians.w -> /^void Frogs::spawn(species *S) {$/;" -> f
=
Here the tagname is |Frogs::spawn|. The filename |pond/Chapter 1/Amphibians.w|
is the file defining this function. The |find| field is an EX-format command for
finding the line in question: see below. Finally, the |more| field is actually
a run of optional extra information, presented in a free-form sort of way, but
we will use it only the simplest of ways. In this example it is just |f|,
meaning "I am a function declaration".
The opening lines of the file, however, are usually metadata, i.e., describing the
file itself and where it came from. In those lines, tagnames begin with |!_| and are
called "pseudotags". The |filename| field is instead a value, while the |find|
field is instead an optional comment.
The first two keys here are essential: the other three seem just to be good practice.
These are the five keys which Universal |ctags| writes by default, so we'll follow
suit.
@<Write header@> =
WRITE("!_TAG_FILE_FORMAT\t2\t/extended format; --format=1 will not append ;\" to lines/\n");
WRITE("!_TAG_FILE_SORTED\t0\t/0=unsorted, 1=sorted, 2=foldcase/\n");
WRITE("!_TAG_PROGRAM_AUTHOR\tGraham Nelson\t/graham.nelson@mod-langs.ox.ac.uk/\n");
WRITE("!_TAG_PROGRAM_NAME\t[[Title]]\t//\n");
WRITE("!_TAG_PROGRAM_VERSION\t[[Semantic Version Number]]\t/built [[Build Date]]/\n");
@ Having prudently opted to give the tags in an unsorted way, we're free to list
them in any order convenient to us, and here goes.
The |more| field |d| says that a tagname is a defined constant:
@<List defined constants@> =
defined_constant *str;
LOOP_OVER(str, defined_constant)
if (str->at->owning_section->owning_web == W) {
WRITE("%S\t", str->name);
Ctags::write_line_ref(OUT, str->at, P);
WRITE(";\"\t");
WRITE("d");
WRITE("\n");
}
@ The |more| field |t| says that a tagname is a type, and we add a clarifying
detail to say that it results from a |typedef struct|. (Note that |typeref|
here, with an "r", is not a mistake. This is what Universal |ctags| calls it.)
@<List structures@> =
language_type *str;
LOOP_OVER(str, language_type)
if (str->structure_header_at->owning_section->owning_web == W) {
WRITE("%S\t", str->structure_name);
Ctags::write_line_ref(OUT, str->structure_header_at, P);
WRITE(";\"\t");
WRITE("t\ttyperef:struct:%S", str->structure_name);
WRITE("\n");
}
@ The |more| field |f| says that a tagname is a function:
@<List functions@> =
language_function *fn;
LOOP_OVER(fn, language_function)
if (fn->function_header_at->owning_section->owning_web == W) {
WRITE("%S\t", fn->function_name);
Ctags::write_line_ref(OUT, fn->function_header_at, P);
WRITE(";\"\t");
WRITE("f");
WRITE("\n");
}
@ So, then, here we write the |filename| and |find| fields for a given
source line |L| in our web. Note that:
(a) The filename must be given relative to the directory containing the tags
file, so for us that will be the home directory of the web.
(b) The |find| field looks like a regular expression but is not one, despite
the suggestive positional markers |^| and |$|. Note in particular that round
brackets and asterisk characters are not escaped, as they would be in a regex.
The Ctags documentation is vague here but does note that |^| and |$| should
be escaped only where they occur in the first or last positions. Tabs do
not need to be escaped.
=
void Ctags::write_line_ref(OUTPUT_STREAM, source_line *L, pathname *P) {
TEMPORARY_TEXT(fn)
WRITE_TO(fn, "%f", L->owning_section->md->source_file_for_section);
if (Platform::is_folder_separator(Str::get_first_char(fn)) == FALSE) {
Str::clear(fn);
Filenames::to_text_relative(fn, L->owning_section->md->source_file_for_section, P);
}
WRITE("%S\t/^", fn);
DISCARD_TEXT(fn)
for (int i = 0; i < Str::len(L->text); i++) {
wchar_t c = Str::get_at(L->text, i);
switch (c) {
case '/': PUT('\\'); PUT(c); break;
case '^': if (i == 0) PUT('\\'); PUT(c); break;
case '$': if (i < Str::len(L->text) - 1) PUT('\\'); PUT(c); break;
default: PUT(c); break;
}
}
WRITE("$/");
}
@ To make the above work, we need to keep a list of defined constant names.
We could laboriously extract that from the hash table of reserved words
(see //The Analyser//), but this is one of those times when life is short and
memory is cheap. It's easier to keep a duplicate list.
=
typedef struct defined_constant {
struct text_stream *name;
struct source_line *at;
CLASS_DEFINITION
} defined_constant;
@ This is called for any |@d| or |@e| constant name, then:
=
void Ctags::note_defined_constant(source_line *L, text_stream *name) {
defined_constant *dc = CREATE(defined_constant);
dc->name = Str::duplicate(name);
dc->at = L;
}

View file

@ -77,6 +77,7 @@ Chapter 6: Extras
"Additional features for turning webs into open-source projects."
Makefiles
Git Support
Ctags Support
Readme Writeme
Colonies

View file

@ -49,6 +49,8 @@ for weaving a web:
-weave-to X weave, but to filename X (for single files only)
for tangling a web:
-ctags-to X tangle, but write Universal Ctags file to X not to 'tags'
-no-ctags don't write a Universal Ctags file when tangling (default is -ctags)
-tangle tangle the web into machine-compilable form
-tangle-to X tangle, but to filename X

View file

@ -511,6 +511,24 @@ specifies the files to be ignored. The following does so for a web |W|:
Once again, Inweb does this by working from a script, this time called
|gitignorescript.txt|.
@h Ctags.
Each time a web is tangled, Inweb writes a |tags| file to the web's home
directory, containing a list of //Universal ctags -> https://ctags.io//
for any structures, functions or constant definitions found in the web. You
need do nothing to make this happen, and can ignore the file if it's of no
use. If you are editing a web in certain text editors, though, such as
//BBEdit -> https://www.barebones.com/products/bbedit// for MacOS, then this
should make code completion and definition lookup features work.
You can however write the file elsewhere:
= (text as ConsoleText)
$ inweb/Tangled/inweb W -tangle -ctags-to secret_lair/my_nifty.ctags
=
or not at all:
= (text as ConsoleText)
$ inweb/Tangled/inweb W -tangle -no-ctags
=
@h README files.
Repositories at Github customarily have |README.mk| files, in Markdown
syntax, explaining what they are. These of course should probably include

View file

@ -1,6 +1,7 @@
# This is the script from which inweb -gitignore will construct a .gitignore.
debug-log.txt
tags
Woven/
Tangled/
!Tangled/*.preform

View file

@ -1,6 +1,6 @@
# Inweb 7
v7-alpha.1+1A75 'Escape to Danger' (10 August 2021)
v7-alpha.1+1A76 'Escape to Danger' (11 August 2021)
## About Inweb

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,3 @@
top-hat-capacity = 6 rabbits
cabinet-trapdoor = closed
marked-card = 6 of clubs

View file

@ -1,3 +1,3 @@
Prerelease: alpha.1
Build Date: 10 August 2021
Build Number: 1A75
Build Date: 11 August 2021
Build Number: 1A76

View file

@ -149,7 +149,14 @@ as Unicode code points, regardless of what text encoding the locale has.)
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="4-sm.html#SP21" class="function-link"><span class="function-syntax">Str::prefix_eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ft</span><span class="plain-syntax">, </span><span class="identifier-syntax">pt</span><span class="plain-syntax">, </span><span class="identifier-syntax">n</span><span class="plain-syntax">)) &amp;&amp; (</span><a href="1-wp.html#SP4" class="function-link"><span class="function-syntax">Platform::is_folder_separator</span></a><span class="plain-syntax">(</span><a href="4-sm.html#SP13" class="function-link"><span class="function-syntax">Str::get_at</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ft</span><span class="plain-syntax">, </span><span class="identifier-syntax">n</span><span class="plain-syntax">)))) {</span>
<span class="plain-syntax"> </span><a href="4-sm.html#SP25" class="function-link"><span class="function-syntax">Str::delete_n_characters</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">ft</span><span class="plain-syntax">, </span><span class="identifier-syntax">n</span><span class="plain-syntax">+1);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">ft</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"filename not relative to pathname"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">P</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">ft</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"..%c"</span><span class="plain-syntax">, </span><span class="constant-syntax">FOLDER_SEPARATOR</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="3-fln.html#SP5" class="function-link"><span class="function-syntax">Filenames::to_text_relative</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><a href="3-pth.html#SP7" class="function-link"><span class="function-syntax">Pathnames::up</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">));</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">ft</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pt</span><span class="plain-syntax">)</span>
<span class="plain-syntax">}</span>

View file

@ -252,7 +252,7 @@ line.
<span class="plain-syntax"> </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pt</span><span class="plain-syntax">)</span>
<span class="plain-syntax">}</span>
<span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="function-syntax">Pathnames::up</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">Pathnames::up</span></span>:<br/><a href="3-pth.html#SP8">&#167;8</a><br/>Web Modules - <a href="8-wm.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="function-syntax">Pathnames::up</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">Pathnames::up</span></span>:<br/><a href="3-pth.html#SP8">&#167;8</a><br/>Filenames - <a href="3-fln.html#SP5">&#167;5</a><br/>Web Modules - <a href="8-wm.html#SP7">&#167;7</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">P</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"can't go up from root directory"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">pathname_of_parent</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

Binary file not shown.

View file

@ -92,7 +92,7 @@ actually look for: they will be available to some patterns and not others.
<span class="plain-syntax"> </span><span class="constant-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">colour_scheme</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure colour_scheme is accessed in 5/ee, 1/ts, 5/hf and here.</li></ul>
<ul class="endnotetexts"><li>The structure colour_scheme is accessed in 5/ee, 1/ts, 5/hf, 6/cs and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b></p>
<pre class="displayed-code all-displayed-code code-font">

View file

@ -59,6 +59,7 @@ see <a href="../foundation-module/P-abgtf.html" class="internal">A Brief Guide t
<span class="definition-keyword">enum</span> <span class="constant-syntax">colour_scheme_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">colouring_language_block_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">colouring_rule_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">defined_constant_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">enumeration_set_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">footnote_CLASS</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">hash_table_entry_CLASS</span>
@ -147,6 +148,7 @@ see <a href="../foundation-module/P-abgtf.html" class="internal">A Brief Guide t
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">colour_scheme</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">colouring_language_block</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">colouring_rule</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">defined_constant</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">enumeration_set</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">footnote</span><span class="plain-syntax">)</span>
<span class="identifier-syntax">DECLARE_CLASS</span><span class="plain-syntax">(</span><span class="reserved-syntax">hash_table_entry_usage</span><span class="plain-syntax">)</span>

View file

@ -74,10 +74,12 @@ command line: there will only ever be one of these.
<span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">structures_switch</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">-structures</span></span><span class="comment-syntax">: print catalogue of structures within sections</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">advance_switch</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">-advance-build</span></span><span class="comment-syntax">: advance build file for web</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">scan_switch</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">-scan</span></span><span class="comment-syntax">: simply show the syntactic scan of the source</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">ctags_switch</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">-ctags</span></span><span class="comment-syntax">: generate a set of Universal Ctags on each tangle</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">weave_to_setting</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">-weave-to X</span></span><span class="comment-syntax">: the pathname X, if supplied</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">weave_into_setting</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">-weave-into X</span></span><span class="comment-syntax">: the pathname X, if supplied</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">sequential</span><span class="plain-syntax">; </span><span class="comment-syntax"> give the sections sequential sigils</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tangle_setting</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">-tangle-to X</span></span><span class="comment-syntax">: the pathname X, if supplied</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">ctags_setting</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">-ctags-to X</span></span><span class="comment-syntax">: the pathname X, if supplied</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">makefile_setting</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">-makefile X</span></span><span class="comment-syntax">: the filename X, if supplied</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">gitignore_setting</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">-gitignore X</span></span><span class="comment-syntax">: the filename X, if supplied</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">advance_setting</span><span class="plain-syntax">; </span><span class="comment-syntax"> </span><span class="extract"><span class="extract-syntax">-advance-build-file X</span></span><span class="comment-syntax">: advance build file X</span>
@ -135,11 +137,13 @@ then declare them.
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">.</span><span class="element-syntax">advance_switch</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">.</span><span class="element-syntax">scan_switch</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">.</span><span class="element-syntax">verbose_switch</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">.</span><span class="element-syntax">ctags_switch</span><span class="plain-syntax"> = </span><span class="constant-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">.</span><span class="element-syntax">chosen_web</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">.</span><span class="element-syntax">chosen_file</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">.</span><span class="element-syntax">chosen_range</span><span class="plain-syntax"> = </span><a href="../foundation-module/4-sm.html#SP2" class="function-link"><span class="function-syntax">Str::new</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">.</span><span class="element-syntax">chosen_range_actually_chosen</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">.</span><span class="element-syntax">tangle_setting</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">.</span><span class="element-syntax">ctags_setting</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">.</span><span class="element-syntax">weave_to_setting</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">.</span><span class="element-syntax">weave_into_setting</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">.</span><span class="element-syntax">makefile_setting</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
@ -195,6 +199,8 @@ provides automatically.
<span class="definition-keyword">enum</span> <span class="constant-syntax">TANGLING_CLSG</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">TANGLE_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">TANGLE_TO_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">CTAGS_TO_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">CTAGS_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">COLONIAL_CLSG</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">COLONY_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">MEMBER_CLSW</span>
@ -283,6 +289,10 @@ provides automatically.
<span class="plain-syntax"> </span><span class="identifier-syntax">L</span><span class="string-syntax">"tangle the web into machine-compilable form"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="../foundation-module/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::declare_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">TANGLE_TO_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="string-syntax">"tangle-to"</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">,</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">L</span><span class="string-syntax">"tangle, but to filename X"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="../foundation-module/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::declare_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">CTAGS_TO_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="string-syntax">"ctags-to"</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">,</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">L</span><span class="string-syntax">"tangle, but write Universal Ctags file to X not to 'tags'"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="../foundation-module/3-cla.html#SP6" class="function-link"><span class="function-syntax">CommandLine::declare_boolean_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">CTAGS_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="string-syntax">"ctags"</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">,</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">L</span><span class="string-syntax">"write a Universal Ctags file when tangling"</span><span class="plain-syntax">, </span><span class="constant-syntax">TRUE</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="../foundation-module/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::end_group</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax"> </span><a href="../foundation-module/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::begin_group</span></a><span class="plain-syntax">(</span><span class="constant-syntax">COLONIAL_CLSG</span><span class="plain-syntax">,</span>
@ -397,6 +407,12 @@ provides automatically.
<span class="plain-syntax"> </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TANGLE_TO_CLSW:</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">tangle_setting</span><span class="plain-syntax"> = </span><a href="../foundation-module/3-fln.html#SP3" class="function-link"><span class="function-syntax">Filenames::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">arg</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="1-cnf.html#SP7" class="function-link"><span class="function-syntax">Configuration::set_fundamental_mode</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">args</span><span class="plain-syntax">, </span><span class="constant-syntax">TANGLE_MODE</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CTAGS_TO_CLSW:</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ctags_setting</span><span class="plain-syntax"> = </span><a href="../foundation-module/3-fln.html#SP3" class="function-link"><span class="function-syntax">Filenames::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">arg</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CTAGS_CLSW:</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">args</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ctags_switch</span><span class="plain-syntax"> = </span><span class="identifier-syntax">val</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"unimplemented switch"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> }</span>

View file

@ -304,6 +304,7 @@ line , but otherwise we impose a sensible choice based on the target.
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">tn</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">tn</span><span class="plain-syntax"> = </span><a href="3-tt.html#SP4" class="function-link"><span class="function-syntax">Tangler::primary_target</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="3-tt.html#SP1" class="function-link"><span class="function-syntax">Tangler::tangle</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">tn</span><span class="plain-syntax">, </span><span class="identifier-syntax">tangle_to</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">ins</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ctags_switch</span><span class="plain-syntax">) </span><a href="6-cs.html#SP2" class="function-link"><span class="function-syntax">Ctags::write</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="identifier-syntax">ins</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">ctags_setting</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">tangle_leaf</span><span class="plain-syntax">)</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="1-pc.html#SP7_4">&#167;7.4</a>.</li></ul>

View file

@ -93,7 +93,7 @@ correspond to one of these:
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">paragraph</span><span class="plain-syntax"> *</span><span class="identifier-syntax">owning_paragraph</span><span class="plain-syntax">; </span><span class="comment-syntax"> for lines falling under paragraphs; </span><span class="extract"><span class="extract-syntax">NULL</span></span><span class="comment-syntax"> if not</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">source_line</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure source_line is accessed in 1/pc, 2/tr, 2/tp, 2/pm, 2/ec, 2/pn, 3/ta, 3/tw, 3/twot, 3/tt, 4/taf, 4/lm, 4/as, 4/cl, 4/is, 5/wt, 5/ptf, 5/tf, 5/hf, 5/df, 6/cln and here.</li></ul>
<ul class="endnotetexts"><li>The structure source_line is accessed in 1/pc, 2/tr, 2/tp, 2/pm, 2/ec, 2/pn, 3/ta, 3/tw, 3/twot, 3/tt, 4/taf, 4/lm, 4/as, 4/cl, 4/is, 5/wt, 5/ptf, 5/tf, 5/hf, 5/df, 6/cs, 6/cln and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b></p>
<pre class="displayed-code all-displayed-code code-font">

View file

@ -826,6 +826,7 @@ C preprocessor macros, Inform 6 <span class="extract"><span class="extract-synta
<span class="plain-syntax"> </span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="identifier-syntax">text_operand2</span><span class="plain-syntax"> = </span><a href="../foundation-module/4-sm.html#SP2" class="function-link"><span class="function-syntax">Str::new</span></a><span class="plain-syntax">(); </span><span class="comment-syntax"> no value given</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><a href="3-ta.html#SP10" class="function-link"><span class="function-syntax">Analyser::mark_reserved_word_at_line</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">text_operand</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_COLOUR</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="6-cs.html#SP5" class="function-link"><span class="function-syntax">Ctags::note_defined_constant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">text_operand</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">comment_mode</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">is_commentary</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><a href="../foundation-module/4-pm.html#SP9" class="function-link"><span class="function-syntax">Regexp::dispose_of</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">);</span>
@ -862,6 +863,7 @@ enumerated sort of <span class="extract"><span class="extract-syntax">@d</span><
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">inweb_mode</span><span class="plain-syntax"> == </span><span class="constant-syntax">TANGLE_MODE</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> </span><a href="2-ec.html#SP3" class="function-link"><span class="function-syntax">Enumerations::define</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">text_operand2</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">text_operand</span><span class="plain-syntax">, </span><span class="identifier-syntax">from</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="3-ta.html#SP10" class="function-link"><span class="function-syntax">Analyser::mark_reserved_word_at_line</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">text_operand</span><span class="plain-syntax">, </span><span class="constant-syntax">CONSTANT_COLOUR</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="6-cs.html#SP5" class="function-link"><span class="function-syntax">Ctags::note_defined_constant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">text_operand</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">comment_mode</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">is_commentary</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><a href="../foundation-module/4-pm.html#SP9" class="function-link"><span class="function-syntax">Regexp::dispose_of</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">);</span>

View file

@ -97,7 +97,7 @@ each of which has a list of <span class="extract"><span class="extract-syntax">s
<span class="plain-syntax"> </span><span class="constant-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">web</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure web is accessed in 1/pc, 1/ts, 1/ptt, 1/apacs, 2/lc, 2/tp, 2/pn, 3/ta, 3/tc, 3/tw, 3/twot, 3/tt, 4/pl, 4/taf, 4/as, 4/cl, 4/is, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/mkf, 6/rw, 6/cln and here.</li></ul>
<ul class="endnotetexts"><li>The structure web is accessed in 1/pc, 1/ts, 1/ptt, 1/apacs, 2/lc, 2/tp, 2/pn, 3/ta, 3/tc, 3/tw, 3/twot, 3/tt, 4/pl, 4/taf, 4/as, 4/cl, 4/is, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/mkf, 6/cs, 6/rw, 6/cln and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>And for a chapter:
</p>
@ -113,7 +113,7 @@ each of which has a list of <span class="extract"><span class="extract-syntax">s
<span class="plain-syntax"> </span><span class="constant-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">chapter</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure chapter is accessed in 1/pc, 1/ts, 1/ptt, 2/lc, 2/tp, 2/pn, 3/ta, 3/tc, 3/tw, 3/twot, 3/tt, 4/pl, 4/as, 4/is, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/mkf, 6/rw, 6/cln and here.</li></ul>
<ul class="endnotetexts"><li>The structure chapter is accessed in 1/pc, 1/ts, 1/ptt, 2/lc, 2/tp, 2/pn, 3/ta, 3/tc, 3/tw, 3/twot, 3/tt, 4/pl, 4/as, 4/is, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/mkf, 6/cs, 6/rw, 6/cln and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>And lastly for a section.
</p>
@ -146,7 +146,7 @@ each of which has a list of <span class="extract"><span class="extract-syntax">s
<span class="plain-syntax"> </span><span class="constant-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">section</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure section is accessed in 1/pc, 1/ts, 1/ptt, 2/lc, 2/tp, 2/pm, 2/tgs, 2/pn, 3/ta, 3/tc, 3/tw, 3/twot, 3/tt, 4/pl, 4/taf, 4/lm, 4/as, 4/is, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/mkf, 6/rw, 6/cln and here.</li></ul>
<ul class="endnotetexts"><li>The structure section is accessed in 1/pc, 1/ts, 1/ptt, 2/lc, 2/tp, 2/pm, 2/tgs, 2/pn, 3/ta, 3/tc, 3/tw, 3/twot, 3/tt, 4/pl, 4/taf, 4/lm, 4/as, 4/is, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/mkf, 6/cs, 6/rw, 6/cln and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>The following routine makes the <span class="extract"><span class="extract-syntax">web</span></span>-<span class="extract"><span class="extract-syntax">chapter</span></span>-<span class="extract"><span class="extract-syntax">section</span></span> tree out of a
<span class="extract"><span class="extract-syntax">web_md</span></span>-<span class="extract"><span class="extract-syntax">chapter_md</span></span>-<span class="extract"><span class="extract-syntax">section_md</span></span> tree:
</p>

View file

@ -67,7 +67,7 @@ function togglePopup(material_id) {
<span class="plain-syntax"> </span><span class="constant-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">language_type</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure language_type is accessed in 3/tw, 4/as, 4/cl, 6/cln and here.</li></ul>
<ul class="endnotetexts"><li>The structure language_type is accessed in 3/tw, 4/as, 4/cl, 6/cs, 6/cln and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b></p>
<pre class="displayed-code all-displayed-code code-font">
@ -196,7 +196,7 @@ affects the reports in the woven code about where structures are used.
<span class="plain-syntax"> </span><span class="constant-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">language_function</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure language_function is accessed in 3/tw, 3/twot, 4/as, 4/cl, 5/ptf, 5/tf, 5/hf, 5/df, 6/cln and here.</li></ul>
<ul class="endnotetexts"><li>The structure language_function is accessed in 3/tw, 3/twot, 4/as, 4/cl, 5/ptf, 5/tf, 5/hf, 5/df, 6/cs, 6/cln and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b></p>
<pre class="displayed-code all-displayed-code code-font">

View file

@ -294,7 +294,7 @@ function togglePopup(material_id) {
<span class="plain-syntax"> </span><span class="constant-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">weave_verbatim_node</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure weave_document_node is accessed in 3/tc, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_head_node is accessed in 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_body_node is private to this section.</li><li>The structure weave_tail_node is accessed in 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_chapter_header_node is accessed in 5/ptf, 5/tf, 5/df and here.</li><li>The structure weave_chapter_footer_node is accessed in 5/ptf, 5/tf, 5/df and here.</li><li>The structure weave_section_header_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_section_footer_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_section_purpose_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_subheading_node is accessed in 1/pc, 2/lc, 2/tp, 2/pn, 3/ta, 3/tw, 3/tt, 4/as, 4/cl, 4/is, 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_bar_node is private to this section.</li><li>The structure weave_pagebreak_node is private to this section.</li><li>The structure weave_linebreak_node is private to this section.</li><li>The structure weave_paragraph_heading_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_endnote_node is private to this section.</li><li>The structure weave_figure_node is accessed in 1/fm, 1/pp, 1/wp, 8/ws, 4/cl, 5/tf, 5/hf, 5/df, 6/rw and here.</li><li>The structure weave_audio_node is accessed in 8/ws, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_video_node is accessed in 1/fm, 1/pp, 1/wp, 8/ws, 4/cl, 5/tf, 5/hf, 5/df, 6/rw and here.</li><li>The structure weave_download_node is accessed in 5/hf, 5/df and here.</li><li>The structure weave_material_node is accessed in 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_embed_node is accessed in 1/fm, 1/pp, 1/wp, 8/ws, 4/cl, 5/ptf, 5/tf, 5/hf, 5/df, 6/rw and here.</li><li>The structure weave_pmac_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_vskip_node is accessed in 5/tf, 5/df and here.</li><li>The structure weave_chapter_node is accessed in 5/ptf, 5/tf, 5/df and here.</li><li>The structure weave_section_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_code_line_node is private to this section.</li><li>The structure weave_function_usage_node is accessed in 1/wp, 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_commentary_node is accessed in 1/pc, 2/lc, 2/tp, 2/pn, 3/ta, 3/tw, 3/tt, 4/as, 4/cl, 4/is, 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_carousel_slide_node is accessed in 2/tgs, 5/hf, 5/df and here.</li><li>The structure weave_toc_node is accessed in 5/tf, 5/df and here.</li><li>The structure weave_toc_line_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_chapter_title_page_node is private to this section.</li><li>The structure weave_defn_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_inline_node is private to this section.</li><li>The structure weave_locale_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_source_code_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_url_node is accessed in 2/trs, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/rw and here.</li><li>The structure weave_footnote_cue_node is accessed in 2/tp, 3/tw, 3/twot, 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_begin_footnote_text_node is accessed in 2/tp, 3/tw, 3/twot, 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_display_line_node is accessed in 1/pc, 2/lc, 2/tp, 2/pn, 3/ta, 3/tw, 3/tt, 4/as, 4/cl, 4/is, 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_function_defn_node is accessed in 1/wp, 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_item_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_grammar_index_node is private to this section.</li><li>The structure weave_maths_node is accessed in 2/trs, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/rw and here.</li><li>The structure weave_verbatim_node is accessed in 2/trs, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/rw and here.</li></ul>
<ul class="endnotetexts"><li>The structure weave_document_node is accessed in 3/tc, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_head_node is accessed in 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_body_node is private to this section.</li><li>The structure weave_tail_node is accessed in 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_chapter_header_node is accessed in 5/ptf, 5/tf, 5/df and here.</li><li>The structure weave_chapter_footer_node is accessed in 5/ptf, 5/tf, 5/df and here.</li><li>The structure weave_section_header_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_section_footer_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_section_purpose_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_subheading_node is accessed in 1/pc, 2/lc, 2/tp, 2/pn, 3/ta, 3/tw, 3/tt, 4/as, 4/cl, 4/is, 5/ptf, 5/tf, 5/hf, 5/df, 6/cs and here.</li><li>The structure weave_bar_node is private to this section.</li><li>The structure weave_pagebreak_node is private to this section.</li><li>The structure weave_linebreak_node is private to this section.</li><li>The structure weave_paragraph_heading_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_endnote_node is private to this section.</li><li>The structure weave_figure_node is accessed in 1/fm, 1/pp, 1/wp, 8/ws, 4/cl, 5/tf, 5/hf, 5/df, 6/rw and here.</li><li>The structure weave_audio_node is accessed in 8/ws, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_video_node is accessed in 1/fm, 1/pp, 1/wp, 8/ws, 4/cl, 5/tf, 5/hf, 5/df, 6/rw and here.</li><li>The structure weave_download_node is accessed in 5/hf, 5/df and here.</li><li>The structure weave_material_node is accessed in 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_embed_node is accessed in 1/fm, 1/pp, 1/wp, 8/ws, 4/cl, 5/ptf, 5/tf, 5/hf, 5/df, 6/rw and here.</li><li>The structure weave_pmac_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_vskip_node is accessed in 5/tf, 5/df and here.</li><li>The structure weave_chapter_node is accessed in 5/ptf, 5/tf, 5/df and here.</li><li>The structure weave_section_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_code_line_node is private to this section.</li><li>The structure weave_function_usage_node is accessed in 1/wp, 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_commentary_node is accessed in 1/pc, 2/lc, 2/tp, 2/pn, 3/ta, 3/tw, 3/tt, 4/as, 4/cl, 4/is, 5/ptf, 5/tf, 5/hf, 5/df, 6/cs and here.</li><li>The structure weave_carousel_slide_node is accessed in 2/tgs, 5/hf, 5/df and here.</li><li>The structure weave_toc_node is accessed in 5/tf, 5/df and here.</li><li>The structure weave_toc_line_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_chapter_title_page_node is private to this section.</li><li>The structure weave_defn_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_inline_node is private to this section.</li><li>The structure weave_locale_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_source_code_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_url_node is accessed in 2/trs, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/rw and here.</li><li>The structure weave_footnote_cue_node is accessed in 2/tp, 3/tw, 3/twot, 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_begin_footnote_text_node is accessed in 2/tp, 3/tw, 3/twot, 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_display_line_node is accessed in 1/pc, 2/lc, 2/tp, 2/pn, 3/ta, 3/tw, 3/tt, 4/as, 4/cl, 4/is, 5/ptf, 5/tf, 5/hf, 5/df, 6/cs and here.</li><li>The structure weave_function_defn_node is accessed in 1/wp, 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_item_node is accessed in 5/ptf, 5/tf, 5/hf, 5/df and here.</li><li>The structure weave_grammar_index_node is private to this section.</li><li>The structure weave_maths_node is accessed in 2/trs, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/rw and here.</li><li>The structure weave_verbatim_node is accessed in 2/trs, 3/twot, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/rw and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b></p>
<pre class="displayed-code all-displayed-code code-font">

View file

@ -109,7 +109,7 @@ directory holding a multi-section web.
<span class="plain-syntax"> </span><span class="constant-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">colony_member</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure colony_member is accessed in 2/trs, 1/cnf, 1/ts, 3/tc, 5/wt, 6/rw and here.</li></ul>
<ul class="endnotetexts"><li>The structure colony_member is accessed in 2/trs, 1/cnf, 1/ts, 3/tc, 5/wt, 6/cs, 6/rw and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>And the following reads a colony file <span class="extract"><span class="extract-syntax">F</span></span> and produces a suitable <span class="extract"><span class="extract-syntax">colony</span></span>
object from it. This, for example, is the colony file for the Inweb repository
at GitHub:
@ -666,7 +666,7 @@ the main one.
</pre>
<ul class="endnotetexts"><li>The function Colonies::reference_URL is used in The Collater (<a href="3-tc.html#SP5_1_11_6_1">&#167;5.1.11.6.1</a>, <a href="3-tc.html#SP5_1_11_12">&#167;5.1.11.12</a>, <a href="3-tc.html#SP5_1_11_15">&#167;5.1.11.15</a>).</li><li>The function Colonies::section_URL is used in <a href="6-cln.html#SP10_6_1">&#167;10.6.1</a>, <a href="6-cln.html#SP10_6_2">&#167;10.6.2</a>, The Collater (<a href="3-tc.html#SP5_1_11_8_1">&#167;5.1.11.8.1</a>), HTML Formats (<a href="5-hf.html#SP5_3">&#167;5.3</a>, <a href="5-hf.html#SP5_3_1">&#167;5.3.1</a>, <a href="5-hf.html#SP5_3_2">&#167;5.3.2</a>).</li><li>The function Colonies::paragraph_URL is used in <a href="6-cln.html#SP10_4">&#167;10.4</a>, <a href="6-cln.html#SP10_5">&#167;10.5</a>, The Weaver of Text (<a href="3-twot.html#SP4_3">&#167;4.3</a>), HTML Formats (<a href="5-hf.html#SP5_16">&#167;5.16</a>, <a href="5-hf.html#SP5_24">&#167;5.24</a>, <a href="5-hf.html#SP5_35">&#167;5.35</a>).</li><li>The function Colonies::paragraph_anchor is used in HTML Formats (<a href="5-hf.html#SP8">&#167;8</a>).</li></ul>
<nav role="progress"><div class="progresscontainer">
<ul class="progressbar"><li class="progressprev"><a href="6-rw.html">&#10094;</a></li><li class="progresschapter"><a href="M-iti.html">M</a></li><li class="progresschapter"><a href="P-htpw.html">P</a></li><li class="progresschapter"><a href="1-bsc.html">1</a></li><li class="progresschapter"><a href="2-tr.html">2</a></li><li class="progresschapter"><a href="3-ta.html">3</a></li><li class="progresschapter"><a href="4-pl.html">4</a></li><li class="progresschapter"><a href="5-wt.html">5</a></li><li class="progresscurrentchapter">6</li><li class="progresssection"><a href="6-mkf.html">mkf</a></li><li class="progresssection"><a href="6-gs.html">gs</a></li><li class="progresssection"><a href="6-rw.html">rw</a></li><li class="progresscurrent">cln</li><li class="progressnextoff">&#10095;</li></ul></div>
<ul class="progressbar"><li class="progressprev"><a href="6-rw.html">&#10094;</a></li><li class="progresschapter"><a href="M-iti.html">M</a></li><li class="progresschapter"><a href="P-htpw.html">P</a></li><li class="progresschapter"><a href="1-bsc.html">1</a></li><li class="progresschapter"><a href="2-tr.html">2</a></li><li class="progresschapter"><a href="3-ta.html">3</a></li><li class="progresschapter"><a href="4-pl.html">4</a></li><li class="progresschapter"><a href="5-wt.html">5</a></li><li class="progresscurrentchapter">6</li><li class="progresssection"><a href="6-mkf.html">mkf</a></li><li class="progresssection"><a href="6-gs.html">gs</a></li><li class="progresssection"><a href="6-cs.html">cs</a></li><li class="progresssection"><a href="6-rw.html">rw</a></li><li class="progresscurrent">cln</li><li class="progressnextoff">&#10095;</li></ul></div>
</nav><!--End of weave-->
</main>

282
docs/inweb/6-cs.html Normal file
View file

@ -0,0 +1,282 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Ctags Support</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
<meta name="viewport" content="width=device-width initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="en-gb">
<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script src="http://code.jquery.com/jquery-1.12.4.min.js"
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script src="../docs-assets/Bigfoot.js"></script>
<link href="../docs-assets/Bigfoot.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
var popup = document.getElementById(material_id);
popup.classList.toggle("show");
}
</script>
<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
</head>
<body class="commentary-font">
<nav role="navigation">
<h1><a href="../index.html">
<img src="../docs-assets/Octagram.png" width=72 height=72">
</a></h1>
<ul><li><a href="index.html"><span class="selectedlink">inweb</span></a></li>
</ul><h2>Foundation Module</h2><ul>
<li><a href="../foundation-module/index.html">foundation</a></li>
<li><a href="../foundation-test/index.html">foundation-test</a></li>
</ul><h2>Example Webs</h2><ul>
<li><a href="../goldbach/index.html">goldbach</a></li>
<li><a href="../twinprimes/twinprimes.html">twinprimes</a></li>
<li><a href="../eastertide/index.html">eastertide</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=18> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="../../../inform/docs/index.html">inform</a></li>
<li><a href="../../../intest/docs/index.html">intest</a></li>
</ul>
</nav>
<main role="main">
<!--Weave of 'Ctags Support' generated by Inweb-->
<div class="breadcrumbs">
<ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="index.html">inweb</a></li><li><a href="index.html#6">Chapter 6: Extras</a></li><li><b>Ctags Support</b></li></ul></div>
<p class="purpose">Constructing a suitable ctags file for a web.</p>
<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. </b>On every tangle, Inweb writes a simple Universal Ctags file to the root
directory of the web: this can then be used by text editors (such as BBEdit
on MacOS) to provide code completion and jump-to-definition features when
editing the sections in the web.
</p>
<p class="commentary">A ctags file is essentially just a list of identifiers called "tagnames",
which are usually names of functions or data types, along with details of
where they are defined in a program. Ctags files are almost never written by
hand, but are instead generated by a tool such as the eponymous <span class="extract"><span class="extract-syntax">ctags</span></span>. Here,
though, Inweb is going to do the generation, because it can make sense of the
web structure of source code in a way which the <span class="extract"><span class="extract-syntax">ctags</span></span> parser cannot.
</p>
<p class="commentary">The original <span class="extract"><span class="extract-syntax">ctags</span></span> dates to 1992, and was devised by Ken Arnold. This was
much extended as Exuberant Ctags, by Darren Hiebert, which was then forked and
re-maintained as Universal Ctags by Reza Jelveh and others. The result is
nearly standard now, though as with a lot of early Unix infrastructure (compare
<span class="extract"><span class="extract-syntax">make</span></span>, for example), that standard design feels very antique: white space is
significant, filename extensions are not standard practice, and so on. See
<a href="https://ctags.io" class="external">Universal Ctags</a> for more.<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup>
</p>
<ul class="footnotetexts"><li class="footnote" id="fn:1"><p class="inwebfootnote"><sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> If there is an exact specification for the file format we need to write
here, though, I have been unable to find it. There is a sketch "proposal" for one,
but it omits details of, e.g., exactly what characters must be escaped and how;
what characters can legally be part of a tagname; and so on.
<a href="#fnref:1" title="return to text"> &#x21A9;</a></p></li></ul>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>As mentioned above, Ctags go back to an age before filenames necessarily had
extensions, and just as the defaukt make file is <span class="extract"><span class="extract-syntax">makefile</span></span> and not <span class="extract"><span class="extract-syntax">makefile.mk</span></span>,
so the default Ctags file is called <span class="extract"><span class="extract-syntax">tags</span></span> and not <span class="extract"><span class="extract-syntax">tags.ctag</span></span>.
</p>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Ctags::write</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">Ctags::write</span></span>:<br/>Program Control - <a href="1-pc.html#SP7_4_2">&#167;7.4.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">web</span><span class="plain-syntax"> *</span><span class="identifier-syntax">W</span><span class="plain-syntax">, </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">F</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> </span><span class="identifier-syntax">ctags_file</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">F</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><a href="../foundation-module/3-fln.html#SP6" class="function-link"><span class="function-syntax">Filenames::up</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">F</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">P</span><span class="plain-syntax"> = </span><span class="identifier-syntax">W</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">md</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">path_to_web</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">F</span><span class="plain-syntax"> = </span><a href="../foundation-module/3-fln.html#SP2" class="function-link"><span class="function-syntax">Filenames::in</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"tags"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">OUT</span><span class="plain-syntax"> = &amp;</span><span class="identifier-syntax">ctags_file</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">STREAM_OPEN_TO_FILE</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><span class="constant-syntax">UTF8_ENC</span><span class="plain-syntax">) == </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> </span><a href="../foundation-module/3-em.html#SP2" class="function-link"><span class="function-syntax">Errors::fatal_with_file</span></a><span class="plain-syntax">(</span><span class="string-syntax">"unable to write ctags file"</span><span class="plain-syntax">, </span><span class="identifier-syntax">F</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="6-cs.html#SP2_1" class="named-paragraph-link"><span class="named-paragraph">Write header</span><span class="named-paragraph-number">2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="6-cs.html#SP2_2" class="named-paragraph-link"><span class="named-paragraph">List defined constants</span><span class="named-paragraph-number">2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="6-cs.html#SP2_3" class="named-paragraph-link"><span class="named-paragraph">List structures</span><span class="named-paragraph-number">2.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="6-cs.html#SP2_4" class="named-paragraph-link"><span class="named-paragraph">List functions</span><span class="named-paragraph-number">2.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">STREAM_CLOSE</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2_1" class="paragraph-anchor"></a><b>&#167;2.1. </b>Unless you really want to monkey with identifiers or filenames containing
line break characters or tabs, a ctags file has a simple format to read or
write: there's one tag on each line, and each line has three or more fields
divided by tab characters. If we write <span class="extract"><span class="extract-syntax"> -&gt; </span></span> for a tab, a line looks like:
</p>
<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax"> tagname -&gt; filename -&gt; /find/;" -&gt; more</span>
</pre>
<p class="commentary">The stranded double-quote there is not a misprint. For example:
</p>
<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax"> Frogs::spawn -&gt; pond/Chapter 1/Amphibians.w -&gt; /^void Frogs::spawn(species *S) {$/;" -&gt; f</span>
</pre>
<p class="commentary">Here the tagname is <span class="extract"><span class="extract-syntax">Frogs::spawn</span></span>. The filename <span class="extract"><span class="extract-syntax">pond/Chapter 1/Amphibians.w</span></span>
is the file defining this function. The <span class="extract"><span class="extract-syntax">find</span></span> field is an EX-format command for
finding the line in question: see below. Finally, the <span class="extract"><span class="extract-syntax">more</span></span> field is actually
a run of optional extra information, presented in a free-form sort of way, but
we will use it only the simplest of ways. In this example it is just <span class="extract"><span class="extract-syntax">f</span></span>,
meaning "I am a function declaration".
</p>
<p class="commentary">The opening lines of the file, however, are usually metadata, i.e., describing the
file itself and where it came from. In those lines, tagnames begin with <span class="extract"><span class="extract-syntax">!_</span></span> and are
called "pseudotags". The <span class="extract"><span class="extract-syntax">filename</span></span> field is instead a value, while the <span class="extract"><span class="extract-syntax">find</span></span>
field is instead an optional comment.
</p>
<p class="commentary">The first two keys here are essential: the other three seem just to be good practice.
These are the five keys which Universal <span class="extract"><span class="extract-syntax">ctags</span></span> writes by default, so we'll follow
suit.
</p>
<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Write header</span><span class="named-paragraph-number">2.1</span></span><span class="comment-syntax"> =</span>
</p>
<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"!_TAG_FILE_FORMAT\t2\t/extended format; --format=1 will not append ;\" to lines/\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"!_TAG_FILE_SORTED\t0\t/0=unsorted, 1=sorted, 2=foldcase/\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"!_TAG_PROGRAM_AUTHOR\tGraham Nelson\t/graham.nelson@mod-langs.ox.ac.uk/\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"!_TAG_PROGRAM_NAME\t[[Title]]\t</span><span class="comment-syntax">\n");</span>
<span class="string-syntax"> WRITE("</span><span class="plain-syntax">!</span><span class="identifier-syntax">_TAG_PROGRAM_VERSION</span><span class="plain-syntax">\</span><span class="identifier-syntax">t</span><span class="plain-syntax">[[</span><span class="identifier-syntax">Semantic</span><span class="plain-syntax"> </span><span class="identifier-syntax">Version</span><span class="plain-syntax"> </span><span class="identifier-syntax">Number</span><span class="plain-syntax">]]\</span><span class="identifier-syntax">t</span><span class="plain-syntax">/</span><span class="identifier-syntax">built</span><span class="plain-syntax"> [[</span><span class="identifier-syntax">Build</span><span class="plain-syntax"> </span><span class="identifier-syntax">Date</span><span class="plain-syntax">]]/\</span><span class="identifier-syntax">n</span><span class="string-syntax">");</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="6-cs.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_2" class="paragraph-anchor"></a><b>&#167;2.2. </b>Having prudently opted to give the tags in an unsorted way, we're free to list
them in any order convenient to us, and here goes.
</p>
<p class="commentary">The <span class="extract"><span class="extract-syntax">more</span></span> field <span class="extract"><span class="extract-syntax">d</span></span> says that a tagname is a defined constant:
</p>
<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">List defined constants</span><span class="named-paragraph-number">2.2</span></span><span class="comment-syntax"> =</span>
</p>
<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax"> </span><span class="reserved-syntax">defined_constant</span><span class="plain-syntax"> *</span><span class="identifier-syntax">str</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">str</span><span class="plain-syntax">, </span><span class="reserved-syntax">defined_constant</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">str</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_section</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_web</span><span class="plain-syntax"> == </span><span class="identifier-syntax">W</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S\t"</span><span class="plain-syntax">, </span><span class="identifier-syntax">str</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="6-cs.html#SP3" class="function-link"><span class="function-syntax">Ctags::write_line_ref</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">str</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">at</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">";\"\t"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"d"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="6-cs.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_3" class="paragraph-anchor"></a><b>&#167;2.3. </b>The <span class="extract"><span class="extract-syntax">more</span></span> field <span class="extract"><span class="extract-syntax">t</span></span> says that a tagname is a type, and we add a clarifying
detail to say that it results from a <span class="extract"><span class="extract-syntax">typedef struct</span></span>. (Note that <span class="extract"><span class="extract-syntax">typeref</span></span>
here, with an "r", is not a mistake. This is what Universal <span class="extract"><span class="extract-syntax">ctags</span></span> calls it.)
</p>
<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">List structures</span><span class="named-paragraph-number">2.3</span></span><span class="comment-syntax"> =</span>
</p>
<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax"> </span><span class="reserved-syntax">language_type</span><span class="plain-syntax"> *</span><span class="identifier-syntax">str</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">str</span><span class="plain-syntax">, </span><span class="reserved-syntax">language_type</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">str</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">structure_header_at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_section</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_web</span><span class="plain-syntax"> == </span><span class="identifier-syntax">W</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S\t"</span><span class="plain-syntax">, </span><span class="identifier-syntax">str</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">structure_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="6-cs.html#SP3" class="function-link"><span class="function-syntax">Ctags::write_line_ref</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">str</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">structure_header_at</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">";\"\t"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"t\ttyperef:struct:%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">str</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">structure_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="6-cs.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_4" class="paragraph-anchor"></a><b>&#167;2.4. </b>The <span class="extract"><span class="extract-syntax">more</span></span> field <span class="extract"><span class="extract-syntax">f</span></span> says that a tagname is a function:
</p>
<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">List functions</span><span class="named-paragraph-number">2.4</span></span><span class="comment-syntax"> =</span>
</p>
<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax"> </span><span class="reserved-syntax">language_function</span><span class="plain-syntax"> *</span><span class="identifier-syntax">fn</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">fn</span><span class="plain-syntax">, </span><span class="reserved-syntax">language_function</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">fn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">function_header_at</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_section</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_web</span><span class="plain-syntax"> == </span><span class="identifier-syntax">W</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S\t"</span><span class="plain-syntax">, </span><span class="identifier-syntax">fn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">function_name</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="6-cs.html#SP3" class="function-link"><span class="function-syntax">Ctags::write_line_ref</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">fn</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">function_header_at</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">";\"\t"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"f"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\n"</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="6-cs.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>So, then, here we write the <span class="extract"><span class="extract-syntax">filename</span></span> and <span class="extract"><span class="extract-syntax">find</span></span> fields for a given
source line <span class="extract"><span class="extract-syntax">L</span></span> in our web. Note that:
</p>
<ul class="items"><li>(a) The filename must be given relative to the directory containing the tags
file, so for us that will be the home directory of the web.
</li><li>(b) The <span class="extract"><span class="extract-syntax">find</span></span> field looks like a regular expression but is not one, despite
the suggestive positional markers <span class="extract"><span class="extract-syntax">^</span></span> and <span class="extract"><span class="extract-syntax">$</span></span>. Note in particular that round
brackets and asterisk characters are not escaped, as they would be in a regex.
The Ctags documentation is vague here but does note that <span class="extract"><span class="extract-syntax">^</span></span> and <span class="extract"><span class="extract-syntax">$</span></span> should
be escaped only where they occur in the first or last positions. Tabs do
not need to be escaped.
</li></ul>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Ctags::write_line_ref</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">Ctags::write_line_ref</span></span>:<br/><a href="6-cs.html#SP2_2">&#167;2.2</a>, <a href="6-cs.html#SP2_3">&#167;2.3</a>, <a href="6-cs.html#SP2_4">&#167;2.4</a></span></button><span class="plain-syntax">(</span><span class="constant-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">source_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">L</span><span class="plain-syntax">, </span><span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">fn</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">fn</span><span class="plain-syntax">, </span><span class="string-syntax">"%f"</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_section</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">md</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">source_file_for_section</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation-module/1-wp.html#SP4" class="function-link"><span class="function-syntax">Platform::is_folder_separator</span></a><span class="plain-syntax">(</span><a href="../foundation-module/4-sm.html#SP13" class="function-link"><span class="function-syntax">Str::get_first_char</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">fn</span><span class="plain-syntax">)) == </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><a href="../foundation-module/4-sm.html#SP15" class="function-link"><span class="function-syntax">Str::clear</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">fn</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><a href="../foundation-module/3-fln.html#SP5" class="function-link"><span class="function-syntax">Filenames::to_text_relative</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">fn</span><span class="plain-syntax">, </span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">owning_section</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">md</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">source_file_for_section</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S\t/^"</span><span class="plain-syntax">, </span><span class="identifier-syntax">fn</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">fn</span><span class="plain-syntax">)</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><a href="../foundation-module/4-sm.html#SP8" class="function-link"><span class="function-syntax">Str::len</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">text</span><span class="plain-syntax">); </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">wchar_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><a href="../foundation-module/4-sm.html#SP13" class="function-link"><span class="function-syntax">Str::get_at</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="character-syntax">'/'</span><span class="plain-syntax">: </span><span class="identifier-syntax">PUT</span><span class="plain-syntax">(</span><span class="character-syntax">'\\'</span><span class="plain-syntax">); </span><span class="identifier-syntax">PUT</span><span class="plain-syntax">(</span><span class="identifier-syntax">c</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="character-syntax">'^'</span><span class="plain-syntax">: </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">PUT</span><span class="plain-syntax">(</span><span class="character-syntax">'\\'</span><span class="plain-syntax">); </span><span class="identifier-syntax">PUT</span><span class="plain-syntax">(</span><span class="identifier-syntax">c</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="character-syntax">'$'</span><span class="plain-syntax">: </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><a href="../foundation-module/4-sm.html#SP8" class="function-link"><span class="function-syntax">Str::len</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">L</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">text</span><span class="plain-syntax">) - </span><span class="constant-syntax">1</span><span class="plain-syntax">) </span><span class="identifier-syntax">PUT</span><span class="plain-syntax">(</span><span class="character-syntax">'\\'</span><span class="plain-syntax">); </span><span class="identifier-syntax">PUT</span><span class="plain-syntax">(</span><span class="identifier-syntax">c</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">PUT</span><span class="plain-syntax">(</span><span class="identifier-syntax">c</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"$/"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>To make the above work, we need to keep a list of defined constant names.
We could laboriously extract that from the hash table of reserved words
(see <a href="3-ta.html" class="internal">The Analyser</a>), but this is one of those times when life is short and
memory is cheap. It's easier to keep a duplicate list.
</p>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">defined_constant</span><span class="plain-syntax"> {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">source_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">at</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="constant-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">defined_constant</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure defined_constant is accessed in 2/trs, 1/apacs, 5/wt, 6/rw, 6/cln and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>This is called for any <span class="extract"><span class="extract-syntax">@d</span></span> or <span class="extract"><span class="extract-syntax">@e</span></span> constant name, then:
</p>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Ctags::note_defined_constant</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">Ctags::note_defined_constant</span></span>:<br/>The Parser - <a href="2-tp.html#SP1_1_7_5_1_6">&#167;1.1.7.5.1.6</a>, <a href="2-tp.html#SP1_1_7_5_1_7">&#167;1.1.7.5.1.7</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">source_line</span><span class="plain-syntax"> *</span><span class="identifier-syntax">L</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax">) {</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">defined_constant</span><span class="plain-syntax"> *</span><span class="identifier-syntax">dc</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">defined_constant</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">dc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">name</span><span class="plain-syntax"> = </span><a href="../foundation-module/4-sm.html#SP3" class="function-link"><span class="function-syntax">Str::duplicate</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">dc</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">at</span><span class="plain-syntax"> = </span><span class="identifier-syntax">L</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
<ul class="progressbar"><li class="progressprev"><a href="6-gs.html">&#10094;</a></li><li class="progresschapter"><a href="M-iti.html">M</a></li><li class="progresschapter"><a href="P-htpw.html">P</a></li><li class="progresschapter"><a href="1-bsc.html">1</a></li><li class="progresschapter"><a href="2-tr.html">2</a></li><li class="progresschapter"><a href="3-ta.html">3</a></li><li class="progresschapter"><a href="4-pl.html">4</a></li><li class="progresschapter"><a href="5-wt.html">5</a></li><li class="progresscurrentchapter">6</li><li class="progresssection"><a href="6-mkf.html">mkf</a></li><li class="progresssection"><a href="6-gs.html">gs</a></li><li class="progresscurrent">cs</li><li class="progresssection"><a href="6-rw.html">rw</a></li><li class="progresssection"><a href="6-cln.html">cln</a></li><li class="progressnext"><a href="6-rw.html">&#10095;</a></li></ul></div>
</nav><!--End of weave-->
</main>
</body>
</html>

View file

@ -118,7 +118,7 @@ file by following a "prototype".
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="6-gs.html#SP2">&#167;2</a>.</li></ul>
<nav role="progress"><div class="progresscontainer">
<ul class="progressbar"><li class="progressprev"><a href="6-mkf.html">&#10094;</a></li><li class="progresschapter"><a href="M-iti.html">M</a></li><li class="progresschapter"><a href="P-htpw.html">P</a></li><li class="progresschapter"><a href="1-bsc.html">1</a></li><li class="progresschapter"><a href="2-tr.html">2</a></li><li class="progresschapter"><a href="3-ta.html">3</a></li><li class="progresschapter"><a href="4-pl.html">4</a></li><li class="progresschapter"><a href="5-wt.html">5</a></li><li class="progresscurrentchapter">6</li><li class="progresssection"><a href="6-mkf.html">mkf</a></li><li class="progresscurrent">gs</li><li class="progresssection"><a href="6-rw.html">rw</a></li><li class="progresssection"><a href="6-cln.html">cln</a></li><li class="progressnext"><a href="6-rw.html">&#10095;</a></li></ul></div>
<ul class="progressbar"><li class="progressprev"><a href="6-mkf.html">&#10094;</a></li><li class="progresschapter"><a href="M-iti.html">M</a></li><li class="progresschapter"><a href="P-htpw.html">P</a></li><li class="progresschapter"><a href="1-bsc.html">1</a></li><li class="progresschapter"><a href="2-tr.html">2</a></li><li class="progresschapter"><a href="3-ta.html">3</a></li><li class="progresschapter"><a href="4-pl.html">4</a></li><li class="progresschapter"><a href="5-wt.html">5</a></li><li class="progresscurrentchapter">6</li><li class="progresssection"><a href="6-mkf.html">mkf</a></li><li class="progresscurrent">gs</li><li class="progresssection"><a href="6-cs.html">cs</a></li><li class="progresssection"><a href="6-rw.html">rw</a></li><li class="progresssection"><a href="6-cln.html">cln</a></li><li class="progressnext"><a href="6-cs.html">&#10095;</a></li></ul></div>
</nav><!--End of weave-->
</main>

View file

@ -487,7 +487,7 @@ following a "prototype".
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
<ul class="progressbar"><li class="progressprev"><a href="5-tu.html">&#10094;</a></li><li class="progresschapter"><a href="M-iti.html">M</a></li><li class="progresschapter"><a href="P-htpw.html">P</a></li><li class="progresschapter"><a href="1-bsc.html">1</a></li><li class="progresschapter"><a href="2-tr.html">2</a></li><li class="progresschapter"><a href="3-ta.html">3</a></li><li class="progresschapter"><a href="4-pl.html">4</a></li><li class="progresschapter"><a href="5-wt.html">5</a></li><li class="progresscurrentchapter">6</li><li class="progresscurrent">mkf</li><li class="progresssection"><a href="6-gs.html">gs</a></li><li class="progresssection"><a href="6-rw.html">rw</a></li><li class="progresssection"><a href="6-cln.html">cln</a></li><li class="progressnext"><a href="6-gs.html">&#10095;</a></li></ul></div>
<ul class="progressbar"><li class="progressprev"><a href="5-tu.html">&#10094;</a></li><li class="progresschapter"><a href="M-iti.html">M</a></li><li class="progresschapter"><a href="P-htpw.html">P</a></li><li class="progresschapter"><a href="1-bsc.html">1</a></li><li class="progresschapter"><a href="2-tr.html">2</a></li><li class="progresschapter"><a href="3-ta.html">3</a></li><li class="progresschapter"><a href="4-pl.html">4</a></li><li class="progresschapter"><a href="5-wt.html">5</a></li><li class="progresscurrentchapter">6</li><li class="progresscurrent">mkf</li><li class="progresssection"><a href="6-gs.html">gs</a></li><li class="progresssection"><a href="6-cs.html">cs</a></li><li class="progresssection"><a href="6-rw.html">rw</a></li><li class="progresssection"><a href="6-cln.html">cln</a></li><li class="progressnext"><a href="6-gs.html">&#10095;</a></li></ul></div>
</nav><!--End of weave-->
</main>

View file

@ -149,7 +149,7 @@ parameters.
<span class="plain-syntax"> </span><span class="constant-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">macro_tokens</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure macro is accessed in 2/trs, 3/twot, 5/wt, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/cln and here.</li><li>The structure macro_tokens is private to this section.</li></ul>
<ul class="endnotetexts"><li>The structure macro is accessed in 2/trs, 3/twot, 5/wt, 5/fm, 5/ptf, 5/tf, 5/hf, 5/df, 6/cs, 6/cln and here.</li><li>The structure macro_tokens is private to this section.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b></p>
<pre class="displayed-code all-displayed-code code-font">
@ -344,7 +344,7 @@ assume that the version complies with any format).
<span class="plain-syntax"> </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation-module/4-sm.html#SP19" class="function-link"><span class="function-syntax">Str::eq</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">datum</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Version Number"</span><span class="plain-syntax">)) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">A</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">version</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure writeme_asset is accessed in 2/trs, 5/wt, 6/cln and here.</li></ul>
<ul class="endnotetexts"><li>The structure writeme_asset is accessed in 2/trs, 5/wt, 6/cs, 6/cln and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b>That just leaves the business of inspecting assets to obtain their metadata.
</p>
@ -477,7 +477,7 @@ assume that the version complies with any format).
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
<ul class="progressbar"><li class="progressprev"><a href="6-gs.html">&#10094;</a></li><li class="progresschapter"><a href="M-iti.html">M</a></li><li class="progresschapter"><a href="P-htpw.html">P</a></li><li class="progresschapter"><a href="1-bsc.html">1</a></li><li class="progresschapter"><a href="2-tr.html">2</a></li><li class="progresschapter"><a href="3-ta.html">3</a></li><li class="progresschapter"><a href="4-pl.html">4</a></li><li class="progresschapter"><a href="5-wt.html">5</a></li><li class="progresscurrentchapter">6</li><li class="progresssection"><a href="6-mkf.html">mkf</a></li><li class="progresssection"><a href="6-gs.html">gs</a></li><li class="progresscurrent">rw</li><li class="progresssection"><a href="6-cln.html">cln</a></li><li class="progressnext"><a href="6-cln.html">&#10095;</a></li></ul></div>
<ul class="progressbar"><li class="progressprev"><a href="6-cs.html">&#10094;</a></li><li class="progresschapter"><a href="M-iti.html">M</a></li><li class="progresschapter"><a href="P-htpw.html">P</a></li><li class="progresschapter"><a href="1-bsc.html">1</a></li><li class="progresschapter"><a href="2-tr.html">2</a></li><li class="progresschapter"><a href="3-ta.html">3</a></li><li class="progresschapter"><a href="4-pl.html">4</a></li><li class="progresschapter"><a href="5-wt.html">5</a></li><li class="progresscurrentchapter">6</li><li class="progresssection"><a href="6-mkf.html">mkf</a></li><li class="progresssection"><a href="6-gs.html">gs</a></li><li class="progresssection"><a href="6-cs.html">cs</a></li><li class="progresscurrent">rw</li><li class="progresssection"><a href="6-cln.html">cln</a></li><li class="progressnext"><a href="6-cln.html">&#10095;</a></li></ul></div>
</nav><!--End of weave-->
</main>

View file

@ -97,6 +97,8 @@
<span class="plain-syntax"> -weave-to X weave, but to filename X (for single files only)</span>
<span class="plain-syntax">for tangling a web:</span>
<span class="plain-syntax"> -ctags-to X tangle, but write Universal Ctags file to X not to 'tags'</span>
<span class="plain-syntax"> -no-ctags don't write a Universal Ctags file when tangling (default is -ctags)</span>
<span class="plain-syntax"> -tangle tangle the web into machine-compilable form</span>
<span class="plain-syntax"> -tangle-to X tangle, but to filename X</span>

View file

@ -43,7 +43,7 @@
<ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="index.html">inweb</a></li><li><a href="index.html#M">Manual</a></li><li><b>Webs, Tangling and Weaving</b></li></ul></div>
<p class="purpose">How to use Inweb to weave or tangle a web already written.</p>
<ul class="toc"><li><a href="M-wtaw.html#SP1">&#167;1. All-in-one webs</a></li><li><a href="M-wtaw.html#SP4">&#167;4. Multi-section webs</a></li><li><a href="M-wtaw.html#SP7">&#167;7. Tangling</a></li><li><a href="M-wtaw.html#SP10">&#167;10. Weaving</a></li><li><a href="M-wtaw.html#SP13">&#167;13. Weave tags</a></li><li><a href="M-wtaw.html#SP14">&#167;14. Modules</a></li><li><a href="M-wtaw.html#SP17">&#167;17. The section catalogue</a></li><li><a href="M-wtaw.html#SP18">&#167;18. Makefile</a></li><li><a href="M-wtaw.html#SP19">&#167;19. Gitignore</a></li><li><a href="M-wtaw.html#SP20">&#167;20. README files</a></li><li><a href="M-wtaw.html#SP23">&#167;23. Semantic version numbering and build metadata</a></li></ul><hr class="tocbar">
<ul class="toc"><li><a href="M-wtaw.html#SP1">&#167;1. All-in-one webs</a></li><li><a href="M-wtaw.html#SP4">&#167;4. Multi-section webs</a></li><li><a href="M-wtaw.html#SP7">&#167;7. Tangling</a></li><li><a href="M-wtaw.html#SP10">&#167;10. Weaving</a></li><li><a href="M-wtaw.html#SP13">&#167;13. Weave tags</a></li><li><a href="M-wtaw.html#SP14">&#167;14. Modules</a></li><li><a href="M-wtaw.html#SP17">&#167;17. The section catalogue</a></li><li><a href="M-wtaw.html#SP18">&#167;18. Makefile</a></li><li><a href="M-wtaw.html#SP19">&#167;19. Gitignore</a></li><li><a href="M-wtaw.html#SP20">&#167;20. Ctags</a></li><li><a href="M-wtaw.html#SP21">&#167;21. README files</a></li><li><a href="M-wtaw.html#SP24">&#167;24. Semantic version numbering and build metadata</a></li></ul><hr class="tocbar">
<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. All-in-one webs. </b>A program written for use with Inweb is called a "web". Inweb was primarily
designed for large, multisection webs, but it can also be used in a much
@ -648,7 +648,28 @@ specifies the files to be ignored. The following does so for a web <span class="
<span class="extract"><span class="ConsoleText-extract-syntax">gitignorescript.txt</span></span>.
</p>
<p class="commentary firstcommentary"><a id="SP20" class="paragraph-anchor"></a><b>&#167;20. README files. </b>Repositories at Github customarily have <span class="extract"><span class="ConsoleText-extract-syntax">README.mk</span></span> files, in Markdown
<p class="commentary firstcommentary"><a id="SP20" class="paragraph-anchor"></a><b>&#167;20. Ctags. </b>Each time a web is tangled, Inweb writes a <span class="extract"><span class="ConsoleText-extract-syntax">tags</span></span> file to the web's home
directory, containing a list of <a href="https://ctags.io" class="external">Universal ctags</a>
for any structures, functions or constant definitions found in the web. You
need do nothing to make this happen, and can ignore the file if it's of no
use. If you are editing a web in certain text editors, though, such as
<a href="https://www.barebones.com/products/bbedit" class="external">BBEdit</a> for MacOS, then this
should make code completion and definition lookup features work.
</p>
<p class="commentary">You can however write the file elsewhere:
</p>
<pre class="ConsoleText-displayed-code all-displayed-code code-font">
<span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-element-syntax">$</span><span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-function-syntax">inweb/Tangled/inweb</span><span class="ConsoleText-plain-syntax"> W</span><span class="ConsoleText-identifier-syntax"> -tangle -ctags-to</span><span class="ConsoleText-plain-syntax"> secret_lair/my_nifty.ctags</span>
</pre>
<p class="commentary">or not at all:
</p>
<pre class="ConsoleText-displayed-code all-displayed-code code-font">
<span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-element-syntax">$</span><span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-function-syntax">inweb/Tangled/inweb</span><span class="ConsoleText-plain-syntax"> W</span><span class="ConsoleText-identifier-syntax"> -tangle -no-ctags</span>
</pre>
<p class="commentary firstcommentary"><a id="SP21" class="paragraph-anchor"></a><b>&#167;21. README files. </b>Repositories at Github customarily have <span class="extract"><span class="ConsoleText-extract-syntax">README.mk</span></span> files, in Markdown
syntax, explaining what they are. These of course should probably include
current version numbers, and it's a pain keeping that up to date. For
really complicated repositories, containing multiple webs, some automation
@ -665,7 +686,7 @@ the script can be specified explicitly:
<pre class="ConsoleText-displayed-code all-displayed-code code-font">
<span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-element-syntax">$</span><span class="ConsoleText-plain-syntax"> </span><span class="ConsoleText-function-syntax">inweb/Tangled/inweb</span><span class="ConsoleText-plain-syntax"> W</span><span class="ConsoleText-identifier-syntax"> -prototype</span><span class="ConsoleText-plain-syntax"> MySpecialThang.txt</span><span class="ConsoleText-identifier-syntax"> -write-me</span><span class="ConsoleText-plain-syntax"> W/README.mk</span>
</pre>
<p class="commentary firstcommentary"><a id="SP21" class="paragraph-anchor"></a><b>&#167;21. </b>Everything in the script is copied over verbatim except where the <span class="extract"><span class="ConsoleText-extract-syntax">@</span></span> character
<p class="commentary firstcommentary"><a id="SP22" class="paragraph-anchor"></a><b>&#167;22. </b>Everything in the script is copied over verbatim except where the <span class="extract"><span class="ConsoleText-extract-syntax">@</span></span> character
is used, which was chosen because it isn't significant in Github's form of
Markdown. <span class="extract"><span class="ConsoleText-extract-syntax">@name(args)</span></span> is like a function call (or, in more traditional
language, a macro): it expands out to something depending on the arguments.
@ -687,7 +708,7 @@ the web indicated by <span class="extract"><span class="ConsoleText-extract-synt
<span class="extract"><span class="ConsoleText-extract-syntax">@var(A,Version Number)</span></span> and <span class="extract"><span class="ConsoleText-extract-syntax">@purpose(A)</span></span> for <span class="extract"><span class="ConsoleText-extract-syntax">@var(A,Purpose)</span></span>, so this
is really the only one needed.
</li></ul>
<p class="commentary firstcommentary"><a id="SP22" class="paragraph-anchor"></a><b>&#167;22. </b>It is also possible to define new functions. For example:
<p class="commentary firstcommentary"><a id="SP23" class="paragraph-anchor"></a><b>&#167;23. </b>It is also possible to define new functions. For example:
</p>
<pre class="displayed-code all-displayed-code code-font">
@ -712,7 +733,7 @@ function <span class="extract"><span class="extract-syntax">B</span></span> not
both <span class="extract"><span class="extract-syntax">A</span></span> and <span class="extract"><span class="extract-syntax">B</span></span> have been defined. So, basically, declare before use.
</p>
<p class="commentary firstcommentary"><a id="SP23" class="paragraph-anchor"></a><b>&#167;23. Semantic version numbering and build metadata. </b>When Inweb reads in a web, it also looks for a file called <span class="extract"><span class="extract-syntax">build.txt</span></span> in
<p class="commentary firstcommentary"><a id="SP24" class="paragraph-anchor"></a><b>&#167;24. Semantic version numbering and build metadata. </b>When Inweb reads in a web, it also looks for a file called <span class="extract"><span class="extract-syntax">build.txt</span></span> in
the web's directory; if that isn't there, it looks for the same file in the
current working directory; if that's not there either, never mind.
</p>
@ -745,7 +766,7 @@ the web as the variable <span class="extract"><span class="extract-syntax">Seman
<p class="commentary">For more on semvers, see: <a href="https://semver.org" class="external">https://semver.org</a>
</p>
<p class="commentary firstcommentary"><a id="SP24" class="paragraph-anchor"></a><b>&#167;24. </b>A special advancing mechanism exists to update build numbers and dates.
<p class="commentary firstcommentary"><a id="SP25" class="paragraph-anchor"></a><b>&#167;25. </b>A special advancing mechanism exists to update build numbers and dates.
Running Inweb with <span class="extract"><span class="extract-syntax">-advance-build W</span></span> checks the build date for web <span class="extract"><span class="extract-syntax">W</span></span>:
if it differs from today, then it is changed to today, and the build code
is advanced by one.

View file

@ -307,6 +307,11 @@
<spon class="sectiontitle">Git Support</span></a> -
<span class="sectionpurpose">Constructing a suitable gitignore file for a simple inweb project.</span></p>
</li>
<li>
<p class="sectionentry"><a href="6-cs.html">
<spon class="sectiontitle">Ctags Support</span></a> -
<span class="sectionpurpose">Constructing a suitable ctags file for a web.</span></p>
</li>
<li>
<p class="sectionentry"><a href="6-rw.html">
<spon class="sectiontitle">Readme Writeme</span></a> -

View file

@ -97,7 +97,14 @@ void Filenames::to_text_relative(OUTPUT_STREAM, filename *F, pathname *P) {
if ((Str::prefix_eq(ft, pt, n)) && (Platform::is_folder_separator(Str::get_at(ft, n)))) {
Str::delete_n_characters(ft, n+1);
WRITE("%S", ft);
} else internal_error("filename not relative to pathname");
} else {
if (P == NULL) {
WRITE("%S", ft);
} else {
WRITE("..%c", FOLDER_SEPARATOR);
Filenames::to_text_relative(OUT, F, Pathnames::up(P));
}
}
DISCARD_TEXT(ft)
DISCARD_TEXT(pt)
}

View file

@ -4,6 +4,7 @@
.DS_Store
Manual.html
debug-log.txt
tags
Woven/
Tangled/inweb
Tangled/inweb_dev*