Example #1
0
void do_preference_phase (void) {
  production *prod;
  struct token_struct *tok;
  wme *w;
  instantiation *inst;


/* AGR 617/634:  These are 2 bug reports that report the same problem,
   namely that when 2 chunk firings happen in succession, there is an
   extra newline printed out.  The simple fix is to monitor
   get_printer_output_column and see if it's at the beginning of a line
   or not when we're ready to print a newline.  94.11.14 */


  if (current_agent(sysparams)[TRACE_PHASES_SYSPARAM]) {
     if (current_agent(operand2_mode) == TRUE) {
	switch (current_agent(FIRING_TYPE)) {
	   case PE_PRODS:
              print ("\t--- Firing Productions (PE) ---\n");
	      break;
	   case IE_PRODS:
              print ("\t--- Firing Productions (IE) ---\n");
	      break;
	}
     }

     else
	  print ("\n--- Preference Phase ---\n");
  }


  current_agent(newly_created_instantiations) = NIL;

  /* MVP 6-8-94 */
  while (get_next_assertion (&prod, &tok, &w)) {
     if (current_agent(max_chunks_reached)) {
       current_agent(system_halted) = TRUE;
       return;
     }
     create_instantiation (prod, tok, w);
   }

  assert_new_preferences ();

  while (get_next_retraction (&inst))
    retract_instantiation (inst);

/* REW: begin 08.20.97 */

  /*  In Waterfall, if there are nil goal retractions, then we want to 
      retract them as well, even though they are not associated with any
      particular goal (because their goal has been deleted). The 
      functionality of this separte routine could have been easily 
      combined in get_next_retraction but I wanted to highlight the 
      distinction between regualr retractions (those that can be 
      mapped onto a goal) and nil goal retractions that require a
      special data strucutre (because they don't appear on any goal) 
      REW.  */

  if (current_agent(operand2_mode) && current_agent(nil_goal_retractions)) {
    while (get_next_nil_goal_retraction (&inst))
      retract_instantiation (inst);
  }

/* REW: end   08.20.97 */

}
Example #2
0
 bool
 Module_scanner<Impl>::insert_instantiation(ast::Module_instantiation const& node) {
   create_instantiation(node);
   return false;
 }