diff --git a/README.md b/README.md
index 4e77a35cf..44b17c3e7 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Inform 7
-v10.1.0-alpha.1+6T34 'Krypton' (23 September 2021)
+v10.1.0-alpha.1+6T35 'Krypton' (25 September 2021)
## About Inform 7
diff --git a/build.txt b/build.txt
index 1595760cd..f5ff36d0d 100644
--- a/build.txt
+++ b/build.txt
@@ -1,3 +1,3 @@
Prerelease: alpha.1
-Build Date: 23 September 2021
-Build Number: 6T34
+Build Date: 25 September 2021
+Build Number: 6T35
diff --git a/docs/CommandParserKit/S-prs.html b/docs/CommandParserKit/S-prs.html
index 1b8537f92..9f5a43c44 100644
--- a/docs/CommandParserKit/S-prs.html
+++ b/docs/CommandParserKit/S-prs.html
@@ -2062,7 +2062,7 @@ is set; it returns a parser error number, or 0 if no error occurred.
1 : indef_type = indef_type | THAT_BIT ;
default :
indef_owner = PronounValue ( cto );
- if ( indef_owner == NULL ) indef_owner = InformParser ;
+ if ( indef_owner == NULL ) indef_owner = nothing ;
}
}
diff --git a/docs/WorldModelKit/S-msc.html b/docs/WorldModelKit/S-msc.html
index 16a5af865..315ae392f 100644
--- a/docs/WorldModelKit/S-msc.html
+++ b/docs/WorldModelKit/S-msc.html
@@ -67,14 +67,6 @@ are more important to understand.
(1) The first three variables to be defined are special in that they are
significant to very early-style Z-machine interpreters, where they are
used to produce the status line display (hence and ).
-The first variable must always equal a valid object number, which is why
-we — pretty weirdly — set it equal to the placeholder object ,
-which takes no part in play, and is not a valid I7 object. This is not
-typesafe in I7 terms, but that doesn't matter because initialisation
-will correct it to a typesafe value before any I7 source text can execute.
-( and are entirely unused on when we target Glulx.)
-Once these variables are defined, the sequence of definition of the rest
-is not significant.
(2) The are used for the finite state machine used in printing
text, which keeps track of automatic paragraph breaking and the like. For
details see the "Printing.i6t" section.
@@ -141,7 +133,7 @@ based on character cells.
-Global location = InformLibrary ;
+Global location = 0 ;
Global sline1 ; Global sline2 ;
@@ -284,15 +276,11 @@ possibility later.
-Object InformParser "(Inform Parser)" has proper ;
-
[ ParserError error_type ;
if ( error_type ) PrintSingleParagraph ( error_type );
rfalse ;
];
-Object InformLibrary "(Inform Library)" has proper ;
-
[ UnknownVerb v ;
if ( KIT_CONFIGURATION_BITMAP & NO_VERB_VERB_DEFINED_TCBIT ) {
verb_wordnum = 0 ; return 'no.verb' ;
diff --git a/docs/WorldModelKit/S-tst.html b/docs/WorldModelKit/S-tst.html
index af88654ab..d2af3a00b 100644
--- a/docs/WorldModelKit/S-tst.html
+++ b/docs/WorldModelKit/S-tst.html
@@ -72,7 +72,6 @@ moves an object to a new position in the object tree.
];
[ XTestMove obj dest ;
- if ( obj <= InformLibrary ) print_ret "[Can't move " , ( name ) obj , ": it's a system object.]" ;
if ( obj . component_parent ) print_ret "[Can't move " , ( name ) obj , ": it's part of " ,
( the ) obj . component_parent , ".]" ;
while ( dest ) {
diff --git a/docs/final-module/2-cg.html b/docs/final-module/2-cg.html
index a077122a5..e94ba07a9 100644
--- a/docs/final-module/2-cg.html
+++ b/docs/final-module/2-cg.html
@@ -73,7 +73,7 @@ function togglePopup(material_id) {
To generate final code from intermediate code.
-
+
The structure code_generation is accessed in 2/cg2, 2/tvg, 2/vc, 2/vo, 2/vv, 2/vc2, 3/fti, 3/fbi, 3/fi, 4/fi6, 5/fnc, 5/cnm, 5/cmm, 5/cpc, 5/ccn, 5/com, 5/cfm, 5/clt and here.
+The structure code_generation is accessed in 2/cg2, 2/tvg, 2/vc, 2/vo, 2/vc2, 3/fti, 3/fbi, 3/fi, 4/fi6, 5/fnc, 5/cnm, 5/cmm, 5/cpc, 5/ccn, 5/com, 5/cfm, 5/clt and here.
-generated_segment * CodeGen::select ( code_generation * gen , int i ) {
+generated_segment * CodeGen::select ( code_generation * gen , int i ) {
generated_segment * saved = gen -> segmentation . current_segment ;
if (( i < 0 ) || ( i >= NO_DEFINED_I7CGS_VALUES )) internal_error ( "out of range" );
if ( gen -> segmentation . temporarily_diverted ) internal_error ( "poorly timed selection" );
@@ -288,7 +292,7 @@ to go back to where it was. These calls must be made in properly nested pairs.
return saved ;
}
-void CodeGen::deselect ( code_generation * gen , generated_segment * saved ) {
+void CodeGen::deselect ( code_generation * gen , generated_segment * saved ) {
if ( gen -> segmentation . temporarily_diverted ) internal_error ( "poorly timed deselection" );
gen -> segmentation . current_segment = saved ;
}
@@ -317,7 +321,7 @@ if it has been "temporarily diverted" then the regiular selection is ignored.
-text_stream * CodeGen::current ( code_generation * gen ) {
+text_stream * CodeGen::current ( code_generation * gen ) {
if ( gen -> segmentation . temporarily_diverted )
return gen -> segmentation . segments [ temporary_I7CGS ]-> generated_code ;
if ( gen -> segmentation . current_segment == NULL ) return NULL ;
@@ -382,8 +386,18 @@ what we've worked on so far.
Inter::Symbols::clear_flag ( symb_name , TRAVERSE_MARK_BIT );
}
+
+
+
+text_stream * CodeGen::name ( inter_symbol * symb ) {
+ if ( symb == NULL ) return NULL ;
+ if ( Inter::Symbols::get_translate ( symb )) return Inter::Symbols::get_translate ( symb );
+ return symb -> symbol_name ;
+}
+
+
diff --git a/docs/final-module/2-cg2.html b/docs/final-module/2-cg2.html
index 6c4e81ab7..45d05df89 100644
--- a/docs/final-module/2-cg2.html
+++ b/docs/final-module/2-cg2.html
@@ -73,7 +73,7 @@ function togglePopup(material_id) {
To create the range of possible targets into which Inter can be converted.
-
+
@@ -173,12 +173,61 @@ I6 code. Still, all pragmas are offered to all generators.
enum OFFER_PRAGMA_MTID
-VOID_METHOD_TYPE ( OFFER_PRAGMA_MTID , code_generator * generator , code_generation * gen , inter_tree_node * P , text_stream * tag , text_stream * content )
-void Generators::offer_pragma ( code_generation * gen , inter_tree_node * P , text_stream * tag , text_stream * content ) {
+VOID_METHOD_TYPE ( OFFER_PRAGMA_MTID , code_generator * generator , code_generation * gen ,
+ inter_tree_node * P , text_stream * tag , text_stream * content )
+void Generators::offer_pragma ( code_generation * gen , inter_tree_node * P , text_stream * tag ,
+ text_stream * content ) {
VOID_METHOD_CALL ( gen -> generator , OFFER_PRAGMA_MTID , gen , P , tag , content );
}
-
+
+
+enum PLACE_LABEL_MTID
+enum EVALUATE_LABEL_MTID
+
+
+VOID_METHOD_TYPE ( PLACE_LABEL_MTID , code_generator * generator , code_generation * gen ,
+ text_stream * label_name )
+VOID_METHOD_TYPE ( EVALUATE_LABEL_MTID , code_generator * generator , code_generation * gen ,
+ text_stream * label_name )
+void Generators::place_label ( code_generation * gen , text_stream * label_name ) {
+ VOID_METHOD_CALL ( gen -> generator , PLACE_LABEL_MTID , gen , label_name );
+}
+void Generators::evaluate_label ( code_generation * gen , text_stream * label_name ) {
+ VOID_METHOD_CALL ( gen -> generator , EVALUATE_LABEL_MTID , gen , label_name );
+}
+
+
+
+enum INVOKE_PRIMITIVE_MTID
+enum INVOKE_FUNCTION_MTID
+enum INVOKE_OPCODE_MTID
+
+
+VOID_METHOD_TYPE ( INVOKE_PRIMITIVE_MTID , code_generator * generator , code_generation * gen ,
+ inter_symbol * prim_name , inter_tree_node * P , int void_context )
+VOID_METHOD_TYPE ( INVOKE_FUNCTION_MTID , code_generator * generator , code_generation * gen ,
+ inter_symbol * fn , inter_tree_node * P , int void_context )
+VOID_METHOD_TYPE ( INVOKE_OPCODE_MTID , code_generator * generator , code_generation * gen ,
+ text_stream * opcode , int operand_count , inter_tree_node ** operands ,
+ inter_tree_node * label , int label_sense , int void_context )
+void Generators::invoke_primitive ( code_generation * gen , inter_symbol * prim_name ,
+ inter_tree_node * P , int void_context ) {
+ VOID_METHOD_CALL ( gen -> generator , INVOKE_PRIMITIVE_MTID , gen , prim_name , P , void_context );
+}
+void Generators::invoke_function ( code_generation * gen , inter_symbol * fn , inter_tree_node * P ,
+ int void_context ) {
+ VOID_METHOD_CALL ( gen -> generator , INVOKE_FUNCTION_MTID , gen , fn , P , void_context );
+}
+void Generators::invoke_opcode ( code_generation * gen , text_stream * opcode , int operand_count ,
+ inter_tree_node ** operands , inter_tree_node * label , int label_sense , int void_context ) {
+ VOID_METHOD_CALL ( gen -> generator , INVOKE_OPCODE_MTID , gen , opcode , operand_count ,
+ operands , label , label_sense , void_context );
+}
+
+
enum GENERAL_SEGMENT_MTID
enum DEFAULT_SEGMENT_MTID
@@ -193,69 +242,57 @@ I6 code. Still, all pragmas are offered to all generators.
INT_METHOD_TYPE ( CONSTANT_SEGMENT_MTID , code_generator * generator , code_generation * gen )
INT_METHOD_TYPE ( TL_SEGMENT_MTID , code_generator * generator , code_generation * gen )
-int Generators::general_segment ( code_generation * gen , inter_tree_node * P ) {
+int Generators::general_segment ( code_generation * gen , inter_tree_node * P ) {
int rv = 0 ;
INT_METHOD_CALL ( rv , gen -> generator , GENERAL_SEGMENT_MTID , gen , P );
return rv ;
}
-int Generators::default_segment ( code_generation * gen ) {
+int Generators::default_segment ( code_generation * gen ) {
int rv = 0 ;
INT_METHOD_CALL ( rv , gen -> generator , DEFAULT_SEGMENT_MTID , gen );
return rv ;
}
-int Generators::constant_segment ( code_generation * gen ) {
+int Generators::constant_segment ( code_generation * gen ) {
int rv = 0 ;
INT_METHOD_CALL ( rv , gen -> generator , CONSTANT_SEGMENT_MTID , gen );
return rv ;
}
-int Generators::basic_constant_segment ( code_generation * gen , inter_symbol * con_name , int depth ) {
+int Generators::basic_constant_segment ( code_generation * gen , inter_symbol * con_name , int depth ) {
int rv = 0 ;
INT_METHOD_CALL ( rv , gen -> generator , BASIC_CONSTANT_SEGMENT_MTID , gen , con_name , depth );
return rv ;
}
-int Generators::tl_segment ( code_generation * gen ) {
+int Generators::tl_segment ( code_generation * gen ) {
int rv = 0 ;
INT_METHOD_CALL ( rv , gen -> generator , TL_SEGMENT_MTID , gen );
return rv ;
}
-
+
enum MANGLE_IDENTIFIER_MTID
VOID_METHOD_TYPE ( MANGLE_IDENTIFIER_MTID , code_generator * generator , text_stream * OUT , text_stream * identifier )
-void Generators::mangle ( code_generation * gen , text_stream * OUT , text_stream * identifier ) {
+void Generators::mangle ( code_generation * gen , text_stream * OUT , text_stream * identifier ) {
VOID_METHOD_CALL ( gen -> generator , MANGLE_IDENTIFIER_MTID , OUT , identifier );
}
-
-
-enum COMPILE_PRIMITIVE_MTID
-
-
-INT_METHOD_TYPE ( COMPILE_PRIMITIVE_MTID , code_generator * generator , code_generation * gen , inter_symbol * prim_name , inter_tree_node * P )
-int Generators::compile_primitive ( code_generation * gen , inter_symbol * prim_name , inter_tree_node * P ) {
- int rv = FALSE ;
- INT_METHOD_CALL ( rv , gen -> generator , COMPILE_PRIMITIVE_MTID , gen , prim_name , P );
- return rv ;
-}
-
-
+
enum COMPILE_DICTIONARY_WORD_MTID
VOID_METHOD_TYPE ( COMPILE_DICTIONARY_WORD_MTID , code_generator * generator , code_generation * gen , text_stream * S , int pluralise )
-void Generators::compile_dictionary_word ( code_generation * gen , text_stream * S , int pluralise ) {
+void Generators::compile_dictionary_word ( code_generation * gen , text_stream * S , int pluralise ) {
VOID_METHOD_CALL ( gen -> generator , COMPILE_DICTIONARY_WORD_MTID , gen , S , pluralise );
}
-
+
enum COMPILE_LITERAL_NUMBER_MTID
enum COMPILE_LITERAL_REAL_MTID
@@ -263,24 +300,24 @@ I6 code. Still, all pragmas are offered to all generators.
VOID_METHOD_TYPE ( COMPILE_LITERAL_NUMBER_MTID , code_generator * generator , code_generation * gen , inter_ti val , int hex_mode )
VOID_METHOD_TYPE ( COMPILE_LITERAL_REAL_MTID , code_generator * generator , code_generation * gen , text_stream * textual )
-void Generators::compile_literal_number ( code_generation * gen , inter_ti val , int hex_mode ) {
+void Generators::compile_literal_number ( code_generation * gen , inter_ti val , int hex_mode ) {
VOID_METHOD_CALL ( gen -> generator , COMPILE_LITERAL_NUMBER_MTID , gen , val , hex_mode );
}
-void Generators::compile_literal_real ( code_generation * gen , text_stream * textual ) {
+void Generators::compile_literal_real ( code_generation * gen , text_stream * textual ) {
VOID_METHOD_CALL ( gen -> generator , COMPILE_LITERAL_REAL_MTID , gen , textual );
}
-
+
enum COMPILE_LITERAL_TEXT_MTID
VOID_METHOD_TYPE ( COMPILE_LITERAL_TEXT_MTID , code_generator * generator , code_generation * gen , text_stream * S , int print_mode , int box_mode , int escape_mode )
-void Generators::compile_literal_text ( code_generation * gen , text_stream * S , int print_mode , int box_mode , int escape_mode ) {
+void Generators::compile_literal_text ( code_generation * gen , text_stream * S , int print_mode , int box_mode , int escape_mode ) {
VOID_METHOD_CALL ( gen -> generator , COMPILE_LITERAL_TEXT_MTID , gen , S , print_mode , box_mode , escape_mode );
}
-
+
enum DECLARE_PROPERTY_MTID
enum DECLARE_ATTRIBUTE_MTID
@@ -288,39 +325,54 @@ I6 code. Still, all pragmas are offered to all generators.
VOID_METHOD_TYPE ( DECLARE_PROPERTY_MTID , code_generator * generator , code_generation * gen , inter_symbol * prop_name , int used )
VOID_METHOD_TYPE ( DECLARE_ATTRIBUTE_MTID , code_generator * generator , code_generation * gen , text_stream * prop_name )
-void Generators::declare_property ( code_generation * gen , inter_symbol * prop_name , int used ) {
+void Generators::declare_property ( code_generation * gen , inter_symbol * prop_name , int used ) {
VOID_METHOD_CALL ( gen -> generator , DECLARE_PROPERTY_MTID , gen , prop_name , used );
}
-void Generators::declare_attribute ( code_generation * gen , text_stream * prop_name ) {
+void Generators::declare_attribute ( code_generation * gen , text_stream * prop_name ) {
VOID_METHOD_CALL ( gen -> generator , DECLARE_ATTRIBUTE_MTID , gen , prop_name );
}
-
+
enum PREPARE_VARIABLE_MTID
enum DECLARE_VARIABLE_MTID
+enum DECLARE_VARIABLES_MTID
enum EVALUATE_VARIABLE_MTID
INT_METHOD_TYPE ( PREPARE_VARIABLE_MTID , code_generator * generator , code_generation * gen , inter_tree_node * P , inter_symbol * var_name , int k )
INT_METHOD_TYPE ( DECLARE_VARIABLE_MTID , code_generator * generator , code_generation * gen , inter_tree_node * P , inter_symbol * var_name , int k , int of )
+VOID_METHOD_TYPE ( DECLARE_VARIABLES_MTID , code_generator * generator , code_generation * gen , linked_list * L )
VOID_METHOD_TYPE ( DECLARE_LOCAL_VARIABLE_MTID , code_generator * generator , code_generation * gen , inter_tree_node * P , inter_symbol * var_name )
VOID_METHOD_TYPE ( EVALUATE_VARIABLE_MTID , code_generator * generator , code_generation * gen , inter_symbol * var_name , int as_reference )
-int Generators::prepare_variable ( code_generation * gen , inter_tree_node * P , inter_symbol * var_name , int k ) {
+int Generators::prepare_variable ( code_generation * gen , inter_tree_node * P , inter_symbol * var_name , int k ) {
int rv = 0 ;
INT_METHOD_CALL ( rv , gen -> generator , PREPARE_VARIABLE_MTID , gen , P , var_name , k );
return rv ;
}
-int Generators::declare_variable ( code_generation * gen , inter_tree_node * P , inter_symbol * var_name , int k , int of ) {
+int Generators::declare_variable ( code_generation * gen , inter_tree_node * P , inter_symbol * var_name , int k , int of ) {
int rv = 0 ;
INT_METHOD_CALL ( rv , gen -> generator , DECLARE_VARIABLE_MTID , gen , P , var_name , k , of );
return rv ;
}
-void Generators::evaluate_variable ( code_generation * gen , inter_symbol * var_name , int as_reference ) {
+void Generators::declare_variables ( code_generation * gen , linked_list * L ) {
+ VOID_METHOD_CALL ( gen -> generator , DECLARE_VARIABLES_MTID , gen , L );
+}
+void Generators::evaluate_variable ( code_generation * gen , inter_symbol * var_name , int as_reference ) {
VOID_METHOD_CALL ( gen -> generator , EVALUATE_VARIABLE_MTID , gen , var_name , as_reference );
}
-
+
+
+enum PSEUDO_OBJECT_MTID
+
+
+VOID_METHOD_TYPE ( PSEUDO_OBJECT_MTID , code_generator * generator , code_generation * gen , text_stream * obj_name )
+void Generators::pseudo_object ( code_generation * gen , text_stream * obj_name ) {
+ VOID_METHOD_CALL ( gen -> generator , PSEUDO_OBJECT_MTID , gen , obj_name );
+}
+
+
enum DECLARE_CLASS_MTID
enum END_CLASS_MTID
@@ -334,47 +386,47 @@ I6 code. Still, all pragmas are offered to all generators.
VOID_METHOD_TYPE ( DECLARE_CLASS_MTID , code_generator * generator , code_generation * gen , text_stream * class_name , text_stream * printed_name , text_stream * super_class )
VOID_METHOD_TYPE ( END_CLASS_MTID , code_generator * generator , code_generation * gen , text_stream * class_name )
-void Generators::declare_class ( code_generation * gen , text_stream * class_name , text_stream * printed_name , text_stream * super_class ) {
+void Generators::declare_class ( code_generation * gen , text_stream * class_name , text_stream * printed_name , text_stream * super_class ) {
VOID_METHOD_CALL ( gen -> generator , DECLARE_CLASS_MTID , gen , class_name , printed_name , super_class );
}
-void Generators::end_class ( code_generation * gen , text_stream * class_name ) {
+void Generators::end_class ( code_generation * gen , text_stream * class_name ) {
VOID_METHOD_CALL ( gen -> generator , END_CLASS_MTID , gen , class_name );
}
VOID_METHOD_TYPE ( DECLARE_INSTANCE_MTID , code_generator * generator , code_generation * gen , text_stream * class_name , text_stream * instance_name , text_stream * printed_name , int acount , int is_dir )
VOID_METHOD_TYPE ( END_INSTANCE_MTID , code_generator * generator , code_generation * gen , text_stream * class_name , text_stream * instance_name )
-void Generators::declare_instance ( code_generation * gen , text_stream * class_name , text_stream * instance_name , text_stream * printed_name , int acount , int is_dir ) {
+void Generators::declare_instance ( code_generation * gen , text_stream * class_name , text_stream * instance_name , text_stream * printed_name , int acount , int is_dir ) {
VOID_METHOD_CALL ( gen -> generator , DECLARE_INSTANCE_MTID , gen , class_name , instance_name , printed_name , acount , is_dir );
}
-void Generators::end_instance ( code_generation * gen , text_stream * class_name , text_stream * instance_name ) {
+void Generators::end_instance ( code_generation * gen , text_stream * class_name , text_stream * instance_name ) {
VOID_METHOD_CALL ( gen -> generator , END_INSTANCE_MTID , gen , class_name , instance_name );
}
VOID_METHOD_TYPE ( DECLARE_VALUE_INSTANCE_MTID , code_generator * generator , code_generation * gen , text_stream * instance_name , text_stream * printed_name , text_stream * val )
-void Generators::declare_value_instance ( code_generation * gen , text_stream * instance_name , text_stream * printed_name , text_stream * val ) {
+void Generators::declare_value_instance ( code_generation * gen , text_stream * instance_name , text_stream * printed_name , text_stream * val ) {
VOID_METHOD_CALL ( gen -> generator , DECLARE_VALUE_INSTANCE_MTID , gen , instance_name , printed_name , val );
}
INT_METHOD_TYPE ( OPTIMISE_PROPERTY_MTID , code_generator * generator , code_generation * gen , inter_symbol * prop_name , inter_tree_node * X )
-int Generators::optimise_property_value ( code_generation * gen , inter_symbol * prop_name , inter_tree_node * X ) {
+int Generators::optimise_property_value ( code_generation * gen , inter_symbol * prop_name , inter_tree_node * X ) {
int rv = FALSE ;
INT_METHOD_CALL ( rv , gen -> generator , OPTIMISE_PROPERTY_MTID , gen , prop_name , X );
return rv ;
}
VOID_METHOD_TYPE ( ASSIGN_PROPERTY_MTID , code_generator * generator , code_generation * gen , text_stream * property_name , text_stream * val , int as_att )
-void Generators::assign_property ( code_generation * gen , text_stream * property_name , text_stream * val , int as_att ) {
+void Generators::assign_property ( code_generation * gen , text_stream * property_name , text_stream * val , int as_att ) {
VOID_METHOD_CALL ( gen -> generator , ASSIGN_PROPERTY_MTID , gen , property_name , val , as_att );
}
-void Generators::assign_mangled_property ( code_generation * gen , text_stream * property_name , text_stream * val , int as_att ) {
+void Generators::assign_mangled_property ( code_generation * gen , text_stream * property_name , text_stream * val , int as_att ) {
TEMPORARY_TEXT ( mangled )
- Generators::mangle ( gen , mangled , val );
- Generators::assign_property ( gen , property_name , mangled , as_att );
+ Generators::mangle ( gen , mangled , val );
+ Generators::assign_property ( gen , property_name , mangled , as_att );
DISCARD_TEXT ( mangled )
}
VOID_METHOD_TYPE ( PROPERTY_OFFSET_MTID , code_generator * generator , code_generation * gen , text_stream * property_name , int pos , int as_att )
-void Generators::property_offset ( code_generation * gen , text_stream * property_name , int pos , int as_att ) {
+void Generators::property_offset ( code_generation * gen , text_stream * property_name , int pos , int as_att ) {
VOID_METHOD_CALL ( gen -> generator , PROPERTY_OFFSET_MTID , gen , property_name , pos , as_att );
}
-
+
enum BEGIN_CONSTANT_MTID
enum END_CONSTANT_MTID
@@ -382,66 +434,36 @@ I6 code. Still, all pragmas are offered to all generators.
INT_METHOD_TYPE ( BEGIN_CONSTANT_MTID , code_generator * generator , code_generation * gen , text_stream * const_name , inter_symbol * const_s , inter_tree_node * P , int continues , int ifndef_me )
VOID_METHOD_TYPE ( END_CONSTANT_MTID , code_generator * generator , code_generation * gen , text_stream * const_name , int ifndef_me )
-int Generators::begin_constant ( code_generation * gen , text_stream * const_name , inter_symbol * const_s , inter_tree_node * P , int continues , int ifndef_me ) {
+int Generators::begin_constant ( code_generation * gen , text_stream * const_name , inter_symbol * const_s , inter_tree_node * P , int continues , int ifndef_me ) {
int rv = FALSE ;
INT_METHOD_CALL ( rv , gen -> generator , BEGIN_CONSTANT_MTID , gen , const_name , const_s , P , continues , ifndef_me );
return rv ;
}
-void Generators::end_constant ( code_generation * gen , text_stream * const_name , int ifndef_me ) {
+void Generators::end_constant ( code_generation * gen , text_stream * const_name , int ifndef_me ) {
VOID_METHOD_CALL ( gen -> generator , END_CONSTANT_MTID , gen , const_name , ifndef_me );
}
-
+
enum PREDECLARE_FUNCTION_MTID
enum DECLARE_FUNCTION_MTID
enum BEGIN_FUNCTION_CODE_MTID
-enum PLACE_LABEL_MTID
enum END_FUNCTION_MTID
VOID_METHOD_TYPE ( PREDECLARE_FUNCTION_MTID , code_generator * generator , code_generation * gen , inter_symbol * fn , inter_tree_node * code )
VOID_METHOD_TYPE ( DECLARE_FUNCTION_MTID , code_generator * generator , code_generation * gen , inter_symbol * fn , inter_tree_node * code )
-VOID_METHOD_TYPE ( PLACE_LABEL_MTID , code_generator * generator , code_generation * gen , text_stream * label_name )
VOID_METHOD_TYPE ( END_FUNCTION_MTID , code_generator * generator , int pass , code_generation * gen , inter_symbol * fn )
-void Generators::predeclare_function ( code_generation * gen , inter_symbol * fn , inter_tree_node * code ) {
+void Generators::predeclare_function ( code_generation * gen , inter_symbol * fn , inter_tree_node * code ) {
VOID_METHOD_CALL ( gen -> generator , PREDECLARE_FUNCTION_MTID , gen , fn , code );
}
-void Generators::declare_function ( code_generation * gen , inter_symbol * fn , inter_tree_node * code ) {
+void Generators::declare_function ( code_generation * gen , inter_symbol * fn , inter_tree_node * code ) {
VOID_METHOD_CALL ( gen -> generator , DECLARE_FUNCTION_MTID , gen , fn , code );
}
-void Generators::place_label ( code_generation * gen , text_stream * label_name ) {
- VOID_METHOD_CALL ( gen -> generator , PLACE_LABEL_MTID , gen , label_name );
-}
void Generators::end_function ( int pass , code_generation * gen , inter_symbol * fn ) {
VOID_METHOD_CALL ( gen -> generator , END_FUNCTION_MTID , pass , gen , fn );
}
-
-
-enum FUNCTION_CALL_MTID
-
-
-VOID_METHOD_TYPE ( FUNCTION_CALL_MTID , code_generator * generator , code_generation * gen , inter_symbol * fn , inter_tree_node * P , int argc )
-void Generators::function_call ( code_generation * gen , inter_symbol * fn , inter_tree_node * P , int argc ) {
- VOID_METHOD_CALL ( gen -> generator , FUNCTION_CALL_MTID , gen , fn , P , argc );
-}
-
-
-
-enum ASSEMBLY_MTID
-
-
-VOID_METHOD_TYPE ( ASSEMBLY_MTID , code_generator * generator , code_generation * gen ,
- text_stream * opcode , int operand_count , inter_tree_node ** operands ,
- inter_tree_node * label , int label_sense )
-
-void Generators::assembly ( code_generation * gen , text_stream * opcode , int operand_count ,
- inter_tree_node ** operands , inter_tree_node * label , int label_sense ) {
- VOID_METHOD_CALL ( gen -> generator , ASSEMBLY_MTID , gen , opcode , operand_count ,
- operands , label , label_sense );
-}
-
enum BEGIN_ARRAY_MTID
@@ -460,28 +482,28 @@ I6 code. Still, all pragmas are offered to all generators.
VOID_METHOD_TYPE ( ARRAY_ENTRIES_MTID , code_generator * generator , code_generation * gen , int how_many , int plus_ips , int format )
VOID_METHOD_TYPE ( COMPILE_LITERAL_SYMBOL_MTID , code_generator * generator , code_generation * gen , inter_symbol * aliased , int unsub )
VOID_METHOD_TYPE ( END_ARRAY_MTID , code_generator * generator , code_generation * gen , int format )
-int Generators::begin_array ( code_generation * gen , text_stream * const_name , inter_symbol * array_s , inter_tree_node * P , int format ) {
+int Generators::begin_array ( code_generation * gen , text_stream * const_name , inter_symbol * array_s , inter_tree_node * P , int format ) {
int rv = FALSE ;
INT_METHOD_CALL ( rv , gen -> generator , BEGIN_ARRAY_MTID , gen , const_name , array_s , P , format );
return rv ;
}
-void Generators::array_entry ( code_generation * gen , text_stream * entry , int format ) {
+void Generators::array_entry ( code_generation * gen , text_stream * entry , int format ) {
VOID_METHOD_CALL ( gen -> generator , ARRAY_ENTRY_MTID , gen , entry , format );
}
-void Generators::array_entries ( code_generation * gen , int how_many , int plus_ips , int format ) {
+void Generators::array_entries ( code_generation * gen , int how_many , int plus_ips , int format ) {
VOID_METHOD_CALL ( gen -> generator , ARRAY_ENTRIES_MTID , gen , how_many , plus_ips , format );
}
-void Generators::mangled_array_entry ( code_generation * gen , text_stream * entry , int format ) {
+void Generators::mangled_array_entry ( code_generation * gen , text_stream * entry , int format ) {
TEMPORARY_TEXT ( mangled )
- Generators::mangle ( gen , mangled , entry );
+ Generators::mangle ( gen , mangled , entry );
VOID_METHOD_CALL ( gen -> generator , ARRAY_ENTRY_MTID , gen , mangled , format );
DISCARD_TEXT ( mangled )
}
-void Generators::compile_literal_symbol ( code_generation * gen , inter_symbol * aliased , int unsub ) {
+void Generators::compile_literal_symbol ( code_generation * gen , inter_symbol * aliased , int unsub ) {
VOID_METHOD_CALL ( gen -> generator , COMPILE_LITERAL_SYMBOL_MTID , gen , aliased , unsub );
}
-void Generators::end_array ( code_generation * gen , int format ) {
+void Generators::end_array ( code_generation * gen , int format ) {
VOID_METHOD_CALL ( gen -> generator , END_ARRAY_MTID , gen , format );
}
@@ -491,7 +513,7 @@ I6 code. Still, all pragmas are offered to all generators.
VOID_METHOD_TYPE ( WORLD_MODEL_ESSENTIALS_MTID , code_generator * generator , code_generation * gen )
-void Generators::world_model_essentials ( code_generation * gen ) {
+void Generators::world_model_essentials ( code_generation * gen ) {
VOID_METHOD_CALL ( gen -> generator , WORLD_MODEL_ESSENTIALS_MTID , gen );
}
@@ -506,7 +528,7 @@ I6 code. Still, all pragmas are offered to all generators.
}
+
diff --git a/docs/final-module/2-tvg.html b/docs/final-module/2-tvg.html
index 7b96835e8..d18985151 100644
--- a/docs/final-module/2-tvg.html
+++ b/docs/final-module/2-tvg.html
@@ -87,9 +87,10 @@ be sent
-
- InterTree::traverse ( gen -> from , Vanilla::predeclare_functions , gen , NULL , - PACKAGE_IST );
+ gen -> global_variables = NEW_LINKED_LIST ( inter_symbol );
+ InterTree::traverse ( gen -> from , Vanilla::gather_variables , gen , NULL , VARIABLE_IST );
+ Generators::declare_variables ( gen , gen -> global_variables );
-
+
+
+void Vanilla::gather_variables ( inter_tree * I , inter_tree_node * P , void * state ) {
+ code_generation * gen = ( code_generation *) state ;
+ inter_symbol * var_name = InterSymbolsTables::symbol_from_frame_data ( P , DEFN_VAR_IFLD );
+ ADD_TO_LINKED_LIST ( var_name , inter_symbol , gen -> global_variables );
+}
+
+
+
+
+ InterTree::traverse ( gen -> from , Vanilla::predeclare_functions , gen , NULL , - PACKAGE_IST );
+
+
+
-void Vanilla::predeclare_functions ( inter_tree * I , inter_tree_node * P , void * state ) {
+void Vanilla::predeclare_functions ( inter_tree * I , inter_tree_node * P , void * state ) {
code_generation * gen = ( code_generation *) state ;
inter_package * outer = Inter::Packages::container ( P );
if (( outer == NULL ) || ( Inter::Packages::is_codelike ( outer ) == FALSE )) {
generated_segment * saved =
- CodeGen::select ( gen , Generators::general_segment ( gen , P ));
+ CodeGen::select ( gen , Generators::general_segment ( gen , P ));
switch ( P -> W . data [ ID_IFLD ]) {
case CONSTANT_IST: {
inter_symbol * con_name =
@@ -147,7 +165,7 @@ and then this will do nothing.
if ( Inter::Constant::is_routine ( con_name )) {
inter_package * code_block = Inter::Constant::code_block ( con_name );
inter_tree_node * D = Inter::Packages::definition ( code_block );
- Generators::predeclare_function ( gen , con_name , D );
+ Generators::predeclare_function ( gen , con_name , D );
return ;
}
break ;
@@ -157,23 +175,23 @@ and then this will do nothing.
}
}
-
- InterTree::traverse ( gen -> from , Vanilla::iterate , gen , NULL , - PACKAGE_IST );
+ InterTree::traverse ( gen -> from , Vanilla::iterate , gen , NULL , - PACKAGE_IST );
-
-void Vanilla::iterate ( inter_tree * I , inter_tree_node * P , void * state ) {
+void Vanilla::iterate ( inter_tree * I , inter_tree_node * P , void * state ) {
code_generation * gen = ( code_generation *) state ;
inter_package * outer = Inter::Packages::container ( P );
if (( outer == NULL ) || ( Inter::Packages::is_codelike ( outer ) == FALSE )) {
- generated_segment * saved = CodeGen::select ( gen , Generators::general_segment ( gen , P ));
+ generated_segment * saved = CodeGen::select ( gen , Generators::general_segment ( gen , P ));
switch ( P -> W . data [ ID_IFLD ]) {
case CONSTANT_IST:
case INSTANCE_IST:
@@ -187,11 +205,10 @@ functions, and calls Vanilla::node
}
}
-
- VanillaVariables::consolidate ( gen );
VanillaConstants::consolidate ( gen );
VanillaObjects::consolidate ( gen );
@@ -220,12 +237,11 @@ well the entire tree by the end.
define VNODE_ALLC LOOP_THROUGH_INTER_CHILDREN ( C , P ) Vanilla::node ( gen , C )
-void Vanilla::node ( code_generation * gen , inter_tree_node * P ) {
+void Vanilla::node ( code_generation * gen , inter_tree_node * P ) {
switch ( P -> W . data [ ID_IFLD ]) {
case CONSTANT_IST: VanillaConstants::constant ( gen , P ); break ;
- case VARIABLE_IST: VanillaVariables::variable ( gen , P ); break ;
case INSTANCE_IST: VanillaObjects::instance ( gen , P ); break ;
- case SPLAT_IST: VanillaCode::splat ( gen , P ); break ;
+ case PROPERTYVALUE_IST: VanillaObjects::propertyvalue ( gen , P ); break ;
case LABEL_IST: VanillaCode::label ( gen , P ); break ;
case CODE_IST: VanillaCode::code ( gen , P ); break ;
case EVALUATION_IST: VanillaCode::evaluation ( gen , P ); break ;
@@ -233,11 +249,12 @@ well the entire tree by the end.
case PACKAGE_IST: VanillaCode::block ( gen , P ); break ;
case INV_IST: VanillaCode::inv ( gen , P ); break ;
case CAST_IST: VanillaCode::cast ( gen , P ); break ;
- case VAL_IST: VanillaCode::val_or_ref ( gen , P , FALSE ); break ;
- case REF_IST: VanillaCode::val_or_ref ( gen , P , TRUE ); break ;
- case LAB_IST: VanillaCode::lab ( gen , P ); break ;
- case PROPERTYVALUE_IST: VanillaObjects::propertyvalue ( gen , P ); break ;
+ case VAL_IST: VanillaCode::val_or_ref ( gen , P , FALSE ); break ;
+ case REF_IST: VanillaCode::val_or_ref ( gen , P , TRUE ); break ;
+ case LAB_IST: VanillaCode::lab ( gen , P ); break ;
+ case SPLAT_IST: Vanilla::splat ( gen , P ); break ;
+ case VARIABLE_IST: break ;
case SYMBOL_IST: break ;
case LOCAL_IST: break ;
case NOP_IST: break ;
@@ -249,8 +266,44 @@ well the entire tree by the end.
}
}
+
+
+
+
+define URL_SYMBOL_CHAR 0x00A7
+
+
+void Vanilla::splat ( code_generation * gen , inter_tree_node * P ) {
+ text_stream * OUT = CodeGen::current ( gen );
+ inter_tree * I = gen -> from ;
+ text_stream * S =
+ Inter::Warehouse::get_text ( InterTree::warehouse ( I ), P -> W . data [ MATTER_SPLAT_IFLD ]);
+ int L = Str::len ( S );
+ for ( int i =0; i < L ; i ++) {
+ wchar_t c = Str::get_at ( S , i );
+ if ( c == URL_SYMBOL_CHAR ) {
+ TEMPORARY_TEXT ( T )
+ for ( i ++; i < L ; i ++) {
+ wchar_t c = Str::get_at ( S , i );
+ if ( c == URL_SYMBOL_CHAR ) break ;
+ PUT_TO ( T , c );
+ }
+ inter_symbol * symb = InterSymbolsTables::url_name_to_symbol ( I , NULL , T );
+ WRITE ( "%S" , CodeGen::name ( symb ));
+ DISCARD_TEXT ( T )
+ } else PUT ( c );
+ }
+}
+
+
diff --git a/docs/final-module/2-vc.html b/docs/final-module/2-vc.html
index e25d9bee0..e81105736 100644
--- a/docs/final-module/2-vc.html
+++ b/docs/final-module/2-vc.html
@@ -98,26 +98,7 @@ function togglePopup(material_id) {
}
}
-int the_quartet_found = FALSE ;
-int box_mode = FALSE , printing_mode = FALSE ;
-
void VanillaConstants::prepare ( code_generation * gen ) {
- the_quartet_found = FALSE ;
- box_mode = FALSE ; printing_mode = FALSE ;
- InterTree::traverse ( gen -> from , VanillaConstants::quartet_visitor , NULL , NULL , CONSTANT_IST );
-}
-
-void VanillaConstants::quartet_visitor ( inter_tree * I , inter_tree_node * P , void * state ) {
- inter_symbol * con_name = InterSymbolsTables::symbol_from_frame_data ( P , DEFN_CONST_IFLD );
- if (( Str::eq ( con_name -> symbol_name , I "thedark" )) ||
- ( Str::eq ( con_name -> symbol_name , I "InformLibrary" )) ||
- ( Str::eq ( con_name -> symbol_name , I "InformParser" )) ||
- ( Str::eq ( con_name -> symbol_name , I "Compass" )))
- the_quartet_found = TRUE ;
-}
-
-int VanillaConstants::quartet_present ( void ) {
- return the_quartet_found ;
}
-void VanillaConstants::constant_inner ( code_generation * gen , inter_tree_node * P ) {
+void VanillaConstants::constant_inner ( code_generation * gen , inter_tree_node * P ) {
text_stream * OUT = CodeGen::current ( gen );
inter_symbol * con_name = InterSymbolsTables::symbol_from_frame_data ( P , DEFN_CONST_IFLD );
@@ -166,7 +147,9 @@ is 20. We instead compile this as
( Str::eq ( con_name -> symbol_name , I "cap_short_name" )))
ifndef_me = TRUE ;
- if ( Inter::Symbols::read_annotation ( con_name , OBJECT_IANN ) > 0 ) return ;
+ if ( Inter::Symbols::read_annotation ( con_name , OBJECT_IANN ) > 0 ) {
+ return ;
+ }
if ( Str::eq ( con_name -> symbol_name , I "UUID_ARRAY" )) {
inter_ti ID = P -> W . data [ DATA_CONST_IFLD ];
@@ -201,9 +184,9 @@ is 20. We instead compile this as
case CONSTANT_INDIRECT_TEXT: {
inter_ti ID = P->W.data[DATA_CONST_IFLD];
text_stream *S = Inode::ID_to_text(P, ID);
- if (Generators::begin_constant(gen, VanillaConstants::name(con_name), con_name, P, TRUE, FALSE)) {
+ if (Generators::begin_constant(gen, CodeGen::name(con_name), con_name, P, TRUE, FALSE)) {
Generators::compile_literal_text(gen, S, FALSE, FALSE, FALSE);
- Generators::end_constant(gen, VanillaConstants::name(con_name), FALSE);
+ Generators::end_constant(gen, CodeGen::name(con_name), FALSE);
}
break;
}
@@ -219,7 +202,7 @@ is 20. We instead compile this as
}
if (Inter::Symbols::read_annotation(con_name, BUFFERARRAY_IANN) == 1)
format = BUFFER_ARRAY_FORMAT;
- if (Generators::begin_array(gen, VanillaConstants::name(con_name), con_name, P, format)) {
+ if (Generators::begin_array(gen, CodeGen::name(con_name), con_name, P, format)) {
if (hang_one) Generators::array_entry(gen, I" 1 ", format);
int entry_count = 0;
for (int i=DATA_CONST_IFLD; i<P->W.extent; i=i+2)
@@ -232,7 +215,7 @@ is 20. We instead compile this as
e = VanillaConstants::evaluate(gen, Inter::Packages::scope_of(P), val1, val2, &ips);
}
if (e > 1) {
- LOG(" Entry count 1 on % S masks % d blanks \ n ", VanillaConstants::name(con_name), e);
+ LOG(" Entry count 1 on % S masks % d blanks \ n ", CodeGen::name(con_name), e);
Generators::array_entries(gen, (int) e, ips, format);
} else {
for (int i=DATA_CONST_IFLD; i<P->W.extent; i=i+2) {
@@ -263,7 +246,7 @@ is 20. We instead compile this as
}
generated_segment *saved = CodeGen::select(gen, Generators::basic_constant_segment(gen, con_name, depth));
text_stream *OUT = CodeGen::current(gen);
- if (Generators::begin_constant(gen, VanillaConstants::name(con_name), con_name, P, TRUE, FALSE)) {
+ if (Generators::begin_constant(gen, CodeGen::name(con_name), con_name, P, TRUE, FALSE)) {
WRITE(" ( ");
for (int i=DATA_CONST_IFLD; i<P->W.extent; i=i+2) {
if (i>DATA_CONST_IFLD) {
@@ -279,7 +262,7 @@ is 20. We instead compile this as
if (bracket) WRITE(" ) ");
}
WRITE(" ) ");
- Generators::end_constant(gen, VanillaConstants::name(con_name), FALSE);
+ Generators::end_constant(gen, CodeGen::name(con_name), FALSE);
}
CodeGen::deselect(gen, saved);
break;
@@ -289,11 +272,11 @@ is 20. We instead compile this as
if (depth > 1) LOGIF(CONSTANT_DEPTH_CALCULATION,
" Con % S has depth % d \ n ", con_name->symbol_name, depth);
generated_segment *saved = CodeGen::select(gen, Generators::basic_constant_segment(gen, con_name, depth));
- if (Generators::begin_constant(gen, VanillaConstants::name(con_name), con_name, P, TRUE, ifndef_me)) {
+ if (Generators::begin_constant(gen, CodeGen::name(con_name), con_name, P, TRUE, ifndef_me)) {
inter_ti val1 = P->W.data[DATA_CONST_IFLD];
inter_ti val2 = P->W.data[DATA_CONST_IFLD + 1];
VanillaConstants::literal(gen, con_name, Inter::Packages::scope_of(P), val1, val2, FALSE);
- Generators::end_constant(gen, VanillaConstants::name(con_name), ifndef_me);
+ Generators::end_constant(gen, CodeGen::name(con_name), ifndef_me);
}
CodeGen::deselect(gen, saved);
break;
@@ -350,7 +333,7 @@ is 20. We instead compile this as
inter_symbol *symb = InterSymbolsTables::symbol_from_data_pair_and_table(
val1, val2, Inter::Bookmarks::scope(IBM));
if (symb == NULL) internal_error(" bad symbol ");
- Generators::mangle(gen, OUT, VanillaConstants::name(symb));
+ Generators::mangle(gen, OUT, CodeGen::name(symb));
} else {
switch (val1) {
case UNDEF_IVAL:
@@ -408,20 +391,20 @@ is 20. We instead compile this as
}
}
-void VanillaConstants::enter_box_mode(void) {
- box_mode = TRUE;
+void VanillaConstants::enter_box_mode(code_generation *gen) {
+ gen->literal_text_mode = 1;
}
-void VanillaConstants::exit_box_mode(void) {
- box_mode = FALSE;
+void VanillaConstants::exit_box_mode(code_generation *gen) {
+ gen->literal_text_mode = 0;
}
-void VanillaConstants::enter_print_mode(void) {
- printing_mode = TRUE;
+void VanillaConstants::enter_print_mode(code_generation *gen) {
+ gen->literal_text_mode = 2;
}
-void VanillaConstants::exit_print_mode(void) {
- printing_mode = FALSE;
+void VanillaConstants::exit_print_mode(code_generation *gen) {
+ gen->literal_text_mode = 0;
}
inter_ti VanillaConstants::evaluate(code_generation *gen, inter_symbols_table *T, inter_ti val1, inter_ti val2, int *ips) {
@@ -437,7 +420,7 @@ is 20. We instead compile this as
inter_ti dval2 = D->W.data[DATA_CONST_IFLD + 1];
inter_ti e = VanillaConstants::evaluate(gen, Inter::Packages::scope_of(D), dval1, dval2, ips);
if (e == 0) {
- text_stream *S = VanillaConstants::name(aliased);
+ text_stream *S = CodeGen::name(aliased);
if (Str::eq(S, I" INDIV_PROP_START ")) *ips = TRUE;
}
LOG(" Eval const $3 = % d \ n ", aliased, e);
@@ -465,6 +448,11 @@ is 20. We instead compile this as
return 0;
}
+void VanillaConstants::nonliteral(code_generation *gen, inter_symbol *con_name) {
+ text_stream *OUT = CodeGen::current(gen);
+ Generators::mangle(gen, OUT, CodeGen::name(con_name));
+}
+
void VanillaConstants::literal(code_generation *gen, inter_symbol *con_name, inter_symbols_table *T, inter_ti val1, inter_ti val2, int unsub) {
inter_tree *I = gen->from;
text_stream *OUT = CodeGen::current(gen);
@@ -490,24 +478,19 @@ is 20. We instead compile this as
Generators::compile_dictionary_word(gen, glob_text, TRUE);
} else if (val1 == LITERAL_TEXT_IVAL) {
text_stream *glob_text = Inter::Warehouse::get_text(InterTree::warehouse(I), val2);
- Generators::compile_literal_text(gen, glob_text, printing_mode, box_mode, TRUE);
+ Generators::compile_literal_text(gen, glob_text, (gen->literal_text_mode == 2)?TRUE:FALSE,
+ (gen->literal_text_mode == 1)?TRUE:FALSE, TRUE);
} else if (val1 == GLOB_IVAL) {
text_stream *glob_text = Inter::Warehouse::get_text(InterTree::warehouse(I), val2);
WRITE(" % S ", glob_text);
} else internal_error(" unimplemented direct constant ");
}
-
-text_stream *VanillaConstants::name(inter_symbol *symb) {
- if (symb == NULL) return NULL;
- if (Inter::Symbols::get_translate(symb)) return Inter::Symbols::get_translate(symb);
- return symb->symbol_name;
-}
-The function VanillaConstants::constant_depth appears nowhere else. The function VanillaConstants::constant_depth_inner appears nowhere else. The function VanillaConstants::val_to_text is used in Code Generation (§3 ). The function VanillaConstants::literal_text_at is used in §1 . The function VanillaConstants::compare_tlh appears nowhere else. The function VanillaConstants::consolidate is used in The Vanilla Generator (§1.8 ). The function VanillaConstants::enter_box_mode is used in Generating Inform 6 (§3 ), C Input-Output Model (§2 ). The function VanillaConstants::exit_box_mode is used in Generating Inform 6 (§3 ), C Input-Output Model (§2 ). The function VanillaConstants::enter_print_mode is used in Generating Inform 6 (§3 ), C Input-Output Model (§2 ). The function VanillaConstants::exit_print_mode is used in Generating Inform 6 (§3 ), C Input-Output Model (§2 ). The function VanillaConstants::evaluate appears nowhere else. The function VanillaConstants::literal is used in Vanilla Objects (§5.8.5.1.1 , §8 ), Vanilla Code (§2 ), Generating Inform 6 (§8 , §9 ), C Global Variables (§2 ). The function VanillaConstants::name is used in Vanilla Objects (§4.5 , §4.6 , §5.5 , §5.7 , §5.8.4 , §5.9 , §5.11 , §5.11.2 , §5.11.2.1 , §5.11.2.2 , §6 , §8 ), Vanilla Code (§2 ), Generating Inform 6 (§7 , §8 , §9 ), Final C (§5 ), C Global Variables (§2 ), C Memory Model (§12 ), C Object Model (§6 ), C Function Model (§1 ), C Literals (§2 ). The structure text_literal_holder is private to this section.
+The function VanillaConstants::constant_depth appears nowhere else. The function VanillaConstants::constant_depth_inner appears nowhere else. The function VanillaConstants::val_to_text is used in Code Generation (§3 ). The function VanillaConstants::literal_text_at is used in §1 . The function VanillaConstants::compare_tlh appears nowhere else. The function VanillaConstants::consolidate is used in The Vanilla Generator (§1.10 ). The function VanillaConstants::enter_box_mode is used in Generating Inform 6 (§3 ), C Input-Output Model (§2 ). The function VanillaConstants::exit_box_mode is used in Generating Inform 6 (§3 ), C Input-Output Model (§2 ). The function VanillaConstants::enter_print_mode is used in Generating Inform 6 (§3 ), C Input-Output Model (§2 ). The function VanillaConstants::exit_print_mode is used in Generating Inform 6 (§3 ), C Input-Output Model (§2 ). The function VanillaConstants::evaluate appears nowhere else. The function VanillaConstants::nonliteral is used in Vanilla Code (§4 ). The function VanillaConstants::literal is used in Vanilla Objects (§5.8.5.1.1 , §8 ), Vanilla Code (§4 ), Generating Inform 6 (§8 , §9 ), C Global Variables (§2 ). The structure text_literal_holder is private to this section.
-int VanillaConstants::node_is_ref_to ( inter_tree * I , inter_tree_node * P , inter_ti seek_bip ) {
+int VanillaConstants::node_is_ref_to ( inter_tree * I , inter_tree_node * P , inter_ti seek_bip ) {
int reffed = FALSE ;
while ( P -> W . data [ ID_IFLD ] == REFERENCE_IST ) {
P = InterTree::first_child ( P );
@@ -524,7 +507,7 @@ is 20. We instead compile this as
}
+
diff --git a/docs/final-module/2-vc2.html b/docs/final-module/2-vc2.html
index 7c3954590..afb096487 100644
--- a/docs/final-module/2-vc2.html
+++ b/docs/final-module/2-vc2.html
@@ -73,7 +73,26 @@ function togglePopup(material_id) {
How the vanilla code generation strategy handles the actual code inside functions.
-
+
+
+
+ code
+ inv !printnumber
+ inv !plus
+ val K_number 12
+ val K_number 2
+ ^
+ |
+ void level
+
+
void VanillaCode::code ( code_generation * gen , inter_tree_node * P ) {
@@ -83,160 +102,164 @@ function togglePopup(material_id) {
gen -> void_level = old_level ;
}
-void VanillaCode::block ( code_generation * gen , inter_tree_node * P ) {
- VNODE_ALLC ;
-}
-
-void VanillaCode::evaluation ( code_generation * gen , inter_tree_node * P ) {
- VNODE_ALLC ;
-}
-
-void VanillaCode::reference ( code_generation * gen , inter_tree_node * P ) {
- VNODE_ALLC ;
-}
-
-void VanillaCode::cast ( code_generation * gen , inter_tree_node * P ) {
- VNODE_ALLC ;
-}
+void VanillaCode::block ( code_generation * gen , inter_tree_node * P ) { VNODE_ALLC ; }
+void VanillaCode::evaluation ( code_generation * gen , inter_tree_node * P ) { VNODE_ALLC ; }
+void VanillaCode::reference ( code_generation * gen , inter_tree_node * P ) { VNODE_ALLC ; }
+void VanillaCode::cast ( code_generation * gen , inter_tree_node * P ) { VNODE_ALLC ; }
-
+
-define URL_SYMBOL_CHAR 0x00A7
-
-void VanillaCode::splat ( code_generation * gen , inter_tree_node * P ) {
- text_stream * OUT = CodeGen::current ( gen );
- inter_tree * I = gen -> from ;
- text_stream * S = Inter::Warehouse::get_text ( InterTree::warehouse ( I ), P -> W . data [ MATTER_SPLAT_IFLD ]);
- int L = Str::len ( S );
- for ( int i =0; i < L ; i ++) {
- wchar_t c = Str::get_at ( S , i );
- if ( c == URL_SYMBOL_CHAR ) {
- TEMPORARY_TEXT ( T )
- for ( i ++; i < L ; i ++) {
- wchar_t c = Str::get_at ( S , i );
- if ( c == URL_SYMBOL_CHAR ) break ;
- PUT_TO ( T , c );
- }
- inter_symbol * symb = InterSymbolsTables::url_name_to_symbol ( I , NULL , T );
- WRITE ( "%S" , VanillaConstants::name ( symb ));
- DISCARD_TEXT ( T )
- } else PUT ( c );
- }
-}
-
-void VanillaCode::label ( code_generation * gen , inter_tree_node * P ) {
+void VanillaCode::label ( code_generation * gen , inter_tree_node * P ) {
inter_package * pack = Inter::Packages::container ( P );
- inter_symbol * lab_name = InterSymbolsTables::local_symbol_from_id ( pack , P -> W . data [ DEFN_LABEL_IFLD ]);
- Generators::place_label ( gen , lab_name -> symbol_name );
-}
-
-void VanillaCode::lab ( code_generation * gen , inter_tree_node * P ) {
- inter_package * pack = Inter::Packages::container ( P );
- inter_symbol * lab = InterSymbolsTables::local_symbol_from_id ( pack , P -> W . data [ LABEL_LAB_IFLD ]);
- if ( lab == NULL ) internal_error ( "bad lab" );
- text_stream * OUT = CodeGen::current ( gen );
- text_stream * S = VanillaConstants::name ( lab );
- LOOP_THROUGH_TEXT ( pos , S )
- if ( Str::get ( pos ) != '.' )
- PUT ( Str::get ( pos ));
-}
-
-void VanillaCode::val_or_ref ( code_generation * gen , inter_tree_node * P , int ref ) {
- inter_symbol * val_kind = InterSymbolsTables::symbol_from_frame_data ( P , KIND_VAL_IFLD );
- if ( val_kind ) {
- inter_ti val1 = P -> W . data [ VAL1_VAL_IFLD ];
- inter_ti val2 = P -> W . data [ VAL2_VAL_IFLD ];
- if ( Inter::Symbols::is_stored_in_data ( val1 , val2 )) {
- inter_package * pack = Inter::Packages::container ( P );
- inter_symbol * symb = InterSymbolsTables::local_symbol_from_id ( pack , val2 );
- if ( symb == NULL ) symb = InterSymbolsTables::symbol_from_id ( Inter::Packages::scope_of ( P ), val2 );
- if ( symb == NULL ) internal_error ( "bad val" );
- if (( Str::eq ( VanillaConstants::name ( symb ), I "self" )) ||
- (( symb -> definition ) &&
- ( symb -> definition -> W . data [ ID_IFLD ] == VARIABLE_IST ))) {
- Generators::evaluate_variable ( gen , symb , ( P -> W . data [ ID_IFLD ] == REF_IST )? TRUE:FALSE );
- } else {
- text_stream * OUT = CodeGen::current ( gen );
- Generators::mangle ( gen , OUT , VanillaConstants::name ( symb ));
- }
- return ;
- }
- switch ( val1 ) {
- case UNDEF_IVAL:
- internal_error ( "value undefined" );
- case LITERAL_IVAL:
- case LITERAL_TEXT_IVAL:
- case GLOB_IVAL:
- case DWORD_IVAL:
- case REAL_IVAL:
- case PDWORD_IVAL:
- VanillaConstants::literal ( gen , NULL , NULL , val1 , val2 , FALSE );
- return ;
- }
- }
- internal_error ( "bad val" );
+ inter_symbol * lab_name =
+ InterSymbolsTables::local_symbol_from_id ( pack , P -> W . data [ DEFN_LABEL_IFLD ]);
+ Generators::place_label ( gen , lab_name -> symbol_name );
}
-
+
define MAX_OPERANDS_IN_INTER_ASSEMBLY 32
-void VanillaCode::inv ( code_generation * gen , inter_tree_node * P ) {
- text_stream * OUT = CodeGen::current ( gen );
- int suppress_terminal_semicolon = FALSE ;
-
+void VanillaCode::inv ( code_generation * gen , inter_tree_node * P ) {
+ int void_context = FALSE ;
+ if ( Inter::Defn::get_level ( P ) == gen -> void_level ) void_context = TRUE ;
switch ( P -> W . data [ METHOD_INV_IFLD ]) {
- case INVOKED_PRIMITIVE: {
- inter_symbol * prim = Inter::Inv::invokee ( P );
- if ( prim == NULL ) internal_error ( "bad prim" );
- suppress_terminal_semicolon = Generators::compile_primitive ( gen , prim , P );
- break ;
- }
- case INVOKED_ROUTINE: {
- inter_symbol * routine = InterSymbolsTables::symbol_from_frame_data ( P , INVOKEE_INV_IFLD );
- if ( routine == NULL ) internal_error ( "bad routine" );
- int argc = 0 ;
- LOOP_THROUGH_INTER_CHILDREN ( F , P ) argc ++;
- Generators::function_call ( gen , routine , P , argc );
- break ;
- }
- case INVOKED_OPCODE: {
- inter_ti ID = P -> W . data [ INVOKEE_INV_IFLD ];
- text_stream * S = Inode::ID_to_text ( P , ID );
- inter_tree_node * operands [ MAX_OPERANDS_IN_INTER_ASSEMBLY ], * label = NULL ;
- int operand_count = 0 ;
- int label_sense = NOT_APPLICABLE ;
- LOOP_THROUGH_INTER_CHILDREN ( F , P ) {
- if ( F -> W . data [ ID_IFLD ] == VAL_IST ) {
- inter_ti val1 = F -> W . data [ VAL1_VAL_IFLD ];
- inter_ti val2 = F -> W . data [ VAL2_VAL_IFLD ];
- if ( Inter::Symbols::is_stored_in_data ( val1 , val2 )) {
- inter_symbol * symb = InterSymbolsTables::symbol_from_id ( Inter::Packages::scope_of ( F ), val2 );
- if (( symb ) && ( Str::eq ( symb -> symbol_name , I "__assembly_negated_label" ))) {
- label_sense = FALSE ;
- continue ;
- }
- }
- }
- if ( F -> W . data [ ID_IFLD ] == LAB_IST ) {
- if ( label_sense == NOT_APPLICABLE ) label_sense = TRUE ;
- label = F ; continue ;
- }
- operands [ operand_count ++] = F ;
- }
- Generators::assembly ( gen , S , operand_count , operands , label , label_sense );
- break ;
- }
- default: internal_error ( "bad inv" );
+ case INVOKED_PRIMITIVE: Invoke a primitive 3.1 ; break ;
+ case INVOKED_ROUTINE: Invoke a function 3.2 ; break ;
+ case INVOKED_OPCODE: Invoke an assembly-language opcode 3.3 ; break ;
+ default: internal_error ( "unknown invocation method" );
}
- if (( Inter::Defn::get_level ( P ) == gen -> void_level ) &&
- ( suppress_terminal_semicolon == FALSE )) WRITE ( ";\n" );
+}
+
+
+
+
+ inter_symbol * primitive_s = Inter::Inv::invokee ( P );
+ if ( primitive_s == NULL ) internal_error ( "no primitive" );
+ Generators::invoke_primitive ( gen , primitive_s , P , void_context );
+
+
+
+
+
+ inter_symbol * function_s = Inter::Inv::invokee ( P );
+ if ( function_s == NULL ) internal_error ( "no function" );
+ Generators::invoke_function ( gen , function_s , P , void_context );
+
+
+
+
+
+ inter_ti ID = P -> W . data [ INVOKEE_INV_IFLD ];
+ text_stream * opcode_name = Inode::ID_to_text ( P , ID );
+ inter_tree_node * operands [ MAX_OPERANDS_IN_INTER_ASSEMBLY ], * label = NULL ;
+ int operand_count = 0 ;
+ int label_sense = NOT_APPLICABLE ;
+ Scan the operands 3.3.1 ;
+ Generators::invoke_opcode ( gen , opcode_name , operand_count , operands , label ,
+ label_sense , void_context );
+
+
+
+
+
+
+
+ LOOP_THROUGH_INTER_CHILDREN ( F , P ) {
+ if ( F -> W . data [ ID_IFLD ] == VAL_IST ) {
+ inter_ti val1 = F -> W . data [ VAL1_VAL_IFLD ];
+ inter_ti val2 = F -> W . data [ VAL2_VAL_IFLD ];
+ if ( Inter::Symbols::is_stored_in_data ( val1 , val2 )) {
+ inter_symbol * symb =
+ InterSymbolsTables::symbol_from_id ( Inter::Packages::scope_of ( F ), val2 );
+ if (( symb ) && ( Str::eq ( symb -> symbol_name , I "__assembly_negated_label" ))) {
+ label_sense = FALSE ;
+ continue ;
+ }
+ }
+ }
+ if ( F -> W . data [ ID_IFLD ] == LAB_IST ) {
+ if ( label_sense == NOT_APPLICABLE ) label_sense = TRUE ;
+ label = F ; continue ;
+ }
+ if ( operand_count < MAX_OPERANDS_IN_INTER_ASSEMBLY )
+ operands [ operand_count ++] = F ;
+ }
+
+This code is used in §3.3 .
+
+
+
+
+
+void VanillaCode::val_or_ref ( code_generation * gen , inter_tree_node * P , int ref ) {
+ inter_ti val1 = P -> W . data [ VAL1_VAL_IFLD ];
+ inter_ti val2 = P -> W . data [ VAL2_VAL_IFLD ];
+ if ( Inter::Symbols::is_stored_in_data ( val1 , val2 )) {
+ inter_package * pack = Inter::Packages::container ( P );
+ inter_symbol * named_s =
+ InterSymbolsTables::local_symbol_from_id ( pack , val2 );
+ if ( named_s == NULL ) named_s =
+ InterSymbolsTables::symbol_from_id ( Inter::Packages::scope_of ( P ), val2 );
+ if ( named_s == NULL ) internal_error ( "unknown constant in val/ref in Inter tree" );
+ if (( Str::eq ( CodeGen::name ( named_s ), I "self" )) ||
+ (( named_s -> definition ) &&
+ ( named_s -> definition -> W . data [ ID_IFLD ] == VARIABLE_IST ))) {
+ Generators::evaluate_variable ( gen , named_s , ref );
+ } else {
+
+ VanillaConstants::nonliteral ( gen , named_s );
+ }
+ } else switch ( val1 ) {
+ case UNDEF_IVAL: internal_error ( "undef val/ref in Inter tree" );
+ case LITERAL_IVAL:
+ case LITERAL_TEXT_IVAL:
+ case GLOB_IVAL:
+ case DWORD_IVAL:
+ case REAL_IVAL:
+ case PDWORD_IVAL:
+ if ( ref ) internal_error ( "literal constant as ref in Inter tree" );
+ VanillaConstants::literal ( gen , NULL , NULL , val1 , val2 , FALSE );
+ break ;
+ default: internal_error ( "unknown ival field in val/ref in Inter tree" );
+ }
+}
+
+
+
+
+void VanillaCode::lab ( code_generation * gen , inter_tree_node * P ) {
+ inter_package * pack = Inter::Packages::container ( P );
+ inter_symbol * label_s =
+ InterSymbolsTables::local_symbol_from_id ( pack , P -> W . data [ LABEL_LAB_IFLD ]);
+ if ( label_s == NULL ) internal_error ( "unknown label in lab in Inter tree" );
+ Generators::evaluate_label ( gen , label_s -> symbol_name );
}
+
diff --git a/docs/final-module/2-vo.html b/docs/final-module/2-vo.html
index c4a447874..e79fcb61b 100644
--- a/docs/final-module/2-vo.html
+++ b/docs/final-module/2-vo.html
@@ -144,16 +144,22 @@ MathJax = {
VanillaObjects::consolidate ( gen );
}
-void VanillaObjects::consolidate ( code_generation * gen ) {
+void VanillaObjects::consolidate ( code_generation * gen ) {
if ( properties_written == FALSE ) {
- if ( VanillaConstants::quartet_present ())
- Generators::world_model_essentials ( gen );
- generated_segment * saved = CodeGen::select ( gen , Generators::default_segment ( gen ));
+ InterTree::traverse ( gen -> from , VanillaObjects::pseudo_object_visitor , gen , NULL , CONSTANT_IST );
+ generated_segment * saved = CodeGen::select ( gen , Generators::default_segment ( gen ));
VanillaObjects::knowledge ( gen );
CodeGen::deselect ( gen , saved );
properties_written = TRUE ;
}
}
+
+void VanillaObjects::pseudo_object_visitor ( inter_tree * I , inter_tree_node * P , void * state ) {
+ code_generation * gen = ( code_generation *) state ;
+ inter_symbol * con_name = InterSymbolsTables::symbol_from_frame_data ( P , DEFN_CONST_IFLD );
+ if ( Inter::Symbols::read_annotation ( con_name , OBJECT_IANN ) > 0 )
+ Generators::pseudo_object ( gen , CodeGen::name ( con_name ));
+}
The structure kov_value_stick is accessed in 5/com, 5/clt and here.
- generated_segment * saved = CodeGen::select ( gen , Generators::basic_constant_segment ( gen , prop_name , 1 ));
+ generated_segment * saved = CodeGen::select ( gen , Generators::basic_constant_segment ( gen , prop_name , 1 ));
if ( Inter::Symbols::read_annotation ( prop_name , ASSIMILATED_IANN ) >= 0 ) {
text_stream * A = Inter::Symbols::get_translate ( prop_name );
- if ( A == NULL ) A = VanillaConstants::name ( prop_name );
- Generators::declare_attribute ( gen , A );
+ if ( A == NULL ) A = CodeGen::name ( prop_name );
+ Generators::declare_attribute ( gen , A );
} else {
if ( translated == FALSE )
- Generators::declare_attribute ( gen , VanillaConstants::name ( prop_name ));
+ Generators::declare_attribute ( gen , CodeGen::name ( prop_name ));
}
CodeGen::deselect ( gen , saved );
@@ -401,10 +407,10 @@ compiles an I6 constant for this value.
if ( FBNA_found == FALSE ) {
FBNA_found = TRUE ;
- generated_segment * saved = CodeGen::select ( gen , Generators::constant_segment ( gen ));
- Generators::begin_constant ( gen , I "FBNA_PROP_NUMBER" , NULL , NULL , TRUE , FALSE );
- Generators::mangle ( gen , CodeGen::current ( gen ), VanillaConstants::name ( prop_name ));
- Generators::end_constant ( gen , I "FBNA_PROP_NUMBER" , FALSE );
+ generated_segment * saved = CodeGen::select ( gen , Generators::constant_segment ( gen ));
+ Generators::begin_constant ( gen , I "FBNA_PROP_NUMBER" , NULL , NULL , TRUE , FALSE );
+ Generators::mangle ( gen , CodeGen::current ( gen ), CodeGen::name ( prop_name ));
+ Generators::end_constant ( gen , I "FBNA_PROP_NUMBER" , FALSE );
CodeGen::deselect ( gen , saved );
}
@@ -418,10 +424,10 @@ above has been tried on all properties:
text_stream * OUT = CodeGen::current ( gen );
inter_tree * I = gen -> from ;
if (( FBNA_found == FALSE ) && ( properties_found )) {
- generated_segment * saved = CodeGen::select ( gen , Generators::constant_segment ( gen ));
- Generators::begin_constant ( gen , I "FBNA_PROP_NUMBER" , NULL , NULL , TRUE , FALSE );
+ generated_segment * saved = CodeGen::select ( gen , Generators::constant_segment ( gen ));
+ Generators::begin_constant ( gen , I "FBNA_PROP_NUMBER" , NULL , NULL , TRUE , FALSE );
WRITE_TO ( CodeGen::current ( gen ), "MAX_POSITIVE_NUMBER" );
- Generators::end_constant ( gen , I "FBNA_PROP_NUMBER" , FALSE );
+ Generators::end_constant ( gen , I "FBNA_PROP_NUMBER" , FALSE );
CodeGen::deselect ( gen , saved );
}
inter_symbol ** all_props_in_source_order = NULL ;
@@ -498,7 +504,7 @@ above has been tried on all properties:
inter_symbol * prop_name = InterSymbolsTables::symbol_from_frame_data ( P , DEFN_PROP_IFLD );
if (( Inter::Symbols::read_annotation ( prop_name , ASSIMILATED_IANN ) == 1 ) &&
( Inter::Symbols::read_annotation ( prop_name , ATTRIBUTE_IANN ) != 1 )) {
- Generators::declare_property ( gen , prop_name , TRUE );
+ Generators::declare_property ( gen , prop_name , TRUE );
}
}
}
@@ -573,17 +579,17 @@ bother to force them.)
if ( properties_found ) {
- Generators::declare_instance ( gen , I "Object" , I "property_numberspace_forcer" , NULL , -1, FALSE );
+ Generators::declare_instance ( gen , I "Object" , I "property_numberspace_forcer" , NULL , -1, FALSE );
for ( int p =0; p < no_properties ; p ++) {
inter_symbol * prop_name = props_in_source_order [ p ];
if ( Inter::Symbols::get_flag ( prop_name , ATTRIBUTE_MARK_BIT ) == FALSE ) {
inter_symbol * kind_name = Inter::Property::kind_of ( prop_name );
if ( kind_name == truth_state_kind_symbol ) {
- Generators::assign_property ( gen , VanillaConstants::name ( prop_name ), I "0" , FALSE );
+ Generators::assign_property ( gen , CodeGen::name ( prop_name ), I "0" , FALSE );
}
}
}
- Generators::end_instance ( gen , I "Object" , I "property_numberspace_forcer" );
+ Generators::end_instance ( gen , I "Object" , I "property_numberspace_forcer" );
}
@@ -628,7 +634,7 @@ property usage is legal.
inter_symbol * kind_name = kinds_in_source_order [ i ];
if ( VanillaObjects::is_kind_of_object ( kind_name )) {
inter_symbol * super_name = Inter::Kind::super ( kind_name );
- Generators::mangled_array_entry ( gen , VanillaConstants::name ( kind_name ), WORD_ARRAY_FORMAT );
+ Generators::mangled_array_entry ( gen , CodeGen::name ( kind_name ), WORD_ARRAY_FORMAT );
if (( super_name ) && ( super_name != object_kind_symbol )) {
TEMPORARY_TEXT ( N );
WRITE_TO ( N , "%d" , VanillaObjects::kind_of_object_count ( super_name ));
@@ -685,10 +691,10 @@ take lightly in the Z-machine. But speed and flexibility are worth more.
if ( Inter::Symbols::get_flag ( kind_name , VPH_MARK_BIT )) {
TEMPORARY_TEXT ( instance_name )
WRITE_TO ( instance_name , "VPH_%d" , w );
- Generators::declare_instance ( gen , I "VPH_Class" , instance_name , NULL , -1, FALSE );
+ Generators::declare_instance ( gen , I "VPH_Class" , instance_name , NULL , -1, FALSE );
TEMPORARY_TEXT ( N )
WRITE_TO ( N , "%d" , Inter::Kind::instance_count ( kind_name ));
- Generators::assign_property ( gen , I "value_range" , N , FALSE );
+ Generators::assign_property ( gen , I "value_range" , N , FALSE );
DISCARD_TEXT ( N )
for ( int p =0; p < no_properties ; p ++) {
inter_symbol * prop_name = props_in_source_order [ p ];
@@ -705,7 +711,7 @@ take lightly in the Z-machine. But speed and flexibility are worth more.
Work through this frame list of permissions 5.8.4 ;
}
}
- Generators::end_instance ( gen , I "VPH_Class" , instance_name );
+ Generators::end_instance ( gen , I "VPH_Class" , instance_name );
DISCARD_TEXT ( instance_name )
}
}
@@ -730,8 +736,8 @@ words, the number of instances of this kind.
- Generators::declare_class ( gen , I "VPH_Class" , NULL , I "Class" );
- Generators::end_class ( gen , I "VPH_Class" );
+ Generators::declare_class ( gen , I "VPH_Class" , NULL , I "Class" );
+ Generators::end_class ( gen , I "VPH_Class" );
This code is used in §5.8 .
for ( int e =0; e < no_properties ; e ++) {
inter_symbol * eprop_name = props_in_source_order [ e ];
- if ( Str::eq ( VanillaConstants::name ( eprop_name ), VanillaConstants::name ( prop_name ))) {
+ if ( Str::eq ( CodeGen::name ( eprop_name ), CodeGen::name ( prop_name ))) {
inter_node_list * EVL =
Inter::Warehouse::get_frame_list ( InterTree::warehouse ( I ),
Inter::Property::permissions_list ( eprop_name ));
@@ -1055,7 +1061,7 @@ linearly with the size of the source text, even though \(N\) does.
inter_symbol * owner_name =
InterSymbolsTables::symbol_from_frame_data ( X , OWNER_PERM_IFLD );
if ( owner_name == kind_name ) {
- Generators::mangled_array_entry ( gen , VanillaConstants::name ( kind_name ), WORD_ARRAY_FORMAT );
+ Generators::mangled_array_entry ( gen , CodeGen::name ( kind_name ), WORD_ARRAY_FORMAT );
pos ++;
}
}
@@ -1069,7 +1075,7 @@ linearly with the size of the source text, even though \(N\) does.
inter_symbol * owner_name =
InterSymbolsTables::symbol_from_frame_data ( X , OWNER_PERM_IFLD );
if ( owner_name == inst_name ) {
- Generators::mangled_array_entry ( gen , VanillaConstants::name ( inst_name ), WORD_ARRAY_FORMAT );
+ Generators::mangled_array_entry ( gen , CodeGen::name ( inst_name ), WORD_ARRAY_FORMAT );
pos ++;
}
}
@@ -1092,7 +1098,7 @@ linearly with the size of the source text, even though \(N\) does.
for ( int k =0; k < no_kind_frames ; k ++) {
inter_symbol * kind_name = kinds_in_source_order [ k ];
if ( Inter::Kind::super ( kind_name ) == object_kind_symbol ) {
- Generators::mangled_array_entry ( gen , VanillaConstants::name ( kind_name ), WORD_ARRAY_FORMAT );
+ Generators::mangled_array_entry ( gen , CodeGen::name ( kind_name ), WORD_ARRAY_FORMAT );
pos ++;
}
}
@@ -1108,7 +1114,7 @@ linearly with the size of the source text, even though \(N\) does.
for ( int p =0; p < no_properties ; p ++) {
inter_symbol * prop_name = props_in_source_order [ p ];
if ( Inter::Symbols::read_annotation ( prop_name , ASSIMILATED_IANN ) != 1 ) {
- Generators::declare_property ( gen , prop_name , FALSE );
+ Generators::declare_property ( gen , prop_name , FALSE );
}
}
@@ -1127,14 +1133,14 @@ linearly with the size of the source text, even though \(N\) does.
if ( val1 == UNDEF_IVAL ) defined = FALSE ;
TEMPORARY_TEXT ( val )
if ( defined ) WRITE_TO ( val , "%d" , val2 );
- generated_segment * saved = CodeGen::select ( gen , Generators::basic_constant_segment ( gen , inst_name , 1 ));
+ generated_segment * saved = CodeGen::select ( gen , Generators::basic_constant_segment ( gen , inst_name , 1 ));
text_stream * OUT = CodeGen::current ( gen );
- if ( Generators::begin_constant ( gen , VanillaConstants::name ( inst_name ), inst_name , P , defined , FALSE )) {
+ if ( Generators::begin_constant ( gen , CodeGen::name ( inst_name ), inst_name , P , defined , FALSE )) {
WRITE ( "%S" , val );
- Generators::end_constant ( gen , VanillaConstants::name ( inst_name ), FALSE );
+ Generators::end_constant ( gen , CodeGen::name ( inst_name ), FALSE );
}
CodeGen::deselect ( gen , saved );
- Generators::declare_value_instance ( gen , VanillaConstants::name ( inst_name ),
+ Generators::declare_value_instance ( gen , CodeGen::name ( inst_name ),
Metadata::read_optional_textual ( Inter::Packages::container ( P ), I "^printed_name" ),
val );
DISCARD_TEXT ( val )
@@ -1220,14 +1226,14 @@ really make much conceptual sense, and I7 dropped the idea — it has no
int c = Inter::Symbols::read_annotation ( inst_name , ARROW_COUNT_IANN );
if ( c < 0 ) c = 0 ;
int is_dir = Inter::Kind::is_a ( inst_kind , direction_kind_symbol );
- Generators::declare_instance ( gen , VanillaConstants::name ( inst_kind ), VanillaConstants::name ( inst_name ),
+ Generators::declare_instance ( gen , CodeGen::name ( inst_kind ), CodeGen::name ( inst_name ),
Metadata::read_optional_textual ( Inter::Packages::container ( P ), I "^printed_name" ), c , is_dir );
VanillaObjects::append ( gen , inst_name );
inter_node_list * FL =
Inode::ID_to_frame_list ( P ,
Inter::Instance::properties_list ( inst_name ));
VanillaObjects::plist ( gen , FL );
- Generators::end_instance ( gen , VanillaConstants::name ( inst_kind ), VanillaConstants::name ( inst_name ));
+ Generators::end_instance ( gen , CodeGen::name ( inst_kind ), CodeGen::name ( inst_name ));
}
}
@@ -1237,23 +1243,23 @@ really make much conceptual sense, and I7 dropped the idea — it has no
LOOP_THROUGH_INTER_NODE_LIST ( X , FL ) {
inter_symbol * prop_name = InterSymbolsTables::symbol_from_frame_data ( X , PROP_PVAL_IFLD );
if ( prop_name == NULL ) internal_error ( "no property" );
- text_stream * call_it = VanillaConstants::name ( prop_name );
+ text_stream * call_it = CodeGen::name ( prop_name );
if ( Inter::Symbols::get_flag ( prop_name , ATTRIBUTE_MARK_BIT )) {
if (( X -> W . data [ DVAL1_PVAL_IFLD ] == LITERAL_IVAL ) &&
( X -> W . data [ DVAL2_PVAL_IFLD ] == 0 )) {
- Generators::assign_property ( gen , call_it , I "0" , TRUE );
+ Generators::assign_property ( gen , call_it , I "0" , TRUE );
} else {
- Generators::assign_property ( gen , call_it , I "1" , TRUE );
+ Generators::assign_property ( gen , call_it , I "1" , TRUE );
}
} else {
TEMPORARY_TEXT ( OUT )
CodeGen::select_temporary ( gen , OUT );
- if ( Generators::optimise_property_value ( gen , prop_name , X ) == FALSE ) {
+ if ( Generators::optimise_property_value ( gen , prop_name , X ) == FALSE ) {
VanillaConstants::literal ( gen , NULL , Inter::Packages::scope_of ( X ),
X -> W . data [ DVAL1_PVAL_IFLD ], X -> W . data [ DVAL2_PVAL_IFLD ], FALSE );
}
CodeGen::deselect_temporary ( gen );
- Generators::assign_property ( gen , call_it , OUT , FALSE );
+ Generators::assign_property ( gen , call_it , OUT , FALSE );
DISCARD_TEXT ( OUT )
}
}
@@ -1276,7 +1282,7 @@ really make much conceptual sense, and I7 dropped the idea — it has no
PUT_TO ( T , c );
}
inter_symbol * symb = InterSymbolsTables::url_name_to_symbol ( I , NULL , T );
- WRITE ( "%S" , VanillaConstants::name ( symb ));
+ WRITE ( "%S" , CodeGen::name ( symb ));
DISCARD_TEXT ( T )
} else PUT ( c );
if (( c == '\n' ) && ( i != Str::len ( S )-1)) WRITE ( " " );
@@ -1306,7 +1312,7 @@ really make much conceptual sense, and I7 dropped the idea — it has no
}
+
diff --git a/docs/final-module/2-vv.html b/docs/final-module/2-vv.html
deleted file mode 100644
index c9300493d..000000000
--- a/docs/final-module/2-vv.html
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
- Vanilla Variables
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Compiler Webs Inbuild Modules Inform7 Modules Inter Modules Services
-
-
-
-
-How the vanilla code generation strategy handles variables.
-
-
-
-
-int variables_written = FALSE , prepare_counter = 0 , knowledge_counter = 0 ;
-void VanillaVariables::prepare ( code_generation * gen ) {
- variables_written = FALSE ;
- prepare_counter = 0 ;
- knowledge_counter = 0 ;
- InterTree::traverse ( gen -> from , VanillaVariables::visitor1 , gen , NULL , VARIABLE_IST );
-}
-
-void VanillaVariables::visitor1 ( inter_tree * I , inter_tree_node * P , void * state ) {
- code_generation * gen = ( code_generation *) state ;
- inter_symbol * var_name = InterSymbolsTables::symbol_from_frame_data ( P , DEFN_VAR_IFLD );
- prepare_counter = Generators::prepare_variable ( gen , P , var_name , prepare_counter );
-}
-
-void VanillaVariables::variable ( code_generation * gen , inter_tree_node * P ) {
- if ( variables_written == FALSE ) {
- variables_written = TRUE ;
- InterTree::traverse ( gen -> from , VanillaVariables::visitor2 , gen , NULL , VARIABLE_IST );
- }
-}
-
-void VanillaVariables::visitor2 ( inter_tree * I , inter_tree_node * P , void * state ) {
- code_generation * gen = ( code_generation *) state ;
- inter_symbol * var_name = InterSymbolsTables::symbol_from_frame_data ( P , DEFN_VAR_IFLD );
- knowledge_counter = Generators::declare_variable ( gen , P , var_name , knowledge_counter , prepare_counter );
-}
-
-void VanillaVariables::consolidate ( code_generation * gen ) {
-}
-
-
-
-
-
-
-
-
diff --git a/docs/final-module/4-fi6.html b/docs/final-module/4-fi6.html
index 5c5f35697..7fb0ce741 100644
--- a/docs/final-module/4-fi6.html
+++ b/docs/final-module/4-fi6.html
@@ -147,7 +147,7 @@ function togglePopup(material_id) {
METHOD_ADD ( cgt , DEFAULT_SEGMENT_MTID , I6Target::default_segment );
METHOD_ADD ( cgt , BASIC_CONSTANT_SEGMENT_MTID , I6Target::basic_constant_segment );
METHOD_ADD ( cgt , CONSTANT_SEGMENT_MTID , I6Target::constant_segment );
- METHOD_ADD ( cgt , COMPILE_PRIMITIVE_MTID , I6Target::compile_primitive );
+ METHOD_ADD ( cgt , INVOKE_PRIMITIVE_MTID , I6Target::invoke_primitive );
METHOD_ADD ( cgt , MANGLE_IDENTIFIER_MTID , I6Target::mangle );
METHOD_ADD ( cgt , COMPILE_DICTIONARY_WORD_MTID , I6Target::compile_dictionary_word );
METHOD_ADD ( cgt , COMPILE_LITERAL_NUMBER_MTID , I6Target::compile_literal_number );
@@ -156,8 +156,7 @@ function togglePopup(material_id) {
METHOD_ADD ( cgt , DECLARE_PROPERTY_MTID , I6Target::declare_property );
METHOD_ADD ( cgt , DECLARE_ATTRIBUTE_MTID , I6Target::declare_attribute );
METHOD_ADD ( cgt , PROPERTY_OFFSET_MTID , I6Target::property_offset );
- METHOD_ADD ( cgt , PREPARE_VARIABLE_MTID , I6Target::prepare_variable );
- METHOD_ADD ( cgt , DECLARE_VARIABLE_MTID , I6Target::declare_variable );
+ METHOD_ADD ( cgt , DECLARE_VARIABLES_MTID , I6Target::declare_variables );
METHOD_ADD ( cgt , EVALUATE_VARIABLE_MTID , I6Target::evaluate_variable );
METHOD_ADD ( cgt , DECLARE_CLASS_MTID , I6Target::declare_class );
METHOD_ADD ( cgt , END_CLASS_MTID , I6Target::end_class );
@@ -169,8 +168,9 @@ function togglePopup(material_id) {
METHOD_ADD ( cgt , END_CONSTANT_MTID , I6Target::end_constant );
METHOD_ADD ( cgt , DECLARE_FUNCTION_MTID , I6Target::declare_function );
METHOD_ADD ( cgt , PLACE_LABEL_MTID , I6Target::place_label );
- METHOD_ADD ( cgt , FUNCTION_CALL_MTID , I6Target::function_call );
- METHOD_ADD ( cgt , ASSEMBLY_MTID , I6Target::assembly );
+ METHOD_ADD ( cgt , EVALUATE_LABEL_MTID , I6Target::evaluate_label );
+ METHOD_ADD ( cgt , INVOKE_FUNCTION_MTID , I6Target::invoke_function );
+ METHOD_ADD ( cgt , INVOKE_OPCODE_MTID , I6Target::invoke_opcode );
METHOD_ADD ( cgt , BEGIN_ARRAY_MTID , I6Target::begin_array );
METHOD_ADD ( cgt , ARRAY_ENTRY_MTID , I6Target::array_entry );
METHOD_ADD ( cgt , COMPILE_LITERAL_SYMBOL_MTID , I6Target::compile_literal_symbol );
@@ -178,7 +178,7 @@ function togglePopup(material_id) {
METHOD_ADD ( cgt , END_ARRAY_MTID , I6Target::end_array );
METHOD_ADD ( cgt , OFFER_PRAGMA_MTID , I6Target::offer_pragma )
METHOD_ADD ( cgt , END_GENERATION_MTID , I6Target::end_generation );
- METHOD_ADD ( cgt , WORLD_MODEL_ESSENTIALS_MTID , I6Target::world_model_essentials );
+ METHOD_ADD ( cgt , PSEUDO_OBJECT_MTID , I6Target::pseudo_object );
METHOD_ADD ( cgt , NEW_ACTION_MTID , I6Target::new_action );
inform6_target = cgt ;
}
@@ -358,8 +358,8 @@ It's used in the I6 veneer, and need not exist on any other final compilation ta
WRITE ( "%S" , identifier );
}
-int I6Target::compile_primitive ( code_generator * cgt , code_generation * gen ,
- inter_symbol * prim_name , inter_tree_node * P ) {
+void I6Target::invoke_primitive ( code_generator * cgt , code_generation * gen ,
+ inter_symbol * prim_name , inter_tree_node * P , int void_context ) {
text_stream * OUT = CodeGen::current ( gen );
int suppress_terminal_semicolon = FALSE ;
inter_tree * I = gen -> from ;
@@ -474,14 +474,14 @@ It's used in the I6 veneer, and need not exist on any other final compilation ta
case SEQUENTIAL_BIP: WRITE ( "(" ); VNODE_1C ; WRITE ( "," ); VNODE_2C ; WRITE ( ")" ); break ;
case TERNARYSEQUENTIAL_BIP: Generate primitive for ternarysequential 3.2 ; break ;
- case PRINT_BIP: WRITE ( "print " ); VanillaConstants::enter_print_mode (); VNODE_1C ; VanillaConstants::exit_print_mode (); break ;
+ case PRINT_BIP: WRITE ( "print " ); VanillaConstants::enter_print_mode ( gen ); VNODE_1C ; VanillaConstants::exit_print_mode ( gen ); break ;
case PRINTCHAR_BIP: WRITE ( "print (char) " ); VNODE_1C ; break ;
case PRINTNL_BIP: WRITE ( "new_line" ); break ;
case PRINTOBJ_BIP: WRITE ( "print (object) " ); VNODE_1C ; break ;
case PRINTNUMBER_BIP: WRITE ( "print " ); VNODE_1C ; break ;
case PRINTDWORD_BIP: WRITE ( "print (address) " ); VNODE_1C ; break ;
case PRINTSTRING_BIP: WRITE ( "print (string) " ); VNODE_1C ; break ;
- case BOX_BIP: WRITE ( "box " ); VanillaConstants::enter_box_mode (); VNODE_1C ; VanillaConstants::exit_box_mode (); break ;
+ case BOX_BIP: WRITE ( "box " ); VanillaConstants::enter_box_mode ( gen ); VNODE_1C ; VanillaConstants::exit_box_mode ( gen ); break ;
case IF_BIP: Generate primitive for if 3.3 ; break ;
case IFDEBUG_BIP: Generate primitive for ifdebug 3.4 ; break ;
@@ -503,7 +503,7 @@ It's used in the I6 veneer, and need not exist on any other final compilation ta
default: LOG ( "Prim: %S\n" , prim_name -> symbol_name ); internal_error ( "unimplemented prim" );
}
- return suppress_terminal_semicolon ;
+ if (( void_context ) && ( suppress_terminal_semicolon == FALSE )) WRITE ( ";\n" );
}
The structure I6_generation_data is private to this section.
@@ -824,7 +824,7 @@ trick called "stubbing", these being "stub definitions".)
void I6Target::declare_property ( code_generator * cgt , code_generation * gen ,
inter_symbol * prop_name , int used ) {
- text_stream * name = VanillaConstants::name ( prop_name );
+ text_stream * name = CodeGen::name ( prop_name );
if ( used ) {
generated_segment * saved = CodeGen::select ( gen , predeclarations_I7CGS );
WRITE_TO ( CodeGen::current ( gen ), "Property %S;\n" , prop_name -> symbol_name );
@@ -860,64 +860,61 @@ trick called "stubbing", these being "stub definitions".)
-int I6Target::prepare_variable ( code_generator * cgt , code_generation * gen ,
- inter_tree_node * P , inter_symbol * var_name , int k ) {
-
+void I6Target::declare_variables ( code_generator * cgt , code_generation * gen ,
+ linked_list * L ) {
+ int k = 0 ;
+ inter_symbol * var_name ;
+ LOOP_OVER_LINKED_LIST ( var_name , inter_symbol , L ) {
+ inter_tree_node * P = var_name -> definition ;
if ( Inter::Symbols::read_annotation ( var_name , ASSIMILATED_IANN ) != 1 ) {
text_stream * S = Str::new ();
WRITE_TO ( S , "(Global_Vars-->%d)" , k );
Inter::Symbols::set_translate ( var_name , S );
+ generated_segment * saved = CodeGen::select ( gen , predeclarations_I7CGS );
+ text_stream * OUT = CodeGen::current ( gen );
+ if ( k == 0 ) WRITE ( "Array Global_Vars -->\n" );
+ WRITE ( " (" );
+ inter_symbols_table * globals = Inter::Packages::scope_of ( P );
+ VanillaConstants::literal ( gen , NULL , globals , P -> W . data [ VAL1_VAR_IFLD ], P -> W . data [ VAL2_VAR_IFLD ], FALSE );
+ WRITE ( ") ! -->%d = %S (%S)\n" , k , CodeGen::name ( var_name ), var_name -> symbol_name );
+ CodeGen::deselect ( gen , saved );
k ++;
+ } else {
+ generated_segment * saved = CodeGen::select ( gen , main_matter_I7CGS );
+ text_stream * OUT = CodeGen::current ( gen );
+ WRITE ( "Global %S = " , CodeGen::name ( var_name ));
+ VanillaConstants::literal ( gen , NULL , Inter::Packages::scope_of ( P ), P -> W . data [ VAL1_VAR_IFLD ], P -> W . data [ VAL2_VAR_IFLD ], FALSE );
+ WRITE ( ";\n" );
+ CodeGen::deselect ( gen , saved );
}
-
- return k ;
-}
+ }
-int I6Target::declare_variable ( code_generator * cgt , code_generation * gen ,
- inter_tree_node * P , inter_symbol * var_name , int k , int of ) {
- if ( Inter::Symbols::read_annotation ( var_name , ASSIMILATED_IANN ) == 1 ) {
- generated_segment * saved = CodeGen::select ( gen , main_matter_I7CGS );
- text_stream * OUT = CodeGen::current ( gen );
- WRITE ( "Global %S = " , VanillaConstants::name ( var_name ));
- VanillaConstants::literal ( gen , NULL , Inter::Packages::scope_of ( P ), P -> W . data [ VAL1_VAR_IFLD ], P -> W . data [ VAL2_VAR_IFLD ], FALSE );
- WRITE ( ";\n" );
- CodeGen::deselect ( gen , saved );
- } else {
-
+ if ( k > 0 ) {
generated_segment * saved = CodeGen::select ( gen , predeclarations_I7CGS );
text_stream * OUT = CodeGen::current ( gen );
- if ( k == 0 ) WRITE ( "Array Global_Vars -->\n" );
- WRITE ( " (" );
- inter_symbols_table * globals = Inter::Packages::scope_of ( P );
- VanillaConstants::literal ( gen , NULL , globals , P -> W . data [ VAL1_VAR_IFLD ], P -> W . data [ VAL2_VAR_IFLD ], FALSE );
- WRITE ( ") ! -->%d = %S (%S)\n" , k , VanillaConstants::name ( var_name ), var_name -> symbol_name );
- k ++;
- if ( k == of ) {
- if ( k < 2 ) WRITE ( " NULL NULL" );
- WRITE ( ";\n" );
- }
+ while ( k ++ < 2 ) WRITE ( " NULL" );
+ WRITE ( ";\n" );
CodeGen::deselect ( gen , saved );
}
- return k ;
}
-void I6Target::evaluate_variable ( code_generator * cgt , code_generation * gen , inter_symbol * var_name , int as_reference ) {
+void I6Target::evaluate_variable ( code_generator * cgt , code_generation * gen , inter_symbol * var_name , int as_reference ) {
text_stream * OUT = CodeGen::current ( gen );
- WRITE ( "%S" , VanillaConstants::name ( var_name ));
+ WRITE ( "%S" , CodeGen::name ( var_name ));
}
-void I6Target::declare_class ( code_generator * cgt , code_generation * gen , text_stream * class_name , text_stream * printed_name , text_stream * super_class ) {
+void I6Target::declare_class ( code_generator * cgt , code_generation * gen , text_stream * class_name , text_stream * printed_name , text_stream * super_class ) {
text_stream * OUT = CodeGen::current ( gen );
WRITE ( "Class %S\n" , class_name );
if ( Str::len ( super_class ) > 0 ) WRITE ( " class %S\n" , super_class );
}
-void I6Target::end_class ( code_generator * cgt , code_generation * gen , text_stream * class_name ) {
+void I6Target::end_class ( code_generator * cgt , code_generation * gen , text_stream * class_name ) {
text_stream * OUT = CodeGen::current ( gen );
WRITE ( ";\n" );
}
-void I6Target::declare_instance ( code_generator * cgt , code_generation * gen , text_stream * class_name , text_stream * instance_name , text_stream * printed_name , int acount , int is_dir ) {
+void I6Target::declare_instance ( code_generator * cgt , code_generation * gen , text_stream * class_name , text_stream * instance_name , text_stream * printed_name , int acount , int is_dir ) {
text_stream * OUT = CodeGen::current ( gen );
WRITE ( "%S" , class_name );
for ( int i =0; i < acount ; i ++) WRITE ( " ->" );
@@ -925,12 +922,12 @@ trick called "stubbing", these being "stub definitions".)
if ( is_dir ) WRITE ( " Compass" );
}
-void I6Target::end_instance ( code_generator * cgt , code_generation * gen , text_stream * class_name , text_stream * instance_name ) {
+void I6Target::end_instance ( code_generator * cgt , code_generation * gen , text_stream * class_name , text_stream * instance_name ) {
text_stream * OUT = CodeGen::current ( gen );
WRITE ( ";\n" );
}
-int I6Target::optimise_property_value ( code_generator * cgt , code_generation * gen , inter_symbol * prop_name , inter_tree_node * X ) {
+int I6Target::optimise_property_value ( code_generator * cgt , code_generation * gen , inter_symbol * prop_name , inter_tree_node * X ) {
if ( Inter::Symbols::is_stored_in_data ( X -> W . data [ DVAL1_PVAL_IFLD ], X -> W . data [ DVAL2_PVAL_IFLD ])) {
inter_symbol * S = InterSymbolsTables::symbol_from_data_pair_and_frame ( X -> W . data [ DVAL1_PVAL_IFLD ], X -> W . data [ DVAL2_PVAL_IFLD ], X );
if (( S ) && ( Inter::Symbols::read_annotation ( S , INLINE_ARRAY_IANN ) == 1 )) {
@@ -946,7 +943,7 @@ trick called "stubbing", these being "stub definitions".)
return FALSE ;
}
-void I6Target::assign_property ( code_generator * cgt , code_generation * gen , text_stream * property_name , text_stream * val , int as_att ) {
+void I6Target::assign_property ( code_generator * cgt , code_generation * gen , text_stream * property_name , text_stream * val , int as_att ) {
text_stream * OUT = CodeGen::current ( gen );
if ( as_att ) {
if ( Str::eq ( val , I "0" )) WRITE ( " has ~%S\n" , property_name );
@@ -967,7 +964,7 @@ trick called "stubbing", these being "stub definitions".)
LOOP_THROUGH_INTER_CHILDREN ( F , P ) I6Target::seek_locals ( gen , F );
}
-int I6Target::begin_constant ( code_generator * cgt , code_generation * gen , text_stream * const_name , inter_symbol * const_s , inter_tree_node * P , int continues , int ifndef_me ) {
+int I6Target::begin_constant ( code_generator * cgt , code_generation * gen , text_stream * const_name , inter_symbol * const_s , inter_tree_node * P , int continues , int ifndef_me ) {
text_stream * OUT = CodeGen::current ( gen );
if (( const_s ) && ( Inter::Symbols::read_annotation ( const_s , INLINE_ARRAY_IANN ) == 1 )) return FALSE ;
@@ -1011,15 +1008,15 @@ trick called "stubbing", these being "stub definitions".)
if ( continues ) WRITE ( " = " );
return TRUE ;
}
-void I6Target::end_constant ( code_generator * cgt , code_generation * gen , text_stream * const_name , int ifndef_me ) {
+void I6Target::end_constant ( code_generator * cgt , code_generation * gen , text_stream * const_name , int ifndef_me ) {
text_stream * OUT = CodeGen::current ( gen );
WRITE ( ";\n" );
if ( ifndef_me ) WRITE ( "#endif;\n" );
}
int this_is_I6_Main = 0 ;
-void I6Target::declare_function ( code_generator * cgt , code_generation * gen , inter_symbol * fn , inter_tree_node * D ) {
- text_stream * fn_name = VanillaConstants::name ( fn );
+void I6Target::declare_function ( code_generator * cgt , code_generation * gen , inter_symbol * fn , inter_tree_node * D ) {
+ text_stream * fn_name = CodeGen::name ( fn );
this_is_I6_Main = 0 ;
text_stream * OUT = CodeGen::current ( gen );
WRITE ( "[ %S" , fn_name );
@@ -1080,7 +1077,7 @@ trick called "stubbing", these being "stub definitions".)
}
Vanilla::node ( gen , D );
-
+
if ( Str::eq ( fn_name , I "FINAL_CODE_STARTUP_R" )) {
WRITE ( "#ifdef TARGET_GLULX;\n" );
WRITE ( "@gestalt 9 0 res;\n" );
@@ -1109,10 +1106,16 @@ trick called "stubbing", these being "stub definitions".)
}
WRITE ( "];\n" );
}
-void I6Target::place_label ( code_generator * cgt , code_generation * gen , text_stream * label_name ) {
+void I6Target::place_label ( code_generator * cgt , code_generation * gen , text_stream * label_name ) {
text_stream * OUT = CodeGen::current ( gen );
WRITE ( "%S;\n" , label_name );
}
+void I6Target::evaluate_label ( code_generator * cgt , code_generation * gen , text_stream * label_name ) {
+ text_stream * OUT = CodeGen::current ( gen );
+ LOOP_THROUGH_TEXT ( pos , label_name )
+ if ( Str::get ( pos ) != '.' )
+ PUT ( Str::get ( pos ));
+}
-int CArithmetic::compile_primitive ( code_generation * gen , inter_ti bip , inter_tree_node * P ) {
+int CArithmetic::invoke_primitive ( code_generation * gen , inter_ti bip , inter_tree_node * P ) {
text_stream * OUT = CodeGen::current ( gen );
switch ( bip ) {
case PLUS_BIP: WRITE ( "(" ); VNODE_1C ; WRITE ( " + " ); VNODE_2C ; WRITE ( ")" ); break ;
diff --git a/docs/final-module/5-cas.html b/docs/final-module/5-cas.html
index 2a751af8b..7ed5a5151 100644
--- a/docs/final-module/5-cas.html
+++ b/docs/final-module/5-cas.html
@@ -78,7 +78,7 @@ function togglePopup(material_id) {
void CAssembly::initialise ( code_generator * cgt ) {
- METHOD_ADD ( cgt , ASSEMBLY_MTID , CAssembly::assembly );
+ METHOD_ADD ( cgt , INVOKE_OPCODE_MTID , CAssembly::assembly );
}
void CAssembly::initialise_data ( code_generation * gen ) {
@@ -124,7 +124,7 @@ function togglePopup(material_id) {
void CAssembly::assembly ( code_generator * cgt , code_generation * gen ,
text_stream * opcode , int operand_count , inter_tree_node ** operands ,
- inter_tree_node * label , int label_sense ) {
+ inter_tree_node * label , int label_sense , int void_context ) {
text_stream * OUT = CodeGen::current ( gen );
int vararg_operands_from = 0 , vararg_operands_to = 0 ;
@@ -220,6 +220,7 @@ function togglePopup(material_id) {
}
if ( pushed_result ) WRITE ( "; i7_push(proc, proc->state.tmp)" );
+ if ( void_context ) WRITE ( ";\n" );
}
diff --git a/docs/final-module/5-ccn.html b/docs/final-module/5-ccn.html
index 2eadbce2c..485d3661c 100644
--- a/docs/final-module/5-ccn.html
+++ b/docs/final-module/5-ccn.html
@@ -76,7 +76,7 @@ function togglePopup(material_id) {
-int CConditions::compile_primitive ( code_generation * gen , inter_ti bip , inter_tree_node * P ) {
+int CConditions::invoke_primitive ( code_generation * gen , inter_ti bip , inter_tree_node * P ) {
text_stream * OUT = CodeGen::current ( gen );
switch ( bip ) {
case NOT_BIP: WRITE ( "(!(" ); VNODE_1C ; WRITE ( "))" ); break ;
diff --git a/docs/final-module/5-cfm.html b/docs/final-module/5-cfm.html
index 244515807..0cd95323c 100644
--- a/docs/final-module/5-cfm.html
+++ b/docs/final-module/5-cfm.html
@@ -81,7 +81,8 @@ function togglePopup(material_id) {
METHOD_ADD ( cgt , PREDECLARE_FUNCTION_MTID , CFunctionModel::predeclare_function );
METHOD_ADD ( cgt , DECLARE_FUNCTION_MTID , CFunctionModel::declare_function );
METHOD_ADD ( cgt , PLACE_LABEL_MTID , CFunctionModel::place_label );
- METHOD_ADD ( cgt , FUNCTION_CALL_MTID , CFunctionModel::function_call );
+ METHOD_ADD ( cgt , EVALUATE_LABEL_MTID , CFunctionModel::evaluate_label );
+ METHOD_ADD ( cgt , INVOKE_FUNCTION_MTID , CFunctionModel::invoke_function );
}
typedef struct C_generation_function_model_data {
@@ -239,7 +240,7 @@ function togglePopup(material_id) {
void CFunctionModel::predeclare_function ( code_generator * cgt , code_generation * gen ,
inter_symbol * fn , inter_tree_node * D ) {
- text_stream * fn_name = VanillaConstants::name ( fn );
+ text_stream * fn_name = CodeGen::name ( fn );
inter_package * P = Inter::Packages::container ( fn -> definition );
inter_package * PP = Inter::Packages::parent ( P );
text_stream * md = Metadata::read_optional_textual ( PP , I "^phrase_syntax" );
@@ -293,7 +294,7 @@ function togglePopup(material_id) {
inter_symbol * var_name =
InterSymbolsTables::local_symbol_from_id ( pack , P -> W . data [ DEFN_LOCAL_IFLD ]);
TEMPORARY_TEXT ( name )
- CNamespace::mangle ( gen -> generator , name , VanillaConstants::name ( var_name ));
+ CNamespace::mangle ( gen -> generator , name , CodeGen::name ( var_name ));
final_c_function * fcf = C_GEN_DATA ( fndata . current_fcf );
if ( Str::eq ( var_name -> symbol_name , I "_vararg_count" )) {
fcf -> uses_vararg_model = TRUE ;
@@ -308,7 +309,7 @@ function togglePopup(material_id) {
}
void CFunctionModel::declare_function ( code_generator * cgt , code_generation * gen , inter_symbol * fn , inter_tree_node * D ) {
- text_stream * fn_name = VanillaConstants::name ( fn );
+ text_stream * fn_name = CodeGen::name ( fn );
final_c_function * fcf = RETRIEVE_POINTER_final_c_function ( fn -> translation_data );
C_GEN_DATA ( fndata . current_fcf ) = fcf ;
text_stream * OUT = CodeGen::current ( gen );
@@ -338,13 +339,22 @@ function togglePopup(material_id) {
PUT ( Str::get ( pos ));
WRITE ( ": ;\n" , label_name );
}
+void CFunctionModel::evaluate_label ( code_generator * cgt , code_generation * gen , text_stream * label_name ) {
+ text_stream * OUT = CodeGen::current ( gen );
+ LOOP_THROUGH_TEXT ( pos , label_name )
+ if ( Str::get ( pos ) != '.' )
+ PUT ( Str::get ( pos ));
+}
int CFunctionModel::inside_function ( code_generation * gen ) {
if ( C_GEN_DATA ( fndata . compiling_function )) return TRUE ;
return FALSE ;
}
-void CFunctionModel::function_call ( code_generator * cgt , code_generation * gen , inter_symbol * fn , inter_tree_node * P , int argc ) {
+void CFunctionModel::invoke_function ( code_generator * cgt , code_generation * gen , inter_symbol * fn , inter_tree_node * P , int void_context ) {
+ int argc = 0 ;
+ LOOP_THROUGH_INTER_CHILDREN ( F , P ) argc ++;
+
inter_tree_node * D = fn -> definition ;
if (( D ) && ( D -> W . data [ ID_IFLD ] == CONSTANT_IST ) && ( D -> W . data [ FORMAT_CONST_IFLD ] == CONSTANT_DIRECT )) {
inter_ti val1 = D -> W . data [ DATA_CONST_IFLD ];
@@ -358,7 +368,7 @@ function togglePopup(material_id) {
if ( GENERAL_POINTER_IS_NULL ( fn -> translation_data ) == FALSE )
fcf = RETRIEVE_POINTER_final_c_function ( fn -> translation_data );
- text_stream * fn_name = VanillaConstants::name ( fn );
+ text_stream * fn_name = CodeGen::name ( fn );
text_stream * OUT = CodeGen::current ( gen );
inter_tree_node * fargstuff [128];
@@ -396,6 +406,7 @@ function togglePopup(material_id) {
}
}
WRITE ( ")" );
+ if ( void_context ) WRITE ( ";\n" );
}
The structure C_generation_function_model_data is private to this section. The structure final_c_function is private to this section.
diff --git a/docs/final-module/5-cgv.html b/docs/final-module/5-cgv.html
index 59d595a7c..41676e79c 100644
--- a/docs/final-module/5-cgv.html
+++ b/docs/final-module/5-cgv.html
@@ -80,8 +80,7 @@ function togglePopup(material_id) {
void CGlobals::initialise ( code_generator * cgt ) {
- METHOD_ADD ( cgt , PREPARE_VARIABLE_MTID , CGlobals::prepare_variable );
- METHOD_ADD ( cgt , DECLARE_VARIABLE_MTID , CGlobals::declare_variable );
+ METHOD_ADD ( cgt , DECLARE_VARIABLES_MTID , CGlobals::declare_variables );
METHOD_ADD ( cgt , EVALUATE_VARIABLE_MTID , CGlobals::evaluate_variable );
}
@@ -114,20 +113,17 @@ function togglePopup(material_id) {
-int CGlobals::prepare_variable ( code_generator * cgt , code_generation * gen ,
- inter_tree_node * P , inter_symbol * var_name , int k ) {
- return k ;
-}
-
-int CGlobals::declare_variable ( code_generator * cgt , code_generation * gen ,
- inter_tree_node * P , inter_symbol * var_name , int k , int of ) {
- CGlobals::declare_variable_by_name ( gen , VanillaConstants::name ( var_name ), P );
- text_stream * name = Metadata::read_optional_textual ( Inter::Packages::container ( var_name -> definition ), I "^name" );
- if ( name )
- CObjectModel::define_header_constant_for_variable ( gen , name , C_var_count - 1 );
- else
- CObjectModel::define_header_constant_for_variable ( gen , VanillaConstants::name ( var_name ), C_var_count - 1 );
- return k ;
+void CGlobals::declare_variables ( code_generator * cgt , code_generation * gen , linked_list * L ) {
+ inter_symbol * var_name ;
+ LOOP_OVER_LINKED_LIST ( var_name , inter_symbol , L ) {
+ inter_tree_node * P = var_name -> definition ;
+ CGlobals::declare_variable_by_name ( gen , CodeGen::name ( var_name ), P );
+ text_stream * name = Metadata::read_optional_textual ( Inter::Packages::container ( var_name -> definition ), I "^name" );
+ if ( name )
+ CObjectModel::define_header_constant_for_variable ( gen , name , C_var_count - 1 );
+ else
+ CObjectModel::define_header_constant_for_variable ( gen , CodeGen::name ( var_name ), C_var_count - 1 );
+ }
}
void CGlobals::declare_variable_by_name ( code_generation * gen , text_stream * name ,
@@ -146,9 +142,9 @@ function togglePopup(material_id) {
WRITE_TO ( C_var_vals , " /* %S */\n" , name );
}
-void CGlobals::evaluate_variable ( code_generator * cgt , code_generation * gen , inter_symbol * var_name , int as_reference ) {
+void CGlobals::evaluate_variable ( code_generator * cgt , code_generation * gen , inter_symbol * var_name , int as_reference ) {
text_stream * OUT = CodeGen::current ( gen );
- WRITE ( "proc->state.variables[i7_var_%S]" , VanillaConstants::name ( var_name ));
+ WRITE ( "proc->state.variables[i7_var_%S]" , CodeGen::name ( var_name ));
}
diff --git a/docs/final-module/5-cim.html b/docs/final-module/5-cim.html
index 553ad953e..1493a1d0a 100644
--- a/docs/final-module/5-cim.html
+++ b/docs/final-module/5-cim.html
@@ -94,18 +94,18 @@ function togglePopup(material_id) {
-int CInputOutputModel::compile_primitive ( code_generation * gen , inter_ti bip , inter_tree_node * P ) {
+int CInputOutputModel::invoke_primitive ( code_generation * gen , inter_ti bip , inter_tree_node * P ) {
text_stream * OUT = CodeGen::current ( gen );
switch ( bip ) {
case SPACES_BIP: WRITE ( "for (int j = " ); VNODE_1C ; WRITE ( "; j > 0; j--) i7_print_char(proc, 32);" ); break ;
case FONT_BIP: WRITE ( "i7_font(proc, " ); VNODE_1C ; WRITE ( ")" ); break ;
case STYLE_BIP: WRITE ( "i7_style(proc, " ); VNODE_1C ; WRITE ( ")" ); break ;
- case PRINT_BIP: WRITE ( "i7_print_C_string(proc, " ); VanillaConstants::enter_print_mode (); VNODE_1C ; VanillaConstants::exit_print_mode (); WRITE ( ")" ); break ;
+ case PRINT_BIP: WRITE ( "i7_print_C_string(proc, " ); VanillaConstants::enter_print_mode ( gen ); VNODE_1C ; VanillaConstants::exit_print_mode ( gen ); WRITE ( ")" ); break ;
case PRINTCHAR_BIP: WRITE ( "i7_print_char(proc, " ); VNODE_1C ; WRITE ( ")" ); break ;
case PRINTNL_BIP: WRITE ( "i7_print_char(proc, '\\n')" ); break ;
case PRINTOBJ_BIP: WRITE ( "i7_print_object(proc, " ); VNODE_1C ; WRITE ( ")" ); break ;
case PRINTNUMBER_BIP: WRITE ( "i7_print_decimal(proc, " ); VNODE_1C ; WRITE ( ")" ); break ;
- case BOX_BIP: WRITE ( "i7_print_box(proc, " ); VanillaConstants::enter_box_mode (); VNODE_1C ; VanillaConstants::exit_box_mode (); WRITE ( ")" ); break ;
+ case BOX_BIP: WRITE ( "i7_print_box(proc, " ); VanillaConstants::enter_box_mode ( gen ); VNODE_1C ; VanillaConstants::exit_box_mode ( gen ); WRITE ( ")" ); break ;
case READ_BIP: WRITE ( "i7_read(proc, " ); VNODE_1C ; WRITE ( ", " ); VNODE_2C ; WRITE ( ")" ); break ;
default: return NOT_APPLICABLE ;
}
diff --git a/docs/final-module/5-clt.html b/docs/final-module/5-clt.html
index 7a1788f0b..8f47c012c 100644
--- a/docs/final-module/5-clt.html
+++ b/docs/final-module/5-clt.html
@@ -431,7 +431,7 @@ function togglePopup(material_id) {
bc = 0x83 ;
CLiteralsModel::grammar_byte ( gen , bc + lookahead );
TEMPORARY_TEXT ( MG )
- CNamespace::mangle ( cgt , MG , VanillaConstants::name ( aliased ));
+ CNamespace::mangle ( cgt , MG , CodeGen::name ( aliased ));
CLiteralsModel::grammar_word_textual ( gen , MG );
DISCARD_TEXT ( MG )
continue ;
@@ -815,7 +815,7 @@ function togglePopup(material_id) {
return C_GEN_DATA ( litdata . no_double_quoted_C_strings );
}
-int CLiteralsModel::compile_primitive ( code_generation * gen , inter_ti bip , inter_tree_node * P ) {
+int CLiteralsModel::invoke_primitive ( code_generation * gen , inter_ti bip , inter_tree_node * P ) {
text_stream * OUT = CodeGen::current ( gen );
switch ( bip ) {
case PRINTSTRING_BIP: WRITE ( "i7_print_C_string(proc, dqs[" ); VNODE_1C ; WRITE ( " - I7VAL_STRINGS_BASE])" ); break ;
diff --git a/docs/final-module/5-cmm.html b/docs/final-module/5-cmm.html
index c32d895be..5be26eb51 100644
--- a/docs/final-module/5-cmm.html
+++ b/docs/final-module/5-cmm.html
@@ -476,8 +476,8 @@ and therefore if
void CObjectModel::initialise ( code_generator * cgt ) {
- METHOD_ADD ( cgt , WORLD_MODEL_ESSENTIALS_MTID , CObjectModel::world_model_essentials );
+ METHOD_ADD ( cgt , PSEUDO_OBJECT_MTID , CObjectModel::pseudo_object );
METHOD_ADD ( cgt , DECLARE_INSTANCE_MTID , CObjectModel::declare_instance );
METHOD_ADD ( cgt , DECLARE_VALUE_INSTANCE_MTID , CObjectModel::declare_value_instance );
METHOD_ADD ( cgt , DECLARE_CLASS_MTID , CObjectModel::declare_class );
@@ -265,11 +265,9 @@ overlap.
-void CObjectModel::world_model_essentials ( code_generator * cgt , code_generation * gen ) {
- C_GEN_DATA ( objdata . compass_instance ) = CObjectModel::declare_instance ( cgt , gen , I "Object" , I "Compass" , I "Compass" , -1, FALSE );
- CObjectModel::declare_instance ( cgt , gen , I "Object" , I "thedark" , NULL , -1, FALSE );
- CObjectModel::declare_instance ( cgt , gen , I "Object" , I "InformParser" , NULL , -1, FALSE );
- CObjectModel::declare_instance ( cgt , gen , I "Object" , I "InformLibrary" , NULL , -1, FALSE );
+void CObjectModel::pseudo_object ( code_generator * cgt , code_generation * gen , text_stream * obj_name ) {
+ C_property_owner * obj = CObjectModel::declare_instance ( cgt , gen , I "Object" , obj_name , obj_name , -1, FALSE );
+ if ( Str::eq ( obj_name , I "Compass" )) C_GEN_DATA ( objdata . compass_instance ) = obj ;
}
C_property_owner * CObjectModel::declare_instance ( code_generator * cgt , code_generation * gen ,
@@ -479,7 +477,7 @@ that references to it will not fail to compile.
void CObjectModel::declare_property ( code_generator * cgt , code_generation * gen ,
inter_symbol * prop_name , int used ) {
- text_stream * name = VanillaConstants::name ( prop_name );
+ text_stream * name = CodeGen::name ( prop_name );
C_property * cp = CObjectModel::property_by_name ( gen , name , used , FALSE );
text_stream * pname = Metadata::read_optional_textual ( Inter::Packages::container ( prop_name -> definition ), I "^name" );
if ( pname )
@@ -747,7 +745,7 @@ which we will then need to write in -
How the vanilla code generation strategy handles instances, kinds, and properties.
-
-
- Vanilla Variables -
- How the vanilla code generation strategy handles variables.
-
Vanilla Code -
diff --git a/docs/imperative-module/5-cii.html b/docs/imperative-module/5-cii.html
index ebc44dffc..ab3f46646 100644
--- a/docs/imperative-module/5-cii.html
+++ b/docs/imperative-module/5-cii.html
@@ -2163,13 +2163,6 @@ representation. This is the functionality I would most like to remove from Infor
WRITE ( "%n" , RTProperties::iname ( <<rp>> ));
return ;
}
- if ( <k-kind> ( LW )) {
- kind * K = <<rp>> ;
- if ( Kinds::Behaviour::is_subkind_of_object ( K )) {
- WRITE ( "%n" , RTKindDeclarations::iname ( K ));
- return ;
- }
- }
if ( <instance-of-object> ( LW )) {
instance * I = <<rp>> ;
WRITE ( "%~I" , I );
@@ -2187,6 +2180,13 @@ representation. This is the functionality I would most like to remove from Infor
}
return ;
}
+ if ( <k-kind> ( LW )) {
+ kind * K = <<rp>> ;
+ if ( Kinds::Behaviour::is_subkind_of_object ( K )) {
+ WRITE ( "%n" , RTKindDeclarations::iname ( K ));
+ return ;
+ }
+ }
nonlocal_variable * nlv = NonlocalVariables::parse_global ( LW );
if ( nlv ) {
PUT ( URL_SYMBOL_CHAR );
diff --git a/docs/standard_rules/S-var.html b/docs/standard_rules/S-var.html
index 6c2d0c4b1..7726a23e5 100644
--- a/docs/standard_rules/S-var.html
+++ b/docs/standard_rules/S-var.html
@@ -92,10 +92,6 @@ flag which the I6 library would have stored as the
-
-
The location -- documented at var_location -- is an object that varies .
The score -- documented at var_score -- is a number that varies .
diff --git a/inform7/Figures/memory-diagnostics.txt b/inform7/Figures/memory-diagnostics.txt
index 09177292a..e1c9324b0 100644
--- a/inform7/Figures/memory-diagnostics.txt
+++ b/inform7/Figures/memory-diagnostics.txt
@@ -1,10 +1,10 @@
-Total memory consumption was 394747K = 385 MB
+Total memory consumption was 394741K = 385 MB
-60.7% was used for 1997363 objects, in 371205 frames in 300 x 800K = 240000K = 234 MB:
+60.7% was used for 1997359 objects, in 371201 frames in 300 x 800K = 240000K = 234 MB:
10.3% inter_tree_node_array 58 x 8192 = 475136 objects, 41813824 bytes
7.1% text_stream_array 5146 x 100 = 514600 objects, 28982272 bytes
- 4.2% linked_list 30852 objects, 17277120 bytes
+ 4.2% linked_list 30854 objects, 17278240 bytes
3.9% inter_symbol_array 139 x 1024 = 142336 objects, 15946080 bytes
2.5% parse_node 129365 objects, 10349200 bytes
1.8% verb_conjugation 160 objects, 7425280 bytes
@@ -14,11 +14,11 @@ Total memory consumption was 394747K = 385 MB
0.6% kind_array 68 x 1000 = 68000 objects, 2722176 bytes
0.5% inter_name_generator_array 53 x 1000 = 53000 objects, 2121696 bytes
0.4% inter_schema_token 13475 objects, 1940400 bytes
- 0.4% inter_package 26570 objects, 1913040 bytes
+ 0.4% inter_package 26568 objects, 1912896 bytes
0.4% package_request 21136 objects, 1859968 bytes
0.4% vocabulary_entry_array 161 x 100 = 16100 objects, 1808352 bytes
- 0.4% inter_symbols_table 26570 objects, 1700480 bytes
- 0.3% dictionary 33267 objects, 1596816 bytes
+ 0.4% inter_symbols_table 26568 objects, 1700352 bytes
+ 0.3% dictionary 33265 objects, 1596720 bytes
0.3% match_trie_array 11 x 1000 = 11000 objects, 1496352 bytes
0.3% i6_schema_array 23 x 100 = 2300 objects, 1380736 bytes
0.3% dict_entry_array 393 x 100 = 39300 objects, 1270176 bytes
@@ -179,7 +179,7 @@ Total memory consumption was 394747K = 385 MB
---- I6T_intervention 8 objects, 640 bytes
---- relation_guard 5 objects, 640 bytes
---- inter_warehouse_room 10 objects, 640 bytes
- ---- code_generation 1 object, 608 bytes
+ ---- code_generation 1 object, 624 bytes
---- inbuild_search_result 15 objects, 600 bytes
---- rulebook_outcome 17 objects, 544 bytes
---- small_word_set 11 objects, 528 bytes
@@ -238,16 +238,16 @@ Total memory consumption was 394747K = 385 MB
39.2% was used for memory not allocated for objects:
- 20.4% text stream storage 82587012 bytes in 532783 claims
- 4.4% dictionary storage 18176000 bytes in 33267 claims
+ 20.4% text stream storage 82582104 bytes in 532749 claims
+ 4.4% dictionary storage 18174976 bytes in 33265 claims
---- sorting 744 bytes in 3 claims
1.7% source text 7200000 bytes in 3 claims
2.6% source text details 10800000 bytes in 2 claims
---- documentation fragments 262144 bytes in 1 claim
---- linguistic stock array 81920 bytes in 2 claims
---- small word set array 105600 bytes in 22 claims
- 1.0% inter symbols storage 4175216 bytes in 27681 claims
- 4.1% inter bytecode storage 16802804 bytes in 14 claims
+ 1.0% inter symbols storage 4174960 bytes in 27679 claims
+ 4.1% inter bytecode storage 16802768 bytes in 14 claims
4.0% inter links storage 16174208 bytes in 266 claims
---- inter tree location list storage 191232 bytes in 32 claims
0.4% instance-of-kind counting 1695204 bytes in 1 claim
@@ -256,5 +256,5 @@ Total memory consumption was 394747K = 385 MB
---- code generation workspace for objects 9624 bytes in 9 claims
---- emitter array storage 161792 bytes in 2062 claims
-18.7% was overhead - 75830312 bytes = 74053K = 72 MB
+18.7% was overhead - 75829544 bytes = 74052K = 72 MB
diff --git a/inform7/Figures/timings-diagnostics.txt b/inform7/Figures/timings-diagnostics.txt
index 978be17bf..06108e070 100644
--- a/inform7/Figures/timings-diagnostics.txt
+++ b/inform7/Figures/timings-diagnostics.txt
@@ -1,8 +1,8 @@
100.0% in inform7 run
- 54.6% in compilation to Inter
- 39.4% in //Sequence::undertake_queued_tasks//
+ 54.2% in compilation to Inter
+ 39.1% in //Sequence::undertake_queued_tasks//
3.4% in //MajorNodes::pre_pass//
- 2.5% in //MajorNodes::pass_1//
+ 2.4% in //MajorNodes::pass_1//
2.0% in //RTPhrasebook::compile_entries//
1.3% in //ImperativeDefinitions::assess_all//
1.1% in //RTKindConstructors::compile//
@@ -16,12 +16,12 @@
0.1% in //RTKindConstructors::compile_permissions//
0.1% in //Task::make_built_in_kind_constructors//
0.1% in //World::stages_II_and_III//
- 1.6% not specifically accounted for
- 43.4% in running Inter pipeline
- 12.5% in step preparation
- 9.6% in inter step 7/16: consolidate-text
- 7.8% in inter step 2/16: link
- 7.2% in inter step 16/16: generate inform6 -> auto.inf
+ 1.7% not specifically accounted for
+ 43.8% in running Inter pipeline
+ 12.4% in step preparation
+ 9.7% in inter step 7/16: consolidate-text
+ 7.9% in inter step 2/16: link
+ 7.4% in inter step 16/16: generate inform6 -> auto.inf
1.5% in inter step 11/16: make-identifiers-unique
0.4% in inter step 12/16: reconcile-verbs
0.2% in inter step 10/16: detect-indirect-calls
@@ -32,6 +32,6 @@
0.1% in inter step 13/16: eliminate-redundant-labels
0.1% in inter step 4/16: parse-linked-matter
0.1% in inter step 5/16: resolve-conditional-compilation
- 2.3% not specifically accounted for
+ 2.5% not specifically accounted for
1.6% in supervisor
- 0.2% not specifically accounted for
+ 0.3% not specifically accounted for
diff --git a/inform7/Internal/Inter/CommandParserKit/Sections/Parser.i6t b/inform7/Internal/Inter/CommandParserKit/Sections/Parser.i6t
index a5b3094d4..5de8ac106 100644
--- a/inform7/Internal/Inter/CommandParserKit/Sections/Parser.i6t
+++ b/inform7/Internal/Inter/CommandParserKit/Sections/Parser.i6t
@@ -1988,7 +1988,7 @@ is set; it returns a parser error number, or 0 if no error occurred.
1: indef_type = indef_type | THAT_BIT;
default:
indef_owner = PronounValue(cto);
- if (indef_owner == NULL) indef_owner = InformParser;
+ if (indef_owner == NULL) indef_owner = nothing;
}
}
diff --git a/inform7/Internal/Inter/WorldModelKit/Sections/Miscellany.i6t b/inform7/Internal/Inter/WorldModelKit/Sections/Miscellany.i6t
index 1acfc45fd..e4b0b1cc6 100644
--- a/inform7/Internal/Inter/WorldModelKit/Sections/Miscellany.i6t
+++ b/inform7/Internal/Inter/WorldModelKit/Sections/Miscellany.i6t
@@ -11,14 +11,6 @@ are more important to understand.
(1) The first three variables to be defined are special in that they are
significant to very early-style Z-machine interpreters, where they are
used to produce the status line display (hence |sline1| and |sline2|).
-The first variable must always equal a valid object number, which is why
-we -- pretty weirdly -- set it equal to the placeholder object |InformLibrary|,
-which takes no part in play, and is not a valid I7 object. This is not
-typesafe in I7 terms, but that doesn't matter because initialisation
-will correct it to a typesafe value before any I7 source text can execute.
-(|sline1| and |sline2| are entirely unused on when we target Glulx.)
-Once these variables are defined, the sequence of definition of the rest
-is not significant.
(2) The |say__*| are used for the finite state machine used in printing
text, which keeps track of automatic paragraph breaking and the like. For
@@ -98,7 +90,7 @@ based on character cells.
=
! (1)
-Global location = InformLibrary; ! does not = I7 "location": see below
+Global location = 0; ! does not = I7 "location": see below
Global sline1; Global sline2;
! (2)
@@ -241,15 +233,11 @@ Global MAX_SCORE = INITIAL_MAX_SCORE;
@h Other odds and ends.
=
-Object InformParser "(Inform Parser)" has proper;
-
[ ParserError error_type;
if (error_type) PrintSingleParagraph(error_type);
rfalse;
];
-Object InformLibrary "(Inform Library)" has proper;
-
[ UnknownVerb v;
if (KIT_CONFIGURATION_BITMAP & NO_VERB_VERB_DEFINED_TCBIT) {
verb_wordnum = 0; return 'no.verb';
diff --git a/inform7/Internal/Inter/WorldModelKit/Sections/Tests.i6t b/inform7/Internal/Inter/WorldModelKit/Sections/Tests.i6t
index 5df38fa82..04a983110 100644
--- a/inform7/Internal/Inter/WorldModelKit/Sections/Tests.i6t
+++ b/inform7/Internal/Inter/WorldModelKit/Sections/Tests.i6t
@@ -29,7 +29,6 @@ moves an object to a new position in the object tree.
];
[ XTestMove obj dest;
- if (obj <= InformLibrary) print_ret "[Can't move ", (name) obj, ": it's a system object.]";
if (obj.component_parent) print_ret "[Can't move ", (name) obj, ": it's part of ",
(the) obj.component_parent, ".]";
while (dest) {
diff --git a/inform7/Tests/Test Cases/BracketPlus.txt b/inform7/Tests/Test Cases/BracketPlus.txt
index 5f23a10f2..a64f9d2db 100644
--- a/inform7/Tests/Test Cases/BracketPlus.txt
+++ b/inform7/Tests/Test Cases/BracketPlus.txt
@@ -21,10 +21,10 @@ To decide if (T - a thing) radiates:
(- ( (+ radioactive +)({T}) ) -).
To decide if (T - a thing) helps:
- (- ( {T} has (+ supporter +) ) -).
+ (- ( {T} ofclass (+ supporter +) ) -).
To decide if (T - a thing) helps:
- (- ( {T} has (+ supporter +) ) -).
+ (- ( {T} ofclass (+ supporter +) ) -).
To decide if (T - a thing) sacks:
(- ( {T} == (+ sack of pitchblende +) ) -).
diff --git a/inform7/Tests/Test Cases/_Results_Ideal/UnsetPronouns.txt b/inform7/Tests/Test Cases/_Results_Ideal/UnsetPronouns.txt
index e2d841d50..fb1773a5c 100644
--- a/inform7/Tests/Test Cases/_Results_Ideal/UnsetPronouns.txt
+++ b/inform7/Tests/Test Cases/_Results_Ideal/UnsetPronouns.txt
@@ -54,7 +54,7 @@
[Object list from word 2]
[Calling NounDomain on location and actor]
[NounDomain called at word 3
- seeking indefinite object: owner:(Inform Parser)
+ seeking indefinite object:
number wanted: 0
most likely GNAs of names: 4095
Trying yourself at word 3
diff --git a/inform7/Tests/Test Makes/Eg4-C/textual.txt b/inform7/Tests/Test Makes/Eg4-C/textual.txt
index 3402009df..11b171eed 100644
--- a/inform7/Tests/Test Makes/Eg4-C/textual.txt
+++ b/inform7/Tests/Test Makes/Eg4-C/textual.txt
@@ -34795,7 +34795,7 @@ package main _plain
constant KIT_CONFIGURATION_BITMAP K_typeless_int = 0
constant KIT_CONFIGURATION_LOOKMODE K_typeless_int = 2
constant I7_VERSION_NUMBER K_typeless_string = "10.1.0"
- constant I7_FULL_VERSION_NUMBER K_typeless_string = "10.1.0-alpha.1+6T33"
+ constant I7_FULL_VERSION_NUMBER K_typeless_string = "10.1.0-alpha.1+6T34"
constant ^virtual_machine K_typeless_string = "C/32d/v1/no-main"
constant ^virtual_machine_icon K_typeless_string = "vm_glulx.png"
constant ^language_elements_used K_typeless_string = "core, naming, instance counting, glulx external files"
diff --git a/inform7/extensions/standard_rules/Sections/Variables and Rulebooks.w b/inform7/extensions/standard_rules/Sections/Variables and Rulebooks.w
index e8785630e..15a270de9 100644
--- a/inform7/extensions/standard_rules/Sections/Variables and Rulebooks.w
+++ b/inform7/extensions/standard_rules/Sections/Variables and Rulebooks.w
@@ -34,9 +34,6 @@ it is always an actual room, and I7 has nothing corresponding to I6's
flag which the I6 library would have stored as the |visited| attribute for the
|thedark| object.
-The "maximum score" is, rather cheekily, translated to an I6 constant:
-and this cannot be changed at run-time.
-
=
The location -- documented at var_location -- is an object that varies.
The score -- documented at var_score -- is a number that varies.
diff --git a/inform7/imperative-module/Chapter 5/Compile Invocations Inline.w b/inform7/imperative-module/Chapter 5/Compile Invocations Inline.w
index e2f14e27f..8dff9f1f9 100644
--- a/inform7/imperative-module/Chapter 5/Compile Invocations Inline.w
+++ b/inform7/imperative-module/Chapter 5/Compile Invocations Inline.w
@@ -1661,13 +1661,6 @@ void CSIInline::eval_bracket_plus_to_text(text_stream *OUT, wording LW) {
WRITE("%n", RTProperties::iname(<>));
return;
}
- if ((LW)) {
- kind *K = <>;
- if (Kinds::Behaviour::is_subkind_of_object(K)) {
- WRITE("%n", RTKindDeclarations::iname(K));
- return;
- }
- }
if ((LW)) {
instance *I = <>;
WRITE("%~I", I);
@@ -1685,6 +1678,13 @@ void CSIInline::eval_bracket_plus_to_text(text_stream *OUT, wording LW) {
}
return;
}
+ if ((LW)) {
+ kind *K = <>;
+ if (Kinds::Behaviour::is_subkind_of_object(K)) {
+ WRITE("%n", RTKindDeclarations::iname(K));
+ return;
+ }
+ }
nonlocal_variable *nlv = NonlocalVariables::parse_global(LW);
if (nlv) {
PUT(URL_SYMBOL_CHAR);
diff --git a/inter/final-module/Chapter 2/Code Generation.w b/inter/final-module/Chapter 2/Code Generation.w
index f8616f0bc..72805ab08 100644
--- a/inter/final-module/Chapter 2/Code Generation.w
+++ b/inter/final-module/Chapter 2/Code Generation.w
@@ -46,6 +46,8 @@ typedef struct code_generation {
struct segmentation_data segmentation;
int void_level;
+ int literal_text_mode;
+ struct linked_list *global_variables;
CLASS_DEFINITION
} code_generation;
@@ -63,6 +65,8 @@ code_generation *CodeGen::new_generation(filename *F, text_stream *T, inter_tree
else gen->just_this_package = Site::main_package(I);
gen->segmentation = CodeGen::new_segmentation_data();
gen->void_level = -1;
+ gen->literal_text_mode = 0;
+ gen->global_variables = NEW_LINKED_LIST(inter_symbol);
return gen;
}
@@ -291,3 +295,13 @@ void CodeGen::mark(inter_symbol *symb_name) {
void CodeGen::unmark(inter_symbol *symb_name) {
Inter::Symbols::clear_flag(symb_name, TRAVERSE_MARK_BIT);
}
+
+@h Names.
+Finally, this function is frequently needed:
+
+=
+text_stream *CodeGen::name(inter_symbol *symb) {
+ if (symb == NULL) return NULL;
+ if (Inter::Symbols::get_translate(symb)) return Inter::Symbols::get_translate(symb);
+ return symb->symbol_name;
+}
diff --git a/inter/final-module/Chapter 2/Code Generators.w b/inter/final-module/Chapter 2/Code Generators.w
index a1acadbe9..b774acb4f 100644
--- a/inter/final-module/Chapter 2/Code Generators.w
+++ b/inter/final-module/Chapter 2/Code Generators.w
@@ -95,11 +95,59 @@ I6 code. Still, all pragmas are offered to all generators.
@e OFFER_PRAGMA_MTID
=
-VOID_METHOD_TYPE(OFFER_PRAGMA_MTID, code_generator *generator, code_generation *gen, inter_tree_node *P, text_stream *tag, text_stream *content)
-void Generators::offer_pragma(code_generation *gen, inter_tree_node *P, text_stream *tag, text_stream *content) {
+VOID_METHOD_TYPE(OFFER_PRAGMA_MTID, code_generator *generator, code_generation *gen,
+ inter_tree_node *P, text_stream *tag, text_stream *content)
+void Generators::offer_pragma(code_generation *gen, inter_tree_node *P, text_stream *tag,
+ text_stream *content) {
VOID_METHOD_CALL(gen->generator, OFFER_PRAGMA_MTID, gen, P, tag, content);
}
+@h Methods for code inside functions.
+Labels are identified by name only, and are potential |!jump| destinations:
+
+@e PLACE_LABEL_MTID
+@e EVALUATE_LABEL_MTID
+
+=
+VOID_METHOD_TYPE(PLACE_LABEL_MTID, code_generator *generator, code_generation *gen,
+ text_stream *label_name)
+VOID_METHOD_TYPE(EVALUATE_LABEL_MTID, code_generator *generator, code_generation *gen,
+ text_stream *label_name)
+void Generators::place_label(code_generation *gen, text_stream *label_name) {
+ VOID_METHOD_CALL(gen->generator, PLACE_LABEL_MTID, gen, label_name);
+}
+void Generators::evaluate_label(code_generation *gen, text_stream *label_name) {
+ VOID_METHOD_CALL(gen->generator, EVALUATE_LABEL_MTID, gen, label_name);
+}
+
+@ The three ways to invoke:
+
+@e INVOKE_PRIMITIVE_MTID
+@e INVOKE_FUNCTION_MTID
+@e INVOKE_OPCODE_MTID
+
+=
+VOID_METHOD_TYPE(INVOKE_PRIMITIVE_MTID, code_generator *generator, code_generation *gen,
+ inter_symbol *prim_name, inter_tree_node *P, int void_context)
+VOID_METHOD_TYPE(INVOKE_FUNCTION_MTID, code_generator *generator, code_generation *gen,
+ inter_symbol *fn, inter_tree_node *P, int void_context)
+VOID_METHOD_TYPE(INVOKE_OPCODE_MTID, code_generator *generator, code_generation *gen,
+ text_stream *opcode, int operand_count, inter_tree_node **operands,
+ inter_tree_node *label, int label_sense, int void_context)
+void Generators::invoke_primitive(code_generation *gen, inter_symbol *prim_name,
+ inter_tree_node *P, int void_context) {
+ VOID_METHOD_CALL(gen->generator, INVOKE_PRIMITIVE_MTID, gen, prim_name, P, void_context);
+}
+void Generators::invoke_function(code_generation *gen, inter_symbol *fn, inter_tree_node *P,
+ int void_context) {
+ VOID_METHOD_CALL(gen->generator, INVOKE_FUNCTION_MTID, gen, fn, P, void_context);
+}
+void Generators::invoke_opcode(code_generation *gen, text_stream *opcode, int operand_count,
+ inter_tree_node **operands, inter_tree_node *label, int label_sense, int void_context) {
+ VOID_METHOD_CALL(gen->generator, INVOKE_OPCODE_MTID, gen, opcode, operand_count,
+ operands, label, label_sense, void_context);
+}
+
@
@e GENERAL_SEGMENT_MTID
@@ -157,18 +205,6 @@ void Generators::mangle(code_generation *gen, text_stream *OUT, text_stream *ide
@
-@e COMPILE_PRIMITIVE_MTID
-
-=
-INT_METHOD_TYPE(COMPILE_PRIMITIVE_MTID, code_generator *generator, code_generation *gen, inter_symbol *prim_name, inter_tree_node *P)
-int Generators::compile_primitive(code_generation *gen, inter_symbol *prim_name, inter_tree_node *P) {
- int rv = FALSE;
- INT_METHOD_CALL(rv, gen->generator, COMPILE_PRIMITIVE_MTID, gen, prim_name, P);
- return rv;
-}
-
-@
-
@e COMPILE_DICTIONARY_WORD_MTID
=
@@ -221,11 +257,13 @@ void Generators::declare_attribute(code_generation *gen, text_stream *prop_name)
@e PREPARE_VARIABLE_MTID
@e DECLARE_VARIABLE_MTID
+@e DECLARE_VARIABLES_MTID
@e EVALUATE_VARIABLE_MTID
=
INT_METHOD_TYPE(PREPARE_VARIABLE_MTID, code_generator *generator, code_generation *gen, inter_tree_node *P, inter_symbol *var_name, int k)
INT_METHOD_TYPE(DECLARE_VARIABLE_MTID, code_generator *generator, code_generation *gen, inter_tree_node *P, inter_symbol *var_name, int k, int of)
+VOID_METHOD_TYPE(DECLARE_VARIABLES_MTID, code_generator *generator, code_generation *gen, linked_list *L)
VOID_METHOD_TYPE(DECLARE_LOCAL_VARIABLE_MTID, code_generator *generator, code_generation *gen, inter_tree_node *P, inter_symbol *var_name)
VOID_METHOD_TYPE(EVALUATE_VARIABLE_MTID, code_generator *generator, code_generation *gen, inter_symbol *var_name, int as_reference)
int Generators::prepare_variable(code_generation *gen, inter_tree_node *P, inter_symbol *var_name, int k) {
@@ -238,12 +276,25 @@ int Generators::declare_variable(code_generation *gen, inter_tree_node *P, inter
INT_METHOD_CALL(rv, gen->generator, DECLARE_VARIABLE_MTID, gen, P, var_name, k, of);
return rv;
}
+void Generators::declare_variables(code_generation *gen, linked_list *L) {
+ VOID_METHOD_CALL(gen->generator, DECLARE_VARIABLES_MTID, gen, L);
+}
void Generators::evaluate_variable(code_generation *gen, inter_symbol *var_name, int as_reference) {
VOID_METHOD_CALL(gen->generator, EVALUATE_VARIABLE_MTID, gen, var_name, as_reference);
}
@
+@e PSEUDO_OBJECT_MTID
+
+=
+VOID_METHOD_TYPE(PSEUDO_OBJECT_MTID, code_generator *generator, code_generation *gen, text_stream *obj_name)
+void Generators::pseudo_object(code_generation *gen, text_stream *obj_name) {
+ VOID_METHOD_CALL(gen->generator, PSEUDO_OBJECT_MTID, gen, obj_name);
+}
+
+@
+
@e DECLARE_CLASS_MTID
@e END_CLASS_MTID
@e DECLARE_INSTANCE_MTID
@@ -318,13 +369,11 @@ void Generators::end_constant(code_generation *gen, text_stream *const_name, int
@e PREDECLARE_FUNCTION_MTID
@e DECLARE_FUNCTION_MTID
@e BEGIN_FUNCTION_CODE_MTID
-@e PLACE_LABEL_MTID
@e END_FUNCTION_MTID
=
VOID_METHOD_TYPE(PREDECLARE_FUNCTION_MTID, code_generator *generator, code_generation *gen, inter_symbol *fn, inter_tree_node *code)
VOID_METHOD_TYPE(DECLARE_FUNCTION_MTID, code_generator *generator, code_generation *gen, inter_symbol *fn, inter_tree_node *code)
-VOID_METHOD_TYPE(PLACE_LABEL_MTID, code_generator *generator, code_generation *gen, text_stream *label_name)
VOID_METHOD_TYPE(END_FUNCTION_MTID, code_generator *generator, int pass, code_generation *gen, inter_symbol *fn)
void Generators::predeclare_function(code_generation *gen, inter_symbol *fn, inter_tree_node *code) {
VOID_METHOD_CALL(gen->generator, PREDECLARE_FUNCTION_MTID, gen, fn, code);
@@ -332,40 +381,12 @@ void Generators::predeclare_function(code_generation *gen, inter_symbol *fn, int
void Generators::declare_function(code_generation *gen, inter_symbol *fn, inter_tree_node *code) {
VOID_METHOD_CALL(gen->generator, DECLARE_FUNCTION_MTID, gen, fn, code);
}
-void Generators::place_label(code_generation *gen, text_stream *label_name) {
- VOID_METHOD_CALL(gen->generator, PLACE_LABEL_MTID, gen, label_name);
-}
void Generators::end_function(int pass, code_generation *gen, inter_symbol *fn) {
VOID_METHOD_CALL(gen->generator, END_FUNCTION_MTID, pass, gen, fn);
}
@
-@e FUNCTION_CALL_MTID
-
-=
-VOID_METHOD_TYPE(FUNCTION_CALL_MTID, code_generator *generator, code_generation *gen, inter_symbol *fn, inter_tree_node *P, int argc)
-void Generators::function_call(code_generation *gen, inter_symbol *fn, inter_tree_node *P, int argc) {
- VOID_METHOD_CALL(gen->generator, FUNCTION_CALL_MTID, gen, fn, P, argc);
-}
-
-@
-
-@e ASSEMBLY_MTID
-
-=
-VOID_METHOD_TYPE(ASSEMBLY_MTID, code_generator *generator, code_generation *gen,
- text_stream *opcode, int operand_count, inter_tree_node **operands,
- inter_tree_node *label, int label_sense)
-
-void Generators::assembly(code_generation *gen, text_stream *opcode, int operand_count,
- inter_tree_node **operands, inter_tree_node *label, int label_sense) {
- VOID_METHOD_CALL(gen->generator, ASSEMBLY_MTID, gen, opcode, operand_count,
- operands, label, label_sense);
-}
-
-@
-
@e BEGIN_ARRAY_MTID
@e ARRAY_ENTRY_MTID
@e ARRAY_ENTRIES_MTID
diff --git a/inter/final-module/Chapter 2/The Vanilla Generator.w b/inter/final-module/Chapter 2/The Vanilla Generator.w
index 7a114823d..62b36bb10 100644
--- a/inter/final-module/Chapter 2/The Vanilla Generator.w
+++ b/inter/final-module/Chapter 2/The Vanilla Generator.w
@@ -15,6 +15,7 @@ be sent |END_GENERATION_MTID|.
void Vanilla::go(code_generation *gen) {
@;
@;
+ @;
@;
@;
@;
@@ -23,7 +24,6 @@ void Vanilla::go(code_generation *gen) {
@ =
gen->void_level = -1;
VanillaConstants::prepare(gen);
- VanillaVariables::prepare(gen);
VanillaObjects::prepare(gen);
@ =
@@ -39,6 +39,18 @@ void Vanilla::pragma(inter_tree *I, inter_tree_node *P, void *state) {
Generators::offer_pragma(gen, P, target_symbol->symbol_name, S);
}
+@ =
+ gen->global_variables = NEW_LINKED_LIST(inter_symbol);
+ InterTree::traverse(gen->from, Vanilla::gather_variables, gen, NULL, VARIABLE_IST);
+ Generators::declare_variables(gen, gen->global_variables);
+
+@ =
+void Vanilla::gather_variables(inter_tree *I, inter_tree_node *P, void *state) {
+ code_generation *gen = (code_generation *) state;
+ inter_symbol *var_name = InterSymbolsTables::symbol_from_frame_data(P, DEFN_VAR_IFLD);
+ ADD_TO_LINKED_LIST(var_name, inter_symbol, gen->global_variables);
+}
+
@ =
InterTree::traverse(gen->from, Vanilla::predeclare_functions, gen, NULL, -PACKAGE_IST);
@@ -96,7 +108,6 @@ void Vanilla::iterate(inter_tree *I, inter_tree_node *P, void *state) {
}
@ =
- VanillaVariables::consolidate(gen);
VanillaConstants::consolidate(gen);
VanillaObjects::consolidate(gen);
@@ -123,9 +134,8 @@ It is so often used recursively that the following abbreviation macros are helpf
void Vanilla::node(code_generation *gen, inter_tree_node *P) {
switch (P->W.data[ID_IFLD]) {
case CONSTANT_IST: VanillaConstants::constant(gen, P); break;
- case VARIABLE_IST: VanillaVariables::variable(gen, P); break;
case INSTANCE_IST: VanillaObjects::instance(gen, P); break;
- case SPLAT_IST: VanillaCode::splat(gen, P); break;
+ case PROPERTYVALUE_IST: VanillaObjects::propertyvalue(gen, P); break;
case LABEL_IST: VanillaCode::label(gen, P); break;
case CODE_IST: VanillaCode::code(gen, P); break;
case EVALUATION_IST: VanillaCode::evaluation(gen, P); break;
@@ -136,8 +146,9 @@ void Vanilla::node(code_generation *gen, inter_tree_node *P) {
case VAL_IST: VanillaCode::val_or_ref(gen, P, FALSE); break;
case REF_IST: VanillaCode::val_or_ref(gen, P, TRUE); break;
case LAB_IST: VanillaCode::lab(gen, P); break;
- case PROPERTYVALUE_IST: VanillaObjects::propertyvalue(gen, P); break;
+ case SPLAT_IST: Vanilla::splat(gen, P); break;
+ case VARIABLE_IST: break;
case SYMBOL_IST: break;
case LOCAL_IST: break;
case NOP_IST: break;
@@ -148,3 +159,37 @@ void Vanilla::node(code_generation *gen, inter_tree_node *P) {
internal_error("unexpected node type in Inter tree");
}
}
+
+@ |splat| nodes are the joker in the pack. They copy material verbatim to the
+output, regardless of the language being generated. (In practice, of course, this
+means that the content of a |splat| must carefully have been pre-generated in
+the right format.) Inform uses such nodes as little as it possibly can.
+
+A wrinkle, though, is that the special |URL_SYMBOL_CHAR| is used to mark out
+a URL for a symbol in the Inter tree: this is replaced with its properly
+generated name. So a splat is not quite generator-independent after all.
+
+@d URL_SYMBOL_CHAR 0x00A7
+
+=
+void Vanilla::splat(code_generation *gen, inter_tree_node *P) {
+ text_stream *OUT = CodeGen::current(gen);
+ inter_tree *I = gen->from;
+ text_stream *S =
+ Inter::Warehouse::get_text(InterTree::warehouse(I), P->W.data[MATTER_SPLAT_IFLD]);
+ int L = Str::len(S);
+ for (int i=0; ivoid_level = old_level;
}
-void VanillaCode::block(code_generation *gen, inter_tree_node *P) {
- VNODE_ALLC;
-}
+void VanillaCode::block(code_generation *gen, inter_tree_node *P) { VNODE_ALLC; }
+void VanillaCode::evaluation(code_generation *gen, inter_tree_node *P) { VNODE_ALLC; }
+void VanillaCode::reference(code_generation *gen, inter_tree_node *P) { VNODE_ALLC; }
+void VanillaCode::cast(code_generation *gen, inter_tree_node *P) { VNODE_ALLC; }
-void VanillaCode::evaluation(code_generation *gen, inter_tree_node *P) {
- VNODE_ALLC;
-}
-
-void VanillaCode::reference(code_generation *gen, inter_tree_node *P) {
- VNODE_ALLC;
-}
-
-void VanillaCode::cast(code_generation *gen, inter_tree_node *P) {
- VNODE_ALLC;
-}
-
-@
-
-@d URL_SYMBOL_CHAR 0x00A7
+@ As with assembly language, Inter can contain positional markers called labels.
+These we offer to the generator to deal with as it likes:
=
-void VanillaCode::splat(code_generation *gen, inter_tree_node *P) {
- text_stream *OUT = CodeGen::current(gen);
- inter_tree *I = gen->from;
- text_stream *S = Inter::Warehouse::get_text(InterTree::warehouse(I), P->W.data[MATTER_SPLAT_IFLD]);
- int L = Str::len(S);
- for (int i=0; iW.data[DEFN_LABEL_IFLD]);
+ inter_symbol *lab_name =
+ InterSymbolsTables::local_symbol_from_id(pack, P->W.data[DEFN_LABEL_IFLD]);
Generators::place_label(gen, lab_name->symbol_name);
}
-void VanillaCode::lab(code_generation *gen, inter_tree_node *P) {
- inter_package *pack = Inter::Packages::container(P);
- inter_symbol *lab = InterSymbolsTables::local_symbol_from_id(pack, P->W.data[LABEL_LAB_IFLD]);
- if (lab == NULL) internal_error("bad lab");
- text_stream *OUT = CodeGen::current(gen);
- text_stream *S = VanillaConstants::name(lab);
- LOOP_THROUGH_TEXT(pos, S)
- if (Str::get(pos) != '.')
- PUT(Str::get(pos));
-}
-
-void VanillaCode::val_or_ref(code_generation *gen, inter_tree_node *P, int ref) {
- inter_symbol *val_kind = InterSymbolsTables::symbol_from_frame_data(P, KIND_VAL_IFLD);
- if (val_kind) {
- inter_ti val1 = P->W.data[VAL1_VAL_IFLD];
- inter_ti val2 = P->W.data[VAL2_VAL_IFLD];
- if (Inter::Symbols::is_stored_in_data(val1, val2)) {
- inter_package *pack = Inter::Packages::container(P);
- inter_symbol *symb = InterSymbolsTables::local_symbol_from_id(pack, val2);
- if (symb == NULL) symb = InterSymbolsTables::symbol_from_id(Inter::Packages::scope_of(P), val2);
- if (symb == NULL) internal_error("bad val");
- if ((Str::eq(VanillaConstants::name(symb), I"self")) ||
- ((symb->definition) &&
- (symb->definition->W.data[ID_IFLD] == VARIABLE_IST))) {
- Generators::evaluate_variable(gen, symb, (P->W.data[ID_IFLD] == REF_IST)?TRUE:FALSE);
- } else {
- text_stream *OUT = CodeGen::current(gen);
- Generators::mangle(gen, OUT, VanillaConstants::name(symb));
- }
- return;
- }
- switch (val1) {
- case UNDEF_IVAL:
- internal_error("value undefined");
- case LITERAL_IVAL:
- case LITERAL_TEXT_IVAL:
- case GLOB_IVAL:
- case DWORD_IVAL:
- case REAL_IVAL:
- case PDWORD_IVAL:
- VanillaConstants::literal(gen, NULL, NULL, val1, val2, FALSE);
- return;
- }
- }
- internal_error("bad val");
-}
-
-@
+@ There are three ways to perform an invocation. One of the three, assembly
+language, can only in fact occur in void context, but we won't assume that here.
@d MAX_OPERANDS_IN_INTER_ASSEMBLY 32
=
void VanillaCode::inv(code_generation *gen, inter_tree_node *P) {
- text_stream *OUT = CodeGen::current(gen);
- int suppress_terminal_semicolon = FALSE;
-
+ int void_context = FALSE;
+ if (Inter::Defn::get_level(P) == gen->void_level) void_context = TRUE;
switch (P->W.data[METHOD_INV_IFLD]) {
- case INVOKED_PRIMITIVE: {
- inter_symbol *prim = Inter::Inv::invokee(P);
- if (prim == NULL) internal_error("bad prim");
- suppress_terminal_semicolon = Generators::compile_primitive(gen, prim, P);
- break;
- }
- case INVOKED_ROUTINE: {
- inter_symbol *routine = InterSymbolsTables::symbol_from_frame_data(P, INVOKEE_INV_IFLD);
- if (routine == NULL) internal_error("bad routine");
- int argc = 0;
- LOOP_THROUGH_INTER_CHILDREN(F, P) argc++;
- Generators::function_call(gen, routine, P, argc);
- break;
- }
- case INVOKED_OPCODE: {
- inter_ti ID = P->W.data[INVOKEE_INV_IFLD];
- text_stream *S = Inode::ID_to_text(P, ID);
- inter_tree_node *operands[MAX_OPERANDS_IN_INTER_ASSEMBLY], *label = NULL;
- int operand_count = 0;
- int label_sense = NOT_APPLICABLE;
- LOOP_THROUGH_INTER_CHILDREN(F, P) {
- if (F->W.data[ID_IFLD] == VAL_IST) {
- inter_ti val1 = F->W.data[VAL1_VAL_IFLD];
- inter_ti val2 = F->W.data[VAL2_VAL_IFLD];
- if (Inter::Symbols::is_stored_in_data(val1, val2)) {
- inter_symbol *symb = InterSymbolsTables::symbol_from_id(Inter::Packages::scope_of(F), val2);
- if ((symb) && (Str::eq(symb->symbol_name, I"__assembly_negated_label"))) {
- label_sense = FALSE;
- continue;
- }
- }
- }
- if (F->W.data[ID_IFLD] == LAB_IST) {
- if (label_sense == NOT_APPLICABLE) label_sense = TRUE;
- label = F; continue;
- }
- operands[operand_count++] = F;
- }
- Generators::assembly(gen, S, operand_count, operands, label, label_sense);
- break;
- }
- default: internal_error("bad inv");
+ case INVOKED_PRIMITIVE: @; break;
+ case INVOKED_ROUTINE: @; break;
+ case INVOKED_OPCODE: @; break;
+ default: internal_error("unknown invocation method");
}
- if ((Inter::Defn::get_level(P) == gen->void_level) &&
- (suppress_terminal_semicolon == FALSE)) WRITE(";\n");
}
+@ =
+ inter_symbol *primitive_s = Inter::Inv::invokee(P);
+ if (primitive_s == NULL) internal_error("no primitive");
+ Generators::invoke_primitive(gen, primitive_s, P, void_context);
+
+@ =
+ inter_symbol *function_s = Inter::Inv::invokee(P);
+ if (function_s == NULL) internal_error("no function");
+ Generators::invoke_function(gen, function_s, P, void_context);
+
+@ =
+ inter_ti ID = P->W.data[INVOKEE_INV_IFLD];
+ text_stream *opcode_name = Inode::ID_to_text(P, ID);
+ inter_tree_node *operands[MAX_OPERANDS_IN_INTER_ASSEMBLY], *label = NULL;
+ int operand_count = 0;
+ int label_sense = NOT_APPLICABLE;
+ @;
+ Generators::invoke_opcode(gen, opcode_name, operand_count, operands, label,
+ label_sense, void_context);
+
+@ Unusually, opcode invocations do not work by recursing down through the tree
+to pick up the operands implicitly: instead we gather them into a small array.
+This is because of the slightly clumsy way in which labels are represented in
+Inter assembly, which we want to take care of here, so that generators don't
+need to.
+
+@ =
+ LOOP_THROUGH_INTER_CHILDREN(F, P) {
+ if (F->W.data[ID_IFLD] == VAL_IST) {
+ inter_ti val1 = F->W.data[VAL1_VAL_IFLD];
+ inter_ti val2 = F->W.data[VAL2_VAL_IFLD];
+ if (Inter::Symbols::is_stored_in_data(val1, val2)) {
+ inter_symbol *symb =
+ InterSymbolsTables::symbol_from_id(Inter::Packages::scope_of(F), val2);
+ if ((symb) && (Str::eq(symb->symbol_name, I"__assembly_negated_label"))) {
+ label_sense = FALSE;
+ continue;
+ }
+ }
+ }
+ if (F->W.data[ID_IFLD] == LAB_IST) {
+ if (label_sense == NOT_APPLICABLE) label_sense = TRUE;
+ label = F; continue;
+ }
+ if (operand_count < MAX_OPERANDS_IN_INTER_ASSEMBLY)
+ operands[operand_count++] = F;
+ }
+
+@ If they are not further invocations or code blocks, for which see above, the
+nodes under an invocation will be |val|, |ref| or |lab|.
+
+A |ref| can be to a variable; a |val| can be to a named constant, a variable
+or a literal. The special |self| symbol, which has no definition, counts as
+a variable here.
+
+=
+void VanillaCode::val_or_ref(code_generation *gen, inter_tree_node *P, int ref) {
+ inter_ti val1 = P->W.data[VAL1_VAL_IFLD];
+ inter_ti val2 = P->W.data[VAL2_VAL_IFLD];
+ if (Inter::Symbols::is_stored_in_data(val1, val2)) {
+ inter_package *pack = Inter::Packages::container(P);
+ inter_symbol *named_s =
+ InterSymbolsTables::local_symbol_from_id(pack, val2);
+ if (named_s == NULL) named_s =
+ InterSymbolsTables::symbol_from_id(Inter::Packages::scope_of(P), val2);
+ if (named_s == NULL) internal_error("unknown constant in val/ref in Inter tree");
+ if ((Str::eq(CodeGen::name(named_s), I"self")) ||
+ ((named_s->definition) &&
+ (named_s->definition->W.data[ID_IFLD] == VARIABLE_IST))) {
+ Generators::evaluate_variable(gen, named_s, ref);
+ } else {
+// if (ref) internal_error("named constant as ref in Inter tree");
+ VanillaConstants::nonliteral(gen, named_s);
+ }
+ } else switch (val1) {
+ case UNDEF_IVAL: internal_error("undef val/ref in Inter tree");
+ case LITERAL_IVAL:
+ case LITERAL_TEXT_IVAL:
+ case GLOB_IVAL:
+ case DWORD_IVAL:
+ case REAL_IVAL:
+ case PDWORD_IVAL:
+ if (ref) internal_error("literal constant as ref in Inter tree");
+ VanillaConstants::literal(gen, NULL, NULL, val1, val2, FALSE);
+ break;
+ default: internal_error("unknown ival field in val/ref in Inter tree");
+ }
+}
+
+@ A |lab| works on a named label, which will be defined somewhere in the same
+function body.
+
+=
+void VanillaCode::lab(code_generation *gen, inter_tree_node *P) {
+ inter_package *pack = Inter::Packages::container(P);
+ inter_symbol *label_s =
+ InterSymbolsTables::local_symbol_from_id(pack, P->W.data[LABEL_LAB_IFLD]);
+ if (label_s == NULL) internal_error("unknown label in lab in Inter tree");
+ Generators::evaluate_label(gen, label_s->symbol_name);
+}
diff --git a/inter/final-module/Chapter 2/Vanilla Constants.w b/inter/final-module/Chapter 2/Vanilla Constants.w
index 9c2d128c5..bf5a642ce 100644
--- a/inter/final-module/Chapter 2/Vanilla Constants.w
+++ b/inter/final-module/Chapter 2/Vanilla Constants.w
@@ -28,26 +28,7 @@ void VanillaConstants::constant(code_generation *gen, inter_tree_node *P) {
}
}
-int the_quartet_found = FALSE;
-int box_mode = FALSE, printing_mode = FALSE;
-
void VanillaConstants::prepare(code_generation *gen) {
- the_quartet_found = FALSE;
- box_mode = FALSE; printing_mode = FALSE;
- InterTree::traverse(gen->from, VanillaConstants::quartet_visitor, NULL, NULL, CONSTANT_IST);
-}
-
-void VanillaConstants::quartet_visitor(inter_tree *I, inter_tree_node *P, void *state) {
- inter_symbol *con_name = InterSymbolsTables::symbol_from_frame_data(P, DEFN_CONST_IFLD);
- if ((Str::eq(con_name->symbol_name, I"thedark")) ||
- (Str::eq(con_name->symbol_name, I"InformLibrary")) ||
- (Str::eq(con_name->symbol_name, I"InformParser")) ||
- (Str::eq(con_name->symbol_name, I"Compass")))
- the_quartet_found = TRUE;
-}
-
-int VanillaConstants::quartet_present(void) {
- return the_quartet_found;
}
@ There's a contrivance here to get around an awkward point of I6 syntax:
@@ -93,7 +74,9 @@ void VanillaConstants::constant_inner(code_generation *gen, inter_tree_node *P)
(Str::eq(con_name->symbol_name, I"cap_short_name")))
ifndef_me = TRUE;
- if (Inter::Symbols::read_annotation(con_name, OBJECT_IANN) > 0) return;
+ if (Inter::Symbols::read_annotation(con_name, OBJECT_IANN) > 0) {
+ return;
+ }
if (Str::eq(con_name->symbol_name, I"UUID_ARRAY")) {
inter_ti ID = P->W.data[DATA_CONST_IFLD];
@@ -128,9 +111,9 @@ void VanillaConstants::constant_inner(code_generation *gen, inter_tree_node *P)
case CONSTANT_INDIRECT_TEXT: {
inter_ti ID = P->W.data[DATA_CONST_IFLD];
text_stream *S = Inode::ID_to_text(P, ID);
- if (Generators::begin_constant(gen, VanillaConstants::name(con_name), con_name, P, TRUE, FALSE)) {
+ if (Generators::begin_constant(gen, CodeGen::name(con_name), con_name, P, TRUE, FALSE)) {
Generators::compile_literal_text(gen, S, FALSE, FALSE, FALSE);
- Generators::end_constant(gen, VanillaConstants::name(con_name), FALSE);
+ Generators::end_constant(gen, CodeGen::name(con_name), FALSE);
}
break;
}
@@ -146,7 +129,7 @@ void VanillaConstants::constant_inner(code_generation *gen, inter_tree_node *P)
}
if (Inter::Symbols::read_annotation(con_name, BUFFERARRAY_IANN) == 1)
format = BUFFER_ARRAY_FORMAT;
- if (Generators::begin_array(gen, VanillaConstants::name(con_name), con_name, P, format)) {
+ if (Generators::begin_array(gen, CodeGen::name(con_name), con_name, P, format)) {
if (hang_one) Generators::array_entry(gen, I"1", format);
int entry_count = 0;
for (int i=DATA_CONST_IFLD; iW.extent; i=i+2)
@@ -159,7 +142,7 @@ void VanillaConstants::constant_inner(code_generation *gen, inter_tree_node *P)
e = VanillaConstants::evaluate(gen, Inter::Packages::scope_of(P), val1, val2, &ips);
}
if (e > 1) {
- LOG("Entry count 1 on %S masks %d blanks\n", VanillaConstants::name(con_name), e);
+ LOG("Entry count 1 on %S masks %d blanks\n", CodeGen::name(con_name), e);
Generators::array_entries(gen, (int) e, ips, format);
} else {
for (int i=DATA_CONST_IFLD; iW.extent; i=i+2) {
@@ -190,7 +173,7 @@ void VanillaConstants::constant_inner(code_generation *gen, inter_tree_node *P)
}
generated_segment *saved = CodeGen::select(gen, Generators::basic_constant_segment(gen, con_name, depth));
text_stream *OUT = CodeGen::current(gen);
- if (Generators::begin_constant(gen, VanillaConstants::name(con_name), con_name, P, TRUE, FALSE)) {
+ if (Generators::begin_constant(gen, CodeGen::name(con_name), con_name, P, TRUE, FALSE)) {
WRITE("(");
for (int i=DATA_CONST_IFLD; iW.extent; i=i+2) {
if (i>DATA_CONST_IFLD) {
@@ -206,7 +189,7 @@ void VanillaConstants::constant_inner(code_generation *gen, inter_tree_node *P)
if (bracket) WRITE(")");
}
WRITE(")");
- Generators::end_constant(gen, VanillaConstants::name(con_name), FALSE);
+ Generators::end_constant(gen, CodeGen::name(con_name), FALSE);
}
CodeGen::deselect(gen, saved);
break;
@@ -216,11 +199,11 @@ void VanillaConstants::constant_inner(code_generation *gen, inter_tree_node *P)
if (depth > 1) LOGIF(CONSTANT_DEPTH_CALCULATION,
"Con %S has depth %d\n", con_name->symbol_name, depth);
generated_segment *saved = CodeGen::select(gen, Generators::basic_constant_segment(gen, con_name, depth));
- if (Generators::begin_constant(gen, VanillaConstants::name(con_name), con_name, P, TRUE, ifndef_me)) {
+ if (Generators::begin_constant(gen, CodeGen::name(con_name), con_name, P, TRUE, ifndef_me)) {
inter_ti val1 = P->W.data[DATA_CONST_IFLD];
inter_ti val2 = P->W.data[DATA_CONST_IFLD + 1];
VanillaConstants::literal(gen, con_name, Inter::Packages::scope_of(P), val1, val2, FALSE);
- Generators::end_constant(gen, VanillaConstants::name(con_name), ifndef_me);
+ Generators::end_constant(gen, CodeGen::name(con_name), ifndef_me);
}
CodeGen::deselect(gen, saved);
break;
@@ -277,7 +260,7 @@ void VanillaConstants::val_to_text(code_generation *gen, inter_bookmark *IBM, in
inter_symbol *symb = InterSymbolsTables::symbol_from_data_pair_and_table(
val1, val2, Inter::Bookmarks::scope(IBM));
if (symb == NULL) internal_error("bad symbol");
- Generators::mangle(gen, OUT, VanillaConstants::name(symb));
+ Generators::mangle(gen, OUT, CodeGen::name(symb));
} else {
switch (val1) {
case UNDEF_IVAL:
@@ -335,20 +318,20 @@ void VanillaConstants::consolidate(code_generation *gen) {
}
}
-void VanillaConstants::enter_box_mode(void) {
- box_mode = TRUE;
+void VanillaConstants::enter_box_mode(code_generation *gen) {
+ gen->literal_text_mode = 1;
}
-void VanillaConstants::exit_box_mode(void) {
- box_mode = FALSE;
+void VanillaConstants::exit_box_mode(code_generation *gen) {
+ gen->literal_text_mode = 0;
}
-void VanillaConstants::enter_print_mode(void) {
- printing_mode = TRUE;
+void VanillaConstants::enter_print_mode(code_generation *gen) {
+ gen->literal_text_mode = 2;
}
-void VanillaConstants::exit_print_mode(void) {
- printing_mode = FALSE;
+void VanillaConstants::exit_print_mode(code_generation *gen) {
+ gen->literal_text_mode = 0;
}
inter_ti VanillaConstants::evaluate(code_generation *gen, inter_symbols_table *T, inter_ti val1, inter_ti val2, int *ips) {
@@ -364,7 +347,7 @@ inter_ti VanillaConstants::evaluate(code_generation *gen, inter_symbols_table *T
inter_ti dval2 = D->W.data[DATA_CONST_IFLD + 1];
inter_ti e = VanillaConstants::evaluate(gen, Inter::Packages::scope_of(D), dval1, dval2, ips);
if (e == 0) {
- text_stream *S = VanillaConstants::name(aliased);
+ text_stream *S = CodeGen::name(aliased);
if (Str::eq(S, I"INDIV_PROP_START")) *ips = TRUE;
}
LOG("Eval const $3 = %d\n", aliased, e);
@@ -392,6 +375,11 @@ inter_ti VanillaConstants::evaluate(code_generation *gen, inter_symbols_table *T
return 0;
}
+void VanillaConstants::nonliteral(code_generation *gen, inter_symbol *con_name) {
+ text_stream *OUT = CodeGen::current(gen);
+ Generators::mangle(gen, OUT, CodeGen::name(con_name));
+}
+
void VanillaConstants::literal(code_generation *gen, inter_symbol *con_name, inter_symbols_table *T, inter_ti val1, inter_ti val2, int unsub) {
inter_tree *I = gen->from;
text_stream *OUT = CodeGen::current(gen);
@@ -417,19 +405,14 @@ void VanillaConstants::literal(code_generation *gen, inter_symbol *con_name, int
Generators::compile_dictionary_word(gen, glob_text, TRUE);
} else if (val1 == LITERAL_TEXT_IVAL) {
text_stream *glob_text = Inter::Warehouse::get_text(InterTree::warehouse(I), val2);
- Generators::compile_literal_text(gen, glob_text, printing_mode, box_mode, TRUE);
+ Generators::compile_literal_text(gen, glob_text, (gen->literal_text_mode == 2)?TRUE:FALSE,
+ (gen->literal_text_mode == 1)?TRUE:FALSE, TRUE);
} else if (val1 == GLOB_IVAL) {
text_stream *glob_text = Inter::Warehouse::get_text(InterTree::warehouse(I), val2);
WRITE("%S", glob_text);
} else internal_error("unimplemented direct constant");
}
-text_stream *VanillaConstants::name(inter_symbol *symb) {
- if (symb == NULL) return NULL;
- if (Inter::Symbols::get_translate(symb)) return Inter::Symbols::get_translate(symb);
- return symb->symbol_name;
-}
-
@ =
int VanillaConstants::node_is_ref_to(inter_tree *I, inter_tree_node *P, inter_ti seek_bip) {
int reffed = FALSE;
diff --git a/inter/final-module/Chapter 2/Vanilla Objects.w b/inter/final-module/Chapter 2/Vanilla Objects.w
index 821ee11e0..319d6ca2d 100644
--- a/inter/final-module/Chapter 2/Vanilla Objects.w
+++ b/inter/final-module/Chapter 2/Vanilla Objects.w
@@ -59,8 +59,7 @@ void VanillaObjects::propertyvalue(code_generation *gen, inter_tree_node *P) {
void VanillaObjects::consolidate(code_generation *gen) {
if (properties_written == FALSE) {
- if (VanillaConstants::quartet_present())
- Generators::world_model_essentials(gen);
+ InterTree::traverse(gen->from, VanillaObjects::pseudo_object_visitor, gen, NULL, CONSTANT_IST);
generated_segment *saved = CodeGen::select(gen, Generators::default_segment(gen));
VanillaObjects::knowledge(gen);
CodeGen::deselect(gen, saved);
@@ -68,6 +67,13 @@ void VanillaObjects::consolidate(code_generation *gen) {
}
}
+void VanillaObjects::pseudo_object_visitor(inter_tree *I, inter_tree_node *P, void *state) {
+ code_generation *gen = (code_generation *) state;
+ inter_symbol *con_name = InterSymbolsTables::symbol_from_frame_data(P, DEFN_CONST_IFLD);
+ if (Inter::Symbols::read_annotation(con_name, OBJECT_IANN) > 0)
+ Generators::pseudo_object(gen, CodeGen::name(con_name));
+}
+
@h Representing instances in I6.
Partly for historical reasons, partly to squeeze performance out of the
virtual machines used in traditional parser IF, the I6 run-time
@@ -244,11 +250,11 @@ in the I6 template, or some extension), and we therefore do nothing.
generated_segment *saved = CodeGen::select(gen, Generators::basic_constant_segment(gen, prop_name, 1));
if (Inter::Symbols::read_annotation(prop_name, ASSIMILATED_IANN) >= 0) {
text_stream *A = Inter::Symbols::get_translate(prop_name);
- if (A == NULL) A = VanillaConstants::name(prop_name);
+ if (A == NULL) A = CodeGen::name(prop_name);
Generators::declare_attribute(gen, A);
} else {
if (translated == FALSE)
- Generators::declare_attribute(gen, VanillaConstants::name(prop_name));
+ Generators::declare_attribute(gen, CodeGen::name(prop_name));
}
CodeGen::deselect(gen, saved);
@@ -275,7 +281,7 @@ compiles an I6 constant for this value.
FBNA_found = TRUE;
generated_segment *saved = CodeGen::select(gen, Generators::constant_segment(gen));
Generators::begin_constant(gen, I"FBNA_PROP_NUMBER", NULL, NULL, TRUE, FALSE);
- Generators::mangle(gen, CodeGen::current(gen), VanillaConstants::name(prop_name));
+ Generators::mangle(gen, CodeGen::current(gen), CodeGen::name(prop_name));
Generators::end_constant(gen, I"FBNA_PROP_NUMBER", FALSE);
CodeGen::deselect(gen, saved);
}
@@ -428,7 +434,7 @@ bother to force them.)
if (Inter::Symbols::get_flag(prop_name, ATTRIBUTE_MARK_BIT) == FALSE) {
inter_symbol *kind_name = Inter::Property::kind_of(prop_name);
if (kind_name == truth_state_kind_symbol) {
- Generators::assign_property(gen, VanillaConstants::name(prop_name), I"0", FALSE);
+ Generators::assign_property(gen, CodeGen::name(prop_name), I"0", FALSE);
}
}
}
@@ -469,7 +475,7 @@ property usage is legal.
inter_symbol *kind_name = kinds_in_source_order[i];
if (VanillaObjects::is_kind_of_object(kind_name)) {
inter_symbol *super_name = Inter::Kind::super(kind_name);
- Generators::mangled_array_entry(gen, VanillaConstants::name(kind_name), WORD_ARRAY_FORMAT);
+ Generators::mangled_array_entry(gen, CodeGen::name(kind_name), WORD_ARRAY_FORMAT);
if ((super_name) && (super_name != object_kind_symbol)) {
TEMPORARY_TEXT(N);
WRITE_TO(N, "%d", VanillaObjects::kind_of_object_count(super_name));
@@ -626,11 +632,11 @@ just to force the property into being.
if (prop_name == NULL) internal_error("no property");
if (CodeGen::marked(prop_name) == FALSE) {
CodeGen::mark(prop_name);
- text_stream *call_it = VanillaConstants::name(prop_name);
+ text_stream *call_it = CodeGen::name(prop_name);
if (X->W.data[STORAGE_PERM_IFLD]) {
inter_symbol *store = InterSymbolsTables::symbol_from_frame_data(X, STORAGE_PERM_IFLD);
if (store == NULL) internal_error("bad PP in inter");
- Generators::assign_mangled_property(gen, call_it, VanillaConstants::name(store), FALSE);
+ Generators::assign_mangled_property(gen, call_it, CodeGen::name(store), FALSE);
} else {
TEMPORARY_TEXT(ident)
kov_value_stick *kvs = CREATE(kov_value_stick);
@@ -714,13 +720,13 @@ because I6 doesn't allow function calls in a constant context.
(VanillaObjects::is_kind_of_object(kind_name))) {
text_stream *super_class = NULL;
inter_symbol *super_name = Inter::Kind::super(kind_name);
- if (super_name) super_class = VanillaConstants::name(super_name);
- Generators::declare_class(gen, VanillaConstants::name(kind_name), Metadata::read_optional_textual(Inter::Packages::container(kind_name->definition), I"^printed_name"), super_class);
+ if (super_name) super_class = CodeGen::name(super_name);
+ Generators::declare_class(gen, CodeGen::name(kind_name), Metadata::read_optional_textual(Inter::Packages::container(kind_name->definition), I"^printed_name"), super_class);
VanillaObjects::append(gen, kind_name);
inter_node_list *FL =
Inter::Warehouse::get_frame_list(InterTree::warehouse(I), Inter::Kind::properties_list(kind_name));
VanillaObjects::plist(gen, FL);
- Generators::end_class(gen, VanillaConstants::name(kind_name));
+ Generators::end_class(gen, CodeGen::name(kind_name));
}
}
@@ -760,9 +766,9 @@ though this won't happen for any property created by I7 source text.
for (int p=0; p;
@;
Generators::mangled_array_entry(gen, I"NULL", WORD_ARRAY_FORMAT);
@@ -801,7 +807,7 @@ linearly with the size of the source text, even though $N$ does.
@ =
for (int e=0; eW.data[DVAL1_PVAL_IFLD] == LITERAL_IVAL) &&
(X->W.data[DVAL2_PVAL_IFLD] == 0)) {
@@ -1031,7 +1037,7 @@ void VanillaObjects::append(code_generation *gen, inter_symbol *symb) {
PUT_TO(T, c);
}
inter_symbol *symb = InterSymbolsTables::url_name_to_symbol(I, NULL, T);
- WRITE("%S", VanillaConstants::name(symb));
+ WRITE("%S", CodeGen::name(symb));
DISCARD_TEXT(T)
} else PUT(c);
if ((c == '\n') && (i != Str::len(S)-1)) WRITE(" ");
diff --git a/inter/final-module/Chapter 2/Vanilla Variables.w b/inter/final-module/Chapter 2/Vanilla Variables.w
deleted file mode 100644
index 3c49a6585..000000000
--- a/inter/final-module/Chapter 2/Vanilla Variables.w
+++ /dev/null
@@ -1,34 +0,0 @@
-[VanillaVariables::] Vanilla Variables.
-
-How the vanilla code generation strategy handles variables.
-
-@ =
-int variables_written = FALSE, prepare_counter = 0, knowledge_counter = 0;
-void VanillaVariables::prepare(code_generation *gen) {
- variables_written = FALSE;
- prepare_counter = 0;
- knowledge_counter = 0;
- InterTree::traverse(gen->from, VanillaVariables::visitor1, gen, NULL, VARIABLE_IST);
-}
-
-void VanillaVariables::visitor1(inter_tree *I, inter_tree_node *P, void *state) {
- code_generation *gen = (code_generation *) state;
- inter_symbol *var_name = InterSymbolsTables::symbol_from_frame_data(P, DEFN_VAR_IFLD);
- prepare_counter = Generators::prepare_variable(gen, P, var_name, prepare_counter);
-}
-
-void VanillaVariables::variable(code_generation *gen, inter_tree_node *P) {
- if (variables_written == FALSE) {
- variables_written = TRUE;
- InterTree::traverse(gen->from, VanillaVariables::visitor2, gen, NULL, VARIABLE_IST);
- }
-}
-
-void VanillaVariables::visitor2(inter_tree *I, inter_tree_node *P, void *state) {
- code_generation *gen = (code_generation *) state;
- inter_symbol *var_name = InterSymbolsTables::symbol_from_frame_data(P, DEFN_VAR_IFLD);
- knowledge_counter = Generators::declare_variable(gen, P, var_name, knowledge_counter, prepare_counter);
-}
-
-void VanillaVariables::consolidate(code_generation *gen) {
-}
diff --git a/inter/final-module/Chapter 4/Final Inform 6.w b/inter/final-module/Chapter 4/Final Inform 6.w
index 3f95c1a13..35f81dbd4 100644
--- a/inter/final-module/Chapter 4/Final Inform 6.w
+++ b/inter/final-module/Chapter 4/Final Inform 6.w
@@ -74,7 +74,7 @@ void I6Target::create_generator(void) {
METHOD_ADD(cgt, DEFAULT_SEGMENT_MTID, I6Target::default_segment);
METHOD_ADD(cgt, BASIC_CONSTANT_SEGMENT_MTID, I6Target::basic_constant_segment);
METHOD_ADD(cgt, CONSTANT_SEGMENT_MTID, I6Target::constant_segment);
- METHOD_ADD(cgt, COMPILE_PRIMITIVE_MTID, I6Target::compile_primitive);
+ METHOD_ADD(cgt, INVOKE_PRIMITIVE_MTID, I6Target::invoke_primitive);
METHOD_ADD(cgt, MANGLE_IDENTIFIER_MTID, I6Target::mangle);
METHOD_ADD(cgt, COMPILE_DICTIONARY_WORD_MTID, I6Target::compile_dictionary_word);
METHOD_ADD(cgt, COMPILE_LITERAL_NUMBER_MTID, I6Target::compile_literal_number);
@@ -83,8 +83,7 @@ void I6Target::create_generator(void) {
METHOD_ADD(cgt, DECLARE_PROPERTY_MTID, I6Target::declare_property);
METHOD_ADD(cgt, DECLARE_ATTRIBUTE_MTID, I6Target::declare_attribute);
METHOD_ADD(cgt, PROPERTY_OFFSET_MTID, I6Target::property_offset);
- METHOD_ADD(cgt, PREPARE_VARIABLE_MTID, I6Target::prepare_variable);
- METHOD_ADD(cgt, DECLARE_VARIABLE_MTID, I6Target::declare_variable);
+ METHOD_ADD(cgt, DECLARE_VARIABLES_MTID, I6Target::declare_variables);
METHOD_ADD(cgt, EVALUATE_VARIABLE_MTID, I6Target::evaluate_variable);
METHOD_ADD(cgt, DECLARE_CLASS_MTID, I6Target::declare_class);
METHOD_ADD(cgt, END_CLASS_MTID, I6Target::end_class);
@@ -96,8 +95,9 @@ void I6Target::create_generator(void) {
METHOD_ADD(cgt, END_CONSTANT_MTID, I6Target::end_constant);
METHOD_ADD(cgt, DECLARE_FUNCTION_MTID, I6Target::declare_function);
METHOD_ADD(cgt, PLACE_LABEL_MTID, I6Target::place_label);
- METHOD_ADD(cgt, FUNCTION_CALL_MTID, I6Target::function_call);
- METHOD_ADD(cgt, ASSEMBLY_MTID, I6Target::assembly);
+ METHOD_ADD(cgt, EVALUATE_LABEL_MTID, I6Target::evaluate_label);
+ METHOD_ADD(cgt, INVOKE_FUNCTION_MTID, I6Target::invoke_function);
+ METHOD_ADD(cgt, INVOKE_OPCODE_MTID, I6Target::invoke_opcode);
METHOD_ADD(cgt, BEGIN_ARRAY_MTID, I6Target::begin_array);
METHOD_ADD(cgt, ARRAY_ENTRY_MTID, I6Target::array_entry);
METHOD_ADD(cgt, COMPILE_LITERAL_SYMBOL_MTID, I6Target::compile_literal_symbol);
@@ -105,7 +105,7 @@ void I6Target::create_generator(void) {
METHOD_ADD(cgt, END_ARRAY_MTID, I6Target::end_array);
METHOD_ADD(cgt, OFFER_PRAGMA_MTID, I6Target::offer_pragma)
METHOD_ADD(cgt, END_GENERATION_MTID, I6Target::end_generation);
- METHOD_ADD(cgt, WORLD_MODEL_ESSENTIALS_MTID, I6Target::world_model_essentials);
+ METHOD_ADD(cgt, PSEUDO_OBJECT_MTID, I6Target::pseudo_object);
METHOD_ADD(cgt, NEW_ACTION_MTID, I6Target::new_action);
inform6_target = cgt;
}
@@ -284,8 +284,8 @@ void I6Target::mangle(code_generator *cgt, OUTPUT_STREAM, text_stream *identifie
WRITE("%S", identifier);
}
-int I6Target::compile_primitive(code_generator *cgt, code_generation *gen,
- inter_symbol *prim_name, inter_tree_node *P) {
+void I6Target::invoke_primitive(code_generator *cgt, code_generation *gen,
+ inter_symbol *prim_name, inter_tree_node *P, int void_context) {
text_stream *OUT = CodeGen::current(gen);
int suppress_terminal_semicolon = FALSE;
inter_tree *I = gen->from;
@@ -400,14 +400,14 @@ int I6Target::compile_primitive(code_generator *cgt, code_generation *gen,
case SEQUENTIAL_BIP: WRITE("("); VNODE_1C; WRITE(","); VNODE_2C; WRITE(")"); break;
case TERNARYSEQUENTIAL_BIP: @; break;
- case PRINT_BIP: WRITE("print "); VanillaConstants::enter_print_mode(); VNODE_1C; VanillaConstants::exit_print_mode(); break;
+ case PRINT_BIP: WRITE("print "); VanillaConstants::enter_print_mode(gen); VNODE_1C; VanillaConstants::exit_print_mode(gen); break;
case PRINTCHAR_BIP: WRITE("print (char) "); VNODE_1C; break;
case PRINTNL_BIP: WRITE("new_line"); break;
case PRINTOBJ_BIP: WRITE("print (object) "); VNODE_1C; break;
case PRINTNUMBER_BIP: WRITE("print "); VNODE_1C; break;
case PRINTDWORD_BIP: WRITE("print (address) "); VNODE_1C; break;
case PRINTSTRING_BIP: WRITE("print (string) "); VNODE_1C; break;
- case BOX_BIP: WRITE("box "); VanillaConstants::enter_box_mode(); VNODE_1C; VanillaConstants::exit_box_mode(); break;
+ case BOX_BIP: WRITE("box "); VanillaConstants::enter_box_mode(gen); VNODE_1C; VanillaConstants::exit_box_mode(gen); break;
case IF_BIP: @; break;
case IFDEBUG_BIP: @; break;
@@ -429,7 +429,7 @@ int I6Target::compile_primitive(code_generator *cgt, code_generation *gen,
default: LOG("Prim: %S\n", prim_name->symbol_name); internal_error("unimplemented prim");
}
- return suppress_terminal_semicolon;
+ if ((void_context) && (suppress_terminal_semicolon == FALSE)) WRITE(";\n");
}
@ =
@@ -683,7 +683,7 @@ trick called "stubbing", these being "stub definitions".)
=
void I6Target::declare_property(code_generator *cgt, code_generation *gen,
inter_symbol *prop_name, int used) {
- text_stream *name = VanillaConstants::name(prop_name);
+ text_stream *name = CodeGen::name(prop_name);
if (used) {
generated_segment *saved = CodeGen::select(gen, predeclarations_I7CGS);
WRITE_TO(CodeGen::current(gen), "Property %S;\n", prop_name->symbol_name);
@@ -719,50 +719,47 @@ void I6Target::property_offset(code_generator *cgt, code_generation *gen, text_s
@
=
-int I6Target::prepare_variable(code_generator *cgt, code_generation *gen,
- inter_tree_node *P, inter_symbol *var_name, int k) {
-// if (Inter::Symbols::read_annotation(var_name, EXPLICIT_VARIABLE_IANN) != 1) {
+void I6Target::declare_variables(code_generator *cgt, code_generation *gen,
+ linked_list *L) {
+ int k = 0;
+ inter_symbol *var_name;
+ LOOP_OVER_LINKED_LIST(var_name, inter_symbol, L) {
+ inter_tree_node *P = var_name->definition;
if (Inter::Symbols::read_annotation(var_name, ASSIMILATED_IANN) != 1) {
text_stream *S = Str::new();
WRITE_TO(S, "(Global_Vars-->%d)", k);
Inter::Symbols::set_translate(var_name, S);
+ generated_segment *saved = CodeGen::select(gen, predeclarations_I7CGS);
+ text_stream *OUT = CodeGen::current(gen);
+ if (k == 0) WRITE("Array Global_Vars -->\n");
+ WRITE(" (");
+ inter_symbols_table *globals = Inter::Packages::scope_of(P);
+ VanillaConstants::literal(gen, NULL, globals, P->W.data[VAL1_VAR_IFLD], P->W.data[VAL2_VAR_IFLD], FALSE);
+ WRITE(") ! -->%d = %S (%S)\n", k, CodeGen::name(var_name), var_name->symbol_name);
+ CodeGen::deselect(gen, saved);
k++;
+ } else {
+ generated_segment *saved = CodeGen::select(gen, main_matter_I7CGS);
+ text_stream *OUT = CodeGen::current(gen);
+ WRITE("Global %S = ", CodeGen::name(var_name));
+ VanillaConstants::literal(gen, NULL, Inter::Packages::scope_of(P), P->W.data[VAL1_VAR_IFLD], P->W.data[VAL2_VAR_IFLD], FALSE);
+ WRITE(";\n");
+ CodeGen::deselect(gen, saved);
}
-// }
- return k;
-}
+ }
-int I6Target::declare_variable(code_generator *cgt, code_generation *gen,
- inter_tree_node *P, inter_symbol *var_name, int k, int of) {
- if (Inter::Symbols::read_annotation(var_name, ASSIMILATED_IANN) == 1) {
- generated_segment *saved = CodeGen::select(gen, main_matter_I7CGS);
- text_stream *OUT = CodeGen::current(gen);
- WRITE("Global %S = ", VanillaConstants::name(var_name));
- VanillaConstants::literal(gen, NULL, Inter::Packages::scope_of(P), P->W.data[VAL1_VAR_IFLD], P->W.data[VAL2_VAR_IFLD], FALSE);
- WRITE(";\n");
- CodeGen::deselect(gen, saved);
- } else {
-// if (Inter::Symbols::read_annotation(var_name, EXPLICIT_VARIABLE_IANN) != 1) {
+ if (k > 0) {
generated_segment *saved = CodeGen::select(gen, predeclarations_I7CGS);
text_stream *OUT = CodeGen::current(gen);
- if (k == 0) WRITE("Array Global_Vars -->\n");
- WRITE(" (");
- inter_symbols_table *globals = Inter::Packages::scope_of(P);
- VanillaConstants::literal(gen, NULL, globals, P->W.data[VAL1_VAR_IFLD], P->W.data[VAL2_VAR_IFLD], FALSE);
- WRITE(") ! -->%d = %S (%S)\n", k, VanillaConstants::name(var_name), var_name->symbol_name);
- k++;
- if (k == of) {
- if (k < 2) WRITE(" NULL NULL");
- WRITE(";\n");
- }
+ while (k++ < 2) WRITE(" NULL");
+ WRITE(";\n");
CodeGen::deselect(gen, saved);
}
- return k;
}
void I6Target::evaluate_variable(code_generator *cgt, code_generation *gen, inter_symbol *var_name, int as_reference) {
text_stream *OUT = CodeGen::current(gen);
- WRITE("%S", VanillaConstants::name(var_name));
+ WRITE("%S", CodeGen::name(var_name));
}
void I6Target::declare_class(code_generator *cgt, code_generation *gen, text_stream *class_name, text_stream *printed_name, text_stream *super_class) {
@@ -878,7 +875,7 @@ void I6Target::end_constant(code_generator *cgt, code_generation *gen, text_stre
int this_is_I6_Main = 0;
void I6Target::declare_function(code_generator *cgt, code_generation *gen, inter_symbol *fn, inter_tree_node *D) {
- text_stream *fn_name = VanillaConstants::name(fn);
+ text_stream *fn_name = CodeGen::name(fn);
this_is_I6_Main = 0;
text_stream *OUT = CodeGen::current(gen);
WRITE("[ %S", fn_name);
@@ -939,7 +936,7 @@ void I6Target::declare_function(code_generator *cgt, code_generation *gen, inter
}
Vanilla::node(gen, D);
// text_stream *OUT = CodeGen::current(gen);
-// text_stream *fn_name = VanillaConstants::name(fn);
+// text_stream *fn_name = CodeGen::name(fn);
if (Str::eq(fn_name, I"FINAL_CODE_STARTUP_R")) {
WRITE("#ifdef TARGET_GLULX;\n");
WRITE("@gestalt 9 0 res;\n");
@@ -972,6 +969,12 @@ void I6Target::place_label(code_generator *cgt, code_generation *gen, text_strea
text_stream *OUT = CodeGen::current(gen);
WRITE("%S;\n", label_name);
}
+void I6Target::evaluate_label(code_generator *cgt, code_generation *gen, text_stream *label_name) {
+ text_stream *OUT = CodeGen::current(gen);
+ LOOP_THROUGH_TEXT(pos, label_name)
+ if (Str::get(pos) != '.')
+ PUT(Str::get(pos));
+}
@ This enables use of March 2009 extension to Glulx which optimises the speed
of Inform-compiled story files by moving the work of I6 veneer routines into
@@ -982,8 +985,8 @@ Inter tree doesn't need to refer to eldritch Glulx-only symbols like |#g$self|
or implement assembly-language operations like |@accelparam|. (See //final//.)
=
-void I6Target::function_call(code_generator *cgt, code_generation *gen, inter_symbol *fn, inter_tree_node *P, int argc) {
- text_stream *fn_name = VanillaConstants::name(fn);
+void I6Target::invoke_function(code_generator *cgt, code_generation *gen, inter_symbol *fn, inter_tree_node *P, int void_context) {
+ text_stream *fn_name = CodeGen::name(fn);
text_stream *OUT = CodeGen::current(gen);
WRITE("%S(", fn_name);
int c = 0;
@@ -992,11 +995,12 @@ void I6Target::function_call(code_generator *cgt, code_generation *gen, inter_sy
Vanilla::node(gen, F);
}
WRITE(")");
+ if (void_context) WRITE(";\n");
}
-void I6Target::assembly(code_generator *cgt, code_generation *gen,
+void I6Target::invoke_opcode(code_generator *cgt, code_generation *gen,
text_stream *opcode, int operand_count, inter_tree_node **operands,
- inter_tree_node *label, int label_sense) {
+ inter_tree_node *label, int label_sense, int void_context) {
text_stream *OUT = CodeGen::current(gen);
WRITE("%S", opcode);
for (int opc = 0; opc < operand_count; opc++) {
@@ -1008,6 +1012,7 @@ void I6Target::assembly(code_generator *cgt, code_generation *gen,
if (label_sense == FALSE) WRITE("~");
Vanilla::node(gen, label);
}
+ if (void_context) WRITE(";\n");
}
int I6Target::begin_array(code_generator *cgt, code_generation *gen, text_stream *array_name, inter_symbol *array_s, inter_tree_node *P, int format) {
@@ -1059,7 +1064,7 @@ void I6Target::compile_literal_symbol(code_generator *cgt, code_generation *gen,
WRITE("scope=");
if ((unsub) && (Inter::Symbols::read_annotation(aliased, NOUN_FILTER_IANN) == 1))
WRITE("noun=");
- text_stream *S = VanillaConstants::name(aliased);
+ text_stream *S = CodeGen::name(aliased);
if ((unsub) && (Str::begins_with_wide_string(S, L"##"))) {
LOOP_THROUGH_TEXT(pos, S)
if (pos.index >= 2)
@@ -1093,12 +1098,9 @@ void I6Target::new_action(code_generator *cgt, code_generation *gen, text_stream
}
}
-void I6Target::world_model_essentials(code_generator *cgt, code_generation *gen) {
+void I6Target::pseudo_object(code_generator *cgt, code_generation *gen, text_stream *obj_name) {
generated_segment *saved = CodeGen::select(gen, main_matter_I7CGS);
text_stream *OUT = CodeGen::current(gen);
- WRITE("Object Compass \"compass\" has concealed;\n");
- WRITE("Object thedark \"(darkness object)\";\n");
- WRITE("Object InformParser \"(Inform Parser)\" has proper;\n");
- WRITE("Object InformLibrary \"(Inform Library)\" has proper;\n");
+ WRITE("Object %S \"(%S object)\" has concealed;\n", obj_name, obj_name);
CodeGen::deselect(gen, saved);
}
diff --git a/inter/final-module/Chapter 5/C Arithmetic.w b/inter/final-module/Chapter 5/C Arithmetic.w
index 965d23c8a..2ce72f5f8 100644
--- a/inter/final-module/Chapter 5/C Arithmetic.w
+++ b/inter/final-module/Chapter 5/C Arithmetic.w
@@ -6,7 +6,7 @@ Integer and floating-point calculations translated to C.
easy.
=
-int CArithmetic::compile_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
+int CArithmetic::invoke_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
text_stream *OUT = CodeGen::current(gen);
switch (bip) {
case PLUS_BIP: WRITE("("); VNODE_1C; WRITE(" + "); VNODE_2C; WRITE(")"); break;
diff --git a/inter/final-module/Chapter 5/C Assembly.w b/inter/final-module/Chapter 5/C Assembly.w
index 8a79126df..cedebbc14 100644
--- a/inter/final-module/Chapter 5/C Assembly.w
+++ b/inter/final-module/Chapter 5/C Assembly.w
@@ -6,7 +6,7 @@ The problem of assembly language.
=
void CAssembly::initialise(code_generator *cgt) {
- METHOD_ADD(cgt, ASSEMBLY_MTID, CAssembly::assembly);
+ METHOD_ADD(cgt, INVOKE_OPCODE_MTID, CAssembly::assembly);
}
void CAssembly::initialise_data(code_generation *gen) {
@@ -53,7 +53,7 @@ void i7_push(i7process_t *proc, i7word_t x) {
=
void CAssembly::assembly(code_generator *cgt, code_generation *gen,
text_stream *opcode, int operand_count, inter_tree_node **operands,
- inter_tree_node *label, int label_sense) {
+ inter_tree_node *label, int label_sense, int void_context) {
text_stream *OUT = CodeGen::current(gen);
int vararg_operands_from = 0, vararg_operands_to = 0;
@@ -149,6 +149,7 @@ void CAssembly::assembly(code_generator *cgt, code_generation *gen,
}
if (pushed_result) WRITE("; i7_push(proc, proc->state.tmp)");
+ if (void_context) WRITE(";\n");
}
@
diff --git a/inter/final-module/Chapter 5/C Conditions.w b/inter/final-module/Chapter 5/C Conditions.w
index 1eddab05a..149bac444 100644
--- a/inter/final-module/Chapter 5/C Conditions.w
+++ b/inter/final-module/Chapter 5/C Conditions.w
@@ -5,7 +5,7 @@ Evaluating conditions.
@
=
-int CConditions::compile_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
+int CConditions::invoke_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
text_stream *OUT = CodeGen::current(gen);
switch (bip) {
case NOT_BIP: WRITE("(!("); VNODE_1C; WRITE("))"); break;
diff --git a/inter/final-module/Chapter 5/C Function Model.w b/inter/final-module/Chapter 5/C Function Model.w
index 3072b291f..56de48805 100644
--- a/inter/final-module/Chapter 5/C Function Model.w
+++ b/inter/final-module/Chapter 5/C Function Model.w
@@ -9,7 +9,8 @@ void CFunctionModel::initialise(code_generator *cgt) {
METHOD_ADD(cgt, PREDECLARE_FUNCTION_MTID, CFunctionModel::predeclare_function);
METHOD_ADD(cgt, DECLARE_FUNCTION_MTID, CFunctionModel::declare_function);
METHOD_ADD(cgt, PLACE_LABEL_MTID, CFunctionModel::place_label);
- METHOD_ADD(cgt, FUNCTION_CALL_MTID, CFunctionModel::function_call);
+ METHOD_ADD(cgt, EVALUATE_LABEL_MTID, CFunctionModel::evaluate_label);
+ METHOD_ADD(cgt, INVOKE_FUNCTION_MTID, CFunctionModel::invoke_function);
}
typedef struct C_generation_function_model_data {
@@ -167,7 +168,7 @@ void CFunctionModel::make_veneer_fcf(code_generation *gen, text_stream *unmangle
void CFunctionModel::predeclare_function(code_generator *cgt, code_generation *gen,
inter_symbol *fn, inter_tree_node *D) {
- text_stream *fn_name = VanillaConstants::name(fn);
+ text_stream *fn_name = CodeGen::name(fn);
inter_package *P = Inter::Packages::container(fn->definition);
inter_package *PP = Inter::Packages::parent(P);
text_stream *md = Metadata::read_optional_textual(PP, I"^phrase_syntax");
@@ -221,7 +222,7 @@ void CFunctionModel::seek_locals(code_generation *gen, inter_tree_node *P) {
inter_symbol *var_name =
InterSymbolsTables::local_symbol_from_id(pack, P->W.data[DEFN_LOCAL_IFLD]);
TEMPORARY_TEXT(name)
- CNamespace::mangle(gen->generator, name, VanillaConstants::name(var_name));
+ CNamespace::mangle(gen->generator, name, CodeGen::name(var_name));
final_c_function *fcf = C_GEN_DATA(fndata.current_fcf);
if (Str::eq(var_name->symbol_name, I"_vararg_count")) {
fcf->uses_vararg_model = TRUE;
@@ -236,7 +237,7 @@ void CFunctionModel::seek_locals(code_generation *gen, inter_tree_node *P) {
}
void CFunctionModel::declare_function(code_generator *cgt, code_generation *gen, inter_symbol *fn, inter_tree_node *D) {
- text_stream *fn_name = VanillaConstants::name(fn);
+ text_stream *fn_name = CodeGen::name(fn);
final_c_function *fcf = RETRIEVE_POINTER_final_c_function(fn->translation_data);
C_GEN_DATA(fndata.current_fcf) = fcf;
text_stream *OUT = CodeGen::current(gen);
@@ -266,13 +267,22 @@ void CFunctionModel::place_label(code_generator *cgt, code_generation *gen, text
PUT(Str::get(pos));
WRITE(": ;\n", label_name);
}
+void CFunctionModel::evaluate_label(code_generator *cgt, code_generation *gen, text_stream *label_name) {
+ text_stream *OUT = CodeGen::current(gen);
+ LOOP_THROUGH_TEXT(pos, label_name)
+ if (Str::get(pos) != '.')
+ PUT(Str::get(pos));
+}
int CFunctionModel::inside_function(code_generation *gen) {
if (C_GEN_DATA(fndata.compiling_function)) return TRUE;
return FALSE;
}
-void CFunctionModel::function_call(code_generator *cgt, code_generation *gen, inter_symbol *fn, inter_tree_node *P, int argc) {
+void CFunctionModel::invoke_function(code_generator *cgt, code_generation *gen, inter_symbol *fn, inter_tree_node *P, int void_context) {
+ int argc = 0;
+ LOOP_THROUGH_INTER_CHILDREN(F, P) argc++;
+
inter_tree_node *D = fn->definition;
if ((D) && (D->W.data[ID_IFLD] == CONSTANT_IST) && (D->W.data[FORMAT_CONST_IFLD] == CONSTANT_DIRECT)) {
inter_ti val1 = D->W.data[DATA_CONST_IFLD];
@@ -286,7 +296,7 @@ void CFunctionModel::function_call(code_generator *cgt, code_generation *gen, in
if (GENERAL_POINTER_IS_NULL(fn->translation_data) == FALSE)
fcf = RETRIEVE_POINTER_final_c_function(fn->translation_data);
- text_stream *fn_name = VanillaConstants::name(fn);
+ text_stream *fn_name = CodeGen::name(fn);
text_stream *OUT = CodeGen::current(gen);
inter_tree_node *fargstuff[128];
@@ -324,6 +334,7 @@ void CFunctionModel::function_call(code_generator *cgt, code_generation *gen, in
}
}
WRITE(")");
+ if (void_context) WRITE(";\n");
}
@
diff --git a/inter/final-module/Chapter 5/C Global Variables.w b/inter/final-module/Chapter 5/C Global Variables.w
index 11050b16b..02df2a3e7 100644
--- a/inter/final-module/Chapter 5/C Global Variables.w
+++ b/inter/final-module/Chapter 5/C Global Variables.w
@@ -6,8 +6,7 @@ Global variables translated to C.
=
void CGlobals::initialise(code_generator *cgt) {
- METHOD_ADD(cgt, PREPARE_VARIABLE_MTID, CGlobals::prepare_variable);
- METHOD_ADD(cgt, DECLARE_VARIABLE_MTID, CGlobals::declare_variable);
+ METHOD_ADD(cgt, DECLARE_VARIABLES_MTID, CGlobals::declare_variables);
METHOD_ADD(cgt, EVALUATE_VARIABLE_MTID, CGlobals::evaluate_variable);
}
@@ -40,20 +39,17 @@ void CGlobals::end(code_generation *gen) {
@
=
-int CGlobals::prepare_variable(code_generator *cgt, code_generation *gen,
- inter_tree_node *P, inter_symbol *var_name, int k) {
- return k;
-}
-
-int CGlobals::declare_variable(code_generator *cgt, code_generation *gen,
- inter_tree_node *P, inter_symbol *var_name, int k, int of) {
- CGlobals::declare_variable_by_name(gen, VanillaConstants::name(var_name), P);
- text_stream *name = Metadata::read_optional_textual(Inter::Packages::container(var_name->definition), I"^name");
- if (name)
- CObjectModel::define_header_constant_for_variable(gen, name, C_var_count - 1);
- else
- CObjectModel::define_header_constant_for_variable(gen, VanillaConstants::name(var_name), C_var_count - 1);
- return k;
+void CGlobals::declare_variables(code_generator *cgt, code_generation *gen, linked_list *L) {
+ inter_symbol *var_name;
+ LOOP_OVER_LINKED_LIST(var_name, inter_symbol, L) {
+ inter_tree_node *P = var_name->definition;
+ CGlobals::declare_variable_by_name(gen, CodeGen::name(var_name), P);
+ text_stream *name = Metadata::read_optional_textual(Inter::Packages::container(var_name->definition), I"^name");
+ if (name)
+ CObjectModel::define_header_constant_for_variable(gen, name, C_var_count - 1);
+ else
+ CObjectModel::define_header_constant_for_variable(gen, CodeGen::name(var_name), C_var_count - 1);
+ }
}
void CGlobals::declare_variable_by_name(code_generation *gen, text_stream *name,
@@ -74,7 +70,7 @@ void CGlobals::declare_variable_by_name(code_generation *gen, text_stream *name,
void CGlobals::evaluate_variable(code_generator *cgt, code_generation *gen, inter_symbol *var_name, int as_reference) {
text_stream *OUT = CodeGen::current(gen);
- WRITE("proc->state.variables[i7_var_%S]", VanillaConstants::name(var_name));
+ WRITE("proc->state.variables[i7_var_%S]", CodeGen::name(var_name));
}
@
diff --git a/inter/final-module/Chapter 5/C Input-Output Model.w b/inter/final-module/Chapter 5/C Input-Output Model.w
index 2db0ca089..3825beac1 100644
--- a/inter/final-module/Chapter 5/C Input-Output Model.w
+++ b/inter/final-module/Chapter 5/C Input-Output Model.w
@@ -20,18 +20,18 @@ void CInputOutputModel::end(code_generation *gen) {
@
=
-int CInputOutputModel::compile_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
+int CInputOutputModel::invoke_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
text_stream *OUT = CodeGen::current(gen);
switch (bip) {
case SPACES_BIP: WRITE("for (int j = "); VNODE_1C; WRITE("; j > 0; j--) i7_print_char(proc, 32);"); break;
case FONT_BIP: WRITE("i7_font(proc, "); VNODE_1C; WRITE(")"); break;
case STYLE_BIP: WRITE("i7_style(proc, "); VNODE_1C; WRITE(")"); break;
- case PRINT_BIP: WRITE("i7_print_C_string(proc, "); VanillaConstants::enter_print_mode(); VNODE_1C; VanillaConstants::exit_print_mode(); WRITE(")"); break;
+ case PRINT_BIP: WRITE("i7_print_C_string(proc, "); VanillaConstants::enter_print_mode(gen); VNODE_1C; VanillaConstants::exit_print_mode(gen); WRITE(")"); break;
case PRINTCHAR_BIP: WRITE("i7_print_char(proc, "); VNODE_1C; WRITE(")"); break;
case PRINTNL_BIP: WRITE("i7_print_char(proc, '\\n')"); break;
case PRINTOBJ_BIP: WRITE("i7_print_object(proc, "); VNODE_1C; WRITE(")"); break;
case PRINTNUMBER_BIP: WRITE("i7_print_decimal(proc, "); VNODE_1C; WRITE(")"); break;
- case BOX_BIP: WRITE("i7_print_box(proc, "); VanillaConstants::enter_box_mode(); VNODE_1C; VanillaConstants::exit_box_mode(); WRITE(")"); break;
+ case BOX_BIP: WRITE("i7_print_box(proc, "); VanillaConstants::enter_box_mode(gen); VNODE_1C; VanillaConstants::exit_box_mode(gen); WRITE(")"); break;
case READ_BIP: WRITE("i7_read(proc, "); VNODE_1C; WRITE(", "); VNODE_2C; WRITE(")"); break;
default: return NOT_APPLICABLE;
}
diff --git a/inter/final-module/Chapter 5/C Literals.w b/inter/final-module/Chapter 5/C Literals.w
index 5b2908e9c..7e63950ea 100644
--- a/inter/final-module/Chapter 5/C Literals.w
+++ b/inter/final-module/Chapter 5/C Literals.w
@@ -356,7 +356,7 @@ void CLiteralsModel::verb_grammar(code_generator *cgt, code_generation *gen,
bc = 0x83;
CLiteralsModel::grammar_byte(gen, bc + lookahead);
TEMPORARY_TEXT(MG)
- CNamespace::mangle(cgt, MG, VanillaConstants::name(aliased));
+ CNamespace::mangle(cgt, MG, CodeGen::name(aliased));
CLiteralsModel::grammar_word_textual(gen, MG);
DISCARD_TEXT(MG)
continue;
@@ -738,7 +738,7 @@ int CLiteralsModel::no_strings(code_generation *gen) {
return C_GEN_DATA(litdata.no_double_quoted_C_strings);
}
-int CLiteralsModel::compile_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
+int CLiteralsModel::invoke_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
text_stream *OUT = CodeGen::current(gen);
switch (bip) {
case PRINTSTRING_BIP: WRITE("i7_print_C_string(proc, dqs["); VNODE_1C; WRITE(" - I7VAL_STRINGS_BASE])"); break;
diff --git a/inter/final-module/Chapter 5/C Memory Model.w b/inter/final-module/Chapter 5/C Memory Model.w
index 8f9f4cd32..1e99e30c4 100644
--- a/inter/final-module/Chapter 5/C Memory Model.w
+++ b/inter/final-module/Chapter 5/C Memory Model.w
@@ -369,7 +369,7 @@ and therefore if |X| is a valid constant-context expression in C then so is
=
void CMemoryModel::compile_literal_symbol(code_generator *cgt, code_generation *gen, inter_symbol *aliased, int unsub) {
text_stream *OUT = CodeGen::current(gen);
- text_stream *S = VanillaConstants::name(aliased);
+ text_stream *S = CodeGen::name(aliased);
Generators::mangle(gen, OUT, S);
}
@@ -411,7 +411,7 @@ int CMemoryModel::handle_store_by_ref(code_generation *gen, inter_tree_node *ref
return FALSE;
}
-int CMemoryModel::compile_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
+int CMemoryModel::invoke_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
text_stream *OUT = CodeGen::current(gen);
switch (bip) {
case LOOKUP_BIP: if (CReferences::am_I_a_ref(gen)) @
diff --git a/inter/final-module/Chapter 5/C Object Model.w b/inter/final-module/Chapter 5/C Object Model.w
index 1dcdebaf5..ca060e3f7 100644
--- a/inter/final-module/Chapter 5/C Object Model.w
+++ b/inter/final-module/Chapter 5/C Object Model.w
@@ -6,7 +6,7 @@ How objects, classes and properties are compiled to C.
=
void CObjectModel::initialise(code_generator *cgt) {
- METHOD_ADD(cgt, WORLD_MODEL_ESSENTIALS_MTID, CObjectModel::world_model_essentials);
+ METHOD_ADD(cgt, PSEUDO_OBJECT_MTID, CObjectModel::pseudo_object);
METHOD_ADD(cgt, DECLARE_INSTANCE_MTID, CObjectModel::declare_instance);
METHOD_ADD(cgt, DECLARE_VALUE_INSTANCE_MTID, CObjectModel::declare_value_instance);
METHOD_ADD(cgt, DECLARE_CLASS_MTID, CObjectModel::declare_class);
@@ -181,11 +181,9 @@ void CObjectModel::declare_class_inner(code_generation *gen,
@ And each instance here:
=
-void CObjectModel::world_model_essentials(code_generator *cgt, code_generation *gen) {
- C_GEN_DATA(objdata.compass_instance) = CObjectModel::declare_instance(cgt, gen, I"Object", I"Compass", I"Compass", -1, FALSE);
- CObjectModel::declare_instance(cgt, gen, I"Object", I"thedark", NULL, -1, FALSE);
- CObjectModel::declare_instance(cgt, gen, I"Object", I"InformParser", NULL, -1, FALSE);
- CObjectModel::declare_instance(cgt, gen, I"Object", I"InformLibrary", NULL, -1, FALSE);
+void CObjectModel::pseudo_object(code_generator *cgt, code_generation *gen, text_stream *obj_name) {
+ C_property_owner *obj = CObjectModel::declare_instance(cgt, gen, I"Object", obj_name, obj_name, -1, FALSE);
+ if (Str::eq(obj_name, I"Compass")) C_GEN_DATA(objdata.compass_instance) = obj;
}
C_property_owner *CObjectModel::declare_instance(code_generator *cgt, code_generation *gen,
@@ -389,7 +387,7 @@ that references to it will not fail to compile.
=
void CObjectModel::declare_property(code_generator *cgt, code_generation *gen,
inter_symbol *prop_name, int used) {
- text_stream *name = VanillaConstants::name(prop_name);
+ text_stream *name = CodeGen::name(prop_name);
C_property *cp = CObjectModel::property_by_name(gen, name, used, FALSE);
text_stream *pname = Metadata::read_optional_textual(Inter::Packages::container(prop_name->definition), I"^name");
if (pname)
@@ -634,7 +632,7 @@ int CObjectModel::handle_store_by_ref(code_generation *gen, inter_tree_node *ref
return FALSE;
}
-int CObjectModel::compile_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
+int CObjectModel::invoke_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
text_stream *OUT = CodeGen::current(gen);
switch (bip) {
case PROPERTYADDRESS_BIP: WRITE("i7_prop_addr("); VNODE_1C; WRITE(", "); VNODE_2C; WRITE(")"); break;
diff --git a/inter/final-module/Chapter 5/C Program Control.w b/inter/final-module/Chapter 5/C Program Control.w
index b2a8990d3..fb2927f81 100644
--- a/inter/final-module/Chapter 5/C Program Control.w
+++ b/inter/final-module/Chapter 5/C Program Control.w
@@ -6,29 +6,26 @@ Generating C code to effect loops, branches and the like.
=
void CProgramControl::initialise(code_generator *cgt) {
- METHOD_ADD(c_target, COMPILE_PRIMITIVE_MTID, CProgramControl::compile_primitive);
+ METHOD_ADD(c_target, INVOKE_PRIMITIVE_MTID, CProgramControl::invoke_primitive);
}
-int CProgramControl::compile_primitive(code_generator *cgt, code_generation *gen,
- inter_symbol *prim_name, inter_tree_node *P) {
+void CProgramControl::invoke_primitive(code_generator *cgt, code_generation *gen,
+ inter_symbol *prim_name, inter_tree_node *P, int void_context) {
inter_tree *I = gen->from;
inter_ti bip = Primitives::to_bip(I, prim_name);
- int r = CReferences::compile_primitive(gen, bip, P);
- if (r != NOT_APPLICABLE) return r;
- r = CArithmetic::compile_primitive(gen, bip, P);
- if (r != NOT_APPLICABLE) return r;
- r = CMemoryModel::compile_primitive(gen, bip, P);
- if (r != NOT_APPLICABLE) return r;
- r = CObjectModel::compile_primitive(gen, bip, P);
- if (r != NOT_APPLICABLE) return r;
- r = CLiteralsModel::compile_primitive(gen, bip, P);
- if (r != NOT_APPLICABLE) return r;
- r = CInputOutputModel::compile_primitive(gen, bip, P);
- if (r != NOT_APPLICABLE) return r;
- r = CConditions::compile_primitive(gen, bip, P);
- if (r != NOT_APPLICABLE) return r;
- return CProgramControl::compile_control_primitive(gen, bip, P);
+ int r = CReferences::invoke_primitive(gen, bip, P);
+ if (r == NOT_APPLICABLE) r = CArithmetic::invoke_primitive(gen, bip, P);
+ if (r == NOT_APPLICABLE) r = CMemoryModel::invoke_primitive(gen, bip, P);
+ if (r == NOT_APPLICABLE) r = CObjectModel::invoke_primitive(gen, bip, P);
+ if (r == NOT_APPLICABLE) r = CLiteralsModel::invoke_primitive(gen, bip, P);
+ if (r == NOT_APPLICABLE) r = CInputOutputModel::invoke_primitive(gen, bip, P);
+ if (r == NOT_APPLICABLE) r = CConditions::invoke_primitive(gen, bip, P);
+ if (r == NOT_APPLICABLE) r = CProgramControl::compile_control_primitive(gen, bip, P);
+ if ((void_context) && (r == FALSE)) {
+ text_stream *OUT = CodeGen::current(gen);
+ WRITE(";\n");
+ }
}
int CProgramControl::compile_control_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
diff --git a/inter/final-module/Chapter 5/C References.w b/inter/final-module/Chapter 5/C References.w
index 6d6053e17..4679f7a85 100644
--- a/inter/final-module/Chapter 5/C References.w
+++ b/inter/final-module/Chapter 5/C References.w
@@ -63,7 +63,7 @@ int CReferences::am_I_a_ref(code_generation *gen) {
@ So, then, here goes:
=
-int CReferences::compile_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
+int CReferences::invoke_primitive(code_generation *gen, inter_ti bip, inter_tree_node *P) {
text_stream *OUT = CodeGen::current(gen);
text_stream *store_form = NULL;
switch (bip) {
diff --git a/inter/final-module/Chapter 5/Final C.w b/inter/final-module/Chapter 5/Final C.w
index 4f7d7ed28..13e860d23 100644
--- a/inter/final-module/Chapter 5/Final C.w
+++ b/inter/final-module/Chapter 5/Final C.w
@@ -569,8 +569,8 @@ int CTarget::constant_segment(code_generator *cgt, code_generation *gen) {
return c_early_matter_I7CGS;
}
int CTarget::basic_constant_segment(code_generator *cgt, code_generation *gen, inter_symbol *con_name, int depth) {
- if (Str::eq(VanillaConstants::name(con_name), I"Release")) return c_ids_and_maxima_I7CGS;
- if (Str::eq(VanillaConstants::name(con_name), I"Serial")) return c_ids_and_maxima_I7CGS;
+ if (Str::eq(CodeGen::name(con_name), I"Release")) return c_ids_and_maxima_I7CGS;
+ if (Str::eq(CodeGen::name(con_name), I"Serial")) return c_ids_and_maxima_I7CGS;
if (depth >= 10) depth = 10;
return c_constants_1_I7CGS + depth - 1;
}
diff --git a/inter/final-module/Contents.w b/inter/final-module/Contents.w
index 372e6ff0b..218c4d378 100644
--- a/inter/final-module/Contents.w
+++ b/inter/final-module/Contents.w
@@ -13,7 +13,6 @@ Chapter 2: Mechanism
The Vanilla Generator
Vanilla Constants
Vanilla Objects
- Vanilla Variables
Vanilla Code
Chapter 3: Other Generators