logout.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
-- 2000/8 LINUX/Sather verion
-- 1996/10 
-- LINUX/Modula2 version
-- 93/06/22 21:43:00
-- Kouji  Kodama    1989/8    
-- Modula2 version

-- logging on a file with displaying on terminal .


class LOGOUT < $OSTREAM

class LOGOUT < $OSTREAM is shared outS:FILE; shared LogEnabled:BOOL:=false; shared FileEnabled:BOOL:=false; shared LogFile:STR; create:SAME is return self; end; setDefaultName is LogFile:="knotLog." +DATE::year.str+"-"+DATE::mon.str+"-"+DATE::mday.str; end; Connect(inout s:STR) is -- set output file name & open. length,position:INT; file:STR; if void(LogFile) then setDefaultName; end; if ~FileEnabled then length:=-1; position:=-1; if ( s.size>0 ) then file:=s; else file:=LogFile; -- GetSTR(file,i,'Log file:',3,3); end; s:=""; if file[0]>' ' then outS:=FILE::open_for_append(file); FileEnabled:=~outS.error; if FileEnabled then --length:=msFIO.FSize(outS); --if length>=0 then position:=msFIO.Seek(outS,length); end; --msFIO.FWrLn(outS); if ~outS.error then s:=file; LogFile:=file; else outS.close; FileEnabled:=false; end; end; end; end; end; Disconnect is if FileEnabled then LogEnabled:=false; FileEnabled:=false; outS.flush; outS.close; end; end; LogBegin is if FileEnabled.not then Connect(inout LogFile); end; LogEnabled:= FileEnabled; end; LogEnd is if FileEnabled then outS.flush; end; LogEnabled:=false; end; is_enabled:BOOL is -- true if log Enabled. return LogEnabled; end; LogTime is if LogEnabled then outS+"#DATE" +DATE::year+"-"+DATE::mon+"-"+DATE::mday+"," +DATE::hour+":"+DATE::min+":"+DATE::sec+".\n"; end; end; Title(s1,s2:STR) is #OUT+s1+" "+s2+".\n"; if LogEnabled then outS+"\n"; LogTime; outS+s1+" "+s2+".\n"; end; end; flush is #OUT.flush; if FileEnabled then outS.flush; end; end; plus(s:STR) is #OUT+s; if LogEnabled then outS+s; end; end; plus(s:FSTR) is #OUT+s; if LogEnabled then outS+s; end; end; plus(s:$STR) is #OUT+s; if LogEnabled then outS+s; end; end; plus(s:STR):SAME is #OUT+s; if LogEnabled then outS+s; end; return self; end; plus(s:FSTR):SAME is #OUT+s; if LogEnabled then outS+s; end; return self; end; plus(s:$STR):SAME is #OUT+s; if LogEnabled then outS+s; end; return self; end; end; -- class LOGOUT