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

Fix for Mantis bug 1987

This commit is contained in:
Graham Nelson 2022-04-10 12:34:19 +01:00
parent 58f64b1e73
commit 2a998ded3e
5 changed files with 42 additions and 37 deletions

View file

@ -3,7 +3,7 @@
47.9% in //Sequence::undertake_queued_tasks//
4.5% in //MajorNodes::pre_pass//
3.2% in //MajorNodes::pass_1//
2.3% in //RTPhrasebook::compile_entries//
2.4% in //RTPhrasebook::compile_entries//
1.8% in //ImperativeDefinitions::assess_all//
1.5% in //RTKindConstructors::compile//
1.0% in //Sequence::lint_inter//
@ -18,12 +18,12 @@
0.1% in //Task::make_built_in_kind_constructors//
0.1% in //Understand::traverse//
0.1% in //World::stages_II_and_III//
2.2% not specifically accounted for
2.0% not specifically accounted for
29.0% in running Inter pipeline
10.2% in step 14/15: generate inform6 -> auto.inf
10.1% in step 14/15: generate inform6 -> auto.inf
7.6% in step 5/15: load-binary-kits
6.5% in step 6/15: make-synoptic-module
1.5% in step 9/15: make-identifiers-unique
1.6% in step 9/15: make-identifiers-unique
0.5% in step 4/15: compile-splats
0.4% in step 12/15: eliminate-redundant-operations
0.4% in step 7/15: shorten-wiring

View file

@ -17,19 +17,19 @@ You can see a cannon ball and a feather here.
Taken.
>[2] drop it from 1m
You let go the cannon ball from a height of 1m, and, subject to a downward force of 19.614N, it falls. 45 seconds later, this mass of 2kg hits the floor at 4.42 m/s with a kinetic energy of 19.53J.
You let go the cannon ball from a height of 1m, and, subject to a downward force of 19.614N, it falls. 0.45s later, this mass of 2kg hits the floor at 4.42 m/s with a kinetic energy of 19.53J.
>[3] get ball
Taken.
>[4] drop it from 2m
You let go the cannon ball from a height of 2m, and, subject to a downward force of 19.614N, it falls. 63 seconds later, this mass of 2kg hits the floor at 6.26 m/s with a kinetic energy of 39.18J.
You let go the cannon ball from a height of 2m, and, subject to a downward force of 19.614N, it falls. 0.63s later, this mass of 2kg hits the floor at 6.26 m/s with a kinetic energy of 39.18J.
>[5] get ball
Taken.
>[6] drop it from 3m
You let go the cannon ball from a height of 3m, and, subject to a downward force of 19.614N, it falls. 78 seconds later, this mass of 2kg hits the floor at 7.67 m/s with a kinetic energy of 58.82J.
You let go the cannon ball from a height of 3m, and, subject to a downward force of 19.614N, it falls. 0.78s later, this mass of 2kg hits the floor at 7.67 m/s with a kinetic energy of 58.82J.
This is not doing either the floor or your ears any favours.
@ -58,6 +58,6 @@ A reddish-lit room with steel walls, whose only exit is the teleport corridor to
You let go the cannon ball from a height of 3m, and, subject to a downward force of 7.38N, it falls. 1.27s later, this mass of 2kg hits the floor at 4.7 m/s with a kinetic energy of 22.09J.
>[14] drop feather from 3m
You let go the feather from a height of 3m, and, subject to a downward force of 36 Newtons, it falls. 1.25s later, this mass of 10g hits the floor at 4.64 m/s with a kinetic energy of 107mJ.
You let go the feather from a height of 3m, and, subject to a downward force of 0.036N, it falls. 1.25s later, this mass of 10g hits the floor at 4.64 m/s with a kinetic energy of 107mJ.
>Are you sure you want to quit?

View file

