diff --git a/docs/codegen-module/1-cm.html b/docs/codegen-module/1-cm.html
index 741e150bd..f79d0c28f 100644
--- a/docs/codegen-module/1-cm.html
+++ b/docs/codegen-module/1-cm.html
@@ -93,6 +93,7 @@ which use this module:
enum simplified_scene_CLASS
enum simplified_end_CLASS
enum simplified_connector_CLASS
+enum command_index_entry_CLASS
DECLARE_CLASS ( I6T_intervention )
@@ -115,6 +116,7 @@ which use this module:
DECLARE_CLASS ( simplified_scene )
DECLARE_CLASS ( simplified_end )
DECLARE_CLASS ( simplified_connector )
+DECLARE_CLASS ( command_index_entry )
diff --git a/docs/codegen-module/6-ae.html b/docs/codegen-module/6-ae.html
index 3398cffd4..4f120156b 100644
--- a/docs/codegen-module/6-ae.html
+++ b/docs/codegen-module/6-ae.html
@@ -191,7 +191,7 @@ text, sorted into kind order of left and then right operand.
+
diff --git a/docs/codegen-module/6-be.html b/docs/codegen-module/6-be.html
index 13182c89e..131baf48a 100644
--- a/docs/codegen-module/6-be.html
+++ b/docs/codegen-module/6-be.html
@@ -115,7 +115,7 @@ function togglePopup(material_id) {
}
+
diff --git a/docs/codegen-module/6-ce.html b/docs/codegen-module/6-ce.html
index 5c16ab2ad..d2c162a29 100644
--- a/docs/codegen-module/6-ce.html
+++ b/docs/codegen-module/6-ce.html
@@ -256,7 +256,7 @@ giving only minimal entries about them.
+
diff --git a/docs/codegen-module/6-ce2.html b/docs/codegen-module/6-ce2.html
index d026050be..2d0a53d32 100644
--- a/docs/codegen-module/6-ce2.html
+++ b/docs/codegen-module/6-ce2.html
@@ -150,7 +150,7 @@ simplified form of the iFiction record, without the XML overhead.
}
+
diff --git a/docs/codegen-module/6-ce3.html b/docs/codegen-module/6-ce3.html
index 1a03c5f83..916a27638 100644
--- a/docs/codegen-module/6-ce3.html
+++ b/docs/codegen-module/6-ce3.html
@@ -655,7 +655,7 @@ whole row.
}
+
diff --git a/docs/codegen-module/6-ce4.html b/docs/codegen-module/6-ce4.html
new file mode 100644
index 000000000..44964df90
--- /dev/null
+++ b/docs/codegen-module/6-ce4.html
@@ -0,0 +1,230 @@
+
+
+
+ Commands Element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Compiler Webs Inbuild Modules Inform7 Modules Inter Modules Services
+
+
+
+
+To write the Commands element (Cm) in the index.
+
+
+
+
+void CommandsElement::render ( OUTPUT_STREAM ) {
+ inter_tree * I = Index::get_tree ();
+
+ command_index_entry * vie , * vie2 , * last_vie2 , * list_start = NULL ;
+ command_grammar * cg ;
+ int head_letter ;
+
+ inter_package * pack = Inter::Packages::by_url ( I , I "/main/completion/grammar" );
+ inter_symbol * wanted = PackageTypes::get ( I , I "_command_grammar" );
+ inter_tree_node * D = Inter::Packages::definition ( pack );
+ LOOP_THROUGH_INTER_CHILDREN ( C , D ) {
+ if ( C -> W . data [ ID_IFLD ] == PACKAGE_IST ) {
+ inter_package * entry = Inter::Package::defined_by_frame ( C );
+ if ( Inter::Packages::type ( entry ) == wanted ) {
+
+ if ( Wordings::empty ( cg -> command ))
+ CommandsElement::vie_new_from ( OUT , L "0" , cg , NORMAL_COMMAND );
+ else
+ CommandsElement::vie_new_from ( OUT , Lexer::word_text ( Wordings::first_wn ( cg -> command )), cg , NORMAL_COMMAND );
+ for ( int i =0; i <cg-> no_aliased_commands ; i ++)
+ CommandsElement::vie_new_from ( OUT , Lexer::word_text ( Wordings::first_wn ( cg -> aliased_command [ i ])), cg , ALIAS_COMMAND );
+*/
+ }
+ }
+ }
+ }
+
+ CommandsElement::direction_verb ();
+
+ LOOP_OVER ( vie , command_index_entry ) {
+ if ( list_start == NULL ) { list_start = vie ; continue ; }
+ vie2 = list_start ;
+ last_vie2 = NULL ;
+ while ( vie2 && ( Str::cmp ( vie -> command_headword , vie2 -> command_headword ) > 0 )) {
+ last_vie2 = vie2 ;
+ vie2 = vie2 -> next_alphabetically ;
+ }
+ if ( last_vie2 == NULL ) {
+ vie -> next_alphabetically = list_start ; list_start = vie ;
+ } else {
+ last_vie2 -> next_alphabetically = vie ; vie -> next_alphabetically = vie2 ;
+ }
+ }
+
+ for ( vie = list_start , head_letter = 0 ; vie ; vie = vie -> next_alphabetically ) {
+ if ( Str::get_first_char ( vie -> command_headword ) != head_letter ) {
+ if ( head_letter ) HTML_TAG ( "br" );
+ head_letter = Str::get_first_char ( vie -> command_headword );
+ }
+ inter_package * cg = vie -> cg_indexed ;
+ switch ( vie -> nature ) {
+ case NORMAL_COMMAND:
+ CommandsIndex::index_normal ( OUT , cg , vie -> command_headword );
+ break ;
+ case ALIAS_COMMAND:
+ CommandsIndex::index_alias ( OUT , cg , vie -> command_headword );
+ break ;
+ case OUT_OF_WORLD_COMMAND:
+ HTML::begin_colour ( OUT , I "800000" );
+ WRITE ( ""%S", <i>a command for controlling play</i>" ,
+ vie -> command_headword );
+ HTML::end_colour ( OUT );
+ HTML_TAG ( "br" );
+ break ;
+ case TESTING_COMMAND:
+ HTML::begin_colour ( OUT , I "800000" );
+ WRITE ( ""%S", <i>a testing command not available "
+ "in the final game</i>" ,
+ vie -> command_headword );
+ HTML::end_colour ( OUT );
+ HTML_TAG ( "br" );
+ break ;
+ case BARE_DIRECTION_COMMAND:
+ WRITE ( ""[direction]" - <i>Going</i>" );
+ HTML_TAG ( "br" );
+ break ;
+ }
+ }
+}
+
+
+
+define NORMAL_COMMAND 1
+define ALIAS_COMMAND 2
+define OUT_OF_WORLD_COMMAND 3
+define TESTING_COMMAND 4
+define BARE_DIRECTION_COMMAND 5
+
+
+typedef struct command_index_entry {
+ int nature ;
+ struct text_stream * command_headword ;
+ struct inter_package * cg_indexed ;
+ struct command_index_entry * next_alphabetically ;
+ CLASS_DEFINITION
+} command_index_entry ;
+
+command_index_entry * sorted_command_index = NULL ;
+
+The structure command_index_entry is private to this section.
+
+
+
+void CommandsElement::index_meta_verb ( char * t ) {
+ command_index_entry * vie ;
+ vie = CREATE ( command_index_entry );
+ vie -> command_headword = Str::new ();
+ WRITE_TO ( vie -> command_headword , "%s" , t );
+ vie -> nature = OUT_OF_WORLD_COMMAND ;
+ vie -> cg_indexed = NULL ;
+ vie -> next_alphabetically = NULL ;
+}
+
+void CommandsElement::test_verb ( text_stream * t ) {
+ command_index_entry * vie ;
+ vie = CREATE ( command_index_entry );
+ vie -> command_headword = Str::duplicate ( t );
+ vie -> nature = TESTING_COMMAND ;
+ vie -> cg_indexed = NULL ;
+ vie -> next_alphabetically = NULL ;
+}
+
+command_index_entry * CommandsElement::vie_new_from ( wchar_t * headword , inter_package * cg , int nature ) {
+ command_index_entry * vie ;
+ vie = CREATE ( command_index_entry );
+ vie -> command_headword = Str::new ();
+ WRITE_TO ( vie -> command_headword , "%w" , headword );
+ vie -> nature = nature ;
+ vie -> cg_indexed = cg ;
+ vie -> next_alphabetically = NULL ;
+ return vie ;
+}
+
+void CommandsElement::direction_verb ( void ) {
+ vie = CREATE ( command_index_entry );
+ vie -> command_headword = I "0" ;
+ vie -> nature = BARE_DIRECTION_COMMAND ;
+ vie -> cg_indexed = NULL ;
+ vie -> next_alphabetically = NULL ;
+}
+
+
+
+
+
+
+
+
diff --git a/docs/codegen-module/6-ee.html b/docs/codegen-module/6-ee.html
index ba460765a..76a429e2c 100644
--- a/docs/codegen-module/6-ee.html
+++ b/docs/codegen-module/6-ee.html
@@ -150,7 +150,7 @@ function togglePopup(material_id) {
+
diff --git a/docs/codegen-module/6-ee2.html b/docs/codegen-module/6-ee2.html
index b09e62876..900e902d8 100644
--- a/docs/codegen-module/6-ee2.html
+++ b/docs/codegen-module/6-ee2.html
@@ -135,7 +135,7 @@ function togglePopup(material_id) {
This code is used in §1.1 (twice).
+
diff --git a/docs/codegen-module/6-fe.html b/docs/codegen-module/6-fe.html
index b064faf07..8cdb004cc 100644
--- a/docs/codegen-module/6-fe.html
+++ b/docs/codegen-module/6-fe.html
@@ -353,7 +353,7 @@ to match this width, preserving the aspect ratio.
+
diff --git a/docs/codegen-module/6-ge.html b/docs/codegen-module/6-ge.html
index 0412ac036..bf6a1ec5d 100644
--- a/docs/codegen-module/6-ge.html
+++ b/docs/codegen-module/6-ge.html
@@ -82,7 +82,7 @@ function togglePopup(material_id) {
}
+
diff --git a/docs/codegen-module/6-ie.html b/docs/codegen-module/6-ie.html
index 7b348695e..285b15a97 100644
--- a/docs/codegen-module/6-ie.html
+++ b/docs/codegen-module/6-ie.html
@@ -288,7 +288,7 @@ pragma is set:
+
diff --git a/docs/codegen-module/6-ifs.html b/docs/codegen-module/6-ifs.html
index 39c93e03e..381f17a4f 100644
--- a/docs/codegen-module/6-ifs.html
+++ b/docs/codegen-module/6-ifs.html
@@ -83,7 +83,7 @@ function togglePopup(material_id) {
indexing_tree = I ;
}
-inter_tree * Index::get_tree ( void ) {
+inter_tree * Index::get_tree ( void ) {
return indexing_tree ;
}
@@ -822,21 +822,22 @@ to show, hide and colour things:
if ( Str::eq_wide_string ( elt , L "C" )) { ContentsElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "Cd" )) { CardElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "Ch" )) { ChartElement::render ( OUT ); return ; }
+ if ( Str::eq_wide_string ( elt , L "Cm" )) { CommandsElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "Ev" )) { EventsElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "Fi" )) { FiguresElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "Gz" )) { GazetteerElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "In" )) { InnardsElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "Lx" )) { LexiconElement::render ( OUT ); return ; }
+ if ( Str::eq_wide_string ( elt , L "Ph" )) { PhrasebookElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "Pl" )) { PlotElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "Rl" )) { RelationsElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "RS" )) { RulesForScenesElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "St" )) { StandardsElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "Tb" )) { TablesElement::render ( OUT ); return ; }
+ if ( Str::eq_wide_string ( elt , L "To" )) { TokensElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "Vb" )) { VerbsElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "Vl" )) { ValuesElement::render ( OUT ); return ; }
if ( Str::eq_wide_string ( elt , L "Xt" )) { ExtrasElement::render ( OUT ); return ; }
- if ( Str::eq_wide_string ( elt , L "Ph" )) { PhrasebookElement::render ( OUT ); return ; }
- if ( Str::eq_wide_string ( elt , L "To" )) { TokensElement::render ( OUT ); return ; }
# ifdef CORE_MODULE
if ( Str::eq_wide_string ( elt , L "Mp" )) {
@@ -847,10 +848,6 @@ to show, hide and colour things:
CommandsIndex::page ( OUT );
return ;
}
- if ( Str::eq_wide_string ( elt , L "Cm" )) {
- CommandsIndex::commands ( OUT );
- return ;
- }
if ( Str::eq_wide_string ( elt , L "A2" )) {
CommandsIndex::alphabetical ( OUT );
return ;
@@ -1102,7 +1099,7 @@ quotes.
}
+
diff --git a/docs/codegen-module/6-ii.html b/docs/codegen-module/6-ii.html
index 5e8f00cef..8d5838185 100644
--- a/docs/codegen-module/6-ii.html
+++ b/docs/codegen-module/6-ii.html
@@ -288,7 +288,7 @@ time.) -
To write the Tokens element (To) in the index.
+
+
+ Commands Element -
+ To write the Commands element (Cm) in the index.
+
diff --git a/docs/core-module/1-cp.html b/docs/core-module/1-cp.html
index 445935b3d..9b1938dc9 100644
--- a/docs/core-module/1-cp.html
+++ b/docs/core-module/1-cp.html
@@ -296,14 +296,12 @@ We begin with core itself.
enum activity_crossref_CLASS
-enum command_index_entry_CLASS
enum connected_submap_CLASS
enum EPS_map_level_CLASS
enum rubric_holder_CLASS
DECLARE_CLASS_ALLOCATED_IN_ARRAYS ( activity_crossref , 100 )
-DECLARE_CLASS ( command_index_entry )
DECLARE_CLASS ( connected_submap )
DECLARE_CLASS ( EPS_map_level )
DECLARE_CLASS ( rubric_holder )
diff --git a/docs/index-module/2-ie.html b/docs/index-module/2-ie.html
index be56b00fa..ef4d8eb7f 100644
--- a/docs/index-module/2-ie.html
+++ b/docs/index-module/2-ie.html
@@ -216,7 +216,7 @@ documentation page could be forgiven for thinking it a miscellany.
# ifdef IF_MODULE
- CommandsIndex::index_for_extension ( OUT , E -> read_into_file , E );
+ CommandsIndex::index_for_extension ( OUT , E -> read_into_file , E );
# endif
@@ -301,7 +301,7 @@ dictionary.
-int IndexExtensions::document_headword ( OUTPUT_STREAM , int kc , inform_extension * E , char * par_heading ,
+int IndexExtensions::document_headword ( OUTPUT_STREAM , int kc , inform_extension * E , char * par_heading ,
text_stream * category , wording W ) {
if ( kc ++ == 0 ) { HTML_OPEN ( "p" ); WRITE ( "%s: " , par_heading ); }
else WRITE ( ", " );
diff --git a/docs/index-module/3-act.html b/docs/index-module/3-act.html
index f27263437..312c80ad1 100644
--- a/docs/index-module/3-act.html
+++ b/docs/index-module/3-act.html
@@ -96,7 +96,7 @@ function togglePopup(material_id) {
return an -> indexing_data . an_specification_text_word ;
}
-int IXActions::index ( OUTPUT_STREAM , action_name * an , int pass ,
+int IXActions::index ( OUTPUT_STREAM , action_name * an , int pass ,
inform_extension ** ext , heading ** current_area , int f , int * new_par , int bold ,
int on_details_page ) {
heading * definition_area = Headings::of_wording ( ActionNameNames::tensed ( an , IS_TENSE ));
@@ -189,7 +189,7 @@ function togglePopup(material_id) {
HTML_TAG ( "hr" );
HTML_OPEN ( "p" ); WRITE ( "<b>Typed commands leading to this action</b>\n" ); HTML_CLOSE ( "p" );
HTML_OPEN ( "p" );
- if ( CommandsIndex::index_list_with_action ( OUT , an -> command_parser_grammar_producing_this ) == FALSE )
+ if ( CommandsIndex::index_list_with_action ( OUT , an -> command_parser_grammar_producing_this ) == FALSE )
WRITE ( "<i>None</i>" );
HTML_CLOSE ( "p" );
if ( SharedVariables::set_empty ( an -> action_variables ) == FALSE ) {
diff --git a/docs/index-module/3-ci.html b/docs/index-module/3-ci.html
index 5b241f55f..aaae16479 100644
--- a/docs/index-module/3-ci.html
+++ b/docs/index-module/3-ci.html
@@ -72,62 +72,19 @@ function togglePopup(material_id) {
To construct the index of command verbs.
-
+
-
-
-define NORMAL_COMMAND 1
-define ALIAS_COMMAND 2
-define OUT_OF_WORLD_COMMAND 3
-define TESTING_COMMAND 4
-define BARE_DIRECTION_COMMAND 5
-
-
-typedef struct command_index_entry {
- int nature ;
- struct text_stream * command_headword ;
- struct command_grammar * cg_indexed ;
- struct command_index_entry * next_alphabetically ;
- CLASS_DEFINITION
-} command_index_entry ;
-
-command_index_entry * sorted_command_index = NULL ;
-
-The structure command_index_entry is private to this section.
-
+
-void CommandsIndex::index_meta_verb ( char * t ) {
- command_index_entry * vie ;
- vie = CREATE ( command_index_entry );
- vie -> command_headword = Str::new ();
- WRITE_TO ( vie -> command_headword , "%s" , t );
- vie -> nature = OUT_OF_WORLD_COMMAND ;
- vie -> cg_indexed = NULL ;
- vie -> next_alphabetically = NULL ;
-}
-
-void CommandsIndex::test_verb ( text_stream * t ) {
- command_index_entry * vie ;
- vie = CREATE ( command_index_entry );
- vie -> command_headword = Str::duplicate ( t );
- vie -> nature = TESTING_COMMAND ;
- vie -> cg_indexed = NULL ;
- vie -> next_alphabetically = NULL ;
-}
-
-void CommandsIndex::verb_definition ( OUTPUT_STREAM , wchar_t * p , text_stream * trueverb , wording W ) {
+void CommandsIndex::verb_definition ( OUTPUT_STREAM , wchar_t * p , text_stream * trueverb , wording W ) {
int i = 1 ;
if (( p [0] == 0 ) || ( p [1] == 0 )) return ;
if ( Str::len ( trueverb ) > 0 ) {
if ( Str::eq_wide_string ( trueverb , L "0" ) == FALSE ) {
WRITE ( "%S" , trueverb );
if ( Wordings::nonempty ( W ))
- CommandsIndex::index_command_aliases ( OUT ,
+ CommandsIndex::index_command_aliases ( OUT ,
CommandGrammars::for_command_verb ( W ));
for ( i =1; p [ i +1]; i ++) if ( p [ i ] == ' ' ) break ;
for (; p [ i +1]; i ++) if ( p [ i ] != ' ' ) break ;
@@ -143,64 +100,49 @@ we divide these headwords into five "natures":
}
}
-command_index_entry * CommandsIndex::vie_new_from ( OUTPUT_STREAM , wchar_t * headword , command_grammar * cg , int nature ) {
- command_index_entry * vie ;
- vie = CREATE ( command_index_entry );
- vie -> command_headword = Str::new ();
- WRITE_TO ( vie -> command_headword , "%w" , headword );
- vie -> nature = nature ;
- vie -> cg_indexed = cg ;
- vie -> next_alphabetically = NULL ;
- return vie ;
-}
-
void CommandsIndex::commands ( OUTPUT_STREAM ) {
- command_index_entry * vie , * vie2 , * last_vie2 , * list_start = NULL ;
+ command_index_entry * vie , * vie2 , * last_vie2 , * list_start = NULL ;
command_grammar * cg ;
int head_letter ;
LOOP_OVER ( cg , command_grammar )
- CommandsIndex::make_command_index_entries ( OUT , cg );
+ CommandsIndex::make_command_index_entries ( OUT , cg );
- vie = CREATE ( command_index_entry );
- vie -> command_headword = I "0" ;
- vie -> nature = BARE_DIRECTION_COMMAND ;
- vie -> cg_indexed = NULL ;
- vie -> next_alphabetically = NULL ;
+ CommandsElement::direction_verb ();
- LOOP_OVER ( vie , command_index_entry ) {
+ LOOP_OVER ( vie , command_index_entry ) {
if ( list_start == NULL ) { list_start = vie ; continue ; }
vie2 = list_start ;
last_vie2 = NULL ;
- while ( vie2 && ( Str::cmp ( vie -> command_headword , vie2 -> command_headword ) > 0 )) {
+ while ( vie2 && ( Str::cmp ( vie -> command_headword , vie2 -> command_headword ) > 0 )) {
last_vie2 = vie2 ;
- vie2 = vie2 -> next_alphabetically ;
+ vie2 = vie2 -> next_alphabetically ;
}
if ( last_vie2 == NULL ) {
- vie -> next_alphabetically = list_start ; list_start = vie ;
+ vie -> next_alphabetically = list_start ; list_start = vie ;
} else {
- last_vie2 -> next_alphabetically = vie ; vie -> next_alphabetically = vie2 ;
+ last_vie2 -> next_alphabetically = vie ; vie -> next_alphabetically = vie2 ;
}
}
- for ( vie = list_start , head_letter = 0 ; vie ; vie = vie -> next_alphabetically ) {
+ for ( vie = list_start , head_letter = 0 ; vie ; vie = vie -> next_alphabetically ) {
command_grammar * cg ;
- if ( Str::get_first_char ( vie -> command_headword ) != head_letter ) {
+ if ( Str::get_first_char ( vie -> command_headword ) != head_letter ) {
if ( head_letter ) HTML_TAG ( "br" );
- head_letter = Str::get_first_char ( vie -> command_headword );
+ head_letter = Str::get_first_char ( vie -> command_headword );
}
- cg = vie -> cg_indexed ;
- switch ( vie -> nature ) {
+ cg = vie -> cg_indexed ;
+ switch ( vie -> nature ) {
case NORMAL_COMMAND:
- CommandsIndex::index_normal ( OUT , cg , vie -> command_headword );
+ CommandsIndex::index_normal ( OUT , cg , vie -> command_headword );
break ;
case ALIAS_COMMAND:
- CommandsIndex::index_alias ( OUT , cg , vie -> command_headword );
+ CommandsIndex::index_alias ( OUT , cg , vie -> command_headword );
break ;
case OUT_OF_WORLD_COMMAND:
HTML::begin_colour ( OUT , I "800000" );
WRITE ( ""%S", <i>a command for controlling play</i>" ,
- vie -> command_headword );
+ vie -> command_headword );
HTML::end_colour ( OUT );
HTML_TAG ( "br" );
break ;
@@ -208,7 +150,7 @@ we divide these headwords into five "natures":
HTML::begin_colour ( OUT , I "800000" );
WRITE ( ""%S", <i>a testing command not available "
"in the final game</i>" ,
- vie -> command_headword );
+ vie -> command_headword );
HTML::end_colour ( OUT );
HTML_TAG ( "br" );
break ;
@@ -224,13 +166,13 @@ we divide these headwords into five "natures":
int nr = NUMBER_CREATED ( action_name );
action_name ** sorted = Memory::calloc ( nr , sizeof ( action_name *), INDEX_SORTING_MREASON );
if ( sorted ) {
- Sort the action names 2.2 ;
- Tabulate the action names 2.1 ;
+ Sort the action names 1.2 ;
+ Tabulate the action names 1.1 ;
Memory::I7_array_free ( sorted , INDEX_SORTING_MREASON , nr , sizeof ( action_name *));
}
}
-
@@ -276,31 +218,31 @@ we divide these headwords into five "natures":
}
HTML::end_html_table ( OUT );
-
-
+
-
int i = 0 ;
action_name * an ;
LOOP_OVER ( an , action_name ) sorted [ i ++] = an ;
- qsort ( sorted , ( size_t ) nr , sizeof ( action_name *), CommandsIndex::compare_action_names );
+ qsort ( sorted , ( size_t ) nr , sizeof ( action_name *), CommandsIndex::compare_action_names );
-
-
+
-int CommandsIndex::compare_action_names ( const void * ent1 , const void * ent2 ) {
+int CommandsIndex::compare_action_names ( const void * ent1 , const void * ent2 ) {
const action_name * an1 = *(( const action_name **) ent1 );
const action_name * an2 = *(( const action_name **) ent2 );
return Wordings::strcmp ( ActionNameNames::tensed (( action_name *) an1 , IS_TENSE ), ActionNameNames::tensed (( action_name *) an2 , IS_TENSE ));
}
-
+
void CommandsIndex::page ( OUTPUT_STREAM ) {
@@ -340,7 +282,7 @@ we divide these headwords into five "natures":
}
}
-void CommandsIndex::index_for_extension ( OUTPUT_STREAM , source_file * sf , inform_extension * E ) {
+void CommandsIndex::index_for_extension ( OUTPUT_STREAM , source_file * sf , inform_extension * E ) {
action_name * an ;
int kc = 0 ;
LOOP_OVER ( an , action_name )
@@ -350,7 +292,7 @@ we divide these headwords into five "natures":
if ( kc != 0 ) HTML_CLOSE ( "p" );
}
-
-void CommandsIndex::make_command_index_entries ( OUTPUT_STREAM , command_grammar * cg ) {
- if (( cg -> cg_is == CG_IS_COMMAND ) && ( cg -> first_line )) {
- if ( Wordings::empty ( cg -> command ))
- CommandsIndex::vie_new_from ( OUT , L "0" , cg , NORMAL_COMMAND );
- else
- CommandsIndex::vie_new_from ( OUT , Lexer::word_text ( Wordings::first_wn ( cg -> command )), cg , NORMAL_COMMAND );
- for ( int i =0; i <cg-> no_aliased_commands ; i ++)
- CommandsIndex::vie_new_from ( OUT , Lexer::word_text ( Wordings::first_wn ( cg -> aliased_command [ i ])), cg , ALIAS_COMMAND );
- }
-}
-
-void CommandsIndex::index_alias ( OUTPUT_STREAM , command_grammar * cg , text_stream * headword ) {
+void CommandsIndex::index_alias ( OUTPUT_STREAM , command_grammar * cg , text_stream * headword ) {
WRITE ( ""%S", <i>same as</i> "%N"" ,
headword , Wordings::first_wn ( cg -> command ));
TEMPORARY_TEXT ( link )
@@ -384,10 +315,10 @@ needed.
HTML_TAG ( "br" );
}
-
+
-void CommandsIndex::index_command_aliases ( OUTPUT_STREAM , command_grammar * cg ) {
+void CommandsIndex::index_command_aliases ( OUTPUT_STREAM , command_grammar * cg ) {
if ( cg == NULL ) return ;
int i , n = cg -> no_aliased_commands ;
for ( i =0; i < n ; i ++)
@@ -408,7 +339,7 @@ needed.
}
The structure cg_line_indexing_data is private to this section.
-
-void CommandsIndex::index_normal ( OUTPUT_STREAM , command_grammar * cg , text_stream * headword ) {
+void CommandsIndex::index_normal ( OUTPUT_STREAM , command_grammar * cg , text_stream * headword ) {
LOOP_THROUGH_SORTED_CG_LINES ( cgl , cg )
- CommandsIndex::cgl_index_normal ( OUT , cgl , headword );
+ CommandsIndex::cgl_index_normal ( OUT , cgl , headword );
}
void CommandsIndex::cgl_index_normal ( OUTPUT_STREAM , cg_line * cgl , text_stream * headword ) {
@@ -429,7 +360,7 @@ order of parsing — this is what the reader of the index is interested in.
if ( ActionSemantics::is_out_of_world ( an ))
HTML::begin_colour ( OUT , I "800000" );
WRITE ( """ );
- CommandsIndex::verb_definition ( OUT , Lexer::word_text ( cgl -> original_text ),
+ CommandsIndex::verb_definition ( OUT , Lexer::word_text ( cgl -> original_text ),
headword , EMPTY_WORDING );
WRITE ( """ );
Index::link ( OUT , cgl -> original_text );
@@ -442,7 +373,7 @@ order of parsing — this is what the reader of the index is interested in.
HTML_TAG ( "br" );
}
-
@@ -473,12 +404,12 @@ this for a whole list of CGLs:
list_head -> indexing_data . next_with_action = cgl ;
}
-
-int CommandsIndex::index_list_with_action ( OUTPUT_STREAM , cg_line * cgl ) {
+int CommandsIndex::index_list_with_action ( OUTPUT_STREAM , cg_line * cgl ) {
int said_something = FALSE ;
while ( cgl != NULL ) {
if ( cgl -> indexing_data . belongs_to_cg ) {
@@ -488,7 +419,7 @@ the HTML index.
WRITE_TO ( trueverb , "%W" , Wordings::one_word ( Wordings::first_wn ( VW )));
HTML::open_indented_p ( OUT , 2 , "hanging" );
WRITE ( """ );
- CommandsIndex::verb_definition ( OUT ,
+ CommandsIndex::verb_definition ( OUT ,
Lexer::word_text ( cgl -> original_text ), trueverb , VW );
WRITE ( """ );
Index::link ( OUT , cgl -> original_text );
@@ -502,7 +433,7 @@ the HTML index.
return said_something ;
}
-
@@ -517,7 +448,7 @@ the HTML index.
HTML::open_indented_p ( OUT , 2 , "hanging" );
if ( k ++ == 0 ) WRITE ( "=" ); else WRITE ( "or" );
WRITE ( " "" );
- CommandsIndex::verb_definition ( OUT ,
+ CommandsIndex::verb_definition ( OUT ,
Lexer::word_text ( cgl -> original_text ), trueverb , EMPTY_WORDING );
WRITE ( """ );
Index::link ( OUT , cgl -> original_text );
diff --git a/inform7/Figures/timings-diagnostics.txt b/inform7/Figures/timings-diagnostics.txt
index 646f47cd0..fd2c3208e 100644
--- a/inform7/Figures/timings-diagnostics.txt
+++ b/inform7/Figures/timings-diagnostics.txt
@@ -1,11 +1,11 @@
100.0% in inform7 run
- 56.2% in compilation to Inter
- 39.9% in //Sequence::undertake_queued_tasks//
+ 55.9% in compilation to Inter
+ 39.4% in //Sequence::undertake_queued_tasks//
3.7% in //MajorNodes::pre_pass//
2.8% in //MajorNodes::pass_1//
- 2.2% in //RTPhrasebook::compile_entries//
+ 2.1% in //RTPhrasebook::compile_entries//
1.5% in //ImperativeDefinitions::assess_all//
- 1.1% in //RTKindConstructors::compile//
+ 1.0% in //RTKindConstructors::compile//
0.4% in //ImperativeDefinitions::compile_first_block//
0.4% in //MajorNodes::pass_2//
0.4% in //Sequence::undertake_queued_tasks//
@@ -16,13 +16,13 @@
0.1% in //RTKindConstructors::compile_permissions//
0.1% in //Task::make_built_in_kind_constructors//
0.1% in //World::stages_II_and_III//
- 1.7% not specifically accounted for
- 41.6% in running Inter pipeline
- 10.2% in inter step 7/14: consolidate-text
- 10.0% in step preparation
+ 1.9% not specifically accounted for
+ 41.8% in running Inter pipeline
+ 11.1% in step preparation
+ 10.3% in inter step 7/14: consolidate-text
8.6% in inter step 2/14: link
- 6.9% in inter step 14/14: generate inform6 -> auto.inf
- 1.1% in inter step 10/14: make-identifiers-unique
+ 7.0% in inter step 14/14: generate inform6 -> auto.inf
+ 1.0% in inter step 10/14: make-identifiers-unique
0.3% in inter step 11/14: reconcile-verbs
0.3% in inter step 13/14: eliminate-redundant-operations
0.3% in inter step 6/14: assimilate
@@ -31,6 +31,6 @@
0.1% in inter step 4/14: parse-linked-matter
0.1% in inter step 5/14: resolve-conditional-compilation
0.1% in inter step 9/14: inspect-plugs
- 2.8% not specifically accounted for
+ 1.7% not specifically accounted for
1.7% in supervisor
- 0.4% not specifically accounted for
+ 0.5% not specifically accounted for
diff --git a/inform7/core-module/Chapter 1/Class Predeclarations.w b/inform7/core-module/Chapter 1/Class Predeclarations.w
index 08b56bece..2e8fd5792 100644
--- a/inform7/core-module/Chapter 1/Class Predeclarations.w
+++ b/inform7/core-module/Chapter 1/Class Predeclarations.w
@@ -227,14 +227,12 @@ DECLARE_CLASS(to_phrase_request)
@ //index// --
@e activity_crossref_CLASS
-@e command_index_entry_CLASS
@e connected_submap_CLASS
@e EPS_map_level_CLASS
@e rubric_holder_CLASS
=
DECLARE_CLASS_ALLOCATED_IN_ARRAYS(activity_crossref, 100)
-DECLARE_CLASS(command_index_entry)
DECLARE_CLASS(connected_submap)
DECLARE_CLASS(EPS_map_level)
DECLARE_CLASS(rubric_holder)
diff --git a/inform7/index-module/Chapter 3/Commands Index.w b/inform7/index-module/Chapter 3/Commands Index.w
index 35beb8640..e8c7fb46e 100644
--- a/inform7/index-module/Chapter 3/Commands Index.w
+++ b/inform7/index-module/Chapter 3/Commands Index.w
@@ -2,48 +2,7 @@
To construct the index of command verbs.
-@ The following modest structure is used for the indexing of command verbs,
-and is too deeply boring to comment upon. These are the headwords of commands
-which can be typed at run-time, like QUIT or INVENTORY. For indexing purposes,
-we divide these headwords into five "natures":
-
-@d NORMAL_COMMAND 1
-@d ALIAS_COMMAND 2
-@d OUT_OF_WORLD_COMMAND 3
-@d TESTING_COMMAND 4
-@d BARE_DIRECTION_COMMAND 5
-
-=
-typedef struct command_index_entry {
- int nature; /* one of the above values */
- struct text_stream *command_headword; /* text of command headword, such as "REMOVE" */
- struct command_grammar *cg_indexed; /* ...leading to... */
- struct command_index_entry *next_alphabetically; /* next in linked list */
- CLASS_DEFINITION
-} command_index_entry;
-
-command_index_entry *sorted_command_index = NULL; /* in alphabetical order of |text| */
-
@ =
-void CommandsIndex::index_meta_verb(char *t) {
- command_index_entry *vie;
- vie = CREATE(command_index_entry);
- vie->command_headword = Str::new();
- WRITE_TO(vie->command_headword, "%s", t);
- vie->nature = OUT_OF_WORLD_COMMAND;
- vie->cg_indexed = NULL;
- vie->next_alphabetically = NULL;
-}
-
-void CommandsIndex::test_verb(text_stream *t) {
- command_index_entry *vie;
- vie = CREATE(command_index_entry);
- vie->command_headword = Str::duplicate(t);
- vie->nature = TESTING_COMMAND;
- vie->cg_indexed = NULL;
- vie->next_alphabetically = NULL;
-}
-
void CommandsIndex::verb_definition(OUTPUT_STREAM, wchar_t *p, text_stream *trueverb, wording W) {
int i = 1;
if ((p[0] == 0) || (p[1] == 0)) return;
@@ -67,17 +26,6 @@ void CommandsIndex::verb_definition(OUTPUT_STREAM, wchar_t *p, text_stream *true
}
}
-command_index_entry *CommandsIndex::vie_new_from(OUTPUT_STREAM, wchar_t *headword, command_grammar *cg, int nature) {
- command_index_entry *vie;
- vie = CREATE(command_index_entry);
- vie->command_headword = Str::new();
- WRITE_TO(vie->command_headword, "%w", headword);
- vie->nature = nature;
- vie->cg_indexed = cg;
- vie->next_alphabetically = NULL;
- return vie;
-}
-
void CommandsIndex::commands(OUTPUT_STREAM) {
command_index_entry *vie, *vie2, *last_vie2, *list_start = NULL;
command_grammar *cg;
@@ -86,11 +34,7 @@ void CommandsIndex::commands(OUTPUT_STREAM) {
LOOP_OVER(cg, command_grammar)
CommandsIndex::make_command_index_entries(OUT, cg);
- vie = CREATE(command_index_entry);
- vie->command_headword = I"0";
- vie->nature = BARE_DIRECTION_COMMAND;
- vie->cg_indexed = NULL;
- vie->next_alphabetically = NULL;
+ CommandsElement::direction_verb();
LOOP_OVER(vie, command_index_entry) {
if (list_start == NULL) { list_start = vie; continue; }
@@ -273,17 +217,6 @@ to process; the other two routines act upon any such entries once they are
needed.
=
-void CommandsIndex::make_command_index_entries(OUTPUT_STREAM, command_grammar *cg) {
- if ((cg->cg_is == CG_IS_COMMAND) && (cg->first_line)) {
- if (Wordings::empty(cg->command))
- CommandsIndex::vie_new_from(OUT, L"0", cg, NORMAL_COMMAND);
- else
- CommandsIndex::vie_new_from(OUT, Lexer::word_text(Wordings::first_wn(cg->command)), cg, NORMAL_COMMAND);
- for (int i=0; ino_aliased_commands; i++)
- CommandsIndex::vie_new_from(OUT, Lexer::word_text(Wordings::first_wn(cg->aliased_command[i])), cg, ALIAS_COMMAND);
- }
-}
-
void CommandsIndex::index_alias(OUTPUT_STREAM, command_grammar *cg, text_stream *headword) {
WRITE(""%S", same as "%N"",
headword, Wordings::first_wn(cg->command));
diff --git a/inter/codegen-module/Chapter 1/Codegen Module.w b/inter/codegen-module/Chapter 1/Codegen Module.w
index a0803b712..fb34996ba 100644
--- a/inter/codegen-module/Chapter 1/Codegen Module.w
+++ b/inter/codegen-module/Chapter 1/Codegen Module.w
@@ -30,6 +30,7 @@ which use this module:
@e simplified_scene_CLASS
@e simplified_end_CLASS
@e simplified_connector_CLASS
+@e command_index_entry_CLASS
=
DECLARE_CLASS(I6T_intervention)
@@ -52,6 +53,7 @@ DECLARE_CLASS(index_tlexicon_entry)
DECLARE_CLASS(simplified_scene)
DECLARE_CLASS(simplified_end)
DECLARE_CLASS(simplified_connector)
+DECLARE_CLASS(command_index_entry)
@ Like all modules, this one must define a |start| and |end| function:
diff --git a/inter/codegen-module/Chapter 6/Commands Element.w b/inter/codegen-module/Chapter 6/Commands Element.w
new file mode 100644
index 000000000..c0b71627c
--- /dev/null
+++ b/inter/codegen-module/Chapter 6/Commands Element.w
@@ -0,0 +1,145 @@
+[CommandsElement::] Commands Element.
+
+To write the Commands element (Cm) in the index.
+
+@ =
+void CommandsElement::render(OUTPUT_STREAM) {
+ inter_tree *I = Index::get_tree();
+
+ command_index_entry *vie, *vie2, *last_vie2, *list_start = NULL;
+ command_grammar *cg;
+ int head_letter;
+
+ inter_package *pack = Inter::Packages::by_url(I, I"/main/completion/grammar");
+ inter_symbol *wanted = PackageTypes::get(I, I"_command_grammar");
+ inter_tree_node *D = Inter::Packages::definition(pack);
+ LOOP_THROUGH_INTER_CHILDREN(C, D) {
+ if (C->W.data[ID_IFLD] == PACKAGE_IST) {
+ inter_package *entry = Inter::Package::defined_by_frame(C);
+ if (Inter::Packages::type(entry) == wanted) {
+/* if ((cg->cg_is == CG_IS_COMMAND) && (cg->first_line)) {
+ if (Wordings::empty(cg->command))
+ CommandsElement::vie_new_from(OUT, L"0", cg, NORMAL_COMMAND);
+ else
+ CommandsElement::vie_new_from(OUT, Lexer::word_text(Wordings::first_wn(cg->command)), cg, NORMAL_COMMAND);
+ for (int i=0; ino_aliased_commands; i++)
+ CommandsElement::vie_new_from(OUT, Lexer::word_text(Wordings::first_wn(cg->aliased_command[i])), cg, ALIAS_COMMAND);
+*/
+ }
+ }
+ }
+ }
+
+ CommandsElement::direction_verb();
+
+ LOOP_OVER(vie, command_index_entry) {
+ if (list_start == NULL) { list_start = vie; continue; }
+ vie2 = list_start;
+ last_vie2 = NULL;
+ while (vie2 && (Str::cmp(vie->command_headword, vie2->command_headword) > 0)) {
+ last_vie2 = vie2;
+ vie2 = vie2->next_alphabetically;
+ }
+ if (last_vie2 == NULL) {
+ vie->next_alphabetically = list_start; list_start = vie;
+ } else {
+ last_vie2->next_alphabetically = vie; vie->next_alphabetically = vie2;
+ }
+ }
+
+ for (vie = list_start, head_letter = 0; vie; vie = vie->next_alphabetically) {
+ if (Str::get_first_char(vie->command_headword) != head_letter) {
+ if (head_letter) HTML_TAG("br");
+ head_letter = Str::get_first_char(vie->command_headword);
+ }
+ inter_package *cg = vie->cg_indexed;
+ switch (vie->nature) {
+ case NORMAL_COMMAND:
+ CommandsIndex::index_normal(OUT, cg, vie->command_headword);
+ break;
+ case ALIAS_COMMAND:
+ CommandsIndex::index_alias(OUT, cg, vie->command_headword);
+ break;
+ case OUT_OF_WORLD_COMMAND:
+ HTML::begin_colour(OUT, I"800000");
+ WRITE(""%S", a command for controlling play ",
+ vie->command_headword);
+ HTML::end_colour(OUT);
+ HTML_TAG("br");
+ break;
+ case TESTING_COMMAND:
+ HTML::begin_colour(OUT, I"800000");
+ WRITE(""%S", a testing command not available "
+ "in the final game ",
+ vie->command_headword);
+ HTML::end_colour(OUT);
+ HTML_TAG("br");
+ break;
+ case BARE_DIRECTION_COMMAND:
+ WRITE(""[direction]" - Going ");
+ HTML_TAG("br");
+ break;
+ }
+ }
+}
+
+@ The following modest structure is used for the indexing of command verbs,
+and is too deeply boring to comment upon. These are the headwords of commands
+which can be typed at run-time, like QUIT or INVENTORY. For indexing purposes,
+we divide these headwords into five "natures":
+
+@d NORMAL_COMMAND 1
+@d ALIAS_COMMAND 2
+@d OUT_OF_WORLD_COMMAND 3
+@d TESTING_COMMAND 4
+@d BARE_DIRECTION_COMMAND 5
+
+=
+typedef struct command_index_entry {
+ int nature; /* one of the above values */
+ struct text_stream *command_headword; /* text of command headword, such as "REMOVE" */
+ struct inter_package *cg_indexed; /* ...leading to... */
+ struct command_index_entry *next_alphabetically; /* next in linked list */
+ CLASS_DEFINITION
+} command_index_entry;
+
+command_index_entry *sorted_command_index = NULL; /* in alphabetical order of |text| */
+
+@ =
+void CommandsElement::index_meta_verb(char *t) {
+ command_index_entry *vie;
+ vie = CREATE(command_index_entry);
+ vie->command_headword = Str::new();
+ WRITE_TO(vie->command_headword, "%s", t);
+ vie->nature = OUT_OF_WORLD_COMMAND;
+ vie->cg_indexed = NULL;
+ vie->next_alphabetically = NULL;
+}
+
+void CommandsElement::test_verb(text_stream *t) {
+ command_index_entry *vie;
+ vie = CREATE(command_index_entry);
+ vie->command_headword = Str::duplicate(t);
+ vie->nature = TESTING_COMMAND;
+ vie->cg_indexed = NULL;
+ vie->next_alphabetically = NULL;
+}
+
+command_index_entry *CommandsElement::vie_new_from(wchar_t *headword, inter_package *cg, int nature) {
+ command_index_entry *vie;
+ vie = CREATE(command_index_entry);
+ vie->command_headword = Str::new();
+ WRITE_TO(vie->command_headword, "%w", headword);
+ vie->nature = nature;
+ vie->cg_indexed = cg;
+ vie->next_alphabetically = NULL;
+ return vie;
+}
+
+void CommandsElement::direction_verb(void) {
+ vie = CREATE(command_index_entry);
+ vie->command_headword = I"0";
+ vie->nature = BARE_DIRECTION_COMMAND;
+ vie->cg_indexed = NULL;
+ vie->next_alphabetically = NULL;
+}
diff --git a/inter/codegen-module/Chapter 6/Index File Services.w b/inter/codegen-module/Chapter 6/Index File Services.w
index 2ab011891..406adf248 100644
--- a/inter/codegen-module/Chapter 6/Index File Services.w
+++ b/inter/codegen-module/Chapter 6/Index File Services.w
@@ -649,21 +649,22 @@ void Index::index_actual_element(OUTPUT_STREAM, text_stream *elt) {
if (Str::eq_wide_string(elt, L"C")) { ContentsElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"Cd")) { CardElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"Ch")) { ChartElement::render(OUT); return; }
+ if (Str::eq_wide_string(elt, L"Cm")) { CommandsElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"Ev")) { EventsElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"Fi")) { FiguresElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"Gz")) { GazetteerElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"In")) { InnardsElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"Lx")) { LexiconElement::render(OUT); return; }
+ if (Str::eq_wide_string(elt, L"Ph")) { PhrasebookElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"Pl")) { PlotElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"Rl")) { RelationsElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"RS")) { RulesForScenesElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"St")) { StandardsElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"Tb")) { TablesElement::render(OUT); return; }
+ if (Str::eq_wide_string(elt, L"To")) { TokensElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"Vb")) { VerbsElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"Vl")) { ValuesElement::render(OUT); return; }
if (Str::eq_wide_string(elt, L"Xt")) { ExtrasElement::render(OUT); return; }
- if (Str::eq_wide_string(elt, L"Ph")) { PhrasebookElement::render(OUT); return; }
- if (Str::eq_wide_string(elt, L"To")) { TokensElement::render(OUT); return; }
#ifdef CORE_MODULE
if (Str::eq_wide_string(elt, L"Mp")) {
@@ -674,10 +675,6 @@ void Index::index_actual_element(OUTPUT_STREAM, text_stream *elt) {
CommandsIndex::page(OUT);
return;
}
- if (Str::eq_wide_string(elt, L"Cm")) {
- CommandsIndex::commands(OUT);
- return;
- }
if (Str::eq_wide_string(elt, L"A2")) {
CommandsIndex::alphabetical(OUT);
return;
diff --git a/inter/codegen-module/Contents.w b/inter/codegen-module/Contents.w
index 2c2c21450..a9c2b0271 100644
--- a/inter/codegen-module/Contents.w
+++ b/inter/codegen-module/Contents.w
@@ -85,3 +85,4 @@ Chapter 6: Index
Chart Element
Phrasebook Element
Tokens Element
+ Commands Element