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

Eliminated HEX_IANN and SIGNED_IANN

This commit is contained in:
Graham Nelson 2022-03-17 00:19:49 +00:00
parent df5da12ead
commit 0ab1d23d9e
36 changed files with 129 additions and 110 deletions

View file

@ -1,6 +1,6 @@
# Inform 7
v10.1.0-alpha.1+6U59 'Krypton' (16 March 2022)
v10.1.0-alpha.1+6U60 'Krypton' (17 March 2022)
## About Inform 7

View file

@ -1,3 +1,3 @@
Prerelease: alpha.1
Build Date: 16 March 2022
Build Number: 6U59
Build Date: 17 March 2022
Build Number: 6U60

View file

@ -134,32 +134,36 @@ it represents an actual number at run-time, the second if not:
=
inter_name *Emit::numeric_constant(inter_name *con_iname, inter_ti val) {
return Emit::numeric_constant_inner(con_iname, val, INT32_ITCONC, INVALID_IANN);
return Emit::numeric_constant_inner(con_iname,
InterValuePairs::number_in_base(val, 10), INT32_ITCONC);
}
inter_name *Emit::named_numeric_constant_hex(inter_name *con_iname, inter_ti val) {
return Emit::numeric_constant_inner(con_iname, val, INT32_ITCONC, HEX_IANN);
return Emit::numeric_constant_inner(con_iname,
InterValuePairs::number_in_base(val, 16), INT32_ITCONC);
}
inter_name *Emit::named_unchecked_constant_hex(inter_name *con_iname, inter_ti val) {
return Emit::numeric_constant_inner(con_iname, val, UNCHECKED_ITCONC, HEX_IANN);
return Emit::numeric_constant_inner(con_iname,
InterValuePairs::number_in_base(val, 16), UNCHECKED_ITCONC);
}
inter_name *Emit::named_numeric_constant_signed(inter_name *con_iname, int val) {
return Emit::numeric_constant_inner(con_iname, (inter_ti) val, INT32_ITCONC, SIGNED_IANN);
return Emit::numeric_constant_inner(con_iname,
InterValuePairs::signed_number(val), INT32_ITCONC);
}
inter_name *Emit::unchecked_numeric_constant(inter_name *con_iname, inter_ti val) {
return Emit::numeric_constant_inner(con_iname, val, UNCHECKED_ITCONC, INVALID_IANN);
return Emit::numeric_constant_inner(con_iname,
InterValuePairs::number_in_base(val, 10), UNCHECKED_ITCONC);
}
inter_name *Emit::numeric_constant_inner(inter_name *con_iname, inter_ti val,
inter_ti constructor_code, inter_ti annotation) {
inter_name *Emit::numeric_constant_inner(inter_name *con_iname, inter_pair val,
inter_ti constructor_code) {
packaging_state save = Packaging::enter_home_of(con_iname);
inter_symbol *con_s = InterNames::to_symbol(con_iname);
if (annotation != INVALID_IANN) SymbolAnnotation::set_b(con_s, annotation, 0);
Produce::guard(ConstantInstruction::new(Emit::at(), con_s,
InterTypes::from_constructor_code(constructor_code), InterValuePairs::number(val),
InterTypes::from_constructor_code(constructor_code), val,
Emit::baseline(), NULL));
Packaging::exit(Emit::tree(), save);
return con_iname;

View file

@ -162,23 +162,18 @@ we see that the two variables have different URLs, |/main/one/V_speed| and
|/main/two/V_speed|.
@h Annotations.
A few of the defined names in Inter can be "annotated": to be exact, those
created by |constant|, |property|, |variable| and |local|.
A few of the defined names in Inter can be "annotated".
Many annotations are simply markers temporarily given to these names during
the compilation process, and they usually do not change the meaning of the
program. For example, a constant given the annotation |_hex| has its value
printed out in textual Inter in hexadecimal not decimal. So:
program. For example, the final C code generator annotates the names of arrays
with their addresses in (virtual) memory, with the |__array_address| annotation.
In textual format:
= (text as Inter)
constant SPEED_LIMIT = 0x1ff __hex
constant my_array = { 1, 2, 4, 8 } __array_address=7718
=
This tells the code generator that it is more natural to express this value
as |1ff| hexadecimal rather than 511 decimal.
Most annotations are either there or not there, like |__hex|. (All annotation
names begin with a double underscore, |__|.) But some supply a value: for
example, |__priority=17| would be the syntax to specify this, though |__priority|
is not in the standard set, as it happens.
All annotation names begin with a double underscore, |__|. They do not all
express a value: some are boolean flags, where no |=...| part is written.
For the list of standard annotation names in use, see //Inform Annotations//.

View file

@ -15,17 +15,6 @@ generated by I7.
@h Miscellaneous constants.
@ |__hex|. Applies to |constant|. Marks that the value of this constant
is most legible in hexadecimal rather than decimal. Inter itself uses
this when writing a textual inter fomr of the constant's declaration,
and the Inform back end uses it when compiling Inform 6, in that it will
compile to a hexadecimal literal like |$4F02| rather than a decimal one
like |20226|. There is no effect on the final program.
@ |__signed|. Applies to |constant|. Marks that the value of this constant
is most legible if printed as a signed decimal literal than as an
unsigned one.
@ |__late|. Applies to |constant|. Suggests that this should be placed late
on the final compiled code, rather than at its current place. (This clue
helps the I6 code generator to avoid not-yet-declared errors; I6 is quite

View file

@ -16,7 +16,7 @@ package main _plain
constant (K_number) C_death = -5
constant (K_number) C_taxes = 14
variable (K_number) V_anxiety = C_death
constant (K_number) C_x = 0x7f2a __hex
constant (K_number) C_x = 0x7f2a
constant (K_number) cornelius = dw"frogs"
constant (K_number) gaius = dw"toads"
splat "Sing a song of \"six splats\"...\nand don't wait up"

View file

@ -16,7 +16,7 @@ package main _plain
constant (K_number) C_death = -5
constant (K_number) C_taxes = 14
variable (K_number) V_anxiety = C_death
constant (K_number) C_x = 0x7f2a __hex
constant (K_number) C_x = 0x7f2a
constant (K_number) cornelius = dw"frogs"
constant (K_number) gaius = dw"toads"
splat "Sing a song of \"six splats\"...\nand don't wait up"

View file

@ -16,7 +16,7 @@ package main _plain
constant (K_number) C_death = -5
constant (K_number) C_taxes = 14
variable (K_number) V_anxiety = C_death
constant (K_number) C_x = 0x7f2a __hex
constant (K_number) C_x = 0x7f2a
constant (K_number) cornelius = dw"frogs"
constant (K_number) gaius = dw"toads"
splat "Sing a song of \"six splats\"...\nand don't wait up"

View file

@ -17,7 +17,7 @@ package main _plain
constant (K_number) C_death = -5
constant (K_number) C_taxes = 14
variable (K_number) V_anxiety = C_death
constant (K_number) C_x = 0x7f2a __hex
constant (K_number) C_x = 0x7f2a
constant (K_number) cornelius = dw"frogs"
constant (K_number) gaius = dw"toads"
splat "Sing a song of \"six splats\"...\nand don't wait up"

View file

@ -17,7 +17,7 @@ package main _plain
constant (K_number) C_death = -5
constant (K_number) C_taxes = 14
variable (K_number) V_anxiety = C_death
constant (K_number) C_x = 0x7f2a __hex
constant (K_number) C_x = 0x7f2a
constant (K_number) cornelius = dw"frogs"
constant (K_number) gaius = dw"toads"
splat "Sing a song of \"six splats\"...\nand don't wait up"

View file

@ -16,7 +16,7 @@ package main _plain
constant (K_number) C_death = -5
constant (K_number) C_taxes = 14
variable (K_number) V_anxiety = C_death
constant (K_number) C_x = 0x7f2a __hex
constant (K_number) C_x = 0x7f2a
constant (K_number) cornelius = dw"frogs"
constant (K_number) gaius = dw"toads"
splat "Sing a song of \"six splats\"...\nand don't wait up"

View file

@ -16,7 +16,7 @@ package main _plain
constant (K_number) C_death = -5
constant (K_number) C_taxes = 14
variable (K_number) V_anxiety = C_death
constant (K_number) C_x = 0x7f2a __hex
constant (K_number) C_x = 0x7f2a
constant (K_number) cornelius = dw"frogs"
constant (K_number) gaius = dw"toads"
splat "Sing a song of \"six splats\"...\nand don't wait up"

View file

@ -16,7 +16,7 @@ package main _plain
constant (K_number) C_death = -5
constant (K_number) C_taxes = 14
variable (K_number) V_anxiety = C_death
constant (K_number) C_x = 0x7f2a __hex
constant (K_number) C_x = 0x7f2a
constant (K_number) cornelius = dw"frogs"
constant (K_number) gaius = dw"toads"
splat "Sing a song of \"six splats\"...\nand don't wait up"

View file

@ -19,7 +19,7 @@ package main _plain
constant (K_number) C_death = -5
constant (K_number) C_taxes = 14
variable (K_number) V_anxiety = C_death
constant (K_number) C_x = 0x7f2a __hex
constant (K_number) C_x = 0x7f2a
constant (K_number) cornelius = dw"frogs"
constant (K_number) gaius = dw"toads"
splat "Sing a song of \"six splats\"...\nand don't wait up"

View file

@ -19,7 +19,7 @@ package main _plain
constant (K_number) C_death = -5
constant (K_number) C_taxes = 14
variable (K_number) V_anxiety = C_death
constant (K_number) C_x = 0x7f2a __hex
constant (K_number) C_x = 0x7f2a
constant (K_number) cornelius = dw"frogs"
constant (K_number) gaius = dw"toads"
splat "Sing a song of \"six splats\"...\nand don't wait up"

View file

@ -110,12 +110,12 @@ primitive !externalcall val val -> val
package main _plain
package architectural _linkage
constant WORDSIZE = 2 __architectural
constant NULL = 0xffff __architectural __hex
constant WORD_HIGHBIT = 0x8000 __architectural __hex
constant WORD_NEXTTOHIGHBIT = 0x4000 __architectural __hex
constant IMPROBABLE_VALUE = 0x7fe3 __architectural __hex
constant NULL = 0xffff __architectural
constant WORD_HIGHBIT = 0x8000 __architectural
constant WORD_NEXTTOHIGHBIT = 0x4000 __architectural
constant IMPROBABLE_VALUE = 0x7fe3 __architectural
constant MAX_POSITIVE_NUMBER = 32767 __architectural
constant MIN_NEGATIVE_NUMBER = -32768 __architectural __signed
constant MIN_NEGATIVE_NUMBER = -32768 __architectural
constant TARGET_ZCODE = 1 __architectural
constant DEBUG = 1 __architectural
package generic _module

View file

@ -110,12 +110,12 @@ primitive !externalcall val val -> val
package main _plain
package architectural _linkage
constant WORDSIZE = 2 __architectural
constant NULL = 0xffff __architectural __hex
constant WORD_HIGHBIT = 0x8000 __architectural __hex
constant WORD_NEXTTOHIGHBIT = 0x4000 __architectural __hex
constant IMPROBABLE_VALUE = 0x7fe3 __architectural __hex
constant NULL = 0xffff __architectural
constant WORD_HIGHBIT = 0x8000 __architectural
constant WORD_NEXTTOHIGHBIT = 0x4000 __architectural
constant IMPROBABLE_VALUE = 0x7fe3 __architectural
constant MAX_POSITIVE_NUMBER = 32767 __architectural
constant MIN_NEGATIVE_NUMBER = -32768 __architectural __signed
constant MIN_NEGATIVE_NUMBER = -32768 __architectural
constant TARGET_ZCODE = 1 __architectural
constant DEBUG = 1 __architectural
package generic _module

View file

@ -16,7 +16,7 @@ package main _plain
constant (K_number) C_death = -5
constant (K_number) C_taxes = 14
variable (K_number) V_anxiety = C_death
constant (K_number) C_x = 0x7f2a __hex
constant (K_number) C_x = 0x7f2a
constant (K_number) cornelius = dw"frogs"
constant (K_number) gaius = dw"toads"
splat "Sing a song of \"six splats\"...\nand don't wait up"

View file

@ -206,7 +206,7 @@ inter_symbol *LargeScale::find_architectural_symbol(inter_tree *I, text_stream *
Dictionaries::create(create_these_architectural_symbols_on_demand, I"Object");
}
if (Dictionaries::find(create_these_architectural_symbols_on_demand, N)) {
S = LargeScale::arch_constant(I, N, InterTypes::unchecked(), 0);
S = LargeScale::arch_constant_dec(I, N, InterTypes::unchecked(), 0);
SymbolAnnotation::set_b(S, VENEER_IANN, TRUE);
}
}
@ -244,55 +244,62 @@ void LargeScale::make_architectural_definitions(inter_tree *I,
if (current_architecture == NULL) internal_error("no architecture set");
inter_type type = InterTypes::unchecked();
if (Architectures::is_16_bit(current_architecture)) {
LargeScale::arch_constant(I, I"WORDSIZE", type, 2);
LargeScale::arch_constant_dec(I, I"WORDSIZE", type, 2);
LargeScale::arch_constant_hex(I, I"NULL", type, 0xffff);
LargeScale::arch_constant_hex(I, I"WORD_HIGHBIT", type, 0x8000);
LargeScale::arch_constant_hex(I, I"WORD_NEXTTOHIGHBIT", type, 0x4000);
LargeScale::arch_constant_hex(I, I"IMPROBABLE_VALUE", type, 0x7fe3);
LargeScale::arch_constant(I, I"MAX_POSITIVE_NUMBER", type, 32767);
LargeScale::arch_constant_dec(I, I"MAX_POSITIVE_NUMBER", type, 32767);
LargeScale::arch_constant_signed(I, I"MIN_NEGATIVE_NUMBER", type, -32768);
LargeScale::arch_constant(I, I"TARGET_ZCODE", type, 1);
LargeScale::arch_constant_dec(I, I"TARGET_ZCODE", type, 1);
} else {
LargeScale::arch_constant(I, I"WORDSIZE", type, 4);
LargeScale::arch_constant_dec(I, I"WORDSIZE", type, 4);
LargeScale::arch_constant_hex(I, I"NULL", type, 0xffffffff);
LargeScale::arch_constant_hex(I, I"WORD_HIGHBIT", type, 0x80000000);
LargeScale::arch_constant_hex(I, I"WORD_NEXTTOHIGHBIT", type, 0x40000000);
LargeScale::arch_constant_hex(I, I"IMPROBABLE_VALUE", type, 0xdeadce11);
LargeScale::arch_constant(I, I"MAX_POSITIVE_NUMBER", type, 2147483647);
LargeScale::arch_constant_dec(I, I"MAX_POSITIVE_NUMBER", type, 2147483647);
LargeScale::arch_constant_signed(I, I"MIN_NEGATIVE_NUMBER", type, -2147483648);
LargeScale::arch_constant(I, I"TARGET_GLULX", type, 1);
LargeScale::arch_constant_dec(I, I"TARGET_GLULX", type, 1);
}
if (Architectures::debug_enabled(current_architecture))
LargeScale::arch_constant(I, I"DEBUG", type, 1);
LargeScale::arch_constant_dec(I, I"DEBUG", type, 1);
}
@ The functions above use the following tiny API to create architectural constants:
=
inter_symbol *LargeScale::arch_constant(inter_tree *I, text_stream *N,
inter_type type, inter_ti val) {
inter_type type, inter_pair val) {
inter_package *arch = LargeScale::architecture_package(I);
inter_symbols_table *tab = InterPackage::scope(arch);
inter_symbol *S = InterSymbolsTable::symbol_from_name_creating(tab, N);
SymbolAnnotation::set_b(S, ARCHITECTURAL_IANN, TRUE);
inter_bookmark *IBM = &(I->site.strdata.architecture_bookmark);
Produce::guard(ConstantInstruction::new(IBM, S, type, InterValuePairs::number(val),
Produce::guard(ConstantInstruction::new(IBM, S, type, val,
(inter_ti) InterBookmark::baseline(IBM) + 1, NULL));
return S;
}
inter_symbol *LargeScale::arch_constant_dec(inter_tree *I, text_stream *N,
inter_type type, inter_ti val) {
inter_symbol *S = LargeScale::arch_constant(I, N, type,
InterValuePairs::number_in_base(val, 10));
return S;
}
inter_symbol *LargeScale::arch_constant_hex(inter_tree *I, text_stream *N,
inter_type type, inter_ti val) {
inter_symbol *S = LargeScale::arch_constant(I, N, type, val);
SymbolAnnotation::set_b(S, HEX_IANN, 1);
inter_symbol *S = LargeScale::arch_constant(I, N, type,
InterValuePairs::number_in_base(val, 16));
return S;
}
inter_symbol *LargeScale::arch_constant_signed(inter_tree *I, text_stream *N,
inter_type type, int val) {
inter_symbol *S = LargeScale::arch_constant(I, N, type, (inter_ti) val);
SymbolAnnotation::set_b(S, SIGNED_IANN, 1);
inter_symbol *S = LargeScale::arch_constant(I, N, type,
InterValuePairs::signed_number(val));
return S;
}

View file

@ -70,14 +70,12 @@ The set of annotations used by the Inform tool suite is as follows.
@e EITHER_OR_IANN
@e EXTENT_IANN
@e FAKE_ACTION_IANN
@e HEX_IANN
@e IMPLIED_ARGUMENT_IANN
@e INLINE_ARRAY_IANN
@e METAVERB_IANN
@e NOUN_FILTER_IANN
@e OBJECT_IANN
@e SCOPE_FILTER_IANN
@e SIGNED_IANN
@e TABLEARRAY_IANN
@e TEXT_LITERAL_IANN
@e VENEER_IANN
@ -111,14 +109,12 @@ void SymbolAnnotation::declare_canonical_annotations(void) {
SymbolAnnotation::declare(EITHER_OR_IANN, I"__either_or", BOOLEAN_IATYPE);
SymbolAnnotation::declare(EXTENT_IANN, I"__extent", BOOLEAN_IATYPE);
SymbolAnnotation::declare(FAKE_ACTION_IANN, I"__fake_action", BOOLEAN_IATYPE);
SymbolAnnotation::declare(HEX_IANN, I"__hex", BOOLEAN_IATYPE);
SymbolAnnotation::declare(IMPLIED_ARGUMENT_IANN, I"__implied_argument", BOOLEAN_IATYPE);
SymbolAnnotation::declare(INLINE_ARRAY_IANN, I"__inline_array", BOOLEAN_IATYPE);
SymbolAnnotation::declare(METAVERB_IANN, I"__meta_verb", BOOLEAN_IATYPE);
SymbolAnnotation::declare(NOUN_FILTER_IANN, I"__noun_filter", BOOLEAN_IATYPE);
SymbolAnnotation::declare(OBJECT_IANN, I"__object", BOOLEAN_IATYPE);
SymbolAnnotation::declare(SCOPE_FILTER_IANN, I"__scope_filter", BOOLEAN_IATYPE);
SymbolAnnotation::declare(SIGNED_IANN, I"__signed", BOOLEAN_IATYPE);
SymbolAnnotation::declare(TABLEARRAY_IANN, I"__table_array", BOOLEAN_IATYPE);
SymbolAnnotation::declare(TEXT_LITERAL_IANN, I"__text_literal", BOOLEAN_IATYPE);
SymbolAnnotation::declare(VENEER_IANN, I"__veneer", BOOLEAN_IATYPE);

View file

@ -22,7 +22,10 @@ typedef struct inter_pair {
@ These are the formats. Note that changing any of these values would invalidate
existing Inter binary files, necessitating a bump of //The Inter Version//.
@e NUMERIC_IVAL from 0x10000
@e DECIMAL_IVAL from 0x10000
@e HEX_IVAL
@e BINARY_IVAL
@e SIGNED_IVAL
@e TEXTUAL_IVAL
@e REAL_IVAL
@e DWORD_IVAL
@ -33,16 +36,38 @@ existing Inter binary files, necessitating a bump of //The Inter Version//.
@h Numeric pairs.
These can represent any |inter_ti| value, and are used when the data is a
literal integer.
literal integer. Note that they express both an integer and also a preferred
way to print it out -- as decimal, hexadecimal, binary, or signed decimal.
But these are all numerically equal. They affect only the way in which the
Inter program is printed to text files, not the meaning of the program.
=
inter_pair InterValuePairs::number(inter_ti N) {
inter_pair pair;
pair.data_format = NUMERIC_IVAL;
pair.data_format = DECIMAL_IVAL;
pair.data_content = N;
return pair;
}
inter_pair InterValuePairs::number_in_base(inter_ti N, int b) {
inter_pair pair;
switch (b) {
case 2: pair.data_format = BINARY_IVAL; break;
case 10: pair.data_format = DECIMAL_IVAL; break;
case 16: pair.data_format = HEX_IVAL; break;
default: internal_error("only bases 2, 10, 16 are supported");
}
pair.data_content = N;
return pair;
}
inter_pair InterValuePairs::signed_number(int N) {
inter_pair pair;
pair.data_format = SIGNED_IVAL;
pair.data_content = (inter_ti) N;
return pair;
}
inter_pair InterValuePairs::number_from_I6_notation(text_stream *S) {
int sign = 1, base = 10, from = 0;
if (Str::prefix_eq(S, I"-", 1)) { sign = -1; from = 1; }
@ -64,7 +89,17 @@ inter_pair InterValuePairs::number_from_I6_notation(text_stream *S) {
}
inter_ti InterValuePairs::to_number(inter_pair pair) {
if (pair.data_format == NUMERIC_IVAL) return pair.data_content;
if (InterValuePairs::is_number(pair)) return pair.data_content;
return 0;
}
inter_ti InterValuePairs::to_base(inter_pair pair) {
switch (pair.data_format) {
case DECIMAL_IVAL: return 10;
case SIGNED_IVAL: return 10;
case HEX_IVAL: return 16;
case BINARY_IVAL: return 2;
}
return 0;
}
@ -72,18 +107,22 @@ inter_ti InterValuePairs::to_number(inter_pair pair) {
=
int InterValuePairs::is_number(inter_pair pair) {
if (pair.data_format == NUMERIC_IVAL) return TRUE;
if ((pair.data_format == DECIMAL_IVAL) ||
(pair.data_format == HEX_IVAL) ||
(pair.data_format == BINARY_IVAL) ||
(pair.data_format == SIGNED_IVAL))
return TRUE;
return FALSE;
}
int InterValuePairs::is_one(inter_pair pair) {
if ((pair.data_format == NUMERIC_IVAL) &&
if ((InterValuePairs::is_number(pair)) &&
(pair.data_content == 1)) return TRUE;
return FALSE;
}
int InterValuePairs::is_zero(inter_pair pair) {
if ((pair.data_format == NUMERIC_IVAL) &&
if ((InterValuePairs::is_number(pair)) &&
(pair.data_content == 0)) return TRUE;
return FALSE;
}
@ -400,8 +439,8 @@ inter_error_message *InterValuePairs::verify(inter_package *owner, inter_tree_no
inter_pair pair, inter_type type) {
inter_symbols_table *scope = InterPackage::scope(owner);
if (scope == NULL) scope = Inode::globals(P);
if (InterValuePairs::is_number(pair)) @<Check this is in range for the type@>
switch (pair.data_format) {
case NUMERIC_IVAL: @<Check this is in range for the type@>;
case SYMBOLIC_IVAL: @<Check this is reasonable, if we know what it is yet@>;
case DWORD_IVAL:
case PDWORD_IVAL:

View file

@ -422,7 +422,7 @@ in an interleaved form, to keep each notation together. Both have a simple
outer structure:
=
void TextualInter::write_pair(OUTPUT_STREAM, inter_tree_node *P, inter_pair pair, int hex) {
void TextualInter::write_pair(OUTPUT_STREAM, inter_tree_node *P, inter_pair pair) {
inter_tree *I = Inode::tree(P);
if (InterValuePairs::is_number(pair)) @<Print numeric literal syntax@>
@ -480,8 +480,12 @@ inter_error_message *TextualInter::parse_pair(text_stream *line, inter_error_loc
or (unsigned) binary, but cannot be printed back in binary.
@<Print numeric literal syntax@> =
if (hex) WRITE("0x%x", InterValuePairs::to_number(pair));
else WRITE("%d", InterValuePairs::to_number(pair));
switch (InterValuePairs::to_base(pair)) {
case 10: WRITE("%d", InterValuePairs::to_number(pair)); break;
case 2:
case 16: WRITE("0x%x", InterValuePairs::to_number(pair)); break;
default: WRITE("???"); break;
}
@<Parse numeric literal syntax@> =
wchar_t c = first_char;
@ -506,7 +510,8 @@ or (unsigned) binary, but cannot be printed back in binary.
N = sign*N;
if (InterTypes::literal_is_in_range(N, type_wanted) == FALSE)
return InterErrors::quoted(I"value out of range", S, eloc);
*pair = InterValuePairs::number((inter_ti) N);
if (sign == -1) *pair = InterValuePairs::signed_number((int) N);
else *pair = InterValuePairs::number_in_base((inter_ti) N, base);
return NULL;
}

View file

@ -245,8 +245,6 @@ void ConstantInstruction::read(inter_construct *IC, inter_bookmark *IBM,
=
void ConstantInstruction::write(inter_construct *IC, OUTPUT_STREAM, inter_tree_node *P) {
inter_symbol *con_name = InterSymbolsTable::symbol_from_ID_at_node(P, DEFN_CONST_IFLD);
int hex = FALSE;
if (SymbolAnnotation::get_b(con_name, HEX_IANN)) hex = TRUE;
WRITE("constant ");
TextualInter::write_optional_type_marker(OUT, P, TYPE_CONST_IFLD);
WRITE("%S = ", InterSymbol::identifier(con_name));
@ -262,10 +260,9 @@ void ConstantInstruction::write(inter_construct *IC, OUTPUT_STREAM, inter_tree_n
for (int i=DATA_CONST_IFLD; i<P->W.extent; i=i+2) {
if (i > DATA_CONST_IFLD) WRITE(",");
if (fmt != CONST_LIST_FORMAT_NONE) WRITE(" ");
TextualInter::write_pair(OUT, P, InterValuePairs::get(P, i), hex);
TextualInter::write_pair(OUT, P, InterValuePairs::get(P, i));
}
if (fmt != CONST_LIST_FORMAT_NONE) WRITE(" }");
// SymbolAnnotation::write_annotations(OUT, P, con_name);
}
@h Access functions.

View file

@ -137,8 +137,7 @@ void InstanceInstruction::write(inter_construct *IC, OUTPUT_STREAM, inter_tree_n
inter_symbol *typename_s = InterSymbolsTable::symbol_from_ID_at_node(P, TYPE_INST_IFLD);
WRITE("instance (%S) %S = ",
InterSymbol::identifier(typename_s), InterSymbol::identifier(instance_s));
TextualInter::write_pair(OUT, P, InterValuePairs::get(P, VAL1_INST_IFLD), FALSE);
// SymbolAnnotation::write_annotations(OUT, P, instance_s);
TextualInter::write_pair(OUT, P, InterValuePairs::get(P, VAL1_INST_IFLD));
}
@h Access functions.

View file

@ -88,7 +88,6 @@ void PropertyInstruction::write(inter_construct *IC, OUTPUT_STREAM, inter_tree_n
WRITE("property ");
TextualInter::write_optional_type_marker(OUT, P, TYPE_PROP_IFLD);
WRITE("%S", InterSymbol::identifier(prop_name));
// SymbolAnnotation::write_annotations(OUT, P, prop_name);
}
@h Access functions.

View file

@ -160,7 +160,7 @@ void PropertyValueInstruction::write(inter_construct *IC, OUTPUT_STREAM, inter_t
inter_symbol *owner_s = PropertyValueInstruction::owner(P);
WRITE("propertyvalue %S of %S = ",
InterSymbol::identifier(prop_s), InterSymbol::identifier(owner_s));
TextualInter::write_pair(OUT, P, PropertyValueInstruction::value(P), FALSE);
TextualInter::write_pair(OUT, P, PropertyValueInstruction::value(P));
}
@h Access functions.

View file

@ -160,7 +160,6 @@ void TypenameInstruction::write(inter_construct *IC, OUTPUT_STREAM, inter_tree_n
WRITE("= ");
InterTypes::write_typename_definition(OUT, typename_s);
}
// SymbolAnnotation::write_annotations(OUT, P, typename_s);
}
@h Access functions.

View file

@ -96,8 +96,7 @@ void VariableInstruction::write(inter_construct *IC, OUTPUT_STREAM, inter_tree_n
WRITE("variable ");
TextualInter::write_optional_type_marker(OUT, P, TYPE_VAR_IFLD);
WRITE("%S = ", InterSymbol::identifier(var_s));
TextualInter::write_pair(OUT, P, VariableInstruction::value(P), FALSE);
// SymbolAnnotation::write_annotations(OUT, P, var_s);
TextualInter::write_pair(OUT, P, VariableInstruction::value(P));
}
@h Access functions.

View file

@ -76,7 +76,6 @@ void LocalInstruction::write(inter_construct *IC, OUTPUT_STREAM, inter_tree_node
TextualInter::write_optional_type_marker(OUT, P, TYPE_LOCAL_IFLD);
inter_symbol *variable_s = LocalInstruction::variable(P);
WRITE("%S", InterSymbol::identifier(variable_s));
// SymbolAnnotation::write_annotations(OUT, P, variable_s);
}
@h Access function.

View file

@ -78,7 +78,7 @@ void RefInstruction::read(inter_construct *IC, inter_bookmark *IBM, inter_line_p
void RefInstruction::write(inter_construct *IC, OUTPUT_STREAM, inter_tree_node *P) {
WRITE("ref ");
TextualInter::write_optional_type_marker(OUT, P, TYPE_REF_IFLD);
TextualInter::write_pair(OUT, P, RefInstruction::value(P), FALSE);
TextualInter::write_pair(OUT, P, RefInstruction::value(P));
}
@h Access function.

View file

@ -96,7 +96,7 @@ void ValInstruction::read(inter_construct *IC, inter_bookmark *IBM, inter_line_p
void ValInstruction::write(inter_construct *IC, OUTPUT_STREAM, inter_tree_node *P) {
WRITE("val ");
TextualInter::write_optional_type_marker(OUT, P, TYPE_VAL_IFLD);
TextualInter::write_pair(OUT, P, ValInstruction::value(P), FALSE);
TextualInter::write_pair(OUT, P, ValInstruction::value(P));
}
@h Access function.

View file

@ -163,17 +163,9 @@ void VanillaConstants::definition_value(code_generation *gen, int form,
Generators::compile_literal_number(gen, 1, FALSE);
}
break;
case DATA_GDCFORM: {
inter_pair val = ConstantInstruction::constant(P);
if ((InterValuePairs::is_number(val)) &&
(SymbolAnnotation::get_b(con_name, HEX_IANN))) {
inter_ti N = InterValuePairs::to_number(val);
Generators::compile_literal_number(gen, N, TRUE);
} else {
CodeGen::pair(gen, P, val);
}
case DATA_GDCFORM:
CodeGen::pair(gen, P, ConstantInstruction::constant(P));
break;
}
case COMPUTED_GDCFORM: {
WRITE("(");
for (int i=0; i<ConstantInstruction::list_len(P); i++) {