@ -102,14 +102,14 @@ void RTLiteralPatterns::compilation_agent(compilation_subtask *t) {
EmitCode::up();
}
switch (lp->lp_tokens[tc].lpt_type) {
case WORD_LPT: @<Compile I6 code to print a fixed word token within a literal pattern@>; break;
case CHARACTER_LPT: @<Compile I6 code to print a character token within a literal pattern@>; break;
case ELEMENT_LPT: @<Compile I6 code to print an element token within a literal pattern@>; break;
case WORD_LPT: @<Compile Inter to print a fixed word token within a literal pattern@>; break;
case CHARACTER_LPT: @<Compile Inter to print a character token within a literal pattern@>; break;
case ELEMENT_LPT: @<Compile Inter to print an element token within a literal pattern@>; break;
default: internal_error("unknown literal pattern token type");
}
}
@<Compile I6 code to print a fixed word token within a literal pattern@> =
@<Compile Inter to print a fixed word token within a literal pattern@> =
TEMPORARY_TEXT(T)
TranscodeText::from_wide_string(T, Lexer::word_raw_text(lp->lp_tokens[tc].token_wn), CT_RAW);
EmitCode::inv(PRINT_BIP);
@ -118,7 +118,7 @@ void RTLiteralPatterns::compilation_agent(compilation_subtask *t) {
EmitCode::up();
DISCARD_TEXT(T)
@<Compile I6 code to print a character token within a literal pattern@> =
@<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);
@ -130,7 +130,7 @@ void RTLiteralPatterns::compilation_agent(compilation_subtask *t) {
EmitCode::up();
DISCARD_TEXT(T)
@<Compile I6 code to print an element token within a literal pattern@> =
@<Compile Inter to print an element token within a literal pattern@> =
literal_pattern_element *lpe = &(lp->lp_elements[ec]);
if (lpe->element_optional)
@<Truncate the printed form here if subsequent numerical parts are zero@>;
@ -383,9 +383,9 @@ sets the |parsed_number| global to the value matched.
EmitCode::up();
switch (lp->lp_tokens[tc].lpt_type) {
case WORD_LPT: @<Compile I6 code to match a fixed word token within a literal pattern@>; break;
case CHARACTER_LPT: @<Compile I6 code to match a character token within a literal pattern@>; break;
case ELEMENT_LPT: @<Compile I6 code to match an element token within a literal pattern@>; break;
case WORD_LPT: @<Compile Inter to match a fixed word token within a literal pattern@>; break;
case CHARACTER_LPT: @<Compile Inter to match a character token within a literal pattern@>; break;
case ELEMENT_LPT: @<Compile Inter to match an element token within a literal pattern@>; break;
default: internal_error("unknown literal pattern token type");
}
}
@ -480,7 +480,7 @@ sets the |parsed_number| global to the value matched.
EmitCode::val_iname(K_value, Hierarchy::find(GPR_NUMBER_HL));
EmitCode::up();
@<Compile I6 code to match a fixed word token within a literal pattern@> =
@<Compile Inter to match a fixed word token within a literal pattern@> =
EmitCode::inv(IF_BIP);
EmitCode::down();
EmitCode::val_symbol(K_value, gprk.mid_word_s);
@ -517,8 +517,8 @@ sets the |parsed_number| global to the value matched.
EmitCode::ref_iname(K_value, Hierarchy::find(WN_HL));
EmitCode::up();
@<Compile I6 code to match a character token within a literal pattern@> =
@<Compile I6 code to enter mid-word parsing if not already in it@>;
@<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);
@ -562,10 +562,10 @@ sets the |parsed_number| global to the value matched.
EmitCode::up();
EmitCode::up();
@<Compile I6 code to exit mid-word parsing if at end of a word@>;
@<Compile Inter to exit mid-word parsing if at end of a word@>;
@<Compile I6 code to match an element token within a literal pattern@> =
@<Compile I6 code to enter mid-word parsing if not already in it@>;
@<Compile Inter to match an element token within a literal pattern@> =
@<Compile Inter to enter mid-word parsing if not already in it@>;
literal_pattern_element *lpe = &(lp->lp_elements[ec++]);
if (ec == 1) {
EmitCode::inv(STORE_BIP);
@ -607,12 +607,12 @@ sets the |parsed_number| global to the value matched.
EmitCode::up();
if (Kinds::FloatingPoint::uses_floating_point(lp->kind_specified))
@<Compile I6 code to match a real number here@>
@<Compile Inter to match a real number here@>
else
@<Compile I6 code to match an integer here@>;
@<Compile I6 code to exit mid-word parsing if at end of a word@>;
@<Compile Inter to match an integer here@>;
@<Compile Inter to exit mid-word parsing if at end of a word@>;
@<Compile I6 code to match a real number here@> =
@<Compile Inter to match a real number here@> =
EmitCode::inv(STORE_BIP);
EmitCode::down();
EmitCode::ref_symbol(K_value, gprk.f_s);
@ -702,7 +702,7 @@ sets the |parsed_number| global to the value matched.
EmitCode::down();
EmitCode::ref_symbol(K_value, gprk.wpos_s);
EmitCode::up();
@<Compile I6 code to enter mid-word parsing if not already in it@>;
@<Compile Inter to enter mid-word parsing if not already in it@>;
@<March forwards through decimal digits@>;
EmitCode::up();
EmitCode::up();
@ -738,7 +738,7 @@ sets the |parsed_number| global to the value matched.
EmitCode::ref_symbol(K_value, gprk.mid_word_s);
EmitCode::val_false();
EmitCode::up();
@<Compile I6 code to enter mid-word parsing if not already in it@>;
@<Compile Inter to enter mid-word parsing if not already in it@>;
EmitCode::up();
EmitCode::up();
@ -804,7 +804,7 @@ sets the |parsed_number| global to the value matched.
EmitCode::ref_symbol(K_value, gprk.mid_word_s);
EmitCode::val_false();
EmitCode::up();
@<Compile I6 code to enter mid-word parsing if not already in it@>;
@<Compile Inter to enter mid-word parsing if not already in it@>;
EmitCode::up();
EmitCode::up();
@ -1025,7 +1025,7 @@ sets the |parsed_number| global to the value matched.
EmitCode::up();
EmitCode::up();
@<Compile I6 code to match an integer here@> =
@<Compile Inter to match an integer here@> =
EmitCode::inv(STORE_BIP);
EmitCode::down();
EmitCode::ref_symbol(K_value, gprk.tot_s);
@ -1181,7 +1181,7 @@ sets the |parsed_number| global to the value matched.
EmitCode::ref_symbol(K_value, gprk.mid_word_s);
EmitCode::val_false();
EmitCode::up();
@<Compile I6 code to enter mid-word parsing if not already in it@>;
@<Compile Inter to enter mid-word parsing if not already in it@>;
EmitCode::inv(STORE_BIP);
EmitCode::down();
EmitCode::ref_symbol(K_value, gprk.x_s);
@ -1271,7 +1271,7 @@ sets the |parsed_number| global to the value matched.
EmitCode::up();
}
@<Compile I6 code to enter mid-word parsing if not already in it@> =
@<Compile Inter to enter mid-word parsing if not already in it@> =
EmitCode::inv(IF_BIP);
EmitCode::down();
EmitCode::inv(EQ_BIP);
@ -1310,7 +1310,7 @@ sets the |parsed_number| global to the value matched.
EmitCode::up();
EmitCode::up();
@<Compile I6 code to exit mid-word parsing if at end of a word@> =
@<Compile Inter to exit mid-word parsing if at end of a word@> =
EmitCode::inv(IF_BIP);
EmitCode::down();
EmitCode::inv(EQ_BIP);

