Skip to content

Commit

Permalink
Fixed Jira bug I7-1929
Browse files Browse the repository at this point in the history
  • Loading branch information
ganelson committed Nov 14, 2024
1 parent 8a6d028 commit 70fa464
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 27 deletions.
12 changes: 8 additions & 4 deletions docs/assertions-module/3-dbtr.html
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,16 @@ <h1><a href="../index.html">
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax"> </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, *</span><span class="identifier-syntax">K_weak</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="3-dbtr.html#SP4_1_1" class="named-paragraph-link"><span class="named-paragraph">Determine the kind of what to make</span><span class="named-paragraph-number">4.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="3-dbtr.html#SP4_1_2" class="named-paragraph-link"><span class="named-paragraph">Check that this is a kind where it makes sense to enumerate new values</span><span class="named-paragraph-number">4.1.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">K</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Kinds::weaken</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_object</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (!(</span><span class="identifier-syntax">Kinds::Behaviour::is_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">))) </span><span class="identifier-syntax">RTTables::defines</span><span class="plain-syntax">(</span><span class="identifier-syntax">t</span><span class="plain-syntax">, </span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">kind_defined_in_this_table</span><span class="plain-syntax"> = </span><span class="identifier-syntax">K</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">K_weak</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Kinds::weaken</span><span class="plain-syntax">(</span><span class="identifier-syntax">K</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_object</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Kinds::Behaviour::is_object</span><span class="plain-syntax">(</span><span class="identifier-syntax">K_weak</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">kind_defined_in_this_table</span><span class="plain-syntax"> = </span><span class="identifier-syntax">K</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">RTTables::defines</span><span class="plain-syntax">(</span><span class="identifier-syntax">t</span><span class="plain-syntax">, </span><span class="identifier-syntax">K_weak</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="identifier-syntax">t</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">kind_defined_in_this_table</span><span class="plain-syntax"> = </span><span class="identifier-syntax">K_weak</span><span class="plain-syntax">;</span>
<span class="plain-syntax"> }</span>
<span class="plain-syntax"> </span><a href="7-tc.html#SP6" class="function-link"><span class="function-syntax">Tables::Columns::set_kind</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">t</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">columns</span><span class="plain-syntax">[0].</span><span class="element-syntax">column_identity</span><span class="plain-syntax">, </span><span class="identifier-syntax">t</span><span class="plain-syntax">, </span><span class="identifier-syntax">K</span><span class="plain-syntax">);</span>
<span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="3-dbtr.html#SP4_1_3" class="named-paragraph-link"><span class="named-paragraph">Create values for this kind as enumerated by names in the first column</span><span class="named-paragraph-number">4.1.3</span></a></span><span class="plain-syntax">;</span>
</pre>
Expand Down
26 changes: 13 additions & 13 deletions inform7/Figures/timings-diagnostics.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
100.0% in inform7 run
66.7% in compilation to Inter
44.4% in //Sequence::undertake_queued_tasks//
66.2% in compilation to Inter
43.7% in //Sequence::undertake_queued_tasks//
4.4% in //MajorNodes::pre_pass//
3.3% in //MajorNodes::pass_1//
3.4% in //MajorNodes::pass_1//
2.0% in //RTKindConstructors::compile//
1.6% in //ImperativeDefinitions::assess_all//
1.6% in //RTPhrasebook::compile_entries//
1.7% in //ImperativeDefinitions::assess_all//
1.3% in //RTPhrasebook::compile_entries//
1.0% in //Sequence::lint_inter//
0.6% in //ImperativeDefinitions::compile_first_block//
0.6% in //MajorNodes::pass_2//
0.6% in //World::stage_V//
0.3% in //CompletionModule::compile//
0.3% in //InferenceSubjects::emit_all//
0.3% in //RTKindConstructors::compile_permissions//
0.3% in //Sequence::undertake_queued_tasks//
0.3% in //Sequence::undertake_queued_tasks//
0.3% in //Task::make_built_in_kind_constructors//
0.3% in //World::stages_II_and_III//
3.7% not specifically accounted for
26.4% in running Inter pipeline
8.8% in step 14/15: generate inform6 -> auto.inf
7.1% in step 5/15: load-binary-kits
5.4% in step 6/15: make-synoptic-module
4.2% not specifically accounted for
26.8% in running Inter pipeline
8.9% in step 14/15: generate inform6 -> auto.inf
7.2% in step 5/15: load-binary-kits
5.5% in step 6/15: make-synoptic-module
2.0% in step 9/15: make-identifiers-unique
0.3% in step 11/15: eliminate-redundant-labels
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.3% in step 8/15: detect-indirect-calls
1.7% not specifically accounted for
6.1% in supervisor
1.3% not specifically accounted for
6.2% in supervisor
0.7% not specifically accounted for
26 changes: 26 additions & 0 deletions inform7/Tests/Test Cases/ObjectsDefinedByTable--I.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Staging Area
yellow banana was est 1919 for race leader.
polkadot banana was est 1933 for King of the Mountains.
green banana was est 1953 for highest point scorer on sprints.
white banana was est 1975 for best cyclist aged 25 or less.

