[q-lang-cvs] qcalc calclib.q,1.36,1.37 qcalc.q,1.159,1.160
Brought to you by:
agraef
From: Albert G. <ag...@us...> - 2007-11-17 10:39:59
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv28706 Modified Files: calclib.q qcalc.q Log Message: add clearval operation Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** qcalc.q 17 Nov 2007 04:21:56 -0000 1.159 --- qcalc.q 17 Nov 2007 10:39:55 -0000 1.160 *************** *** 782,785 **** --- 782,792 ---- (reg 1,reg 2), (I,J) = val K; + = process_sel2 [(I,J,X)] || merge_undo (I,J) + where X = recursive (process_clear (I,J) S) + if get STATE = 4 + where [(K,S)] = regex "" + "^\\+\\+\\+ Clear: (\\([0-9]+,[0-9]+\\)) (.*)$" S + (reg 1,reg 2), + (I,J) = val K; = qt X "setIconSet" ICONSET where [(K,S)] = regex "" *************** *** 812,815 **** --- 819,832 ---- S = if isstr S0 then S else S1; + // variation of the above, which also forcibly clears a GUI cell before + // setting the new value + + process_clear (I,J) S + = if null S1 then delete_cells (I,J) || + cell_setval (I,J) S0 || + clear_cell (I,J) || set_cell (I,J) S1 || S + where (S0,S1) = unquote S, + S = if isstr S0 then S else S1; + def TEMPL = "%s\nimport calclib;\n/* Main program generated by QCalc. */\n", CMD = "pwd='%s'; filename='%s'; cd \"$pwd\"; echo '+++ Compile:'; \ *************** *** 3337,3341 **** if (S = "+++ Syntax error.") or else not null (regex "" "^\\+\\+\\+ Exception: (.*)$" S ()); ! /* Message to change a cell (calclib::setval). */ = results_loop (insert U ((I1,J1),X)) [(I,J)|V] where X = process_update2 (I1,J1) S1 --- 3354,3358 ---- if (S = "+++ Syntax error.") or else not null (regex "" "^\\+\\+\\+ Exception: (.*)$" S ()); ! /* Messages to change a cell (calclib::setval and clearval). */ = results_loop (insert U ((I1,J1),X)) [(I,J)|V] where X = process_update2 (I1,J1) S1 *************** *** 3344,3347 **** --- 3361,3370 ---- (reg 1,reg 2), (I1,J1) = val K1; + = results_loop (insert U ((I1,J1),X)) [(I,J)|V] + where X = process_clear (I1,J1) S1 + where [(K1,S1)] = regex "" + "^\\+\\+\\+ Clear: (\\([0-9]+,[0-9]+\\)) (.*)$" S + (reg 1,reg 2), + (I1,J1) = val K1; /* Messages to create GUI elements in cells (calclib::combobox et al). */ = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** calclib.q 17 Nov 2007 07:39:57 -0000 1.36 --- calclib.q 17 Nov 2007 10:39:55 -0000 1.37 *************** *** 28,34 **** /* Set a cell value. The given cell index KEY can either be in the numeric format as returned by the index function or in any of the symbolic formats ! supported by the cellindex routine (see above). */ ! public setval KEY X; /* Convenience functions to store a list in a matrix or row/column vector of --- 28,36 ---- /* Set a cell value. The given cell index KEY can either be in the numeric format as returned by the index function or in any of the symbolic formats ! supported by the cellindex routine (see above). clearval works like setval, ! but clears an existing GUI element in the cell instead of setting its ! value. */ ! public setval KEY X, clearval KEY X; /* Convenience functions to store a list in a matrix or row/column vector of *************** *** 137,140 **** --- 139,146 ---- where (I:Int,J:Int) = indexarg KEY; + clearval KEY X = printf "\f+++ Clear: %s %s\n" (str (I,J),str X) || + if member (get YYDATA) (I,J) then yyset (I,J) X else X + where (I:Int,J:Int) = indexarg KEY; + matrix KEY Xs:List = dowith setval Ks (cat Xs) || Xs |