1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-06-26 04:00:43 +03:00

First attempt at moving from wchar_t wide strings to 32-bit strings

This commit is contained in:
David Kinder 2023-09-05 08:36:51 +01:00
parent 5ccc10ada9
commit 521e590618
217 changed files with 1775 additions and 1769 deletions

View file

@ -88,7 +88,7 @@ Blurb commands.
=
typedef struct blurb_command {
char *explicated; /* plain English form of the command */
wchar_t *prototype; /* regular expression prototype */
inchar32_t *prototype; /* regular expression prototype */
int operands; /* one of the above |*_OPS| codes */
int deprecated;
} blurb_command;
@ -104,67 +104,67 @@ but, as we shall see, has no effect.
=
blurb_command syntaxes[] = {
{ "author \"name\"", L"author \"(%q*)\"", T_OPS, FALSE },
{ "author \"name\"", U"author \"(%q*)\"", T_OPS, FALSE },
{ "auxiliary \"filename\" \"description\" \"subfolder\"",
L"auxiliary \"(%q*)\" \"(%q*)\" \"(%q*)\"", TTT_OPS, FALSE },
U"auxiliary \"(%q*)\" \"(%q*)\" \"(%q*)\"", TTT_OPS, FALSE },
{ "base64 \"filename\" to \"filename\"",
L"base64 \"(%q*)\" to \"(%q*)\"", TT_OPS, FALSE },
{ "copyright \"message\"", L"copyright \"(%q*)\"", T_OPS, FALSE },
{ "cover \"filename\"", L"cover \"(%q*)\"", T_OPS, FALSE },
{ "css", L"css", VOID_OPS, FALSE },
{ "data N \"filename\" type TYPE", L"data (%d+) \"(%q*)\" type (%i+)", NTT_OPS, FALSE },
{ "data ID \"filename\" type TYPE", L"data (%i+) \"(%q*)\" type (%i+)", TTT_OPS, FALSE },
{ "ifiction", L"ifiction", VOID_OPS, FALSE },
{ "ifiction public", L"ifiction public", VOID_OPS, FALSE },
{ "ifiction \"filename\" include", L"ifiction \"(%q*)\" include", T_OPS, FALSE },
U"base64 \"(%q*)\" to \"(%q*)\"", TT_OPS, FALSE },
{ "copyright \"message\"", U"copyright \"(%q*)\"", T_OPS, FALSE },
{ "cover \"filename\"", U"cover \"(%q*)\"", T_OPS, FALSE },
{ "css", U"css", VOID_OPS, FALSE },
{ "data N \"filename\" type TYPE", U"data (%d+) \"(%q*)\" type (%i+)", NTT_OPS, FALSE },
{ "data ID \"filename\" type TYPE", U"data (%i+) \"(%q*)\" type (%i+)", TTT_OPS, FALSE },
{ "ifiction", U"ifiction", VOID_OPS, FALSE },
{ "ifiction public", U"ifiction public", VOID_OPS, FALSE },
{ "ifiction \"filename\" include", U"ifiction \"(%q*)\" include", T_OPS, FALSE },
{ "interpreter \"interpreter-name\" \"vm-letter\"",
L"interpreter \"(%q*)\" \"([gz])\"", TT_OPS, FALSE },
{ "palette { details }", L"palette {(%c*?)}", T_OPS, TRUE },
{ "palette 16 bit", L"palette 16 bit", VOID_OPS, TRUE },
{ "palette 32 bit", L"palette 32 bit", VOID_OPS, TRUE },
U"interpreter \"(%q*)\" \"([gz])\"", TT_OPS, FALSE },
{ "palette { details }", U"palette {(%c*?)}", T_OPS, TRUE },
{ "palette 16 bit", U"palette 16 bit", VOID_OPS, TRUE },
{ "palette 32 bit", U"palette 32 bit", VOID_OPS, TRUE },
{ "picture ID \"filename\" scale ...",
L"picture (%i+?) \"(%q*)\" scale (%c*)", TTT_OPS, TRUE },
{ "picture N \"filename\"", L"picture (%d+) \"(%q*)\"", NT_OPS, FALSE },
{ "picture ID \"filename\"", L"picture (%i+) \"(%q*)\"", TT_OPS, FALSE },
{ "picture \"filename\"", L"picture \"(%q*)\"", T_OPS, FALSE },
{ "picture N \"filename\" \"alt-text\"", L"picture (%d+) \"(%q*)\" \"(%q*)\"", NTT_OPS, FALSE },
{ "placeholder [name] = \"text\"", L"placeholder %[(%C+)%] = \"(%q*)\"", TT_OPS, FALSE },
{ "project folder \"pathname\"", L"project folder \"(%q*)\"", T_OPS, FALSE },
{ "release \"text\"", L"release \"(%q*)\"", T_OPS, FALSE },
{ "release file \"filename\"", L"release file \"(%q*)\"", T_OPS, FALSE },
U"picture (%i+?) \"(%q*)\" scale (%c*)", TTT_OPS, TRUE },
{ "picture N \"filename\"", U"picture (%d+) \"(%q*)\"", NT_OPS, FALSE },
{ "picture ID \"filename\"", U"picture (%i+) \"(%q*)\"", TT_OPS, FALSE },
{ "picture \"filename\"", U"picture \"(%q*)\"", T_OPS, FALSE },
{ "picture N \"filename\" \"alt-text\"", U"picture (%d+) \"(%q*)\" \"(%q*)\"", NTT_OPS, FALSE },
{ "placeholder [name] = \"text\"", U"placeholder %[(%C+)%] = \"(%q*)\"", TT_OPS, FALSE },
{ "project folder \"pathname\"", U"project folder \"(%q*)\"", T_OPS, FALSE },
{ "release \"text\"", U"release \"(%q*)\"", T_OPS, FALSE },
{ "release file \"filename\"", U"release file \"(%q*)\"", T_OPS, FALSE },
{ "release file \"filename\" from \"template\"",
L"release file \"(%q*)\" from \"(%q*)\"", TT_OPS, FALSE },
U"release file \"(%q*)\" from \"(%q*)\"", TT_OPS, FALSE },
{ "release source \"filename\" using \"filename\" from \"template\"",
L"release source \"(%q*)\" using \"(%q*)\" from \"(%q*)\"", TTT_OPS, FALSE },
{ "release to \"pathname\"", L"release to \"(%q*)\"", T_OPS, FALSE },
{ "resolution NxN max NxN", L"resolution (%d+) max (%d+)", NN_OPS, TRUE },
{ "resolution NxN min NxN max NxN", L"resolution (%d+) min (%d+) max (%d+)", NNN_OPS, TRUE },
{ "resolution NxN min NxN", L"resolution (%d+) min (%d+)", NN_OPS, TRUE },
{ "resolution NxN", L"resolution (%d+)", N_OPS, TRUE },
{ "solution", L"solution", VOID_OPS, FALSE },
{ "solution public", L"solution public", VOID_OPS, FALSE },
{ "sound ID \"filename\" music", L"sound (%i+) \"(%q*)\" music", TT_OPS, TRUE },
U"release source \"(%q*)\" using \"(%q*)\" from \"(%q*)\"", TTT_OPS, FALSE },
{ "release to \"pathname\"", U"release to \"(%q*)\"", T_OPS, FALSE },
{ "resolution NxN max NxN", U"resolution (%d+) max (%d+)", NN_OPS, TRUE },
{ "resolution NxN min NxN max NxN", U"resolution (%d+) min (%d+) max (%d+)", NNN_OPS, TRUE },
{ "resolution NxN min NxN", U"resolution (%d+) min (%d+)", NN_OPS, TRUE },
{ "resolution NxN", U"resolution (%d+)", N_OPS, TRUE },
{ "solution", U"solution", VOID_OPS, FALSE },
{ "solution public", U"solution public", VOID_OPS, FALSE },
{ "sound ID \"filename\" music", U"sound (%i+) \"(%q*)\" music", TT_OPS, TRUE },
{ "sound ID \"filename\" repeat N",
L"sound (%i+) \"(%q*)\" repeat (%d+)", TTN_OPS, TRUE },
U"sound (%i+) \"(%q*)\" repeat (%d+)", TTN_OPS, TRUE },
{ "sound ID \"filename\" repeat forever",
L"sound (%i+) \"(%q*)\" repeat forever", TT_OPS, TRUE },
{ "sound ID \"filename\" song", L"sound (%i+) \"(%q*)\" song", TT_OPS, TRUE },
{ "sound N \"filename\"", L"sound (%d+) \"(%q*)\"", NT_OPS, FALSE },
{ "sound ID \"filename\"", L"sound (%i+) \"(%q*)\"", TT_OPS, FALSE },
{ "sound \"filename\"", L"sound \"(%q*)\"", T_OPS, FALSE },
{ "sound N \"filename\" \"alt-text\"", L"sound (%d+) \"(%q*)\" \"(%q*)\"", NTT_OPS, FALSE },
{ "source", L"source", VOID_OPS, FALSE },
{ "source public", L"source public", VOID_OPS, FALSE },
{ "status \"template\" \"filename\"", L"status \"(%q*)\" \"(%q*)\"", TT_OPS, FALSE },
U"sound (%i+) \"(%q*)\" repeat forever", TT_OPS, TRUE },
{ "sound ID \"filename\" song", U"sound (%i+) \"(%q*)\" song", TT_OPS, TRUE },
{ "sound N \"filename\"", U"sound (%d+) \"(%q*)\"", NT_OPS, FALSE },
{ "sound ID \"filename\"", U"sound (%i+) \"(%q*)\"", TT_OPS, FALSE },
{ "sound \"filename\"", U"sound \"(%q*)\"", T_OPS, FALSE },
{ "sound N \"filename\" \"alt-text\"", U"sound (%d+) \"(%q*)\" \"(%q*)\"", NTT_OPS, FALSE },
{ "source", U"source", VOID_OPS, FALSE },
{ "source public", U"source public", VOID_OPS, FALSE },
{ "status \"template\" \"filename\"", U"status \"(%q*)\" \"(%q*)\"", TT_OPS, FALSE },
{ "status alternative ||link to Inform documentation||",
L"status alternative ||(%c*)||", T_OPS, FALSE },
U"status alternative ||(%c*)||", T_OPS, FALSE },
{ "status instruction ||link to Inform source text||",
L"status instruction ||(%c*)||", T_OPS, FALSE },
{ "storyfile \"filename\" include", L"storyfile \"(%q*)\" include", T_OPS, FALSE },
{ "storyfile \"filename\"", L"storyfile \"(%q*)\"", T_OPS, TRUE },
{ "storyfile leafname \"leafname\"", L"storyfile leafname \"(%q*)\"", T_OPS, FALSE },
{ "template path \"folder\"", L"template path \"(%q*)\"", T_OPS, FALSE },
{ "website \"template\"", L"website \"(%q*)\"", T_OPS, FALSE },
U"status instruction ||(%c*)||", T_OPS, FALSE },
{ "storyfile \"filename\" include", U"storyfile \"(%q*)\" include", T_OPS, FALSE },
{ "storyfile \"filename\"", U"storyfile \"(%q*)\"", T_OPS, TRUE },
{ "storyfile leafname \"leafname\"", U"storyfile leafname \"(%q*)\"", T_OPS, FALSE },
{ "template path \"folder\"", U"template path \"(%q*)\"", T_OPS, FALSE },
{ "website \"template\"", U"website \"(%q*)\"", T_OPS, FALSE },
{ NULL, NULL, VOID_OPS, FALSE }
};
@ -191,7 +191,7 @@ including any blank lines.
void Parser::interpret_line(text_stream *command, text_file_position *tf, void *state) {
BlorbErrors::set_error_position(tf);
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, command, L" *(%c*?) *")) Str::copy(command, mr.exp[0]);
if (Regexp::match(&mr, command, U" *(%c*?) *")) Str::copy(command, mr.exp[0]);
if (Str::len(command) == 0) return; /* thus skip a line containing only blank space */
if (Str::get_first_char(command) == '!') return; /* thus skip a comment line */
@ -339,7 +339,7 @@ has the assumption that the cover art is image number 1 built in.
if (Filenames::guess_format(cover_filename) == FORMAT_PERHAPS_JPEG)
cover_is_in_JPEG_format = TRUE;
Writer::frontispiece_chunk(1);
if (Str::eq_wide_string(Filenames::get_leafname(cover_filename), L"DefaultCover.jpg"))
if (Str::eq_wide_string(Filenames::get_leafname(cover_filename), U"DefaultCover.jpg"))
default_cover_used = TRUE;
Placeholders::set_to(I"SMALLCOVER", text1, 0);
@ -385,7 +385,7 @@ void Parser::qualify_placeholder(text_stream *openUrl_path, text_stream *fileUrl
text_stream *FU = Placeholders::read(fileUrl_path);
text_stream *U = Placeholders::read(original);
LOOP_THROUGH_TEXT(P, U) {
int c = Str::get(P);
inchar32_t c = Str::get(P);
if (c == ' ') {
if (escape_openUrl) WRITE_TO(OU, "%%2520");
else PUT_TO(OU, c);

View file

@ -10,8 +10,8 @@ values here aren't actually correct for any platform as they stand: in the
|main| routine below, we set them as needed.
=
wchar_t *FONT_TAG = L"size=2"; /* contents of a |<font>| tag */
wchar_t *JAVASCRIPT_PRELUDE = L"javascript:window.Project."; /* calling prefix */
inchar32_t *FONT_TAG = U"size=2"; /* contents of a |<font>| tag */
inchar32_t *JAVASCRIPT_PRELUDE = U"javascript:window.Project."; /* calling prefix */
int escape_openUrl = FALSE, escape_fileUrl = FALSE;
int reverse_slash_openUrl = FALSE, reverse_slash_fileUrl = FALSE;
@ -98,13 +98,13 @@ int main(int argc, char *argv[]) {
blurb_filename, blorb_filename);
@<Read the command-line switches@> =
CommandLine::declare_heading(L"inblorb: a releaser and packager for IF story files\n\n"
L"usage: inblorb [-options] [blurbfile [blorbfile]]\n");
CommandLine::declare_heading(U"inblorb: a releaser and packager for IF story files\n\n"
U"usage: inblorb [-options] [blurbfile [blorbfile]]\n");
CommandLine::declare_boolean_switch(VERBOSE_CLSW, L"verbose", 1,
L"print running notes on what's happening", FALSE);
CommandLine::declare_switch(PROJECT_CLSW, L"project", 2,
L"work within Inform project X");
CommandLine::declare_boolean_switch(VERBOSE_CLSW, U"verbose", 1,
U"print running notes on what's happening", FALSE);
CommandLine::declare_switch(PROJECT_CLSW, U"project", 2,
U"work within Inform project X");
int bare_words = 0;
CommandLine::read(argc, argv, &bare_words, &Main::switch, &Main::bareword);
@ -160,7 +160,7 @@ since backslashes are escape characters in Javascript literals.
@<Set platform-dependent HTML and Javascript variables@> =
#ifndef PLATFORM_WINDOWS
FONT_TAG = L"face=\"lucida grande,geneva,arial,tahoma,verdana,helvetica,helv\" size=2";
FONT_TAG = U"face=\"lucida grande,geneva,arial,tahoma,verdana,helvetica,helv\" size=2";
escape_openUrl = TRUE; /* we want |openUrl| to escape, and |fileUrl| not to */
#endif
#ifdef PLATFORM_WINDOWS
@ -242,9 +242,9 @@ that's where they're used.
Placeholders::set_to(I"CBLORBSTATUSLOW", I"failed", 0);
Placeholders::set_to(I"CBLORBSTATUSIMAGE", I"inform:/outcome_images/cblorb_failed.png", 0);
Placeholders::set_to(I"CBLORBSTATUSTEXT",
Str::literal(L"Inform translated your source text as usual, to manufacture a 'story "
L"file': all of that worked fine. But the Release then went wrong, for "
L"the following reason:<p><ul>[CBLORBERRORS]</ul>"), 0
Str::literal(U"Inform translated your source text as usual, to manufacture a 'story "
U"file': all of that worked fine. But the Release then went wrong, for "
U"the following reason:<p><ul>[CBLORBERRORS]</ul>"), 0
);
} else {
Placeholders::set_to(I"CBLORBERRORS", I"No problems occurred", 0);
@ -252,12 +252,12 @@ that's where they're used.
Placeholders::set_to(I"CBLORBSTATUSLOW", I"succeeded", 0);
Placeholders::set_to(I"CBLORBSTATUSIMAGE", I"file://[SMALLCOVER]", 0);
Placeholders::set_to(I"CBLORBSTATUSTEXT",
Str::literal(L"All went well. I've put the released material into the 'Release' subfolder "
L"of the Materials folder for the project: you can take a look with "
L"the menu option <b>Release &gt; Open Materials Folder</b> or by clicking "
L"the blue folders above.<p>"
L"Releases can range in size from a single blorb file to a medium-sized website. "
L"Here's what we currently have:<p>"), 0
Str::literal(U"All went well. I've put the released material into the 'Release' subfolder "
U"of the Materials folder for the project: you can take a look with "
U"the menu option <b>Release &gt; Open Materials Folder</b> or by clicking "
U"the blue folders above.<p>"
U"Releases can range in size from a single blorb file to a medium-sized website. "
U"Here's what we currently have:<p>"), 0
);
Requests::report_requested_material(I"CBLORBSTATUSTEXT");
}

View file

@ -18,7 +18,7 @@ RFC 1113 permits white space to be used freely, including in particular
line breaks, but we don't avail ourselves.
=
char *RFC1113_table = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
inchar32_t *RFC1113_table = U"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
@ The encoding routine is as follows.

View file

@ -74,7 +74,7 @@ list entry tags, for convenience of CSS styling.
void Links::expand_AUXILIARY_variable(OUTPUT_STREAM) {
auxiliary_file *aux;
LOOP_OVER(aux, auxiliary_file) {
if (Str::eq_wide_string(aux->description, L"--") == FALSE) {
if (Str::eq_wide_string(aux->description, U"--") == FALSE) {
WRITE("<li>");
Links::download_link(OUT,
aux->description, aux->full_filename, aux->aux_leafname, aux->format);
@ -101,13 +101,13 @@ This routine, then, handles either kind of link.
=
void Links::download_link(OUTPUT_STREAM, text_stream *desc, filename *F, text_stream *relative_url, text_stream *form) {
int size_up = TRUE;
if (Str::eq_wide_string(form, L"link")) size_up = FALSE;
if (Str::eq_wide_string(form, U"link")) size_up = FALSE;
WRITE("<a href=\"%S\">%S</a> ", relative_url, desc);
Websites::open_style(OUT, "filetype");
WRITE("(%S", form);
if (size_up) {
long int size = -1L;
if (Str::eq_wide_string(desc, L"Story File")) size = (long int) blorb_file_size;
if (Str::eq_wide_string(desc, U"Story File")) size = (long int) blorb_file_size;
else size = BinaryFiles::size(F);
if (size != -1L) @<Write a description of the rough file size@>
}

View file

@ -177,7 +177,7 @@ within an HTML paragraph.
@<Copy an ordinary unreserved placeholder@> =
int L = Str::len(wv->pl_contents);
for (int i=0; i<L; i++) {
int c = Str::get_at(wv->pl_contents, i);
inchar32_t c = Str::get_at(wv->pl_contents, i);
if ((c == '<') &&
(Str::get_at(wv->pl_contents, i+1) == 'b') &&
(Str::get_at(wv->pl_contents, i+2) == 'r') &&
@ -189,7 +189,7 @@ within an HTML paragraph.
TEMPORARY_TEXT(inner_name)
int expanded = FALSE;
for (int j = i+1; j<L; j++) {
int c = Str::get_at(wv->pl_contents, j);
inchar32_t c = Str::get_at(wv->pl_contents, j);
if ((c == '[') || (c == ' ')) break;
if (c == ']') {
i = j;

View file

@ -152,7 +152,7 @@ void Requests::create_requested_material(void) {
@<Copy a file into the release folder@> =
pathname *P = release_folder;
if (Str::eq_wide_string(req->details3, L"--") == FALSE)
if (Str::eq_wide_string(req->details3, U"--") == FALSE)
P = Pathnames::down(P, req->details3);
filename *write_to = Filenames::in(P, req->details2);
filename *from = Filenames::from_text(req->details1);
@ -286,8 +286,8 @@ int cp_written = FALSE;
void Requests::read_requested_ifile(text_stream *manifestline, text_file_position *tfp, void *state) {
if (cp_written == FALSE) { cp_written = TRUE; current_placeholder = Str::new(); }
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, manifestline, L" *(%c*?) *")) Str::copy(manifestline, mr.exp[0]);
if (Regexp::match(&mr, manifestline, L"%[(%c*)%]"))
if (Regexp::match(&mr, manifestline, U" *(%c*?) *")) Str::copy(manifestline, mr.exp[0]);
if (Regexp::match(&mr, manifestline, U"%[(%c*)%]"))
Str::copy(current_placeholder, mr.exp[0]);
else if (Str::len(current_placeholder) == 0)
@<We're outside placeholder mode, so it's a comment or a manifested filename@>
@ -373,7 +373,7 @@ to the experts.
@<Release an HTML page from the template into the website@> =
Placeholders::set_to(I"TEMPLATE", t, 0);
if (verbose_mode) PRINT("! Web page %S from template %S\n", name, t);
if (Str::eq_wide_string(name, L"source.html"))
if (Str::eq_wide_string(name, U"source.html"))
Websites::web_copy_source(from, release_folder);
else
Websites::web_copy(from, write_to);
@ -459,9 +459,9 @@ void Requests::report_requested_material(text_stream *ph) {
@<Itemise the blorb file, possibly mentioning pictures and sounds@> =
if ((no_pictures_included > 1) || (no_sounds_included > 0) || (no_data_files_included > 0))
Placeholders::append_to(ph,
Str::literal(L"<li>The blorb file <b>[STORYFILE]</b> ([BLORBFILESIZE]K in size, "
L"including [BLORBFILEPICTURES] figures(s), [BLORBFILESOUNDS] "
L"sound(s) and [BLORBFILEDATAFILES] data files(s))</li>"));
Str::literal(U"<li>The blorb file <b>[STORYFILE]</b> ([BLORBFILESIZE]K in size, "
U"including [BLORBFILEPICTURES] figures(s), [BLORBFILESOUNDS] "
U"sound(s) and [BLORBFILEDATAFILES] data files(s))</li>"));
else
Placeholders::append_to(ph, I"<li>The blorb file <b>[STORYFILE]</b> ([BLORBFILESIZE]K in size)</li>");
@ -526,7 +526,7 @@ void Requests::report_requested_material(text_stream *ph) {
Placeholders::append_to(ph, filesize);
DISCARD_TEXT(filesize)
}
if (Str::eq_wide_string(req->details3, L"--") == FALSE) {
if (Str::eq_wide_string(req->details3, U"--") == FALSE) {
Placeholders::append_to(ph, I" to subfolder ");
Placeholders::append_to(ph, req->details3);
}
@ -545,7 +545,7 @@ application, called |openUrl|.
Placeholders::append_to(ph, I"<p><center>");
if (launch_website) {
Placeholders::append_to(ph,
Str::literal(L"<a href=\"javascript:window.Project."
Str::literal(U"<a href=\"javascript:window.Project."
"openUrl('file://[**MATERIALSFOLDERPATHOPEN]/Release/index.html')\">"
"<img src='inform:/outcome_images/browse.png' border=0></a> home page"));
}
@ -553,9 +553,9 @@ application, called |openUrl|.
Placeholders::append_to(ph, I" : ");
if (launch_play)
Placeholders::append_to(ph,
Str::literal(L"<a href=\"javascript:window.Project."
L"openUrl('file://[**MATERIALSFOLDERPATHOPEN]/Release/play.html')\">"
L"<img src='inform:/outcome_images/browse.png' border=0></a> play-in-browser page"));
Str::literal(U"<a href=\"javascript:window.Project."
U"openUrl('file://[**MATERIALSFOLDERPATHOPEN]/Release/play.html')\">"
U"<img src='inform:/outcome_images/browse.png' border=0></a> play-in-browser page"));
Placeholders::append_to(ph, I"</center></p>");
@ Since Inblorb has no knowledge of what the Inform source text producing

View file

@ -171,7 +171,7 @@ void Solution::read_skein_line(text_stream *line, int pass) {
void Solution::find_node_ID_in_tag(OUTPUT_STREAM, text_stream *line, char *tag) {
TEMPORARY_TEXT(prototype)
WRITE_TO(prototype, "%%c*?<%s nodeId=\"(%%c*?)\"%%c*", tag);
wchar_t prototype_Cs[128];
inchar32_t prototype_Cs[128];
Str::copy_to_wide_string(prototype_Cs, prototype, 128);
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, line, prototype_Cs)) Str::copy(OUT, mr.exp[0]);
@ -187,7 +187,7 @@ int Solution::find_text_of_tag(OUTPUT_STREAM, text_stream *line, char *tag) {
TEMPORARY_TEXT(prototype)
WRITE_TO(prototype, "%%c*?>(%%c*?)</%s%%c*", tag);
match_results mr = Regexp::create_mr();
wchar_t prototype_Cs[128];
inchar32_t prototype_Cs[128];
Str::copy_to_wide_string(prototype_Cs, prototype, 128);
if (Regexp::match(&mr, line, prototype_Cs)) {
DISCARD_TEXT(prototype)
@ -234,12 +234,12 @@ void Solution::undo_XML_escapes_in_string(text_stream *p) {
@ Note that all other ampersand-escapes are passed through verbatim.
@<We have identified an XML escape@> =
wchar_t c = 0;
if (Str::eq_wide_string(xml_escape, L"&lt;")) c = '<';
if (Str::eq_wide_string(xml_escape, L"&gt;")) c = '>';
if (Str::eq_wide_string(xml_escape, L"&amp;")) c = '&';
if (Str::eq_wide_string(xml_escape, L"&apos;")) c = '\'';
if (Str::eq_wide_string(xml_escape, L"&quot;")) c = '\"';
inchar32_t c = 0;
if (Str::eq_wide_string(xml_escape, U"&lt;")) c = '<';
if (Str::eq_wide_string(xml_escape, U"&gt;")) c = '>';
if (Str::eq_wide_string(xml_escape, U"&amp;")) c = '&';
if (Str::eq_wide_string(xml_escape, U"&apos;")) c = '\'';
if (Str::eq_wide_string(xml_escape, U"&quot;")) c = '\"';
if (c) { Str::put_at(p, j++, c); i += Str::len(xml_escape); continue; }
@h Step 2: identify the relevant lines.

View file

@ -258,14 +258,14 @@ void Websites::copy_html_line(text_stream *line, text_file_position *tfp, void *
void Websites::copy_html_line_r(text_stream *line, text_file_position *tfp, void *state) {
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, line, L"(%c*?)%[(%c*?)%](%c*)")) {
if (Regexp::match(&mr, line, U"(%c*?)%[(%c*?)%](%c*)")) {
Websites::copy_html_line_r(mr.exp[0], tfp, state);
Placeholders::write(COPYTO, mr.exp[1]);
Websites::copy_html_line_r(mr.exp[2], tfp, state);
Regexp::dispose_of(&mr);
return;
}
if (Regexp::match(&mr, line, L"(%c*?)</head>(%c*)")) {
if (Regexp::match(&mr, line, U"(%c*?)</head>(%c*)")) {
Websites::copy_html_line_r(mr.exp[0], tfp, state);
Placeholders::write(COPYTO, I"INTERPRETERSCRIPTS");
WRITE_TO(COPYTO, "</head>");
@ -383,20 +383,20 @@ unfairly called "dull"). We set |lv| accordingly.
@<Look at the first word on the line to find the level of our interest@> =
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, line, L" *")) lv = EMPTY_LEVEL;
else if (Regexp::match(&mr, line, L" *(%C+)%c*?")) {
if (Str::eq_wide_string(mr.exp[0], L"table")) lv = TABLE_LEVEL;
if (Regexp::match(&mr, line, U" *")) lv = EMPTY_LEVEL;
else if (Regexp::match(&mr, line, U" *(%C+)%c*?")) {
if (Str::eq_wide_string(mr.exp[0], U"table")) lv = TABLE_LEVEL;
if (lc > position_of_documentation_bar) {
if (Str::eq_wide_string(mr.exp[0], L"chapter:")) lv = DOC_CHAPTER_LEVEL;
if (Str::eq_wide_string(mr.exp[0], L"section:")) lv = DOC_SECTION_LEVEL;
if (Str::eq_wide_string(mr.exp[0], L"example:")) lv = EXAMPLE_LEVEL;
if (Str::eq_wide_string(mr.exp[0], U"chapter:")) lv = DOC_CHAPTER_LEVEL;
if (Str::eq_wide_string(mr.exp[0], U"section:")) lv = DOC_SECTION_LEVEL;
if (Str::eq_wide_string(mr.exp[0], U"example:")) lv = EXAMPLE_LEVEL;
} else {
if (Str::eq_wide_string(mr.exp[0], L"volume")) lv = 1;
if (Str::eq_wide_string(mr.exp[0], L"book")) lv = 2;
if (Str::eq_wide_string(mr.exp[0], L"part")) lv = 3;
if (Str::eq_wide_string(mr.exp[0], L"chapter")) lv = 4;
if (Str::eq_wide_string(mr.exp[0], L"section")) lv = 5;
if (Regexp::match(&mr, line, L" *---- documentation ---- *")) lv = DOC_LEVEL;
if (Str::eq_wide_string(mr.exp[0], U"volume")) lv = 1;
if (Str::eq_wide_string(mr.exp[0], U"book")) lv = 2;
if (Str::eq_wide_string(mr.exp[0], U"part")) lv = 3;
if (Str::eq_wide_string(mr.exp[0], U"chapter")) lv = 4;
if (Str::eq_wide_string(mr.exp[0], U"section")) lv = 5;
if (Regexp::match(&mr, line, U" *---- documentation ---- *")) lv = DOC_LEVEL;
}
}
Regexp::dispose_of(&mr);

View file

@ -349,7 +349,7 @@ inbuild_copy *Main::file_or_path_to_copy(text_stream *arg, int throwing_error) {
TEMPORARY_TEXT(ext)
int pos = Str::len(arg) - 1, dotpos = -1;
while (pos >= 0) {
wchar_t c = Str::get_at(arg, pos);
inchar32_t c = Str::get_at(arg, pos);
if (Platform::is_folder_separator(c)) break;
if (c == '.') dotpos = pos;
pos--;
@ -448,98 +448,98 @@ other options to the selection defined here.
@<Read the command line@> =
CommandLine::declare_heading(
L"[[Purpose]]\n\n"
L"usage: inbuild [-TASK] TARGET1 TARGET2 ...\n");
CommandLine::declare_switch(COPY_TO_CLSW, L"copy-to", 2,
L"copy target(s) to nest X");
CommandLine::declare_switch(SYNC_TO_CLSW, L"sync-to", 2,
L"forcibly copy target(s) to nest X, even if prior version already there");
CommandLine::declare_boolean_switch(VERSIONS_IN_FILENAMES_CLSW, L"versions-in-filenames", 1,
L"append _v number to destination filenames on -copy-to or -sync-to", TRUE);
CommandLine::declare_switch(BUILD_CLSW, L"build", 1,
L"incrementally build target(s)");
CommandLine::declare_switch(REBUILD_CLSW, L"rebuild", 1,
L"completely rebuild target(s)");
CommandLine::declare_switch(INSPECT_CLSW, L"inspect", 1,
L"show target(s) but take no action");
CommandLine::declare_switch(INSTALL_CLSW, L"install", 1,
L"install extension within the Inform GUI apps");
CommandLine::declare_switch(UNINSTALL_CLSW, L"uninstall", 1,
L"remove extension within the Inform GUI apps");
CommandLine::declare_switch(GRAPH_CLSW, L"graph", 1,
L"show dependency graph of target(s) but take no action");
CommandLine::declare_switch(USE_NEEDS_CLSW, L"use-needs", 1,
L"show all the extensions, kits and so on needed to use");
CommandLine::declare_switch(BUILD_NEEDS_CLSW, L"build-needs", 1,
L"show all the extensions, kits and so on needed to build");
CommandLine::declare_switch(USE_LOCATE_CLSW, L"use-locate", 1,
L"show file paths of all the extensions, kits and so on needed to use");
CommandLine::declare_switch(BUILD_LOCATE_CLSW, L"build-locate", 1,
L"show file paths of all the extensions, kits and so on needed to build");
CommandLine::declare_switch(USE_MISSING_CLSW, L"use-missing", 1,
L"show the extensions, kits and so on which are needed to use but missing");
CommandLine::declare_switch(BUILD_MISSING_CLSW, L"build-missing", 1,
L"show the extensions, kits and so on which are needed to build but missing");
CommandLine::declare_switch(ARCHIVE_CLSW, L"archive", 1,
L"sync copies of all extensions, kits and so on needed for -project into Materials");
CommandLine::declare_switch(ARCHIVE_TO_CLSW, L"archive-to", 2,
L"sync copies of all extensions, kits and so on needed into nest X");
CommandLine::declare_switch(TOOLS_CLSW, L"tools", 2,
L"make X the directory of intools executables");
CommandLine::declare_boolean_switch(DRY_CLSW, L"dry", 1,
L"make this a dry run (print but do not execute shell commands)", FALSE);
CommandLine::declare_boolean_switch(BUILD_TRACE_CLSW, L"build-trace", 1,
L"show verbose reasoning during -build", FALSE);
CommandLine::declare_switch(MATCHING_CLSW, L"matching", 2,
L"apply to all works in nest(s) matching requirement X");
CommandLine::declare_switch(CONTENTS_OF_CLSW, L"contents-of", 2,
L"apply to all targets in the directory X");
CommandLine::declare_boolean_switch(RECURSIVE_CLSW, L"recursive", 1,
L"run -contents-of recursively to look through subdirectories too", FALSE);
CommandLine::declare_switch(VERIFY_REGISTRY_CLSW, L"verify-registry", 2,
L"verify roster.json metadata of registry in the directory X");
CommandLine::declare_switch(BUILD_REGISTRY_CLSW, L"build-registry", 2,
L"construct HTML menu pages for registry in the directory X");
CommandLine::declare_switch(PREPROCESS_HTML_CLSW, L"preprocess-html", 2,
L"construct HTML page based on X");
CommandLine::declare_switch(PREPROCESS_HTML_TO_CLSW, L"preprocess-html-to", 2,
L"set destination for -preprocess-html to be X");
CommandLine::declare_switch(PREPROCESS_APP_CLSW, L"preprocess-app", 2,
L"use CSS suitable for app platform X (macos, windows, linux)");
CommandLine::declare_boolean_switch(REPAIR_CLSW, L"repair", 1,
L"quietly fix missing or incorrect extension metadata", TRUE);
CommandLine::declare_switch(RESULTS_CLSW, L"results", 2,
L"write HTML report file to X (for use within Inform GUI apps)");
CommandLine::declare_boolean_switch(CONFIRMED_CLSW, L"confirmed", 1,
L"confirm installation in the Inform GUI apps", TRUE);
CommandLine::declare_boolean_switch(VERBOSE_CLSW, L"verbose", 1,
L"equivalent to -verbosity=1", FALSE);
CommandLine::declare_numerical_switch(VERBOSITY_CLSW, L"verbosity", 1,
L"how much explanation to print: lowest is 0 (default), highest is 3");
CommandLine::declare_switch(JSON_CLSW, L"json", 2,
L"write output of -inspect to a JSON file in X (or '-' for stdout)");
CommandLine::declare_switch(DOCUMENT_CLSW, L"document", 1,
L"(re-)generate documentation on this within current project");
CommandLine::declare_switch(DOCUMENT_FROM_CLSW, L"document-from", 2,
L"generate documentation from documentation source file X");
CommandLine::declare_switch(DOCUMENT_TO_CLSW, L"document-to", 2,
L"divert generated documentation to directory X");
CommandLine::declare_switch(MODERNISE_CLSW, L"modernise", 1,
L"update copies to the newest available format");
U"[[Purpose]]\n\n"
U"usage: inbuild [-TASK] TARGET1 TARGET2 ...\n");
CommandLine::declare_switch(COPY_TO_CLSW, U"copy-to", 2,
U"copy target(s) to nest X");
CommandLine::declare_switch(SYNC_TO_CLSW, U"sync-to", 2,
U"forcibly copy target(s) to nest X, even if prior version already there");
CommandLine::declare_boolean_switch(VERSIONS_IN_FILENAMES_CLSW, U"versions-in-filenames", 1,
U"append _v number to destination filenames on -copy-to or -sync-to", TRUE);
CommandLine::declare_switch(BUILD_CLSW, U"build", 1,
U"incrementally build target(s)");
CommandLine::declare_switch(REBUILD_CLSW, U"rebuild", 1,
U"completely rebuild target(s)");
CommandLine::declare_switch(INSPECT_CLSW, U"inspect", 1,
U"show target(s) but take no action");
CommandLine::declare_switch(INSTALL_CLSW, U"install", 1,
U"install extension within the Inform GUI apps");
CommandLine::declare_switch(UNINSTALL_CLSW, U"uninstall", 1,
U"remove extension within the Inform GUI apps");
CommandLine::declare_switch(GRAPH_CLSW, U"graph", 1,
U"show dependency graph of target(s) but take no action");
CommandLine::declare_switch(USE_NEEDS_CLSW, U"use-needs", 1,
U"show all the extensions, kits and so on needed to use");
CommandLine::declare_switch(BUILD_NEEDS_CLSW, U"build-needs", 1,
U"show all the extensions, kits and so on needed to build");
CommandLine::declare_switch(USE_LOCATE_CLSW, U"use-locate", 1,
U"show file paths of all the extensions, kits and so on needed to use");
CommandLine::declare_switch(BUILD_LOCATE_CLSW, U"build-locate", 1,
U"show file paths of all the extensions, kits and so on needed to build");
CommandLine::declare_switch(USE_MISSING_CLSW, U"use-missing", 1,
U"show the extensions, kits and so on which are needed to use but missing");
CommandLine::declare_switch(BUILD_MISSING_CLSW, U"build-missing", 1,
U"show the extensions, kits and so on which are needed to build but missing");
CommandLine::declare_switch(ARCHIVE_CLSW, U"archive", 1,
U"sync copies of all extensions, kits and so on needed for -project into Materials");
CommandLine::declare_switch(ARCHIVE_TO_CLSW, U"archive-to", 2,
U"sync copies of all extensions, kits and so on needed into nest X");
CommandLine::declare_switch(TOOLS_CLSW, U"tools", 2,
U"make X the directory of intools executables");
CommandLine::declare_boolean_switch(DRY_CLSW, U"dry", 1,
U"make this a dry run (print but do not execute shell commands)", FALSE);
CommandLine::declare_boolean_switch(BUILD_TRACE_CLSW, U"build-trace", 1,
U"show verbose reasoning during -build", FALSE);
CommandLine::declare_switch(MATCHING_CLSW, U"matching", 2,
U"apply to all works in nest(s) matching requirement X");
CommandLine::declare_switch(CONTENTS_OF_CLSW, U"contents-of", 2,
U"apply to all targets in the directory X");
CommandLine::declare_boolean_switch(RECURSIVE_CLSW, U"recursive", 1,
U"run -contents-of recursively to look through subdirectories too", FALSE);
CommandLine::declare_switch(VERIFY_REGISTRY_CLSW, U"verify-registry", 2,
U"verify roster.json metadata of registry in the directory X");
CommandLine::declare_switch(BUILD_REGISTRY_CLSW, U"build-registry", 2,
U"construct HTML menu pages for registry in the directory X");
CommandLine::declare_switch(PREPROCESS_HTML_CLSW, U"preprocess-html", 2,
U"construct HTML page based on X");
CommandLine::declare_switch(PREPROCESS_HTML_TO_CLSW, U"preprocess-html-to", 2,
U"set destination for -preprocess-html to be X");
CommandLine::declare_switch(PREPROCESS_APP_CLSW, U"preprocess-app", 2,
U"use CSS suitable for app platform X (macos, windows, linux)");
CommandLine::declare_boolean_switch(REPAIR_CLSW, U"repair", 1,
U"quietly fix missing or incorrect extension metadata", TRUE);
CommandLine::declare_switch(RESULTS_CLSW, U"results", 2,
U"write HTML report file to X (for use within Inform GUI apps)");
CommandLine::declare_boolean_switch(CONFIRMED_CLSW, U"confirmed", 1,
U"confirm installation in the Inform GUI apps", TRUE);
CommandLine::declare_boolean_switch(VERBOSE_CLSW, U"verbose", 1,
U"equivalent to -verbosity=1", FALSE);
CommandLine::declare_numerical_switch(VERBOSITY_CLSW, U"verbosity", 1,
U"how much explanation to print: lowest is 0 (default), highest is 3");
CommandLine::declare_switch(JSON_CLSW, U"json", 2,
U"write output of -inspect to a JSON file in X (or '-' for stdout)");
CommandLine::declare_switch(DOCUMENT_CLSW, U"document", 1,
U"(re-)generate documentation on this within current project");
CommandLine::declare_switch(DOCUMENT_FROM_CLSW, U"document-from", 2,
U"generate documentation from documentation source file X");
CommandLine::declare_switch(DOCUMENT_TO_CLSW, U"document-to", 2,
U"divert generated documentation to directory X");
CommandLine::declare_switch(MODERNISE_CLSW, U"modernise", 1,
U"update copies to the newest available format");
CommandLine::begin_group(MARKDOWN_SUITE_CLSG, I"for generating HTML from Markdown");
CommandLine::declare_switch(MARKDOWN_FROM_CLSW, L"markdown-from", 2,
L"generate HTML file from Markdown source file X");
CommandLine::declare_switch(MARKDOWN_TO_CLSW, L"markdown-to", 2,
L"set filename for single Markdown-generated HTML file to be X");
CommandLine::declare_switch(MARKDOWN_FROM_DIR_CLSW, L"markdown-from-dir", 2,
L"generate HTML files from all Markdown sources in X");
CommandLine::declare_switch(MARKDOWN_TO_DIR_CLSW, L"markdown-to-dir", 2,
L"generate HTML files from Markdown sources into X");
CommandLine::declare_switch(MARKDOWN_MODEL_CLSW, L"markdown-model", 2,
L"use this model file when generating HTML from Markdown ('none' for none)");
CommandLine::declare_switch(MARKDOWN_VARIATION_CLSW, L"markdown-variation", 2,
L"use dialect X of Markdown: 'CommonMark', 'GitHub', 'Inform', 'RTP'");
CommandLine::declare_switch(MARKDOWN_FROM_CLSW, U"markdown-from", 2,
U"generate HTML file from Markdown source file X");
CommandLine::declare_switch(MARKDOWN_TO_CLSW, U"markdown-to", 2,
U"set filename for single Markdown-generated HTML file to be X");
CommandLine::declare_switch(MARKDOWN_FROM_DIR_CLSW, U"markdown-from-dir", 2,
U"generate HTML files from all Markdown sources in X");
CommandLine::declare_switch(MARKDOWN_TO_DIR_CLSW, U"markdown-to-dir", 2,
U"generate HTML files from Markdown sources into X");
CommandLine::declare_switch(MARKDOWN_MODEL_CLSW, U"markdown-model", 2,
U"use this model file when generating HTML from Markdown ('none' for none)");
CommandLine::declare_switch(MARKDOWN_VARIATION_CLSW, U"markdown-variation", 2,
U"use dialect X of Markdown: 'CommonMark', 'GitHub', 'Inform', 'RTP'");
CommandLine::end_group();
Supervisor::declare_options();

View file

@ -143,26 +143,26 @@ better way to choose a virtual machine to compile to.
@<Declare Inform-related options@> =
CommandLine::begin_group(INBUILD_INFORM_CLSG, I"for translating Inform source text to Inter");
CommandLine::declare_switch(PROJECT_CLSW, L"project", 2,
L"work within the Inform project X");
CommandLine::declare_switch(BASIC_CLSW, L"basic", 1,
L"use Basic Inform language");
CommandLine::declare_boolean_switch(DEBUG_CLSW, L"debug", 1,
L"compile with debugging features even on a Release", FALSE);
CommandLine::declare_boolean_switch(RELEASE_CLSW, L"release", 1,
L"compile a version suitable for a Release build", FALSE);
CommandLine::declare_textual_switch(FORMAT_CLSW, L"format", 1,
L"compile to the format X (default is Inform6/32)");
CommandLine::declare_switch(SOURCE_CLSW, L"source", 2,
L"use file X as the Inform source text");
CommandLine::declare_switch(O_CLSW, L"o", 2,
L"use file X as the compiled output (not for use with -project)");
CommandLine::declare_boolean_switch(CENSUS_CLSW, L"census", 1,
L"withdrawn: previously, 'perform an extensions census'", FALSE);
CommandLine::declare_boolean_switch(RNG_CLSW, L"rng", 1,
L"fix the random number generator of the story file (for testing)", FALSE);
CommandLine::declare_switch(CASE_CLSW, L"case", 2,
L"make any source links refer to the source in extension example X");
CommandLine::declare_switch(PROJECT_CLSW, U"project", 2,
U"work within the Inform project X");
CommandLine::declare_switch(BASIC_CLSW, U"basic", 1,
U"use Basic Inform language");
CommandLine::declare_boolean_switch(DEBUG_CLSW, U"debug", 1,
U"compile with debugging features even on a Release", FALSE);
CommandLine::declare_boolean_switch(RELEASE_CLSW, U"release", 1,
U"compile a version suitable for a Release build", FALSE);
CommandLine::declare_textual_switch(FORMAT_CLSW, U"format", 1,
U"compile to the format X (default is Inform6/32)");
CommandLine::declare_switch(SOURCE_CLSW, U"source", 2,
U"use file X as the Inform source text");
CommandLine::declare_switch(O_CLSW, U"o", 2,
U"use file X as the compiled output (not for use with -project)");
CommandLine::declare_boolean_switch(CENSUS_CLSW, U"census", 1,
U"withdrawn: previously, 'perform an extensions census'", FALSE);
CommandLine::declare_boolean_switch(RNG_CLSW, U"rng", 1,
U"fix the random number generator of the story file (for testing)", FALSE);
CommandLine::declare_switch(CASE_CLSW, U"case", 2,
U"make any source links refer to the source in extension example X");
CommandLine::end_group();
@ Again, except for |-nest|, these go back to the mid-2010s.
@ -177,16 +177,16 @@ better way to choose a virtual machine to compile to.
@<Declare resource-related options@> =
CommandLine::begin_group(INBUILD_RESOURCES_CLSG, I"for locating resources in the file system");
CommandLine::declare_switch(NEST_CLSW, L"nest", 2,
L"add the nest at pathname X to the search list");
CommandLine::declare_switch(INTERNAL_CLSW, L"internal", 2,
L"use X as the location of built-in material such as the Standard Rules");
CommandLine::declare_switch(EXTERNAL_CLSW, L"external", 2,
L"use X as the user's home for installed material such as extensions");
CommandLine::declare_switch(DEPRECATED_EXTERNAL_CLSW, L"deprecated-external", 2,
L"same as -external X, but issues warnings if the nest is actually used");
CommandLine::declare_switch(TRANSIENT_CLSW, L"transient", 2,
L"(an option now withdrawn)");
CommandLine::declare_switch(NEST_CLSW, U"nest", 2,
U"add the nest at pathname X to the search list");
CommandLine::declare_switch(INTERNAL_CLSW, U"internal", 2,
U"use X as the location of built-in material such as the Standard Rules");
CommandLine::declare_switch(EXTERNAL_CLSW, U"external", 2,
U"use X as the user's home for installed material such as extensions");
CommandLine::declare_switch(DEPRECATED_EXTERNAL_CLSW, U"deprecated-external", 2,
U"same as -external X, but issues warnings if the nest is actually used");
CommandLine::declare_switch(TRANSIENT_CLSW, U"transient", 2,
U"(an option now withdrawn)");
CommandLine::end_group();
@ These are all new in 2020. They are not formally shared with the |inter| tool,
@ -201,14 +201,14 @@ but |-pipeline-file| and |-variable| have the same effect as they would there.
@<Declare Inter-related options@> =
CommandLine::begin_group(INBUILD_INTER_CLSG, I"for tweaking code generation from Inter");
CommandLine::declare_switch(KIT_CLSW, L"kit", 2,
L"(an option now withdrawn)");
CommandLine::declare_switch(PIPELINE_CLSW, L"pipeline", 2,
L"specify code-generation pipeline by name (default is \"compile\")");
CommandLine::declare_switch(PIPELINE_FILE_CLSW, L"pipeline-file", 2,
L"specify code-generation pipeline as file X");
CommandLine::declare_switch(PIPELINE_VARIABLE_CLSW, L"variable", 2,
L"set pipeline variable X (in form name=value)");
CommandLine::declare_switch(KIT_CLSW, U"kit", 2,
U"(an option now withdrawn)");
CommandLine::declare_switch(PIPELINE_CLSW, U"pipeline", 2,
U"specify code-generation pipeline by name (default is \"compile\")");
CommandLine::declare_switch(PIPELINE_FILE_CLSW, U"pipeline-file", 2,
U"specify code-generation pipeline as file X");
CommandLine::declare_switch(PIPELINE_VARIABLE_CLSW, U"variable", 2,
U"set pipeline variable X (in form name=value)");
CommandLine::end_group();
@ Use of the above options will cause the following global variables to be
@ -310,7 +310,7 @@ of the parent. In practice, that will be true for |inform7| but not |inbuild|.
@<Set a pipeline variable@> =
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, arg, L"(%c+)=(%c+)")) {
if (Regexp::match(&mr, arg, U"(%c+)=(%c+)")) {
if (Str::get_first_char(arg) != '*') {
Errors::fatal("-variable names must begin with '*'");
} else {

View file

@ -102,8 +102,8 @@ void SupervisorModule::start(void) {
Memory::reason_name(RESULTS_SORTING_MREASON, "results sorting");
Writers::register_writer('X', &Works::writer);
Writers::register_writer('J', &Languages::log);
Log::declare_aspect(EXTENSIONS_CENSUS_DA, L"extensions census", FALSE, FALSE);
Log::declare_aspect(HEADINGS_DA, L"headings", FALSE, FALSE);
Log::declare_aspect(EXTENSIONS_CENSUS_DA, U"extensions census", FALSE, FALSE);
Log::declare_aspect(HEADINGS_DA, U"headings", FALSE, FALSE);
Supervisor::start();
@<Declare the tree annotations@>;
}

View file

@ -41,7 +41,7 @@ typedef struct copy_error {
struct parse_node *details_node2;
struct inbuild_work *details_work;
struct inbuild_work *details_work2;
wchar_t *details_word;
inchar32_t *details_word;
CLASS_DEFINITION
} copy_error;
@ -84,7 +84,7 @@ copy_error *CopyErrors::new_F(int cat, int subcat, filename *F) {
return CE;
}
copy_error *CopyErrors::new_WT(int cat, int subcat, wchar_t *details_word, text_stream *NB) {
copy_error *CopyErrors::new_WT(int cat, int subcat, inchar32_t *details_word, text_stream *NB) {
copy_error *CE = CopyErrors::new(cat, subcat);
CE->details_word = details_word;
CE->details = Str::duplicate(NB);

View file

@ -518,7 +518,7 @@ as is necessary in JavaScript string literals.
void Registries::write_escaped(OUTPUT_STREAM, text_stream *text, text_stream *escape) {
if (Str::eq(escape, I"quotes")) {
LOOP_THROUGH_TEXT(pos, text) {
wchar_t c = Str::get(pos);
inchar32_t c = Str::get(pos);
if (c == '\'') {
PUT('\\');
PUT('\'');
@ -528,7 +528,7 @@ void Registries::write_escaped(OUTPUT_STREAM, text_stream *text, text_stream *es
}
} else if (Str::eq(escape, I"spaces")) {
LOOP_THROUGH_TEXT(pos, text) {
wchar_t c = Str::get(pos);
inchar32_t c = Str::get(pos);
if (c == ' ') {
WRITE("%%20");
} else {
@ -537,7 +537,7 @@ void Registries::write_escaped(OUTPUT_STREAM, text_stream *text, text_stream *es
}
} else if (Str::eq(escape, I"both")) {
LOOP_THROUGH_TEXT(pos, text) {
wchar_t c = Str::get(pos);
inchar32_t c = Str::get(pos);
if (c == '\'') {
PUT('\\');
PUT('\'');

View file

@ -55,7 +55,7 @@ inbuild_requirement *Requirements::from_text(text_stream *T,
inbuild_requirement *req = Requirements::anything();
int from = 0;
for (int at = 0; at < Str::len(T); at++) {
wchar_t c = Str::get_at(T, at);
inchar32_t c = Str::get_at(T, at);
if (c == ',') {
TEMPORARY_TEXT(initial)
Str::substr(initial, Str::at(T, from), Str::at(T, at));
@ -84,7 +84,7 @@ void Requirements::impose_clause(inbuild_requirement *req, text_stream *T,
TEMPORARY_TEXT(term)
TEMPORARY_TEXT(value)
for (int at = 0; at < Str::len(T); at++) {
wchar_t c = Str::get_at(T, at);
inchar32_t c = Str::get_at(T, at);
if (c == '=') {
Str::substr(term, Str::start(T), Str::at(T, at));
Str::substr(value, Str::at(T, at+1), Str::end(T));

View file

@ -88,7 +88,7 @@ begins at the start of the text, after a hyphen, or after a bracket. Thus
void Works::normalise_casing(text_stream *p) {
int boundary = TRUE;
LOOP_THROUGH_TEXT(pos, p) {
wchar_t c = Str::get(pos);
inchar32_t c = Str::get(pos);
if (boundary) Str::put(pos, Characters::toupper(c));
else Str::put(pos, Characters::tolower(c));
boundary = FALSE;
@ -107,7 +107,7 @@ would both pass, whereas //Works::normalise_casing// would make them into
void Works::normalise_casing_mixed(text_stream *p) {
int boundary = TRUE;
LOOP_THROUGH_TEXT(pos, p) {
wchar_t c = Str::get(pos);
inchar32_t c = Str::get(pos);
if (boundary) Str::put(pos, Characters::toupper(c));
boundary = FALSE;
if (c == ' ') boundary = TRUE;
@ -246,7 +246,7 @@ void Works::begin_extension_link(OUTPUT_STREAM, inbuild_work *work, text_stream
void Works::escape_apostrophes(OUTPUT_STREAM, text_stream *S) {
LOOP_THROUGH_TEXT(pos, S) {
wchar_t c = Str::get(pos);
inchar32_t c = Str::get(pos);
if ((c == '\'') || (c == '\"') || (c == ' ') || (c == '&') ||
(c == '<') || (c == '>') || (c == '%'))
WRITE("%%%x", (int) c);

View file

@ -138,7 +138,7 @@ void ExtensionBundleManager::dismantle_name(text_stream *name,
TEMPORARY_TEXT(title)
int pos = Str::len(name) - 1, dotpos = -1;
while (pos >= 0) {
wchar_t c = Str::get_at(name, pos);
inchar32_t c = Str::get_at(name, pos);
if (Platform::is_folder_separator(c)) break;
if (c == '.') dotpos = pos;
pos--;
@ -151,7 +151,7 @@ void ExtensionBundleManager::dismantle_name(text_stream *name,
}
semantic_version_number V = VersionNumbers::null();
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, title, L"(%c+)-v([0-9_]+)")) {
if (Regexp::match(&mr, title, U"(%c+)-v([0-9_]+)")) {
Str::clear(title);
WRITE_TO(title, "%S", mr.exp[0]);
LOOP_THROUGH_TEXT(pos, mr.exp[1])

View file

@ -80,7 +80,7 @@ void LanguageManager::claim_as_copy(inbuild_genre *gen, inbuild_copy **C,
text_stream *name = Pathnames::directory_name(P);
int acceptable = TRUE;
LOOP_THROUGH_TEXT(pos, name) {
wchar_t c = Str::get(pos);
inchar32_t c = Str::get(pos);
if ((c < 32) || (c > 126)) acceptable = FALSE; /* contains non-ASCII */
if (Platform::is_folder_separator(c)) { Str::put(pos, 0); break; }
}

View file

@ -173,7 +173,7 @@ by the local |\n| for good measure.
if (c == ']') commented_out = FALSE;
} else if (quoted) {
if (c == '"') quoted = FALSE;
PUT_TO(titling_line, c);
PUT_TO(titling_line, (inchar32_t) c);
} else {
if (c == '[') commented_out = TRUE;
else {
@ -181,10 +181,10 @@ by the local |\n| for good measure.
else if ((c == '\x0a') || (c == '\x0d') || (c == '\n')) {
if (content_found) break;
c = ' ';
} else if (Characters::is_whitespace(c) == FALSE) {
} else if (Characters::is_whitespace((inchar32_t) c) == FALSE) {
content_found = TRUE;
}
PUT_TO(titling_line, c);
PUT_TO(titling_line, (inchar32_t) c);
}
}
}
@ -213,7 +213,7 @@ thing we read here is a meaningless |0D|.
else break;
} else {
if (c == '"') break;
if (found_start) PUT_TO(E->rubric_as_lexed, c);
if (found_start) PUT_TO(E->rubric_as_lexed, (inchar32_t) c);
}
}
@ -229,19 +229,19 @@ load the entire file.
@<Parse the version, title, author and VM requirements from the titling line@> =
match_results mr = Regexp::create_mr();
if (Str::get_last_char(titling_line) == '.') Str::delete_last_character(titling_line);
if ((Regexp::match(&mr, titling_line, L"(%c*) Begin Here")) ||
(Regexp::match(&mr, titling_line, L"(%c*) Begins Here"))) {
if ((Regexp::match(&mr, titling_line, U"(%c*) Begin Here")) ||
(Regexp::match(&mr, titling_line, U"(%c*) Begins Here"))) {
Str::copy(titling_line, mr.exp[0]);
} else {
if ((Regexp::match(&mr, titling_line, L"(%c*) Start Here")) ||
(Regexp::match(&mr, titling_line, L"(%c*) Starts Here"))) {
if ((Regexp::match(&mr, titling_line, U"(%c*) Start Here")) ||
(Regexp::match(&mr, titling_line, U"(%c*) Starts Here"))) {
Str::copy(titling_line, mr.exp[0]);
}
Copies::attach_error(C, CopyErrors::new_T(EXT_MISWORDED_CE, -1,
I"the opening line does not end 'begin(s) here'"));
}
@<Scan the version text, if any, and advance to the position past Version... Of@>;
if (Regexp::match(&mr, titling_line, L"The (%c*)")) Str::copy(titling_line, mr.exp[0]);
if (Regexp::match(&mr, titling_line, U"The (%c*)")) Str::copy(titling_line, mr.exp[0]);
@<Divide the remaining text into a claimed author name and title, divided by By@>;
@<Extract the VM requirements text, if any, from the claimed title@>;
Regexp::dispose_of(&mr);
@ -252,7 +252,7 @@ other files, not to syntax-check all extensions to see if they would work
if used.
@<Scan the version text, if any, and advance to the position past Version... Of@> =
if (Regexp::match(&mr, titling_line, L"Version (%c*?) Of (%c*)")) {
if (Regexp::match(&mr, titling_line, U"Version (%c*?) Of (%c*)")) {
Str::copy(version_text, mr.exp[0]);
Str::copy(titling_line, mr.exp[1]);
}
@ -265,7 +265,7 @@ not a situation we need to contend with.
int quote_found = FALSE, brackets_underflowed = FALSE, brackets_in_author = FALSE;
int which = 1, bl = 0;
for (int i=0; i<Str::len(titling_line); i++) {
wchar_t c = Str::get_at(titling_line, i);
inchar32_t c = Str::get_at(titling_line, i);
if (c == '(') { bl++; if (which == 2) brackets_in_author = TRUE; }
if (c == ')') { bl--; if (bl < 0) brackets_underflowed = TRUE; }
if (c == '\"') quote_found = TRUE;
@ -298,7 +298,7 @@ not a situation we need to contend with.
this is unambiguous.
@<Extract the VM requirements text, if any, from the claimed title@> =
if (Regexp::match(&mr, claimed_title, L"(%c*?) *(%(%c*%))")) {
if (Regexp::match(&mr, claimed_title, U"(%c*?) *(%(%c*%))")) {
Str::copy(claimed_title, mr.exp[0]);
Str::copy(reqs, mr.exp[1]);
}
@ -801,7 +801,7 @@ range, we flatten them from general ISO to plain ASCII.
E->as_copy->edition->work->author_name);
LOOP_THROUGH_TEXT(pos, synopsis)
Str::put(pos,
Characters::make_wchar_t_filename_safe(
Characters::make_filename_safe(
Str::get(pos)));
@ Note that if there is an active project, then we are reading the extension

View file

@ -368,13 +368,13 @@ out I6T template files tidily.
@<Read rest of line as argument@> =
Str::clear(argument);
if (Characters::is_space_or_tab(cr) == FALSE) PUT_TO(argument, cr);
if (Characters::is_space_or_tab((inchar32_t) cr) == FALSE) PUT_TO(argument, (inchar32_t) cr);
int at_start = TRUE;
while (TRUE) {
@<Read next character from I6T stream@>;
if ((cr == 10) || (cr == 13) || (cr == EOF)) break;
if ((at_start) && (Characters::is_space_or_tab(cr))) continue;
PUT_TO(argument, cr); at_start = FALSE;
if ((at_start) && (Characters::is_space_or_tab((inchar32_t) cr))) continue;
PUT_TO(argument, (inchar32_t) cr); at_start = FALSE;
}
while (Characters::is_space_or_tab(Str::get_last_char(argument)))
Str::delete_last_character(argument);

View file

@ -200,11 +200,11 @@ inform_language *Languages::Preform_find(text_stream *name) {
inform_language *Languages::find_for(text_stream *name, linked_list *search) {
text_stream *author = NULL;
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, name, L"(%c+) [Ll]anguage by (%c+)")) {
if (Regexp::match(&mr, name, U"(%c+) [Ll]anguage by (%c+)")) {
name = mr.exp[0]; author = mr.exp[1];
} else if (Regexp::match(&mr, name, L"(%c+) by (%c+)")) {
} else if (Regexp::match(&mr, name, U"(%c+) by (%c+)")) {
name = mr.exp[0]; author = mr.exp[1];
} else if (Regexp::match(&mr, name, L"(%c+) [Ll]anguage")) {
} else if (Regexp::match(&mr, name, U"(%c+) [Ll]anguage")) {
name = mr.exp[0];
}
TEMPORARY_TEXT(title)

View file

@ -1070,7 +1070,7 @@ like Basic Inform or Standard Rules; and also any sentences in the
@<First an implied super-heading for implied inclusions and the Options@> =
inclusions_heading = Node::new(HEADING_NT);
Node::set_text(inclusions_heading,
Feeds::feed_C_string_expanding_strings(L"Implied inclusions"));
Feeds::feed_C_string_expanding_strings(U"Implied inclusions"));
SyntaxTree::graft_sentence(proj->syntax_tree, inclusions_heading);
Headings::place_implied_level_0(proj->syntax_tree, inclusions_heading, proj->as_copy);
@ -1126,7 +1126,7 @@ ready for those inventions (if in fact there are any).
int l = SyntaxTree::push_bud(proj->syntax_tree, proj->syntax_tree->root_node);
implicit_heading = Node::new(HEADING_NT);
Node::set_text(implicit_heading,
Feeds::feed_C_string_expanding_strings(L"Invented sentences"));
Feeds::feed_C_string_expanding_strings(U"Invented sentences"));
SyntaxTree::graft_sentence(proj->syntax_tree, implicit_heading);
Headings::place_implied_level_0(proj->syntax_tree, implicit_heading, proj->as_copy);
SyntaxTree::pop_bud(proj->syntax_tree, l);
@ -1200,27 +1200,27 @@ the whole thing goes into |bibliographic_sentence| and |bracketed| is empty.
if (c == ']') commented = FALSE;
} else {
if (quoted) {
if (rounded) PUT_TO(bracketed, c);
else PUT_TO(bibliographic_sentence, c);
if (rounded) PUT_TO(bracketed, (inchar32_t) c);
else PUT_TO(bibliographic_sentence, (inchar32_t) c);
if (c == '"') quoted = FALSE;
} else {
if (c == '[') commented = TRUE;
else {
if (Characters::is_whitespace(c) == FALSE) content_found = TRUE;
if (Characters::is_whitespace((inchar32_t) c) == FALSE) content_found = TRUE;
if (rounded) {
if (c == '"') quoted = TRUE;
if ((c == '\x0a') || (c == '\x0d') || (c == '\n')) c = ' ';
if (c == ')') rounded = FALSE;
else PUT_TO(bracketed, c);
else PUT_TO(bracketed, (inchar32_t) c);
} else {
if (c == '(') rounded = TRUE;
else {
if ((c == '\x0a') || (c == '\x0d') || (c == '\n')) {
if (content_found) break;
c = ' ';
PUT_TO(bibliographic_sentence, c);
PUT_TO(bibliographic_sentence, (inchar32_t) c);
} else {
PUT_TO(bibliographic_sentence, c);
PUT_TO(bibliographic_sentence, (inchar32_t) c);
}
if (c == '"') quoted = TRUE;
}
@ -1244,15 +1244,15 @@ But not always:
@<The opening sentence is bibliographic, so scan it@> =
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, bibliographic_sentence, L"\"([^\"]+)\" by \"([^\"]+)\"")) {
if (Regexp::match(&mr, bibliographic_sentence, U"\"([^\"]+)\" by \"([^\"]+)\"")) {
text_stream *title = mr.exp[0];
text_stream *author = mr.exp[1];
@<Set title and author@>;
} else if (Regexp::match(&mr, bibliographic_sentence, L"\"([^\"]+)\" by ([^\"]+)")) {
} else if (Regexp::match(&mr, bibliographic_sentence, U"\"([^\"]+)\" by ([^\"]+)")) {
text_stream *title = mr.exp[0];
text_stream *author = mr.exp[1];
@<Set title and author@>;
} else if (Regexp::match(&mr, bibliographic_sentence, L"\"([^\"]+)\"")) {
} else if (Regexp::match(&mr, bibliographic_sentence, U"\"([^\"]+)\"")) {
text_stream *title = mr.exp[0];
text_stream *author = NULL;
@<Set title and author@>;
@ -1263,7 +1263,7 @@ But not always:
if (Str::len(bracketed) > 0) {
int okay = TRUE;
match_results mr2 = Regexp::create_mr();
while (Regexp::match(&mr2, bracketed, L"(%c+?),(%c+)")) {
while (Regexp::match(&mr2, bracketed, U"(%c+?),(%c+)")) {
okay = (okay && (Projects::parse_language_clauses(proj, mr2.exp[0])));
bracketed = Str::duplicate(mr2.exp[1]);
}
@ -1296,15 +1296,15 @@ But not always:
int Projects::parse_language_clauses(inform_project *proj, text_stream *clause) {
int verdict = FALSE;
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, clause, L"(%c+?) in (%c+)")) {
if (Regexp::match(&mr, clause, U"(%c+?) in (%c+)")) {
text_stream *what = mr.exp[0];
text_stream *language_name = mr.exp[1];
verdict = Projects::parse_language_clause(proj, what, language_name);
} else if (Regexp::match(&mr, clause, L" *in (%c+)")) {
} else if (Regexp::match(&mr, clause, U" *in (%c+)")) {
text_stream *what = I"played";
text_stream *language_name = mr.exp[0];
verdict = Projects::parse_language_clause(proj, what, language_name);
} else if (Regexp::match(&mr, clause, L" *")) {
} else if (Regexp::match(&mr, clause, U" *")) {
verdict = TRUE;
}
Regexp::dispose_of(&mr);
@ -1314,19 +1314,19 @@ int Projects::parse_language_clauses(inform_project *proj, text_stream *clause)
int Projects::parse_language_clause(inform_project *proj, text_stream *what, text_stream *language_name) {
match_results mr = Regexp::create_mr();
int verdict = FALSE;
if (Regexp::match(&mr, what, L"(%c+?), and (%c+)")) {
if (Regexp::match(&mr, what, U"(%c+?), and (%c+)")) {
verdict = ((Projects::parse_language_clause(proj, mr.exp[0], language_name)) &&
(Projects::parse_language_clause(proj, mr.exp[1], language_name)));
} else if (Regexp::match(&mr, what, L"(%c+?), (%c+)")) {
} else if (Regexp::match(&mr, what, U"(%c+?), (%c+)")) {
verdict = ((Projects::parse_language_clause(proj, mr.exp[0], language_name)) &&
(Projects::parse_language_clause(proj, mr.exp[1], language_name)));
} else if (Regexp::match(&mr, what, L"(%c+?) and (%c+)")) {
} else if (Regexp::match(&mr, what, U"(%c+?) and (%c+)")) {
verdict = ((Projects::parse_language_clause(proj, mr.exp[0], language_name)) &&
(Projects::parse_language_clause(proj, mr.exp[1], language_name)));
} else {
if (Regexp::match(&mr, what, L" *written *")) @<Set language of syntax@>
else if (Regexp::match(&mr, what, L" *played *")) @<Set language of play@>
else if (Regexp::match(&mr, what, L" *indexed *")) @<Set language of index@>
if (Regexp::match(&mr, what, U" *written *")) @<Set language of syntax@>
else if (Regexp::match(&mr, what, U" *played *")) @<Set language of play@>
else if (Regexp::match(&mr, what, U" *indexed *")) @<Set language of index@>
}
Regexp::dispose_of(&mr);
return verdict;

View file

@ -17,7 +17,7 @@ typedef struct control_structure_phrase {
int is_a_loop;
int requires_new_syntax;
int allow_run_on;
wchar_t *keyword;
inchar32_t *keyword;
CLASS_DEFINITION
} control_structure_phrase;
@ -31,7 +31,7 @@ control_structure_phrase *ControlStructures::new(text_stream *mnemonic) {
csp->used_at_stage = -1;
csp->requires_new_syntax = FALSE;
csp->allow_run_on = FALSE;
csp->keyword = L"<none>";
csp->keyword = U"<none>";
csp->is_a_loop = FALSE;
return csp;
}
@ -61,17 +61,17 @@ void ControlStructures::create_standard(void) {
switch_CSP->body_empty_except_for_subordinates = TRUE;
switch_CSP->indent_subblocks = TRUE;
switch_CSP->requires_new_syntax = TRUE;
switch_CSP->keyword = L"if";
switch_CSP->keyword = U"if";
if_CSP = ControlStructures::new(I"IF");
if_CSP->keyword = L"if";
if_CSP->keyword = U"if";
repeat_CSP = ControlStructures::new(I"RPT");
repeat_CSP->keyword = L"repeat";
repeat_CSP->keyword = U"repeat";
repeat_CSP->is_a_loop = TRUE;
while_CSP = ControlStructures::new(I"WHI");
while_CSP->keyword = L"while";
while_CSP->keyword = U"while";
while_CSP->is_a_loop = TRUE;
otherwise_CSP = ControlStructures::new(I"O");
@ -185,9 +185,9 @@ int ControlStructures::permits_break(control_structure_phrase *csp) {
return FALSE;
}
wchar_t *ControlStructures::incipit(control_structure_phrase *csp) {
inchar32_t *ControlStructures::incipit(control_structure_phrase *csp) {
if (csp) return csp->keyword;
return L"<none>";
return U"<none>";
}
control_structure_phrase *ControlStructures::detect(wording W) {

View file

@ -693,7 +693,7 @@ void Headings::satisfy_individual_heading_dependency(inform_project *proj,
suppress_heading_dependencies_ANNOT) == FALSE) {
if (<quoted-text>(h->in_place_of_text)) {
Word::dequote(Wordings::first_wn(S));
wchar_t *text = Lexer::word_text(Wordings::first_wn(S));
inchar32_t *text = Lexer::word_text(Wordings::first_wn(S));
S = Feeds::feed_C_string(text);
}
if (loaded == FALSE) @<Can't replace heading in an unincluded extension@>

View file

@ -19,7 +19,7 @@ so we will simply store it in a global variable.
=
inbuild_copy *currently_lexing_into = NULL;
void SourceText::lexer_problem_handler(int err, text_stream *desc, wchar_t *word) {
void SourceText::lexer_problem_handler(int err, text_stream *desc, inchar32_t *word) {
if (err == MEMORY_OUT_LEXERERROR)
Errors::fatal("Out of memory: unable to create lexer workspace");
if (currently_lexing_into) {

View file

@ -314,35 +314,35 @@ void DocumentationCompiler::read_layout_helper(text_stream *cl, text_file_positi
void *v_cd) {
compiled_documentation *cd = (compiled_documentation *) v_cd;
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, cl, L" *#%c*")) { Regexp::dispose_of(&mr); return; }
if (Regexp::match(&mr, cl, L" *")) { Regexp::dispose_of(&mr); return; }
if (Regexp::match(&mr, cl, U" *#%c*")) { Regexp::dispose_of(&mr); return; }
if (Regexp::match(&mr, cl, U" *")) { Regexp::dispose_of(&mr); return; }
if (Regexp::match(&mr, cl, L" *examples: *(%c+?) to \"(%c*)\"")) {
if (Regexp::match(&mr, cl, U" *examples: *(%c+?) to \"(%c*)\"")) {
if (Str::eq(mr.exp[0], I"lettered")) cd->examples_lettered = TRUE;
else if (Str::eq(mr.exp[0], I"numbered")) cd->examples_lettered = FALSE;
else DocumentationCompiler::layout_error(cd, I"'examples:' must be 'lettered' or 'numbered'", cl, tfp);
cd->example_URL_pattern = Str::duplicate(mr.exp[1]);
} else if (Regexp::match(&mr, cl, L" *pages: *(%c*?) *")) {
} else if (Regexp::match(&mr, cl, U" *pages: *(%c*?) *")) {
@<Act on a page-set declaration@>;
} else if (Regexp::match(&mr, cl, L" *volume: *\"(%c*?)\" to \"(%c*?)\"")) {
} else if (Regexp::match(&mr, cl, U" *volume: *\"(%c*?)\" to \"(%c*?)\"")) {
@<Act on a volume declaration@>;
} else if (Regexp::match(&mr, cl, L" *alphabetical index: *\"(%c*?)\" to \"(%c*?)\" *")) {
} else if (Regexp::match(&mr, cl, U" *alphabetical index: *\"(%c*?)\" to \"(%c*?)\" *")) {
cd->index_title[ALPHABETICAL_EG_INDEX] = Str::duplicate(mr.exp[0]);
cd->index_URL_pattern[ALPHABETICAL_EG_INDEX] = Str::duplicate(mr.exp[1]);
cd->include_index[ALPHABETICAL_EG_INDEX] = TRUE;
} else if (Regexp::match(&mr, cl, L" *numerical index: *\"(%c*?)\" to \"(%c*?)\" *")) {
} else if (Regexp::match(&mr, cl, U" *numerical index: *\"(%c*?)\" to \"(%c*?)\" *")) {
cd->index_title[NUMERICAL_EG_INDEX] = Str::duplicate(mr.exp[0]);
cd->index_URL_pattern[NUMERICAL_EG_INDEX] = Str::duplicate(mr.exp[1]);
cd->include_index[NUMERICAL_EG_INDEX] = TRUE;
} else if (Regexp::match(&mr, cl, L" *thematic index: *\"(%c*?)\" to \"(%c*?)\" *")) {
} else if (Regexp::match(&mr, cl, U" *thematic index: *\"(%c*?)\" to \"(%c*?)\" *")) {
cd->index_title[THEMATIC_EG_INDEX] = Str::duplicate(mr.exp[0]);
cd->index_URL_pattern[THEMATIC_EG_INDEX] = Str::duplicate(mr.exp[1]);
cd->include_index[THEMATIC_EG_INDEX] = TRUE;
} else if (Regexp::match(&mr, cl, L" *general index: *\"(%c*?)\" to \"(%c*?)\" *")) {
} else if (Regexp::match(&mr, cl, U" *general index: *\"(%c*?)\" to \"(%c*?)\" *")) {
cd->index_title[GENERAL_INDEX] = Str::duplicate(mr.exp[0]);
cd->index_URL_pattern[GENERAL_INDEX] = Str::duplicate(mr.exp[1]);
cd->include_index[GENERAL_INDEX] = TRUE;
} else if (Regexp::match(&mr, cl, L" *index notation: *(%c*?) *")) {
} else if (Regexp::match(&mr, cl, U" *index notation: *(%c*?) *")) {
@<Act on an indexing notation@>;
} else {
DocumentationCompiler::layout_error(cd, I"unknown syntax in layout file", cl, tfp);
@ -363,25 +363,25 @@ void DocumentationCompiler::read_layout_helper(text_stream *cl, text_file_positi
text_stream *set = mr.exp[0];
match_results mr2 = Regexp::create_mr();
if (Regexp::match(&mr2, set, L"(%c*) to \"(%c*?.html)\"")) {
if (Regexp::match(&mr2, set, U"(%c*) to \"(%c*?.html)\"")) {
Str::clear(dest); WRITE_TO(dest, "%S", mr2.exp[1]);
Str::clear(set); WRITE_TO(set, "%S", mr2.exp[0]);
} else if (Regexp::match(&mr2, set, L"(%c*) to \"(%c*?)\"")) {
} else if (Regexp::match(&mr2, set, U"(%c*) to \"(%c*?)\"")) {
DocumentationCompiler::layout_error(cd, I"destination file must have filename extension '.html'", cl, tfp);
}
if (Regexp::match(&mr2, set, L"(%c*) by sections")) {
if (Regexp::match(&mr2, set, U"(%c*) by sections")) {
breaking = SECTION_PAGESETBREAKING;
Str::clear(set); WRITE_TO(set, "%S", mr2.exp[0]);
} else if (Regexp::match(&mr2, set, L"(%c*) by chapters")) {
} else if (Regexp::match(&mr2, set, U"(%c*) by chapters")) {
breaking = CHAPTER_PAGESETBREAKING;
Str::clear(set); WRITE_TO(set, "%S", mr2.exp[0]);
} else if (Regexp::match(&mr2, set, L"(%c*) by %c*")) {
} else if (Regexp::match(&mr2, set, U"(%c*) by %c*")) {
DocumentationCompiler::layout_error(cd, I"pages may be split only 'by sections' or 'by chapters'", cl, tfp);
Str::clear(set); WRITE_TO(set, "%S", mr2.exp[0]);
}
if (Regexp::match(&mr2, set, L"\"(%c*?.md)\"")) {
if (Regexp::match(&mr2, set, U"\"(%c*?.md)\"")) {
Str::clear(src); WRITE_TO(src, "%S", mr2.exp[0]);
} else if (Regexp::match(&mr2, set, L"\"(%c*?)\"")) {
} else if (Regexp::match(&mr2, set, U"\"(%c*?)\"")) {
DocumentationCompiler::layout_error(cd, I"source file must have filename extension '.md'", cl, tfp);
} else {
DocumentationCompiler::layout_error(cd, I"unknown syntax in layout file", cl, tfp);
@ -473,15 +473,15 @@ void DocumentationCompiler::read_layout_helper(text_stream *cl, text_file_positi
@<Act on an indexing notation@> =
text_stream *tweak = mr.exp[0];
match_results mr2 = Regexp::create_mr();
if (Regexp::match(&mr2, tweak, L"^{(%C*)headword(%C*)} = (%C+) *(%c*)")) {
if (Regexp::match(&mr2, tweak, U"^{(%C*)headword(%C*)} = (%C+) *(%c*)")) {
Indexes::add_indexing_notation(cd, mr2.exp[0], mr2.exp[1], mr2.exp[2], mr2.exp[3]);
} else if (Regexp::match(&mr2, tweak, L"{(%C+?)} = (%C+) *(%c*)")) {
} else if (Regexp::match(&mr2, tweak, U"{(%C+?)} = (%C+) *(%c*)")) {
Indexes::add_indexing_notation_for_symbols(cd, mr2.exp[0], mr2.exp[1], mr2.exp[2]);
} else if (Regexp::match(&mr2, tweak, L"definition = (%C+) *(%c*)")) {
} else if (Regexp::match(&mr2, tweak, U"definition = (%C+) *(%c*)")) {
Indexes::add_indexing_notation_for_definitions(cd, mr2.exp[0], mr2.exp[1], NULL);
} else if (Regexp::match(&mr2, tweak, L"(%C+)-definition = (%C+) *(%c*)")) {
} else if (Regexp::match(&mr2, tweak, U"(%C+)-definition = (%C+) *(%c*)")) {
Indexes::add_indexing_notation_for_definitions(cd, mr2.exp[1], mr2.exp[2], mr2.exp[0]);
} else if (Regexp::match(&mr2, tweak, L"example = (%C+) *(%c*)")) {
} else if (Regexp::match(&mr2, tweak, U"example = (%C+) *(%c*)")) {
Indexes::add_indexing_notation_for_examples(cd, mr2.exp[0], mr2.exp[1]);
} else {
DocumentationCompiler::layout_error(cd, I"bad indexing notation", cl, tfp);
@ -553,7 +553,7 @@ int DocumentationCompiler::detect_satellites(compiled_documentation *cd) {
if (D) {
TEMPORARY_TEXT(leafname)
while (Directories::next(D, leafname)) {
wchar_t first = Str::get_first_char(leafname), last = Str::get_last_char(leafname);
inchar32_t first = Str::get_first_char(leafname), last = Str::get_last_char(leafname);
if (Platform::is_folder_separator(last)) continue;
if (first == '.') continue;
if (first == '(') continue;
@ -664,8 +664,8 @@ void DocumentationCompiler::read_example_helper(text_stream *text, text_file_pos
example_scanning_state *ess = (example_scanning_state *) v_state;
if (tfp->line_count == 1) {
match_results mr = Regexp::create_mr();
if ((Regexp::match(&mr, text, L"Example *: *(%**) *(%c+?)")) ||
(Regexp::match(&mr, text, L"Example *- *(%**) *(%c+?)"))) {
if ((Regexp::match(&mr, text, U"Example *: *(%**) *(%c+?)")) ||
(Regexp::match(&mr, text, U"Example *- *(%**) *(%c+?)"))) {
ess->star_count = Str::len(mr.exp[0]);
if (ess->star_count == 0) {
DocumentationCompiler::example_error(ess,
@ -686,7 +686,7 @@ void DocumentationCompiler::read_example_helper(text_stream *text, text_file_pos
} else if (ess->past_header == FALSE) {
if (Str::is_whitespace(text)) { ess->past_header = TRUE; return; }
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, text, L"(%C+?) *: *(%c+?)")) {
if (Regexp::match(&mr, text, U"(%C+?) *: *(%c+?)")) {
if (Str::eq(mr.exp[0], I"Location")) ess->placement = Str::duplicate(mr.exp[1]);
else if (Str::eq(mr.exp[0], I"RecipeLocation")) ess->recipe_placement = Str::duplicate(mr.exp[1]);
else if (Str::eq(mr.exp[0], I"Subtitle")) ess->subtitle = Str::duplicate(mr.exp[1]);
@ -766,7 +766,7 @@ void DocumentationCompiler::count_examples(compiled_documentation *cd) {
LOOP_OVER_LINKED_LIST(eg, IFM_example, cd->examples) {
Str::clear(eg->URL);
for (int i=0; i<Str::len(cd->example_URL_pattern); i++) {
wchar_t c = Str::get_at(cd->example_URL_pattern, i);
inchar32_t c = Str::get_at(cd->example_URL_pattern, i);
if (c == '#') WRITE_TO(eg->URL, "%S", eg->insignia);
else PUT_TO(eg->URL, c);
}
@ -936,7 +936,7 @@ int DocumentationCompiler::divide_tree_by_sections(markdown_item *tree, text_str
@<Divide by section here@> =
TEMPORARY_TEXT(leaf)
for (int i=0; i<Str::len(naming); i++) {
wchar_t c = Str::get_at(naming, i);
inchar32_t c = Str::get_at(naming, i);
if (c == '#') {
if (C > 0) WRITE_TO(leaf, "%d_", C);
WRITE_TO(leaf, "%d", N++);
@ -954,7 +954,7 @@ int DocumentationCompiler::divide_tree_by_chapters(markdown_item *tree, text_str
if ((md->type == HEADING_MIT) && (Markdown::get_heading_level(md) == 1)) {
TEMPORARY_TEXT(leaf)
for (int i=0; i<Str::len(naming); i++) {
wchar_t c = Str::get_at(naming, i);
inchar32_t c = Str::get_at(naming, i);
if (c == '#') WRITE_TO(leaf, "%d", N++);
else PUT_TO(leaf, c);
}

View file

@ -66,11 +66,11 @@ void ExamplesIndex::write_alphabetical_examples_index(OUTPUT_STREAM, compiled_do
ExamplesIndex::sort_comparison);
TEMPORARY_TEXT(current_subtitle)
wchar_t current_letter = 0;
inchar32_t current_letter = 0;
int first_letter_block = TRUE;
for (int i=0; i<NUMBER_CREATED(example_index_data); i++) {
example_index_data *eid = eid_list[i];
wchar_t initial = Str::get_first_char(eid->sort_key);
inchar32_t initial = Str::get_first_char(eid->sort_key);
if (Characters::isdigit(initial)) initial = '#';
if (initial != current_letter) @<Start a new letter block@>;
TEMPORARY_TEXT(url)
@ -113,7 +113,7 @@ void ExamplesIndex::write_alphabetical_examples_index(OUTPUT_STREAM, compiled_do
@<Start a new letter block@> =
current_letter = initial;
if (first_letter_block == FALSE) { HTML_TAG("br"); @<End a letter block@>; }
wchar_t uc_current_letter = Characters::toupper(current_letter);
inchar32_t uc_current_letter = Characters::toupper(current_letter);
HTML_OPEN("tr");
HTML_OPEN_WITH("td", "class=\"letterblock\"");
TEMPORARY_TEXT(inc)

View file

@ -108,48 +108,48 @@ category:
ic->cat_name = Str::duplicate(name);
match_results mr = Regexp::create_mr();
ic->cat_glossed = Str::new();
if (Regexp::match(&mr, options, L"(%c*?) *%(\"(%c*?)\"%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(\"(%c*?)\"%) *(%c*)")) {
ic->cat_glossed = Str::duplicate(mr.exp[1]);
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[2]);
}
ic->cat_prefix = Str::new();
if (Regexp::match(&mr, options, L"(%c*?) *%(prefix \"(%c*?)\"%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(prefix \"(%c*?)\"%) *(%c*)")) {
ic->cat_prefix = Str::duplicate(mr.exp[1]);
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[2]);
}
ic->cat_suffix = Str::new();
if (Regexp::match(&mr, options, L"(%c*?) *%(suffix \"(%c*?)\"%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(suffix \"(%c*?)\"%) *(%c*)")) {
ic->cat_suffix = Str::duplicate(mr.exp[1]);
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[2]);
}
ic->cat_under = Str::new();
if (Regexp::match(&mr, options, L"(%c*?) *%(under {(%c*?)}%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(under {(%c*?)}%) *(%c*)")) {
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[2]);
ic->cat_under = Str::duplicate(mr.exp[1]);
}
ic->cat_alsounder = FALSE;
if (Regexp::match(&mr, options, L"(%c*?) *%(also under {(%c*?)}%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(also under {(%c*?)}%) *(%c*)")) {
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[2]);
ic->cat_under = Str::duplicate(mr.exp[1]);
ic->cat_alsounder = TRUE;
}
ic->cat_inverted = FALSE;
if (Regexp::match(&mr, options, L"(%c*?) *%(invert%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(invert%) *(%c*)")) {
ic->cat_inverted = TRUE;
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[1]);
}
ic->cat_bracketed = FALSE;
if (Regexp::match(&mr, options, L"(%c*?) *%(bracketed%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(bracketed%) *(%c*)")) {
ic->cat_bracketed = TRUE;
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[1]);
}
ic->cat_unbracketed = FALSE;
if (Regexp::match(&mr, options, L"(%c*?) *%(unbracketed%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(unbracketed%) *(%c*)")) {
ic->cat_bracketed = TRUE;
ic->cat_unbracketed = TRUE;
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[1]);
}
if (Regexp::match(NULL, options, L"%c*?%C%c*"))
if (Regexp::match(NULL, options, U"%c*?%C%c*"))
Errors::with_text("Unknown notation options: %S", options);
ic->cat_usage = 0;
Regexp::dispose_of(&mr);
@ -200,10 +200,10 @@ void Indexes::scan_indexingnotations(compiled_documentation *cd, markdown_item *
match_results mr = Regexp::create_mr();
TEMPORARY_TEXT(see)
TEMPORARY_TEXT(alphabetise_as)
if (Regexp::match(&mr, term_to_index, L"(%c+?) *<-- *(%c+) *")) {
if (Regexp::match(&mr, term_to_index, U"(%c+?) *<-- *(%c+) *")) {
Str::copy(term_to_index, mr.exp[0]); Str::copy(see, mr.exp[1]);
}
if (Regexp::match(&mr, term_to_index, L"(%c+?) *--> *(%c+) *")) {
if (Regexp::match(&mr, term_to_index, U"(%c+?) *--> *(%c+) *")) {
Str::copy(term_to_index, mr.exp[0]); Str::copy(alphabetise_as, mr.exp[1]);
}
TEMPORARY_TEXT(lemma)
@ -221,7 +221,7 @@ void Indexes::scan_indexingnotations(compiled_documentation *cd, markdown_item *
TEMPORARY_TEXT(smoke_test_text)
Indexes::process_category_options(smoke_test_text, cd, lemma, TRUE, 1);
while (Regexp::match(&mr, see, L" *(%c+) *<-- *(%c+?) *")) {
while (Regexp::match(&mr, see, U" *(%c+) *<-- *(%c+?) *")) {
Str::copy(see, mr.exp[0]);
TEMPORARY_TEXT(seethis)
Indexes::extract_from_indexable_matter(seethis, cd, mr.exp[1]);
@ -239,9 +239,9 @@ void Indexes::scan_indexingnotations(compiled_documentation *cd, markdown_item *
DISCARD_TEXT(seethis)
}
if (indoc_settings_test_index_mode) {
Regexp::replace(smoke_test_text, L"=___=standard", L"", REP_REPEATING);
Regexp::replace(smoke_test_text, L"=___=(%C+)", L" %(%0%)", REP_REPEATING);
Regexp::replace(smoke_test_text, L":", L": ", REP_REPEATING);
Regexp::replace(smoke_test_text, U"=___=standard", U"", REP_REPEATING);
Regexp::replace(smoke_test_text, U"=___=(%C+)", U" %(%0%)", REP_REPEATING);
Regexp::replace(smoke_test_text, U":", U": ", REP_REPEATING);
md->type = PLAIN_MIT;
md->sliced_from = Str::duplicate(smoke_test_text);
md->from = 0; md->to = Str::len(smoke_test_text) - 1;
@ -255,7 +255,7 @@ void Indexes::scan_indexingnotations(compiled_documentation *cd, markdown_item *
void Indexes::extract_from_indexable_matter(OUTPUT_STREAM, compiled_documentation *cd, text_stream *text) {
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, text, L" *(%c+?) *: *(%c+) *")) {
if (Regexp::match(&mr, text, U" *(%c+?) *: *(%c+) *")) {
text_stream *head = mr.exp[0];
text_stream *tail = mr.exp[1];
Indexes::extract_from_indexable_matter(OUT, cd, head);
@ -308,13 +308,13 @@ void Indexes::mark_index_term(compiled_documentation *cd, text_stream *given_ter
int example_index_status) {
TEMPORARY_TEXT(term)
Indexes::process_category_options(term, cd, given_term, TRUE, 4);
if ((Regexp::match(NULL, term, L"IGNORE=___=ME%c*")) ||
(Regexp::match(NULL, term, L"%c*:IGNORE=___=ME%c*"))) return;
if ((Regexp::match(NULL, term, U"IGNORE=___=ME%c*")) ||
(Regexp::match(NULL, term, U"%c*:IGNORE=___=ME%c*"))) return;
if (Str::len(alphabetise_as) > 0)
IndexUtilities::alphabetisation_exception(term, alphabetise_as);
Indexes::ensure_lemmas_exist(cd, term, example_index_status);
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, term, L"%c*=___=([^_]+?)")) {
if (Regexp::match(&mr, term, U"%c*=___=([^_]+?)")) {
text_stream *category = mr.exp[0];
if (Dictionaries::find(cd->id.categories_by_name, category)) {
indexing_category *ic = (indexing_category *)
@ -323,8 +323,8 @@ void Indexes::mark_index_term(compiled_documentation *cd, text_stream *given_ter
if ((ic) && (ic->cat_alsounder == TRUE)) {
TEMPORARY_TEXT(processed_term)
Indexes::process_category_options(processed_term, cd, given_term, FALSE, 5);
if ((Regexp::match(NULL, processed_term, L"IGNORE=___=ME%c*")) ||
(Regexp::match(NULL, processed_term, L"%c*:IGNORE=___=ME%c*"))) return;
if ((Regexp::match(NULL, processed_term, U"IGNORE=___=ME%c*")) ||
(Regexp::match(NULL, processed_term, U"%c*:IGNORE=___=ME%c*"))) return;
Indexes::ensure_lemmas_exist(cd, processed_term, example_index_status);
Indexes::set_index_point(cd, processed_term, V, S, anchor, E, see,
example_index_status);
@ -357,7 +357,7 @@ typedef struct index_reference {
void Indexes::ensure_lemmas_exist(compiled_documentation *cd, text_stream *text,
int example_index_status) {
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, text, L" *(%c+) *: *(%c+?) *"))
if (Regexp::match(&mr, text, U" *(%c+) *: *(%c+?) *"))
Indexes::ensure_lemmas_exist(cd, mr.exp[0], example_index_status);
Regexp::dispose_of(&mr);
if (Dictionaries::find(cd->id.lemmas, text) == NULL) {
@ -409,7 +409,7 @@ void Indexes::process_category_options(OUTPUT_STREAM, compiled_documentation *cd
text_stream *text, int allow_under, int n) {
match_results mr = Regexp::create_mr();
@<Break the text down into a colon-separated list of categories and process each@>;
if (Regexp::match(&mr, text, L"(%c*)=___=(%c*)")) {
if (Regexp::match(&mr, text, U"(%c*)=___=(%c*)")) {
text_stream *lemma = mr.exp[0];
text_stream *category = mr.exp[1];
@<Redirect category names starting with an exclamation@>;
@ -423,7 +423,7 @@ void Indexes::process_category_options(OUTPUT_STREAM, compiled_documentation *cd
}
@<Break the text down into a colon-separated list of categories and process each@> =
if (Regexp::match(&mr, text, L" *(%c+?) *: *(%c+)")) {
if (Regexp::match(&mr, text, U" *(%c+?) *: *(%c+)")) {
Indexes::process_category_options(OUT, cd, mr.exp[0], TRUE, 7);
WRITE(":");
Indexes::process_category_options(OUT, cd, mr.exp[1], allow_under, 8);
@ -461,9 +461,9 @@ else suppressed as unwanted (because the user didn't set up a redirection).
"Mary, Queen of Scots" alone.
@<Perform name inversion as necessary@> =
if ((ic->cat_inverted) && (Regexp::match(NULL, lemma, L"%c*,%c*") == FALSE)) {
if ((ic->cat_inverted) && (Regexp::match(NULL, lemma, U"%c*,%c*") == FALSE)) {
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, lemma, L"(%c*?) (%C+) *")) {
if (Regexp::match(&mr, lemma, U"(%c*?) (%C+) *")) {
Str::clear(lemma);
WRITE_TO(lemma, "%S, %S", mr.exp[1], mr.exp[0]);
}
@ -540,22 +540,22 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
Str::copy(sort_key, il->term);
/* ensure subentries follow main entries */
Regexp::replace(sort_key, L": *", L"ZZZZZZZZZZZZZZZZZZZZZZ", REP_REPEATING);
Regexp::replace(sort_key, U": *", U"ZZZZZZZZZZZZZZZZZZZZZZ", REP_REPEATING);
IndexUtilities::improve_alphabetisation(sort_key);
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, sort_key, L"a/%C+ (%c*)")) Str::copy(sort_key, mr.exp[0]);
if (Regexp::match(&mr, sort_key, L"the/%C+ (%c*)")) Str::copy(sort_key, mr.exp[0]);
if (Regexp::match(&mr, sort_key, U"a/%C+ (%c*)")) Str::copy(sort_key, mr.exp[0]);
if (Regexp::match(&mr, sort_key, U"the/%C+ (%c*)")) Str::copy(sort_key, mr.exp[0]);
if (indoc_settings_index_alphabetisation_algorithm == WORD_ALPHABETIZATION)
Regexp::replace(sort_key, L" ", L"aaaaaaaaaaaaaaaaaaaaaa", REP_REPEATING);
Regexp::replace(sort_key, U" ", U"aaaaaaaaaaaaaaaaaaaaaa", REP_REPEATING);
TEMPORARY_TEXT(un)
Str::copy(un, sort_key);
Regexp::replace(un, L"%(%c*?%)", NULL, REP_REPEATING);
Regexp::replace(un, L" ", NULL, REP_REPEATING);
Regexp::replace(un, L",", NULL, REP_REPEATING);
int f = ' ';
Regexp::replace(un, U"%(%c*?%)", NULL, REP_REPEATING);
Regexp::replace(un, U" ", NULL, REP_REPEATING);
Regexp::replace(un, U",", NULL, REP_REPEATING);
inchar32_t f = ' ';
if (Characters::isalpha(Str::get_first_char(sort_key)))
f = Str::get_first_char(sort_key);
WRITE_TO(il->sorting_key, "%c_%S=___=%S=___=%07d",
@ -568,11 +568,11 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
@<Render the index in sorted order@> =
IndexUtilities::alphabet_row(OUT, 1);
HTML_OPEN_WITH("table", "class=\"indextable\"");
wchar_t current_incipit = 0;
inchar32_t current_incipit = 0;
for (int i=0; i<NL; i++) {
index_lemma *il = lemma_list[i];
if ((just_examples) && (il->example_index_status == 0)) continue;
wchar_t incipit = Str::get_first_char(il->sorting_key);
inchar32_t incipit = Str::get_first_char(il->sorting_key);
if (Characters::isalpha(incipit)) incipit = Characters::toupper(incipit);
else incipit = '#';
if (incipit != current_incipit) {
@ -614,7 +614,7 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
TEMPORARY_TEXT(category)
match_results mr = Regexp::create_mr();
Str::copy(term, il->term);
if (Regexp::match(&mr, term, L"(%c*)=___=(%c*)")) {
if (Regexp::match(&mr, term, U"(%c*)=___=(%c*)")) {
Str::copy(term, mr.exp[0]);
Str::copy(category, mr.exp[1]);
}
@ -652,14 +652,15 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
@<Work out the wording and indentation level@> =
TEMPORARY_TEXT(untreated)
Str::copy(untreated, term);
while (Regexp::match(&mr, untreated, L"%c*?: *(%c+)")) {
while (Regexp::match(&mr, untreated, U"%c*?: *(%c+)")) {
Str::copy(untreated, mr.exp[0]); indent_level++;
}
IndexUtilities::escape_HTML_characters_in(untreated);
for (int i=0, L = Str::len(untreated); i<L; i++) {
int c = Str::get_at(untreated, i);
inchar32_t c = Str::get_at(untreated, i);
if (c == '\\') {
int n = 0, d = 0, id = 0;
inchar32_t n = 0, id = 0;
int d = 0;
while (Characters::isdigit(id = Str::get_at(untreated, i+1))) {
i++, d++; n = n*10 + (id - '0');
}
@ -671,23 +672,23 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
}
if (ic->cat_bracketed) {
while (Regexp::match(&mr, lemma_wording, L"(%c*?)%((%c*?)%)(%c*)")) {
while (Regexp::match(&mr, lemma_wording, U"(%c*?)%((%c*?)%)(%c*)")) {
Str::clear(lemma_wording);
WRITE_TO(lemma_wording,
"%S<span class=\"index%Sbracketed\">___openb___%S___closeb___</span>%S",
mr.exp[0], category, mr.exp[1], mr.exp[2]);
}
if (ic->cat_unbracketed) {
Regexp::replace(lemma_wording, L"___openb___", NULL, REP_REPEATING);
Regexp::replace(lemma_wording, L"___closeb___", NULL, REP_REPEATING);
Regexp::replace(lemma_wording, U"___openb___", NULL, REP_REPEATING);
Regexp::replace(lemma_wording, U"___closeb___", NULL, REP_REPEATING);
} else {
Regexp::replace(lemma_wording, L"___openb___", L"(", REP_REPEATING);
Regexp::replace(lemma_wording, L"___closeb___", L")", REP_REPEATING);
Regexp::replace(lemma_wording, U"___openb___", U"(", REP_REPEATING);
Regexp::replace(lemma_wording, U"___closeb___", U")", REP_REPEATING);
}
}
LOOP_THROUGH_TEXT(pos, lemma_wording) {
int d = Str::get(pos);
inchar32_t d = Str::get(pos);
if (d == SAVED_OPEN_BRACKET) Str::put(pos, '(');
if (d == SAVED_CLOSE_BRACKET) Str::put(pos, ')');
}
@ -721,7 +722,7 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
TEMPORARY_TEXT(link)
if (S) {
for (int i=0; i<Str::len(S->stashed); i++) {
wchar_t c = Str::get_at(S->stashed, i);
inchar32_t c = Str::get_at(S->stashed, i);
if (c == ':') break;
if ((Characters::isdigit(c)) || (c == '.')) PUT_TO(link, c);
}
@ -745,7 +746,7 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
if (lc > 0) WRITE("also ");
HTML_CLOSE("span");
match_results mr2 = Regexp::create_mr();
while (Regexp::match(&mr2, seelist, L"(%c*?) *<-- *(%c*)")) {
while (Regexp::match(&mr2, seelist, U"(%c*?) *<-- *(%c*)")) {
if (sc++ > 0) { WRITE("; "); }
text_stream *see = mr2.exp[0];
@ -753,9 +754,9 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
index_lemma *ils = (index_lemma *) Dictionaries::read_value(cd->id.lemmas, see);
TEMPORARY_TEXT(url)
WRITE_TO(url, "#l%d", ils->allocation_id);
Regexp::replace(see, L"=___=%i+?:", L":", REP_REPEATING);
Regexp::replace(see, L"=___=%i+", NULL, REP_REPEATING);
Regexp::replace(see, L":", L": ", REP_REPEATING);
Regexp::replace(see, U"=___=%i+?:", U":", REP_REPEATING);
Regexp::replace(see, U"=___=%i+", NULL, REP_REPEATING);
Regexp::replace(see, U":", U": ", REP_REPEATING);
IndexUtilities::general_link(OUT, I"indexseelink", url, see);
DISCARD_TEXT(url)
}

View file

@ -30,7 +30,7 @@ void IndexUtilities::general_link(OUTPUT_STREAM, text_stream *cl, text_stream *t
void IndexUtilities::escape_HTML_characters_in(text_stream *text) {
TEMPORARY_TEXT(modified)
for (int i=0, L=Str::len(text); i<L; i++) {
int c = Str::get_at(text, i);
inchar32_t c = Str::get_at(text, i);
switch (c) {
case '\"': WRITE_TO(modified, "&quot;"); break;
case '<': WRITE_TO(modified, "&lt;"); break;
@ -66,9 +66,9 @@ emphasis; and are also used to mark headwords for indexing, as in
=
typedef struct span_notation {
int sp_purpose; /* one of the |*_SPP| constants */
wchar_t sp_left[MAX_PATTERN_LENGTH]; /* wide C string: the start pattern */
inchar32_t sp_left[MAX_PATTERN_LENGTH]; /* wide C string: the start pattern */
int sp_left_len;
wchar_t sp_right[MAX_PATTERN_LENGTH]; /* wide C string: and end pattern */
inchar32_t sp_right[MAX_PATTERN_LENGTH]; /* wide C string: and end pattern */
int sp_right_len;
struct text_stream *sp_style;
CLASS_DEFINITION
@ -112,34 +112,34 @@ void IndexUtilities::improve_alphabetisation(text_stream *sort_key) {
} else {
LOOP_THROUGH_TEXT(pos, sort_key)
Str::put(pos, Characters::tolower(Str::get(pos)));
Regexp::replace(sort_key, L"a ", NULL, REP_ATSTART);
Regexp::replace(sort_key, L"an ", NULL, REP_ATSTART);
Regexp::replace(sort_key, L"the ", NULL, REP_ATSTART);
Regexp::replace(sort_key, U"a ", NULL, REP_ATSTART);
Regexp::replace(sort_key, U"an ", NULL, REP_ATSTART);
Regexp::replace(sort_key, U"the ", NULL, REP_ATSTART);
LOOP_THROUGH_TEXT(pos, sort_key)
Str::put(pos, Characters::tolower(Characters::remove_wchar_t_accent(Str::get(pos))));
Regexp::replace(sort_key, L"%[ *%]", L"____SQUARES____", REP_REPEATING);
Regexp::replace(sort_key, L"%[", NULL, REP_REPEATING);
Regexp::replace(sort_key, L"%]", NULL, REP_REPEATING);
Regexp::replace(sort_key, L"____SQUARES____", L"[]", REP_REPEATING);
Regexp::replace(sort_key, L"%(", NULL, REP_REPEATING);
Regexp::replace(sort_key, L"%)", NULL, REP_REPEATING);
Regexp::replace(sort_key, L"1 ", L"one ", REP_ATSTART);
Regexp::replace(sort_key, L"2 ", L"two ", REP_ATSTART);
Regexp::replace(sort_key, L"3 ", L"three ", REP_ATSTART);
Regexp::replace(sort_key, L"4 ", L"four ", REP_ATSTART);
Regexp::replace(sort_key, L"5 ", L"five ", REP_ATSTART);
Regexp::replace(sort_key, L"6 ", L"six ", REP_ATSTART);
Regexp::replace(sort_key, L"7 ", L"seven ", REP_ATSTART);
Regexp::replace(sort_key, L"8 ", L"eight ", REP_ATSTART);
Regexp::replace(sort_key, L"9 ", L"nine ", REP_ATSTART);
Regexp::replace(sort_key, L"10 ", L"ten ", REP_ATSTART);
Regexp::replace(sort_key, L"11 ", L"eleven ", REP_ATSTART);
Regexp::replace(sort_key, L"12 ", L"twelve ", REP_ATSTART);
Str::put(pos, Characters::tolower(Characters::remove_accent(Str::get(pos))));
Regexp::replace(sort_key, U"%[ *%]", U"____SQUARES____", REP_REPEATING);
Regexp::replace(sort_key, U"%[", NULL, REP_REPEATING);
Regexp::replace(sort_key, U"%]", NULL, REP_REPEATING);
Regexp::replace(sort_key, U"____SQUARES____", U"[]", REP_REPEATING);
Regexp::replace(sort_key, U"%(", NULL, REP_REPEATING);
Regexp::replace(sort_key, U"%)", NULL, REP_REPEATING);
Regexp::replace(sort_key, U"1 ", U"one ", REP_ATSTART);
Regexp::replace(sort_key, U"2 ", U"two ", REP_ATSTART);
Regexp::replace(sort_key, U"3 ", U"three ", REP_ATSTART);
Regexp::replace(sort_key, U"4 ", U"four ", REP_ATSTART);
Regexp::replace(sort_key, U"5 ", U"five ", REP_ATSTART);
Regexp::replace(sort_key, U"6 ", U"six ", REP_ATSTART);
Regexp::replace(sort_key, U"7 ", U"seven ", REP_ATSTART);
Regexp::replace(sort_key, U"8 ", U"eight ", REP_ATSTART);
Regexp::replace(sort_key, U"9 ", U"nine ", REP_ATSTART);
Regexp::replace(sort_key, U"10 ", U"ten ", REP_ATSTART);
Regexp::replace(sort_key, U"11 ", U"eleven ", REP_ATSTART);
Regexp::replace(sort_key, U"12 ", U"twelve ", REP_ATSTART);
TEMPORARY_TEXT(x)
Str::copy(x, sort_key);
Str::clear(sort_key);
match_results mr = Regexp::create_mr();
while (Regexp::match(&mr, x, L"(%c*?)(%d+)(%c*)")) {
while (Regexp::match(&mr, x, U"(%c*?)(%d+)(%c*)")) {
WRITE_TO(sort_key, "%S", mr.exp[0]);
Str::copy(x, mr.exp[2]);
WRITE_TO(sort_key, "%08d", Str::atoi(mr.exp[1], 0));
@ -151,9 +151,9 @@ void IndexUtilities::improve_alphabetisation(text_stream *sort_key) {
@ =
int letters_taken[26];
void IndexUtilities::note_letter(wchar_t c) {
int i = c - (wchar_t) 'A';
if ((i>=0) && (i<26)) letters_taken[i] = TRUE;
void IndexUtilities::note_letter(inchar32_t c) {
inchar32_t i = c - (inchar32_t) 'A';
if (i<26) letters_taken[i] = TRUE;
}
void IndexUtilities::alphabet_row(OUTPUT_STREAM, int sequence) {
switch (sequence) {
@ -167,7 +167,7 @@ void IndexUtilities::alphabet_row(OUTPUT_STREAM, int sequence) {
if (letters_taken[i] == FALSE) {
if (faked == FALSE) { faked = TRUE; HTML_OPEN("p"); }
TEMPORARY_TEXT(singleton)
PUT_TO(singleton, 'A'+i);
PUT_TO(singleton, (inchar32_t) ('A'+i));
HTML::anchor(OUT, singleton);
DISCARD_TEXT(singleton)
}

View file

@ -123,7 +123,7 @@ which we expand into appropriate material:
WRITE_TO(source, "%S", text);
Str::clear(text);
while (Regexp::match(&mr, source, L"(%c*?)%[(%C+)%](%c*)")) {
while (Regexp::match(&mr, source, U"(%c*?)%[(%C+)%](%c*)")) {
WRITE_TO(text, "%S", mr.exp[0]);
text_stream *insertion = mr.exp[1];
@<Insert the insertion@>;
@ -246,13 +246,13 @@ void RTPPages::roster_helper(text_stream *text, text_file_position *tfp, void *s
match_results mr = Regexp::create_mr();
text_stream *token = NULL, *equivalent = NULL, *model = NULL;
if (Regexp::match(&mr, text, L"> *(%c*?) *: *(%C+) *--> *(%C+)")) {
if (Regexp::match(&mr, text, U"> *(%c*?) *: *(%C+) *--> *(%C+)")) {
model = mr.exp[0]; token = mr.exp[2]; equivalent = mr.exp[1];
@<Act on roster item@>;
} else if (Regexp::match(&mr, text, L"> *(%c+?) *: *(%C+)")) {
} else if (Regexp::match(&mr, text, U"> *(%c+?) *: *(%C+)")) {
model = mr.exp[0]; token = mr.exp[1]; equivalent = token;
@<Act on roster item@>;
} else if (Regexp::match(&mr, text, L"> *(%C+)")) {
} else if (Regexp::match(&mr, text, U"> *(%C+)")) {
model = NULL; token = mr.exp[0]; equivalent = token;
@<Act on roster item@>;
} else {

View file

@ -95,7 +95,7 @@ into the main file and individual example files.
TEMPORARY_TEXT(line)
int indentation = 0, space_count = 0;
for (int i=0; i<Str::len(source); i++) {
wchar_t c = Str::get_at(source, i);
inchar32_t c = Str::get_at(source, i);
if (c == '\n') {
@<Line read@>;
Str::clear(line);
@ -116,12 +116,12 @@ into the main file and individual example files.
@<Line read@> =
Str::trim_white_space(line);
match_results mr = Regexp::create_mr();
if ((Regexp::match(&mr, line, L"Section *: *(%c+?)")) ||
(Regexp::match(&mr, line, L"Section *- *(%c+?)"))) {
if ((Regexp::match(&mr, line, U"Section *: *(%c+?)")) ||
(Regexp::match(&mr, line, U"Section *- *(%c+?)"))) {
if (pass == 1) section_count++;
if (pass == 2) @<End any example@>;
} else if ((Regexp::match(&mr, line, L"Chapter *: *(%c+?)")) ||
(Regexp::match(&mr, line, L"Chapter *- *(%c+?)"))) {
} else if ((Regexp::match(&mr, line, U"Chapter *: *(%c+?)")) ||
(Regexp::match(&mr, line, U"Chapter *- *(%c+?)"))) {
if (pass == 1) chapter_count++;
if (pass == 2) {
@<End any example@>;
@ -129,8 +129,8 @@ into the main file and individual example files.
}
}
if (pass == 2) {
if ((Regexp::match(&mr, line, L"Example *: *(%**) *(%c+?)")) ||
(Regexp::match(&mr, line, L"Example *- *(%**) *(%c+?)")))
if ((Regexp::match(&mr, line, U"Example *: *(%**) *(%c+?)")) ||
(Regexp::match(&mr, line, U"Example *- *(%**) *(%c+?)")))
@<Deal with an example heading@>
else
@<Copy the line out to the appropriate file@>;
@ -155,7 +155,7 @@ to sections.
text_stream *title = mr.exp[1];
text_stream *desc = NULL;
match_results mr2 = Regexp::create_mr();
if (Regexp::match(&mr2, title, L" *(%c+?) - *(%c+) *")) {
if (Regexp::match(&mr2, title, U" *(%c+?) - *(%c+) *")) {
title = mr2.exp[0];
desc = mr2.exp[1];
}
@ -168,7 +168,7 @@ to sections.
TEMPORARY_TEXT(eleaf)
for (int i=0, last_was_ws=TRUE; i<Str::len(title); i++) {
wchar_t c = Str::get_at(title, i);
inchar32_t c = Str::get_at(title, i);
if (Characters::is_whitespace(c)) { last_was_ws = TRUE; continue; }
if (last_was_ws) c = Characters::toupper(c);
last_was_ws = FALSE;
@ -198,7 +198,7 @@ are legal.
@<Copy the line out to the appropriate file@> =
for (int i=0; i<indentation; i++) PUT_TO(dest, '\t');
match_results mr2 = Regexp::create_mr();
if ((indentation == 1) && (Regexp::match(&mr2, line, L"%* *: *(%c+?)"))) {
if ((indentation == 1) && (Regexp::match(&mr2, line, U"%* *: *(%c+?)"))) {
WRITE_TO(dest, "{*}%S\n", mr2.exp[0]);
} else {
WRITE_TO(dest, "%S\n", line);

View file

@ -726,7 +726,7 @@ void ExtensionInstaller::uninstall_icon(OUTPUT_STREAM) {
else
WRITE_TO(path, "%p", C->location_if_path);
LOOP_THROUGH_TEXT(pos, path) {
wchar_t c = Str::get(pos);
inchar32_t c = Str::get(pos);
if (c == '\\')
WRITE_TO(js_path, "\\\\");
else

View file

@ -24,8 +24,8 @@ void Basics::end(void) {
@e INSTRUCTIONS_DA
@<Declare the debugging log aspects@> =
Log::declare_aspect(SYMBOLS_DA, L"symbols", FALSE, FALSE);
Log::declare_aspect(INSTRUCTIONS_DA, L"instructions", FALSE, FALSE);
Log::declare_aspect(SYMBOLS_DA, U"symbols", FALSE, FALSE);
Log::declare_aspect(INSTRUCTIONS_DA, U"instructions", FALSE, FALSE);
@h Setting up the memory manager.
We need to itemise the structures we'll want to allocate:

View file

@ -53,24 +53,24 @@ void Configuration::read_command_line(int argc, char **argv, settings_block *set
@<Read the command line@> =
CommandLine::declare_heading(
L"indoc: a tool for rendering Inform documentation\n\n"
L"Usage: indoc [OPTIONS] TARGET\n"
L"where TARGET must be one of those set up in the instructions.\n");
U"indoc: a tool for rendering Inform documentation\n\n"
U"Usage: indoc [OPTIONS] TARGET\n"
U"where TARGET must be one of those set up in the instructions.\n");
CommandLine::declare_boolean_switch(VERBOSE_CLSW, L"verbose", 1,
L"explain what indoc is doing", FALSE);
CommandLine::declare_boolean_switch(TEST_INDEX_CLSW, L"test-index", 1,
L"test indexing", FALSE);
CommandLine::declare_switch(XREFS_CLSW, L"xrefs", 2,
L"write a file of documentation cross-references to filename X");
CommandLine::declare_switch(FROM_CLSW, L"from", 2,
L"use documentation in directory X (instead of 'Documentation' in cwd)");
CommandLine::declare_switch(TO_CLSW, L"to", 2,
L"redirect output to folder X (which must already exist)");
CommandLine::declare_switch(INSERTION_CLSW, L"insertion", 2,
L"insert HTML in file X at the top of each page head");
CommandLine::declare_switch(INSTRUCTIONS_CLSW, L"instructions", 2,
L"read further instructions from file X");
CommandLine::declare_boolean_switch(VERBOSE_CLSW, U"verbose", 1,
U"explain what indoc is doing", FALSE);
CommandLine::declare_boolean_switch(TEST_INDEX_CLSW, U"test-index", 1,
U"test indexing", FALSE);
CommandLine::declare_switch(XREFS_CLSW, U"xrefs", 2,
U"write a file of documentation cross-references to filename X");
CommandLine::declare_switch(FROM_CLSW, U"from", 2,
U"use documentation in directory X (instead of 'Documentation' in cwd)");
CommandLine::declare_switch(TO_CLSW, U"to", 2,
U"redirect output to folder X (which must already exist)");
CommandLine::declare_switch(INSERTION_CLSW, U"insertion", 2,
U"insert HTML in file X at the top of each page head");
CommandLine::declare_switch(INSTRUCTIONS_CLSW, U"instructions", 2,
U"read further instructions from file X");
if (CommandLine::read(argc, argv, &state, &Configuration::switch, &Configuration::bareword)
== FALSE) exit(0);

View file

@ -53,7 +53,7 @@ otherwise.
=
int Symbols::perform_ifdef(text_stream *cond) {
for (int i=0, L=Str::len(cond); i<L; i++) {
int c = Str::get_at(cond, i);
inchar32_t c = Str::get_at(cond, i);
if (Characters::is_whitespace(c)) {
Str::delete_nth_character(cond, i);
i--; L--;
@ -96,7 +96,7 @@ int Symbols::perform_ifdef_inner(text_stream *cond) {
@<Subexpressions can be bracketed@> =
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, cond, L"%((%c*)%)")) {
if (Regexp::match(&mr, cond, U"%((%c*)%)")) {
int rv = Symbols::perform_ifdef(mr.exp[0]);
Regexp::dispose_of(&mr);
return rv;
@ -132,7 +132,7 @@ int Symbols::perform_ifdef_inner(text_stream *cond) {
@<The caret operator is unary and means not@> =
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, cond, L"%^(%c*)")) {
if (Regexp::match(&mr, cond, U"%^(%c*)")) {
int rv = Symbols::perform_ifdef(mr.exp[0]);
Regexp::dispose_of(&mr);
return rv?FALSE:TRUE;
@ -140,10 +140,10 @@ int Symbols::perform_ifdef_inner(text_stream *cond) {
@<A bare symbol name is true if and only if it is declared@> =
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, cond, L"%i+")) {
if (Regexp::match(&mr, cond, U"%i+")) {
Regexp::dispose_of(&mr);
text_stream *entry = Dictionaries::get_text(defined_symbols, cond);
if (Str::eq_wide_string(entry, L"y")) return TRUE;
if (Str::eq_wide_string(entry, U"y")) return TRUE;
return FALSE;
}
@ -154,10 +154,10 @@ int Symbols::perform_ifdef_inner(text_stream *cond) {
parts of the text |cond|, and looks out for mismatched brackets on the way.
=
int Symbols::find_operator(text_stream *cond, int op) {
int Symbols::find_operator(text_stream *cond, inchar32_t op) {
int bl = 0;
for (int k = 0, L = Str::len(cond); k < L; k++) {
int ch = Str::get_at(cond, k);
inchar32_t ch = Str::get_at(cond, k);
if (ch == '(') bl++;
if (ch == ')') bl--;
if (bl < 0) return -2; /* Too many close brackets */

View file

@ -219,15 +219,15 @@ void Instructions::read_instructions_helper(text_stream *cl, text_file_position
settings_block *settings = ihs->settings;
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, cl, L" *#%c*")) { Regexp::dispose_of(&mr); return; }
if (Regexp::match(&mr, cl, L" *")) { Regexp::dispose_of(&mr); return; }
if (Regexp::match(&mr, cl, U" *#%c*")) { Regexp::dispose_of(&mr); return; }
if (Regexp::match(&mr, cl, U" *")) { Regexp::dispose_of(&mr); return; }
if (Regexp::match(&mr, cl, L"(%C+) { *")) {
if (Regexp::match(&mr, cl, U"(%C+) { *")) {
if (Str::len(ihs->scanning_target) > 0)
Errors::in_text_file("second target opened while first is still open", tfp);
Str::copy(ihs->scanning_target, mr.exp[0]);
if (Str::eq(ihs->scanning_target, ihs->desired_target)) ihs->found_aim = TRUE;
} else if (Regexp::match(&mr, cl, L" *} *")) {
} else if (Regexp::match(&mr, cl, U" *} *")) {
if (Str::len(ihs->scanning_target) == 0)
Errors::in_text_file("unexpected target end-marker", tfp);
Str::clear(ihs->scanning_target);
@ -236,14 +236,14 @@ void Instructions::read_instructions_helper(text_stream *cl, text_file_position
(Str::eq(ihs->scanning_target, ihs->desired_target))) {
if (settings->verbose_mode)
PRINT("%f, line %d: %S\n", tfp->text_file_filename, tfp->line_count, cl);
if (Regexp::match(&mr, cl, L" *follow: *(%c*?) *")) {
if (Regexp::match(&mr, cl, U" *follow: *(%c*?) *")) {
if (Instructions::read_instructions_from(
Filenames::in(settings->book_folder, mr.exp[0]),
ihs->desired_target, settings))
ihs->found_aim = TRUE;
} else if (Regexp::match(&mr, cl, L" *declare: *(%c*?) *")) {
} else if (Regexp::match(&mr, cl, U" *declare: *(%c*?) *")) {
Symbols::declare_symbol(mr.exp[0]);
} else if (Regexp::match(&mr, cl, L" *undeclare: *(%c*?) *")) {
} else if (Regexp::match(&mr, cl, U" *undeclare: *(%c*?) *")) {
Symbols::undeclare_symbol(mr.exp[0]);
} else @<This is an instruction@>;
}
@ -252,25 +252,25 @@ void Instructions::read_instructions_helper(text_stream *cl, text_file_position
}
@<This is an instruction@> =
if (Regexp::match(&mr, cl, L" *volume: *(%c*?) *")) {
if (Regexp::match(&mr, cl, U" *volume: *(%c*?) *")) {
@<Disallow this in a specific target@>;
@<Act on a volume creation@>
} else if (Regexp::match(&mr, cl, L" *cover: *(%c*?) *")) {
} else if (Regexp::match(&mr, cl, U" *cover: *(%c*?) *")) {
@<Disallow this in a specific target@>;
settings->book_cover_image = Instructions::set_file(mr.exp[0], settings);
} else if (Regexp::match(&mr, cl, L" *examples *")) {
} else if (Regexp::match(&mr, cl, U" *examples *")) {
@<Disallow this in a specific target@>;
settings->book_contains_examples = TRUE;
} else if (Regexp::match(&mr, cl, L" *dc:(%C+): *(%c*?) *")) {
} else if (Regexp::match(&mr, cl, U" *dc:(%C+): *(%c*?) *")) {
@<Disallow this in a specific target@>;
Instructions::create_ebook_metadata(Str::duplicate(mr.exp[0]), Str::duplicate(mr.exp[1]));
} else if (Regexp::match(&mr, cl, L" *css: *(%c*?) *")) {
} else if (Regexp::match(&mr, cl, U" *css: *(%c*?) *")) {
@<Act on a CSS tweak@>;
} else if (Regexp::match(&mr, cl, L" *index: *(%c*?) *")) {
} else if (Regexp::match(&mr, cl, U" *index: *(%c*?) *")) {
@<Act on an indexing notation@>;
} else if (Regexp::match(&mr, cl, L" *images: *(%c*?) *")) {
} else if (Regexp::match(&mr, cl, U" *images: *(%c*?) *")) {
HTMLUtilities::add_image_source(Instructions::set_path(mr.exp[0], settings));
} else if (Regexp::match(&mr, cl, L" *(%C+) *= *(%c*?) *")) {
} else if (Regexp::match(&mr, cl, U" *(%C+) *= *(%c*?) *")) {
@<Act on an instructions setting@>;
} else {
Errors::in_text_file("unknown syntax in instructions file", tfp);
@ -296,12 +296,12 @@ which reads:
TEMPORARY_TEXT(file)
TEMPORARY_TEXT(abbrev)
match_results mr2 = Regexp::create_mr();
if (Regexp::match(&mr2, title, L"(%c+?) *= *(%c+?)")) { /* the optional filename syntax */
if (Regexp::match(&mr2, title, U"(%c+?) *= *(%c+?)")) { /* the optional filename syntax */
Str::copy(title, mr2.exp[0]); Str::copy(file, mr2.exp[1]);
} else {
WRITE_TO(file, "%S.txt", title);
}
if (Regexp::match(&mr2, title, L"(%c*?) *%((%c*?)%)")) { /* the optional abbreviation syntax */
if (Regexp::match(&mr2, title, U"(%c*?) *%((%c*?)%)")) { /* the optional abbreviation syntax */
Str::copy(title, mr2.exp[0]); Str::copy(abbrev, mr2.exp[1]);
}
Scanner::create_volume(settings->book_folder, file, title, abbrev);
@ -313,11 +313,11 @@ which reads:
text_stream *tweak = mr.exp[0];
match_results mr2 = Regexp::create_mr();
match_results mr3 = Regexp::create_mr();
if (Regexp::match(&mr2, tweak, L"(%C+)text(%C+) = (%C+)")) {
if (Regexp::match(&mr2, tweak, U"(%C+)text(%C+) = (%C+)")) {
CSS::add_span_notation(mr2.exp[0], mr2.exp[1], mr2.exp[2], MARKUP_SPP);
} else {
volume *act_on = NULL;
if (Regexp::match(&mr2, tweak, L"(%C+) *: *(%c+)")) {
if (Regexp::match(&mr2, tweak, U"(%C+) *: *(%c+)")) {
text_stream *abbrev = mr2.exp[0];
Str::copy(tweak, mr2.exp[1]);
volume *V;
@ -326,19 +326,19 @@ which reads:
act_on = V;
if (act_on == NULL) Errors::in_text_file("unknown volume abbreviation", tfp);
}
if (Regexp::match(&mr2, tweak, L"(%c+?) *{ *")) {
if (Regexp::match(&mr2, tweak, U"(%c+?) *{ *")) {
int plus = 0;
text_stream *tag = mr2.exp[0];
TEMPORARY_TEXT(want)
TEMPORARY_TEXT(ncl)
while ((TextFiles::read_line(ncl, FALSE, tfp)), (Str::len(ncl) > 0)) {
Str::trim_white_space(ncl);
if (Regexp::match(&mr3, ncl, L" *} *")) break;
if (Regexp::match(&mr3, ncl, U" *} *")) break;
WRITE_TO(want, "%S\n", ncl);
}
DISCARD_TEXT(ncl)
if (Regexp::match(&mr3, tag, L"(%c*?) *%+%+ *")) { plus = 2; tag = mr3.exp[0]; }
else if (Regexp::match(&mr3, tag, L"(%c*?) *%+ *")) { plus = 1; tag = mr3.exp[0]; }
if (Regexp::match(&mr3, tag, U"(%c*?) *%+%+ *")) { plus = 2; tag = mr3.exp[0]; }
else if (Regexp::match(&mr3, tag, U"(%c*?) *%+ *")) { plus = 1; tag = mr3.exp[0]; }
CSS::request_css_tweak(act_on, tag, want, plus);
DISCARD_TEXT(want)
} else Errors::in_text_file("bad CSS tweaking syntax", tfp);
@ -350,15 +350,15 @@ which reads:
text_stream *tweak = mr.exp[0];
match_results mr2 = Regexp::create_mr();
if (settings->test_index_mode) PRINT("Read in: %S\n", tweak);
if (Regexp::match(&mr2, tweak, L"^{(%C*)headword(%C*)} = (%C+) *(%c*)")) {
if (Regexp::match(&mr2, tweak, U"^{(%C*)headword(%C*)} = (%C+) *(%c*)")) {
Indexes::add_indexing_notation(mr2.exp[0], mr2.exp[1], mr2.exp[2], mr2.exp[3]);
} else if (Regexp::match(&mr2, tweak, L"{(%C+?)} = (%C+) *(%c*)")) {
} else if (Regexp::match(&mr2, tweak, U"{(%C+?)} = (%C+) *(%c*)")) {
Indexes::add_indexing_notation_for_symbols(mr2.exp[0], mr2.exp[1], mr2.exp[2]);
} else if (Regexp::match(&mr2, tweak, L"definition = (%C+) *(%c*)")) {
} else if (Regexp::match(&mr2, tweak, U"definition = (%C+) *(%c*)")) {
Indexes::add_indexing_notation_for_definitions(mr2.exp[0], mr2.exp[1], NULL);
} else if (Regexp::match(&mr2, tweak, L"(%C+)-definition = (%C+) *(%c*)")) {
} else if (Regexp::match(&mr2, tweak, U"(%C+)-definition = (%C+) *(%c*)")) {
Indexes::add_indexing_notation_for_definitions(mr2.exp[1], mr2.exp[2], mr2.exp[0]);
} else if (Regexp::match(&mr2, tweak, L"example = (%C+) *(%c*)")) {
} else if (Regexp::match(&mr2, tweak, U"example = (%C+) *(%c*)")) {
Indexes::add_indexing_notation_for_examples(mr2.exp[0], mr2.exp[1]);
} else {
Errors::in_text_file("bad indexing notation", tfp);
@ -381,7 +381,7 @@ taste). In a multiple-line value, each line is terminated with a newline.
match_results mr2 = Regexp::create_mr();
TEMPORARY_TEXT(ncl)
while ((TextFiles::read_line(ncl, FALSE, tfp)), (Str::len(ncl) > 0)) {
if (Regexp::match(&mr2, ncl, L" *} *")) break;
if (Regexp::match(&mr2, ncl, U" *} *")) break;
WRITE_TO(val, "%S\n", ncl);
}
DISCARD_TEXT(ncl)
@ -389,84 +389,84 @@ taste). In a multiple-line value, each line is terminated with a newline.
}
@<Set an instructions option@> =
if (Str::eq_wide_string(key, L"alphabetization")) {
if (Str::eq_wide_string(val, L"word-by-word"))
if (Str::eq_wide_string(key, U"alphabetization")) {
if (Str::eq_wide_string(val, U"word-by-word"))
settings->index_alphabetisation_algorithm = WORD_ALPHABETIZATION;
else if (Str::eq_wide_string(val, L"letter-by-letter"))
else if (Str::eq_wide_string(val, U"letter-by-letter"))
settings->index_alphabetisation_algorithm = LETTER_ALPHABETIZATION;
else Errors::in_text_file("no such alphabetization", tfp);
}
else if (Str::eq_wide_string(key, L"assume_Public_Library"))
else if (Str::eq_wide_string(key, U"assume_Public_Library"))
settings->assume_Public_Library = Instructions::set_yn(key, val, tfp);
else if (Str::eq_wide_string(key, L"change_logs_directory"))
else if (Str::eq_wide_string(key, U"change_logs_directory"))
settings->change_logs_folder = Instructions::set_path(val, settings);
else if (Str::eq_wide_string(key, L"contents_leafname"))
else if (Str::eq_wide_string(key, U"contents_leafname"))
settings->contents_leafname = Str::duplicate(val);
else if (Str::eq_wide_string(key, L"contents_expandable"))
else if (Str::eq_wide_string(key, U"contents_expandable"))
settings->contents_expandable = Instructions::set_yn(key, val, tfp);
else if (Str::eq_wide_string(key, L"css_source_file")) { settings->css_source_file = Instructions::set_file(val, settings); }
else if (Str::eq_wide_string(key, L"definitions_filename")) { settings->definitions_filename = Instructions::set_file(val, settings); }
else if (Str::eq_wide_string(key, L"definitions_index_filename")) {
else if (Str::eq_wide_string(key, U"css_source_file")) { settings->css_source_file = Instructions::set_file(val, settings); }
else if (Str::eq_wide_string(key, U"definitions_filename")) { settings->definitions_filename = Instructions::set_file(val, settings); }
else if (Str::eq_wide_string(key, U"definitions_index_filename")) {
settings->definitions_index_leafname = Str::duplicate(val); }
else if (Str::eq_wide_string(key, L"destination")) {
else if (Str::eq_wide_string(key, U"destination")) {
if (settings->destination_modifiable)
settings->destination = Instructions::set_path(val, settings);
}
else if (Str::eq_wide_string(key, L"examples_directory")) {
else if (Str::eq_wide_string(key, U"examples_directory")) {
settings->examples_directory = Instructions::set_path(val, settings); }
else if (Str::eq_wide_string(key, L"examples_alphabetical_leafname")) {
else if (Str::eq_wide_string(key, U"examples_alphabetical_leafname")) {
settings->examples_alphabetical_leafname = Str::duplicate(val); }
else if (Str::eq_wide_string(key, L"examples_granularity")) {
else if (Str::eq_wide_string(key, U"examples_granularity")) {
settings->examples_granularity = Instructions::set_range(key, val, 1, 3, tfp); }
else if (Str::eq_wide_string(key, L"examples_mode")) {
if (Str::eq_wide_string(val, L"open")) { settings->examples_mode = EXMODE_open_internal; }
else if (Str::eq_wide_string(val, L"openable")) { settings->examples_mode = EXMODE_openable_internal; }
else if (Str::eq_wide_string(key, U"examples_mode")) {
if (Str::eq_wide_string(val, U"open")) { settings->examples_mode = EXMODE_open_internal; }
else if (Str::eq_wide_string(val, U"openable")) { settings->examples_mode = EXMODE_openable_internal; }
else Errors::in_text_file("no such examples mode", tfp);
}
else if (Str::eq_wide_string(key, L"examples_numerical_leafname")) {
else if (Str::eq_wide_string(key, U"examples_numerical_leafname")) {
settings->examples_numerical_leafname = Str::duplicate(val); }
else if (Str::eq_wide_string(key, L"examples_thematic_leafname")) {
else if (Str::eq_wide_string(key, U"examples_thematic_leafname")) {
settings->examples_thematic_leafname = Str::duplicate(val); }
else if (Str::eq_wide_string(key, L"format")) {
if (Str::eq_wide_string(val, L"HTML")) { settings->format = HTML_FORMAT; }
else if (Str::eq_wide_string(val, L"text")) { settings->format = PLAIN_FORMAT; }
else if (Str::eq_wide_string(key, U"format")) {
if (Str::eq_wide_string(val, U"HTML")) { settings->format = HTML_FORMAT; }
else if (Str::eq_wide_string(val, U"text")) { settings->format = PLAIN_FORMAT; }
else Errors::in_text_file("no such format", tfp);
}
else if (Str::eq_wide_string(key, L"granularity")) { settings->granularity = Instructions::set_range(key, val, 1, 3, tfp); }
else if (Str::eq_wide_string(key, L"html_for_Inform_application")) {
else if (Str::eq_wide_string(key, U"granularity")) { settings->granularity = Instructions::set_range(key, val, 1, 3, tfp); }
else if (Str::eq_wide_string(key, U"html_for_Inform_application")) {
settings->html_for_Inform_application = Instructions::set_yn(key, val, tfp); }
else if (Str::eq_wide_string(key, L"images_path")) { settings->images_path = Instructions::set_path(val, settings); }
else if (Str::eq_wide_string(key, L"images_copy")) { settings->images_copy = Instructions::set_yn(key, val, tfp); }
else if (Str::eq_wide_string(key, L"inform_definitions_mode")) {
else if (Str::eq_wide_string(key, U"images_path")) { settings->images_path = Instructions::set_path(val, settings); }
else if (Str::eq_wide_string(key, U"images_copy")) { settings->images_copy = Instructions::set_yn(key, val, tfp); }
else if (Str::eq_wide_string(key, U"inform_definitions_mode")) {
settings->inform_definitions_mode = Instructions::set_yn(key, val, tfp); }
else if (Str::eq_wide_string(key, L"javascript")) { settings->javascript = Instructions::set_yn(key, val, tfp); }
else if (Str::eq_wide_string(key, L"link_to_extensions_index")) {
else if (Str::eq_wide_string(key, U"javascript")) { settings->javascript = Instructions::set_yn(key, val, tfp); }
else if (Str::eq_wide_string(key, U"link_to_extensions_index")) {
settings->link_to_extensions_index = Str::duplicate(val); }
else if (Str::eq_wide_string(key, L"manifest_leafname")) { settings->manifest_leafname = Str::duplicate(val); }
else if (Str::eq_wide_string(key, L"navigation")) {
else if (Str::eq_wide_string(key, U"manifest_leafname")) { settings->manifest_leafname = Str::duplicate(val); }
else if (Str::eq_wide_string(key, U"navigation")) {
settings->navigation = Nav::parse(val);
if (settings->navigation == NULL) Errors::in_text_file("no such navigation mode", tfp);
}
else if (Str::eq_wide_string(key, L"retina_images")) {
else if (Str::eq_wide_string(key, U"retina_images")) {
settings->retina_images = Instructions::set_yn(key, val, tfp); }
else if (Str::eq_wide_string(key, L"support_creation")) {
else if (Str::eq_wide_string(key, U"support_creation")) {
settings->support_creation = Instructions::set_yn(key, val, tfp); }
else if (Str::eq_wide_string(key, L"suppress_fonts")) {
else if (Str::eq_wide_string(key, U"suppress_fonts")) {
settings->suppress_fonts = Instructions::set_yn(key, val, tfp); }
else if (Str::eq_wide_string(key, L"toc_granularity")) {
else if (Str::eq_wide_string(key, U"toc_granularity")) {
settings->toc_granularity = Instructions::set_range(key, val, 1, 3, tfp); }
else if (Str::eq_wide_string(key, L"top_and_tail_sections")) {
else if (Str::eq_wide_string(key, U"top_and_tail_sections")) {
settings->top_and_tail_sections = Instructions::set_file(val, settings); }
else if (Str::eq_wide_string(key, L"top_and_tail")) { settings->top_and_tail = Instructions::set_file(val, settings); }
else if (Str::eq_wide_string(key, L"treat_code_as_verbatim")) {
else if (Str::eq_wide_string(key, U"top_and_tail")) { settings->top_and_tail = Instructions::set_file(val, settings); }
else if (Str::eq_wide_string(key, U"treat_code_as_verbatim")) {
settings->treat_code_as_verbatim = Instructions::set_yn(key, val, tfp); }
else if (Str::eq_wide_string(key, L"wrapper")) {
if (Str::eq_wide_string(val, L"EPUB")) { settings->wrapper = WRAPPER_epub; }
else if (Str::eq_wide_string(val, L"zip")) { settings->wrapper = WRAPPER_zip; }
else if (Str::eq_wide_string(val, L"none")) { settings->wrapper = WRAPPER_none; }
else if (Str::eq_wide_string(key, U"wrapper")) {
if (Str::eq_wide_string(val, U"EPUB")) { settings->wrapper = WRAPPER_epub; }
else if (Str::eq_wide_string(val, U"zip")) { settings->wrapper = WRAPPER_zip; }
else if (Str::eq_wide_string(val, U"none")) { settings->wrapper = WRAPPER_none; }
else Errors::in_text_file("no such wrapper", tfp);
}
else if (Str::eq_wide_string(key, L"XHTML")) { settings->XHTML = Instructions::set_yn(key, val, tfp); }
else if (Str::eq_wide_string(key, U"XHTML")) { settings->XHTML = Instructions::set_yn(key, val, tfp); }
else Errors::in_text_file("no such setting", tfp);
@ -565,7 +565,7 @@ filename *Instructions::set_file(text_stream *val, settings_block *settings) {
int Instructions::set_range(text_stream *key, text_stream *val,
int min, int max, text_file_position *tfp) {
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, val, L"%d+")) {
if (Regexp::match(&mr, val, U"%d+")) {
int v = Str::atoi(val, 0);
Regexp::dispose_of(&mr);
if ((v >= min) && (v <= max)) return v;
@ -581,8 +581,8 @@ int Instructions::set_range(text_stream *key, text_stream *val,
=
int Instructions::set_yn(text_stream *key, text_stream *val, text_file_position *tfp) {
if (Str::eq_wide_string(val, L"yes")) { return 1; }
if (Str::eq_wide_string(val, L"no")) { return 0; }
if (Str::eq_wide_string(val, U"yes")) { return 1; }
if (Str::eq_wide_string(val, U"no")) { return 0; }
TEMPORARY_TEXT(ERM)
WRITE_TO(ERM, "'%S' must be 'yes' or 'no', not '%S'", key, val);
Errors::in_text_file_S(ERM, tfp);
@ -608,7 +608,7 @@ void Instructions::create_ebook_metadata(text_stream *key, text_stream *value) {
void Instructions::apply_ebook_metadata(ebook *E) {
dc_metadatum *dcm;
LOOP_OVER(dcm, dc_metadatum) {
wchar_t K[1024];
inchar32_t K[1024];
Str::copy_to_wide_string(K, dcm->dc_key, 1024);
Epub::attach_metadata(E, K, dcm->dc_val);
}

View file

@ -41,9 +41,9 @@ emphasis; and are also used to mark headwords for indexing, as in
=
typedef struct span_notation {
int sp_purpose; /* one of the |*_SPP| constants */
wchar_t sp_left[MAX_PATTERN_LENGTH]; /* wide C string: the start pattern */
inchar32_t sp_left[MAX_PATTERN_LENGTH]; /* wide C string: the start pattern */
int sp_left_len;
wchar_t sp_right[MAX_PATTERN_LENGTH]; /* wide C string: and end pattern */
inchar32_t sp_right[MAX_PATTERN_LENGTH]; /* wide C string: and end pattern */
int sp_right_len;
struct text_stream *sp_style;
CLASS_DEFINITION
@ -125,7 +125,7 @@ void CSS::construct_helper(text_stream *line, text_file_position *tfp,
CSS::expand_IMAGES(line);
WRITE("%S\n", line);
} else {
if (Regexp::match(NULL, line, L"%c*BEGIN%c*")) chs->tx_mode = TRUE;
if (Regexp::match(NULL, line, U"%c*BEGIN%c*")) chs->tx_mode = TRUE;
}
}
@ -134,9 +134,9 @@ all CSS files, but here we know that |base.css| is tidily written.
@<Apply CSS modifications requested by the instructions@> =
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, line, L"(%c*?) *{"))
if (Regexp::match(&mr, line, U"(%c*?) *{"))
Str::copy(chs->this_style, mr.exp[0]);
else if (Regexp::match(&mr, line, L" *}")) {
else if (Regexp::match(&mr, line, U" *}")) {
Str::clear(chs->this_style); chs->this_style_tweaked = 0;
} else {
CSS_tweak_data *TD;
@ -167,7 +167,7 @@ all CSS files, but here we know that |base.css| is tidily written.
if (TD->css_plus > 0) {
keep = TRUE;
match_results mr2 = Regexp::create_mr();
if (Regexp::match(&mr2, line, L" *(%C+):%c*")) {
if (Regexp::match(&mr2, line, U" *(%C+):%c*")) {
text_stream *tag = mr2.exp[0];
if (Str::includes(TD->css_tweak, tag)) keep = FALSE;
}
@ -209,15 +209,15 @@ all CSS files, but here we know that |base.css| is tidily written.
void CSS::expand_IMAGES(text_stream *text) {
match_results mr = Regexp::create_mr();
if (indoc_settings->suppress_fonts) {
while (Regexp::match(&mr, text, L"(%c*?)font-family:(%c*?);(%c*)")) {
while (Regexp::match(&mr, text, U"(%c*?)font-family:(%c*?);(%c*)")) {
text_stream *L = mr.exp[0], *M = NULL, *R = mr.exp[2];
if (Regexp::match(NULL, mr.exp[1], L"%c*monospace%c*")) M = I"___MONOSPACE___";
if (Regexp::match(NULL, mr.exp[1], U"%c*monospace%c*")) M = I"___MONOSPACE___";
Str::clear(text);
WRITE_TO(text, "%S%S%S", L, M, R);
}
Regexp::replace(text, L"___MONOSPACE___", L"font-family: monospace;", REP_REPEATING);
Regexp::replace(text, U"___MONOSPACE___", U"font-family: monospace;", REP_REPEATING);
}
while (Regexp::match(&mr, text, L"(%c*?)'IMAGES/(%c*?)'(%c*)")) {
while (Regexp::match(&mr, text, U"(%c*?)'IMAGES/(%c*?)'(%c*)")) {
text_stream *L = mr.exp[0], *name = mr.exp[1], *R = mr.exp[2];
Str::clear(text);
WRITE_TO(text, "%S'", L);
@ -253,14 +253,14 @@ expression parser:
=
void CSS::make_regex_safe(text_stream *text) {
Regexp::replace(text, L"%%", L"%%%", REP_REPEATING);
Regexp::replace(text, L"%(", L"%%(", REP_REPEATING);
Regexp::replace(text, L"%)", L"%%)", REP_REPEATING);
Regexp::replace(text, L"%+", L"%%+", REP_REPEATING);
Regexp::replace(text, L"%*", L"%%*", REP_REPEATING);
Regexp::replace(text, L"%?", L"%%?", REP_REPEATING);
Regexp::replace(text, L"%[", L"%%[", REP_REPEATING);
Regexp::replace(text, L"%]", L"%%]", REP_REPEATING);
Regexp::replace(text, U"%%", U"%%%", REP_REPEATING);
Regexp::replace(text, U"%(", U"%%(", REP_REPEATING);
Regexp::replace(text, U"%)", U"%%)", REP_REPEATING);
Regexp::replace(text, U"%+", U"%%+", REP_REPEATING);
Regexp::replace(text, U"%*", U"%%*", REP_REPEATING);
Regexp::replace(text, U"%?", U"%%?", REP_REPEATING);
Regexp::replace(text, U"%[", U"%%[", REP_REPEATING);
Regexp::replace(text, U"%]", U"%%]", REP_REPEATING);
}
@ The following looks slow, but in fact there's no problem in practice.

View file

@ -124,15 +124,15 @@ void Examples::examples_helper(text_stream *line, text_file_position *tfp, void
E->ex_header_length++;
match_results mr = Regexp::create_mr();
if (tfp->line_count == 1) {
if (Regexp::match(&mr, line, L"Example *: *(%*+) (%c*)")) {
if (Regexp::match(&mr, line, U"Example *: *(%*+) (%c*)")) {
text_stream *asterisk_text = mr.exp[0];
text_stream *name = mr.exp[1];
E->ex_stars = Str::duplicate(asterisk_text);
int starc = 0;
if (Str::eq_wide_string(E->ex_stars, L"*")) starc=1;
if (Str::eq_wide_string(E->ex_stars, L"**")) starc=2;
if (Str::eq_wide_string(E->ex_stars, L"***")) starc=3;
if (Str::eq_wide_string(E->ex_stars, L"****")) starc=4;
if (Str::eq_wide_string(E->ex_stars, U"*")) starc=1;
if (Str::eq_wide_string(E->ex_stars, U"**")) starc=2;
if (Str::eq_wide_string(E->ex_stars, U"***")) starc=3;
if (Str::eq_wide_string(E->ex_stars, U"****")) starc=4;
if (starc == 0) {
Errors::in_text_file("star count for example must be * to ****", tfp);
starc = 1;
@ -146,7 +146,7 @@ void Examples::examples_helper(text_stream *line, text_file_position *tfp, void
Errors::in_text_file("first line should read 'Example: ** Title'", tfp);
}
} else {
if (Regexp::match(&mr, line, L"(%C+?) *: *(%c*)")) {
if (Regexp::match(&mr, line, U"(%C+?) *: *(%c*)")) {
text_stream *field = mr.exp[0];
text_stream *content = mr.exp[1];
if (Str::eq(field, I"Example")) {

View file

@ -445,7 +445,7 @@ void HTMLUtilities::defn_unpack(OUTPUT_STREAM, text_stream *given_defn, volume *
}
@<Given alternates divided by an ampersand, recurse to unpack each in turn@> =
if (Regexp::match(&mr, given_defn, L"(%c*?) & (%c*)")) {
if (Regexp::match(&mr, given_defn, U"(%c*?) & (%c*)")) {
HTMLUtilities::defn_unpack(OUT, mr.exp[0], V, S, anchor);
HTML_TAG("br");
WRITE("<i>or:</i>&#160;&#160;&#160;");
@ -456,8 +456,8 @@ void HTMLUtilities::defn_unpack(OUTPUT_STREAM, text_stream *given_defn, volume *
@<Work out an index mark for this definition@> =
Str::copy(index_as, given_defn);
if (indoc_settings->inform_definitions_mode) Regexp::replace(index_as, L" ...%c*", NULL, 0);
Regexp::replace(index_as, L": *", NULL, 0);
if (indoc_settings->inform_definitions_mode) Regexp::replace(index_as, U" ...%c*", NULL, 0);
Regexp::replace(index_as, U": *", NULL, 0);
WRITE_TO(index_as, "=___=!definition");
Indexes::mark_index_term(index_as, V, S, anchor, NULL, NULL, NULL);
@ -465,26 +465,26 @@ void HTMLUtilities::defn_unpack(OUTPUT_STREAM, text_stream *given_defn, volume *
TEMPORARY_TEXT(proto)
HTML::open(proto, "p", I"class='defnprototype'", __FILE__, __LINE__);
/* given alternative wordings, put only the first in boldface */
Regexp::replace(defn, L"(%i+?)/(%C+)", L"%0</b>/%1<b>", REP_REPEATING);
Regexp::replace(defn, U"(%i+?)/(%C+)", U"%0</b>/%1<b>", REP_REPEATING);
WRITE_TO(proto, "<b>%S</b>", defn);
HTML::close(proto, "p", __FILE__, __LINE__);
Str::copy(defn, proto);
@<Set the kind of the result of the phrase in italic, not bold@> =
if (Regexp::match(&mr, defn, L"(%c*) ... (%c*?)</b>")) {
if (Regexp::match(&mr, defn, U"(%c*) ... (%c*?)</b>")) {
WRITE_TO(defn, "%S</b> ... <i>", mr.exp[0]);
Regexp::replace(mr.exp[1], L"<b>", NULL, REP_REPEATING);
Regexp::replace(mr.exp[1], L"</b>", NULL, REP_REPEATING);
Regexp::replace(mr.exp[1], U"<b>", NULL, REP_REPEATING);
Regexp::replace(mr.exp[1], U"</b>", NULL, REP_REPEATING);
WRITE_TO(defn, "%S</i>", mr.exp[1]);
}
@<Specially set and specially index a phrase to decide a condition@> =
if ((Regexp::match(&mr, defn, L"<b>if (%c*)")) &&
(Regexp::match(NULL, defn, L"%c*a condition%c*"))) {
if ((Regexp::match(&mr, defn, U"<b>if (%c*)")) &&
(Regexp::match(NULL, defn, U"%c*a condition%c*"))) {
WRITE_TO(defn, "<i>if</i> <b>%S", mr.exp[0]);
Regexp::replace(index_as, L"if ", NULL, REP_ATSTART);
Regexp::replace(index_as, U"if ", NULL, REP_ATSTART);
text_stream *index_alph = NULL;
if (Regexp::match(&mr, index_as, L"%(%c*?%) (%c*)")) index_alph = mr.exp[0];
if (Regexp::match(&mr, index_as, U"%(%c*?%) (%c*)")) index_alph = mr.exp[0];
TEMPORARY_TEXT(term)
WRITE_TO(term, "%S=___=!if-definition", index_as);
Indexes::mark_index_term(term, V, S, anchor, NULL, NULL, index_alph);
@ -492,11 +492,11 @@ void HTMLUtilities::defn_unpack(OUTPUT_STREAM, text_stream *given_defn, volume *
}
@<Specially set and specially index a text substitution@> =
if (Regexp::match(&mr, defn, L"<b>say \"%[(%c*)%]\"</b>")) {
if (Regexp::match(&mr, defn, U"<b>say \"%[(%c*)%]\"</b>")) {
WRITE_TO(defn, "say \"[<b>%S</b>]\"", mr.exp[0]);
Regexp::replace(index_as, L"say ", NULL, REP_ATSTART);
Regexp::replace(index_as, U"say ", NULL, REP_ATSTART);
text_stream *index_alph = NULL;
if (Regexp::match(&mr, index_as, L"%[%(?:%(%c*?%) %)?(%c*)%]")) index_alph = mr.exp[0];
if (Regexp::match(&mr, index_as, U"%[%(?:%(%c*?%) %)?(%c*)%]")) index_alph = mr.exp[0];
TEMPORARY_TEXT(term)
WRITE_TO(term, "%S=___=!say-definition", index_as);
Indexes::mark_index_term(term, V, S, anchor, NULL, NULL, index_alph);
@ -504,14 +504,14 @@ void HTMLUtilities::defn_unpack(OUTPUT_STREAM, text_stream *given_defn, volume *
}
@<Tidy up the definition paragraph@> =
Regexp::replace(defn, L"<b></b>", NULL, REP_REPEATING);
Regexp::replace(defn, L"</b><b>", NULL, REP_REPEATING);
Regexp::replace(defn, U"<b></b>", NULL, REP_REPEATING);
Regexp::replace(defn, U"</b><b>", NULL, REP_REPEATING);
TEMPORARY_TEXT(star)
Str::copy(star, defn);
Str::clear(defn);
int bl = 0;
while (Regexp::match(&mr, star, L"(%c)(%c*)")) {
while (Regexp::match(&mr, star, U"(%c)(%c*)")) {
text_stream *ch = mr.exp[0]; Str::copy(star, mr.exp[1]);
if (Str::eq(ch, I"(")) { if (bl == 0) WRITE_TO(defn, "</b>"); bl++; }
WRITE_TO(defn, "%S", ch);
@ -556,7 +556,7 @@ void HTMLUtilities::tt_helper(text_stream *line, text_file_position *tfp, void *
tt_helper_state *tths = (tt_helper_state *) v_tths;
Str::trim_white_space_at_end(line);
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, line, L"(%c*?)%[TEXT%](%c*)")) {
if (Regexp::match(&mr, line, U"(%c*?)%[TEXT%](%c*)")) {
WRITE_TO(tths->top_text, "%S", mr.exp[0]);
HTML::begin_div_with_id(tths->top_text, "bodytext");
HTML::end_div(tths->tail_text);

View file

@ -127,7 +127,7 @@ void Rawtext::process_large_helper(text_stream *rawl, text_file_position *tfp,
}
int shortened = Str::trim_white_space_at_end(rawl);
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, rawl, L"%[(%c*?)%] (%c*)"))
if (Regexp::match(&mr, rawl, U"%[(%c*?)%] (%c*)"))
@<Deal with a block heading@>
else if (rhs->skipping_current_block == FALSE) {
int suppress_p_tag = FALSE;
@ -171,7 +171,7 @@ be the first section.
rhs->skipping_current_block = FALSE;
match_results mr2 = Regexp::create_mr();
if (Regexp::match(&mr2, block_header, L"{(%c*?):}(%c*?)")) {
if (Regexp::match(&mr2, block_header, U"{(%c*?):}(%c*?)")) {
Str::copy(block_header, mr2.exp[1]);
if (Symbols::perform_ifdef(mr2.exp[0]) == FALSE) {
rhs->skipping_current_block = TRUE;
@ -185,7 +185,7 @@ be the first section.
@<Take note of documentation references@>;
Str::copy(rhs->title_of_block_being_read, title);
if (Regexp::match(&mr2, block_header, L"Chapter: (%c*)")) {
if (Regexp::match(&mr2, block_header, U"Chapter: (%c*)")) {
++(rhs->no_chapters_read_in_current_rawtext);
@<Prepare to read a new chapter of rawtext@>;
}
@ -198,7 +198,7 @@ be the first section.
[x] The footwear kind {kind_footwear}
=
@<Take note of documentation references@> =
while (Regexp::match(&mr2, title, L"(%c*) {(%C+)} *")) {
while (Regexp::match(&mr2, title, U"(%c*) {(%C+)} *")) {
Str::copy(title, mr2.exp[0]);
Updater::add_reference_symbol(mr2.exp[1], rhs->V,
(rhs->V)?(rhs->V->sections[rhs->no_blocks_written]):NULL);
@ -220,17 +220,17 @@ rectangles.)
CSS::expand_spannotations(rawl, MARKUP_SPP);
}
if (indoc_settings->format == HTML_FORMAT) Regexp::replace(rawl, L"<(%c*?)>", L"&lt;%0&gt;", REP_REPEATING);
if (indoc_settings->format == HTML_FORMAT) Regexp::replace(rawl, U"<(%c*?)>", U"&lt;%0&gt;", REP_REPEATING);
wchar_t *replacement = L"%1";
if (indoc_settings->format == HTML_FORMAT) replacement = L"<span class=\"%0\">%1</span>";
Regexp::replace(rawl, L"___mu___(%c*?)___mo___(%c*?)___mc___", replacement, REP_REPEATING);
inchar32_t *replacement = U"%1";
if (indoc_settings->format == HTML_FORMAT) replacement = U"<span class=\"%0\">%1</span>";
Regexp::replace(rawl, U"___mu___(%c*?)___mo___(%c*?)___mc___", replacement, REP_REPEATING);
@ The notation |///6X12.txt///| means "insert the change log for build 6X12 here".
It should be the only thing on its line.
@<Deal with an insert-change-log notation@> =
if (Regexp::match(&mr2, rawl, L"(%c*?)///(%c*?.txt)/// *")) {
if (Regexp::match(&mr2, rawl, U"(%c*?)///(%c*?.txt)/// *")) {
Str::copy(rawl, mr2.exp[0]);
if (indoc_settings->format == HTML_FORMAT) {
Str::clear(rawl);
@ -254,8 +254,8 @@ void Rawtext::process_change_log_helper(text_stream *sml, text_file_position *tf
void *v_rawl) {
text_stream *rawl = (text_stream *) v_rawl;
if (indoc_settings->format == HTML_FORMAT) {
Regexp::replace(sml, L"<", L"&lt;", REP_REPEATING);
Regexp::replace(sml, L">", L"&gt;", REP_REPEATING);
Regexp::replace(sml, U"<", U"&lt;", REP_REPEATING);
Regexp::replace(sml, U">", U"&gt;", REP_REPEATING);
}
WRITE_TO(rawl, "%S\n", sml);
}
@ -271,13 +271,13 @@ though only one of these may appear in each line. If the form
is used, then the image is styled as |img.classname|.
@<Deal with an insert-image notation@> =
while (Regexp::match(&mr2, rawl, L"(%c*?)///(%c*?)///(%c*)")) {
while (Regexp::match(&mr2, rawl, U"(%c*?)///(%c*?)///(%c*)")) {
text_stream *left = mr2.exp[0];
text_stream *name = mr2.exp[1];
text_stream *right = mr2.exp[2];
TEMPORARY_TEXT(cl)
match_results mr3 = Regexp::create_mr();
if (Regexp::match(&mr3, name, L"(%c*?): *(%c*)")) {
if (Regexp::match(&mr3, name, U"(%c*?): *(%c*)")) {
Str::copy(cl, mr3.exp[0]); Str::copy(name, mr3.exp[1]);
Regexp::dispose_of(&mr3);
}
@ -308,7 +308,7 @@ then act accordingly.
@<Deal with paragraph tags@> =
match_results mr3 = Regexp::create_mr();
match_results mr4 = Regexp::create_mr();
while (Regexp::match(&mr3, rawl, L"{(%c*?)}(%c*)")) {
while (Regexp::match(&mr3, rawl, U"{(%c*?)}(%c*)")) {
text_stream *paragraph_tag = mr3.exp[0];
Str::copy(rawl, mr3.exp[1]);
@ -333,7 +333,7 @@ throw the whole paragraph away. If we're generating for no specific platform
(for example, for the Inform website), we keep the paragraph but annotate it.
@<Deal with a conditional paragraph tag@> =
if (Regexp::match(&mr4, paragraph_tag, L"(%c*):")) {
if (Regexp::match(&mr4, paragraph_tag, U"(%c*):")) {
if (Symbols::perform_ifdef(mr4.exp[0])) continue;
abandon_para = TRUE; break;
}
@ -346,7 +346,7 @@ throw the whole paragraph away. If we're generating for no specific platform
=
@<Deal with a phrase definition paragraph tag@> =
if (Regexp::match(&mr4, paragraph_tag, L"defn *(%c*?)")) {
if (Regexp::match(&mr4, paragraph_tag, U"defn *(%c*?)")) {
text_stream *defn = mr4.exp[0];
TEMPORARY_TEXT(head)
Str::copy(head, rawl);
@ -359,7 +359,7 @@ throw the whole paragraph away. If we're generating for no specific platform
suppress_p_tag = TRUE;
continue;
}
if (Str::eq_wide_string(paragraph_tag, L"end")) {
if (Str::eq_wide_string(paragraph_tag, U"end")) {
Str::clear(rawl);
HTMLUtilities::end_definition_box(rawl);
suppress_p_tag = TRUE;
@ -367,7 +367,7 @@ throw the whole paragraph away. If we're generating for no specific platform
}
@<Deal with a CSS-styling paragraph tag@> =
if (Regexp::match(&mr4, paragraph_tag, L"(%c*)/")) {
if (Regexp::match(&mr4, paragraph_tag, U"(%c*)/")) {
Str::copy(css_style, mr4.exp[0]);
continue;
}
@ -400,7 +400,7 @@ in tag elements into |&quot;| escapes.
Str::copy(dequotee, rawl);
Str::clear(rawl);
match_results mr4 = Regexp::create_mr();
while (Regexp::match(&mr4, dequotee, L"(%c*?)<(%c*?)>(%c*)")) {
while (Regexp::match(&mr4, dequotee, U"(%c*?)<(%c*?)>(%c*)")) {
text_stream *L = mr4.exp[0]; text_stream *M = mr4.exp[1]; text_stream *R = mr4.exp[2];
Rawtext::escape_HTML_characters_in(L);
WRITE_TO(rawl, "%S<%S>", L, M);
@ -415,7 +415,7 @@ void Rawtext::escape_HTML_characters_in(text_stream *text) {
if (indoc_settings->format == HTML_FORMAT) {
TEMPORARY_TEXT(modified)
for (int i=0, L=Str::len(text); i<L; i++) {
int c = Str::get_at(text, i);
inchar32_t c = Str::get_at(text, i);
switch (c) {
case '\"': WRITE_TO(modified, "&quot;"); break;
case '<': WRITE_TO(modified, "&lt;"); break;

View file

@ -120,7 +120,7 @@ section names are capitalised for this purpose.)
@<Adapt the block title to the form of the title to test@> =
Str::copy(form_of_title_to_test, S->unlabelled_title);
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, form_of_title_to_test, L"(%d+.)* *(%c*)")) {
if (Regexp::match(&mr, form_of_title_to_test, U"(%d+.)* *(%c*)")) {
Str::copy(form_of_title_to_test, mr.exp[1]); Regexp::dispose_of(&mr);
}
if (V->allocation_id == 1)
@ -184,7 +184,7 @@ text_stream *Renderer::render_text_of_block(OUTPUT_STREAM, volume *V, section *S
text_stream *raw = paragraphs[i].par_texts;
match_results mr = Regexp::create_mr();
if ((indoc_settings->treat_code_as_verbatim == FALSE) &&
(Regexp::match(&mr, raw, L"{%*+} *(%c*)")))
(Regexp::match(&mr, raw, U"{%*+} *(%c*)")))
WRITE("%S\n", mr.exp[0]);
else
WRITE("%S\n", raw);
@ -208,7 +208,7 @@ text_stream *Renderer::render_text_of_block(OUTPUT_STREAM, volume *V, section *S
if (tabular_mode == FALSE) {
if (code_mode == FALSE) @<Enter code mode@>
else HTML_TAG("br");
if (Regexp::match(NULL, P->par_texts, L"%c*%C\t+%C%c*"))
if (Regexp::match(NULL, P->par_texts, U"%c*%C\t+%C%c*"))
@<Enter tabular mode@>;
}
if (tabular_mode)
@ -248,12 +248,12 @@ very much.
if (indoc_settings->treat_code_as_verbatim == FALSE) {
Regexp::replace(raw, L"{%*%*}", NULL, REP_REPEATING); /* Remove any paste-continuation marker */
Regexp::replace(raw, U"{%*%*}", NULL, REP_REPEATING); /* Remove any paste-continuation marker */
@<Take note of any named inline example@>;
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, raw, L"(%c*?){%*}(%c*)")) {
if (Regexp::match(&mr, raw, U"(%c*?){%*}(%c*)")) {
@<Convert this paste marker to a Javascript paste mechanism@>;
Regexp::dispose_of(&mr);
}
@ -270,8 +270,8 @@ very much.
@<Take note of any named inline example@> =
match_results mr = Regexp::create_mr();
if ((index_to_examples) &&
(Regexp::match(&mr, raw, L"{%*}&quot;(%c*)&quot;%c*")) &&
(Str::ne_wide_string(mr.exp[0], L"Midsummer Day"))) {
(Regexp::match(&mr, raw, U"{%*}&quot;(%c*)&quot;%c*")) &&
(Str::ne_wide_string(mr.exp[0], U"Midsummer Day"))) {
ExamplesIndex::add_to_alphabetic_examples_index(mr.exp[0], S, NULL, TRUE);
Regexp::dispose_of(&mr);
}
@ -308,10 +308,10 @@ people use the blank marker |--| explicitly if they want blanks.)
TEMPORARY_TEXT(row)
match_results mr = Regexp::create_mr();
Regexp::match(&mr, P->par_texts, L" *(%c*?) *");
Regexp::match(&mr, P->par_texts, U" *(%c*?) *");
Str::copy(row, mr.exp[0]); /* Strip leading and trailing space */
while (Regexp::match(&mr, row, L"(%c*?)\t+(%c*)")) {
while (Regexp::match(&mr, row, U"(%c*?)\t+(%c*)")) {
WRITE("%S", mr.exp[0]); /* Place a cell division at any run of one or more tabs */
HTML_CLOSE("p");
HTML_CLOSE("td");
@ -341,7 +341,7 @@ convert those to HTML links.
@<Look for cross-references and then render@> =
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, P->par_texts, L"%((-*)See {(%c*?)} for (%c*?).%) *")) {
if (Regexp::match(&mr, P->par_texts, U"%((-*)See {(%c*?)} for (%c*?).%) *")) {
if (Str::len(mr.exp[0]) == 0) {
Renderer::render_cross_reference(OUT, mr.exp[1], mr.exp[2], V, 0);
} else {
@ -349,7 +349,7 @@ convert those to HTML links.
Renderer::render_cross_reference(OUT, mr.exp[1], mr.exp[2], V, 1);
}
last_xref_type = 1;
} else if (Regexp::match(&mr, P->par_texts, L"%((-*)See (%c*?) for (%c*?).%) *")) {
} else if (Regexp::match(&mr, P->par_texts, U"%((-*)See (%c*?) for (%c*?).%) *")) {
if (Str::len(mr.exp[0]) == 0) {
Renderer::render_cross_reference(OUT, mr.exp[1], mr.exp[2], V, 0);
} else {
@ -357,7 +357,7 @@ convert those to HTML links.
Renderer::render_cross_reference(OUT, mr.exp[1], mr.exp[2], V, 1);
}
last_xref_type = 1;
} else if (Regexp::match(&mr, P->par_texts, L"%(See example &quot;(%c*?)&quot;%) *")) {
} else if (Regexp::match(&mr, P->par_texts, U"%(See example &quot;(%c*?)&quot;%) *")) {
if (last_xref_type == 1) { HTML_TAG("hr"); }
Renderer::render_example_cross_reference(OUT, mr.exp[0], V);
last_xref_type = 2;
@ -367,7 +367,7 @@ convert those to HTML links.
@ Blank lines are simply ignored.
@<Render a non-quotation paragraph to HTML@> =
if (Regexp::match(NULL, P->par_texts, L" *") == FALSE) {
if (Regexp::match(NULL, P->par_texts, U" *") == FALSE) {
WRITE("%S", P->par_prefix);
if (P->par_suppression == TRUE) {
WRITE("%S\n", P->par_texts);
@ -414,7 +414,7 @@ see below.
if (code_example) {
WRITE_TO(titling, "Example - ");
LOOP_THROUGH_TEXT(pos, code_example->ex_public_name) {
int c = Str::get(pos);
inchar32_t c = Str::get(pos);
if (c == '\'') WRITE_TO(titling, "\\'");
else PUT_TO(titling, c);
}
@ -472,7 +472,7 @@ down to the last line which is included in the paste.
for (l=up_to; ((l<no_paras_in_block_buffer) &&
(paragraphs[l].par_indentation == 0)); l++) { ; }
if ((l<no_paras_in_block_buffer) &&
(Regexp::match(NULL, paragraphs[l].par_texts, L"%c*{%*%*}%c*"))) {
(Regexp::match(NULL, paragraphs[l].par_texts, U"%c*{%*%*}%c*"))) {
for (l++; ((l<no_paras_in_block_buffer) &&
((paragraphs[l].par_indentation > 0) ||
(Str::len(paragraphs[l].par_texts) == 0))); l++) { ; }
@ -493,15 +493,16 @@ down to the last line which is included in the paste.
Str::copy(joinbit, br);
DISCARD_TEXT(br)
}
for (int k=0, L = Str::len(joinbit), prev_c = -1; k<L; k++) {
int c = Str::get_at(joinbit, k);
inchar32_t prev_c = 0;
for (int k=0, L = Str::len(joinbit); k<L; k++) {
inchar32_t c = Str::get_at(joinbit, k);
switch (c) {
case '\\': WRITE_TO(J_text, "___backslash___"); break;
case '\'': WRITE_TO(J_text, "\\'"); break;
case '\t': if (prev_c != '\t') WRITE_TO(J_text, "\\t"); break;
case '&': if (Str::includes_wide_string_at(joinbit, L"amp;", k+1)) k += 4;
case '&': if (Str::includes_wide_string_at(joinbit, U"amp;", k+1)) k += 4;
PUT_TO(J_text, c); break;
case '{': if (Str::includes_wide_string_at(joinbit, L"**}", k+1)) k += 3;
case '{': if (Str::includes_wide_string_at(joinbit, U"**}", k+1)) k += 3;
else PUT_TO(J_text, c); break;
default: PUT_TO(J_text, c); break;
}
@ -528,7 +529,7 @@ void Renderer::remove_paste_markers_from(text_stream *text, int i) {
TEMPORARY_TEXT(modified)
for (int j=0; j<i; j++) PUT_TO(modified, Str::get_at(text, j));
for (int L=Str::len(text); i<L; i++) {
int c = Str::get_at(text, i);
inchar32_t c = Str::get_at(text, i);
if ((c == '{') &&
(Str::get_at(text, i+1) == '*') &&
(Str::get_at(text, i+2) == '*') &&
@ -543,7 +544,7 @@ void Renderer::remove_paste_markers_from(text_stream *text, int i) {
void Renderer::apply_Inform_escape_characters(text_stream *text) {
TEMPORARY_TEXT(modified)
for (int i=0, L=Str::len(text); i<L; i++) {
int c = Str::get_at(text, i);
inchar32_t c = Str::get_at(text, i);
switch (c) {
case '\\':
c = Str::get_at(text, ++i);
@ -558,16 +559,16 @@ void Renderer::apply_Inform_escape_characters(text_stream *text) {
case '<': WRITE_TO(modified, "[=0x003C=]"); break;
case '>': WRITE_TO(modified, "[=0x003E=]"); break;
case '_':
if (Str::includes_wide_string_at(text, L"__backslash___", i+1)) {
if (Str::includes_wide_string_at(text, U"__backslash___", i+1)) {
WRITE_TO(modified, "[=0x005C=]"); i+=14;
} else PUT_TO(modified, c);
break;
case '&':
if (Str::includes_wide_string_at(text, L"quot;", i+1)) {
if (Str::includes_wide_string_at(text, U"quot;", i+1)) {
WRITE_TO(modified, "[=0x0022=]"); i+=5;
} else if (Str::includes_wide_string_at(text, L"lt;", i+1)) {
} else if (Str::includes_wide_string_at(text, U"lt;", i+1)) {
WRITE_TO(modified, "[=0x003C=]"); i+=3;
} else if (Str::includes_wide_string_at(text, L"gt;", i+1)) {
} else if (Str::includes_wide_string_at(text, U"gt;", i+1)) {
WRITE_TO(modified, "[=0x003E=]"); i+=3;
} else {
WRITE_TO(modified, "[=0x0026=]");
@ -686,7 +687,7 @@ with a |<head>| we make ourselves.
HTMLUtilities::get_tt_matter(top, 0, 1);
if (Str::len(top) > 0) {
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, top, L"(%c*?)<title>%c*?</title>(%c*)"))
if (Regexp::match(&mr, top, U"(%c*?)<title>%c*?</title>(%c*)"))
WRITE("%S<title>Inform 7 - %S</title>%S", mr.exp[0], S->section_file_title, mr.exp[1]);
else
WRITE("%S", top);

View file

@ -112,11 +112,11 @@ void Scanner::create_volume(pathname *book_path, text_stream *leaf, text_stream
if (Str::len(abbrev) == 0) {
int f = 0;
if (Str::begins_with_wide_string(title, L"A ")) f = 2;
else if (Str::begins_with_wide_string(title, L"An ")) f = 3;
else if (Str::begins_with_wide_string(title, L"The ")) f = 4;
if (Str::begins_with_wide_string(title, U"A ")) f = 2;
else if (Str::begins_with_wide_string(title, U"An ")) f = 3;
else if (Str::begins_with_wide_string(title, U"The ")) f = 4;
for (int i=f; i<Str::len(title); i++) {
int c = Str::get_at(title, i);
inchar32_t c = Str::get_at(title, i);
if (Characters::is_whitespace(c)) continue;
if ((c >= 'a') && (c <= 'z')) continue;
PUT_TO(abbrev, c);
@ -174,8 +174,8 @@ void Scanner::scan_rawtext_helper(text_stream *nl, text_file_position *tfp,
void *v_sr) {
sr_helper_state *sr = (sr_helper_state *) v_sr;
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, nl, L"(%c*?) ")) Str::copy(nl, mr.exp[0]);
if (Regexp::match(&mr, nl, L"%[(%c*?)%] (%c*)")) {
if (Regexp::match(&mr, nl, U"(%c*?) ")) Str::copy(nl, mr.exp[0]);
if (Regexp::match(&mr, nl, U"%[(%c*?)%] (%c*)")) {
section *S = CREATE(section);
S->next_section = NULL; S->previous_section = NULL;
S->begins_which_chapter = NULL;
@ -194,7 +194,7 @@ void Scanner::scan_rawtext_helper(text_stream *nl, text_file_position *tfp,
@<Strip away heading tags, but act on those filtering out the section@> =
match_results mr2 = Regexp::create_mr();
while (Regexp::match(&mr2, chi, L"{(%c*?:}(%c*)")) {
while (Regexp::match(&mr2, chi, U"{(%c*?:}(%c*)")) {
Str::copy(chi, mr2.exp[1]);
if (Symbols::perform_ifdef(mr2.exp[0]) == FALSE) {
Regexp::dispose_of(&mr);
@ -202,13 +202,13 @@ void Scanner::scan_rawtext_helper(text_stream *nl, text_file_position *tfp,
return;
}
}
while (Regexp::match(&mr2, stitle, L"(%c*) {%c*?} *")) Str::copy(stitle, mr2.exp[0]);
if (Regexp::match(&mr2, stitle, L"(%c*?) ")) Str::copy(stitle, mr2.exp[0]);
while (Regexp::match(&mr2, stitle, U"(%c*) {%c*?} *")) Str::copy(stitle, mr2.exp[0]);
if (Regexp::match(&mr2, stitle, U"(%c*?) ")) Str::copy(stitle, mr2.exp[0]);
Regexp::dispose_of(&mr2);
@<Deal with this as a chapter heading@> =
match_results mr2 = Regexp::create_mr();
if (Regexp::match(&mr2, chi, L"Chapter: (%c*)")) {
if (Regexp::match(&mr2, chi, U"Chapter: (%c*)")) {
chapter *C = CREATE(chapter);
sr->owner->chapters[sr->ch++] = C;
sr->chs = 0;

View file

@ -82,10 +82,10 @@ void Updater::definitions_helper(text_stream *line, text_file_position *tfp, voi
definitions_helper_state *dhs = (definitions_helper_state *) v_dhs;
Str::trim_white_space_at_end(line);
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, line, L" *<!--definition of (%c*?)--%c*")) {
if (Regexp::match(&mr, line, U" *<!--definition of (%c*?)--%c*")) {
WRITE_TO(dhs->OUT, "*=%S=*\n", mr.exp[0]);
dhs->transcribe = TRUE;
} else if (Regexp::match(&mr, line, L" *<!--end definition--%c*")) {
} else if (Regexp::match(&mr, line, U" *<!--end definition--%c*")) {
dhs->transcribe = FALSE;
} else if (dhs->transcribe) WRITE_TO(dhs->OUT, "%S\n", line);
Regexp::dispose_of(&mr);

View file

@ -68,11 +68,11 @@ void ExamplesIndex::write_alphabetical_examples_index(void) {
ExamplesIndex::sort_comparison);
TEMPORARY_TEXT(current_subtitle)
wchar_t current_letter = 0;
inchar32_t current_letter = 0;
int first_letter_block = TRUE;
for (int i=0; i<NUMBER_CREATED(example_index_data); i++) {
example_index_data *eid = eid_list[i];
wchar_t initial = Str::get_first_char(eid->sort_key);
inchar32_t initial = Str::get_first_char(eid->sort_key);
if (Characters::isdigit(initial)) initial = '#';
if (initial != current_letter) @<Start a new letter block@>;
TEMPORARY_TEXT(url)
@ -116,7 +116,7 @@ void ExamplesIndex::write_alphabetical_examples_index(void) {
@<Start a new letter block@> =
current_letter = initial;
if (first_letter_block == FALSE) { HTML_TAG("br"); @<End a letter block@>; }
wchar_t uc_current_letter = Characters::toupper(current_letter);
inchar32_t uc_current_letter = Characters::toupper(current_letter);
HTML_OPEN("tr");
HTML_OPEN_WITH("td", "class=\"letterblock\"");
TEMPORARY_TEXT(inc)

View file

@ -86,48 +86,48 @@ category:
ic->cat_name = Str::duplicate(name);
match_results mr = Regexp::create_mr();
ic->cat_glossed = Str::new();
if (Regexp::match(&mr, options, L"(%c*?) *%(\"(%c*?)\"%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(\"(%c*?)\"%) *(%c*)")) {
ic->cat_glossed = Str::duplicate(mr.exp[1]);
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[2]);
}
ic->cat_prefix = Str::new();
if (Regexp::match(&mr, options, L"(%c*?) *%(prefix \"(%c*?)\"%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(prefix \"(%c*?)\"%) *(%c*)")) {
ic->cat_prefix = Str::duplicate(mr.exp[1]);
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[2]);
}
ic->cat_suffix = Str::new();
if (Regexp::match(&mr, options, L"(%c*?) *%(suffix \"(%c*?)\"%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(suffix \"(%c*?)\"%) *(%c*)")) {
ic->cat_suffix = Str::duplicate(mr.exp[1]);
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[2]);
}
ic->cat_under = Str::new();
if (Regexp::match(&mr, options, L"(%c*?) *%(under {(%c*?)}%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(under {(%c*?)}%) *(%c*)")) {
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[2]);
ic->cat_under = Str::duplicate(mr.exp[1]);
}
ic->cat_alsounder = FALSE;
if (Regexp::match(&mr, options, L"(%c*?) *%(also under {(%c*?)}%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(also under {(%c*?)}%) *(%c*)")) {
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[2]);
ic->cat_under = Str::duplicate(mr.exp[1]);
ic->cat_alsounder = TRUE;
}
ic->cat_inverted = FALSE;
if (Regexp::match(&mr, options, L"(%c*?) *%(invert%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(invert%) *(%c*)")) {
ic->cat_inverted = TRUE;
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[1]);
}
ic->cat_bracketed = FALSE;
if (Regexp::match(&mr, options, L"(%c*?) *%(bracketed%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(bracketed%) *(%c*)")) {
ic->cat_bracketed = TRUE;
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[1]);
}
ic->cat_unbracketed = FALSE;
if (Regexp::match(&mr, options, L"(%c*?) *%(unbracketed%) *(%c*)")) {
if (Regexp::match(&mr, options, U"(%c*?) *%(unbracketed%) *(%c*)")) {
ic->cat_bracketed = TRUE;
ic->cat_unbracketed = TRUE;
Str::clear(options); WRITE_TO(options, "%S%S", mr.exp[0], mr.exp[1]);
}
if (Regexp::match(NULL, options, L"%c*?%C%c*"))
if (Regexp::match(NULL, options, U"%c*?%C%c*"))
Errors::with_text("Unknown notation options: %S", options);
ic->cat_usage = 0;
Regexp::dispose_of(&mr);
@ -140,17 +140,17 @@ int ito_registered = FALSE; /* used for the smoke test of the index */
void Indexes::scan_indexingnotations(text_stream *text, volume *V, section *S, example *E) {
match_results outer_mr = Regexp::create_mr();
match_results mr = Regexp::create_mr();
while (Regexp::match(&outer_mr, text, L"(%c*?)(%^+){(%c*?)}(%c*)")) {
while (Regexp::match(&outer_mr, text, U"(%c*?)(%^+){(%c*?)}(%c*)")) {
text_stream *left = outer_mr.exp[0];
text_stream *carets = outer_mr.exp[1];
text_stream *term_to_index = outer_mr.exp[2];
text_stream *right = outer_mr.exp[3];
TEMPORARY_TEXT(see)
TEMPORARY_TEXT(alphabetise_as)
if (Regexp::match(&mr, term_to_index, L"(%c+?) *<-- *(%c+) *")) {
if (Regexp::match(&mr, term_to_index, U"(%c+?) *<-- *(%c+) *")) {
Str::copy(term_to_index, mr.exp[0]); Str::copy(see, mr.exp[1]);
}
if (Regexp::match(&mr, term_to_index, L"(%c+?) *--> *(%c+) *")) {
if (Regexp::match(&mr, term_to_index, U"(%c+?) *--> *(%c+) *")) {
Str::copy(term_to_index, mr.exp[0]); Str::copy(alphabetise_as, mr.exp[1]);
}
TEMPORARY_TEXT(lemma)
@ -159,13 +159,13 @@ void Indexes::scan_indexingnotations(text_stream *text, volume *V, section *S, e
TEMPORARY_TEXT(midriff)
Str::copy(midriff, lemma);
Regexp::replace(midriff, L"%c*: ", NULL, REP_ATSTART);
Regexp::replace(midriff, L"=___=%C+", NULL, 0);
Regexp::replace(midriff, U"%c*: ", NULL, REP_ATSTART);
Regexp::replace(midriff, U"=___=%C+", NULL, 0);
if ((V->allocation_id > 0) && (E)) {
V = NULL; S = NULL; E = NULL;
}
if (Str::eq_wide_string(carets, L"^^^") == FALSE) {
if (Str::eq_wide_string(carets, U"^^^") == FALSE) {
Indexes::mark_index_term(lemma, V, S, NULL, E, NULL, alphabetise_as);
} else {
Indexes::note_index_term_alphabetisation(lemma, alphabetise_as);
@ -174,7 +174,7 @@ void Indexes::scan_indexingnotations(text_stream *text, volume *V, section *S, e
TEMPORARY_TEXT(smoke_test_text)
Indexes::process_category_options(smoke_test_text, lemma, TRUE, 1);
while (Regexp::match(&mr, see, L" *(%c+) *<-- *(%c+?) *")) {
while (Regexp::match(&mr, see, U" *(%c+) *<-- *(%c+?) *")) {
Str::copy(see, mr.exp[0]);
TEMPORARY_TEXT(seethis)
Indexes::extract_from_indexable_matter(seethis, mr.exp[1]);
@ -191,16 +191,16 @@ void Indexes::scan_indexingnotations(text_stream *text, volume *V, section *S, e
Indexes::process_category_options(smoke_test_text, seethis, TRUE, 3);
DISCARD_TEXT(seethis)
}
if (Str::eq_wide_string(carets, L"^") == FALSE) Str::clear(midriff);
if (Str::eq_wide_string(carets, U"^") == FALSE) Str::clear(midriff);
if (indoc_settings->test_index_mode) {
if (ito_registered == FALSE) {
ito_registered = TRUE;
CSS::add_span_notation(
I"___index_test_on___", I"___index_test_off___", I"smoketest", MARKUP_SPP);
}
Regexp::replace(smoke_test_text, L"=___=standard", L"", REP_REPEATING);
Regexp::replace(smoke_test_text, L"=___=(%C+)", L" %(%0%)", REP_REPEATING);
Regexp::replace(smoke_test_text, L":", L": ", REP_REPEATING);
Regexp::replace(smoke_test_text, U"=___=standard", U"", REP_REPEATING);
Regexp::replace(smoke_test_text, U"=___=(%C+)", U" %(%0%)", REP_REPEATING);
Regexp::replace(smoke_test_text, U":", U": ", REP_REPEATING);
WRITE_TO(midriff, "___index_test_on___%S___index_test_off___", smoke_test_text);
}
Str::clear(text);
@ -212,7 +212,7 @@ void Indexes::scan_indexingnotations(text_stream *text, volume *V, section *S, e
void Indexes::extract_from_indexable_matter(OUTPUT_STREAM, text_stream *text) {
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, text, L" *(%c+?) *: *(%c+) *")) {
if (Regexp::match(&mr, text, U" *(%c+?) *: *(%c+) *")) {
text_stream *head = mr.exp[0];
text_stream *tail = mr.exp[1];
Indexes::extract_from_indexable_matter(OUT, head);
@ -264,13 +264,13 @@ void Indexes::mark_index_term(text_stream *given_term, volume *V, section *S,
text_stream *anchor, example *E, text_stream *see, text_stream *alphabetise_as) {
TEMPORARY_TEXT(term)
Indexes::process_category_options(term, given_term, TRUE, 4);
if ((Regexp::match(NULL, term, L"IGNORE=___=ME%c*")) ||
(Regexp::match(NULL, term, L"%c*:IGNORE=___=ME%c*"))) return;
if ((Regexp::match(NULL, term, U"IGNORE=___=ME%c*")) ||
(Regexp::match(NULL, term, U"%c*:IGNORE=___=ME%c*"))) return;
if (Str::len(alphabetise_as) > 0)
IndexUtilities::alphabetisation_exception(term, alphabetise_as);
Indexes::ensure_lemmas_exist(term);
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, term, L"%c*=___=([^_]+?)")) {
if (Regexp::match(&mr, term, U"%c*=___=([^_]+?)")) {
text_stream *category = mr.exp[0];
indexing_category *ic = (indexing_category *)
Dictionaries::read_value(categories_by_name, category);
@ -278,8 +278,8 @@ void Indexes::mark_index_term(text_stream *given_term, volume *V, section *S,
if (ic->cat_alsounder == TRUE) {
TEMPORARY_TEXT(processed_term)
Indexes::process_category_options(processed_term, given_term, FALSE, 5);
if ((Regexp::match(NULL, processed_term, L"IGNORE=___=ME%c*")) ||
(Regexp::match(NULL, processed_term, L"%c*:IGNORE=___=ME%c*"))) return;
if ((Regexp::match(NULL, processed_term, U"IGNORE=___=ME%c*")) ||
(Regexp::match(NULL, processed_term, U"%c*:IGNORE=___=ME%c*"))) return;
Indexes::ensure_lemmas_exist(processed_term);
Indexes::set_index_point(processed_term, V, S, anchor, E, see);
DISCARD_TEXT(processed_term)
@ -302,7 +302,7 @@ dictionary *index_points_dict = NULL;
void Indexes::ensure_lemmas_exist(text_stream *text) {
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, text, L" *(%c+) *: *(%c+?) *")) {
if (Regexp::match(&mr, text, U" *(%c+) *: *(%c+?) *")) {
Indexes::ensure_lemmas_exist(mr.exp[0]);
Regexp::dispose_of(&mr);
}
@ -339,11 +339,11 @@ void Indexes::set_index_point(text_stream *term, volume *V, section *S,
if (Str::len(see) > 0) WRITE_TO(il->index_see, "%S<--", see);
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, term, L"%c+ *: *(%c+?) *")) {
if (Regexp::match(&mr, term, U"%c+ *: *(%c+?) *")) {
Str::copy(term, mr.exp[0]);
Regexp::dispose_of(&mr);
}
Regexp::replace(term, L"=___=%C*", NULL, 0);
Regexp::replace(term, U"=___=%C*", NULL, 0);
}
@ =
@ -357,7 +357,7 @@ void Indexes::note_index_term_alphabetisation(text_stream *term, text_stream *al
void Indexes::process_category_options(OUTPUT_STREAM, text_stream *text, int allow_under, int n) {
match_results mr = Regexp::create_mr();
@<Break the text down into a colon-separated list of categories and process each@>;
if (Regexp::match(&mr, text, L"(%c*)=___=(%c*)")) {
if (Regexp::match(&mr, text, U"(%c*)=___=(%c*)")) {
text_stream *lemma = mr.exp[0];
text_stream *category = mr.exp[1];
@<Redirect category names starting with an exclamation@>;
@ -371,7 +371,7 @@ void Indexes::process_category_options(OUTPUT_STREAM, text_stream *text, int all
}
@<Break the text down into a colon-separated list of categories and process each@> =
if (Regexp::match(&mr, text, L" *(%c+?) *: *(%c+)")) {
if (Regexp::match(&mr, text, U" *(%c+?) *: *(%c+)")) {
Indexes::process_category_options(OUT, mr.exp[0], TRUE, 7);
WRITE(":");
Indexes::process_category_options(OUT, mr.exp[1], allow_under, 8);
@ -407,9 +407,9 @@ else suppressed as unwanted (because the user didn't set up a redirection).
"Mary, Queen of Scots" alone.
@<Perform name inversion as necessary@> =
if ((ic->cat_inverted) && (Regexp::match(NULL, lemma, L"%c*,%c*") == FALSE)) {
if ((ic->cat_inverted) && (Regexp::match(NULL, lemma, U"%c*,%c*") == FALSE)) {
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, lemma, L"(%c*?) (%C+) *")) {
if (Regexp::match(&mr, lemma, U"(%c*?) (%C+) *")) {
Str::clear(lemma);
WRITE_TO(lemma, "%S, %S", mr.exp[1], mr.exp[0]);
}
@ -480,22 +480,22 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
Str::copy(sort_key, il->term);
/* ensure subentries follow main entries */
Regexp::replace(sort_key, L": *", L"ZZZZZZZZZZZZZZZZZZZZZZ", REP_REPEATING);
Regexp::replace(sort_key, U": *", U"ZZZZZZZZZZZZZZZZZZZZZZ", REP_REPEATING);
IndexUtilities::improve_alphabetisation(sort_key);
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, sort_key, L"a/%C+ (%c*)")) Str::copy(sort_key, mr.exp[0]);
if (Regexp::match(&mr, sort_key, L"the/%C+ (%c*)")) Str::copy(sort_key, mr.exp[0]);
if (Regexp::match(&mr, sort_key, U"a/%C+ (%c*)")) Str::copy(sort_key, mr.exp[0]);
if (Regexp::match(&mr, sort_key, U"the/%C+ (%c*)")) Str::copy(sort_key, mr.exp[0]);
if (indoc_settings->index_alphabetisation_algorithm == WORD_ALPHABETIZATION)
Regexp::replace(sort_key, L" ", L"aaaaaaaaaaaaaaaaaaaaaa", REP_REPEATING);
Regexp::replace(sort_key, U" ", U"aaaaaaaaaaaaaaaaaaaaaa", REP_REPEATING);
TEMPORARY_TEXT(un)
Str::copy(un, sort_key);
Regexp::replace(un, L"%(%c*?%)", NULL, REP_REPEATING);
Regexp::replace(un, L" ", NULL, REP_REPEATING);
Regexp::replace(un, L",", NULL, REP_REPEATING);
int f = ' ';
Regexp::replace(un, U"%(%c*?%)", NULL, REP_REPEATING);
Regexp::replace(un, U" ", NULL, REP_REPEATING);
Regexp::replace(un, U",", NULL, REP_REPEATING);
inchar32_t f = ' ';
if (Characters::isalpha(Str::get_first_char(sort_key)))
f = Str::get_first_char(sort_key);
WRITE_TO(il->sorting_key, "%c_%S=___=%S=___=%07d",
@ -508,10 +508,10 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
@<Render the index in sorted order@> =
IndexUtilities::alphabet_row(OUT, 1);
HTML_OPEN_WITH("table", "class=\"indextable\"");
wchar_t current_incipit = 0;
inchar32_t current_incipit = 0;
for (int i=0; i<NUMBER_CREATED(index_lemma); i++) {
index_lemma *il = lemma_list[i];
wchar_t incipit = Str::get_first_char(il->sorting_key);
inchar32_t incipit = Str::get_first_char(il->sorting_key);
if (Characters::isalpha(incipit)) incipit = Characters::toupper(incipit);
else incipit = '#';
if (incipit != current_incipit) {
@ -553,7 +553,7 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
TEMPORARY_TEXT(category)
match_results mr = Regexp::create_mr();
Str::copy(term, il->term);
if (Regexp::match(&mr, term, L"(%c*)=___=(%c*)")) {
if (Regexp::match(&mr, term, U"(%c*)=___=(%c*)")) {
Str::copy(term, mr.exp[0]);
Str::copy(category, mr.exp[1]);
}
@ -590,14 +590,15 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
@<Work out the wording and indentation level@> =
TEMPORARY_TEXT(untreated)
Str::copy(untreated, term);
while (Regexp::match(&mr, untreated, L"%c*?: *(%c+)")) {
while (Regexp::match(&mr, untreated, U"%c*?: *(%c+)")) {
Str::copy(untreated, mr.exp[0]); indent_level++;
}
Rawtext::escape_HTML_characters_in(untreated);
for (int i=0, L = Str::len(untreated); i<L; i++) {
int c = Str::get_at(untreated, i);
inchar32_t c = Str::get_at(untreated, i);
if (c == '\\') {
int n = 0, d = 0, id = 0;
inchar32_t n = 0, id = 0;
int d = 0;
while (Characters::isdigit(id = Str::get_at(untreated, i+1))) {
i++, d++; n = n*10 + (id - '0');
}
@ -609,23 +610,23 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
}
if (ic->cat_bracketed) {
while (Regexp::match(&mr, lemma_wording, L"(%c*?)%((%c*?)%)(%c*)")) {
while (Regexp::match(&mr, lemma_wording, U"(%c*?)%((%c*?)%)(%c*)")) {
Str::clear(lemma_wording);
WRITE_TO(lemma_wording,
"%S<span class=\"index%Sbracketed\">___openb___%S___closeb___</span>%S",
mr.exp[0], category, mr.exp[1], mr.exp[2]);
}
if (ic->cat_unbracketed) {
Regexp::replace(lemma_wording, L"___openb___", NULL, REP_REPEATING);
Regexp::replace(lemma_wording, L"___closeb___", NULL, REP_REPEATING);
Regexp::replace(lemma_wording, U"___openb___", NULL, REP_REPEATING);
Regexp::replace(lemma_wording, U"___closeb___", NULL, REP_REPEATING);
} else {
Regexp::replace(lemma_wording, L"___openb___", L"(", REP_REPEATING);
Regexp::replace(lemma_wording, L"___closeb___", L")", REP_REPEATING);
Regexp::replace(lemma_wording, U"___openb___", U"(", REP_REPEATING);
Regexp::replace(lemma_wording, U"___closeb___", U")", REP_REPEATING);
}
}
LOOP_THROUGH_TEXT(pos, lemma_wording) {
int d = Str::get(pos);
inchar32_t d = Str::get(pos);
if (d == SAVED_OPEN_BRACKET) Str::put(pos, '(');
if (d == SAVED_CLOSE_BRACKET) Str::put(pos, ')');
}
@ -642,7 +643,7 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
@<Render the list of index points@> =
TEMPORARY_TEXT(elist)
Str::copy(elist, il->index_points);
while (Regexp::match(&mr, elist, L"(%c*?)_(%c*?)_(%c*?),(%c*)")) {
while (Regexp::match(&mr, elist, U"(%c*?)_(%c*?)_(%c*?),(%c*)")) {
if (lc++ > 0) WRITE(", ");
int volume_number = Str::atoi(mr.exp[0], 0);
@ -693,7 +694,7 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
if (lc > 0) WRITE("also ");
HTML_CLOSE("span");
match_results mr2 = Regexp::create_mr();
while (Regexp::match(&mr2, seelist, L"(%c*?) *<-- *(%c*)")) {
while (Regexp::match(&mr2, seelist, U"(%c*?) *<-- *(%c*)")) {
if (sc++ > 0) { WRITE("; "); }
text_stream *see = mr2.exp[0];
@ -701,9 +702,9 @@ int Indexes::sort_comparison(const void *ent1, const void *ent2) {
index_lemma *ils = (index_lemma *) Dictionaries::read_value(index_points_dict, see);
TEMPORARY_TEXT(url)
WRITE_TO(url, "#l%d", ils->allocation_id);
Regexp::replace(see, L"=___=%i+?:", L":", REP_REPEATING);
Regexp::replace(see, L"=___=%i+", NULL, REP_REPEATING);
Regexp::replace(see, L":", L": ", REP_REPEATING);
Regexp::replace(see, U"=___=%i+?:", U":", REP_REPEATING);
Regexp::replace(see, U"=___=%i+", NULL, REP_REPEATING);
Regexp::replace(see, U":", U": ", REP_REPEATING);
HTMLUtilities::general_link(OUT, I"indexseelink", url, see);
DISCARD_TEXT(url)
}

View file

@ -19,13 +19,13 @@ text_stream *IndexUtilities::open_page(text_stream *title, text_stream *leafname
TEMPORARY_TEXT(head)
HTMLUtilities::get_tt_matter(head, 1, 1);
if (Str::len(head) > 0) {
wchar_t replacement[1024];
inchar32_t replacement[1024];
TEMPORARY_TEXT(rep)
WRITE_TO(rep, "<title>Inform 7 - %S</title>", title);
Str::copy_to_wide_string(replacement, rep, 1024);
DISCARD_TEXT(rep)
Regexp::replace(head, L"%[SUBHEADING%]", NULL, REP_REPEATING);
Regexp::replace(head, L"<title>%c*</title>", replacement, REP_REPEATING);
Regexp::replace(head, U"%[SUBHEADING%]", NULL, REP_REPEATING);
Regexp::replace(head, U"<title>%c*</title>", replacement, REP_REPEATING);
WRITE("%S", head);
} else {
HTMLUtilities::begin_file(OUT, volumes[0]);
@ -73,34 +73,34 @@ void IndexUtilities::improve_alphabetisation(text_stream *sort_key) {
} else {
LOOP_THROUGH_TEXT(pos, sort_key)
Str::put(pos, Characters::tolower(Str::get(pos)));
Regexp::replace(sort_key, L"a ", NULL, REP_ATSTART);
Regexp::replace(sort_key, L"an ", NULL, REP_ATSTART);
Regexp::replace(sort_key, L"the ", NULL, REP_ATSTART);
Regexp::replace(sort_key, U"a ", NULL, REP_ATSTART);
Regexp::replace(sort_key, U"an ", NULL, REP_ATSTART);
Regexp::replace(sort_key, U"the ", NULL, REP_ATSTART);
LOOP_THROUGH_TEXT(pos, sort_key)
Str::put(pos, Characters::tolower(Characters::remove_wchar_t_accent(Str::get(pos))));
Regexp::replace(sort_key, L"%[ *%]", L"____SQUARES____", REP_REPEATING);
Regexp::replace(sort_key, L"%[", NULL, REP_REPEATING);
Regexp::replace(sort_key, L"%]", NULL, REP_REPEATING);
Regexp::replace(sort_key, L"____SQUARES____", L"[]", REP_REPEATING);
Regexp::replace(sort_key, L"%(", NULL, REP_REPEATING);
Regexp::replace(sort_key, L"%)", NULL, REP_REPEATING);
Regexp::replace(sort_key, L"1 ", L"one ", REP_ATSTART);
Regexp::replace(sort_key, L"2 ", L"two ", REP_ATSTART);
Regexp::replace(sort_key, L"3 ", L"three ", REP_ATSTART);
Regexp::replace(sort_key, L"4 ", L"four ", REP_ATSTART);
Regexp::replace(sort_key, L"5 ", L"five ", REP_ATSTART);
Regexp::replace(sort_key, L"6 ", L"six ", REP_ATSTART);
Regexp::replace(sort_key, L"7 ", L"seven ", REP_ATSTART);
Regexp::replace(sort_key, L"8 ", L"eight ", REP_ATSTART);
Regexp::replace(sort_key, L"9 ", L"nine ", REP_ATSTART);
Regexp::replace(sort_key, L"10 ", L"ten ", REP_ATSTART);
Regexp::replace(sort_key, L"11 ", L"eleven ", REP_ATSTART);
Regexp::replace(sort_key, L"12 ", L"twelve ", REP_ATSTART);
Str::put(pos, Characters::tolower(Characters::remove_accent(Str::get(pos))));
Regexp::replace(sort_key, U"%[ *%]", U"____SQUARES____", REP_REPEATING);
Regexp::replace(sort_key, U"%[", NULL, REP_REPEATING);
Regexp::replace(sort_key, U"%]", NULL, REP_REPEATING);
Regexp::replace(sort_key, U"____SQUARES____", U"[]", REP_REPEATING);
Regexp::replace(sort_key, U"%(", NULL, REP_REPEATING);
Regexp::replace(sort_key, U"%)", NULL, REP_REPEATING);
Regexp::replace(sort_key, U"1 ", U"one ", REP_ATSTART);
Regexp::replace(sort_key, U"2 ", U"two ", REP_ATSTART);
Regexp::replace(sort_key, U"3 ", U"three ", REP_ATSTART);
Regexp::replace(sort_key, U"4 ", U"four ", REP_ATSTART);
Regexp::replace(sort_key, U"5 ", U"five ", REP_ATSTART);
Regexp::replace(sort_key, U"6 ", U"six ", REP_ATSTART);
Regexp::replace(sort_key, U"7 ", U"seven ", REP_ATSTART);
Regexp::replace(sort_key, U"8 ", U"eight ", REP_ATSTART);
Regexp::replace(sort_key, U"9 ", U"nine ", REP_ATSTART);
Regexp::replace(sort_key, U"10 ", U"ten ", REP_ATSTART);
Regexp::replace(sort_key, U"11 ", U"eleven ", REP_ATSTART);
Regexp::replace(sort_key, U"12 ", U"twelve ", REP_ATSTART);
TEMPORARY_TEXT(x)
Str::copy(x, sort_key);
Str::clear(sort_key);
match_results mr = Regexp::create_mr();
while (Regexp::match(&mr, x, L"(%c*?)(%d+)(%c*)")) {
while (Regexp::match(&mr, x, U"(%c*?)(%d+)(%c*)")) {
WRITE_TO(sort_key, "%S", mr.exp[0]);
Str::copy(x, mr.exp[2]);
WRITE_TO(sort_key, "%08d", Str::atoi(mr.exp[1], 0));
@ -112,9 +112,9 @@ void IndexUtilities::improve_alphabetisation(text_stream *sort_key) {
@ =
int letters_taken[26];
void IndexUtilities::note_letter(wchar_t c) {
int i = c - (wchar_t) 'A';
if ((i>=0) && (i<26)) letters_taken[i] = TRUE;
void IndexUtilities::note_letter(inchar32_t c) {
inchar32_t i = c - (inchar32_t) 'A';
if (i<26) letters_taken[i] = TRUE;
}
void IndexUtilities::alphabet_row(OUTPUT_STREAM, int sequence) {
switch (sequence) {
@ -128,7 +128,7 @@ void IndexUtilities::alphabet_row(OUTPUT_STREAM, int sequence) {
if (letters_taken[i] == FALSE) {
if (faked == FALSE) { faked = TRUE; HTML_OPEN("p"); }
TEMPORARY_TEXT(singleton)
PUT_TO(singleton, 'A'+i);
PUT_TO(singleton, (inchar32_t) ('A'+i));
HTML::anchor(OUT, singleton);
DISCARD_TEXT(singleton)
}

View file

@ -213,13 +213,13 @@ void Midnight::write_contents_page(navigation_design *self, volume *V) {
TEMPORARY_TEXT(xxx)
HTMLUtilities::get_tt_matter(xxx, 1, 1);
if (Str::len(xxx) > 0) {
Regexp::replace(xxx, L"%[SUBHEADING%]", NULL, 0);
wchar_t replacement[1024];
Regexp::replace(xxx, U"%[SUBHEADING%]", NULL, 0);
inchar32_t replacement[1024];
TEMPORARY_TEXT(rep)
WRITE_TO(rep, "<title>%S</title>", title);
Str::copy_to_wide_string(replacement, rep, 1024);
DISCARD_TEXT(rep)
Regexp::replace(xxx, L"<title>%c*</title>", replacement, REP_REPEATING);
Regexp::replace(xxx, U"<title>%c*</title>", replacement, REP_REPEATING);
WRITE("%S", xxx);
} else {
HTMLUtilities::begin_file(OUT, volumes[0]);
@ -342,7 +342,7 @@ there are in practice about 25.
if (no_volumes == 1) WRITE_TO(theprefix, "<b>Chapter %d</b>", C->chapter_number);
else WRITE_TO(theprefix, "<b>%d</b>", C->chapter_number);
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, thetitle, L"Appendix: (%c*)")) {
if (Regexp::match(&mr, thetitle, U"Appendix: (%c*)")) {
Str::clear(theprefix); Str::copy(theprefix, I"Appendix");
Str::clear(thetitle); Str::copy(thetitle, mr.exp[0]);
}

View file

@ -258,8 +258,8 @@ Inform UI apps is really a command to //supervisor// not to |inform7|.
=
int Main::read_command_line(int argc, char *argv[]) {
CommandLine::declare_heading(
L"inform7: a compiler from source text to Inter code\n\n"
L"Usage: inform7 [OPTIONS]\n");
U"inform7: a compiler from source text to Inter code\n\n"
U"Usage: inform7 [OPTIONS]\n");
@<Register command-line arguments@>;
Supervisor::declare_options();
@ -296,34 +296,34 @@ compiler via Delia scripts in |intest|.
@<Register command-line arguments@> =
CommandLine::begin_group(INFORM_TESTING_CLSG, I"for testing and debugging inform7");
CommandLine::declare_boolean_switch(CRASHALL_CLSW, L"crash-all", 1,
L"intentionally crash on Problem messages, for backtracing", FALSE);
CommandLine::declare_boolean_switch(INDEX_CLSW, L"index", 1,
L"produce an Index", TRUE);
CommandLine::declare_boolean_switch(PROBLEMS_CLSW, L"problems", 1,
L"produce (an HTML) Problems report page", TRUE);
CommandLine::declare_boolean_switch(CENSUS_UPDATE_CLSW, L"census-update", 1,
L"withdrawn: previously, 'update the extensions census'", TRUE);
CommandLine::declare_boolean_switch(PROGRESS_CLSW, L"progress", 1,
L"display progress percentages", TRUE);
CommandLine::declare_boolean_switch(SIGILS_CLSW, L"sigils", 1,
L"print Problem message sigils", FALSE);
CommandLine::declare_boolean_switch(CHECK_RESOURCES_CLSW, L"resource-checking", 1,
L"check that figures, sounds and similar resources exist at compile-time", TRUE);
CommandLine::declare_boolean_switch(DIAGNOSTICS_CLSW, L"diagnostics", 2,
L"if no problems occur, write diagnostics files to directory X", FALSE);
CommandLine::declare_switch(REQUIRE_PROBLEM_CLSW, L"require-problem", 2,
L"return 0 unless exactly this Problem message is generated");
CommandLine::declare_switch(LOG_TO_PROJECT_CLSW, L"log-to-project", 2,
L"like -log X, but writing the debugging log into the project");
CommandLine::declare_switch(TEST_OUTPUT_CLSW, L"test-output", 2,
L"write output of internal tests to file X");
CommandLine::declare_boolean_switch(SILENCE_CLSW, L"silence", 1,
L"practice 'silence is golden': print only Unix-style errors", FALSE);
CommandLine::declare_boolean_switch(INBUILD_VERBOSE_CLSW, L"inbuild-verbose", 1,
L"equivalent to -inbuild-verbosity=1", FALSE);
CommandLine::declare_numerical_switch(INBUILD_VERBOSITY_CLSW, L"inbuild-verbosity", 1,
L"how much inbuild should explain: lowest is 0 (default), highest is 3");
CommandLine::declare_boolean_switch(CRASHALL_CLSW, U"crash-all", 1,
U"intentionally crash on Problem messages, for backtracing", FALSE);
CommandLine::declare_boolean_switch(INDEX_CLSW, U"index", 1,
U"produce an Index", TRUE);
CommandLine::declare_boolean_switch(PROBLEMS_CLSW, U"problems", 1,
U"produce (an HTML) Problems report page", TRUE);
CommandLine::declare_boolean_switch(CENSUS_UPDATE_CLSW, U"census-update", 1,
U"withdrawn: previously, 'update the extensions census'", TRUE);
CommandLine::declare_boolean_switch(PROGRESS_CLSW, U"progress", 1,
U"display progress percentages", TRUE);
CommandLine::declare_boolean_switch(SIGILS_CLSW, U"sigils", 1,
U"print Problem message sigils", FALSE);
CommandLine::declare_boolean_switch(CHECK_RESOURCES_CLSW, U"resource-checking", 1,
U"check that figures, sounds and similar resources exist at compile-time", TRUE);
CommandLine::declare_boolean_switch(DIAGNOSTICS_CLSW, U"diagnostics", 2,
U"if no problems occur, write diagnostics files to directory X", FALSE);
CommandLine::declare_switch(REQUIRE_PROBLEM_CLSW, U"require-problem", 2,
U"return 0 unless exactly this Problem message is generated");
CommandLine::declare_switch(LOG_TO_PROJECT_CLSW, U"log-to-project", 2,
U"like -log X, but writing the debugging log into the project");
CommandLine::declare_switch(TEST_OUTPUT_CLSW, U"test-output", 2,
U"write output of internal tests to file X");
CommandLine::declare_boolean_switch(SILENCE_CLSW, U"silence", 1,
U"practice 'silence is golden': print only Unix-style errors", FALSE);
CommandLine::declare_boolean_switch(INBUILD_VERBOSE_CLSW, U"inbuild-verbose", 1,
U"equivalent to -inbuild-verbosity=1", FALSE);
CommandLine::declare_numerical_switch(INBUILD_VERBOSITY_CLSW, U"inbuild-verbosity", 1,
U"how much inbuild should explain: lowest is 0 (default), highest is 3");
CommandLine::end_group();
@ Three of the five options here actually configure the |problems| module

View file

@ -241,7 +241,7 @@ after it is created, but before it is run:
=
Here |my_receiver| is a function. The default receiver looks like this:
= (text as C)
void i7_default_receiver(int id, wchar_t c, char *style) {
void i7_default_receiver(int id, inchar32_t c, char *style) {
if (id == I7_BODY_TEXT_ID) fputc(c, stdout);
}
=

View file

@ -40,12 +40,12 @@ void AssertionsModule::start(void) {
REGISTER_WRITER('B', Tables::log);
REGISTER_WRITER('C', Tables::Columns::log);
Log::declare_aspect(ASSEMBLIES_DA, L"assemblies", FALSE, FALSE);
Log::declare_aspect(ASSERTIONS_DA, L"assertions", FALSE, TRUE);
Log::declare_aspect(IMPLICATIONS_DA, L"implications", FALSE, TRUE);
Log::declare_aspect(NOUN_RESOLUTION_DA, L"noun resolution", FALSE, FALSE);
Log::declare_aspect(PRONOUNS_DA, L"pronouns", FALSE, FALSE);
Log::declare_aspect(RELATION_DEFINITIONS_DA, L"relation definitions", FALSE, FALSE);
Log::declare_aspect(ASSEMBLIES_DA, U"assemblies", FALSE, FALSE);
Log::declare_aspect(ASSERTIONS_DA, U"assertions", FALSE, TRUE);
Log::declare_aspect(IMPLICATIONS_DA, U"implications", FALSE, TRUE);
Log::declare_aspect(NOUN_RESOLUTION_DA, U"noun resolution", FALSE, FALSE);
Log::declare_aspect(PRONOUNS_DA, U"pronouns", FALSE, FALSE);
Log::declare_aspect(RELATION_DEFINITIONS_DA, U"relation definitions", FALSE, FALSE);
InternalTests::make_test_available(I"refinery",
&Classifying::perform_refinery_internal_test, TRUE);

View file

@ -1083,10 +1083,10 @@ void ImperativeSubtrees::unroll_says(parse_node *cb_node, wording W, int depth)
@<Bite off a say term@> =
if ((Wordings::length(W) > 1) ||
(Wide::cmp(Lexer::word_text(Wordings::first_wn(W)), L"\"\"") != 0)) {
(Wide::cmp(Lexer::word_text(Wordings::first_wn(W)), U"\"\"") != 0)) {
if ((Wordings::length(W) == 1) &&
(Vocabulary::test_flags(Wordings::first_wn(W), TEXTWITHSUBS_MC)) && (depth == 0)) {
wchar_t *p = Lexer::word_raw_text(Wordings::first_wn(W));
inchar32_t *p = Lexer::word_raw_text(Wordings::first_wn(W));
@<Check that substitution does not contain suspicious punctuation@>;
TEMPORARY_TEXT(sub)
@<Write a form of the text bracketing substitutions with commas@>;

View file

@ -184,7 +184,7 @@ source_text_intervention *InterventionRequests::new_sti(parse_node *p) {
sti->stage = AFTER_LINK_STAGE;
sti->segment = NULL;
sti->part = NULL;
wchar_t *sf = Lexer::word_raw_text(Wordings::first_wn(Node::get_text(p)) + 2);
inchar32_t *sf = Lexer::word_raw_text(Wordings::first_wn(Node::get_text(p)) + 2);
sti->matter = Str::new();
WRITE_TO(sti->matter, "%w", sf);
sti->seg = NULL;

View file

@ -250,7 +250,7 @@ message is thrown.
if (Characters::isupper(Str::get_at(uo->symbol_name, 0)) == FALSE)
invalid = TRUE;
LOOP_THROUGH_TEXT(pos, uo->symbol_name) {
wchar_t c = Str::get(pos);
inchar32_t c = Str::get(pos);
if ((Characters::isupper(c) == FALSE) &&
(Characters::isdigit(c) == FALSE) &&
(c != '_'))
@ -278,7 +278,7 @@ message is thrown.
if (Characters::isupper(Str::get_at(uo->kit_name, 0)) == FALSE)
invalid = TRUE;
LOOP_THROUGH_TEXT(pos, uo->kit_name) {
wchar_t c = Str::get(pos);
inchar32_t c = Str::get(pos);
if ((Characters::isupper(c) == FALSE) &&
(Characters::islower(c) == FALSE) &&
(Characters::isdigit(c) == FALSE))
@ -356,7 +356,7 @@ void NewUseOptions::pragma_setting(parsed_use_option_setting *puos) {
PUT_TO(target, Str::get(pos));
if (Str::eq_insensitive(target, I"Inform6")) {
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, puos->content_of_pragma, L" *$(%C+)=(%d+);* *")) {
if (Regexp::match(&mr, puos->content_of_pragma, U" *$(%C+)=(%d+);* *")) {
int val = Str::atoi(mr.exp[1], 0);
NewUseOptions::memory_setting(mr.exp[0], val);
} else {

View file

@ -116,7 +116,7 @@ more elaborate:
@<Add script@> =
Word::dequote(Wordings::first_wn(W));
wchar_t *p = Lexer::word_text(Wordings::first_wn(W));
inchar32_t *p = Lexer::word_text(Wordings::first_wn(W));
TestCommand::add_script_to_scenario(ts_being_created, p);
@<Add in-test requirement@> =

View file

@ -923,7 +923,7 @@ and an |COMMON_NOUN_NT| node, "nose".
}
if ((Wordings::nonempty(OW)) && (Wordings::nonempty(NW)) && (Wordings::empty(CW))) {
feed_t id = Feeds::begin();
Feeds::feed_C_string_expanding_strings(L" its ");
Feeds::feed_C_string_expanding_strings(U" its ");
Feeds::feed_wording(NW);
CW = Feeds::end(id);
}

View file

@ -163,7 +163,7 @@ typedef struct inline_details {
int arithmetical_operation; /* |-1|, or one of the |*_OPERATION| constants */
int block_follows; /* for inline phrases only: followed by a begin... end block? */
wchar_t *only_in_loop; /* if not null, the phrase can only be used in this block */
inchar32_t *only_in_loop; /* if not null, the phrase can only be used in this block */
} inline_details;
@ Where:
@ -613,7 +613,7 @@ void IDTypeData::make_id(inline_details *id, int op, int assgn, int let, int blk
if ((let == ASSIGNMENT_LET_PHRASE) && (no_lets_made++ >= 3)) let = NOT_A_LET_PHRASE;
id->let_phrase = let;
id->block_follows = blk;
if (only_in == -1) id->only_in_loop = L"loop";
if (only_in == -1) id->only_in_loop = U"loop";
else if (only_in > 0) id->only_in_loop = Lexer::word_text(only_in);
}
@ -668,7 +668,7 @@ int IDTypeData::is_assignment_phrase(id_body *idb) {
return idb->type_data.as_inline.assignment_phrase;
}
wchar_t *IDTypeData::only_in(id_body *idb) {
inchar32_t *IDTypeData::only_in(id_body *idb) {
if (idb) return idb->type_data.as_inline.only_in_loop;
return NULL;
}
@ -793,7 +793,7 @@ void IDTypeData::write_HTML_representation(OUTPUT_STREAM,
}
@<Describe a fixed word in the word sequence@> =
wchar_t *p = Lexer::word_raw_text(idtd->word_sequence[j]);
inchar32_t *p = Lexer::word_raw_text(idtd->word_sequence[j]);
int tinted = FALSE;
for (int i=0; p[i]; i++) {
if ((p[i] == '/') && (tinted == FALSE)) {

View file

@ -334,7 +334,7 @@ void ToPhraseFamily::compile(imperative_defn_family *self,
(IDTypeData::token_contains_variable(&(idb->type_data), k) == FALSE)) {
current_sentence = ImperativeDefinitions::body_at(idb);
TEMPORARY_TEXT(var_letter)
PUT_TO(var_letter, 'A'+k-1);
PUT_TO(var_letter, (inchar32_t) ('A'+k-1));
Problems::quote_source(1, current_sentence);
Problems::quote_stream(2, var_letter);
StandardProblems::handmade_problem(Task::syntax_tree(),

View file

@ -156,7 +156,7 @@ rule *Rules::by_name(wording W) {
@h The kind of a rule.
Given that Inform authors can refer to (named) rules as constant values, they
need to have kinds, and it is not obvious what those should be. Clearly
some form of "K-based rule producing L" would be reasonable, but leaving K
some form of "K-based rule producing U" would be reasonable, but leaving K
and L just to be "value" -- as the earliest versions of Inform 7 did, in the
mid-2000s -- would be indefinite. Constants should always have definite kinds,
because otherwise kind inference will fail on phrases like:
@ -577,7 +577,7 @@ void Rules::check_response_usages(void) {
}
if (c == 0) WRITE_TO(offers, "no lettered responses at all");
TEMPORARY_TEXT(letter)
PUT_TO(letter, 'A'+l);
PUT_TO(letter, (inchar32_t) ('A'+l));
current_sentence = R->responses[l].used;
Problems::quote_source(1, R->responses[l].used);
Problems::quote_wording(2, R->name);

View file

@ -633,10 +633,10 @@ expression |[A-Za-z]?{1,8}\d?{0,2}|.
=
int Equations::equation_symbol_legal(wording W) {
if (Wordings::length(W) == 1) {
wchar_t *p = Lexer::word_raw_text(Wordings::first_wn(W));
inchar32_t *p = Lexer::word_raw_text(Wordings::first_wn(W));
int j, letters = 0, digits = 0, name_legal = TRUE;
for (j=0; p[j]; j++) {
wchar_t c = p[j];
inchar32_t c = p[j];
if (Characters::isdigit(c)) digits++;
else if (Characters::isalpha(c)) { letters++; if (digits > 0) name_legal = FALSE; }
else name_legal = FALSE;
@ -755,7 +755,7 @@ equation_node *Equations::eqn_parse(equation *eqn) {
int enode_count = 0; /* number of tokens shipped so far */
int bl = 0; /* bracket nesting level */
int wn = Wordings::first_wn(W), i = 0; wchar_t *p = NULL;
int wn = Wordings::first_wn(W), i = 0; inchar32_t *p = NULL;
while ((wn <= Wordings::last_wn(W)) || (p)) {
if (p == NULL) { i = 0; p = Lexer::word_raw_text(wn++); }
/* we are now at character |i| in string |p|, while |wn| is the next word */
@ -782,7 +782,7 @@ equation_node *Equations::eqn_parse(equation *eqn) {
@ Note that symbol names can't begin with a digit.
@<Break off a token from the current position@> =
wchar_t c = p[i];
inchar32_t c = p[i];
if (Characters::isalpha(c)) @<Break off a symbol name as a token@>
else if (Characters::isdigit(c)) @<Break off a numeric constant as a token@>
else @<Break off an operator or a piece of punctuation as a token@>;
@ -891,7 +891,7 @@ capacity; and so is the number 0 itself.
case ')': token = Equations::enode_new(CLOSE_BRACKET_EQN); bl--; break;
default: {
TEMPORARY_TEXT(symbol)
PUT_TO(symbol, (int) c);
PUT_TO(symbol, c);
StandardProblems::equation_problem_S(_p_(PM_EquationOperatorUnrecognised), eqn, symbol,
"the symbol '%3' is one that I don't recognise. I was "
"expecting an arithmetic sign, '+', '-', '*','/', or '^', "

View file

@ -127,7 +127,7 @@ int Calculus::QuasinumericRelations::schema(bp_family *self, int task, binary_pr
cr = Kinds::Behaviour::get_comparison_routine(K_real_number);
} else
cr = Kinds::Behaviour::get_comparison_routine(st[0]);
if ((Str::len(cr) == 0) || (Str::eq_wide_string(cr, L"signed"))) return FALSE;
if ((Str::len(cr) == 0) || (Str::eq_wide_string(cr, U"signed"))) return FALSE;
if (promote_left) {
if (bp == R_numerically_greater_than)

View file

@ -27,9 +27,9 @@ void CoreModule::start(void) {
naming_feature = Features::new(&Naming::start, I"naming", core_feature);
counting_feature = Features::new(&InstanceCounting::start, I"instance counting", core_feature);
Log::declare_aspect(TASK_QUEUE_DA, L"task queue", FALSE, FALSE);
Log::declare_aspect(INTER_DA, L"inter", FALSE, FALSE);
Log::declare_aspect(INFORM_INTER_DA, L"inform inter", FALSE, FALSE);
Log::declare_aspect(TASK_QUEUE_DA, U"task queue", FALSE, FALSE);
Log::declare_aspect(INTER_DA, U"inter", FALSE, FALSE);
Log::declare_aspect(INFORM_INTER_DA, U"inform inter", FALSE, FALSE);
Writers::register_writer_I('B', &CoreModule::writer);
CorePreform::set_core_internal_NTIs();

View file

@ -126,7 +126,7 @@ indicating an owner) is a mere rvalue.
@e NONLOCAL_VARIABLE_NT /* "the location" */
@e PROPERTY_VALUE_NT /* "the carrying capacity of the cedarwood box" */
@e TABLE_ENTRY_NT /* "tonnage in row X of the Table of Corvettes" */
@e LIST_ENTRY_NT /* "item 4 in L" */
@e LIST_ENTRY_NT /* "item 4 in U" */
@<Create the lvalue nodes@> =
NodeType::new(LOCAL_VARIABLE_NT, I"LOCAL_VARIABLE_NT", 0, 0, LVALUE_NCAT, 0);

View file

@ -41,13 +41,13 @@ void IFModule::start(void) {
@e OBJECT_TREE_DA
@<Register this module's debugging log aspects@> =
Log::declare_aspect(ACTION_CREATIONS_DA, L"action creations", FALSE, FALSE);
Log::declare_aspect(ACTION_PATTERN_COMPILATION_DA, L"action pattern compilation",
Log::declare_aspect(ACTION_CREATIONS_DA, U"action creations", FALSE, FALSE);
Log::declare_aspect(ACTION_PATTERN_COMPILATION_DA, U"action pattern compilation",
FALSE, FALSE);
Log::declare_aspect(ACTION_PATTERN_PARSING_DA, L"action pattern parsing", FALSE, FALSE);
Log::declare_aspect(GRAMMAR_DA, L"grammar", FALSE, FALSE);
Log::declare_aspect(GRAMMAR_CONSTRUCTION_DA, L"grammar construction", FALSE, FALSE);
Log::declare_aspect(OBJECT_TREE_DA, L"object tree", FALSE, FALSE);
Log::declare_aspect(ACTION_PATTERN_PARSING_DA, U"action pattern parsing", FALSE, FALSE);
Log::declare_aspect(GRAMMAR_DA, U"grammar", FALSE, FALSE);
Log::declare_aspect(GRAMMAR_CONSTRUCTION_DA, U"grammar construction", FALSE, FALSE);
Log::declare_aspect(OBJECT_TREE_DA, U"object tree", FALSE, FALSE);
@<Register this module's debugging log writers@> =
REGISTER_WRITER('A', ActionPatterns::log);

View file

@ -60,13 +60,13 @@ This handles the special meaning "The story is episode...".
=
int episode_number = -1; /* for a work which is part of a numbered series */
wchar_t *series_name = NULL;
inchar32_t *series_name = NULL;
int BibliographicData::episode_number(void) {
return episode_number;
}
wchar_t *BibliographicData::series_name(void) {
inchar32_t *BibliographicData::series_name(void) {
return series_name;
}
@ -267,7 +267,7 @@ text_stream *BibliographicData::read_uuid(void) {
int c;
while (((c = fgetc(xf)) != EOF) /* the UUID file is plain text, not Unicode */
&& (uuid_read++ < MAX_UUID_LENGTH-1))
PUT_TO(uuid_text, (int) Characters::toupper((wchar_t) c));
PUT_TO(uuid_text, Characters::toupper((inchar32_t) c));
fclose(xf);
return uuid_text;
}
@ -286,7 +286,7 @@ therefore splits into one of three independent methods.
@d HTML_BIBTEXT_MODE 4
=
void BibliographicData::compile_bibliographic_text(OUTPUT_STREAM, wchar_t *p, int mode) {
void BibliographicData::compile_bibliographic_text(OUTPUT_STREAM, inchar32_t *p, int mode) {
if (p == NULL) return;
if (mode == XML_BIBTEXT_MODE)
@<Compile bibliographic text as XML respecting Treaty of Babel rules@>;
@ -448,7 +448,7 @@ just too short to care overmuch about this.
if ((p[i+1]) && (p[i+1] != '\"')) PUT('-');
break;
default: {
int charcode = p[i];
inchar32_t charcode = p[i];
charcode = Characters::make_filename_safe(charcode);
whitespace_count = 0;
if (charcode < 128) {

View file

@ -16,7 +16,7 @@ A "zbyte" is a byte from a Z-machine story file.
=
typedef struct release_instructions {
int release_website; /* Release along with a website? */
wchar_t *website_template_leafname; /* If so, the template name for it */
inchar32_t *website_template_leafname; /* If so, the template name for it */
int release_interpreter; /* Release along with an interpreter? */
struct text_stream *interpreter_template_leafname; /* If so, the template name for it */
int release_booklet; /* Release along with introductory booklet? */
@ -43,7 +43,7 @@ typedef struct release_instructions {
release_instructions *ReleaseInstructions::new_set(void) {
release_instructions *set = CREATE(release_instructions);
set->release_website = FALSE;
set->website_template_leafname = L"Standard";
set->website_template_leafname = U"Standard";
set->release_interpreter = FALSE;
set->interpreter_template_leafname = NULL;
set->release_booklet = FALSE;
@ -92,7 +92,7 @@ typedef struct auxiliary_file {
@ =
void ReleaseInstructions::add_aux_file(release_instructions *rel,
filename *name, pathname *fold, wchar_t *desc, int payload) {
filename *name, pathname *fold, inchar32_t *desc, int payload) {
auxiliary_file *af = CREATE(auxiliary_file);
af->name_of_original_file = name;
af->folder_to_release_to = fold;
@ -277,7 +277,7 @@ void ReleaseInstructions::handle_release_declaration_inner(parse_node *p) {
DISCARD_TEXT(leaf)
ReleaseInstructions::add_aux_file(my_instructions, A,
Task::release_path(),
L"--",
U"--",
payload);
break;
}
@ -294,7 +294,7 @@ void ReleaseInstructions::handle_release_declaration_inner(parse_node *p) {
WRITE_TO(folder, "%N", Wordings::first_wn(FW));
pathname *P = Pathnames::down(Task::release_path(), folder);
DISCARD_TEXT(folder)
ReleaseInstructions::add_aux_file(my_instructions, A, P, L"--", payload);
ReleaseInstructions::add_aux_file(my_instructions, A, P, U"--", payload);
break;
}
case BOOKLET_PAYLOAD: my_instructions->release_booklet = TRUE; break;

View file

@ -46,7 +46,7 @@ the Blorb-file's filename won't be too long for the file system.
(VariableSubjects::has_initial_value_set(story_title_VAR))) {
BlurbFile::write_var_to_text(TEMP, story_title_VAR, TRUNCATE_BIBTEXT_MODE);
LOOP_THROUGH_TEXT(pos, TEMP) {
wchar_t c = Str::get(pos);
inchar32_t c = Str::get(pos);
if ((c == ':') || (c == '/') || (c == '\\') || (c == '.') ||
(c == '*') || (c == '#'))
Str::put(pos, '-');
@ -246,7 +246,7 @@ file online.
@<Give instructions to construct a website around the release@> =
WRITE("\n! Website instructions\n\n");
@<Tell Inblorb where to find the website templates@>;
if (Wide::cmp(rel->website_template_leafname, L"Classic") != 0) WRITE("css\n");
if (Wide::cmp(rel->website_template_leafname, U"Classic") != 0) WRITE("css\n");
WRITE("website \"%w\"\n", rel->website_template_leafname);
@ The order here is significant, since Inblorb searches the folders in order,

View file

@ -113,8 +113,8 @@ int MappingHints::setting(int N) {
=
<map-setting> ::=
<map-parameter> of <map-setting-scope> | ==> { R[2], -, <<wchar_t:partext>> = RP[1], <<parindex>> = R[1] }
<map-parameter> | ==> { ENTIRE_MAP_SCOPE, -, <<wchar_t:partext>> = RP[1], <<parindex>> = R[1] }
<map-parameter> of <map-setting-scope> | ==> { R[2], -, <<inchar32_t:partext>> = RP[1], <<parindex>> = R[1] }
<map-parameter> | ==> { ENTIRE_MAP_SCOPE, -, <<inchar32_t:partext>> = RP[1], <<parindex>> = R[1] }
... of <map-setting-scope> ==> @<Issue PM_MapSettingUnknown problem@>
<map-setting-scope> ::=
@ -137,7 +137,7 @@ For now, at least, these are all in English only.
=
<map-parameter> internal {
int i;
wchar_t *parameter_name = Lexer::word_text(Wordings::first_wn(W));
inchar32_t *parameter_name = Lexer::word_text(Wordings::first_wn(W));
if ((Wordings::length(W) == 1) &&
((i = ConfigureIndexMap::get_map_variable_index_from_wchar(parameter_name))>=0)) {
==> { i, parameter_name };
@ -277,10 +277,10 @@ void MappingHints::new_map_hint_sentence(parse_node *p) {
wording RW = GET_RW(<index-map-sentence-subject>, 1);
wording RESTW = GET_RW(<index-map-sentence-subject>, 2);
Word::dequote(Wordings::first_wn(RW));
wchar_t *annotation = Lexer::word_text(Wordings::first_wn(RW));
inchar32_t *annotation = Lexer::word_text(Wordings::first_wn(RW));
int point_size = 12; /* 12-point type */
wchar_t *font = L"<font>"; /* meaning the default font */
wchar_t *colour = L"000000"; /* black */
inchar32_t *font = U"<font>"; /* meaning the default font */
inchar32_t *colour = U"000000"; /* black */
int at_offset = 10001; /* the offset $(1, 1)$ */
instance *offset_from = NULL;
int i = Wordings::first_wn(RESTW);
@ -312,7 +312,7 @@ void MappingHints::new_map_hint_sentence(parse_node *p) {
@<Make a rubric colour setting@> =
Word::dequote(<<rcol>>);
wchar_t *thec = HTML::translate_colour_name(Lexer::word_text(<<rcol>>));
inchar32_t *thec = HTML::translate_colour_name(Lexer::word_text(<<rcol>>));
if (thec == NULL) {
StandardProblems::map_problem(_p_(PM_MapUnknownColour), p, "There's no such map colour.");
return;
@ -346,7 +346,7 @@ void MappingHints::new_map_hint_sentence(parse_node *p) {
instance *scope_I = NULL;
kind *scope_k = NULL;
@<Determine the scope for which the parameter is being set@>;
wchar_t *parameter_name = <<wchar_t:partext>>;
inchar32_t *parameter_name = <<inchar32_t:partext>>;
int index_of_parameter = <<parindex>>;
@<Check that the value has the right type for this map parameter, and set it@>;
@ -436,7 +436,7 @@ void MappingHints::new_map_hint_sentence(parse_node *p) {
case COL_MDT: i_wanted_a = "a colour name in double-quotes";
if (type_found == TEXT_MDT) {
Word::dequote(wn);
wchar_t *col = HTML::translate_colour_name(Lexer::word_text(wn));
inchar32_t *col = HTML::translate_colour_name(Lexer::word_text(wn));
if (col) {
MappingHints::put_mp(parameter_name, scope_level, scope_I, scope_k, col, 0);
return;
@ -457,16 +457,16 @@ typedef struct mapping_hint {
struct instance *dir;
struct instance *as_dir;
wchar_t *name;
inchar32_t *name;
int scope_level;
struct instance *scope_I;
wchar_t *put_string;
inchar32_t *put_string;
int put_integer;
wchar_t *annotation;
inchar32_t *annotation;
int point_size;
wchar_t *font;
wchar_t *colour;
inchar32_t *font;
inchar32_t *colour;
int at_offset;
struct instance *offset_from;
@ -511,8 +511,8 @@ int MappingHints::obj_in_region(instance *I, instance *reg) {
return MappingHints::obj_in_region(Regions::enclosing(I), reg);
}
void MappingHints::put_mp(wchar_t *name, int scope_level, instance *scope_I,
kind *scope_k, wchar_t *put_string, int put_integer) {
void MappingHints::put_mp(inchar32_t *name, int scope_level, instance *scope_I,
kind *scope_k, inchar32_t *put_string, int put_integer) {
if (scope_I) {
if (Regions::object_is_a_region(scope_I)) {
instance *rm;
@ -538,8 +538,8 @@ void MappingHints::put_mp(wchar_t *name, int scope_level, instance *scope_I,
hint->put_integer = put_integer;
}
void MappingHints::make_rubric(wchar_t *annotation, int point_size, wchar_t *font,
wchar_t *colour, int at_offset, instance *offset_from) {
void MappingHints::make_rubric(inchar32_t *annotation, int point_size, inchar32_t *font,
inchar32_t *colour, int at_offset, instance *offset_from) {
mapping_hint *hint = MappingHints::new_hint();
hint->annotation = annotation;
hint->point_size = point_size;
@ -564,7 +564,7 @@ int MappingHints::parse_eps_map_offset(wording W) {
if (Str::len(offs) >= 30) return ERRONEOUS_OFFSET_VALUE;
match_results mr = Regexp::create_mr();
int xbit = 0, ybit = 0;
if (Regexp::match(&mr, offs, L"(%c*?)&(%c*)")) {
if (Regexp::match(&mr, offs, U"(%c*?)&(%c*)")) {
xbit = Str::atoi(mr.exp[0], 0), ybit = Str::atoi(mr.exp[1], 0);
Regexp::dispose_of(&mr);
} else return ERRONEOUS_OFFSET_VALUE;

View file

@ -46,7 +46,7 @@ kind *K_scene = NULL;
@ =
int Scenes::new_base_kind_notify(kind *new_base, text_stream *name, wording W) {
if (Str::eq_wide_string(name, L"SCENE_TY")) {
if (Str::eq_wide_string(name, U"SCENE_TY")) {
K_scene = new_base; return TRUE;
}
return FALSE;
@ -273,17 +273,17 @@ ends merrily" and "when the Banquet Entertainment ends merrily".
wording NW = Instances::get_name(sc->as_instance, FALSE);
feed_t id = Feeds::begin();
Feeds::feed_C_string_expanding_strings(L"when");
Feeds::feed_C_string_expanding_strings(U"when");
Feeds::feed_wording(NW);
Feeds::feed_C_string_expanding_strings((end==0)?L"begins":L"ends");
Feeds::feed_C_string_expanding_strings((end==0)?U"begins":U"ends");
if (end >= 2) Feeds::feed_wording(sc->ends[end].end_names);
RW = Feeds::end(id);
id = Feeds::begin();
Feeds::feed_C_string_expanding_strings(L"when the");
Feeds::feed_C_string_expanding_strings(U"when the");
NW = Instances::get_name(sc->as_instance, FALSE);
Feeds::feed_wording(NW);
Feeds::feed_C_string_expanding_strings((end==0)?L"begins":L"ends");
Feeds::feed_C_string_expanding_strings((end==0)?U"begins":U"ends");
if (end >= 2) Feeds::feed_wording(sc->ends[end].end_names);
AW = Feeds::end(id);
@ -292,9 +292,9 @@ ends merrily" and "when the Banquet Entertainment ends merrily".
TEMPORARY_TEXT(i6_code)
feed_t id = Feeds::begin();
Feeds::feed_C_string_expanding_strings(L"To decide if (S - ");
Feeds::feed_C_string_expanding_strings(U"To decide if (S - ");
Feeds::feed_wording(NW);
Feeds::feed_C_string_expanding_strings(L") ended ");
Feeds::feed_C_string_expanding_strings(U") ended ");
Feeds::feed_wording(sc->ends[end].end_names);
Sentences::make_node(Task::syntax_tree(), Feeds::end(id), ':');
@ -306,9 +306,9 @@ ends merrily" and "when the Banquet Entertainment ends merrily".
Sentences::make_node(Task::syntax_tree(), Feeds::end(id), '.');
id = Feeds::begin();
Feeds::feed_C_string_expanding_strings(L"To decide if (S - ");
Feeds::feed_C_string_expanding_strings(U"To decide if (S - ");
Feeds::feed_wording(NW);
Feeds::feed_C_string_expanding_strings(L") did not end ");
Feeds::feed_C_string_expanding_strings(U") did not end ");
Feeds::feed_wording(sc->ends[end].end_names);
Sentences::make_node(Task::syntax_tree(), Feeds::end(id), ':');

View file

@ -219,7 +219,7 @@ int Spatial::new_property_notify(property *prn) {
case 1: P_wearable = prn; break;
case 2: P_fixed_in_place = prn; break;
case 3: P_matching_key = prn;
Properties::set_translation(P_matching_key, L"with_key");
Properties::set_translation(P_matching_key, U"with_key");
break;
}
}

View file

@ -15,13 +15,13 @@ recognised by their Inter identifiers:
=
int ARvalues::new_base_kind_notify(kind *new_base, text_stream *name, wording W) {
if (Str::eq_wide_string(name, L"ACTION_NAME_TY")) {
if (Str::eq_wide_string(name, U"ACTION_NAME_TY")) {
K_action_name = new_base; return TRUE;
}
if (Str::eq_wide_string(name, L"DESCRIPTION_OF_ACTION_TY")) {
if (Str::eq_wide_string(name, U"DESCRIPTION_OF_ACTION_TY")) {
K_description_of_action = new_base; return TRUE;
}
if (Str::eq_wide_string(name, L"STORED_ACTION_TY")) {
if (Str::eq_wide_string(name, U"STORED_ACTION_TY")) {
K_stored_action = new_base; return TRUE;
}
return FALSE;

View file

@ -49,8 +49,8 @@ void ActionsPlugin::start(void) {
PluginCalls::plug(COMPILE_TEST_TAIL_PLUG, RTRules::actions_compile_test_tail);
PluginCalls::plug(NEW_RCD_NOTIFY_PLUG, ActionRules::new_rcd);
Vocabulary::set_flags(Vocabulary::entry_for_text(L"doing"), ACTION_PARTICIPLE_MC);
Vocabulary::set_flags(Vocabulary::entry_for_text(L"asking"), ACTION_PARTICIPLE_MC);
Vocabulary::set_flags(Vocabulary::entry_for_text(U"doing"), ACTION_PARTICIPLE_MC);
Vocabulary::set_flags(Vocabulary::entry_for_text(U"asking"), ACTION_PARTICIPLE_MC);
}
int ActionsPlugin::production_line(int stage, int debugging, stopwatch_timer *sequence_timer) {

View file

@ -52,10 +52,10 @@ mark: thus "get away/off/out" becomes
"get" "away" / "off" / "out"
=
@d GRAMMAR_PUNCTUATION_MARKS L".,:;?!(){}[]/" /* note the slash */
@d GRAMMAR_PUNCTUATION_MARKS U".,:;?!(){}[]/" /* note the slash */
=
wording CGTokens::break(wchar_t *text, int expand) {
wording CGTokens::break(inchar32_t *text, int expand) {
@<Reject this if it contains punctuation@>;
wording TW = Feeds::feed_C_string_full(text, expand,
GRAMMAR_PUNCTUATION_MARKS, TRUE);
@ -119,7 +119,7 @@ wording CGTokens::break(wchar_t *text, int expand) {
@ =
int CGTokens::numerical(int wn) {
wchar_t *text = Lexer::word_text(wn);
inchar32_t *text = Lexer::word_text(wn);
for (int i=0; i<Wide::len(text); i++)
if (Characters::isdigit(text[i]) == FALSE)
return FALSE;
@ -130,7 +130,7 @@ int CGTokens::numerical(int wn) {
=
cg_token *CGTokens::tokenise(wording W) {
wchar_t *as_wide_string = Lexer::word_text(Wordings::first_wn(W));
inchar32_t *as_wide_string = Lexer::word_text(Wordings::first_wn(W));
wording TW = CGTokens::break(as_wide_string, TRUE);
cg_token *tokens = CGTokens::break_into_tokens(TW);
if (Wordings::empty(TW)) return NULL;

View file

@ -65,11 +65,11 @@ void TestCommand::add_possession_to_scenario(test_scenario *test, instance *I) {
test->possessions[test->no_possessions++] = I;
}
void TestCommand::add_script_to_scenario(test_scenario *test, wchar_t *p) {
void TestCommand::add_script_to_scenario(test_scenario *test, inchar32_t *p) {
TEMPORARY_TEXT(individual_command)
Str::clear(test->text_of_script);
for (int i=0; p[i]; i++) {
int c = Characters::tolower(p[i]);
inchar32_t c = Characters::tolower(p[i]);
if (c == ' ') {
int l;
if (Str::len(individual_command) == 0) continue;
@ -94,7 +94,7 @@ void TestCommand::add_script_to_scenario(test_scenario *test, wchar_t *p) {
}
@<Check an individual command@> =
if (Str::eq_wide_string(individual_command, L"undo")) {
if (Str::eq_wide_string(individual_command, U"undo")) {
StandardProblems::sentence_problem(Task::syntax_tree(), _p_(PM_TestContainsUndo),
"this test script contains an UNDO command",
"which the story file has no way to automate the running of. "

View file

@ -517,7 +517,7 @@ to another section: here //CommandGrammars::remove_command// or //CommandGrammar
void Understand::command_block(wording W, wording ASW) {
W = Wordings::last_word(W);
Word::dequote(Wordings::first_wn(W));
wchar_t *p = Lexer::word_text(Wordings::first_wn(W));
inchar32_t *p = Lexer::word_text(Wordings::first_wn(W));
for (int i=0; p[i]; i++)
if (p[i] == ' ') {
StandardProblems::sentence_problem(Task::syntax_tree(), _p_(PM_SpacyCommand),

View file

@ -94,7 +94,7 @@ typedef struct dialogue_line {
int wn = Wordings::first_wn(dl->speech_text);
if (wn >= 0) {
int quote_marks = 0;
wchar_t *p = Lexer::word_text(wn);
inchar32_t *p = Lexer::word_text(wn);
for (int i=0; p[i]; i++)
if ((p[i] == '\'') &&
((i<=1) || (p[i+1] == '\"') ||

View file

@ -27,13 +27,13 @@ kind *K_dialogue_choice = NULL;
@ =
int Dialogue::new_base_kind_notify(kind *new_base, text_stream *name, wording W) {
if (Str::eq_wide_string(name, L"DIALOGUE_BEAT_TY")) {
if (Str::eq_wide_string(name, U"DIALOGUE_BEAT_TY")) {
K_dialogue_beat = new_base; return TRUE;
}
if (Str::eq_wide_string(name, L"DIALOGUE_LINE_TY")) {
if (Str::eq_wide_string(name, U"DIALOGUE_LINE_TY")) {
K_dialogue_line = new_base; return TRUE;
}
if (Str::eq_wide_string(name, L"DIALOGUE_CHOICE_TY")) {
if (Str::eq_wide_string(name, U"DIALOGUE_CHOICE_TY")) {
K_dialogue_choice = new_base; return TRUE;
}
return FALSE;

View file

@ -21,7 +21,7 @@ kind *K_performance_style = NULL;
@ =
int PerformanceStyles::new_base_kind_notify(kind *new_base, text_stream *name, wording W) {
if (Str::eq_wide_string(name, L"PERFORMANCE_STYLE_TY")) {
if (Str::eq_wide_string(name, U"PERFORMANCE_STYLE_TY")) {
K_performance_style = new_base; return TRUE;
}
return FALSE;

View file

@ -34,13 +34,13 @@ void ImperativeModule::start(void) {
REGISTER_WRITER('k', LocalVariables::log);
REGISTER_WRITER('R', ImperativeDefinitions::log_body);
Memory::reason_name(INV_LIST_MREASON, "lists for type-checking invocations");
Log::declare_aspect(DESCRIPTION_COMPILATION_DA, L"description compilation", FALSE, FALSE);
Log::declare_aspect(EXPRESSIONS_DA, L"expressions", FALSE, FALSE);
Log::declare_aspect(LOCAL_VARIABLES_DA, L"local variables", FALSE, FALSE);
Log::declare_aspect(PHRASE_COMPARISONS_DA, L"phrase comparisons", FALSE, FALSE);
Log::declare_aspect(PHRASE_COMPILATION_DA, L"phrase compilation", FALSE, FALSE);
Log::declare_aspect(PHRASE_CREATIONS_DA, L"phrase creations", FALSE, FALSE);
Log::declare_aspect(PHRASE_REGISTRATION_DA, L"phrase registration", FALSE, FALSE);
Log::declare_aspect(DESCRIPTION_COMPILATION_DA, U"description compilation", FALSE, FALSE);
Log::declare_aspect(EXPRESSIONS_DA, U"expressions", FALSE, FALSE);
Log::declare_aspect(LOCAL_VARIABLES_DA, U"local variables", FALSE, FALSE);
Log::declare_aspect(PHRASE_COMPARISONS_DA, U"phrase comparisons", FALSE, FALSE);
Log::declare_aspect(PHRASE_COMPILATION_DA, U"phrase compilation", FALSE, FALSE);
Log::declare_aspect(PHRASE_CREATIONS_DA, U"phrase creations", FALSE, FALSE);
Log::declare_aspect(PHRASE_REGISTRATION_DA, U"phrase registration", FALSE, FALSE);
}
void ImperativeModule::end(void) {
}

View file

@ -228,7 +228,7 @@ int CodeBlocks::current_block_level(void) {
return current_block_stack.pb_sp;
}
wchar_t *CodeBlocks::name_of_current_block(void) {
inchar32_t *CodeBlocks::name_of_current_block(void) {
if (block_being_compiled == NULL) return NULL;
return ControlStructures::incipit(block_being_compiled->from_structure);
}

View file

@ -193,7 +193,7 @@ void CompileImperativeDefn::make_inline(id_body *idb, int inline_wn, int mor) {
idb->compilation_data.at_least_one_compiled_form_needed = FALSE;
}
wchar_t *CompileImperativeDefn::get_inline_definition(id_body *idb) {
inchar32_t *CompileImperativeDefn::get_inline_definition(id_body *idb) {
if (idb->compilation_data.inline_wn < 0)
internal_error("tried to access inline definition of non-inline phrase");
return Lexer::word_text(idb->compilation_data.inline_wn);

View file

@ -58,7 +58,7 @@ we simply give in and throw a problem.
return symb;
@<Extract an identifier from the inline definition@> =
wchar_t *p = CompileImperativeDefn::get_inline_definition(idb);
inchar32_t *p = CompileImperativeDefn::get_inline_definition(idb);
for (int i=0; p[i]; i++)
if (Characters::isalpha(p[i])) {
int j = 0;

View file

@ -615,7 +615,7 @@ that would be "property name". Instead:
if ((E == NULL) || (E->as_copy->location_if_path == NULL))
@<Throw PM_RTPOnlyInExtensions@>
else {
wchar_t *p = Lexer::word_text(w1);
inchar32_t *p = Lexer::word_text(w1);
TEMPORARY_TEXT(pcode)
for (; *p; p++) if (*p != '"') PUT_TO(pcode, *p);
EmitCode::val_text(pcode);
@ -643,7 +643,7 @@ that would be "property name". Instead:
if ((E == NULL) || (E->as_copy->location_if_path == NULL))
@<Throw PM_RTPOnlyInExtensions@>
else {
wchar_t *p = Lexer::word_text(w1);
inchar32_t *p = Lexer::word_text(w1);
TEMPORARY_TEXT(pcode)
for (; *p; p++) if (*p != '"') PUT_TO(pcode, *p);
pathname *P = Pathnames::down(E->as_copy->location_if_path, I"RTPs");
@ -1026,7 +1026,7 @@ the second time it's simply printed.)
@<Inline command "my"@> =
local_variable *lvar = NULL;
int n = Str::get_at(ist->operand, 0) - '0';
int n = (int) (Str::get_at(ist->operand, 0) - '0');
if ((Str::get_at(ist->operand, 1) == 0) && (n >= 0) && (n < 10))
@<A single digit as the name@>
else
@ -1242,7 +1242,7 @@ or decrements. But be wary here, because |{-copy:S:+}| adds 1 to S, whereas
@<Find what we are copying from, to and how@> =
TEMPORARY_TEXT(from_p)
int c = Str::get_first_char(ist->operand2);
inchar32_t c = Str::get_first_char(ist->operand2);
if (c == '+') { copy_form = 1; Str::copy_tail(from_p, ist->operand2, 1); }
else if (c == '-') { copy_form = -1; Str::copy_tail(from_p, ist->operand2, 1); }
else Str::copy(from_p, ist->operand2);
@ -1574,7 +1574,7 @@ especially those involving complicated linguistic propositions.
CodeBlocks::emit_break();
break;
case verbose_checking_ISINSC: {
wchar_t *what = L"";
inchar32_t *what = U"";
if (tokens->tokens_count > 0) {
parse_node *aspect = tokens->token_vals[0];
if (Wordings::nonempty(Node::get_text(aspect))) {
@ -1700,9 +1700,9 @@ To give up deciding:
=
kind *CSIInline::parse_bracing_operand_as_kind(text_stream *operand,
kind_variable_declaration *kvd) {
if (Str::eq_wide_string(operand, L"return-kind"))
if (Str::eq_wide_string(operand, U"return-kind"))
return Frames::get_kind_returned();
if (Str::eq_wide_string(operand, L"rule-return-kind"))
if (Str::eq_wide_string(operand, U"rule-return-kind"))
return Rulebooks::kind_from_context();
kind *kind_vars_inline[27];
for (int i=0; i<27; i++) kind_vars_inline[i] = NULL;

View file

@ -49,14 +49,14 @@ void KnowledgeModule::start(void) {
REGISTER_WRITER('K', Rulebooks::log);
REGISTER_WRITER('n', Inferences::log_family)
REGISTER_WRITER('Y', Properties::log);
Log::declare_aspect(ACTIVITY_CREATIONS_DA, L"activity creations", FALSE, FALSE);
Log::declare_aspect(INFERENCES_DA, L"inferences", FALSE, TRUE);
Log::declare_aspect(OBJECT_COMPILATION_DA, L"object compilation", FALSE, FALSE);
Log::declare_aspect(PROPERTY_CREATIONS_DA, L"property creations", FALSE, FALSE);
Log::declare_aspect(PROPERTY_PROVISION_DA, L"property provision", FALSE, FALSE);
Log::declare_aspect(PROPERTY_TRANSLATIONS_DA, L"property translations", FALSE, FALSE);
Log::declare_aspect(RULE_ATTACHMENTS_DA, L"rule attachments", FALSE, FALSE);
Log::declare_aspect(RULEBOOK_COMPILATION_DA, L"rulebook compilation", FALSE, FALSE);
Log::declare_aspect(ACTIVITY_CREATIONS_DA, U"activity creations", FALSE, FALSE);
Log::declare_aspect(INFERENCES_DA, U"inferences", FALSE, TRUE);
Log::declare_aspect(OBJECT_COMPILATION_DA, U"object compilation", FALSE, FALSE);
Log::declare_aspect(PROPERTY_CREATIONS_DA, U"property creations", FALSE, FALSE);
Log::declare_aspect(PROPERTY_PROVISION_DA, U"property provision", FALSE, FALSE);
Log::declare_aspect(PROPERTY_TRANSLATIONS_DA, U"property translations", FALSE, FALSE);
Log::declare_aspect(RULE_ATTACHMENTS_DA, U"rule attachments", FALSE, FALSE);
Log::declare_aspect(RULEBOOK_COMPILATION_DA, U"rulebook compilation", FALSE, FALSE);
Memory::reason_name(INSTANCE_COUNTING_MREASON, "instance-of-kind counting");
Memory::reason_name(COMPILATION_SIZE_MREASON, "size estimates for compiled objects");
Memory::reason_name(OBJECT_COMPILATION_MREASON, "compilation workspace for objects");

View file

@ -408,7 +408,7 @@ to sentences like:
void Properties::translates(wording W, parse_node *p2) {
property *prn = NULL;
if (<property-name>(W)) prn = <<rp>>;
wchar_t *text = Lexer::word_text(Wordings::first_wn(Node::get_text(p2)));
inchar32_t *text = Lexer::word_text(Wordings::first_wn(Node::get_text(p2)));
@<Make sure this is a genuine property@>;
@<Make sure this is a previously untranslated property@>;
@ -581,7 +581,7 @@ defined in a kit of Inter code, and "P translates into Inter as N" will
arrange for that. Such translations can be done with one of two functions:
=
void Properties::set_translation(property *prn, wchar_t *t) {
void Properties::set_translation(property *prn, inchar32_t *t) {
if (prn == NULL) internal_error("translation set for null property");
if ((Properties::is_either_or(prn)) && (prn->compilation_data.store_in_negation)) {
Properties::set_translation(EitherOrProperties::get_negation(prn), t);
@ -607,9 +607,9 @@ void Properties::set_translation_from_text(property *prn, text_stream *t) {
RTProperties::iname(prn);
TEMPORARY_TEXT(T)
LOOP_THROUGH_TEXT(pos, t) {
wchar_t c = Str::get(pos);
if ((isalpha(c)) || (Characters::isdigit(c)) || (c == '_'))
PUT_TO(T, (int) c);
inchar32_t c = Str::get(pos);
if ((Characters::isalpha(c)) || (Characters::isdigit(c)) || (c == '_'))
PUT_TO(T, c);
else
PUT_TO(T, '_');
}

View file

@ -109,7 +109,7 @@ We cache the text literal "the" rather than create it over and over.
parse_node *text_of_word_the = NULL;
void Naming::object_takes_definite_article(inference_subject *subj) {
if (text_of_word_the == NULL)
text_of_word_the = Rvalues::from_wording(Feeds::feed_C_string(L"\"the\""));
text_of_word_the = Rvalues::from_wording(Feeds::feed_C_string(U"\"the\""));
ValueProperties::assert(P_article, subj, text_of_word_the, LIKELY_CE);
}
@ -230,7 +230,7 @@ a comma, and that's caught here:
}
int begins_with_lower_case = FALSE;
if (Wordings::nonempty(W)) {
wchar_t *p = Lexer::word_raw_text(Wordings::first_wn(W));
inchar32_t *p = Lexer::word_raw_text(Wordings::first_wn(W));
if (Characters::islower(p[0])) begins_with_lower_case = TRUE;
}
@<Assert the I6 short-name property@>;
@ -378,7 +378,7 @@ void Naming::compose_words_to_I6_naming_text(OUTPUT_STREAM, wording W, int cap,
if (Wordings::nonempty(W)) {
LOOP_THROUGH_WORDING(j, W) {
int your_here = <possessive-second-person>(Wordings::one_word(j));
wchar_t *p = Lexer::word_raw_text(j);
inchar32_t *p = Lexer::word_raw_text(j);
if (cap) {
if ((j==Wordings::first_wn(W)) && (your_here) && (your_flag)) {
PUT(Characters::toupper(p[0]));

View file

@ -30,7 +30,7 @@ void MultimediaModule::start(void) {
internal_files_feature = Features::new(&InternalFiles::start, I"glulx internal files",
multimedia_feature);
Log::declare_aspect(MULTIMEDIA_CREATIONS_DA, L"figure creations", FALSE, FALSE);
Log::declare_aspect(MULTIMEDIA_CREATIONS_DA, U"figure creations", FALSE, FALSE);
}
void MultimediaModule::end(void) {
}

View file

@ -121,7 +121,7 @@ void ExternalFiles::register_file(wording W, wording FN) {
<external-file-sentence-object>(FN);
FN = Wordings::from(FN, <<r>>);
if (Wordings::empty(FN)) return;
wchar_t *p = Lexer::word_text(Wordings::first_wn(FN));
inchar32_t *p = Lexer::word_text(Wordings::first_wn(FN));
if (<external-file-sentence-subject>(W) == FALSE) internal_error("bad ef grammar");
wording NW = GET_RW(<external-file-name>, 1);
int format = <<r>>;
@ -158,7 +158,7 @@ void ExternalFiles::register_file(wording W, wording FN) {
if ((i==0) || (p[i+1] == 0)) continue;
}
if (i>24) bad_filename = TRUE;
if ((isalpha(p[i])) || (Characters::isdigit(p[i]))) continue;
if ((Characters::isalpha(p[i])) || (Characters::isdigit(p[i]))) continue;
if ((format == INTERNAL_TEXT_FILE_NFSMF) ||
(format == INTERNAL_BINARY_FILE_NFSMF))
if ((p[i] == '.') || (p[i] == '_') || (p[i] == ' ')) continue;
@ -194,7 +194,7 @@ by an unspecified other project, or by a project identified by its IFID.
for (j=1; (j<47) && (p[j]); j++) {
if ((p[j] == '"') && (p[j+1] == 0)) break;
PUT_TO(ifid_of_file, p[j]);
if ((isalpha(p[j])) || (Characters::isdigit(p[j]))) continue;
if ((Characters::isalpha(p[j])) || (Characters::isdigit(p[j]))) continue;
if (p[j] == '-') continue;
invalid = TRUE;
LOG("Objected to character %c\n", p[j]);
@ -228,7 +228,7 @@ kind *K_external_file = NULL;
@ =
int ExternalFiles::files_new_base_kind_notify(kind *new_base, text_stream *name, wording W) {
if (Str::eq_wide_string(name, L"EXTERNAL_FILE_TY")) {
if (Str::eq_wide_string(name, U"EXTERNAL_FILE_TY")) {
K_external_file = new_base; return TRUE;
}
return FALSE;

View file

@ -142,7 +142,7 @@ detects that this has happened, and sets |K_figure_name| to point to it.
=
int Figures::figures_new_base_kind_notify(kind *new_base, text_stream *name, wording W) {
if (Str::eq_wide_string(name, L"FIGURE_NAME_TY")) {
if (Str::eq_wide_string(name, U"FIGURE_NAME_TY")) {
K_figure_name = new_base; return TRUE;
}
return FALSE;
@ -204,8 +204,8 @@ int Figures::figures_new_named_instance_notify(instance *I) {
description appears in the iFiction metadata for a project.
=
wchar_t *Figures::description_of_cover_art(void) {
if ((F_cover_art == NULL) || (F_cover_art->alt_description == -1)) return L"";
inchar32_t *Figures::description_of_cover_art(void) {
if ((F_cover_art == NULL) || (F_cover_art->alt_description == -1)) return U"";
return Lexer::word_text(F_cover_art->alt_description);
}
@ -260,7 +260,7 @@ void Figures::write_blurb_commands(OUTPUT_STREAM) {
figures_data *figd;
LOOP_OVER(figd, figures_data)
if (figd->figure_number > 1) {
wchar_t *desc = L"";
inchar32_t *desc = U"";
if (figd->alt_description >= 0)
desc = Lexer::word_text(figd->alt_description);
if (Wide::len(desc) > 0)
@ -281,6 +281,6 @@ void Figures::write_copy_commands(release_instructions *rel) {
LOOP_OVER(figd, figures_data)
if (figd->figure_number > 1)
ReleaseInstructions::add_aux_file(rel, figd->filename_of_image_file,
Task::released_figures_path(), L"--", SEPARATE_FIGURES_PAYLOAD);
Task::released_figures_path(), U"--", SEPARATE_FIGURES_PAYLOAD);
}

View file

@ -27,7 +27,7 @@ kind *K_internal_file = NULL;
@ =
int InternalFiles::files_new_base_kind_notify(kind *new_base, text_stream *name, wording W) {
if (Str::eq_wide_string(name, L"INTERNAL_FILE_TY")) {
if (Str::eq_wide_string(name, U"INTERNAL_FILE_TY")) {
K_internal_file = new_base; return TRUE;
}
return FALSE;

View file

@ -132,7 +132,7 @@ detects that this has happened, and sets |K_sound_name| to point to it.
=
int Sounds::new_base_kind_notify(kind *new_base, text_stream *name, wording W) {
if (Str::eq_wide_string(name, L"SOUND_NAME_TY")) {
if (Str::eq_wide_string(name, U"SOUND_NAME_TY")) {
K_sound_name = new_base; return TRUE;
}
return FALSE;
@ -217,7 +217,7 @@ void Sounds::write_blurb_commands(OUTPUT_STREAM) {
if (FEATURE_INACTIVE(sounds)) return;
sounds_data *sd;
LOOP_OVER(sd, sounds_data) {
wchar_t *desc = L"";
inchar32_t *desc = U"";
if (sd->alt_description >= 0)
desc = Lexer::word_text(sd->alt_description);
if (Wide::len(desc) > 0)
@ -238,6 +238,6 @@ void Sounds::write_copy_commands(release_instructions *rel) {
ReleaseInstructions::add_aux_file(rel,
sd->filename_of_sound_file,
Task::released_sounds_path(),
L"--",
U"--",
SEPARATE_SOUNDS_PAYLOAD);
}

View file

@ -22,8 +22,8 @@ void RuntimeModule::start(void) {
Memory::reason_name(EMIT_ARRAY_MREASON, "emitter array storage");
Memory::reason_name(PARTITION_MREASON, "initial state for relations in groups");
Memory::reason_name(RELATION_CONSTRUCTION_MREASON, "relation bitmap storage");
Log::declare_aspect(HIERARCHY_DA, L"inter hierarchy", FALSE, FALSE);
Log::declare_aspect(USE_OPTIONS_DA, L"use options", FALSE, FALSE);
Log::declare_aspect(HIERARCHY_DA, U"inter hierarchy", FALSE, FALSE);
Log::declare_aspect(USE_OPTIONS_DA, U"use options", FALSE, FALSE);
}
void RuntimeModule::end(void) {
}

View file

@ -260,7 +260,7 @@ all zeros", and otherwise we look for a comma-separated list to fill it.
int err = FALSE, count = 0;
TEMPORARY_TEXT(term)
for (int i=0, state=1; i<Str::len(textual_description); i++) {
wchar_t c = Str::get_at(textual_description, i);
inchar32_t c = Str::get_at(textual_description, i);
switch (state) {
case 1: /* waiting for term */
if (c == ' ') break;

View file

@ -214,7 +214,7 @@ inter_name *Emit::iname_constant(inter_name *con_iname, kind *K, inter_name *val
is compiled.
=
void Emit::text_constant_from_wide_string(inter_name *con_iname, wchar_t *str) {
void Emit::text_constant_from_wide_string(inter_name *con_iname, inchar32_t *str) {
inter_name *iname = TextLiterals::to_value(Feeds::feed_C_string(str));
Emit::named_generic_constant(con_iname,
Emit::to_value_pair_in_context(con_iname, iname));

View file

@ -57,7 +57,7 @@ text_stream *EqualitySchemas::interpret_equality(kind *left, kind *right) {
text_stream *cr = Kinds::Behaviour::get_comparison_routine(left);
if ((Str::len(cr) == 0) ||
(Str::eq_wide_string(cr, L"signed")) ||
(Str::eq_wide_string(cr, L"UnsignedCompare"))) return I"*=-*1 == *2";
(Str::eq_wide_string(cr, U"signed")) ||
(Str::eq_wide_string(cr, U"UnsignedCompare"))) return I"*=-*1 == *2";
return I"*=- *_1(*1, *2) == 0";
}

View file

@ -110,7 +110,7 @@ text_stream *Interventions::expand_bracket_plus(text_stream *S) {
goto NewCharacter;
}
}
if (OUT) PUT_TO(OUT, cr);
if (OUT) PUT_TO(OUT, (inchar32_t) cr);
} while (cr != EOF);
DISCARD_TEXT(command)
DISCARD_TEXT(argument)
@ -119,7 +119,7 @@ text_stream *Interventions::expand_bracket_plus(text_stream *S) {
}
@<Read next character@> =
cr = Str::get_at(S, sfp); if (cr == 0) cr = EOF; else sfp++;
cr = (int) Str::get_at(S, sfp); if (cr == 0) cr = EOF; else sfp++;
col++; if ((cr == 10) || (cr == 13)) col = 0;
@ Our biggest complication is that I7 expressions can be included in the I6
@ -142,7 +142,7 @@ which can trigger an unwanted |(+|.
if (cr == EOF) break;
if ((cr == ')') && (Str::get_last_char(i7_exp) == '+')) {
Str::delete_last_character(i7_exp); break; }
PUT_TO(i7_exp, cr);
PUT_TO(i7_exp, (inchar32_t) cr);
}
wording W = Feeds::feed_text(i7_exp);
CSIInline::eval_bracket_plus_to_text(OUT, W);
@ -156,8 +156,8 @@ which can trigger an unwanted |(+|.
@<Read next character@>;
if ((cr == '}') || (cr == EOF)) break;
if ((cr == ':') && (com_mode)) { com_mode = FALSE; continue; }
if (com_mode) PUT_TO(command, cr);
else PUT_TO(argument, cr);
if (com_mode) PUT_TO(command, (inchar32_t) cr);
else PUT_TO(argument, (inchar32_t) cr);
}
@<Act on I6T command and argument@> =

View file

@ -462,17 +462,17 @@ int RTUseOptions::handle_deprecated_definition(text_stream *UO, int active, int
int rv = FALSE;
inter_ti val = 0; text_stream *identifier = NULL;
match_results mr = Regexp::create_mr();
if (Regexp::match(&mr, UO, L" *Constant (%C+) *; *")) {
if (Regexp::match(&mr, UO, U" *Constant (%C+) *; *")) {
identifier = mr.exp[0];
} else if (Regexp::match(&mr, UO, L" *Constant (%C+) *= *(%d+) *; *")) {
} else if (Regexp::match(&mr, UO, U" *Constant (%C+) *= *(%d+) *; *")) {
identifier = mr.exp[0]; val = (inter_ti) Str::atoi(mr.exp[1], 0);
} else if (Regexp::match(&mr, UO, L" *Constant (%C+) *= *{N} *; *")) {
} else if (Regexp::match(&mr, UO, U" *Constant (%C+) *= *{N} *; *")) {
identifier = mr.exp[0]; val = (inter_ti) N;
} else if (Regexp::match(&mr, UO, L" *Constant (%C+) *= *{N} *%+ *(%d+) *; *")) {
} else if (Regexp::match(&mr, UO, U" *Constant (%C+) *= *{N} *%+ *(%d+) *; *")) {
identifier = mr.exp[0];
val = (inter_ti) (N + Str::atoi(mr.exp[1], 0));
} else if ((Regexp::match(&mr, UO, L" *Constant (%C+) *= *{N} *%* *(%d+) *; *")) ||
(Regexp::match(&mr, UO, L" *Constant (%C+) *= *(%d+) *%* *{N} *; *"))) {
} else if ((Regexp::match(&mr, UO, U" *Constant (%C+) *= *{N} *%* *(%d+) *; *")) ||
(Regexp::match(&mr, UO, U" *Constant (%C+) *= *(%d+) *%* *{N} *; *"))) {
identifier = mr.exp[0];
val = (inter_ti) (N * Str::atoi(mr.exp[1], 0));
}

View file

@ -12,7 +12,7 @@ related to any other.
The following function compiles an array ready to be |Q|, with some initial
capacity in it to absorb relationships forged at runtime. This is the default
value of kinds using the "relation of K to L" constructor.
value of kinds using the "relation of K to U" constructor.
The runtime representation of temporary relations like this one is complex.
See //Relations// and //BasicInformKit: Relations//.

View file

@ -87,7 +87,7 @@ inter_name *TextLiterals::to_value_unescaped(wording W) {
inter_name *TextLiterals::to_value_inner(wording W, int unesc) {
int w1 = Wordings::first_wn(W);
if (Wide::cmp(Lexer::word_text(w1), L"\"\"") == 0)
if (Wide::cmp(Lexer::word_text(w1), U"\"\"") == 0)
return TextLiterals::default_text();
inter_name *content_iname = Enclosures::new_iname(LITERALS_HAP, TEXT_LITERAL_HL);

View file

@ -167,10 +167,10 @@ void RTVerbs::tabulate_usages(package_request *R, verb_conjugation *vc, int tens
&& (VerbUsages::get_tense_used(vu) == tense)) {
vocabulary_entry *lastword = WordAssemblages::last_word(&(vu->vu_text));
if (c++ > 0) WRITE_TO(USAGES, "; ");
if (Wide::cmp(Vocabulary::get_exemplar(lastword, FALSE), L"by") == 0) WRITE_TO(USAGES, "B ");
if (Wide::cmp(Vocabulary::get_exemplar(lastword, FALSE), U"by") == 0) WRITE_TO(USAGES, "B ");
else WRITE_TO(USAGES, "A ");
WordAssemblages::index(USAGES, &(vu->vu_text));
if (Wide::cmp(Vocabulary::get_exemplar(lastword, FALSE), L"by") == 0) WRITE_TO(USAGES, "A");
if (Wide::cmp(Vocabulary::get_exemplar(lastword, FALSE), U"by") == 0) WRITE_TO(USAGES, "A");
else WRITE_TO(USAGES, "B");
}
if (Str::len(USAGES) > 0) Hierarchy::apply_metadata(R, hl, USAGES);
@ -673,7 +673,7 @@ void RTVerbs::conj_from_wa(word_assemblage *wa, verb_conjugation *vc,
int RTVerbs::takes_contraction_form(word_assemblage *wa) {
vocabulary_entry *ve = WordAssemblages::first_word(wa);
if (ve == NULL) return FALSE;
wchar_t *p = Vocabulary::get_exemplar(ve, FALSE);
inchar32_t *p = Vocabulary::get_exemplar(ve, FALSE);
if (p[0] == '\'') return TRUE;
return FALSE;
}

View file

@ -368,13 +368,13 @@ South" comes out as "QS".
LOOP_THROUGH_WORDING(i, W) {
if ((i > Wordings::first_wn(W)) && (i < Wordings::last_wn(W)) &&
(<map-name-abbreviation-omission-words>(Wordings::one_word(i)))) continue;
wchar_t *p = Lexer::word_raw_text(i);
inchar32_t *p = Lexer::word_raw_text(i);
if (c++ < ABBREV_ROOMS_TO) PUT_TO(abbrev, Characters::toupper(p[0]));
}
LOOP_THROUGH_WORDING(i, W) {
if ((i > Wordings::first_wn(W)) && (i < Wordings::last_wn(W)) &&
(<map-name-abbreviation-omission-words>(Wordings::one_word(i)))) continue;
wchar_t *p = Lexer::word_raw_text(i);
inchar32_t *p = Lexer::word_raw_text(i);
for (int j=1; p[j]; j++)
if (Characters::vowel(p[j]) == FALSE)
if (c++ < ABBREV_ROOMS_TO) PUT_TO(abbrev, p[j]);

View file

@ -121,7 +121,7 @@ void RTLiteralPatterns::compilation_agent(compilation_subtask *t) {
@<Compile Inter to print a character token within a literal pattern@> =
TEMPORARY_TEXT(T)
TEMPORARY_TEXT(tiny_string)
PUT_TO(tiny_string, (int) lp->lp_tokens[tc].token_char);
PUT_TO(tiny_string, lp->lp_tokens[tc].token_char);
TranscodeText::from_stream(T, tiny_string, CT_RAW);
DISCARD_TEXT(tiny_string)
EmitCode::inv(PRINT_BIP);
@ -557,8 +557,8 @@ sets the |parsed_number| global to the value matched.
@<Compile Inter to match a character token within a literal pattern@> =
@<Compile Inter to enter mid-word parsing if not already in it@>;
wchar_t lower_form = Characters::tolower(lp->lp_tokens[tc].token_char);
wchar_t upper_form = Characters::toupper(lp->lp_tokens[tc].token_char);
inchar32_t lower_form = Characters::tolower(lp->lp_tokens[tc].token_char);
inchar32_t upper_form = Characters::toupper(lp->lp_tokens[tc].token_char);
EmitCode::inv(IF_BIP);
EmitCode::down();

Some files were not shown because too many files have changed in this diff Show more