diff --git a/docs/if-module/5-pv.html b/docs/if-module/5-pv.html
new file mode 100644
index 000000000..39889c888
--- /dev/null
+++ b/docs/if-module/5-pv.html
@@ -0,0 +1,211 @@
+
+
+
+
+
+
+To compile I6 general parsing routines (GPRs) and/or |parse_name| properties as required by the I7 grammar.
+
+
+
+
+
+
+typedef struct parse_name_notice {
+ struct inter_name * pnn_iname ;
+ struct inference_subject * parse_subject ;
+ CLASS_DEFINITION
+} parse_name_notice ;
+
+The structure parse_name_notice is private to this section.
+
+
+
+
+
+
+
+
+
+inter_name * UnderstandGeneralTokens::consult_iname ( command_grammar * cg ) {
+ if ( cg == NULL ) return NULL ;
+ if ( cg -> compilation_data . cg_consult_iname == NULL ) {
+ current_sentence = cg -> where_cg_created ;
+ package_request * PR = Hierarchy::local_package ( CONSULT_TOKENS_HAP );
+ cg -> compilation_data . cg_consult_iname = Hierarchy::make_iname_in ( CONSULT_FN_HL , PR );
+ }
+ return cg -> compilation_data . cg_consult_iname ;
+}
+
+
+
+
+
+
+inter_name * UnderstandGeneralTokens::get_gv_parse_name ( command_grammar * cg ) {
+ if ( cg -> compilation_data . cg_parse_name_iname == NULL ) {
+ compilation_unit * C = CompilationUnits::find ( cg -> where_cg_created );
+ package_request * PR = Hierarchy::package ( C , PARSE_NAMES_HAP );
+ cg -> compilation_data . cg_parse_name_iname = Hierarchy::make_iname_in ( PARSE_NAME_FN_HL , PR );
+ }
+ return cg -> compilation_data . cg_parse_name_iname ;
+}
+
+inter_name * UnderstandGeneralTokens::compile_parse_name_property ( inference_subject * subj ) {
+ inter_name * symb = NULL ;
+ command_grammar * cg = PARSING_DATA_FOR_SUBJ ( subj )-> understand_as_this_object ;
+ if ( CommandGrammars::is_empty ( cg ) == FALSE ) {
+ symb = UnderstandGeneralTokens::get_gv_parse_name ( cg );
+ } else {
+ if ( Visibility::any_property_visible_to_subject ( subj , FALSE )) {
+ parse_name_notice * notice = CREATE ( parse_name_notice );
+ compilation_unit * C = CompilationUnits::find ( subj -> infs_created_at );
+ package_request * PR = Hierarchy::package ( C , PARSE_NAMES_HAP );
+ notice -> pnn_iname = Hierarchy::make_iname_in ( PARSE_NAME_DASH_FN_HL , PR );
+ notice -> parse_subject = subj ;
+ symb = notice -> pnn_iname ;
+ }
+ }
+ return symb ;
+}
+
+void UnderstandGeneralTokens::write_parse_name_routines ( void ) {
+ parse_name_notice * notice ;
+ LOOP_OVER ( notice , parse_name_notice ) {
+ gpr_kit gprk = UnderstandValueTokens::new_kit ();
+ packaging_state save = Emit::unused_packaging_state ();
+ if ( UnderstandGeneralTokens::compile_parse_name_head (& save , & gprk ,
+ notice -> parse_subject , NULL , notice -> pnn_iname )) {
+ UnderstandGeneralTokens::compile_parse_name_tail (& gprk );
+ Routines::end ( save );
+ }
+ }
+}
+
+
+
+(iii) the empty output, in happy cases where neither parsing nor
+distinguishability need to be investigated. The routine returns a flag
+indicating if a tail need be compiled (i.e., in cases (i) or (ii) but not
+(iii)).
+
+
+
+
+
+
+
+
+
+
+int UnderstandGeneralTokens::compile_parse_name_head ( packaging_state * save ,
+ gpr_kit * gprk , inference_subject * subj ,
+ command_grammar * cg , inter_name * rname ) {
+ int test_distinguishability = FALSE , sometimes_has_visible_properties = FALSE ;
+ inter_name * N = NULL ;
+
+ if ( subj == NULL ) internal_error ( "compiling parse_name head for null subj" );
+
+ if ( cg ) {
+ sometimes_has_visible_properties =
+ Visibility::any_property_visible_to_subject ( subj , TRUE );
+ N = UnderstandGeneralTokens::get_gv_parse_name ( cg );
+ } else {
+ if ( Visibility::any_property_visible_to_subject ( subj , FALSE )
+ == FALSE ) return FALSE ;
+ }
+
+ if ( KindSubjects::to_kind ( subj )) test_distinguishability = TRUE ;
+
+ inter_name * compile_to = rname ;
+ if ( compile_to == NULL ) compile_to = N ;
+ if ( compile_to == NULL ) internal_error ( "no parse name routine name given" );
+
+ * save = Routines::begin ( compile_to );
+
+ UnderstandValueTokens::add_parse_name_vars ( gprk );
+
+ UnderstandGeneralTokens::top_of_head ( gprk , N , subj ,
+ test_distinguishability , sometimes_has_visible_properties , rname );
+ return TRUE ;
+}
+
+
+
+(1) (words in property) (visible property names) (words in property) (longer grammar) (words in property)
+ (2) (visible property names) (longer grammar) (words in property)
+ (3) (longer grammar) (words in property)
+
+
+
+
+
+
+void UnderstandGeneralTokens::top_of_head ( gpr_kit * gprk , inter_name * cg_iname , inference_subject * subj ,
+ int test_distinguishability , int sometimes_has_visible_properties , inter_name * given_name ) {
+
+ Produce::inv_primitive ( Emit::tree (), IFDEBUG_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), GE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_TRACE_HL ));
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 3 );
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PRINT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_text ( Emit::tree (), I "Parse_name called\n" );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ if (( cg_iname ) && ( sometimes_has_visible_properties == FALSE )) {
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_ACTION_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( THESAME_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), RETURN_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 0 );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ }
+ Save word number 6.1 ;
+
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> pass_s );
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), WHILE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), LE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> pass_s );
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 3 );
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Reset word number 6.2 ;
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> try_from_wn_s );
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> f_s );
+ Produce::val ( Emit::tree (), K_truth_state , LITERAL_IVAL , 0 );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 0 );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), WHILE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 1 );
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+
+
+
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), AND_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), NE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_ACTION_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( THESAME_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> pass_s );
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), WHILE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_call_iname ( Emit::tree (), Hierarchy::find ( WORDINPROPERTY_HL ));
+ Produce::down ( Emit::tree ());
+ Produce::inv_call_iname ( Emit::tree (), Hierarchy::find ( NEXTWORDSTOPPED_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( SELF_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , RTParsing::name_iname ());
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> f_s );
+ Produce::val ( Emit::tree (), K_truth_state , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), POSTDECREMENT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> try_from_wn_s );
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), OR_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> pass_s );
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> pass_s );
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 2 );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ UnderstandGeneralTokens::consider_visible_properties ( gprk , subj , test_distinguishability );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), AND_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), NE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_ACTION_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( THESAME_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> pass_s );
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), WHILE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_call_iname ( Emit::tree (), Hierarchy::find ( WORDINPROPERTY_HL ));
+ Produce::down ( Emit::tree ());
+ Produce::inv_call_iname ( Emit::tree (), Hierarchy::find ( NEXTWORDSTOPPED_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( SELF_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , RTParsing::name_iname ());
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> f_s );
+ Produce::val ( Emit::tree (), K_truth_state , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), POSTDECREMENT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> try_from_wn_s );
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+}
+
+
+
+
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> original_wn_s );
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::up ( Emit::tree ());
+
+
+
+
+
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> original_wn_s );
+ Produce::up ( Emit::tree ());
+
+
+
+
+
+void UnderstandGeneralTokens::after_gl_failed ( gpr_kit * gprk , inter_symbol * label , int pluralised ) {
+ if ( pluralised ) {
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_ACTION_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PLURALFOUND_HL ));
+ Produce::up ( Emit::tree ());
+ }
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> try_from_wn_s );
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> f_s );
+ Produce::val ( Emit::tree (), K_truth_state , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), CONTINUE_BIP );
+
+ Produce::place_label ( Emit::tree (), label );
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> try_from_wn_s );
+ Produce::up ( Emit::tree ());
+}
+
+
+
+
+void UnderstandGeneralTokens::compile_parse_name_tail ( gpr_kit * gprk ) {
+ Produce::inv_primitive ( Emit::tree (), BREAK_BIP );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), WHILE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_call_iname ( Emit::tree (), Hierarchy::find ( WORDINPROPERTY_HL ));
+ Produce::down ( Emit::tree ());
+ Produce::inv_call_iname ( Emit::tree (), Hierarchy::find ( NEXTWORDSTOPPED_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( SELF_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , RTParsing::name_iname ());
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), POSTINCREMENT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), OR_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> f_s );
+ Produce::inv_primitive ( Emit::tree (), GT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 0 );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::inv_primitive ( Emit::tree (), MINUS_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PLUS_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> try_from_wn_s );
+ Produce::up ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> original_wn_s );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> pass_s );
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> pass1_n_s );
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> pass_s );
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 2 );
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> pass2_n_s );
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), POSTINCREMENT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> pass_s );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), IFDEBUG_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), GE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_TRACE_HL ));
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 3 );
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PRINT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_text ( Emit::tree (), I "Pass 1: " );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PRINTNUMBER_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> pass1_n_s );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PRINT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_text ( Emit::tree (), I " Pass 2: " );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PRINTNUMBER_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> pass2_n_s );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PRINT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_text ( Emit::tree (), I " Pass 3: " );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PRINTNUMBER_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PRINT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_text ( Emit::tree (), I "\n" );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), GT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> pass1_n_s );
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> pass1_n_s );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), GT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> pass2_n_s );
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> pass2_n_s );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::inv_primitive ( Emit::tree (), PLUS_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> original_wn_s );
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 0 );
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), RETURN_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , ( inter_ti ) -1);
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::inv_call_iname ( Emit::tree (), Hierarchy::find ( DETECTPLURALWORD_HL ));
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> original_wn_s );
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), RETURN_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> n_s );
+ Produce::up ( Emit::tree ());
+}
+
+
+
+
+void UnderstandGeneralTokens::consider_visible_properties ( gpr_kit * gprk , inference_subject * subj ,
+ int test_distinguishability ) {
+ int phase = 2 ;
+ if ( test_distinguishability ) phase = 1 ;
+ for (; phase <=2; phase ++) {
+ property * pr ;
+ UnderstandGeneralTokens::start_considering_visible_properties ( gprk , phase );
+ LOOP_OVER ( pr , property ) {
+ if (( Properties::is_either_or ( pr )) && ( RTProperties::stored_in_negation ( pr ))) continue ;
+ property_permission * pp =
+ PropertyPermissions::find ( subj , pr , TRUE );
+ if (( pp ) && ( Visibility::get_level ( pp ) > 0 ))
+ UnderstandGeneralTokens::consider_visible_property ( gprk , subj , pr , pp , phase );
+ }
+ UnderstandGeneralTokens::finish_considering_visible_properties ( gprk , phase );
+ }
+}
+
+
+
+
+int visible_properties_code_written = FALSE ;
+
+void UnderstandGeneralTokens::start_considering_visible_properties ( gpr_kit * gprk , int phase ) {
+ visible_properties_code_written = FALSE ;
+}
+
+void UnderstandGeneralTokens::consider_visible_property ( gpr_kit * gprk , inference_subject * subj ,
+ property * pr , property_permission * pp , int phase ) {
+ int conditional_vis = FALSE ;
+ parse_node * spec ;
+
+ if ( visible_properties_code_written == FALSE ) {
+ visible_properties_code_written = TRUE ;
+ if ( phase == 1 )
+ UnderstandGeneralTokens::begin_distinguishing_visible_properties ( gprk );
+ else
+ UnderstandGeneralTokens::begin_parsing_visible_properties ( gprk );
+ }
+
+ spec = Visibility::get_condition ( pp );
+
+ if ( spec ) {
+ conditional_vis = TRUE ;
+ if ( phase == 1 )
+ UnderstandGeneralTokens::test_distinguish_visible_property ( gprk , spec );
+ else
+ UnderstandGeneralTokens::test_parse_visible_property ( gprk , spec );
+ }
+
+ if ( phase == 1 )
+ UnderstandGeneralTokens::distinguish_visible_property ( gprk , pr );
+ else
+ UnderstandGeneralTokens::parse_visible_property ( gprk , subj , pr , Visibility::get_level ( pp ));
+
+ if ( conditional_vis ) { Produce::up ( Emit::tree ()); Produce::up ( Emit::tree ()); }
+}
+
+void UnderstandGeneralTokens::finish_considering_visible_properties ( gpr_kit * gprk , int phase ) {
+ if ( visible_properties_code_written ) {
+ if ( phase == 1 )
+ UnderstandGeneralTokens::finish_distinguishing_visible_properties ( gprk );
+ else
+ UnderstandGeneralTokens::finish_parsing_visible_properties ( gprk );
+ }
+}
+
+
+
+(i) if any property is currently visible for P1 but not P2 or vice versa,
+then they are distinguishable; (ii) if any value property is visible
+but P1 and P2 have different values for it, then they are distinguishable;
+ (iii) if any either/or property is visible but P1 has it and P2 hasn't,
+or vice versa, then they are distinguishable; and otherwise we revert to
+the I6 parser's standard algorithm, which looks at the property.
+
+
+void UnderstandGeneralTokens::begin_distinguishing_visible_properties ( gpr_kit * gprk ) {
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_ACTION_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( THESAME_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), IFDEBUG_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), GE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_TRACE_HL ));
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 4 );
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PRINT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_text ( Emit::tree (), I "p1, p2 = " );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PRINTNUMBER_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_ONE_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PRINT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_text ( Emit::tree (), I ", " );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PRINTNUMBER_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_TWO_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PRINT_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_text ( Emit::tree (), I "\n" );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> ss_s );
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( SELF_HL ));
+ Produce::up ( Emit::tree ());
+}
+
+void UnderstandGeneralTokens::test_distinguish_visible_property ( gpr_kit * gprk , parse_node * spec ) {
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( SELF_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_ONE_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> f_s );
+ Specifications::Compiler::emit_as_val ( K_truth_state , spec );
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( SELF_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_TWO_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> g_s );
+ Specifications::Compiler::emit_as_val ( K_truth_state , spec );
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), NE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> f_s );
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> g_s );
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Return minus two 11.1 ;
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> f_s );
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+}
+
+void UnderstandGeneralTokens::distinguish_visible_property ( gpr_kit * gprk , property * prn ) {
+ TEMPORARY_TEXT ( C )
+ WRITE_TO ( C , "Distinguishing property %n" , RTProperties::iname ( prn ));
+ Emit::code_comment ( C );
+ DISCARD_TEXT ( C )
+
+ if ( Properties::is_either_or ( prn )) {
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), AND_BIP );
+ Produce::down ( Emit::tree ());
+ RTPropertyValues::emit_iname_has_property ( K_value , Hierarchy::find ( PARSER_ONE_HL ), prn );
+ Produce::inv_primitive ( Emit::tree (), NOT_BIP );
+ Produce::down ( Emit::tree ());
+ RTPropertyValues::emit_iname_has_property ( K_value , Hierarchy::find ( PARSER_TWO_HL ), prn );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Return minus two 11.1 ;
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), AND_BIP );
+ Produce::down ( Emit::tree ());
+ RTPropertyValues::emit_iname_has_property ( K_value , Hierarchy::find ( PARSER_TWO_HL ), prn );
+ Produce::inv_primitive ( Emit::tree (), NOT_BIP );
+ Produce::down ( Emit::tree ());
+ RTPropertyValues::emit_iname_has_property ( K_value , Hierarchy::find ( PARSER_ONE_HL ), prn );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Return minus two 11.1 ;
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ } else {
+ kind * K = ValueProperties::kind ( prn );
+ inter_name * distinguisher = Kinds::Behaviour::get_distinguisher_as_iname ( K );
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ if ( distinguisher ) {
+ Produce::inv_call_iname ( Emit::tree (), distinguisher );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PROPERTYVALUE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_ONE_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , RTProperties::iname ( prn ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PROPERTYVALUE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_TWO_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , RTProperties::iname ( prn ));
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ } else {
+ Produce::inv_primitive ( Emit::tree (), NE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PROPERTYVALUE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_ONE_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , RTProperties::iname ( prn ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PROPERTYVALUE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSER_TWO_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , RTProperties::iname ( prn ));
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ }
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Return minus two 11.1 ;
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ }
+}
+
+
+
+
+ Produce::inv_primitive ( Emit::tree (), RETURN_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , ( inter_ti ) -2);
+ Produce::up ( Emit::tree ());
+
+This code is used in §11 (four times).
+
+
+
+void UnderstandGeneralTokens::finish_distinguishing_visible_properties ( gpr_kit * gprk ) {
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( SELF_HL ));
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> ss_s );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), RETURN_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 0 );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+}
+
+
+
+
+void UnderstandGeneralTokens::begin_parsing_visible_properties ( gpr_kit * gprk ) {
+ Emit::code_comment ( I "Match any number of visible property values" );
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> try_from_wn_s );
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> g_s );
+ Produce::val ( Emit::tree (), K_truth_state , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), WHILE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> g_s );
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> g_s );
+ Produce::val ( Emit::tree (), K_truth_state , LITERAL_IVAL , 0 );
+ Produce::up ( Emit::tree ());
+}
+
+void UnderstandGeneralTokens::test_parse_visible_property ( gpr_kit * gprk , parse_node * spec ) {
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Specifications::Compiler::emit_as_val ( K_truth_state , spec );
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+}
+
+int unique_pvp_counter = 0 ;
+void UnderstandGeneralTokens::parse_visible_property ( gpr_kit * gprk ,
+ inference_subject * subj , property * prn , int visibility_level ) {
+ TEMPORARY_TEXT ( C )
+ WRITE_TO ( C , "Parsing property %n" , RTProperties::iname ( prn ));
+ Emit::code_comment ( C );
+ DISCARD_TEXT ( C )
+
+ if ( Properties::is_either_or ( prn )) {
+ TEMPORARY_TEXT ( L )
+ WRITE_TO ( L , ".pvp_pass_L_%d" , unique_pvp_counter ++);
+ inter_symbol * pass_label = Produce::reserve_label ( Emit::tree (), L );
+ DISCARD_TEXT ( L )
+
+ UnderstandGeneralTokens::parse_visible_either_or (
+ gprk , prn , visibility_level , pass_label );
+ property * prnbar = EitherOrProperties::get_negation ( prn );
+ if ( prnbar )
+ UnderstandGeneralTokens::parse_visible_either_or (
+ gprk , prnbar , visibility_level , pass_label );
+
+ Produce::place_label ( Emit::tree (), pass_label );
+ } else {
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> try_from_wn_s );
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> spn_s );
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSED_NUMBER_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> ss_s );
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( ETYPE_HL ));
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ kind * K = ValueProperties::kind ( prn );
+ inter_name * recog_gpr = Kinds::Behaviour::get_recognition_only_GPR_as_iname ( K );
+ if ( recog_gpr ) {
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_call_iname ( Emit::tree (), recog_gpr );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PROPERTYVALUE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( SELF_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , RTProperties::iname ( prn ));
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( GPR_PREPOSITION_HL ));
+ Produce::up ( Emit::tree ());
+ } else if ( Kinds::Behaviour::offers_I6_GPR ( K )) {
+ inter_name * i6_gpr_name = Kinds::Behaviour::get_explicit_I6_GPR_iname ( K );
+ if ( i6_gpr_name ) {
+ Produce::inv_primitive ( Emit::tree (), AND_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_call_iname ( Emit::tree (), i6_gpr_name );
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( GPR_NUMBER_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PROPERTYVALUE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( SELF_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , RTProperties::iname ( prn ));
+ Produce::up ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSED_NUMBER_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ } else if ( Kinds::Behaviour::is_an_enumeration ( K )) {
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_call_iname ( Emit::tree (), RTKinds::get_instance_GPR_iname ( K ));
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PROPERTYVALUE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( SELF_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , RTProperties::iname ( prn ));
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( GPR_NUMBER_HL ));
+ Produce::up ( Emit::tree ());
+ } else {
+ Produce::inv_primitive ( Emit::tree (), AND_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_call_iname ( Emit::tree (), RTKinds::get_kind_GPR_iname ( K ));
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( GPR_NUMBER_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), PROPERTYVALUE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( SELF_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , RTProperties::iname ( prn ));
+ Produce::up ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSED_NUMBER_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ }
+ } else internal_error ( "Unable to recognise kind of value in parsing" );
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> try_from_wn_s );
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> g_s );
+ Produce::val ( Emit::tree (), K_truth_state , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+ if ( visibility_level == 2 ) {
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> f_s );
+ Produce::val ( Emit::tree (), K_truth_state , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+ }
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( PARSED_NUMBER_HL ));
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> spn_s );
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( ETYPE_HL ));
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> ss_s );
+ Produce::up ( Emit::tree ());
+ }
+}
+
+void UnderstandGeneralTokens::parse_visible_either_or ( gpr_kit * gprk , property * prn , int visibility_level ,
+ inter_symbol * pass_l ) {
+ command_grammar * cg = EitherOrProperties::get_parsing_grammar ( prn );
+ UnderstandGeneralTokens::pvp_test_begins_dash ( gprk );
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ wording W = prn -> name ;
+ int j = 0 ; LOOP_THROUGH_WORDING ( i , W ) j ++;
+ int ands = 0 ;
+ if ( j > 0 ) { Produce::inv_primitive ( Emit::tree (), AND_BIP ); Produce::down ( Emit::tree ()); ands ++; }
+ RTPropertyValues::emit_iname_has_property ( K_value , Hierarchy::find ( SELF_HL ), prn );
+ int k = 0 ;
+ LOOP_THROUGH_WORDING ( i , W ) {
+ if ( k < j -1) { Produce::inv_primitive ( Emit::tree (), AND_BIP ); Produce::down ( Emit::tree ()); ands ++; }
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_call_iname ( Emit::tree (), Hierarchy::find ( NEXTWORDSTOPPED_HL ));
+ TEMPORARY_TEXT ( N )
+ WRITE_TO ( N , "%N" , i );
+ Produce::val_dword ( Emit::tree (), N );
+ DISCARD_TEXT ( N )
+ Produce::up ( Emit::tree ());
+ k ++;
+ }
+
+ for ( int a =0; a < ands ; a ++) Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ UnderstandGeneralTokens::pvp_test_passes_dash ( gprk , visibility_level , pass_l );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ if ( cg ) {
+ if ( cg -> compilation_data . cg_prn_iname == NULL ) internal_error ( "no PRN iname" );
+ UnderstandGeneralTokens::pvp_test_begins_dash ( gprk );
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), AND_BIP );
+ Produce::down ( Emit::tree ());
+ RTPropertyValues::emit_iname_has_property ( K_value , Hierarchy::find ( SELF_HL ), prn );
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_call_iname ( Emit::tree (), cg -> compilation_data . cg_prn_iname );
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( GPR_PREPOSITION_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ UnderstandGeneralTokens::pvp_test_passes_dash ( gprk , visibility_level , pass_l );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ }
+}
+
+void UnderstandGeneralTokens::pvp_test_begins_dash ( gpr_kit * gprk ) {
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> try_from_wn_s );
+ Produce::up ( Emit::tree ());
+}
+
+void UnderstandGeneralTokens::pvp_test_passes_dash ( gpr_kit * gprk , int visibility_level , inter_symbol * pass_l ) {
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> try_from_wn_s );
+ Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> g_s );
+ Produce::val ( Emit::tree (), K_truth_state , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+ if ( visibility_level == 2 ) {
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , gprk -> f_s );
+ Produce::val ( Emit::tree (), K_truth_state , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+ }
+ if ( pass_l ) {
+ Produce::inv_primitive ( Emit::tree (), JUMP_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::lab ( Emit::tree (), pass_l );
+ Produce::up ( Emit::tree ());
+ }
+}
+
+void UnderstandGeneralTokens::finish_parsing_visible_properties ( gpr_kit * gprk ) {
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Emit::code_comment ( I "try_from_wn is now advanced past any visible property values" );
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_value , Hierarchy::find ( WN_HL ));
+ Produce::val_symbol ( Emit::tree (), K_value , gprk -> try_from_wn_s );
+ Produce::up ( Emit::tree ());
+}
+
+
+
+
+
+
+
+
diff --git a/docs/runtime-module/5-nft.html b/docs/runtime-module/5-nft.html
new file mode 100644
index 000000000..dac548975
--- /dev/null
+++ b/docs/runtime-module/5-nft.html
@@ -0,0 +1,361 @@
+
+
+
+
+
+
+Filters are used to require nouns to have specific kinds or attributes, or to have specific scoping rules: they correspond to Inform 6's |noun=Routine| and |scope=Routine| tokens. Though these are quite different concepts in I6, their common handling seems natural in I7.
+
+
+
+
+
+
+typedef struct noun_filter_token {
+ struct parse_node * the_filter ;
+ struct parse_node * nft_created_at ;
+ int global_scope_flag ;
+ int any_things_flag ;
+ int parse_using_gpr ;
+ int nft_compiled ;
+ struct inter_name * nft_iname ;
+ CLASS_DEFINITION
+} noun_filter_token ;
+
+The structure noun_filter_token is private to this section.
+
+
+
+noun_filter_token * UnderstandFilterTokens::nft_new ( parse_node * spec , int global_scope , int any_things ) {
+ noun_filter_token * nft = CREATE ( noun_filter_token );
+ nft -> the_filter = spec ;
+ nft -> global_scope_flag = global_scope ;
+ nft -> any_things_flag = any_things ;
+ nft -> nft_created_at = current_sentence ;
+ nft -> parse_using_gpr = FALSE ;
+ nft -> nft_compiled = FALSE ;
+
+ if ( global_scope ) {
+ package_request * PR = Hierarchy::local_package ( SCOPE_FILTERS_HAP );
+ nft -> nft_iname = Hierarchy::make_iname_in ( SCOPE_FILTER_FN_HL , PR );
+ } else {
+ package_request * PR = Hierarchy::local_package ( NOUN_FILTERS_HAP );
+ nft -> nft_iname = Hierarchy::make_iname_in ( NOUN_FILTER_FN_HL , PR );
+ }
+ return nft ;
+}
+
+inter_name * UnderstandFilterTokens::nft_compile_routine_iname ( noun_filter_token * nft ) {
+ return nft -> nft_iname ;
+}
+
+void UnderstandFilterTokens::nft_compile_routine ( noun_filter_token * nft ) {
+ parse_node * noun_var = Lvalues::new_actual_NONLOCAL_VARIABLE ( Inter_noun_VAR );
+ kind * R = Specifications::to_kind ( nft -> the_filter );
+ kind * K = NonlocalVariables::kind ( Inter_noun_VAR );
+ NonlocalVariables::set_kind ( Inter_noun_VAR , R );
+ if ( Kinds::Behaviour::is_object ( R ) == FALSE ) nft -> parse_using_gpr = TRUE ;
+
+ packaging_state save = Routines::begin ( nft -> nft_iname );
+ if ( nft -> parse_using_gpr ) {
+ inter_symbol * v_s = LocalVariables::add_internal_local_c_as_symbol ( I "v" , "value parsed" );
+ inter_symbol * n_s = LocalVariables::add_internal_local_c_as_symbol ( I "n" , "saved value of noun" );
+
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , v_s );
+ inter_name * gpr_to_ask = Kinds::Behaviour::get_explicit_I6_GPR_iname ( R );
+ if ( gpr_to_ask == NULL ) gpr_to_ask = RTKinds::get_kind_GPR_iname ( R );
+ Produce::inv_call_iname ( Emit::tree (), gpr_to_ask );
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), EQ_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , v_s );
+ Produce::val_iname ( Emit::tree (), K_object , Hierarchy::find ( GPR_NUMBER_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , n_s );
+ Produce::val_iname ( Emit::tree (), K_object , Hierarchy::find ( NOUN_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_object , Hierarchy::find ( NOUN_HL ));
+ Produce::val_iname ( Emit::tree (), K_object , Hierarchy::find ( PARSED_NUMBER_HL ));
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), IF_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), NOT_BIP );
+ Produce::down ( Emit::tree ());
+ Calculus::Deferrals::emit_test_if_var_matches_description ( noun_var , nft -> the_filter );
+ Produce::up ( Emit::tree ());
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , v_s );
+ Produce::val_iname ( Emit::tree (), K_object , Hierarchy::find ( GPR_FAIL_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_object , Hierarchy::find ( NOUN_HL ));
+ Produce::val_symbol ( Emit::tree (), K_value , n_s );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), RETURN_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , v_s );
+ Produce::up ( Emit::tree ());
+ } else if ( nft -> global_scope_flag ) {
+ inter_symbol * obj_s = LocalVariables::add_internal_local_c_as_symbol ( I "obj" , "object loop variable" );
+ inter_symbol * o2_s = LocalVariables::add_internal_local_c_as_symbol ( I "o2" , "saved value of noun" );
+
+ Produce::inv_primitive ( Emit::tree (), SWITCH_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val_iname ( Emit::tree (), K_object , Hierarchy::find ( SCOPE_STAGE_HL ));
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), CASE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 1 );
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ if ( nft -> any_things_flag ) Produce::rtrue ( Emit::tree ());
+ else Produce::rfalse ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), CASE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 2 );
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , obj_s );
+ Produce::val_iname ( Emit::tree (), K_object , Hierarchy::find ( NOUN_HL ));
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), OBJECTLOOP_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_object , Hierarchy::find ( NOUN_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , RTKinds::I6_classname ( K_object ));
+ Calculus::Deferrals::emit_test_if_var_matches_description ( noun_var , nft -> the_filter );
+
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , o2_s );
+ Produce::val_iname ( Emit::tree (), K_object , Hierarchy::find ( NOUN_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_object , Hierarchy::find ( NOUN_HL ));
+ Produce::val_symbol ( Emit::tree (), K_value , obj_s );
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_object , Hierarchy::find ( SUPPRESS_SCOPE_LOOPS_HL ));
+ Produce::val ( Emit::tree (), K_truth_state , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_call_iname ( Emit::tree (), Hierarchy::find ( PLACEINSCOPE_HL ));
+ Produce::down ( Emit::tree ());
+ Produce::val_symbol ( Emit::tree (), K_value , o2_s );
+ Produce::val ( Emit::tree (), K_truth_state , LITERAL_IVAL , 1 );
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_object , Hierarchy::find ( SUPPRESS_SCOPE_LOOPS_HL ));
+ Produce::val ( Emit::tree (), K_truth_state , LITERAL_IVAL , 0 );
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_object , Hierarchy::find ( NOUN_HL ));
+ Produce::val_symbol ( Emit::tree (), K_value , o2_s );
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_object , Hierarchy::find ( NOUN_HL ));
+ Produce::val_symbol ( Emit::tree (), K_value , obj_s );
+ Produce::up ( Emit::tree ());
+
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), CASE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , 3 );
+ Produce::code ( Emit::tree ());
+ Produce::down ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_iname ( Emit::tree (), K_object , Hierarchy::find ( NEXTBEST_ETYPE_HL ));
+ Produce::val_iname ( Emit::tree (), K_object , Hierarchy::find ( NOTINCONTEXTPE_HL ));
+ Produce::up ( Emit::tree ());
+ Produce::inv_primitive ( Emit::tree (), RETURN_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::val ( Emit::tree (), K_number , LITERAL_IVAL , ( inter_ti ) (-1));
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ Produce::up ( Emit::tree ());
+ } else {
+ inter_symbol * x_s = LocalVariables::add_internal_local_c_as_symbol ( I "x" , "saved value of noun" );
+ Produce::inv_primitive ( Emit::tree (), STORE_BIP );
+ Produce::down ( Emit::tree ());
+ Produce::ref_symbol ( Emit::tree (), K_value , x_s );
+ Produce::val_iname ( Emit::tree (), K_object , Hierarchy::find ( NOUN_HL ));
+ Produce::up ( Emit::tree ());
+
+ Produce::inv_primitive ( Emit::tree (), RETURN_BIP );
+ Produce::down ( Emit::tree ());
+ if ( Specifications::to_proposition ( nft -> the_filter )) {
+ Propositions::Checker::type_check ( Specifications::to_proposition ( nft -> the_filter ), Propositions::Checker::tc_no_problem_reporting ());
+ Calculus::Deferrals::emit_test_of_proposition (
+ noun_var , Specifications::to_proposition ( nft -> the_filter ));
+ } else
+ Calculus::Deferrals::emit_test_if_var_matches_description ( noun_var , nft -> the_filter );
+ Produce::up ( Emit::tree ());
+ }
+ Routines::end ( save );
+ NonlocalVariables::set_kind ( Inter_noun_VAR , K );
+}
+
+
+
+
+void UnderstandFilterTokens::compile_id ( noun_filter_token * nft ) {
+ if ( nft ) {
+ if ( nft -> parse_using_gpr ) Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( GPR_TT_HL ));
+ else if ( nft -> global_scope_flag ) Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( SCOPE_TT_HL ));
+ else Produce::val_iname ( Emit::tree (), K_value , Hierarchy::find ( ROUTINEFILTER_TT_HL ));
+ Produce::val_iname ( Emit::tree (), K_value , nft -> nft_iname );
+ }
+}
+
+void UnderstandFilterTokens::emit_id ( noun_filter_token * nft ) {
+ if ( nft ) {
+ inter_ti annot = 0 ;
+ if ( nft -> parse_using_gpr == FALSE ) {
+ if ( nft -> global_scope_flag ) annot = SCOPE_FILTER_IANN ;
+ else annot = NOUN_FILTER_IANN ;
+ }
+ inter_name * iname = UnderstandFilterTokens::nft_compile_routine_iname ( nft );
+ if ( annot != 0 )
+ if ( Produce::read_annotation ( iname , annot ) != 1 )
+ Produce::annotate_i ( iname , annot , 1 );
+ Emit::array_iname_entry ( iname );
+ }
+}
+
+
+
+
+void UnderstandFilterTokens::compile ( void ) {
+ noun_filter_token * nft ;
+ LOOP_OVER ( nft , noun_filter_token )
+ if ( nft -> nft_compiled == FALSE ) {
+ current_sentence = nft -> nft_created_at ;
+ UnderstandFilterTokens::nft_compile_routine ( nft );
+ nft -> nft_compiled = TRUE ;
+ }
+}
+
+
+
+
+
+
+
+
diff --git a/docs/runtime-module/5-tpv.html b/docs/runtime-module/5-tpv.html
new file mode 100644
index 000000000..17ba49c2f
--- /dev/null
+++ b/docs/runtime-module/5-tpv.html
@@ -0,0 +1,393 @@
+
+
+
+