diff --git a/docs/bytecode-module/5-tsc.html b/docs/bytecode-module/5-tsc.html
index cab983ce6..d37da2442 100644
--- a/docs/bytecode-module/5-tsc.html
+++ b/docs/bytecode-module/5-tsc.html
@@ -68,7 +68,7 @@ function togglePopup(material_id) {
void SplatInstruction::define_construct ( void ) {
inter_construct * IC = InterInstruction::create_construct ( SPLAT_IST , I "splat" );
InterInstruction::specify_syntax ( IC , I "splat OPTIONALIDENTIFIER TEXT TEXT TEXT" );
-
InterInstruction::data_extent_always ( IC , 4 );
+
InterInstruction::data_extent_always ( IC , 6 );
InterInstruction::allow_in_depth_range ( IC , 0 , INFINITELY_DEEP );
InterInstruction::permit ( IC , OUTSIDE_OF_PACKAGES_ICUP );
InterInstruction::permit ( IC , INSIDE_PLAIN_PACKAGE_ICUP );
@@ -83,23 +83,31 @@ function togglePopup(material_id) {
compulsory words — see
Inter Nodes — followed by:
-
define MATTER_SPLAT_IFLD ( DATA_IFLD + 0 )
-define PLM_SPLAT_IFLD ( DATA_IFLD + 1 )
-define I6ANNOTATION_SPLAT_IFLD ( DATA_IFLD + 2 )
-define NAMESPACE_SPLAT_IFLD ( DATA_IFLD + 3 )
+define MATTER_SPLAT_IFLD ( DATA_IFLD + 0 )
+define PLM_SPLAT_IFLD ( DATA_IFLD + 1 )
+define I6ANNOTATION_SPLAT_IFLD ( DATA_IFLD + 2 )
+define NAMESPACE_SPLAT_IFLD ( DATA_IFLD + 3 )
+define PROVENANCEFILE_SPLAT_IFLD ( DATA_IFLD + 4 )
+define PROVENANCELINE_SPLAT_IFLD ( DATA_IFLD + 5 )
inter_error_message * SplatInstruction::new ( inter_bookmark * IBM , text_stream * splatter ,
- inter_ti plm , text_stream * annotation , text_stream * namespace , inter_ti level ,
- inter_error_location * eloc ) {
- inter_tree_node * P = Inode::new_with_4_data_fields ( IBM , SPLAT_IST ,
+ inter_ti plm , text_stream * annotation , text_stream * namespace ,
+ filename * file , inter_ti line_number , inter_ti level , inter_error_location * eloc ) {
+ TEMPORARY_TEXT ( file_as_text )
+ if ( file ) WRITE_TO ( file_as_text , "%f" , file );
+ inter_tree_node * P = Inode::new_with_6_data_fields ( IBM , SPLAT_IST ,
/* MATTER_SPLAT_IFLD: */ InterWarehouse::create_text_at ( IBM , splatter ),
/* PLM_SPLAT_IFLD: */ plm ,
( Str::len ( annotation ) > 0 )?( InterWarehouse::create_text_at ( IBM , annotation )):0,
( Str::len ( namespace ) > 0 )?( InterWarehouse::create_text_at ( IBM , namespace )):0,
+
+ ( Str::len ( file_as_text ) > 0 )?( InterWarehouse::create_text_at ( IBM , file_as_text )):0,
+ /* PROVENANCELINE_SPLAT_IFLD: */ line_number ,
eloc , level );
+ DISCARD_TEXT ( file_as_text )
inter_error_message * E = VerifyingInter::instruction ( InterBookmark::package ( IBM ), P );
if ( E ) return E ;
NodePlacement::move_to_moving_bookmark ( P , IBM );
@@ -153,7 +161,14 @@ compulsory words — see Inter Nodes if (* E == NULL ) {
* E = TextualInter::parse_literal_text ( raw_ns , namespace_text , 0 , Str::len ( annot_text ), eloc );
if (* E == NULL ) {
- * E = SplatInstruction::new ( IBM , raw , plm , raw_annot , raw_ns , ( inter_ti ) ilp -> indent_level , eloc );
+ filename * F = NULL ;
+ inter_ti lc = 0 ;
+ if ( eloc ) {
+ F = eloc -> error_tfp -> text_file_filename ;
+ lc = ( inter_ti ) eloc -> error_tfp -> line_count ;
+ }
+ * E = SplatInstruction::new ( IBM , raw , plm , raw_annot , raw_ns , F , lc ,
+ ( inter_ti ) ilp -> indent_level , eloc );
}
}
}
@@ -201,6 +216,18 @@ compulsory words — see Inter Nodes if ( Inode::isnt ( P , SPLAT_IST )) return NULL ;
return Inode::ID_to_text ( P , P -> W . instruction [ NAMESPACE_SPLAT_IFLD ]);
}
+
+text_stream * SplatInstruction::file_provenance ( inter_tree_node * P ) {
+ if ( P == NULL ) return NULL ;
+ if ( Inode::isnt ( P , SPLAT_IST )) return NULL ;
+ return Inode::ID_to_text ( P , P -> W . instruction [ PROVENANCEFILE_SPLAT_IFLD ]);
+}
+
+inter_ti SplatInstruction::line_provenance ( inter_tree_node * P ) {
+ if ( P == NULL ) return 0 ;
+ if ( Inode::isnt ( P , SPLAT_IST )) return 0 ;
+ return P -> W . instruction [ PROVENANCELINE_SPLAT_IFLD ];
+}
-
The structure compile_task_data is accessed in 2/up and here.
+
The structure compile_task_data is accessed in 2/up, 2/pwst and here.
+
+
+text_stream * notified_kit_name = NULL ;
+text_stream * notified_architecture_name = NULL ;
+int general_kit_notice_issued = FALSE ;
+int trigger_kit_notice = FALSE ;
+
+void SourceProblems::kit_notification ( text_stream * kit_name , text_stream * architecture_name ) {
+ if ( Str::len ( kit_name ) > 0 ) trigger_kit_notice = TRUE ;
+ else trigger_kit_notice = FALSE ;
+ notified_kit_name = Str::duplicate ( kit_name );
+ notified_architecture_name = Str::duplicate ( architecture_name );
+}
+
+void SourceProblems::I6_level_error ( char * message , text_stream * quote ,
+ text_stream * file_ref , int line ) {
+ TEMPORARY_TEXT ( file )
+ WRITE_TO ( file , "%S" , file_ref );
+ TEMPORARY_TEXT ( kit )
+ TEMPORARY_TEXT ( M )
+ WRITE_TO ( M , message , quote );
+ filename * F = Filenames::from_text ( file );
+ TEMPORARY_TEXT ( EX )
+ Filenames::write_extension ( EX , F );
+ if ( Str::eq_insensitive ( EX , I ".i6t" )) {
+ pathname * P = Filenames::up ( F );
+ if ( Str::eq_insensitive ( Pathnames::directory_name ( P ), I "Sections" ))
+ P = Pathnames::up ( P );
+ WRITE_TO ( kit , "%S" , Pathnames::directory_name ( P ));
+ Str::clear ( file );
+ WRITE_TO ( file , "%S" , Filenames::get_leafname ( F ));
+ }
+ DISCARD_TEXT ( EX )
+ if ( trigger_kit_notice ) {
+ if ( general_kit_notice_issued == FALSE ) {
+ StandardProblems::handmade_problem ( Task::syntax_tree (), _p_ (...));
+ Problems::issue_problem_segment (
+ "Before the project could be translated, one of the 'kits' of low-level "
+ "Inter code which it uses needed to be built first. This is seldom "
+ "necessary and normally happens silently when it is, but this time errors "
+ "occurred and therefore translation had to be abandoned. If you are "
+ "currently tinkering with a kit, you'll often see errors like this, "
+ "but otherwise it probably means that a new extension you're using "
+ "(and which contains a kit) isn't properly working." );
+ general_kit_notice_issued = TRUE ;
+ Problems::issue_problem_end ();
+ }
+ WRITE_TO ( problems_file , "<h3>Building %S for architecture %S</h3>\n" ,
+ notified_kit_name , notified_architecture_name );
+ trigger_kit_notice = FALSE ;
+ }
+ StandardProblems::handmade_problem ( Task::syntax_tree (), _p_ (...));
+ Problems::quote_stream (1, M );
+ if ( Str::len ( kit ) > 0 ) {
+ Problems::quote_stream (2, file );
+ Problems::quote_number (3, & line );
+ Problems::quote_stream (4, kit );
+ if ( general_kit_notice_issued ) Problems::issue_problem_segment ( "%2, near line %3: %1." );
+ else Problems::issue_problem_segment ( "Near line %3 of file %2 in %4: %1." );
+ } else if ( Str::len ( file ) > 0 ) {
+ LOG ( "%S, line %d:\n" , file , line );
+ Problems::problem_quote_file (2, file , line );
+ Problems::issue_problem_segment (
+ "A mistake was found in the Inform 6-syntax code near here %2: %1." );
+ } else {
+ Problems::issue_problem_segment (
+ "My low-level reader of source code reported a mistake - \"%1\". "
+ "%PLow-level material written in Inform 6 syntax occurs either in kits or "
+ "in matter written inside 'Include (- ... -)' in source text, either in "
+ "the main source or in an extension used by it." );
+ }
+ Problems::issue_problem_end ();
+ if (( Str::len ( kit ) > 0 ) && ( general_kit_notice_issued )) {
+ WRITE_TO ( problems_file , "<p>Path: " );
+ pathname * P = NULL , * Q = NULL , * MAT = NULL , * EXT = NULL , * INT = NULL ;
+ for ( Q = Filenames::up ( F ); Q ; Q = Pathnames::up ( Q )) {
+ text_stream * name = Pathnames::directory_name ( Q );
+ if ( Str::eq_insensitive ( name , I "Extensions" )) EXT = Q ;
+ if ( Str::eq_insensitive ( name , I "Inter" )) INT = Q ;
+ if ( Str::suffix_eq ( name , I ".materials" , 10 )) MAT = Q ;
+ }
+ if ( MAT ) P = MAT ; else if ( EXT ) P = EXT ; else if ( INT ) P = INT ;
+ if ( P ) Filenames::to_text_relative ( problems_file , F , Pathnames::up ( P ));
+ else WRITE_TO ( problems_file , "%f" , F );
+ WRITE_TO ( problems_file , "</p>" );
+ }
+ DISCARD_TEXT ( M )
+ DISCARD_TEXT ( kit )
+}
+
diff --git a/docs/pipeline-module/2-pe.html b/docs/pipeline-module/2-pe.html
index ad4163462..ad64bb6a6 100644
--- a/docs/pipeline-module/2-pe.html
+++ b/docs/pipeline-module/2-pe.html
@@ -214,34 +214,40 @@ what the red button marked "danger" does.
-int pipeline_error_count = 0 ;
+int kit_error_count = 0 ;
+text_stream * kit_error_filename = NULL ;
+int kit_error_line_number = 0 ;
-void PipelineErrors::kit_error ( char * message , text_stream * quote ) {
- # ifdef PROBLEMS_MODULE
- TEMPORARY_TEXT ( M )
- WRITE_TO ( M , message , quote );
- Problems::quote_stream (1, M );
- StandardProblems::handmade_problem ( Task::syntax_tree (), _p_ (...));
- Problems::issue_problem_segment (
- "My low-level reader of source code reported a mistake - \"%1\". "
- "%PLow-level material written in Inform 6 syntax occurs either in kits or "
- "in matter written inside 'Include (- ... -)' in source text, either in "
- "the main source or in an extension used by it." );
- Problems::issue_problem_end ();
- DISCARD_TEXT ( M )
- # endif
- # ifndef PROBLEMS_MODULE
- Errors::with_text ( message , quote );
- # endif
- pipeline_error_count ++;
+void PipelineErrors::set_kit_error_location ( text_stream * file , inter_ti line ) {
+ kit_error_filename = file ;
+ kit_error_line_number = ( int ) line ;
}
-void PipelineErrors::reset_errors ( void ) {
- pipeline_error_count = 0 ;
+void PipelineErrors::kit_error ( char * message , text_stream * quote ) {
+ # ifdef CORE_MODULE
+ SourceProblems::I6_level_error ( message , quote , kit_error_filename ,
+ kit_error_line_number );
+ # endif
+ # ifndef CORE_MODULE
+ if ( Str::len ( kit_error_filename ) > 0 ) {
+ filename * F = Filenames::from_text ( kit_error_filename );
+ TEMPORARY_TEXT ( M )
+ WRITE_TO ( M , message , quote );
+ Errors::at_position_S ( M , F , kit_error_line_number );
+ DISCARD_TEXT ( M )
+ } else {
+ Errors::with_text ( message , quote );
+ }
+ # endif
+ kit_error_count ++;
}
-int PipelineErrors::errors_occurred ( void ) {
- if ( pipeline_error_count != 0 ) return TRUE ;
+void PipelineErrors::reset_errors ( void ) {
+ kit_error_count = 0 ;
+}
+
+int PipelineErrors::errors_occurred ( void ) {
+ if ( kit_error_count != 0 ) return TRUE ;
return FALSE ;
}
diff --git a/docs/pipeline-module/3-css.html b/docs/pipeline-module/3-css.html
index 47077261f..ff49d384c 100644
--- a/docs/pipeline-module/3-css.html
+++ b/docs/pipeline-module/3-css.html
@@ -106,14 +106,17 @@ function definition, that is quite a lot of work.
int CompileSplatsStage::run ( pipeline_step * step ) {
PipelineErrors::reset_errors ();
+ PipelineErrors::set_kit_error_location ( NULL , 0 );
compile_splats_state css ;
Initialise the CS state 2.2 ;
inter_tree * I = step -> ephemera . tree ;
InterTree::traverse ( I , CompileSplatsStage::visitor1 , & css , NULL , SPLAT_IST );
InterTree::traverse ( I , CompileSplatsStage::visitor2 , & css , NULL , 0 );
+ PipelineErrors::set_kit_error_location ( NULL , 0 );
int errors_found = CompileSplatsStage::function_bodies ( step , & css , I );
if ( errors_found ) return FALSE ;
InterTree::traverse ( I , CompileSplatsStage::visitor3 , & css , NULL , SPLAT_IST );
+ PipelineErrors::set_kit_error_location ( NULL , 0 );
if ( PipelineErrors::errors_occurred ()) return FALSE ;
return TRUE ;
}
@@ -217,6 +220,11 @@ is being compiled.
+ if ( SplatInstruction::line_provenance ( P ) > 0 )
+ PipelineErrors::set_kit_error_location (
+ SplatInstruction::file_provenance ( P ), SplatInstruction::line_provenance ( P ));
+ else
+ PipelineErrors::set_kit_error_location ( NULL , 0 );
match_results mr = Regexp::create_mr ();
text_stream * raw_identifier = NULL , * value = NULL ;
int proceed = TRUE ;
@@ -943,6 +951,11 @@ in this section.
+ if ( SplatInstruction::line_provenance ( P ) > 0 )
+ PipelineErrors::set_kit_error_location (
+ SplatInstruction::file_provenance ( P ), SplatInstruction::line_provenance ( P ));
+ else
+ PipelineErrors::set_kit_error_location ( NULL , 0 );
text_stream * raw_identifier = NULL , * local_var_names = NULL , * body = NULL ;
match_results mr = Regexp::create_mr ();
if ( SplatInstruction::plm ( P ) == ROUTINE_PLM ) Parse the routine header 3.2.1 ;
diff --git a/docs/pipeline-module/3-ps.html b/docs/pipeline-module/3-ps.html
index 9c371c9e1..7d05370ad 100644
--- a/docs/pipeline-module/3-ps.html
+++ b/docs/pipeline-module/3-ps.html
@@ -161,6 +161,8 @@ it from there.
inter_bookmark here = InterBookmark::after_this_node ( P );
rpi_docket_state * docket_state = ( rpi_docket_state *) docket -> state ;
docket_state -> assimilation_point = & here ;
+ docket_state -> file_provenance = InsertInstruction::file_provenance ( P );
+ docket_state -> line_provenance = InsertInstruction::line_provenance ( P );
SimpleTangler::tangle_text ( docket , insertion );
text_stream * replacing = InsertInstruction::replacing ( P );
if ( Str::len ( replacing ) > 0 ) {
@@ -191,6 +193,8 @@ in .
typedef struct rpi_docket_state {
struct inter_bookmark * assimilation_point ;
struct text_stream * namespace ;
+ struct text_stream * file_provenance ;
+ inter_ti line_provenance ;
} rpi_docket_state ;
The structure rpi_docket_state is accessed in 3/css and here.
@@ -206,10 +210,13 @@ in .
rpi_docket_state state ;
state . assimilation_point = & assimilation_point ;
state . namespace = namespacename ;
+
state . file_provenance = NULL ;
+
state . line_provenance = 0 ;
docket = SimpleTangler::new_docket (
-
&( ParsingStages::receive_raw ),
+
&( ParsingStages::receive_raw ),
&( ParsingStages::receive_command ),
&( ParsingStages::receive_bplus ),
+
&( ParsingStages::line_marker ),
&( PipelineErrors::kit_error ),
step -> ephemera . the_kit , & state );
@@ -271,7 +278,15 @@ in kit files:
"use of (+ ... +) in kit source has been withdrawn: '%S'" , material );
}
-
+
+
+void ParsingStages::line_marker ( text_stream * material , simple_tangle_docket * docket ) {
+ WRITE_TO ( material , "! LINEMARKER %d %f\n" , docket -> current_start_line , docket -> current_filename );
+}
+
+
-void ParsingStages::receive_raw ( text_stream * S , simple_tangle_docket * docket ) {
+void ParsingStages::receive_raw ( text_stream * S , simple_tangle_docket * docket ) {
text_stream * R = Str::new ();
int mode = IGNORE_WS_I6TBIT ;
- LOOP_THROUGH_TEXT ( pos , S ) {
- wchar_t c = Str::get ( pos );
- if (( c == 10 ) || ( c == 13 )) c = '\n' ;
+ rpi_docket_state * state = ( rpi_docket_state *) docket -> state ;
+ inter_ti lc = state -> line_provenance ;
+ for ( int pos = 0 ; pos < Str::len ( S ); pos ++) {
+ wchar_t c = Str::get_at ( S , pos );
+ if (( c == 10 ) || ( c == 13 )) { c = '\n' ; lc ++; }
+ if (( c == '!' ) && ( Str::includes_at ( S , pos , I "! LINEMARKER " ))) {
+ text_stream * file_text = Str::new ();
+ TEMPORARY_TEXT ( number_text )
+ int in_number = TRUE ;
+ for ( pos = pos + 13 ; pos < Str::len ( S ); pos ++) {
+ wchar_t c = Str::get_at ( S , pos );
+ if (( c == 10 ) || ( c == 13 )) break ;
+ if (( c == ' ' ) && ( in_number )) { in_number = FALSE ; continue ; }
+ if ( in_number ) PUT_TO ( number_text , c );
+ else PUT_TO ( file_text , c );
+ }
+ state -> line_provenance = ( inter_ti ) Str::atoi ( number_text , 0 );
+ lc = state -> line_provenance ;
+ state -> file_provenance = file_text ;
+ LOG ( "Spotted %d and <%S>\n" , state -> line_provenance , state -> file_provenance );
+ DISCARD_TEXT ( number_text )
+ continue ;
+ }
if ( mode & IGNORE_WS_I6TBIT ) {
if (( c == '\n' ) || ( Characters::is_whitespace ( c ))) continue ;
mode -= IGNORE_WS_I6TBIT ;
@@ -354,15 +389,17 @@ functions). So for example
}
PUT_TO ( R , c );
if (( c == ';' ) && (!( mode & SUBORDINATE_I6TBITS ))) {
- ParsingStages::splat ( R , docket );
+ ParsingStages::splat ( R , docket );
+ state -> line_provenance = lc ;
mode = IGNORE_WS_I6TBIT ;
}
}
- ParsingStages::splat ( R , docket );
+ ParsingStages::splat ( R , docket );
+ state -> line_provenance = lc ;
Str::clear ( S );
}
-
@@ -371,19 +408,28 @@ state being carried in the docket.
-void ParsingStages::splat ( text_stream * R , simple_tangle_docket * docket ) {
+void ParsingStages::splat ( text_stream * R , simple_tangle_docket * docket ) {
if ( Str::len ( R ) > 0 ) {
TEMPORARY_TEXT ( A )
- Find annotation, if any 6.1 ;
+ Find annotation, if any 7.1 ;
inter_ti I6_dir = 0 ;
- Find directive 6.2 ;
+ Find directive 7.2 ;
if ( I6_dir != WHITESPACE_PLM ) {
rpi_docket_state * state = ( rpi_docket_state *) docket -> state ;
inter_bookmark * IBM = state -> assimilation_point ;
PUT_TO ( R , '\n' );
+ filename * F = NULL ;
+ inter_ti lc = 0 ;
+ if ( Str::len ( state -> file_provenance ) > 0 ) {
+ F = Filenames::from_text ( state -> file_provenance );
+ lc = state -> line_provenance + 1 ;
+ } else if ( docket -> current_filename ) {
+ F = docket -> current_filename ;
+ lc = 25 ;
+ }
Produce::guard ( SplatInstruction::new ( IBM , R , I6_dir , A , state -> namespace ,
- ( inter_ti ) ( InterBookmark::baseline ( IBM ) + 1 ), NULL ));
+ F , lc , ( inter_ti ) ( InterBookmark::baseline ( IBM ) + 1 ), NULL ));
} else if ( A ) {
I6_annotation * IA = I6Annotations::parse ( A );
if (( IA ) && ( Str::eq_insensitive ( IA -> identifier , I "namespace" ))) {
@@ -438,7 +484,7 @@ state being carried in the docket.
}
}
-
@@ -452,14 +498,14 @@ state being carried in the docket.
Str::delete_n_characters ( R , verdict );
}
-
-
+
-
@@ -496,8 +542,8 @@ the directive type as 0.
"this Inform 6 directive is not supported in kits or '(-' inclusions: '%S'" , R );
Regexp::dispose_of (& mr );
-
-
+
define QUOTATION_TOLERANCE_LIMIT 100
-void ProblemBuffer::copy_text ( wording W ) {
+void ProblemBuffer::copy_text ( wording W ) {
W = Wordings::truncate ( W , QUOTATION_TOLERANCE_LIMIT );
WRITE_TO ( PBUFF , "%<W" , W );
}
@@ -113,7 +113,7 @@ mask out angle brackets and quotation marks which we don't want to interpret as
define PROTECTED_QUOT_CHAR L '\x03'
-void ProblemBuffer::copy_source_reference ( wording W ) {
+void ProblemBuffer::copy_source_reference ( wording W ) {
if ( Wordings::empty ( W )) { WRITE_TO ( PBUFF , "<no text>" ); return ; }
source_file * referred = Lexer::file_of_origin ( Wordings::first_wn ( W ));
TEMPORARY_TEXT ( file )
@@ -154,6 +154,31 @@ mask out angle brackets and quotation marks which we don't want to interpret as
}
DISCARD_TEXT ( file )
}
+
+void ProblemBuffer::copy_file_reference ( text_stream * file_ref , int line ) {
+ TEMPORARY_TEXT ( file )
+ WRITE_TO ( file , "%S" , file_ref );
+ pathname * proj = HTML::get_link_abbreviation_path ();
+ if ( proj ) {
+ TEMPORARY_TEXT ( project_prefix )
+ WRITE_TO ( project_prefix , "%p" , proj );
+ if ( Str::prefix_eq ( file , project_prefix , Str::len ( project_prefix )))
+ Str::delete_n_characters ( file , Str::len ( project_prefix ));
+ DISCARD_TEXT ( project_prefix )
+ } else {
+ WRITE_TO ( file , "(no file)" );
+ }
+ text_stream * paraphrase = file ;
+ # ifdef DESCRIBE_SOURCE_FILE_PROBLEMS_CALLBACK
+ paraphrase = DESCRIBE_SOURCE_FILE_PROBLEMS_CALLBACK ( paraphrase , NULL , file );
+ # endif
+ WRITE_TO ( PBUFF , " %c%S%c%S%c%d%c" ,
+ SOURCE_REF_CHAR , paraphrase ,
+ SOURCE_REF_CHAR , file ,
+ SOURCE_REF_CHAR , line ,
+ SOURCE_REF_CHAR );
+ DISCARD_TEXT ( file )
+}
int tail_of_report_written = FALSE ;
-void ProblemBuffer::write_reports ( int disaster_struck ) {
+void ProblemBuffer::write_reports ( int disaster_struck ) {
if ( tail_of_report_written ) return ;
tail_of_report_written = TRUE ;
diff --git a/docs/problems-module/2-pl2.html b/docs/problems-module/2-pl2.html
index 27ef32d90..0f072b1dd 100644
--- a/docs/problems-module/2-pl2.html
+++ b/docs/problems-module/2-pl2.html
@@ -151,7 +151,7 @@ the two possibilities.
# endif
for ( i =0; i < NO_HEADING_LEVELS ; i ++) last_problem_headings [ i ] = NULL ;
}
- if ( do_not_locate_problems ) return ;
+ if (( T == NULL ) || ( do_not_locate_problems )) return ;
Problems::find_headings_at ( T , current_sentence , problem_headings );
for ( i =0; i < NO_HEADING_LEVELS ; i ++) if ( problem_headings [ i ] != NULL ) f = TRUE ;
if ( f )
@@ -213,6 +213,8 @@ easily be changed, but there seems no reason to.)
void * structure_quoted ;
void (* expander )( text_stream *, void *);
struct wording text_quoted ;
+ struct text_stream * file ;
+ int line ;
} problem_quotation ;
problem_quotation problem_quotations [10];
@@ -233,6 +235,8 @@ printed as the inference
wording appended_source = EMPTY_WORDING ;
-void Problems::append_source ( wording W ) {
+void Problems::append_source ( wording W ) {
appended_source = W ;
}
-void Problems::transcribe_appended_source ( void ) {
+void Problems::transcribe_appended_source ( void ) {
if ( Wordings::nonempty ( appended_source ))
ProblemBuffer::copy_source_reference ( appended_source );
}
@@ -486,10 +504,12 @@ on when the shortened form is the one being issued).
if ( Characters::isdigit (( wchar_t ) message [ i +1])) {
int t = (( int ) ( message [ i +1]))-(( int ) '0' ); i ++;
if (( t >=1) && ( t <=9)) {
- if ( problem_quotations [ t ]. wording_based )
- Expand wording-based escape 12.1.1
+ if ( problem_quotations [ t ]. quotation_type == 'F' )
+ Expand file reference 12.1.1
+ else if ( problem_quotations [ t ]. wording_based )
+ Expand wording-based escape 12.1.2
else
- Expand structure-based escape 12.1.2
+ Expand structure-based escape 12.1.3
}
continue ;
}
@@ -497,11 +517,21 @@ on when the shortened form is the one being issued).
PUT_TO ( PBUFF , message [ i ]);
This code is used in §12 .
-
+
+
+
+
+ ProblemBuffer::copy_file_reference ( problem_quotations [ t ]. file , problem_quotations [ t ]. line );
+
+
This code is used in §12.1 .
+
-
@@ -515,18 +545,18 @@ its type, stored internally as a single character.
break ;
- case 'r' : Quote a red-tinted word range in a problem message 12.1.1.1 ;
+ case 'r' : Quote a red-tinted word range in a problem message 12.1.2.1 ;
break ;
- case 'g' : Quote a green-tinted word range in a problem message 12.1.1.2 ;
+ case 'g' : Quote a green-tinted word range in a problem message 12.1.2.2 ;
break ;
default: internal_error ( "unknown error token type" );
}
This code is used in §12.1 .
-
-
@@ -534,14 +564,14 @@ its type, stored internally as a single character.
HTML::begin_span ( OUT , I "problemred" );
WRITE ( "%W" , problem_quotations [ t ]. text_quoted );
HTML::end_span ( OUT );
- Spool temporary stream text to the problem buffer 12.1.1.1.1 ;
+ Spool temporary stream text to the problem buffer 12.1.2.1.1 ;
DISCARD_TEXT ( OUT )
-
This code is used in §12.1.1 .
-
This code is used in §12.1.2 .
+
-
@@ -549,15 +579,15 @@ its type, stored internally as a single character.
HTML::begin_span ( OUT , I "problemgreen" );
WRITE ( "%W" , problem_quotations [ t ]. text_quoted );
HTML::end_span ( OUT );
- Spool temporary stream text to the problem buffer 12.1.1.1.1 ;
+ Spool temporary stream text to the problem buffer 12.1.2.1.1 ;
DISCARD_TEXT ( OUT )
-
This code is used in §12.1.1 .
-
This code is used in §12.1.2 .
+
-
@@ -568,12 +598,12 @@ ourselves, and must delegate to:
( problem_quotations [ t ]. expander )( OUT , problem_quotations [ t ]. structure_quoted );
if ( problem_quotations [ t ]. quotation_type == 'r' ) HTML::end_span ( OUT );
if ( problem_quotations [ t ]. quotation_type == 'g' ) HTML::end_span ( OUT );
- Spool temporary stream text to the problem buffer 12.1.1.1.1 ;
+ Spool temporary stream text to the problem buffer 12.1.2.1.1 ;
DISCARD_TEXT ( OUT )
Problems::transcribe_appended_source ();
This code is used in §12.1 .
-
@@ -585,7 +615,7 @@ ourselves, and must delegate to:
PUT_TO ( PBUFF , c );
}
-
This code is used in §12.1.1.1 , §12.1.1.2 , §12.1.2 .
+
This code is used in §12.1.2.1 , §12.1.2.2 , §12.1.3 .
diff --git a/docs/runtime-module/2-emt.html b/docs/runtime-module/2-emt.html
index c6429a5bf..45b11543f 100644
--- a/docs/runtime-module/2-emt.html
+++ b/docs/runtime-module/2-emt.html
@@ -387,8 +387,17 @@ assimilating during linking.
void Emit::intervention ( text_stream * raw_matter , text_stream * replacing ) {
+ filename * F = NULL ;
+ inter_ti lc = 0 ;
+ if ( current_sentence ) {
+ wording W = current_sentence -> text_parsed ;
+ source_file * sf = Lexer::file_of_origin ( Wordings::first_wn ( W ));
+ if ( sf ) F = TextFromFiles::get_filename ( sf );
+ lc = ( inter_ti ) Lexer::line_of_origin ( Wordings::first_wn ( W ));
+ }
Produce::guard (
- InsertInstruction::new ( Emit::at (), raw_matter , replacing , Emit::baseline (), NULL ));
+ InsertInstruction::new ( Emit::at (), raw_matter , replacing , F , lc ,
+ Emit::baseline (), NULL ));
}