Update of /cvsroot/q-lang/qcalc
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv25256
Modified Files:
calclib.q qcalc.q
Log Message:
bugfixes
Index: qcalc.q
===================================================================
RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v
retrieving revision 1.165
retrieving revision 1.166
diff -C2 -d -r1.165 -r1.166
*** qcalc.q 17 Nov 2007 18:24:57 -0000 1.165
--- qcalc.q 18 Nov 2007 03:55:03 -0000 1.166
***************
*** 572,580 ****
clearmsg = qt STATUS "clear" ();
statusmsg S = qt STATUS "message" S;
! // like statusmsg, but must be processed immediately:
waitmsg S = statusmsg S || GLOBAL := false ||
qt APP "processEvents" () || GLOBAL := G
where G = get GLOBAL;
/* Application cursor. */
--- 572,590 ----
clearmsg = qt STATUS "clear" ();
statusmsg S = qt STATUS "message" S;
!
! /* This is like statusmsg, but must be processed immediately. */
!
waitmsg S = statusmsg S || GLOBAL := false ||
qt APP "processEvents" () || GLOBAL := G
where G = get GLOBAL;
+ /* Status updates of task buttons. Process events so that the arrow indicator
+ on the task button is updated immediately. Currently we don't do anything
+ else with the information provided here, but in the future we might want to
+ have a status LED somewhere which is lit when some tasks are executing. */
+
+ procmsg (I,J) F = GLOBAL := false || qt APP "processEvents" () || GLOBAL := G
+ where G = get GLOBAL;
+
/* Application cursor. */
***************
*** 795,800 ****
(reg 1,reg 2),
(I,J) = val K;
! = qt X "setIconSet" ICONSET ||
! waitmsg (if Y=0 then "" else "Processing...")
where [(K,S)] = regex ""
"^\\+\\+\\+ Taskstate: (\\([0-9]+,[0-9]+\\)) ([0-9]+)$" S
--- 805,809 ----
(reg 1,reg 2),
(I,J) = val K;
! = qt X "setIconSet" ICONSET || procmsg (I,J) (Y<>0)
where [(K,S)] = regex ""
"^\\+\\+\\+ Taskstate: (\\([0-9]+,[0-9]+\\)) ([0-9]+)$" S
Index: calclib.q
===================================================================
RCS file: /cvsroot/q-lang/qcalc/calclib.q,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** calclib.q 17 Nov 2007 16:24:39 -0000 1.38
--- calclib.q 18 Nov 2007 03:55:03 -0000 1.39
***************
*** 340,344 ****
where (I,J,SEM) = get YYSEM!thread_no this_thread;
! private begin_task ARGS, end_task;
taskbutton S:String X
--- 340,345 ----
where (I,J,SEM) = get YYSEM!thread_no this_thread;
! private begin_task ARGS, end_task ARGS, fini_task X ARGS;
! special do_task X ~ARGS;
taskbutton S:String X
***************
*** 356,360 ****
printf "\f+++ Taskbutton: %s %s\n"
(str (I,J),str (S,INIT)) ||
! thread (begin_task (I,J,SEM) || catch id X || end_task);
if active H where (I,J,_) = get YYSEM!thread_no this_thread,
(H:Thread,SEM,'_) = get YYTASKS!(I,J):
--- 357,362 ----
printf "\f+++ Taskbutton: %s %s\n"
(str (I,J),str (S,INIT)) ||
! thread (begin_task (I,J,SEM) || do_task X (I,J,SEM) ||
! end_task (I,J,SEM));
if active H where (I,J,_) = get YYSEM!thread_no this_thread,
(H:Thread,SEM,'_) = get YYTASKS!(I,J):
***************
*** 374,380 ****
printf "\f+++ Taskstate: %s 1\n" (str (I,J)) || flush;
! end_task = setval (I,J) false ||
! printf "\f+++ Taskstate: %s 0\n" (str (I,J)) || flush
! where (I,J) = task_index;
/* Internals. */
--- 376,396 ----
printf "\f+++ Taskstate: %s 1\n" (str (I,J)) || flush;
! end_task (I,J,SEM)
! = setval (I,J) false ||
! printf "\f+++ Taskstate: %s 0\n" (str (I,J)) || flush;
!
! /* Handle unprocessed messages by the task. X denotes a taskbutton expression
! we still have to process after an update. We walk the entire queue to get
! the last such message and reexecute the task if we find one. */
!
! do_task X ARGS = fini_task (catch id X || sleep 0.1) ARGS;
!
! fini_task X (I,J,SEM)
! where Y = get SEM if N>0 where N:Int = #SEM:
! = fini_task 'Y (I,J,SEM) where 'Y = Y;
! = fini_task X (I,J,SEM) otherwise;
! otherwise:
! = do_task X (I,J,SEM) where 'X = X;
! = () otherwise;
/* Internals. */
***************
*** 443,447 ****
where SEM:Semaphore = semaphore,
H:Thread =
! thread (begin_task (I,J,SEM) || catch id X || end_task)
if B;
// thread has terminated and is deactivated, put it in limbo
--- 459,464 ----
where SEM:Semaphore = semaphore,
H:Thread =
! thread (begin_task (I,J,SEM) || do_task X (I,J,SEM) ||
! end_task (I,J,SEM))
if B;
// thread has terminated and is deactivated, put it in limbo
|