mirror of
https://github.com/ganelson/inform.git
synced 2024-06-30 22:14:58 +03:00
Further work on enumerations
This commit is contained in:
parent
a93da24ee7
commit
a2e0cc98bb
|
@ -1,6 +1,6 @@
|
||||||
# Inform 7
|
# Inform 7
|
||||||
|
|
||||||
[Version](notes/versioning.md): 10.2.0-beta+6W64 'Krypton' (21 June 2023)
|
[Version](notes/versioning.md): 10.2.0-beta+6W65 'Krypton' (22 June 2023)
|
||||||
|
|
||||||
## About Inform
|
## About Inform
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
Prerelease: beta
|
Prerelease: beta
|
||||||
Build Date: 21 June 2023
|
Build Date: 22 June 2023
|
||||||
Build Number: 6W64
|
Build Number: 6W65
|
||||||
|
|
|
@ -734,6 +734,7 @@ Section 1 - Enumerations
|
||||||
To decide which number is number of (S - description of values)
|
To decide which number is number of (S - description of values)
|
||||||
(documented at ph_numberof):
|
(documented at ph_numberof):
|
||||||
(- {-primitive-definition:number-of} -).
|
(- {-primitive-definition:number-of} -).
|
||||||
|
To decide what number is the numerical value of (V - enumerated value): (- {V} -).
|
||||||
To decide which K is (name of kind of enumerated value K) after (X - K)
|
To decide which K is (name of kind of enumerated value K) after (X - K)
|
||||||
(documented at ph_enumafter):
|
(documented at ph_enumafter):
|
||||||
(- {-next-routine:K}({X}) -).
|
(- {-next-routine:K}({X}) -).
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"is": {
|
"is": {
|
||||||
"type": "kit",
|
"type": "kit",
|
||||||
"title": "Architecture16Kit",
|
"title": "Architecture16Kit",
|
||||||
"version": "10.2.0-beta+6W64"
|
"version": "10.2.0-beta+6W65"
|
||||||
},
|
},
|
||||||
"compatibility": "16-bit",
|
"compatibility": "16-bit",
|
||||||
"kit-details": {
|
"kit-details": {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"is": {
|
"is": {
|
||||||
"type": "kit",
|
"type": "kit",
|
||||||
"title": "Architecture32Kit",
|
"title": "Architecture32Kit",
|
||||||
"version": "10.2.0-beta+6W64"
|
"version": "10.2.0-beta+6W65"
|
||||||
},
|
},
|
||||||
"compatibility": "32-bit",
|
"compatibility": "32-bit",
|
||||||
"kit-details": {
|
"kit-details": {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"is": {
|
"is": {
|
||||||
"type": "kit",
|
"type": "kit",
|
||||||
"title": "BasicInformKit",
|
"title": "BasicInformKit",
|
||||||
"version": "10.2.0-beta+6W64"
|
"version": "10.2.0-beta+6W65"
|
||||||
},
|
},
|
||||||
"needs": [ {
|
"needs": [ {
|
||||||
"need": {
|
"need": {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"is": {
|
"is": {
|
||||||
"type": "kit",
|
"type": "kit",
|
||||||
"title": "CommandParserKit",
|
"title": "CommandParserKit",
|
||||||
"version": "10.2.0-beta+6W64"
|
"version": "10.2.0-beta+6W65"
|
||||||
},
|
},
|
||||||
"needs": [ {
|
"needs": [ {
|
||||||
"need": {
|
"need": {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"is": {
|
"is": {
|
||||||
"type": "kit",
|
"type": "kit",
|
||||||
"title": "EnglishLanguageKit",
|
"title": "EnglishLanguageKit",
|
||||||
"version": "10.2.0-beta+6W64"
|
"version": "10.2.0-beta+6W65"
|
||||||
},
|
},
|
||||||
"needs": [ {
|
"needs": [ {
|
||||||
"need": {
|
"need": {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"is": {
|
"is": {
|
||||||
"type": "kit",
|
"type": "kit",
|
||||||
"title": "WorldModelKit",
|
"title": "WorldModelKit",
|
||||||
"version": "10.2.0-beta+6W64"
|
"version": "10.2.0-beta+6W65"
|
||||||
},
|
},
|
||||||
"needs": [ {
|
"needs": [ {
|
||||||
"need": {
|
"need": {
|
||||||
|
|
|
@ -915,6 +915,7 @@ Section 1 - Enumerations
|
||||||
To decide which number is number of (S - description of values)
|
To decide which number is number of (S - description of values)
|
||||||
(documented at ph_numberof):
|
(documented at ph_numberof):
|
||||||
(- {-primitive-definition:number-of} -).
|
(- {-primitive-definition:number-of} -).
|
||||||
|
To decide what number is the numerical value of (V - enumerated value): (- {V} -).
|
||||||
To decide which K is (name of kind of enumerated value K) after (X - K)
|
To decide which K is (name of kind of enumerated value K) after (X - K)
|
||||||
(documented at ph_enumafter):
|
(documented at ph_enumafter):
|
||||||
(- {-next-routine:K}({X}) -).
|
(- {-next-routine:K}({X}) -).
|
||||||
|
|
|
@ -350,14 +350,18 @@ void Instances::make_instances_from_Neptune(void) {
|
||||||
LOOP_OVER(kc, kind_constructor) {
|
LOOP_OVER(kc, kind_constructor) {
|
||||||
linked_list *L = KindConstructors::instances(kc);
|
linked_list *L = KindConstructors::instances(kc);
|
||||||
kind_constructor_instance *kci;
|
kind_constructor_instance *kci;
|
||||||
|
inter_ti current_val = 1;
|
||||||
LOOP_OVER_LINKED_LIST(kci, kind_constructor_instance, L) {
|
LOOP_OVER_LINKED_LIST(kci, kind_constructor_instance, L) {
|
||||||
wording W = Feeds::feed_text(kci->natural_language_name);
|
wording W = Feeds::feed_text(kci->natural_language_name);
|
||||||
kind *K = Kinds::base_construction(kc);
|
kind *K = Kinds::base_construction(kc);
|
||||||
pcalc_prop *prop = Propositions::Abstract::to_create_something(K, W);
|
pcalc_prop *prop = Propositions::Abstract::to_create_something(K, W);
|
||||||
Assert::true(prop, CERTAIN_CE);
|
Assert::true(prop, CERTAIN_CE);
|
||||||
instance *I = Instances::latest();
|
instance *I = Instances::latest();
|
||||||
RTKindConstructors::set_explicit_runtime_instance_value(K, I, (inter_ti) kci->value);
|
if (kci->value_specified) current_val = (inter_ti) kci->value;
|
||||||
|
RTKindConstructors::set_explicit_runtime_instance_value(K, I, current_val);
|
||||||
RTInstances::set_translation(I, kci->identifier);
|
RTInstances::set_translation(I, kci->identifier);
|
||||||
|
// LOG("From kit: %W = %S = %d -> $O\n", W, kci->identifier, current_val, I);
|
||||||
|
current_val++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,11 +101,19 @@ void KindCommands::apply(single_kind_command stc, kind_constructor *con) {
|
||||||
}
|
}
|
||||||
if (tcc == instance_KCC) {
|
if (tcc == instance_KCC) {
|
||||||
match_results mr = Regexp::create_mr();
|
match_results mr = Regexp::create_mr();
|
||||||
if (Regexp::match(&mr, stc.textual_argument, L" *(%c+?) *= *(%c+?) *= *(%d+) *")) {
|
if (Regexp::match(&mr, stc.textual_argument, L" *(%c+?) *= *(%C+) *= *(%d+) *")) {
|
||||||
kind_constructor_instance *kci = CREATE(kind_constructor_instance);
|
kind_constructor_instance *kci = CREATE(kind_constructor_instance);
|
||||||
kci->natural_language_name = Str::duplicate(mr.exp[0]);
|
kci->natural_language_name = Str::duplicate(mr.exp[0]);
|
||||||
kci->identifier = Str::duplicate(mr.exp[1]);
|
kci->identifier = Str::duplicate(mr.exp[1]);
|
||||||
kci->value = Str::atoi(mr.exp[2], 0);
|
kci->value = Str::atoi(mr.exp[2], 0);
|
||||||
|
kci->value_specified = TRUE;
|
||||||
|
ADD_TO_LINKED_LIST(kci, kind_constructor_instance, con->instances);
|
||||||
|
} else if (Regexp::match(&mr, stc.textual_argument, L" *(%c+?) *= *(%C+) *")) {
|
||||||
|
kind_constructor_instance *kci = CREATE(kind_constructor_instance);
|
||||||
|
kci->natural_language_name = Str::duplicate(mr.exp[0]);
|
||||||
|
kci->identifier = Str::duplicate(mr.exp[1]);
|
||||||
|
kci->value = 0;
|
||||||
|
kci->value_specified = FALSE;
|
||||||
ADD_TO_LINKED_LIST(kci, kind_constructor_instance, con->instances);
|
ADD_TO_LINKED_LIST(kci, kind_constructor_instance, con->instances);
|
||||||
} else {
|
} else {
|
||||||
NeptuneFiles::error(stc.textual_argument,
|
NeptuneFiles::error(stc.textual_argument,
|
||||||
|
|
|
@ -135,6 +135,7 @@ typedef struct kind_constructor_instance {
|
||||||
struct text_stream *natural_language_name;
|
struct text_stream *natural_language_name;
|
||||||
struct text_stream *identifier;
|
struct text_stream *identifier;
|
||||||
int value;
|
int value;
|
||||||
|
int value_specified;
|
||||||
} kind_constructor_instance;
|
} kind_constructor_instance;
|
||||||
|
|
||||||
@ The "tupling" of an argument is the extent to which an argument can be
|
@ The "tupling" of an argument is the extent to which an argument can be
|
||||||
|
|
Loading…
Reference in a new issue