diff sched/rsched.m @ 6:0ce3c2070089

Removed duplicate code and fixed doc in timed_action.
author samer
date Mon, 14 Jan 2013 14:33:37 +0000
parents 7357e1dc2ad6
children beb8a3f4a345
line wrap: on
line diff
--- a/sched/rsched.m	Sat Jan 12 22:32:08 2013 +0000
+++ b/sched/rsched.m	Mon Jan 14 14:33:37 2013 +0000
@@ -13,17 +13,17 @@
 %
 %       onstart :: (
 %             S       ~'current state', 
-%             real    ~'scheduled start time'
-%             datenum ~'actual time'
+%             real    ~'scheduled start time',
+%             datenum ~'actual start date-stamp'
 %          => void)/@nop ~ 'called on timer start';
 %
 %       onstop  :: (
 %             S       ~'current state',
-%             datenum ~'actual time' %          => void)/@nop ~ 'called on timer stop';
+%             datenum ~'actual start date-stamp'
+%          => void)/@nop ~ 'called on timer stop';
 %
 %       onfinish:: (
-%             S       ~'final state', 
-%             datanum ~'actual time'
+%             datenum ~'actual start date-stamp'
 %          => void)/@nop ~ 'called if state seq finishes';
 %
 %       busy_mode :: {'queue','drop'};
@@ -76,8 +76,8 @@
 		'getstate',	@getstate, ...
 		'setstate',	@setstate, ...
 		'trim',   	@trim, ...
-		'timer',    @()Timer ...
-		'wait',     @sched_wait
+		'timer',    @()Timer, ...
+		'wait',     @sched_wait ...
 	);
 	
 	if opts.final, api.finalstate=@()FinalState; end
@@ -112,9 +112,7 @@
 
 	function stopfn(o,e), 
 		opts.onstop(State,e.Data.time); 
-		if isempty(State), 
-			opts.onfinish(State,e.Data.time); 
-		end
+		if isempty(State), opts.onfinish(e.Data.time); end
 	end
 
 	function startfn(o,e)
@@ -140,3 +138,4 @@
 	function sched_wait
 		while Timer.isrunning(); pause(0.05); end
 	end
+end