diff --git a/docs/arch-module/2-cmp.html b/docs/arch-module/2-cmp.html
index 760d69557..fc4c4aa81 100644
--- a/docs/arch-module/2-cmp.html
+++ b/docs/arch-module/2-cmp.html
@@ -393,7 +393,7 @@ according to what the token
target_vm *VM;
int seen = FALSE;
LOOP_OVER(VM, target_vm)
- if (TargetVMs::compatible_with(VM, cps->current_family)) {
+ if (TargetVMs::compatible_with(VM, cps->current_family)) {
seen = TRUE;
if ((VersionNumbers::eq(VM->version, V)) &&
((with == NOT_APPLICABLE) || (TargetVMs::debug_enabled(VM) == with)))
@@ -424,7 +424,7 @@ according to what the token
int seen = FALSE;
target_vm *VM;
LOOP_OVER(VM, target_vm)
- if (TargetVMs::compatible_with(VM, token)) {
+ if (TargetVMs::compatible_with(VM, token)) {
seen = TRUE;
if (TargetVMs::debug_enabled(VM) == with)
Compatibility::add_exception(cps->C, VM);
@@ -440,8 +440,8 @@ according to what the token
To deal with multiple object code formats. §1. Target VMs. For a fuller explanation of these, see What This Module Does, but briefly:
a target_vm object represents a choice of both Inter architecture and
@@ -421,7 +421,7 @@ two lists of options give rise to sets which are subsets of each other.
§10. This function is only called to decide whether to issue certain ICL memory
+settings to the Inform 6 compiler, and so we can basically assume the VM here
+is going to end up as either the Z-machine or Glulx.
+ §10. File extension provisions. The normal or unblorbed file extension is just a hint for what would make a
+ §11. File extension provisions. The normal or unblorbed file extension is just a hint for what would make a
natural filename for our output: for example, py would be a natural choice
for a Python VN, if there were one.
§11. This is the format name as expressed in an iFiction bibliographic record,
+ §12. This is the format name as expressed in an iFiction bibliographic record,
where it's not meaningful to talk about debugging features or the number
of bits, and where it's currently not possible to express a VM version number.
§12. Different VMs have different in-browser interpreters, which means that
+ §13. Different VMs have different in-browser interpreters, which means that
inblorb needs to be given different release instructions for them. If the
user doesn't specify any particular interpreter, she gets the following.
§14. Options. Final code-generators can call this to see what special requests were made.
+ §15. Options. Final code-generators can call this to see what special requests were made.
Note that a single target_vm object can be used with just one architecture:
-use the function TargetVMs::get_architecture to obtain this. If a target supports
+use the function TargetVMs::get_architecture to obtain this. If a target supports
multiple architectures, then there will be multiple target_vm objects for it,
one for each architecture it supports. For example, the Glulx VM can be reached
by Inform6/32 or Inform6/32d. There can also be multiple versions: for example,
diff --git a/docs/final-module/4-fi6.html b/docs/final-module/4-fi6.html
index 5774391a0..ed97609cb 100644
--- a/docs/final-module/4-fi6.html
+++ b/docs/final-module/4-fi6.html
@@ -206,6 +206,7 @@ we will need for the code we are compiling. But this seems a good time to make i
CodeGen::deselect(gen, saved);
saved = CodeGen::select(gen, ICL_directives_I7CGS);
OUT = CodeGen::current(gen);
+ WRITE("!%% -Cu\n");
WRITE("!%% $ZCODE_LESS_DICT_DATA=1;\n");
if (omit_ur) WRITE("!%% $OMIT_UNUSED_ROUTINES=1;\n");
CodeGen::deselect(gen, saved);
diff --git a/docs/html-module/2-dr2.html b/docs/html-module/2-dr2.html
index 750f34841..d00c4e45b 100644
--- a/docs/html-module/2-dr2.html
+++ b/docs/html-module/2-dr2.html
@@ -392,7 +392,7 @@ nothing at all — not issuing any internal errors.
int i = 0;
p[0] = 0;
while (TRUE) {
- int c = TextFiles::utf8_fgetc(FRAGMENTS, NULL, FALSE, NULL);
+ int c = TextFiles::utf8_fgetc(FRAGMENTS, NULL, NULL);
if (c == EOF) break;
if (c == 0xFEFF) continue; the Unicode BOM non-character
if (i == MAX_EXTENT_OF_FRAGMENTS) break;
diff --git a/docs/html-module/2-lcl.html b/docs/html-module/2-lcl.html
index 7ed97bc0b..658a96fa1 100644
--- a/docs/html-module/2-lcl.html
+++ b/docs/html-module/2-lcl.html
@@ -188,7 +188,7 @@ the earlier ones.
target_vm *VM;
LOOP_OVER(VM, target_vm)
- if (TargetVMs::compatible_with(VM, token)) {
- cps->current_family = TargetVMs::family(VM);
+ if (TargetVMs::compatible_with(VM, token)) {
+ cps->current_family = TargetVMs::family(VM);
return TRUE;
}
return FALSE;
@@ -454,7 +454,7 @@ according to what the token
if ((cps->family_used == FALSE) && (Str::len(cps->current_family) > 0)) {
target_vm *VM;
LOOP_OVER(VM, target_vm)
- if (TargetVMs::compatible_with(VM, cps->current_family))
+ if (TargetVMs::compatible_with(VM, cps->current_family))
Compatibility::add_exception(cps->C, VM);
}
return TRUE;
diff --git a/docs/arch-module/2-tvm.html b/docs/arch-module/2-tvm.html
index 68ccbbc29..a5b31af14 100644
--- a/docs/arch-module/2-tvm.html
+++ b/docs/arch-module/2-tvm.html
@@ -59,7 +59,7 @@ function togglePopup(material_id) {
-
+
-int TargetVMs::is_16_bit(target_vm *VM) {
+int TargetVMs::is_16_bit(target_vm *VM) {
if (VM == NULL) internal_error("no VM");
return Architectures::is_16_bit(VM->architecture);
}
@@ -441,13 +441,31 @@ two lists of options give rise to sets which are subsets of each other.
if ((VM->max_locals >= 0) && (VM->max_locals < N)) return FALSE;
return TRUE;
}
-int TargetVMs::allow_MAX_LOCAL_VARIABLES(target_vm *VM) {
+
+
+int TargetVMs::allow_memory_setting(target_vm *VM, text_stream *setting) {
if (VM == NULL) internal_error("no VM");
- if (VM->max_locals > 15) return TRUE;
- return FALSE;
+ if (Str::eq_insensitive(setting, I"MAX_LOCAL_VARIABLES")) {
+ if (VM->max_locals > 15) return TRUE;
+ return FALSE;
+ }
+ if (Str::eq_insensitive(setting, I"DICT_CHAR_SIZE")) {
+ if (TargetVMs::is_16_bit(VM) == FALSE) return TRUE;
+ return FALSE;
+ }
+ if (Str::eq_insensitive(setting, I"DICT_WORD_SIZE")) {
+ if (TargetVMs::is_16_bit(VM) == FALSE) return TRUE;
+ return FALSE;
+ }
+ return TRUE;
}
-
text_stream *TargetVMs::family(target_vm *VM) {
@@ -527,7 +545,7 @@ will return the empty text.
return FALSE;
}
-
diff --git a/docs/arch-module/P-wtmd.html b/docs/arch-module/P-wtmd.html
index 1cc138a73..b615ee0cc 100644
--- a/docs/arch-module/P-wtmd.html
+++ b/docs/arch-module/P-wtmd.html
@@ -123,7 +123,7 @@ involves a combination of both architecture and target:
...
- cr = TextFiles::utf8_fgetc(Input_File, NULL, FALSE, &ufb);
+ cr = TextFiles::utf8_fgetc(Input_File, NULL, &ufb);
col++;
if ((cr == 10) || (cr == 13)) { col = 0; nwsol = FALSE; line++; }
diff --git a/docs/pipeline-module/2-rp.html b/docs/pipeline-module/2-rp.html
index c2991188e..2fd87c0cc 100644
--- a/docs/pipeline-module/2-rp.html
+++ b/docs/pipeline-module/2-rp.html
@@ -230,7 +230,7 @@ steps in turn, timing how long each one took us.
Work out the filename3.1.2.1;
text_stream text_output_struct;
text_stream *T = &text_output_struct;
- if (STREAM_OPEN_TO_FILE(T, step->ephemera.parsed_filename, ISO_ENC) == FALSE) {
+ if (STREAM_OPEN_TO_FILE(T, step->ephemera.parsed_filename, UTF8_ENC) == FALSE) {
PipelineErrors::error(step, "unable to open file named in pipeline step");
active = FALSE;
} else {
diff --git a/docs/runtime-module/3-uo.html b/docs/runtime-module/3-uo.html
index 1a56cd102..68dd17698 100644
--- a/docs/runtime-module/3-uo.html
+++ b/docs/runtime-module/3-uo.html
@@ -262,10 +262,6 @@ ICL ("Inform Control Language") instructions: see the Inform 6 Designer's Manual
for details of these. Any other code-generator can ignore these pragmas.
Note that not every VM allows MAX_LOCAL_VARIABLES to be raised; if the current -one doesn't, that's not an error; it's just a pragma we suppress. -
-Compile pragmas from use options which set these1.4 =
@@ -274,15 +270,13 @@ one doesn't, that's not an error; it's just a pragma we suppress. LOOP_OVER(tps, target_pragma_setting) Emit::pragma(tps->target, tps->content); i6_memory_setting *ms; - LOOP_OVER(ms, i6_memory_setting) { - if ((Str::eq(ms->ICL_identifier, I"MAX_LOCAL_VARIABLES")) && - (TargetVMs::allow_MAX_LOCAL_VARIABLES(Task::vm()) == FALSE)) - continue; - TEMPORARY_TEXT(prag) - WRITE_TO(prag, "$%S=%d", ms->ICL_identifier, ms->number); - Emit::pragma(I"Inform6", prag); - DISCARD_TEXT(prag) - } + LOOP_OVER(ms, i6_memory_setting) + if (TargetVMs::allow_memory_setting(Task::vm(), ms->ICL_identifier)) { + TEMPORARY_TEXT(prag) + WRITE_TO(prag, "$%S=%d", ms->ICL_identifier, ms->number); + Emit::pragma(I"Inform6", prag); + DISCARD_TEXT(prag) + }§1.5. A few kit configuration values cannot be set with use options, and are diff --git a/docs/supervisor-module/1-ic.html b/docs/supervisor-module/1-ic.html index 394a6f4ba..3142d57b1 100644 --- a/docs/supervisor-module/1-ic.html +++ b/docs/supervisor-module/1-ic.html @@ -440,7 +440,7 @@ line, which is why we couldn't work this out earlier:
target_vm *current_target_VM = NULL; -target_vm *Supervisor::current_vm(void) { +target_vm *Supervisor::current_vm(void) { RUN_ONLY_FROM_PHASE(TINKERING_INBUILD_PHASE) return current_target_VM; } diff --git a/docs/supervisor-module/5-es.html b/docs/supervisor-module/5-es.html index a7b417ceb..338fcbf7b 100644 --- a/docs/supervisor-module/5-es.html +++ b/docs/supervisor-module/5-es.html @@ -249,7 +249,7 @@ by the local \nint c; - while ((c = TextFiles::utf8_fgetc(EXTF, NULL, FALSE, NULL)) != EOF) { + while ((c = TextFiles::utf8_fgetc(EXTF, NULL, NULL)) != EOF) { if (c == 0xFEFF) continue; skip the optional Unicode BOM pseudo-character if ((c == '\x0a') || (c == '\x0d') || (c == '\n')) break; PUT_TO(titling_line, c); @@ -271,7 +271,7 @@ thing we read here is a meaningless int c, found_start = FALSE; - while ((c = TextFiles::utf8_fgetc(EXTF, NULL, FALSE, NULL)) != EOF) { + while ((c = TextFiles::utf8_fgetc(EXTF, NULL, NULL)) != EOF) { if ((c == '\x0a') || (c == '\x0d') || (c == '\n') || (c == '\t')) c = ' '; if ((c != ' ') && (found_start == FALSE)) { if (c == '"') found_start = TRUE; diff --git a/docs/supervisor-module/5-ps2.html b/docs/supervisor-module/5-ps2.html index 0dca89b46..f4fca83ab 100644 --- a/docs/supervisor-module/5-ps2.html +++ b/docs/supervisor-module/5-ps2.html @@ -1390,7 +1390,7 @@ the whole thing goes into bibint c, commented = FALSE, quoted = FALSE, rounded = FALSE, content_found = FALSE; - while ((c = TextFiles::utf8_fgetc(SF, NULL, FALSE, NULL)) != EOF) { + while ((c = TextFiles::utf8_fgetc(SF, NULL, NULL)) != EOF) { if (c == 0xFEFF) continue; skip the optional Unicode BOM pseudo-character if (commented) { if (c == ']') commented = FALSE; diff --git a/docs/supervisor-module/6-st.html b/docs/supervisor-module/6-st.html index 93a9db550..c1cf0a4b4 100644 --- a/docs/supervisor-module/6-st.html +++ b/docs/supervisor-module/6-st.html @@ -107,8 +107,11 @@ perhaps combining our feed with that of others. if (handle) { text_stream *leaf = Filenames::get_leafname(F); if (primary) leaf = I"main source text"; + int mode = UNICODE_UFBHM; + target_vm *vm = Supervisor::current_vm(); + if (TargetVMs::is_16_bit(vm)) mode = ZSCII_UFBHM; sf = TextFromFiles::feed_open_file_into_lexer(F, handle, - leaf, documentation_only, ref); + leaf, documentation_only, ref, mode); if (sf == NULL) { Copies::attach_error(C, CopyErrors::new_F(OPEN_FAILED_CE, -1, F)); } else { diff --git a/docs/words-module/3-tff.html b/docs/words-module/3-tff.html index 43b9089fc..552ccb7d5 100644 --- a/docs/words-module/3-tff.html +++ b/docs/words-module/3-tff.html @@ -91,7 +91,7 @@ instance, so they are not similarly converted.source_file *TextFromFiles::feed_open_file_into_lexer(filename *F, FILE *handle, - text_stream *leaf, int documentation_only, general_pointer ref) { + text_stream *leaf, int documentation_only, general_pointer ref, int mode) { source_file *sf = CREATE(source_file); sf->words_of_source = 0; sf->words_of_quoted_text = 0; @@ -101,7 +101,7 @@ instance, so they are not similarly converted. source_location top_of_file; int cr, last_cr, next_cr, read_cr, newline_char = 0; - unicode_file_buffer ufb = TextFiles::create_ufb(); + unicode_file_buffer ufb = TextFiles::create_filtered_ufb(mode); top_of_file.file_of_origin = sf; top_of_file.line_number = 1; @@ -109,10 +109,10 @@ instance, so they are not similarly converted. Lexer::feed_begins(top_of_file); if (documentation_only) lexer_wait_for_dashes = TRUE; - last_cr = ' '; cr = ' '; next_cr = TextFiles::utf8_fgetc(sf->handle, NULL, TRUE, &ufb); - if (next_cr == 0xFEFF) next_cr = TextFiles::utf8_fgetc(sf->handle, NULL, TRUE, &ufb); Unicode BOM code + last_cr = ' '; cr = ' '; next_cr = TextFiles::utf8_fgetc(sf->handle, NULL, &ufb); + if (next_cr == 0xFEFF) next_cr = TextFiles::utf8_fgetc(sf->handle, NULL, &ufb); Unicode BOM code if (next_cr != EOF) - while (((read_cr = TextFiles::utf8_fgetc(sf->handle, NULL, TRUE, &ufb)), next_cr) != EOF) { + while (((read_cr = TextFiles::utf8_fgetc(sf->handle, NULL, &ufb)), next_cr) != EOF) { last_cr = cr; cr = next_cr; next_cr = read_cr; switch(cr) { case '\x0a': @@ -160,7 +160,7 @@ quoted text (i.e., their text within double-quotes). FILE *handle = Filenames::fopen(F, "r"); if (handle == NULL) return NULL; source_file *sf = TextFromFiles::feed_open_file_into_lexer(F, handle, - Filenames::get_leafname(F), FALSE, ref); + Filenames::get_leafname(F), FALSE, ref, UNICODE_UFBHM); fclose(handle); return sf; } diff --git a/inform7/Figures/memory-diagnostics.txt b/inform7/Figures/memory-diagnostics.txt index e59fdfdb8..e4148eadb 100644 --- a/inform7/Figures/memory-diagnostics.txt +++ b/inform7/Figures/memory-diagnostics.txt @@ -251,7 +251,7 @@ Total memory consumption was 123156K = 120 MB 100.0% was used for memory not allocated for objects: - 57.5% text stream storage 72566464 bytes in 487987 claims + 57.5% text stream storage 72566844 bytes in 487989 claims 4.2% dictionary storage 5319680 bytes in 7630 claims ---- sorting 2720 bytes in 387 claims 5.7% source text 7200000 bytes in 3 claims diff --git a/inform7/Figures/timings-diagnostics.txt b/inform7/Figures/timings-diagnostics.txt index 8514f8f21..33f932081 100644 --- a/inform7/Figures/timings-diagnostics.txt +++ b/inform7/Figures/timings-diagnostics.txt @@ -1,32 +1,32 @@ 100.0% in inform7 run - 70.4% in compilation to Inter - 49.8% in //Sequence::undertake_queued_tasks// - 5.1% in //MajorNodes::pre_pass// - 3.3% in //MajorNodes::pass_1// + 70.1% in compilation to Inter + 49.6% in //Sequence::undertake_queued_tasks// + 4.9% in //MajorNodes::pre_pass// + 3.5% in //MajorNodes::pass_1// 1.7% in //ImperativeDefinitions::assess_all// 1.5% in //RTKindConstructors::compile// - 1.5% in //RTPhrasebook::compile_entries// + 1.3% in //RTPhrasebook::compile_entries// 0.9% in //Sequence::lint_inter// 0.5% in //ImperativeDefinitions::compile_first_block// 0.5% in //Sequence::undertake_queued_tasks// - 0.5% in //Sequence::undertake_queued_tasks// 0.5% in //World::stage_V// 0.3% in //MajorNodes::pass_2// + 0.3% in //Sequence::undertake_queued_tasks// 0.1% in //CompletionModule::compile// 0.1% in //InferenceSubjects::emit_all// 0.1% in //RTKindConstructors::compile_permissions// 0.1% in //Task::make_built_in_kind_constructors// - 2.7% not specifically accounted for - 26.1% in running Inter pipeline - 9.8% in step 14/15: generate inform6 -> auto.inf + 3.0% not specifically accounted for + 26.2% in running Inter pipeline + 10.0% in step 14/15: generate inform6 -> auto.inf 5.9% in step 5/15: load-binary-kits - 5.3% in step 6/15: make-synoptic-module - 1.9% in step 9/15: make-identifiers-unique + 5.5% in step 6/15: make-synoptic-module + 1.7% 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.3% in step 8/15: detect-indirect-calls 0.1% in step 11/15: eliminate-redundant-labels - 1.3% not specifically accounted for + 1.2% not specifically accounted for 2.9% in supervisor - 0.4% not specifically accounted for + 0.6% not specifically accounted for diff --git a/inform7/runtime-module/Chapter 3/Use Options.w b/inform7/runtime-module/Chapter 3/Use Options.w index 0150234f1..22b3cb74a 100644 --- a/inform7/runtime-module/Chapter 3/Use Options.w +++ b/inform7/runtime-module/Chapter 3/Use Options.w @@ -179,23 +179,18 @@ compiler (assuming we will be using that) to raise some limit. This is done with ICL ("Inform Control Language") instructions: see the Inform 6 Designer's Manual for details of these. Any other code-generator can ignore these pragmas. -Note that not every VM allows |MAX_LOCAL_VARIABLES| to be raised; if the current -one doesn't, that's not an error; it's just a pragma we suppress. - @= target_pragma_setting *tps; LOOP_OVER(tps, target_pragma_setting) Emit::pragma(tps->target, tps->content); i6_memory_setting *ms; - LOOP_OVER(ms, i6_memory_setting) { - if ((Str::eq(ms->ICL_identifier, I"MAX_LOCAL_VARIABLES")) && - (TargetVMs::allow_MAX_LOCAL_VARIABLES(Task::vm()) == FALSE)) - continue; - TEMPORARY_TEXT(prag) - WRITE_TO(prag, "$%S=%d", ms->ICL_identifier, ms->number); - Emit::pragma(I"Inform6", prag); - DISCARD_TEXT(prag) - } + LOOP_OVER(ms, i6_memory_setting) + if (TargetVMs::allow_memory_setting(Task::vm(), ms->ICL_identifier)) { + TEMPORARY_TEXT(prag) + WRITE_TO(prag, "$%S=%d", ms->ICL_identifier, ms->number); + Emit::pragma(I"Inform6", prag); + DISCARD_TEXT(prag) + } @ A few kit configuration values cannot be set with use options, and are hard-wired into the compiler: diff --git a/services/arch-module/Chapter 2/Target Virtual Machines.w b/services/arch-module/Chapter 2/Target Virtual Machines.w index c36b6085c..48a3d6b19 100644 --- a/services/arch-module/Chapter 2/Target Virtual Machines.w +++ b/services/arch-module/Chapter 2/Target Virtual Machines.w @@ -348,10 +348,27 @@ int TargetVMs::allow_this_many_locals(target_vm *VM, int N) { if ((VM->max_locals >= 0) && (VM->max_locals < N)) return FALSE; return TRUE; } -int TargetVMs::allow_MAX_LOCAL_VARIABLES(target_vm *VM) { + +@ This function is only called to decide whether to issue certain ICL memory +settings to the Inform 6 compiler, and so we can basically assume the VM here +is going to end up as either the Z-machine or Glulx. + += +int TargetVMs::allow_memory_setting(target_vm *VM, text_stream *setting) { if (VM == NULL) internal_error("no VM"); - if (VM->max_locals > 15) return TRUE; - return FALSE; + if (Str::eq_insensitive(setting, I"MAX_LOCAL_VARIABLES")) { + if (VM->max_locals > 15) return TRUE; + return FALSE; + } + if (Str::eq_insensitive(setting, I"DICT_CHAR_SIZE")) { + if (TargetVMs::is_16_bit(VM) == FALSE) return TRUE; + return FALSE; + } + if (Str::eq_insensitive(setting, I"DICT_WORD_SIZE")) { + if (TargetVMs::is_16_bit(VM) == FALSE) return TRUE; + return FALSE; + } + return TRUE; } @h File extension provisions.