View file

@ -227,8 +227,8 @@ equivalent to an exact value.
literal_pattern *lp;
scaling_transformation *benchmark_sc = NULL;
for (lp = list_head; lp; lp = lp->next_for_this_kind)
if (lp->benchmark) benchmark_sc = &(lp->scaling);
if (lp->benchmark)
benchmark_sc = &(lp->scaling);
int rescale_factor = Kinds::Scalings::determine_M(&(new_lp->scaling), benchmark_sc,
FALSE, new_lp->equivalent_unit, new_lp->primary_alternative);
if (rescale_factor != 1)
@ -236,7 +236,6 @@ equivalent to an exact value.
if ((lp != new_lp) && (lp->equivalent_unit == FALSE))
lp->scaling =
Kinds::Scalings::enlarge(lp->scaling, rescale_factor);
list_head = LiteralPatterns::lp_list_add_inner(list_head, new_lp);
if ((TargetVMs::is_16_bit(Task::vm())) && (PM_ZMachineOverflow2_issued == FALSE))

View file

@ -453,6 +453,12 @@ so this is what we set |M| to.
double k = sc->real_scalar;
sc->real_M = B*k;
}
} else if (sc->scaling_mode == LP_SCALED_AT) {
if (sc->use_integer_scaling) {
sc->int_M = benchmark_sc->int_M;
} else {
sc->real_M = benchmark_sc->real_M;
}
}
@h Enlarging and contracting.