Skip to content

Commit

Permalink
Fix for Mantis bug 1838
Browse files Browse the repository at this point in the history
  • Loading branch information
ganelson committed Apr 12, 2022
1 parent ce8014c commit 6e04553
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 38 deletions.
48 changes: 26 additions & 22 deletions inform7/Figures/timings-diagnostics.txt
@@ -1,33 +1,37 @@
100.0% in inform7 run
68.8% in compilation to Inter
47.8% in //Sequence::undertake_queued_tasks//
4.5% in //MajorNodes::pre_pass//
3.4% in //MajorNodes::pass_1//
2.4% in //RTPhrasebook::compile_entries//
1.8% in //ImperativeDefinitions::assess_all//
67.8% in compilation to Inter
47.3% in //Sequence::undertake_queued_tasks//
4.6% in //MajorNodes::pre_pass//
3.3% in //MajorNodes::pass_1//
2.2% in //RTPhrasebook::compile_entries//
1.9% in //ImperativeDefinitions::assess_all//
1.5% in //RTKindConstructors::compile//
1.1% in //Sequence::lint_inter//
0.5% in //ImperativeDefinitions::compile_first_block//
1.0% in //Sequence::lint_inter//
0.5% in //MajorNodes::pass_2//
0.5% in //Sequence::undertake_queued_tasks//
0.5% in //World::stage_V//
0.3% in //Sequence::undertake_queued_tasks//
0.1% in //CompletionModule::compile//
0.4% in //ImperativeDefinitions::compile_first_block//
0.4% in //Sequence::undertake_queued_tasks//
0.4% in //Sequence::undertake_queued_tasks//
0.2% in //CompletionModule::compile//
0.2% in //RTKindConstructors::compile_permissions//
0.1% in //InferenceSubjects::emit_all//
0.1% in //RTKindConstructors::compile_permissions//
0.1% in //Task::make_built_in_kind_constructors//
0.1% in //Understand::traverse//
0.1% in //World::stages_II_and_III//
2.4% not specifically accounted for
28.4% in running Inter pipeline
2.1% not specifically accounted for
29.3% in running Inter pipeline
10.2% in step 14/15: generate inform6 -> auto.inf
7.5% in step 5/15: load-binary-kits
6.4% in step 6/15: make-synoptic-module
7.7% in step 5/15: load-binary-kits
6.6% in step 6/15: make-synoptic-module
1.5% in step 9/15: make-identifiers-unique
0.3% in step 12/15: eliminate-redundant-operations
0.3% in step 4/15: compile-splats
0.3% in step 7/15: shorten-wiring
0.4% in step 12/15: eliminate-redundant-operations
0.4% in step 4/15: compile-splats
0.4% in step 7/15: shorten-wiring
0.3% in step 8/15: detect-indirect-calls
0.1% in step 11/15: eliminate-redundant-labels
0.9% not specifically accounted for
2.2% in supervisor
0.2% in step 11/15: eliminate-redundant-labels
0.1% in step 10/15: reconcile-verbs
0.1% in step 2/15: parse-insertions
0.1% in step 3/15: resolve-conditional-compilation
0.7% not specifically accounted for
2.3% in supervisor
0.4% not specifically accounted for
4 changes: 4 additions & 0 deletions inform7/Tests/Test Problems/PM_UODuplicate.txt
@@ -0,0 +1,4 @@
Home is a room.

Use sequential action translates as (- Constant SEQUENTIAL_ACTION; -).
Use sequential action translates as (- Constant ASEQUENTIAL_ACTION; -).
12 changes: 12 additions & 0 deletions inform7/Tests/Test Problems/_Results_Ideal/PM_UODuplicate.txt
@@ -0,0 +1,12 @@
Inform 7 v10.1.0 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 7691 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 32092 words long.
Problem__ PM_UODuplicate
>--> In 'Use sequential action translates as (- Constant ASEQUENTIAL_ACTION;
-)' (source text, line 4), you define a use option 'sequential action', but
that has already been defined, and with a different meaning: 'Use
sequential action translates as (- Constant SEQUENTIAL_ACTION; -)' (source
text, line 3).
Inform 7 has finished.
48 changes: 32 additions & 16 deletions inform7/assertions-module/Chapter 3/New Use Option Requests.w
Expand Up @@ -79,22 +79,38 @@ typedef struct use_option {
wording SP = Node::get_text(V->next);
wording OP = Node::get_text(V->next->next);
<use-setting>(SP); /* always passes */
int N = <<r>>;

use_option *uo = CREATE(use_option);
uo->name = GET_RW(<use-setting>, 1);
uo->expansion = OP;
uo->option_used = FALSE;
uo->minimum_setting_value = (N >= 0) ? N : -1;
uo->source_file_scoped = FALSE;
uo->notable_option_code = -1;
if (<notable-use-option-name>(uo->name)) uo->notable_option_code = <<r>>;
if (uo->notable_option_code == AUTHORIAL_MODESTY_UO) uo->source_file_scoped = TRUE;
uo->where_used = NULL;
uo->where_created = current_sentence;
uo->compilation_data = RTUseOptions::new_compilation_data(uo);
Nouns::new_proper_noun(uo->name, NEUTER_GENDER, ADD_TO_LEXICON_NTOPT,
MISCELLANEOUS_MC, Rvalues::from_use_option(uo), Task::language_of_syntax());
int N = <<r>>; if (N < 0) N = -1;

wording UOW = GET_RW(<use-setting>, 1);
use_option *existing_uo = NewUseOptions::parse_uo(UOW);
if (existing_uo) {
if ((Wordings::match(OP, existing_uo->expansion) == FALSE) ||
(N != existing_uo->minimum_setting_value)) {
Problems::quote_source(1, current_sentence);
Problems::quote_wording(2, UOW);
Problems::quote_source(3, existing_uo->where_created);
StandardProblems::handmade_problem(Task::syntax_tree(), _p_(PM_UODuplicate));
Problems::issue_problem_segment(
"In %1, you define a use option '%2', but that has already been "
"defined, and with a different meaning: %3.");
Problems::issue_problem_end();
}
} else {
use_option *uo = CREATE(use_option);
uo->name = UOW;
uo->expansion = OP;
uo->option_used = FALSE;
uo->minimum_setting_value = N;
uo->source_file_scoped = FALSE;
uo->notable_option_code = -1;
if (<notable-use-option-name>(uo->name)) uo->notable_option_code = <<r>>;
if (uo->notable_option_code == AUTHORIAL_MODESTY_UO) uo->source_file_scoped = TRUE;
uo->where_used = NULL;
uo->where_created = current_sentence;
uo->compilation_data = RTUseOptions::new_compilation_data(uo);
Nouns::new_proper_noun(uo->name, NEUTER_GENDER, ADD_TO_LEXICON_NTOPT,
MISCELLANEOUS_MC, Rvalues::from_use_option(uo), Task::language_of_syntax());
}

@ Having registered the use option names as miscellaneous, we need to parse
them back that way too:
Expand Down
2 changes: 2 additions & 0 deletions resources/Documentation/Writing with Inform.txt
Expand Up @@ -17965,6 +17965,8 @@ then instead the I6 inclusion becomes:

The I6 constant MAX_PRESENTED_FOOTNOTES can then be used as the size of an array, for instance.

Finally, note that it is legal to define the same use option more than once, but only if it has exactly the same meaning each time it is defined. (This is allowed so that multiple extensions all needing the same definition can safely make it, and still be used together.)

[x] Longer extracts of Inform 6 code

^^{Inform 6 inclusions: long sections of code}
Expand Down

0 comments on commit 6e04553

Please sign in to comment.