home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / LIB / ACC_DECL.EXP next >
Text File  |  1996-06-04  |  3KB  |  82 lines

  1. %    $Id: acc_declarations.exp,v 1.2 1994/12/08 23:55:22 duchier Exp $    
  2. module("acc_declarations")?
  3.  
  4. public(acc_info,pred_info,pass_info,clear_acc_def,is_passed,is_acc,expandable,get_acc_info,get_pass_info,list_of_accs,dcg,check_expansion_flag,set_error_expander,reset_error_expander,non_expanded_warning)?
  5.  
  6. persistent(accumulators)?
  7.  
  8. persistent(passed_arguments)?
  9.  
  10. persistent(predicates_info)?
  11.  
  12. persistent(check_expansion_flag)?
  13.  
  14. <<-(check_expansion_flag,false)?
  15.  
  16. non_strict(acc_info)?
  17.  
  18. associate_expanders(acc_info,acc_info_expander)?
  19.  
  20. :-(acc_info_expander(_A,in_clauses => _B,out_clauses => _B),_A).
  21.  
  22. :-(acc_info(_A,_B,_C,_D,acc_pred => _E,in_name => _F,in_start => _G,out_name => _H,out_start => _I),,(=(_J,psi2str(_A)),,(=(_F,{strcon("in_",_J);@}),,(=(_H,{strcon("out_",_J);@}),,(!,,(cond(has_feature(_A,accumulators),overriding_warning(_A)),<<-(.(accumulators,_A),@(_A,_B,_C,_D,acc_pred => _E,in_name => _F,in_start => _G,out_name => _H,out_start => _I)))))))).
  23.  
  24. :-(_A: get_acc_info(_B),cond(has_feature(_B,accumulators,_C),=(_A,copy_term(_C)),fail)).
  25.  
  26. ->(is_acc(_A),has_feature(_A,accumulators)).
  27.  
  28. :-(pred_info(_A,_B),cond(:<(_A,list),pred_list_info(_A,_B),pred_info2(_A,_B))).
  29.  
  30. :-(pred_list_info([_A|_B],_C),,(!,,(pred_info2(_A,_C),pred_list_info(_B,_C)))).
  31.  
  32. pred_list_info([]).
  33.  
  34. :-(pred_info2(_A,_B),,(;(,(check_expansion_flag,,(!,,(remove_expanders(_A,error_expander),add_expanders_a(_A,error_expander)))),succeed),cond(:<(_B,list),acc_list_info(_B,combined_name(_A)),<<-(.(.(predicates_info,combined_name(_A)),_B),true)))).
  35.  
  36. :-(acc_list_info([_A|_B],_C),,(!,,(<<-(.(.(predicates_info,_C),_A),true),acc_list_info(_B,_C)))).
  37.  
  38. acc_list_info([]).
  39.  
  40. associate_expanders(pred_info,pred_info_expander)?
  41.  
  42. :-(pred_info_expander(_A,in_clauses => _B,out_clauses => _B),_A).
  43.  
  44. ->(expandable(_A),has_feature(combined_name(_A),predicates_info)).
  45.  
  46. non_strict(pass_info)?
  47.  
  48. :-(pass_info(_A,_B,_C,acc_pred => _D,start => _E),<<-(.(passed_arguments,_A),@(_A,_B,_C,acc_pred => _D,start => _E))).
  49.  
  50. :-(_A: get_pass_info(_B),cond(has_feature(_B,passed_arguments,_C),=(_A,copy_term(_C)),fail)).
  51.  
  52. associate_expanders(pass_info,pass_info_expander)?
  53.  
  54. :-(pass_info_expander(_A,in_clauses => _B,out_clauses => _B),_A).
  55.  
  56. ->(is_passed(_A),has_feature(_A,passed_arguments)).
  57.  
  58. :-(clear_acc_def(_A),cond(:<(_A,list),maprel(clear_one_def,_A),clear_one_def(_A))).
  59.  
  60. :-(clear_one_def(_A),<<-(.(accumulators,_A),@(false))).
  61.  
  62. ->(list_of_accs(_A,_B),|(_C,,(=(_D,cond(has_feature(combined_name(_A),predicates_info,_E),_E,@)),,(=(_F,features(_D,current_module)),cond(_B,cond(has_feature(dcg,_D),=(_C,_F),=(_C,[dcg|_F])),=(_C,_F)))))).
  63.  
  64. :-(error_expander(_A,file => _B,in_clauses => [_A|_C],line => _D,out_clauses => _C),non_expanded_warning(_A,_B,_D)).
  65.  
  66. :-(set_error_expander,maprel(set_check_exp,features(predicates_info,current_module))).
  67.  
  68. :-(reset_error_expander,maprel(reset_check_exp,features(predicates_info,current_module))).
  69.  
  70. :-(set_check_exp(_A),,(remove_expanders(_A,error_expander),add_expanders_a(_A,error_expander))).
  71.  
  72. :-(reset_check_exp(_A),remove_expanders(_A,error_expander)).
  73.  
  74. :-(overriding_warning(@),,(quiet,!)).
  75.  
  76. :-(overriding_warning(_A),,(write_err("*** Warning: overriding previous declaration"," of accumulator ",_A),nl_err)).
  77.  
  78. :-(non_expanded_warning(@,@,@),,(quiet,!)).
  79.  
  80. :-(non_expanded_warning(_A,_B,_C),,(write_err("*** Warning: ",root_sort(_A)),,(nl_err,,(write_err("             is not expanded in file ",_B," near line ",_C,"."),nl_err)))).
  81.  
  82.