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

Moved two extension problems from inform to inbuild

This commit is contained in:
Graham Nelson 2020-02-18 00:41:18 +00:00
parent 1558194b45
commit 7043d6c855
28 changed files with 86 additions and 83 deletions

View file

@ -144,6 +144,8 @@ therefore has a list attached of errors which occurred in reading it.
@e OPEN_FAILED_CE from 1
@e EXT_MISWORDED_CE
@e EXT_TITLE_TOO_LONG_CE
@e EXT_AUTHOR_TOO_LONG_CE
@e LEXER_CE
=
@ -155,6 +157,7 @@ typedef struct copy_error {
struct text_file_position pos;
struct text_stream *notes;
struct text_stream *details;
int details_N;
wchar_t *word;
MEMORY_MANAGEMENT
} copy_error;
@ -166,12 +169,19 @@ copy_error *Copies::new_error(int cat, text_stream *NB) {
CE->file = NULL;
CE->notes = Str::duplicate(NB);
CE->details = NULL;
CE->details_N = -1;
CE->pos = TextFiles::nowhere();
CE->copy = NULL;
CE->word = NULL;
return CE;
}
copy_error *Copies::new_error_N(int cat, int N) {
copy_error *CE = Copies::new_error(cat, NULL);
CE->details_N = N;
return CE;
}
copy_error *Copies::new_error_on_file(int cat, filename *F) {
copy_error *CE = Copies::new_error(cat, NULL);
CE->file = F;
@ -193,6 +203,10 @@ void Copies::list_problems_arising(OUTPUT_STREAM, inbuild_copy *C) {
switch (CE->error_category) {
case OPEN_FAILED_CE: WRITE("unable to open file %f", CE->file); break;
case EXT_MISWORDED_CE: WRITE("extension misworded: %S", CE->notes); break;
case EXT_TITLE_TOO_LONG_CE: WRITE("title too long: %d characters (max is %d)",
CE->details_N, MAX_EXTENSION_TITLE_LENGTH); break;
case EXT_AUTHOR_TOO_LONG_CE: WRITE("author name too long: %d characters (max is %d)",
CE->details_N, MAX_EXTENSION_AUTHOR_LENGTH); break;
case LEXER_CE: WRITE("%S", CE->notes); break;
default: internal_error("an unknown error occurred");
}

View file

@ -103,6 +103,12 @@ inbuild_copy *ExtensionManager::claim_file_as_copy(filename *F,
Copies::edition(Works::new(extension_genre, title, author), V), F);
if (Str::len(error_text) > 0)
Copies::attach(C, Copies::new_error(EXT_MISWORDED_CE, error_text));
if (Str::len(title) > MAX_EXTENSION_TITLE_LENGTH) {
Copies::attach(C, Copies::new_error_N(EXT_TITLE_TOO_LONG_CE, Str::len(title)));
}
if (Str::len(author) > MAX_EXTENSION_AUTHOR_LENGTH) {
Copies::attach(C, Copies::new_error_N(EXT_AUTHOR_TOO_LONG_CE, Str::len(author)));
}
if ((allow_malformed) || (Str::len(error_text) == 0)) {
Works::add_to_database(C->edition->work, CLAIMED_WDBC);
ExtensionManager::build_vertex(C);

View file

@ -0,0 +1,3 @@
When To The Sessions Of Sweet Silent Thought I Conjure Up by Araminta Intest begins here.
When To The Sessions Of Sweet Silent Thought I Conjure Up ends here.

View file

@ -0,0 +1,3 @@
Extauthortoolong Extension by Araminta Spongiform Pterodactyl Brontosaurus Spam Spam Spam Spam Spam Intest begins here.
Extauthortoolong Extension ends here.

View file

@ -1,4 +1,6 @@
PM_ExtMiswordedBeginsHere
PM_ExtTitleTooLong
PM_ExtAuthorTooLong
PM_TooMuchQuotedText
PM_WordTooLong
PM_UnendingQuote

View file

@ -0,0 +1,3 @@
Include Extauthortoolong Extension by Araminta Spongiform Pterodactyl Brontosaurus Spam Spam Spam Spam Spam Intest.
Xenon is a room.

View file

@ -0,0 +1,3 @@
Include When To The Sessions Of Sweet Silent Thought I Conjure Up by Araminta Intest.
Xenon is a room.

View file

@ -1,11 +0,0 @@
Include Blah by Author aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaaa
aaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaaaaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaaaaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaaaaa aaaaaaa aaaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa.

View file

@ -0,0 +1,11 @@
Inform 7.10.1 build 6Q21 has started.
I've now read your source text, which is 18 words long.
I've also read Basic Inform by Graham Nelson, which is 7645 words long.
I've also read English Language by Graham Nelson, which is 2328 words long.
I've also read Standard Rules by Graham Nelson, which is 32123 words long.
Problem__ PM_ExtAuthorTooLong
>--> The extension Extauthortoolong Extension by Araminta Spongiform
Pterodactyl Brontosaurus Spam Spam Spam Spam Spam Intest, which your source
text makes use of, has an author name which is too long, exceeding the
maximum allowed (51 characters) by 25.
Inform 7 has finished: 12 centiseconds used.

View file

@ -0,0 +1,10 @@
Inform 7.10.1 build 6Q21 has started.
I've now read your source text, which is 19 words long.
I've also read Basic Inform by Graham Nelson, which is 7645 words long.
I've also read English Language by Graham Nelson, which is 2328 words long.
I've also read Standard Rules by Graham Nelson, which is 32123 words long.
Problem__ PM_ExtTitleTooLong
>--> The extension When To The Sessions Of Sweet Silent Thought I Conjure Up
by Araminta Intest, which your source text makes use of, has a title which
is too long, exceeding the maximum allowed (51 characters) by 6.
Inform 7 has finished: 12 centiseconds used.

View file

@ -1,37 +0,0 @@
Inform 7.10.1 build 6Q21 has started.
I've now read your source text, which is 127 words long.
I've also read Basic Inform by Graham Nelson, which is 7645 words long.
I've also read English Language by Graham Nelson, which is 2328 words long.
I've also read Standard Rules by Graham Nelson, which is 32123 words long.
Problem__ PM_IncludesTooLong
>--> The extension Blah by Author aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaaaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaaaaaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa, which your source text requests, has an author's name
which is too long, exceeding the maximum allowed (50 characters) by 1025.
Problem__ PM_BogusExtension
>--> I can't find the extension requested by: 'Include Blah by Author aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaaaaa aaaaaaaaaaaaaa aaaaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaaaaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaa aaaaaaaaaa aaaaaaa aaaaaaa
aaaaaaa aaaaaaa aaaaaaa' (source text, line 1). You can get hold of
extensions which people have made public at the Inform website,
www.inform7.com, or by using the Public Library in the Extensions panel.
Inform 7 has finished: 13 centiseconds used.

View file

@ -217,7 +217,7 @@ list is not exhaustive.
@<Perform lexical analysis@> =
ProgressBar::update_progress_bar(0, 0);
if (problem_count == 0) CoreMain::go_to_log_phase(I"Lexical analysis");
COMPILATION_STEP(SourceFiles::read_primary_source_text, I"SourceFiles::read_primary_source_text")
SourceFiles::read(Inbuild::project()->as_copy);
COMPILATION_STEP(Sentences::RuleSubtrees::create_standard_csps, I"Sentences::RuleSubtrees::create_standard_csps")
@<Perform semantic analysis@> =

View file

@ -12,8 +12,7 @@ does this), and some extensions, such as Basic Inform, need to be given
inclusion sentences -- see Kits.
=
void SourceFiles::read_primary_source_text(void) {
inbuild_copy *C = Inbuild::project()->as_copy;
void SourceFiles::read(inbuild_copy *C) {
Copies::read_source_text_for(C);
SourceFiles::issue_problems_arising(C);
}
@ -43,6 +42,34 @@ void SourceFiles::issue_problems_arising(inbuild_copy *C) {
"Specifically, %2.");
Problems::issue_problem_end();
break;
case EXT_TITLE_TOO_LONG_CE: {
int max = MAX_EXTENSION_TITLE_LENGTH;
int overage = CE->details_N - MAX_EXTENSION_TITLE_LENGTH;
Problems::quote_work(1, CE->copy->found_by->work);
Problems::quote_number(2, &max);
Problems::quote_number(3, &overage);
Problems::Issue::handmade_problem(_p_(PM_ExtTitleTooLong));
Problems::issue_problem_segment(
"The extension %1, which your source text makes use of, has a "
"title which is too long, exceeding the maximum allowed "
"(%2 characters) by %3.");
Problems::issue_problem_end();
break;
}
case EXT_AUTHOR_TOO_LONG_CE: {
int max = MAX_EXTENSION_AUTHOR_LENGTH;
int overage = CE->details_N - MAX_EXTENSION_AUTHOR_LENGTH;
Problems::quote_work(1, CE->copy->found_by->work);
Problems::quote_number(2, &max);
Problems::quote_number(3, &overage);
Problems::Issue::handmade_problem(_p_(PM_ExtAuthorTooLong));
Problems::issue_problem_segment(
"The extension %1, which your source text makes use of, has an "
"author name which is too long, exceeding the maximum allowed "
"(%2 characters) by %3.");
Problems::issue_problem_end();
break;
}
case LEXER_CE:
switch (CE->error_subcategory) {
case STRING_TOO_LONG_LEXERERROR:

View file

@ -125,29 +125,10 @@ parse tree.
if (version_word >= 0)
Extensions::Inclusion::parse_version(version_word); /* this checks the formatting of the version number */
TEMPORARY_TEXT(violation);
TEMPORARY_TEXT(exft);
TEMPORARY_TEXT(exfa);
WRITE_TO(exft, "%+W", W);
WRITE_TO(exfa, "%+W", AW);
if (Extensions::Census::currently_recording_errors() == FALSE) {
if (Str::len(exfa) >= MAX_EXTENSION_AUTHOR_LENGTH) {
WRITE_TO(violation,
"has an author's name which is too long, exceeding the maximum "
"allowed (%d characters) by %d",
MAX_EXTENSION_AUTHOR_LENGTH-1,
(int) (1+Str::len(exfa)-MAX_EXTENSION_AUTHOR_LENGTH));
Str::truncate(exfa, MAX_EXTENSION_AUTHOR_LENGTH-1);
}
if (Str::len(exft) >= MAX_EXTENSION_AUTHOR_LENGTH) {
WRITE_TO(violation,
"has a title which is too long, exceeding the maximum allowed "
"(%d characters) by %d",
MAX_EXTENSION_TITLE_LENGTH-1,
(int) (1+Str::len(exft)-MAX_EXTENSION_TITLE_LENGTH));
Str::truncate(exft, MAX_EXTENSION_AUTHOR_LENGTH-1);
}
}
inbuild_work *work = Works::new(extension_genre, exft, exfa);
Works::add_to_database(work, LOADED_WDBC);
inbuild_version_number min = VersionNumbers::null();
@ -155,16 +136,6 @@ parse tree.
inbuild_requirement *req = Requirements::new(work, min, VersionNumbers::null());
DISCARD_TEXT(exft);
DISCARD_TEXT(exfa);
if (Str::len(violation) > 0) {
Problems::quote_wording(1, W);
Problems::quote_wording(2, AW);
Problems::quote_stream(3, violation);
Problems::Issue::handmade_problem(_p_(PM_IncludesTooLong));
Problems::issue_problem_segment(
"The extension %1 by %2, which your source text requests, %3.");
Problems::issue_problem_end();
}
DISCARD_TEXT(violation);
inform_extension *E = Extensions::Inclusion::load(req);
if (E) {
@ -238,9 +209,7 @@ trap-door into Read Source Text, to seek and open the file.
if (found_to_be_malformed == FALSE) {
if (E == NULL) @<Issue a cannot-find problem@>
else {
inbuild_copy *C = E->as_copy;
Copies::read_source_text_for(C);
SourceFiles::issue_problems_arising(C);
SourceFiles::read(E->as_copy);
}
}