check_am.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
---------------------------> Sather 1.1 source file <--------------------------
-- Copyright (C) International Computer Science Institute, 1995.  COPYRIGHT  --
-- NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY and is subject --
-- to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE contained in    --
-- the file "Doc/License" of the Sather distribution.  The license is also   --
-- available from ICSI, 1947 Center St., Suite 600, Berkeley CA 94704, USA.  --
--------> Please email comments to sather-bugs@icsi.berkeley.edu. <----------


class CHECK_AM < $CHECK_AM

class CHECK_AM < $CHECK_AM is -- Check the code for routines which aren't called, but don't output -- any am code for them. include CS_COMPONENT; -- private attr sig_out:FSET{SIG}; -- Table of signatures which have been -- output. create(p:PROG):SAME is r::=new; r.prog:=p; -- CHECK_AM::prog return r; end; check_code is -- sig_out := prog.generate_am.sig_out; loop -- don't use prog.tp_done.elt! since pSather transformation -- might add new helper objects to prog.tp_done. -- The outer loop catches any entries in prog.tp_done that are -- added on the fly. These are processed by working on tp_done -- locally. if prog.tp_done.size = 0 then break! end;-- CHECK_AM::prog PROG::tp_done FSET{1}::size INT::is_eq tp_done ::= prog.tp_done;-- CHECK_AM::prog PROG::tp_done prog.tp_done := void;-- CHECK_AM::prog PROG::tp_done loop tp:$TP:=tp_done.elt!;-- FSET{1}::elt! typecase tp when TP_CLASS then if ~tp.is_abstract then -- TP_CLASS::is_abstract BOOL::not ti::=tp.ifc;-- TP_CLASS::ifc if ~void(ti) and ~void(ti.sigs) then -- BOOL::not IFC::sigs BOOL::not loop check_sig(ti.sigs.elt!) end;-- CHECK_AM::check_sig IFC::sigs SIG_TBL::elt! end; end; else end; end; end; end; check_sig(s:SIG) -- Check `s' for errors, but only generate code for it if -- `generate_checked_code' is true. pre ~void(s) is-- BOOL::not if s.am_created then return end; -- Already did it.-- SIG::am_created s.am_created:=true; -- Mark it done.-- SIG::am_created if prog.show_checked_sig then-- CHECK_AM::prog PROG::show_checked_sig #OUT + "Check sig " + s.str + "\n" end; -- OUT::create OUT::plus OUT::plus SIG::str OUT::plus if s.tp.is_abstract then return end;-- SIG::tp elt:ELT:=s.tp.impl.elts.elt_with_sig(s);-- SIG::tp IMPL::elts ELT_TBL::elt_with_sig if elt.is_external and elt.is_abstract then return end;-- ELT::is_external ELT::is_abstract if void(elt) then return end; am:AM_ROUT_DEF:=TRANS::transform_elt(elt);-- TRANS::transform_elt if void(am) then return end; if prog.show_am_check then-- CHECK_AM::prog PROG::show_am_check #OUT + "\nCheck AM for " + am.sig.str + "="; -- OUT::create OUT::plus OUT::plus AM_ROUT_DEF::sig SIG::str OUT::plus AM_OUT::AM_out(am); #OUT + "\n" end;-- AM_OUT::AM_out OUT::create OUT::plus if prog.generate_checked_code then-- CHECK_AM::prog PROG::generate_checked_code prog.back_end.emit(am) end end;-- CHECK_AM::prog PROG::back_end end; -- class CHECK_AM