1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-05-19 09:28:51 +03:00

First successful template transplant

This commit is contained in:
Graham Nelson 2019-09-01 21:17:40 +01:00
parent 1ddf852361
commit 3055f43612
15 changed files with 40 additions and 25 deletions

1
.gitignore vendored
View file

@ -20,6 +20,7 @@ resources/Documentation/Examples/_Results_Actual/
inform7/Internal/Extensions/Graham Nelson/Standard Rules.i7x
inform7/Internal/Languages/English/Syntax.preform
inform7/Internal/Miscellany/definitions.html
inform7/Internal/Inter/*.interb
retrospective/*/cBlorb
retrospective/*/ni

View file

@ -574,9 +574,6 @@ ordering equivalent to alphabetical order.)
to prevent them causing errors if they are referred to in code but not
actually present in any object (as can easily happen with extensions
presenting optional features which the user chooses not to employ).
|cap_short_name| is similarly stubbed: this doesn't correspond to any
I7 property, but is used by NI to record capitalised forms of the printed
name (which in turn goes into |short_name|).
(5) Counters are used to allocate cells of storage to inline phrases which
need a permanent state associated with them: see the Standard Rules. Since
@ -586,9 +583,6 @@ the counters, and therefore the amount of storage we need to allocate.
(6) Similarly, each "quotation" box needs its own cell of memory.
@c
#IFNDEF CAP_SHORT_NAME_EXISTS;
Constant cap_short_name = short_name;
#ENDIF;
Array Runtime_Quotations_Displayed --> CCOUNT_QUOTATIONS;
@p Block Values.

View file

@ -220,15 +220,7 @@ strings in the Z-machine, and advises the use of Glulx instead. Glulx
does handle overruns safely, and indeed allows us to dynamically allocate
memory as necessary so that we can always avoid overruns entirely.
In either case, though, it's useful to have |TEXT_TY_BufferSize|, the size
of the temporary buffer, large enough that it will never be overrun in
ordinary use. This is controllable with the use option "maximum indexed
text length".
@c
#ifndef TEXT_TY_BufferSize;
Constant TEXT_TY_BufferSize = 512;
#endif;
Constant TEXT_TY_NoBuffers = 2;
#ifdef TARGET_ZCODE;

View file

@ -0,0 +1,7 @@
prepare-zd
merge-template <- Output.i6t
parse-linked-matter
resolve-conditional-compilation
assimilate
resolve-external-symbols
generate binary -> *out

View file

@ -386,6 +386,7 @@ with "Output.i6t".
COMPILATION_STEP(PL::Showme::compile_SHOWME_details, I"PL::Showme::compile_SHOWME_details")
COMPILATION_STEP(Phrases::Timed::TimedEventsTable, I"Phrases::Timed::TimedEventsTable")
COMPILATION_STEP(Phrases::Timed::TimedEventTimesTable, I"Phrases::Timed::TimedEventTimesTable")
COMPILATION_STEP(PL::Naming::compile_cap_short_name, I"PL::Naming::compile_cap_short_name")
@<Convert inter to Inform 6@> =
if ((problem_count == 0) && (existing_story_file == FALSE)) {

View file

@ -51,7 +51,6 @@ void Hierarchy::establish(inter_tree *I) {
@e REPARSE_CODE_HL
@e MAX_POSITIVE_NUMBER_HL
@e MIN_NEGATIVE_NUMBER_HL
@e CAP_SHORT_NAME_EXISTS_HL
@e NI_BUILD_COUNT_HL
@e RANKING_TABLE_HL
@e PLUGIN_FILES_HL
@ -75,7 +74,6 @@ void Hierarchy::establish(inter_tree *I) {
HierarchyLocations::con(I, REPARSE_CODE_HL, I"REPARSE_CODE", Translation::same(), generic_basics);
HierarchyLocations::con(I, MAX_POSITIVE_NUMBER_HL, I"MAX_POSITIVE_NUMBER", Translation::same(), generic_basics);
HierarchyLocations::con(I, MIN_NEGATIVE_NUMBER_HL, I"MIN_NEGATIVE_NUMBER", Translation::same(), generic_basics);
HierarchyLocations::con(I, CAP_SHORT_NAME_EXISTS_HL, I"CAP_SHORT_NAME_EXISTS", Translation::same(), generic_basics);
HierarchyLocations::con(I, NI_BUILD_COUNT_HL, I"NI_BUILD_COUNT", Translation::same(), generic_basics);
HierarchyLocations::con(I, RANKING_TABLE_HL, I"RANKING_TABLE", Translation::same(), generic_basics);
HierarchyLocations::con(I, PLUGIN_FILES_HL, I"PLUGIN_FILES", Translation::same(), generic_basics);

View file

@ -279,8 +279,7 @@ actually means it's rarely needed.)
inter_name *property_iname = Hierarchy::find(CAPSHORTNAME_HL);
P_cap_short_name = Properties::Valued::new_nameless_using(
K_text, Kinds::Behaviour::package(K_object), property_iname);
inter_name *iname = Hierarchy::find(CAP_SHORT_NAME_EXISTS_HL);
Emit::named_numeric_constant(iname, 1);
Hierarchy::make_available(Emit::tree(), property_iname);
}
if (faux)
Properties::Valued::assert(P_cap_short_name, subj,
@ -486,3 +485,10 @@ void PL::Naming::compile_small_names(void) {
Emit::array_end(save);
}
}
void PL::Naming::compile_cap_short_name(void) {
if (P_cap_short_name == NULL) {
inter_name *iname = Hierarchy::find(CAPSHORTNAME_HL);
Emit::named_iname_constant(iname, K_value, Hierarchy::find(SHORT_NAME_HL));
Hierarchy::make_available(Emit::tree(), iname);
}
}

View file

@ -5,9 +5,10 @@
{identity-settings}
BLORBLIB = $(ME)/Tests/Assistants/blorblib
INTER = inter/Tangled/inter
.PHONY: all
all: executable preform
all: executable preform templates
.PHONY: executable
executable: $(ME)/Tangled/$(MYNAME)
@ -15,6 +16,12 @@ executable: $(ME)/Tangled/$(MYNAME)
.PHONY: preform
preform: $(ME)/Tangled/Syntax.preform
.PHONY: templates
templates: $(ME)/Internal/Inter/template-zd.interb
$(ME)/Internal/Inter/template-zd.interb: $(ME)/Internal/Inter/templates.interpipeline $(ME)/Internal/I6T/*.i6t
$(INTER) -template inform7/Internal/I6T -variable *out=$(ME)/Internal/Inter/template-zd.interb -pipeline-file $(ME)/Internal/Inter/templates.interpipeline
# Making the program:
$(ME)/Tangled/$(MYNAME): {dependent-files}

1
inter/.gitignore vendored
View file

@ -11,6 +11,7 @@ Tests/hashes.intest
Tests/_Results_Actual/
codegen-module/Woven/
building-module/Woven/
inter-module/Woven/
inter.mk

View file

@ -79,6 +79,8 @@ void Site::clear(inter_tree *I) {
for (int i=0; i<NO_DEFINED_HMD_VALUES; i++) B->hmds_indexed_by_id[i] = NULL;
B->veneer_symbols_indexed_by_name = Dictionaries::new(512, FALSE);
for (int i=0; i<MAX_VSYMBS; i++) B->veneer_symbols[i] = NULL;
for (int i=0; i<MAX_VSYMBS; i++) B->veneer_symbol_names[i] = NULL;
for (int i=0; i<MAX_VSYMBS; i++) B->veneer_symbol_translations[i] = NULL;
Veneer::create_indexes(I);
Packaging::initialise_state(I);
}

View file

@ -147,7 +147,11 @@ inter_symbol *Veneer::find(inter_tree *I, text_stream *S, inter_symbol *unchecke
if (Dictionaries::find(I->site.veneer_symbols_indexed_by_name, S)) {
inter_symbol **slot = (inter_symbol **) Dictionaries::read_value(I->site.veneer_symbols_indexed_by_name, S);
if (slot == NULL) internal_error("accident with veneer dictionary");
return Veneer::make(I, slot, S, NULL, unchecked_kind_symbol);
if (*slot) return *slot;
for (int ix=0; ix<MAX_VSYMBS; ix++)
if (Str::eq(I->site.veneer_symbol_names[ix], S))
return Veneer::find_by_index(I, ix, unchecked_kind_symbol);
internal_error("indexing accident with veneer dictionary");
}
return NULL;
}

View file

@ -75,12 +75,10 @@ int EmitInterSchemas::process_conditionals(inter_tree *I, inter_schema_node *isn
if (Str::eq(symbol_to_check, I"#version_number")) { val = 8; def = TRUE; }
else if (Str::eq(symbol_to_check, I"STRICT_MODE")) { def = TRUE; }
else {
LOG("Searching for %S\n", symbol_to_check);
inter_symbol *symb = EmitInterSchemas::find_identifier_text(I, symbol_to_check,
Inter::Packages::scope(Packaging::incarnate(Site::veneer_request(I))),
second_call);
while ((symb) && (symb->equated_to)) symb = symb->equated_to;
LOG("Symb is $3\n", symb);
LOGIF(SCHEMA_COMPILATION, "Symb is $3\n", symb);
if (Inter::Symbols::is_defined(symb)) {
def = TRUE;

View file

@ -100,13 +100,14 @@ void CodeGen::CL::constant(code_generation *gen, inter_tree_node *P) {
}
int ifndef_me = FALSE;
if (Inter::Symbols::read_annotation(con_name, VENEER_IANN) == 1) return;
if (Inter::Symbols::read_annotation(con_name, VENEER_IANN) > 0) return;
if ((Str::eq(con_name->symbol_name, I"WORDSIZE")) ||
(Str::eq(con_name->symbol_name, I"TARGET_ZCODE")) ||
(Str::eq(con_name->symbol_name, I"INDIV_PROP_START")) ||
(Str::eq(con_name->symbol_name, I"TARGET_GLULX")) ||
(Str::eq(con_name->symbol_name, I"DICT_WORD_SIZE")) ||
(Str::eq(con_name->symbol_name, I"DEBUG")))
(Str::eq(con_name->symbol_name, I"DEBUG")) ||
(Str::eq(con_name->symbol_name, I"cap_short_name")))
ifndef_me = TRUE;
if (Str::eq(con_name->symbol_name, I"thedark")) {

View file

@ -131,7 +131,7 @@ void Inter::Transmigration::correct_migrant(inter_tree *I, inter_tree_node *P, v
if ((symb) && (symb->equated_to)) {
inter_symbol *target = symb->equated_to;
while (target->equated_to) target = target->equated_to;
if (Inter::Symbols::read_annotation(target, VENEER_IANN) == 1) {
if (Inter::Symbols::read_annotation(target, VENEER_IANN) > 0) {
symb->equated_to = Veneer::find(ipct->destination->package_head->tree, target->symbol_name, Produce::kind_to_symbol(NULL));
} else if (Inter::Symbols::get_scope(target) == PLUG_ISYMS) {
inter_symbol *equivalent = Inter::Transmigration::cached_equivalent(target);
@ -187,6 +187,8 @@ void Inter::Transmigration::correct_migrant(inter_tree *I, inter_tree_node *P, v
TEMPORARY_TEXT(URL);
Inter::SymbolsTables::symbol_to_url_name(URL, target);
equivalent = Inter::SymbolsTables::url_name_to_symbol(ipct->destination->package_head->tree, NULL, URL);
if ((equivalent == NULL) && (Inter::Kind::is(target)))
equivalent = Inter::Packages::search_resources_exhaustively(ipct->destination->package_head->tree, target->symbol_name);
if (equivalent == NULL)
equivalent = Inter::Connectors::plug(ipct->destination_tree, URL);
DISCARD_TEXT(URL);

View file

@ -20,6 +20,7 @@ resources/Documentation/Examples/_Results_Actual/
inform7/Internal/Extensions/Graham Nelson/Standard Rules.i7x
inform7/Internal/Languages/English/Syntax.preform
inform7/Internal/Miscellany/definitions.html
inform7/Internal/Inter/*.interb
retrospective/*/cBlorb
retrospective/*/ni