red snowflake provides snowtext: This snowflake is red.
blue snowflake provides snowtext: This snowflake is blue.

Welcome
An Interactive Fiction
Release 1 / Serial number 160428 / Inform 7 v10.2.0 / D

Staging Area
You can see a yellow jersey, a polkadot jersey, a green jersey and a white jersey here.

> > Staging Area
(Testing.)

>[1] examine yellow jersey
Since 1919, the Tour de France has awarded this jersey to the race leader.

>[2] examine green jersey
Since 1953, the Tour de France has awarded this jersey to the highest point scorer on sprints.

> >
40 changes: 40 additions & 0 deletions inform7/Tests/Test Cases/ObjectsDefinedByTable.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Test: ObjectsDefinedByTable
For: Z-Machine

The Staging Area is a room. A jersey is a kind of thing. A jersey is wearable. Some jerseys in the Staging Area are defined by the Table of Honorary Jerseys. The description of a jersey is "Since [year established], the Tour de France has awarded this jersey to the [citation]."

A banana is a kind of value. Some bananas are defined by the Table of Honorary Bananas.

When play begins:
repeat with B running through bananas:
say "[B] was est [year banana established of B] for [banana citation of B]."

Table of Honorary Jerseys
jersey year established citation
a yellow jersey 1919 "race leader"
a polkadot jersey 1933 "King of the Mountains"
a green jersey 1953 "highest point scorer on sprints"
a white jersey 1975 "best cyclist aged 25 or less"

Table of Honorary Bananas
banana year banana established banana citation
a yellow banana 1919 "race leader"
a polkadot banana 1933 "King of the Mountains"
a green banana 1953 "highest point scorer on sprints"
a white banana 1975 "best cyclist aged 25 or less"

Test me with "examine yellow jersey / examine green jersey".

A snowflake is a kind of object. A snowflake has some text called the snowtext.

Some snowflakes are defined by the Table of Test Snow.

Table of Test Snow
snowflake snowtext
red snowflake "This snowflake is red"
blue snowflake "This snowflake is blue"

When play begins:
repeat with S running through objects:
if S provides snowtext:
say "[S] provides snowtext: [snowtext of S]."
10 changes: 5 additions & 5 deletions inform7/Tests/Test Cases/TableDefinedTexts--I.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Lab
Welcome
An Interactive Fiction
Release 1 / Serial number 160428 / Inform 7 v10.1.0 / D
Release 1 / Serial number 160428 / Inform 7 v10.2.0 / D

Lab

Expand All @@ -12,24 +12,24 @@
thing 1 - thing
location: out of play
unlit, inedible, portable; singular-named, proper-named
description: "This is

the first thing."
initial appearance: none
printed name: "thing 1"
printed plural name: none
indefinite article: none
description: "This is

the first thing."
list grouping key: none

>[2] showme thing 2
thing 2 - thing
location: out of play
unlit, inedible, portable; singular-named, proper-named
description: "This is the second thing."
initial appearance: none
printed name: "thing 2"
printed plural name: none
indefinite article: none
description: "This is the second thing."
list grouping key: none

> >
2 changes: 1 addition & 1 deletion inform7/Tests/Test Internals/Calculus--I.txt
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ Listed-in predication
<< listed_in('4', 'the table of solid stuff') >>

2. nothing is a statue listed in the Table of Stolid Stuff
<< listed_in('nothing', 'the table of stolid stuff') >>
<< statue('nothing') & listed_in('nothing', 'the table of stolid stuff') >>

3. a crispiness listed in the Table of Salad Stuff is a density listed in the Table of Solid Stuff
<< Exists x : number(x) & listed_in(x, 'the table of salad stuff') & listed_in(x, 'the table of solid stuff') >>
Expand Down
12 changes: 8 additions & 4 deletions inform7/assertions-module/Chapter 3/Define by Table Requests.w
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,16 @@ void DefineByTable::kind_defined_by_table(parse_node *V) {
@h Creation.

@<Create whatever is in column 1@> =
kind *K = NULL;
kind *K = NULL, *K_weak = NULL;
@<Determine the kind of what to make@>;
@<Check that this is a kind where it makes sense to enumerate new values@>;
K = Kinds::weaken(K, K_object);
if (!(Kinds::Behaviour::is_object(K))) RTTables::defines(t, K);
t->kind_defined_in_this_table = K;
K_weak = Kinds::weaken(K, K_object);
if (Kinds::Behaviour::is_object(K_weak)) {
t->kind_defined_in_this_table = K;
} else {
RTTables::defines(t, K_weak);
t->kind_defined_in_this_table = K_weak;
}
Tables::Columns::set_kind(t->columns[0].column_identity, t, K);
@<Create values for this kind as enumerated by names in the first column@>;

Expand Down

0 comments on commit 70fa464

Please sign in to comment.