diff --git a/docs/codegen-module/3-su.html b/docs/codegen-module/3-su.html
index bf52e7306..6c6ba6957 100644
--- a/docs/codegen-module/3-su.html
+++ b/docs/codegen-module/3-su.html
@@ -207,7 +207,7 @@ function togglePopup(material_id) {
tree_inventory * cached_inventory = NULL ;
inter_tree * cache_is_for = NULL ;
-tree_inventory * Synoptic::inv ( inter_tree * I ) {
+tree_inventory * Synoptic::inv ( inter_tree * I ) {
if ( cache_is_for == I ) return cached_inventory ;
cache_is_for = I ;
cached_inventory = Synoptic::new_inventory ( I );
@@ -238,7 +238,7 @@ function togglePopup(material_id) {
return TRUE ;
}
-
The structure tree_inventory is accessed in 3/ext, 3/lt, 3/rsp, 3/rls, 3/act, 3/act2, 3/ins, 3/knd, 3/prp, 3/rlt, 3/tbl, 3/chr, 3/scn, 3/mlt, 3/uo, 3/vrb, 3/tst, 6/be, 6/re, 6/ee, 6/fe and here. The structure tree_inventory_item is private to this section.
+The structure tree_inventory is accessed in 3/ext, 3/lt, 3/rsp, 3/rls, 3/act, 3/act2, 3/ins, 3/knd, 3/prp, 3/rlt, 3/tbl, 3/chr, 3/scn, 3/mlt, 3/uo, 3/vrb, 3/tst, 6/be, 6/re, 6/ee, 6/fe, 6/te and here. The structure tree_inventory_item is private to this section.
@@ -257,7 +257,7 @@ function togglePopup(material_id) {
return E1 -> sort_key - E2 -> sort_key ;
}
-int Synoptic::category_order ( const void * ent1 , const void * ent2 ) {
+int Synoptic::category_order ( const void * ent1 , const void * ent2 ) {
itl_entry * E1 = ( itl_entry *) ent1 ;
itl_entry * E2 = ( itl_entry *) ent2 ;
if ( E1 == E2 ) return 0 ;
@@ -373,7 +373,7 @@ function togglePopup(material_id) {
synoptic_array_node -> W . data [ synoptic_array_node -> W . extent -1] = val2 ;
}
-inter_tree_node * Synoptic::get_definition ( inter_package * pack , text_stream * name ) {
+inter_tree_node * Synoptic::get_definition ( inter_package * pack , text_stream * name ) {
inter_symbol * def_s = InterSymbolsTables::symbol_from_name ( Inter::Packages::scope ( pack ), name );
if ( def_s == NULL ) {
LOG ( "Unable to find symbol %S in $6\n" , name , pack );
@@ -395,7 +395,7 @@ function togglePopup(material_id) {
return D ;
}
-inter_package * Synoptic::module_containing ( inter_tree_node * P ) {
+inter_package * Synoptic::module_containing ( inter_tree_node * P ) {
inter_package * pack = Inter::Packages::container ( P );
inter_tree * I = Inter::Packages::tree ( pack );
while ( pack ) {
diff --git a/docs/codegen-module/6-be.html b/docs/codegen-module/6-be.html
index e3c4970f9..c9f8f059e 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 8a419ef31..0f25c4a05 100644
--- a/docs/codegen-module/6-ce.html
+++ b/docs/codegen-module/6-ce.html
@@ -150,7 +150,7 @@ simplified form of the iFiction record, without the XML overhead.
}
+
diff --git a/docs/codegen-module/6-ee.html b/docs/codegen-module/6-ee.html
index 2be343b71..e842d819d 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-fe.html b/docs/codegen-module/6-fe.html
index 18c4a8e18..6605c5333 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-ifs.html b/docs/codegen-module/6-ifs.html
index 1831d742f..990a594e7 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 ;
}
@@ -225,7 +225,6 @@ leafname
}
ifl = & index_file_struct ;
text_stream * OUT = ifl ;
-LOG ( "Index: %f\n" , F );
Set the current index page 8.1 ;
HTML::header ( OUT , title ,
@@ -838,12 +837,12 @@ to show, hide and colour things:
FiguresElement::render ( OUT );
return ;
}
-
- # ifdef CORE_MODULE
if ( Str::eq_wide_string ( elt , L "Tb" )) {
- IXTables::render ( OUT );
+ TablesElement::render ( OUT );
return ;
}
+
+ # ifdef CORE_MODULE
if ( Str::eq_wide_string ( elt , L "In" )) {
IXInnards::render ( OUT , Supervisor::current_vm ());
return ;
@@ -1023,7 +1022,7 @@ the source text in the application.
-void Index::link ( OUTPUT_STREAM , int wn ) {
+void Index::link ( OUTPUT_STREAM , int wn ) {
Index::link_to_location ( OUT , Lexer::word_location ( wn ), TRUE );
}
@@ -1096,7 +1095,7 @@ code.
-void Index::extra_link ( OUTPUT_STREAM , int id ) {
+void Index::extra_link ( OUTPUT_STREAM , int id ) {
HTML_OPEN_WITH ( "a" , "href=\"#\" onclick=\"showExtra('extra%d', 'plus%d'); return false;\"" , id , id );
HTML_TAG_WITH ( "img" , "border=0 id=\"plus%d\" src=inform:/doc_images/extra.png" , id );
HTML_CLOSE ( "a" );
@@ -1126,13 +1125,13 @@ code.
-void Index::extra_div_open ( OUTPUT_STREAM , int id , int indent , char * colour ) {
+void Index::extra_div_open ( OUTPUT_STREAM , int id , int indent , char * colour ) {
HTML_OPEN_WITH ( "div" , "id=\"extra%d\" style=\"display: none;\"" , id );
HTML::open_indented_p ( OUT , indent , "" );
HTML::open_coloured_box ( OUT , colour , ROUND_BOX_TOP + ROUND_BOX_BOTTOM );
}
-void Index::extra_div_close ( OUTPUT_STREAM , char * colour ) {
+void Index::extra_div_close ( OUTPUT_STREAM , char * colour ) {
HTML::close_coloured_box ( OUT , colour , ROUND_BOX_TOP + ROUND_BOX_BOTTOM );
HTML_CLOSE ( "p" );
HTML_CLOSE ( "div" );
@@ -1176,7 +1175,7 @@ quotes.
}
+
diff --git a/docs/codegen-module/6-ii.html b/docs/codegen-module/6-ii.html
index 152595346..05ad59ad2 100644
--- a/docs/codegen-module/6-ii.html
+++ b/docs/codegen-module/6-ii.html
@@ -288,7 +288,7 @@ time.)
+
diff --git a/docs/codegen-module/6-re.html b/docs/codegen-module/6-re.html
index 2532d11ed..c1edce1bf 100644
--- a/docs/codegen-module/6-re.html
+++ b/docs/codegen-module/6-re.html
@@ -112,7 +112,7 @@ function togglePopup(material_id) {
}
+
diff --git a/docs/codegen-module/6-te.html b/docs/codegen-module/6-te.html
new file mode 100644
index 000000000..69272032c
--- /dev/null
+++ b/docs/codegen-module/6-te.html
@@ -0,0 +1,261 @@
+
+
+
+ Tables Element
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Compiler Webs Inbuild Modules Inform7 Modules Inter Modules Services
+
+
+
+
+To write the Tables element (Tb) in the index.
+
+
+
+
+
+
+void TablesElement::render ( OUTPUT_STREAM ) {
+ inter_tree * I = Index::get_tree ();
+ tree_inventory * inv = Synoptic::inv ( I );
+ TreeLists::sort ( inv -> table_nodes , Synoptic::category_order );
+
+ inter_package * current_mod = NULL ; int mc = 0 , first_ext = TRUE ;
+ inter_ti cat = 1 , open_cat = 0 ;
+ for ( inter_ti with_cat = 1 ; with_cat <= 3 ; with_cat ++) {
+ for ( int i =0; i <TreeLists::len(inv-> table_nodes ); i ++) {
+ inter_package * mod = Synoptic::module_containing ( inv -> table_nodes -> list [ i ]. node );
+ if ( mod == NULL ) continue ;
+ cat = Metadata::read_optional_numeric ( mod , I "^category" );
+ if ( cat == with_cat ) {
+ if (( mc == 0 ) || ( mod != current_mod )) {
+ Close block of tables 1.2 ;
+ mc ++; current_mod = mod ;
+ Open block of tables 1.1 ;
+ }
+ inter_package * pack = Inter::Package::defined_by_frame ( inv -> table_nodes -> list [ i ]. node );
+ Index this table 1.3 ;
+ }
+ }
+ }
+ Close block of tables 1.2 ;
+}
+
+
+
+
+ if ( cat > 1 ) {
+ if ( first_ext ) {
+ HTML_OPEN ( "p" );
+ Index::extra_link ( OUT , 2 );
+ if ( mc > 1 ) WRITE ( "Show tables inside extensions too" );
+ else WRITE ( "Show tables inside extensions (there are none in the main text)" );
+ HTML_CLOSE ( "p" );
+ first_ext = FALSE ;
+ }
+ Index::extra_div_open ( OUT , 2 , 1 , "e0e0e0" );
+ HTML_OPEN ( "p" );
+ WRITE ( "<i>%S</i>" , Metadata::read_textual ( mod , I "^title" ));
+ HTML_CLOSE ( "p" );
+ }
+ open_cat = cat ;
+ HTML::begin_plain_html_table ( OUT );
+
+
+
+
+
+ if ( mc > 0 ) {
+ HTML::end_html_table ( OUT );
+ if ( open_cat > 1 ) Index::extra_div_close ( OUT , "e0e0e0" );
+ }
+
+This code is used in §1 (twice).
+
+
+
+
+
+ HTML::first_html_column_spaced ( OUT , 0 );
+ WRITE ( "<b>%S</b>" , Metadata::read_textual ( pack , I "^printed_name" ));
+ int ntc = 0 ;
+ 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 ) == PackageTypes::get ( I , I "_table_contribution" )) {
+ if ( ntc ++ > 0 ) WRITE ( " +" );
+ int at = ( int ) Metadata::read_optional_numeric ( entry , I "^at" );
+ Index::link ( OUT , at );
+ }
+ }
+ }
+ HTML::next_html_column_spaced ( OUT , 0 );
+
+ int nc = 0 ;
+ 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 ) == PackageTypes::get ( I , I "_table_column_usage" ))
+ nc ++;
+ }
+ }
+ int nr = ( int ) Metadata::read_numeric ( pack , I "^rows" );
+ int nb = ( int ) Metadata::read_numeric ( pack , I "^blank_rows" );
+ int defines = ( int ) Metadata::read_optional_numeric ( pack , I "^defines" );
+ text_stream * for_each = Metadata::read_optional_textual ( pack , I "^blank_rows_for_each" );
+
+ WRITE ( "<i>" );
+ HTML_OPEN_WITH ( "span" , "class=\"smaller\"" );
+ if ( defines ) {
+ WRITE ( "%d definition%s" , nr , ( nr == 1 )? "" : "s" );
+ } else {
+ WRITE ( "%d column%s x %d row%s" , nc , ( nc == 1 )? "" : "s" , nr , ( nr == 1 )? "" : "s" );
+ }
+ if ( nb > 0 ) {
+ WRITE ( " (%d blank" , nb );
+ if ( Str::len ( for_each ) > 0 ) WRITE ( ", one for each %S" , for_each );
+ WRITE ( ")" );
+ }
+ HTML_CLOSE ( "span" );
+ WRITE ( "</i>" );
+
+ HTML::end_html_row ( OUT );
+
+ int col = 0 ;
+ 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 ) == PackageTypes::get ( I , I "_table_column_usage" )) {
+ inter_tree_node * ID = Synoptic::get_definition ( entry , I "column_identity" );
+ inter_symbol * id_s = NULL ;
+ if ( ID -> W . data [ DATA_CONST_IFLD ] == ALIAS_IVAL )
+ id_s = InterSymbolsTables::symbol_from_id ( Inter::Packages::scope ( entry ), ID -> W . data [ DATA_CONST_IFLD +1]);
+ if ( id_s == NULL ) internal_error ( "column_identity not an ALIAS_IVAL" );
+ inter_package * col_pack = Inter::Packages::container ( id_s -> definition );
+ LOG ( "Whellll... $6\n" , col_pack );
+
+ HTML::first_html_column ( OUT , 0 );
+ WRITE ( " col %d: " , col +1);
+ Give column details 1.3.1 ;
+ HTML::next_html_column ( OUT , 0 );
+ Give column 2 details 1.3.2 ;
+ HTML::end_html_row ( OUT );
+ col ++;
+ }
+ }
+ }
+
+
+
+
+
+ text_stream * CW = Metadata::read_optional_textual ( col_pack , I "^name" );
+ if (( defines ) && ( col == 0 )) {
+ WRITE ( "%S" , Metadata::read_optional_textual ( pack , I "^defines_text" ));
+ int at = ( int ) Metadata::read_optional_numeric ( pack , I "^defines_at" );
+ Index::link ( OUT , at );
+ } else {
+ if ( defines ) WRITE ( "<i>sets</i> " );
+ WRITE ( "%S " , CW );
+ TEMPORARY_TEXT ( TEMP )
+ WRITE_TO ( TEMP , "%S" , CW );
+ if ( defines == FALSE ) WRITE_TO ( TEMP , " entry" );
+ PasteButtons::paste_text ( OUT , TEMP );
+ DISCARD_TEXT ( TEMP )
+ }
+
+This code is used in §1.3 .
+
+
+
+ if (( defines ) && ( col == 0 )) {
+ WRITE ( "<i>names</i>" );
+ } else if ( defines ) {
+ WRITE ( "%S property" , Metadata::read_optional_textual ( col_pack , I "^contents" ));
+ } else {
+ WRITE ( "of %S" , Metadata::read_optional_textual ( col_pack , I "^contents" ));
+ }
+
+This code is used in §1.3 .
+
+
+
+
+
+
+
diff --git a/docs/codegen-module/index.html b/docs/codegen-module/index.html
index bad07846c..cec479df6 100644
--- a/docs/codegen-module/index.html
+++ b/docs/codegen-module/index.html
@@ -361,6 +361,11 @@
Figures Element -
To write the Figures element (Fi) in the index.
+
+
+ Tables Element -
+ To write the Tables element (Tb) in the index.
+
diff --git a/docs/index-module/2-act.html b/docs/index-module/2-act.html
index c0374343e..113084c9a 100644
--- a/docs/index-module/2-act.html
+++ b/docs/index-module/2-act.html
@@ -86,7 +86,7 @@ function togglePopup(material_id) {
struct activity_crossref * next ;
} activity_crossref ;
-The structure activity_indexing_data is private to this section. The structure activity_crossref is accessed in 2/ins, 2/rls, 2/te, 3/pe, 4/em and here.
+The structure activity_indexing_data is private to this section. The structure activity_crossref is accessed in 2/ins, 2/rls, 3/pe, 4/em and here.
@@ -164,7 +164,7 @@ function togglePopup(material_id) {
}
+
diff --git a/docs/index-module/2-adj.html b/docs/index-module/2-adj.html
index ba251424b..5919052de 100644
--- a/docs/index-module/2-adj.html
+++ b/docs/index-module/2-adj.html
@@ -104,7 +104,7 @@ prefaced "(of a rulebook)", "(of an activity)", and so on.
+
diff --git a/docs/index-module/2-ae.html b/docs/index-module/2-ae.html
index 8034545c6..aab8aa63d 100644
--- a/docs/index-module/2-ae.html
+++ b/docs/index-module/2-ae.html
@@ -217,7 +217,7 @@ text, sorted into kind order of left and then right operand.
+
diff --git a/docs/index-module/2-ce.html b/docs/index-module/2-ce.html
index c53386c5b..4a46da452 100644
--- a/docs/index-module/2-ce.html
+++ b/docs/index-module/2-ce.html
@@ -129,7 +129,7 @@ function togglePopup(material_id) {
}
}
-The structure contents_entry is accessed in 2/ins, 2/rls, 2/act, 2/te, 3/pe, 4/em and here.
+The structure contents_entry is accessed in 2/ins, 2/rls, 2/act, 3/pe, 4/em and here.
@@ -312,7 +312,7 @@ giving only minimal entries about them.
}
+
diff --git a/docs/index-module/2-ie.html b/docs/index-module/2-ie.html
index 5053158e7..5d2451236 100644
--- a/docs/index-module/2-ie.html
+++ b/docs/index-module/2-ie.html
@@ -299,7 +299,7 @@ dictionary.
}
+
diff --git a/docs/index-module/2-ie2.html b/docs/index-module/2-ie2.html
index 168e68726..1f84b4fef 100644
--- a/docs/index-module/2-ie2.html
+++ b/docs/index-module/2-ie2.html
@@ -255,7 +255,7 @@ function togglePopup(material_id) {
This code is used in §5 (twice).
+
diff --git a/docs/index-module/2-inf.html b/docs/index-module/2-inf.html
index 0b98805b4..c10ed81d4 100644
--- a/docs/index-module/2-inf.html
+++ b/docs/index-module/2-inf.html
@@ -194,7 +194,7 @@ state of being boolean, and the given certainty levels:
}
+
diff --git a/docs/index-module/2-ins.html b/docs/index-module/2-ins.html
index ef83bcba3..6516eab1d 100644
--- a/docs/index-module/2-ins.html
+++ b/docs/index-module/2-ins.html
@@ -89,7 +89,7 @@ function togglePopup(material_id) {
struct instance_usage * next ;
} instance_usage ;
-The structure instance_index_data is private to this section. The structure instance_usage is accessed in 2/rls, 2/act, 2/te, 3/pe, 4/em and here.
+The structure instance_index_data is private to this section. The structure instance_usage is accessed in 2/rls, 2/act, 3/pe, 4/em and here.
@@ -203,7 +203,7 @@ constant value.
}
+
diff --git a/docs/index-module/2-ki.html b/docs/index-module/2-ki.html
index e71e51bef..5c889dd1d 100644
--- a/docs/index-module/2-ki.html
+++ b/docs/index-module/2-ki.html
@@ -571,7 +571,7 @@ as "0 kg", "0 hectares", or whatever is appropriate.
+
diff --git a/docs/index-module/2-li.html b/docs/index-module/2-li.html
index 22e118e48..5044f208d 100644
--- a/docs/index-module/2-li.html
+++ b/docs/index-module/2-li.html
@@ -712,7 +712,7 @@ be able to print out a table of just those verbs created in that extension.
}
+
diff --git a/docs/index-module/2-me.html b/docs/index-module/2-me.html
index 3678b88d6..d03c2d4d8 100644
--- a/docs/index-module/2-me.html
+++ b/docs/index-module/2-me.html
@@ -475,7 +475,7 @@ table of Kinds.
}
+
diff --git a/docs/index-module/2-pi.html b/docs/index-module/2-pi.html
index b5ad87a76..3212aa728 100644
--- a/docs/index-module/2-pi.html
+++ b/docs/index-module/2-pi.html
@@ -501,7 +501,7 @@ so we won't list them here.
}
+
diff --git a/docs/index-module/2-prp.html b/docs/index-module/2-prp.html
index 91d045136..b8227b552 100644
--- a/docs/index-module/2-prp.html
+++ b/docs/index-module/2-prp.html
@@ -143,7 +143,7 @@ function togglePopup(material_id) {
}
+
diff --git a/docs/index-module/2-rfse.html b/docs/index-module/2-rfse.html
index 0dabf3cac..b71fbb118 100644
--- a/docs/index-module/2-rfse.html
+++ b/docs/index-module/2-rfse.html
@@ -82,7 +82,7 @@
}
+
diff --git a/docs/index-module/2-rls.html b/docs/index-module/2-rls.html
index 07b678679..b4ee3a942 100644
--- a/docs/index-module/2-rls.html
+++ b/docs/index-module/2-rls.html
@@ -796,7 +796,7 @@ have affected it in this way:
}
}
-The structure rulebook_indexing_data is private to this section. The structure placement_affecting is accessed in 2/ins, 2/act, 2/te, 3/pe, 4/em and here.
+The structure rulebook_indexing_data is private to this section. The structure placement_affecting is accessed in 2/ins, 2/act, 3/pe, 4/em and here.
@@ -864,7 +864,7 @@ text to assert a change:
}
+
diff --git a/docs/index-module/2-te.html b/docs/index-module/2-te.html
deleted file mode 100644
index a1c5a0d79..000000000
--- a/docs/index-module/2-te.html
+++ /dev/null
@@ -1,221 +0,0 @@
-
-
-
- Tables Element
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Compiler Webs Inbuild Modules Inform7 Modules Inter Modules Services
-
-
-
-
-To index tables.
-
-
-
-
-
-
-void IXTables::render ( OUTPUT_STREAM ) {
- HTML_OPEN ( "p" );
- int m = IXTables::index_tables_in ( OUT , NULL , 0 );
- HTML_CLOSE ( "p" );
- HTML_OPEN ( "p" );
- Index::extra_link ( OUT , 2 );
- if ( m > 0 ) WRITE ( "Show tables inside extensions too" );
- else WRITE ( "Show tables inside extensions (there are none in the main text)" );
- HTML_CLOSE ( "p" );
- Index::extra_div_open ( OUT , 2 , 1 , "e0e0e0" );
- inform_extension * E ; int efc = 0 ;
- LOOP_OVER ( E , inform_extension ) IXTables::index_tables_in ( OUT , E , efc ++);
- Index::extra_div_close ( OUT , "e0e0e0" );
-}
-
-
-
-
-int IXTables::index_tables_in ( OUTPUT_STREAM , inform_extension * E , int efc ) {
- int tc = 0 ; table * t ;
- LOOP_OVER ( t , table ) if ( IXTables::table_within ( t , E )) tc ++;
- if ( tc > 0 ) {
- if ( E ) {
- HTML_OPEN ( "p" );
- WRITE ( "<i>%S</i>" , E -> as_copy -> edition -> work -> title );
- HTML_CLOSE ( "p" );
- }
- HTML::begin_plain_html_table ( OUT );
- LOOP_OVER ( t , table )
- if ( IXTables::table_within ( t , E ))
- Index this table 2.1 ;
- HTML::end_html_table ( OUT );
- }
- return tc ;
-}
-
-
-
-
-
-
- HTML::first_html_column_spaced ( OUT , 0 );
- WRITE ( "<b>%+W</b>" , Node::get_text ( t -> headline_fragment ));
- table_contribution * tc ; int ntc = 0 ;
- for ( tc = t -> table_created_at ; tc ; tc = tc -> next ) {
- if ( ntc ++ > 0 ) WRITE ( " +" );
- Index::link ( OUT , Wordings::first_wn ( Node::get_text ( tc -> source_table )));
- }
- HTML::next_html_column_spaced ( OUT , 0 );
- int rc = Tables::get_no_rows ( t );
- WRITE ( "<i>" );
- HTML_OPEN_WITH ( "span" , "class=\"smaller\"" );
- if ( t -> first_column_by_definition ) {
- WRITE ( "%d definition%s" , rc ,
- ( rc == 1 )? "" : "s" );
- } else {
- WRITE ( "%d column%s x %d row%s" ,
- t -> no_columns , ( t -> no_columns == 1 )? "" : "s" ,
- rc , ( rc == 1 )? "" : "s" );
- }
- if ( t -> blank_rows > 0 ) {
- WRITE ( " (%d blank" , t -> blank_rows );
- if ( Wordings::nonempty ( t -> blank_rows_for_each_text ))
- WRITE ( ", one for each %+W" , t -> blank_rows_for_each_text );
- WRITE ( ")" );
- }
- HTML_CLOSE ( "span" );
- WRITE ( "</i>" );
- HTML::end_html_row ( OUT );
- int col ;
- for ( col = 0 ; col < t -> no_columns ; col ++) {
- HTML::first_html_column ( OUT , 0 );
- WRITE ( " col %d: " , col +1);
- wording CW = Nouns::nominative_singular ( t -> columns [ col ]. column_identity -> name );
- if (( t -> first_column_by_definition ) && ( col == 0 )) {
- parse_node * PN = t -> where_used_to_define ;
- WRITE ( "%+W" , Node::get_text ( PN ));
- Index::link ( OUT , Wordings::first_wn ( Node::get_text ( PN )));
- } else {
- if ( t -> first_column_by_definition ) WRITE ( "<i>sets</i> " );
- WRITE ( "%+W " , CW );
- TEMPORARY_TEXT ( TEMP )
- WRITE_TO ( TEMP , "%+W" , CW );
- if ( t -> first_column_by_definition == FALSE ) WRITE_TO ( TEMP , " entry" );
- PasteButtons::paste_text ( OUT , TEMP );
- DISCARD_TEXT ( TEMP )
- }
- HTML::next_html_column ( OUT , 0 );
- if (( t -> first_column_by_definition ) && ( col == 0 )) {
- parse_node * cell ;
- int row ;
- for ( row = 1 , cell = t -> columns [0]. entries -> down ; cell ; cell = cell -> next , row ++) {
- if ( row > 1 ) WRITE ( ", " );
- WRITE ( "%+W" , Node::get_text ( cell ));
- Index::link ( OUT , Wordings::first_wn ( Node::get_text ( cell )));
- }
- } else if ( t -> first_column_by_definition ) {
- Kinds::Textual::write ( OUT ,
- Tables::Columns::get_kind (
- t -> columns [ col ]. column_identity ));
- WRITE ( " property" );
- } else {
- WRITE ( "of " );
- Kinds::Textual::write_plural ( OUT ,
- Tables::Columns::get_kind (
- t -> columns [ col ]. column_identity ));
- }
- HTML::end_html_row ( OUT );
- }
-
-
-
-
-
-int IXTables::table_within ( table * t , inform_extension * E ) {
- if ( t -> amendment_of ) return FALSE ;
- heading * at_heading =
- Headings::of_wording ( Node::get_text ( t -> table_created_at -> source_table ));
- inform_extension * at_E = Headings::get_extension_containing ( at_heading );
- if ( E == at_E ) return TRUE ;
- return FALSE ;
-}
-
-
-
-
-
-
-
-
diff --git a/docs/index-module/2-ve.html b/docs/index-module/2-ve.html
index f2581602e..bdfa50933 100644
--- a/docs/index-module/2-ve.html
+++ b/docs/index-module/2-ve.html
@@ -188,7 +188,7 @@ the following:
}
+
diff --git a/docs/index-module/4-em.html b/docs/index-module/4-em.html
index ae6d35547..d831a1f64 100644
--- a/docs/index-module/4-em.html
+++ b/docs/index-module/4-em.html
@@ -127,7 +127,7 @@ values inherited by sub-objects.
int numeric_value ;
} plotting_parameter ;
-The structure plotting_parameter is accessed in 2/ie, 2/ins, 2/ve, 2/prp, 2/inf, 2/rls, 2/act, 2/pi, 2/te, 2/ie2 and here.
+The structure plotting_parameter is accessed in 2/ie, 2/ins, 2/ve, 2/prp, 2/inf, 2/rls, 2/act, 2/pi, 2/ie2 and here.
-
-
- Tables Element -
- To index tables.
-
Innards Element -
diff --git a/docs/runtime-module/2-hrr.html b/docs/runtime-module/2-hrr.html
index c46f994e8..24df73736 100644
--- a/docs/runtime-module/2-hrr.html
+++ b/docs/runtime-module/2-hrr.html
@@ -1378,6 +1378,12 @@ that the compiler can refer to it.
enum TABLE_PNAME_MD_HL
enum TABLE_VALUE_MD_HL
enum RANKING_TABLE_MD_HL
+enum TABLE_ROWS_MD_HL
+enum TABLE_BLANK_ROWS_MD_HL
+enum TABLE_BLANK_ROWS_FOR_MD_HL
+enum TABLE_DEFINES_MD_HL
+enum TABLE_DEFINES_TEXT_MD_HL
+enum TABLE_DEFINES_AT_MD_HL
enum TABLE_ID_HL
enum TABLE_DATA_HL
enum TABLE_COLUMN_USAGES_HAP
@@ -1386,8 +1392,12 @@ that the compiler can refer to it.
enum COLUMN_BITS_HL
enum COLUMN_BLANKS_HL
enum COLUMN_BLANK_DATA_HL
+enum TABLE_CONTRIBUTION_HAP
+enum TABLE_CONTRIBUTION_AT_MD_HL
enum TABLE_COLUMNS_HAP
enum TABLE_COLUMN_ID_HL
+enum TABLE_COLUMN_NAME_MD_HL
+enum TABLE_COLUMN_CONTENTS_MD_HL
enum TABLE_COLUMN_KIND_MD_HL
-package_request * Hierarchy::package_within ( int hap_id , package_request * super ) {
+package_request * Hierarchy::package_within ( int hap_id , package_request * super ) {
return HierarchyLocations::attach_new_package ( Emit::tree (), NULL , super , hap_id );
}
@@ -1869,12 +1890,12 @@ point system, and for those:
-void Hierarchy::apply_metadata ( package_request * P , int id , text_stream * value ) {
+void Hierarchy::apply_metadata ( package_request * P , int id , text_stream * value ) {
inter_name * iname = Hierarchy::make_iname_in ( id , P );
Emit::text_constant ( iname , value );
}
-void Hierarchy::apply_metadata_from_number ( package_request * P , int id , inter_ti N ) {
+void Hierarchy::apply_metadata_from_number ( package_request * P , int id , inter_ti N ) {
inter_name * iname = Hierarchy::make_iname_in ( id , P );
Emit::numeric_constant ( iname , N );
}
@@ -1891,7 +1912,7 @@ point system, and for those:
DISCARD_TEXT ( ANT )
}
-void Hierarchy::apply_metadata_from_raw_wording ( package_request * P , int id , wording W ) {
+void Hierarchy::apply_metadata_from_raw_wording ( package_request * P , int id , wording W ) {
TEMPORARY_TEXT ( ANT )
WRITE_TO ( ANT , "%+W" , W );
Hierarchy::apply_metadata ( P , id , ANT );
diff --git a/docs/runtime-module/5-tbl.html b/docs/runtime-module/5-tbl.html
index 504d62227..b2956798c 100644
--- a/docs/runtime-module/5-tbl.html
+++ b/docs/runtime-module/5-tbl.html
@@ -421,6 +421,29 @@ case.)
WRITE_TO ( S , "%+W" , Node::get_text ( t -> headline_fragment ));
Hierarchy::apply_metadata ( RTTables::package ( t ), TABLE_PNAME_MD_HL , S );
DISCARD_TEXT ( S )
+ for ( table_contribution * tc = t -> table_created_at ; tc ; tc = tc -> next ) {
+ package_request * R =
+ Hierarchy::package_within ( TABLE_CONTRIBUTION_HAP ,
+ RTTables::package ( t ));
+ Hierarchy::apply_metadata_from_number ( R , TABLE_CONTRIBUTION_AT_MD_HL ,
+ ( inter_ti ) Wordings::first_wn ( Node::get_text ( tc -> source_table )));
+ }
+ Hierarchy::apply_metadata_from_number ( RTTables::package ( t ),
+ TABLE_ROWS_MD_HL , ( inter_ti ) Tables::get_no_rows ( t ));
+ Hierarchy::apply_metadata_from_number ( RTTables::package ( t ),
+ TABLE_BLANK_ROWS_MD_HL , ( inter_ti ) t -> blank_rows );
+ if ( Wordings::nonempty ( t -> blank_rows_for_each_text ))
+ Hierarchy::apply_metadata_from_raw_wording ( RTTables::package ( t ),
+ TABLE_BLANK_ROWS_FOR_MD_HL , t -> blank_rows_for_each_text );
+ if ( t -> first_column_by_definition ) {
+ Hierarchy::apply_metadata_from_number ( RTTables::package ( t ),
+ TABLE_DEFINES_MD_HL , 1 );
+ Hierarchy::apply_metadata_from_raw_wording ( RTTables::package ( t ),
+ TABLE_DEFINES_TEXT_MD_HL , Node::get_text ( t -> where_used_to_define ));
+ Hierarchy::apply_metadata_from_number ( RTTables::package ( t ),
+ TABLE_DEFINES_AT_MD_HL ,
+ ( inter_ti ) Wordings::first_wn ( Node::get_text ( t -> where_used_to_define )));
+ }
+
+
+ Table of Honorary Jerseys
+
+
+ 4 definitions
+
+
+
+
+ col 1: Some jerseys in the Home
+
+
+ names
+
+
+
+
+ col 2: sets citation
+
+
+ texts property
+
+
+
+
+ col 3: sets jersey
+
+
+ objects property
+
+
+
+
+ Table 4 - Recent Monarchs
+
+
+ 3 columns x 12 rows
+
+
+
+
+ col 1: Name
+
+
+ of texts
+
+
+
+
+ col 2: Accession
+
+
+ of numbers
+
+
+
+
+ col 3: Family
+
+
+ of dynasties
+
+
+
+
+ Table 2.1 - Selected Elements
+
+
+ 5 columns x 7 rows (3 blank)
+
+
+
+
+ col 1: Element
+
+
+ of texts
+
+
+
+
+ col 2: Symbol
+
+
+ of texts
+
+
+
+
+ col 3: Atomic number
+
+
+ of numbers
+
+
+
+
+ col 4: Atomic weight
+
+
+ of numbers
+
+
+
+
+ col 5: Mystery
+
+
+ of lists of numbers
+
+
+
+ Show tables inside extensions too
+
+
diff --git a/inform7/index-module/Chapter 2/Tables Element.w b/inform7/index-module/Chapter 2/Tables Element.w
deleted file mode 100644
index 9908d8983..000000000
--- a/inform7/index-module/Chapter 2/Tables Element.w
+++ /dev/null
@@ -1,133 +0,0 @@
-[IXTables::] Tables Element.
-
-To index tables.
-
-@h Indexing.
-Tables inside extensions are often used just for the storage needed to manage
-back-of-house algorithms, so to speak, and they aren't intended for the end
-user to poke around with; that's certainly true of the tables in the Standard
-Rules, which of course are always present. So these are hidden by default.
-
-=
-void IXTables::render(OUTPUT_STREAM) {
- HTML_OPEN("p");
- int m = IXTables::index_tables_in(OUT, NULL, 0);
- HTML_CLOSE("p");
- HTML_OPEN("p");
- Index::extra_link(OUT, 2);
- if (m > 0) WRITE("Show tables inside extensions too");
- else WRITE("Show tables inside extensions (there are none in the main text)");
- HTML_CLOSE("p");
- Index::extra_div_open(OUT, 2, 1, "e0e0e0");
- inform_extension *E; int efc = 0;
- LOOP_OVER(E, inform_extension) IXTables::index_tables_in(OUT, E, efc++);
- Index::extra_div_close(OUT, "e0e0e0");
-}
-
-@ This tabulates tables within a given extension, returning the number listed,
-and does nothing at all if that number is 0.
-
-=
-int IXTables::index_tables_in(OUTPUT_STREAM, inform_extension *E, int efc) {
- int tc = 0; table *t;
- LOOP_OVER(t, table) if (IXTables::table_within(t, E)) tc++;
- if (tc > 0) {
- if (E) {
- HTML_OPEN("p");
- WRITE("%S ", E->as_copy->edition->work->title);
- HTML_CLOSE("p");
- }
- HTML::begin_plain_html_table(OUT);
- LOOP_OVER(t, table)
- if (IXTables::table_within(t, E))
- @;
- HTML::end_html_table(OUT);
- }
- return tc;
-}
-
-@ The following probably ought to use a multiplication sign rather than a
-Helvetica-style lower case "x", but life is full of compromises.
-
-@ =
- HTML::first_html_column_spaced(OUT, 0);
- WRITE("%+W ", Node::get_text(t->headline_fragment));
- table_contribution *tc; int ntc = 0;
- for (tc = t->table_created_at; tc; tc = tc->next) {
- if (ntc++ > 0) WRITE(" +");
- Index::link(OUT, Wordings::first_wn(Node::get_text(tc->source_table)));
- }
- HTML::next_html_column_spaced(OUT, 0);
- int rc = Tables::get_no_rows(t);
- WRITE("");
- HTML_OPEN_WITH("span", "class=\"smaller\"");
- if (t->first_column_by_definition) {
- WRITE("%d definition%s", rc,
- (rc == 1)?"":"s");
- } else {
- WRITE("%d column%s x %d row%s",
- t->no_columns, (t->no_columns == 1)?"":"s",
- rc, (rc == 1)?"":"s");
- }
- if (t->blank_rows > 0) {
- WRITE(" (%d blank", t->blank_rows);
- if (Wordings::nonempty(t->blank_rows_for_each_text))
- WRITE(", one for each %+W", t->blank_rows_for_each_text);
- WRITE(")");
- }
- HTML_CLOSE("span");
- WRITE(" ");
- HTML::end_html_row(OUT);
- int col;
- for (col = 0; col < t->no_columns; col++) {
- HTML::first_html_column(OUT, 0);
- WRITE(" col %d: ", col+1);
- wording CW = Nouns::nominative_singular(t->columns[col].column_identity->name);
- if ((t->first_column_by_definition) && (col == 0)) {
- parse_node *PN = t->where_used_to_define;
- WRITE("%+W", Node::get_text(PN));
- Index::link(OUT, Wordings::first_wn(Node::get_text(PN)));
- } else {
- if (t->first_column_by_definition) WRITE("sets ");
- WRITE("%+W ", CW);
- TEMPORARY_TEXT(TEMP)
- WRITE_TO(TEMP, "%+W", CW);
- if (t->first_column_by_definition == FALSE) WRITE_TO(TEMP, " entry");
- PasteButtons::paste_text(OUT, TEMP);
- DISCARD_TEXT(TEMP)
- }
- HTML::next_html_column(OUT, 0);
- if ((t->first_column_by_definition) && (col == 0)) {
- parse_node *cell;
- int row;
- for (row = 1, cell = t->columns[0].entries->down; cell; cell = cell->next, row++) {
- if (row > 1) WRITE(", ");
- WRITE("%+W", Node::get_text(cell));
- Index::link(OUT, Wordings::first_wn(Node::get_text(cell)));
- }
- } else if (t->first_column_by_definition) {
- Kinds::Textual::write(OUT,
- Tables::Columns::get_kind(
- t->columns[col].column_identity));
- WRITE(" property");
- } else {
- WRITE("of ");
- Kinds::Textual::write_plural(OUT,
- Tables::Columns::get_kind(
- t->columns[col].column_identity));
- }
- HTML::end_html_row(OUT);
- }
-
-@ The following laboriously tests whether a table is defined within a
-given extension:
-
-=
-int IXTables::table_within(table *t, inform_extension *E) {
- if (t->amendment_of) return FALSE;
- heading *at_heading =
- Headings::of_wording(Node::get_text(t->table_created_at->source_table));
- inform_extension *at_E = Headings::get_extension_containing(at_heading);
- if (E == at_E) return TRUE;
- return FALSE;
-}
diff --git a/inform7/index-module/Contents.w b/inform7/index-module/Contents.w
index f3b180bf8..f60eced49 100644
--- a/inform7/index-module/Contents.w
+++ b/inform7/index-module/Contents.w
@@ -22,7 +22,6 @@ Chapter 2: Indexing
Rules
Activities
Phrasebook Index
- Tables Element
Innards Element
Rules for Scenes Element
Arithmetic Element
diff --git a/inform7/runtime-module/Chapter 2/Hierarchy.w b/inform7/runtime-module/Chapter 2/Hierarchy.w
index f0fd3f81f..7061e8398 100644
--- a/inform7/runtime-module/Chapter 2/Hierarchy.w
+++ b/inform7/runtime-module/Chapter 2/Hierarchy.w
@@ -1214,6 +1214,12 @@ void Hierarchy::establish(void) {
@e TABLE_PNAME_MD_HL
@e TABLE_VALUE_MD_HL
@e RANKING_TABLE_MD_HL
+@e TABLE_ROWS_MD_HL
+@e TABLE_BLANK_ROWS_MD_HL
+@e TABLE_BLANK_ROWS_FOR_MD_HL
+@e TABLE_DEFINES_MD_HL
+@e TABLE_DEFINES_TEXT_MD_HL
+@e TABLE_DEFINES_AT_MD_HL
@e TABLE_ID_HL
@e TABLE_DATA_HL
@e TABLE_COLUMN_USAGES_HAP
@@ -1222,9 +1228,13 @@ void Hierarchy::establish(void) {
@e COLUMN_BITS_HL
@e COLUMN_BLANKS_HL
@e COLUMN_BLANK_DATA_HL
+@e TABLE_CONTRIBUTION_HAP
+@e TABLE_CONTRIBUTION_AT_MD_HL
@e TABLE_COLUMNS_HAP
@e TABLE_COLUMN_ID_HL
+@e TABLE_COLUMN_NAME_MD_HL
+@e TABLE_COLUMN_CONTENTS_MD_HL
@e TABLE_COLUMN_KIND_MD_HL
@ =
@@ -1236,6 +1246,12 @@ void Hierarchy::establish(void) {
H_C_U(TABLE_PNAME_MD_HL, I"^printed_name")
H_C_U(TABLE_VALUE_MD_HL, I"^value")
H_C_U(RANKING_TABLE_MD_HL, I"^ranking_table")
+ H_C_U(TABLE_ROWS_MD_HL, I"^rows")
+ H_C_U(TABLE_BLANK_ROWS_MD_HL, I"^blank_rows")
+ H_C_U(TABLE_BLANK_ROWS_FOR_MD_HL, I"^blank_rows_for_each")
+ H_C_U(TABLE_DEFINES_MD_HL, I"^defines")
+ H_C_U(TABLE_DEFINES_TEXT_MD_HL, I"^defines_text")
+ H_C_U(TABLE_DEFINES_AT_MD_HL, I"^defines_at")
H_C_U(TABLE_ID_HL, I"table_id")
H_C_U(TABLE_DATA_HL, I"table_data")
H_BEGIN_AP(TABLE_COLUMN_USAGES_HAP, I"column", I"_table_column_usage")
@@ -1245,6 +1261,9 @@ void Hierarchy::establish(void) {
H_C_U(COLUMN_BLANKS_HL, I"column_blanks")
H_C_U(COLUMN_BLANK_DATA_HL, I"^column_blank_data")
H_END
+ H_BEGIN_AP(TABLE_CONTRIBUTION_HAP, I"contribution", I"_table_contribution")
+ H_C_U(TABLE_CONTRIBUTION_AT_MD_HL, I"^at")
+ H_END
H_END
H_END
@@ -1252,7 +1271,9 @@ void Hierarchy::establish(void) {
H_BEGIN(HierarchyLocations::local_submodule(table_columns))
H_BEGIN_AP(TABLE_COLUMNS_HAP, I"table_column", I"_table_column")
H_C_U(TABLE_COLUMN_ID_HL, I"table_column_id")
- H_C_U(TABLE_COLUMN_KIND_MD_HL, I"^column_kind")
+ H_C_U(TABLE_COLUMN_NAME_MD_HL, I"^name")
+ H_C_U(TABLE_COLUMN_CONTENTS_MD_HL, I"^contents")
+ H_C_U(TABLE_COLUMN_KIND_MD_HL, I"^column_kind")
H_END
H_END
diff --git a/inform7/runtime-module/Chapter 5/Table Columns.w b/inform7/runtime-module/Chapter 5/Table Columns.w
index 9facce553..a841778a8 100644
--- a/inform7/runtime-module/Chapter 5/Table Columns.w
+++ b/inform7/runtime-module/Chapter 5/Table Columns.w
@@ -44,9 +44,15 @@ to the column-ID constant, and let the linker choose a value for that.
void RTTableColumns::compile(void) {
table_column *tc;
LOOP_OVER(tc, table_column) {
+ package_request *pack = RTTableColumns::package(tc);
Emit::numeric_constant(RTTableColumns::id_iname(tc), 0); /* placeholder value */
- inter_name *kind_iname = Hierarchy::make_iname_in(TABLE_COLUMN_KIND_MD_HL,
- RTTableColumns::package(tc));
+ inter_name *kind_iname = Hierarchy::make_iname_in(TABLE_COLUMN_KIND_MD_HL, pack);
RTKindIDs::define_constant_as_strong_id(kind_iname, Tables::Columns::get_kind(tc));
+ Hierarchy::apply_metadata_from_raw_wording(pack,
+ TABLE_COLUMN_NAME_MD_HL, Nouns::nominative_singular(tc->name));
+ TEMPORARY_TEXT(conts)
+ Kinds::Textual::write_plural(conts, Tables::Columns::get_kind(tc));
+ Hierarchy::apply_metadata(pack, TABLE_COLUMN_CONTENTS_MD_HL, conts);
+ DISCARD_TEXT(conts)
}
}
diff --git a/inform7/runtime-module/Chapter 5/Tables.w b/inform7/runtime-module/Chapter 5/Tables.w
index c28563c93..8bf0b8814 100644
--- a/inform7/runtime-module/Chapter 5/Tables.w
+++ b/inform7/runtime-module/Chapter 5/Tables.w
@@ -288,6 +288,29 @@ case.)
WRITE_TO(S, "%+W", Node::get_text(t->headline_fragment));
Hierarchy::apply_metadata(RTTables::package(t), TABLE_PNAME_MD_HL, S);
DISCARD_TEXT(S)
+ for (table_contribution *tc = t->table_created_at; tc; tc = tc->next) {
+ package_request *R =
+ Hierarchy::package_within(TABLE_CONTRIBUTION_HAP,
+ RTTables::package(t));
+ Hierarchy::apply_metadata_from_number(R, TABLE_CONTRIBUTION_AT_MD_HL,
+ (inter_ti) Wordings::first_wn(Node::get_text(tc->source_table)));
+ }
+ Hierarchy::apply_metadata_from_number(RTTables::package(t),
+ TABLE_ROWS_MD_HL, (inter_ti) Tables::get_no_rows(t));
+ Hierarchy::apply_metadata_from_number(RTTables::package(t),
+ TABLE_BLANK_ROWS_MD_HL, (inter_ti) t->blank_rows);
+ if (Wordings::nonempty(t->blank_rows_for_each_text))
+ Hierarchy::apply_metadata_from_raw_wording(RTTables::package(t),
+ TABLE_BLANK_ROWS_FOR_MD_HL, t->blank_rows_for_each_text);
+ if (t->first_column_by_definition) {
+ Hierarchy::apply_metadata_from_number(RTTables::package(t),
+ TABLE_DEFINES_MD_HL, 1);
+ Hierarchy::apply_metadata_from_raw_wording(RTTables::package(t),
+ TABLE_DEFINES_TEXT_MD_HL, Node::get_text(t->where_used_to_define));
+ Hierarchy::apply_metadata_from_number(RTTables::package(t),
+ TABLE_DEFINES_AT_MD_HL,
+ (inter_ti) Wordings::first_wn(Node::get_text(t->where_used_to_define)));
+ }
@ The issue here is whether the value |IMPROBABLE_VALUE| can, despite its
improbability, be valid for this kind. If we can prove that it is not, we
diff --git a/inter/codegen-module/Chapter 6/Index File Services.w b/inter/codegen-module/Chapter 6/Index File Services.w
index 1f4bcadfa..e853cd7e5 100644
--- a/inter/codegen-module/Chapter 6/Index File Services.w
+++ b/inter/codegen-module/Chapter 6/Index File Services.w
@@ -142,7 +142,6 @@ text_stream *Index::open_file(text_stream *index_leaf, text_stream *title, int s
}
ifl = &index_file_struct;
text_stream *OUT = ifl;
-LOG("Index: %f\n", F);
@;
HTML::header(OUT, title,
@@ -665,12 +664,12 @@ void Index::index_actual_element(OUTPUT_STREAM, text_stream *elt) {
FiguresElement::render(OUT);
return;
}
-
- #ifdef CORE_MODULE
if (Str::eq_wide_string(elt, L"Tb")) {
- IXTables::render(OUT);
+ TablesElement::render(OUT);
return;
}
+
+ #ifdef CORE_MODULE
if (Str::eq_wide_string(elt, L"In")) {
IXInnards::render(OUT, Supervisor::current_vm());
return;
diff --git a/inter/codegen-module/Chapter 6/Tables Element.w b/inter/codegen-module/Chapter 6/Tables Element.w
new file mode 100644
index 000000000..30c5010ad
--- /dev/null
+++ b/inter/codegen-module/Chapter 6/Tables Element.w
@@ -0,0 +1,159 @@
+[TablesElement::] Tables Element.
+
+To write the Tables element (Tb) in the index.
+
+@h Indexing.
+Tables inside extensions are often used just for the storage needed to manage
+back-of-house algorithms, so to speak, and they aren't intended for the end
+user to poke around with; that's certainly true of the tables in the Standard
+Rules, which of course are always present. So these are hidden by default.
+
+=
+void TablesElement::render(OUTPUT_STREAM) {
+ inter_tree *I = Index::get_tree();
+ tree_inventory *inv = Synoptic::inv(I);
+ TreeLists::sort(inv->table_nodes, Synoptic::category_order);
+
+ inter_package *current_mod = NULL; int mc = 0, first_ext = TRUE;
+ inter_ti cat = 1, open_cat = 0;
+ for (inter_ti with_cat = 1; with_cat <= 3; with_cat++) {
+ for (int i=0; itable_nodes); i++) {
+ inter_package *mod = Synoptic::module_containing(inv->table_nodes->list[i].node);
+ if (mod == NULL) continue;
+ cat = Metadata::read_optional_numeric(mod, I"^category");
+ if (cat == with_cat) {
+ if ((mc == 0) || (mod != current_mod)) {
+ @;
+ mc++; current_mod = mod;
+ @;
+ }
+ inter_package *pack = Inter::Package::defined_by_frame(inv->table_nodes->list[i].node);
+ @;
+ }
+ }
+ }
+ @;
+}
+
+@ =
+ if (cat > 1) {
+ if (first_ext) {
+ HTML_OPEN("p");
+ Index::extra_link(OUT, 2);
+ if (mc > 1) WRITE("Show tables inside extensions too");
+ else WRITE("Show tables inside extensions (there are none in the main text)");
+ HTML_CLOSE("p");
+ first_ext = FALSE;
+ }
+ Index::extra_div_open(OUT, 2, 1, "e0e0e0");
+ HTML_OPEN("p");
+ WRITE("%S ", Metadata::read_textual(mod, I"^title"));
+ HTML_CLOSE("p");
+ }
+ open_cat = cat;
+ HTML::begin_plain_html_table(OUT);
+
+@ =
+ if (mc > 0) {
+ HTML::end_html_table(OUT);
+ if (open_cat > 1) Index::extra_div_close(OUT, "e0e0e0");
+ }
+
+@ The following probably ought to use a multiplication sign rather than a
+Helvetica-style lower case "x", but life is full of compromises.
+
+@ =
+ HTML::first_html_column_spaced(OUT, 0);
+ WRITE("%S ", Metadata::read_textual(pack, I"^printed_name"));
+ int ntc = 0;
+ 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) == PackageTypes::get(I, I"_table_contribution")) {
+ if (ntc++ > 0) WRITE(" +");
+ int at = (int) Metadata::read_optional_numeric(entry, I"^at");
+ Index::link(OUT, at);
+ }
+ }
+ }
+ HTML::next_html_column_spaced(OUT, 0);
+
+ int nc = 0;
+ 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) == PackageTypes::get(I, I"_table_column_usage"))
+ nc++;
+ }
+ }
+ int nr = (int) Metadata::read_numeric(pack, I"^rows");
+ int nb = (int) Metadata::read_numeric(pack, I"^blank_rows");
+ int defines = (int) Metadata::read_optional_numeric(pack, I"^defines");
+ text_stream *for_each = Metadata::read_optional_textual(pack, I"^blank_rows_for_each");
+
+ WRITE("");
+ HTML_OPEN_WITH("span", "class=\"smaller\"");
+ if (defines) {
+ WRITE("%d definition%s", nr, (nr == 1)?"":"s");
+ } else {
+ WRITE("%d column%s x %d row%s", nc, (nc == 1)?"":"s", nr, (nr == 1)?"":"s");
+ }
+ if (nb > 0) {
+ WRITE(" (%d blank", nb);
+ if (Str::len(for_each) > 0) WRITE(", one for each %S", for_each);
+ WRITE(")");
+ }
+ HTML_CLOSE("span");
+ WRITE(" ");
+
+ HTML::end_html_row(OUT);
+
+ int col = 0;
+ 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) == PackageTypes::get(I, I"_table_column_usage")) {
+ inter_tree_node *ID = Synoptic::get_definition(entry, I"column_identity");
+ inter_symbol *id_s = NULL;
+ if (ID->W.data[DATA_CONST_IFLD] == ALIAS_IVAL)
+ id_s = InterSymbolsTables::symbol_from_id(Inter::Packages::scope(entry), ID->W.data[DATA_CONST_IFLD+1]);
+ if (id_s == NULL) internal_error("column_identity not an ALIAS_IVAL");
+ inter_package *col_pack = Inter::Packages::container(id_s->definition);
+ LOG("Whellll... $6\n", col_pack);
+
+ HTML::first_html_column(OUT, 0);
+ WRITE(" col %d: ", col+1);
+ @;
+ HTML::next_html_column(OUT, 0);
+ @;
+ HTML::end_html_row(OUT);
+ col++;
+ }
+ }
+ }
+
+@ =
+ text_stream *CW = Metadata::read_optional_textual(col_pack, I"^name");
+ if ((defines) && (col == 0)) {
+ WRITE("%S", Metadata::read_optional_textual(pack, I"^defines_text"));
+ int at = (int) Metadata::read_optional_numeric(pack, I"^defines_at");
+ Index::link(OUT, at);
+ } else {
+ if (defines) WRITE("sets ");
+ WRITE("%S ", CW);
+ TEMPORARY_TEXT(TEMP)
+ WRITE_TO(TEMP, "%S", CW);
+ if (defines == FALSE) WRITE_TO(TEMP, " entry");
+ PasteButtons::paste_text(OUT, TEMP);
+ DISCARD_TEXT(TEMP)
+ }
+
+@ =
+ if ((defines) && (col == 0)) {
+ WRITE("names ");
+ } else if (defines) {
+ WRITE("%S property", Metadata::read_optional_textual(col_pack, I"^contents"));
+ } else {
+ WRITE("of %S", Metadata::read_optional_textual(col_pack, I"^contents"));
+ }
diff --git a/inter/codegen-module/Contents.w b/inter/codegen-module/Contents.w
index 59e8c2703..92de5e6b0 100644
--- a/inter/codegen-module/Contents.w
+++ b/inter/codegen-module/Contents.w
@@ -68,3 +68,4 @@ Chapter 6: Index
Relations Element
Events Element
Figures Element
+ Tables Element