q-lang-cvs Mailing List for Q - Equational Programming Language (Page 18)
Brought to you by:
agraef
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(106) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(219) |
Feb
(152) |
Mar
|
Apr
(92) |
May
(45) |
Jun
(3) |
Jul
|
Aug
(3) |
Sep
(111) |
Oct
(52) |
Nov
|
Dec
|
2005 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(23) |
Jun
(46) |
Jul
(158) |
Aug
(22) |
Sep
|
Oct
(26) |
Nov
(11) |
Dec
(49) |
2006 |
Jan
(57) |
Feb
(196) |
Mar
(10) |
Apr
(41) |
May
(149) |
Jun
(308) |
Jul
(11) |
Aug
(25) |
Sep
(15) |
Oct
|
Nov
|
Dec
(15) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
(15) |
May
(204) |
Jun
(112) |
Jul
(7) |
Aug
(16) |
Sep
(134) |
Oct
(313) |
Nov
(262) |
Dec
(83) |
2008 |
Jan
(81) |
Feb
(83) |
Mar
(21) |
Apr
|
May
|
Jun
(1) |
Jul
(2) |
Aug
(6) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Albert G. <ag...@us...> - 2007-11-10 22:13:19
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14605 Modified Files: qcalc.q Log Message: bugfixes and optimizations in the dfs evaluation algorithm Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** qcalc.q 10 Nov 2007 13:17:30 -0000 1.123 --- qcalc.q 10 Nov 2007 22:13:14 -0000 1.124 *************** *** 176,180 **** [which "pixmaps/flag.png", which "pixmaps/1rightarrow.png", ()], // dictionary of edited and computed cells ! CELLS = ref emptyhdict, EVAL = ref emptyhdict, // current filename and edited status EDITED = ref false, FILENAME = ref (), --- 176,180 ---- [which "pixmaps/flag.png", which "pixmaps/1rightarrow.png", ()], // dictionary of edited and computed cells ! CELLS = ref emptyhdict, EVAL = ref emptyhdict, XREF = ref emptyhdict, // current filename and edited status EDITED = ref false, FILENAME = ref (), *************** *** 417,430 **** set_eval Xs:HDict ! = EVAL := Xs; insert_eval ((I,J),X) ! = EVAL := insert (get EVAL) ((I,J),X); insert_eval Xs:List ! = EVAL := foldl insert (get EVAL) Xs; delete_eval (I,J) ! = EVAL := delete (get EVAL) (I,J); delete_eval Xs:List ! = EVAL := foldl delete (get EVAL) Xs; ! filter_eval P = EVAL := hdict $ filter P $ list $ get EVAL; /* Dialogs. */ --- 417,514 ---- set_eval Xs:HDict ! = EVAL := Xs || make_xref if null (get EVAL); ! = update_xref (delta (get EVAL) Xs) || EVAL := Xs otherwise; insert_eval ((I,J),X) ! = update_xref ((I,J),X) || ! EVAL := insert (get EVAL) ((I,J),X); insert_eval Xs:List ! = update_xref Xs || ! EVAL := foldl insert (get EVAL) Xs; delete_eval (I,J) ! = update_xref (I,J) || ! EVAL := delete (get EVAL) (I,J); delete_eval Xs:List ! = update_xref Xs || ! EVAL := foldl delete (get EVAL) Xs; ! filter_eval P = EVAL := hdict $ filter P $ list $ get EVAL || make_xref; ! ! make_xref = //printf "XREF = %s\n" $ str E || ! XREF := hdict E ! where (K,V,E) = rev_graph, ! E = zip K $ map (sort indexcmp.map (K!)) E; ! ! delta OLD_EVAL NEW_EVAL ! = OLD++NEW ! where OLD = sort cellcmp (list OLD_EVAL), ! NEW = sort cellcmp (list NEW_EVAL), ! OLD = filter (deltacmp NEW_EVAL) OLD, ! NEW = filter (deltacmp OLD_EVAL) NEW, ! OLD = filter (neg.member (hdict NEW)) OLD, ! OLD = map fst OLD; ! ! deltacmp D (I,J;_,_,X) ! = (X<>Y) where (_,_,Y) = D!(I,J); ! = true otherwise; ! ! update_xref (I,J;_,_,NEW_DEPS) ! = //printf "XREF += %s\n" $ str E || ! XREF := foldl insert (get XREF) E ! where OLD_DEPS = get_deps (I,J), ! OLD = hdict $ zip OLD_DEPS $ map (cst true) OLD_DEPS, ! OLD = keys $ foldl delete OLD NEW_DEPS, ! NEW = hdict $ zip NEW_DEPS $ map (cst true) NEW_DEPS, ! NEW = keys $ foldl delete NEW OLD_DEPS, ! OLD_XREFS = map (filter (<>(I,J)).get_xref) OLD, ! NEW_XREFS = map (sort indexcmp.cons (I,J).get_xref) NEW, ! E = zip (OLD++NEW) (OLD_XREFS++NEW_XREFS); ! update_xref (I,J) ! = update_xref (I,J;(),(),[]); ! update_xref Xs:List ! = do update_xref Xs; ! ! get_deps (I,J) = DEPS where (_,_,DEPS) = get EVAL!(I,J); ! = [] otherwise; ! get_xref (I,J) = X where X:List = get XREF!(I,J); ! = [] otherwise; ! ! /* Compute the reversal of the dependencies graph given by the DEPS fields in ! the EVAL data structure. This graph is used to initialize the XREF cross ! references table which contains, for each "backward" edge (I2,J2)->(I1,J1) ! in the dependencies graph pointing from a cell to its requisite cells, a ! corresponding "forward" edge (I1,J1)->(I2,J2) pointing from a cell to its ! dependent cells. This information is needed (rather than the DEPS fields ! which are easily derived from the corresponding cell formulas) to implement ! the depth-first search evaluation algorithm in an efficient manner. */ ! ! rev_graph = (KEYS,V,E) ! where // create a node numbering ! CELLS = foldl insert (get CELLS) $ ! /* Add all requisite cells in DEPS fields. These must be ! in the graph even if the corresponding cells are ! empty (and thus not contained in the CELLS ! structure), so that later changes in these cells ! properly trigger corresponding updates. */ ! map (flip pair true) $ ! cat $ map trd $ vals $ get EVAL, ! KEYS = keys CELLS, N = [0..#KEYS-1], ! V = hdict (zip KEYS N), ! // collect the forward edges ! E = sort edgescmp $ cat $ ! map (make_edges V) $ list $ get EVAL, ! (E,_) = foldl group_edges ([],E) N, ! E = reverse E; ! ! group_edges (A,E) N ! = ([list $ set X|A],E) ! where X = map snd $ takewhile ((=N).fst) E, ! E = dropwhile ((=N).fst) E; ! ! make_edges V (I,J;_,_,K) ! = map (flip pair X) $ filter isint $ map (V!) K ! where X:Int = V!(I,J); ! = [] otherwise; ! ! edgescmp (I1,J1) (I2,J2) ! = (I1<I2) or else (I1=I2) and then (J1<J2); /* Dialogs. */ *************** *** 1650,1656 **** --- 1734,1742 ---- CELLS := emptyhdict || EVAL := emptyhdict || + XREF := emptyhdict || do (qt TABLE "clearCell") OLD_KEYS || CELLS := hdict (zip KEYS (map (cst true) KEYS)) || EVAL := hdict (zip KEYS2 (zip3 VALS2 XVALS2 DEPS)) || + make_xref || do (qt TABLE "setText") L1 || do (\I.qt TABLE "setRowHeight" (I,DEF_HT)) ROWS || *************** *** 1699,1702 **** --- 1785,1789 ---- CELLS := emptyhdict || EVAL := emptyhdict || + XREF := emptyhdict || do (\I.qt TABLE "setRowHeight" (I,DEF_HT)) ROWS || do (\J.qt TABLE "setColumnWidth" (J,DEF_WD)) COLS || *************** *** 1719,1722 **** --- 1806,1810 ---- CELLS := emptyhdict || EVAL := emptyhdict || + XREF := emptyhdict || do (\I.qt TABLE "setRowHeight" (I,DEF_HT)) ROWS || do (\J.qt TABLE "setColumnWidth" (J,DEF_WD)) COLS || *************** *** 3034,3078 **** dfs_list [] = ([],[]); ! dfs_list V = //printf "reverse dfs postorder: %s\n" $ str V || (V,[]) ! where // create the dependencies graph ! (K,U,E) = dfs_graph V, V = map (U!) V, ! // traverse it ! V = dfs E V, V = map (K!) V, ! // determine the list of cells to be evaluated ! V = filter (member (get EVAL)) V; ! dfs E V = Xs where (_,Xs) = foldl (search E) (emptyset,[]) V; ! search E (V,Xs) X ! = (V,Xs) if member V X; = (V,[X|Xs]) ! where (V,Xs) = foldl (search E) (insert V X,Xs) (E!X); ! ! // create the depedencies graph for dfs traversal ! ! dfs_graph V = (KEYS,V,E) ! where // create a node numbering ! CELLS = foldl insert (get CELLS) $ ! map (flip pair true) V, ! KEYS = keys CELLS, N = [0..#KEYS-1], ! V = hdict (zip KEYS N), ! // collect the backward edges ! E = sort edgescmp $ cat $ ! map (make_edges V) $ list $ get EVAL, ! (E,_) = foldl group_edges ([],E) N, ! E = reverse E; ! ! group_edges (A,E) N ! = ([list $ set X|A],E) ! where X = map snd $ takewhile ((=N).fst) E, ! E = dropwhile ((=N).fst) E; ! ! make_edges V (I,J;_,_,K) ! = map (flip pair X) $ filter isint $ map (V!) K ! where X:Int = V!(I,J); ! = [] otherwise; ! ! edgescmp (I1,J1) (I2,J2) ! = (I1<I2) or else (I1=I2) and then (J1<J2); /* Topological order. */ --- 3122,3135 ---- dfs_list [] = ([],[]); ! dfs_list V = //printf "DFS: %s\n" $ str V || (V,[]) ! where V = filter (member (get EVAL)) $ dfs V; ! dfs V = Xs where (_,Xs) = foldl search (emptyhdict,[]) V; ! search (V,Xs) X = (V,Xs) if member V X; = (V,[X|Xs]) ! where W:List = get XREF!X, ! (V,Xs) = foldl search (insert V (X,true),Xs) W; ! = (V,[X|Xs]) otherwise; /* Topological order. */ |
From: Albert G. <ag...@us...> - 2007-11-10 13:42:16
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv10091 Modified Files: calclib.q Log Message: bugfix: missing update of internal data in interpreter, 2nd attempt Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** calclib.q 10 Nov 2007 13:33:09 -0000 1.24 --- calclib.q 10 Nov 2007 13:42:12 -0000 1.25 *************** *** 377,381 **** setval KEY X = printf "\f+++ Update: %s %s\n" (str (I,J),str X) || ! if member (get YYDATA) (I,J) then yyset (I,J) X where (I:Int,J:Int) = indexarg KEY; --- 377,381 ---- setval KEY X = printf "\f+++ Update: %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; |
From: Albert G. <ag...@us...> - 2007-11-10 13:36:01
|
Update of /cvsroot/q-lang/qcalc/examples In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7775/examples Modified Files: guiexamples.qcalc Log Message: bugfixes in formulas of GUI example Index: guiexamples.qcalc =================================================================== RCS file: /cvsroot/q-lang/qcalc/examples/guiexamples.qcalc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** guiexamples.qcalc 10 Nov 2007 12:20:02 -0000 1.3 --- guiexamples.qcalc 10 Nov 2007 13:35:57 -0000 1.4 *************** *** 1,4 **** ! // qcalc 1.0, created Sat Nov 10 13:14:46 2007 -*-Q-*- -*- coding: UTF-8 -*- ! // [((0,1),"GUI element"),((0,2),"Value"),((0,3),"Display"),((2,0),"Checkbox"),((2,1),"= checkbox (\"test\",true)"),((2,2),"= B3"),((2,3),"= checkbox (\"test\",B3)"),((4,0),"Combobox"),((4,1),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((4,2),"= B5"),((4,3),"= combobox ([\"apples\",\"bananas\",\"oranges\"],B5)"),((5,0),"Comboedit"),((5,1),"= comboedit ([\"apples\",\"bananas\",\"oranges\"],\"bananas\")"),((5,2),"= B6"),((5,3),"= comboedit ([\"apples\",\"bananas\",\"oranges\"],B6)"),((6,0),"Int Spinbox"),((6,1),"= spinbox (0,100,5,40)"),((6,2),"= B7"),((6,3),"= spinbox (0,100,5,B7)"),((7,0),"Float Spinbox"),((7,1),"= spinbox (0.0,10.0,0.5,4.0)"),((7,2),"= B8"),((7,3),"= spinbox (0.0,10.0,0.5,B8)"),((9,0),"Spinbox with special value"),((9,1),"= spinbox (-1,10,1,0,\"Any\")"),((9,2),"= B10"),((9,3),"= spinbox (-1,10,1,B10,\"Any\")"),((10,0),"Spinbox with prefix"),((10,1),"= spinbox (-0.1,10,0.1,0,\"Any\",\"$ \")"),((10,2),"= B11"),((10,3),"= spinbox (-0.1,10,0.1,B11,\"Any\",\"$ \")"),((11,0),"Spinbox with suffix"),((11,1),"= spinbox (-1,72,1,10,\"Any\",\"\",\"pt\")"),((11,2),"= B12"),((11,3),"= spinbox (-1,72,1,B12,\"Any\",\"\",\"pt\")"),((13,0),"Horizontal slider"),((13,1),"= hslider (0,100,1,50)"),((13,2),"= B14"),((13,3),"= hslider (0,100,1,B14)"),((14,0),"Vertical slider"),((14,1),"= vslider (0,100,1,50)"),((14,2),"= B15"),((14,3),"= vslider (0,100,1,B15)"),((16,0),"Pushbutton"),((16,1),"= pushbutton \"Push me!\""),((16,2),"= B17"),((16,3),"N/A"),((17,0),"Pushbutton with icon"),((17,1),"= pushbutton (\"Push me!\",which \"pixmaps/1rightarrow.png\")"),((17,2),"= B18"),((17,3),"N/A"),((18,0),"Togglebutton with icon"),((18,1),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((18,2),"= B19"),((18,3),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\",B19)"),((20,0),"\"Buddies\" (linked elements)"),((20,1),"= hslider (0,100,1,D21)"),((20,2),"= B21"),((20,3),"= spinbox (0,100,1,B21)"),((22,0),"Alternative \"remote control\" of GUI elements using setval"),((24,0),"GUI element A (click here)"),((24,1),"Transfer A -> B"),((24,2),"GUI element B (display)"),((24,3),"Value of B"),((26,0),"= checkbox \"A\""),((26,1),"= setval 'C27 A27 || A27"),((26,2),"= checkbox \"B\""),((26,3),"= C27"),((27,0),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((27,1),"= setval 'C28 A28 || A28"),((27,2),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((27,3),"= C28"),((28,0),"= spinbox (-5,100,5,40,\"Any\")"),((28,1),"= setval 'C29 A29 || A29"),((28,2),"= spinbox (-1,100,1,40,\"Any\")"),((28,3),"= C29"),((29,0),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((29,1),"= setval 'C30 A30 || A30"),((29,2),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((29,3),"= C30"),((30,0),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((30,1),"= setval 'C31 A31 || A31"),((30,2),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((30,3),"= C31")] // [(14,55)] // [(0,151),(2,139)] --- 1,4 ---- ! // qcalc 1.0, created Sat Nov 10 14:17:44 2007 -*-Q-*- -*- coding: UTF-8 -*- ! // [((0,1),"GUI element"),((0,2),"Value"),((0,3),"Display"),((2,0),"Checkbox"),((2,1),"= checkbox (\"test\",true)"),((2,2),"= B3"),((2,3),"= checkbox (\"test\",B3)"),((4,0),"Combobox"),((4,1),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((4,2),"= B5"),((4,3),"= combobox ([\"apples\",\"bananas\",\"oranges\"],B5)"),((5,0),"Comboedit"),((5,1),"= comboedit ([\"apples\",\"bananas\",\"oranges\"],\"bananas\")"),((5,2),"= B6"),((5,3),"= comboedit ([\"apples\",\"bananas\",\"oranges\"],B6)"),((6,0),"Int Spinbox"),((6,1),"= spinbox (0,100,5,40)"),((6,2),"= B7"),((6,3),"= spinbox (0,100,5,B7)"),((7,0),"Float Spinbox"),((7,1),"= spinbox (0.0,10.0,0.5,4.0)"),((7,2),"= B8"),((7,3),"= spinbox (0.0,10.0,0.5,B8)"),((9,0),"Spinbox with special value"),((9,1),"= spinbox (-1,10,1,0,\"Any\")"),((9,2),"= B10"),((9,3),"= spinbox (-1,10,1,B10,\"Any\")"),((10,0),"Spinbox with prefix"),((10,1),"= spinbox (-0.1,10,0.1,0,\"Any\",\"$ \")"),((10,2),"= B11"),((10,3),"= spinbox (-0.1,10,0.1,B11,\"Any\",\"$ \")"),((11,0),"Spinbox with suffix"),((11,1),"= spinbox (-1,72,1,10,\"Any\",\"\",\"pt\")"),((11,2),"= B12"),((11,3),"= spinbox (-1,72,1,B12,\"Any\",\"\",\"pt\")"),((13,0),"Horizontal slider"),((13,1),"= hslider (0,100,1,50)"),((13,2),"= B14"),((13,3),"= hslider (0,100,1,B14)"),((14,0),"Vertical slider"),((14,1),"= vslider (0,100,1,50)"),((14,2),"= B15"),((14,3),"= vslider (0,100,1,B15)"),((16,0),"Pushbutton"),((16,1),"= pushbutton \"Push me!\""),((16,2),"= B17"),((16,3),"N/A"),((17,0),"Pushbutton with icon"),((17,1),"= pushbutton (\"Push me!\",which \"pixmaps/1rightarrow.png\")"),((17,2),"= B18"),((17,3),"N/A"),((18,0),"Togglebutton with icon"),((18,1),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((18,2),"= B19"),((18,3),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\",B19)"),((20,0),"\"Buddies\" (linked elements)"),((20,1),"= hslider (0,100,1,D21)"),((20,2),"= B21"),((20,3),"= spinbox (0,100,1,B21)"),((22,0),"Alternative \"remote control\" of GUI elements using setval"),((24,0),"GUI element A (click here)"),((24,1),"Transfer A -> B"),((24,2),"GUI element B (display)"),((24,3),"Value of B"),((26,0),"= checkbox \"A\""),((26,1),"= setval 'C27 A27"),((26,2),"= checkbox \"B\""),((26,3),"= C27"),((27,0),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((27,1),"= setval 'C28 A28"),((27,2),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((27,3),"= C28"),((28,0),"= spinbox (-5,100,5,40,\"Any\")"),((28,1),"= setval 'C29 A29"),((28,2),"= spinbox (-1,100,1,40,\"Any\")"),((28,3),"= C29"),((29,0),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((29,1),"= setval 'C30 A30"),((29,2),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((29,3),"= C30"),((30,0),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((30,1),"= setval 'C31 A31"),((30,2),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((30,3),"= C31")] // [(14,55)] // [(0,151),(2,139)] |
From: Albert G. <ag...@us...> - 2007-11-10 13:33:12
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7091 Modified Files: calclib.q Log Message: bugfix: missing update of internal data in interpreter Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** calclib.q 10 Nov 2007 13:00:28 -0000 1.23 --- calclib.q 10 Nov 2007 13:33:09 -0000 1.24 *************** *** 376,380 **** indexarg 'X = (I,J) where (I,J) = cellindex 'X; ! setval KEY X = printf "\f+++ Update: %s %s\n" (str (I,J),str X) || X where (I:Int,J:Int) = indexarg KEY; --- 376,381 ---- indexarg 'X = (I,J) where (I,J) = cellindex 'X; ! setval KEY X = printf "\f+++ Update: %s %s\n" (str (I,J),str X) || ! if member (get YYDATA) (I,J) then yyset (I,J) X where (I:Int,J:Int) = indexarg KEY; |
From: Albert G. <ag...@us...> - 2007-11-10 13:17:34
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6105 Modified Files: qcalc.q Log Message: remove unneeded import of the reftypes module, which breaks the fill operation Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** qcalc.q 10 Nov 2007 13:00:28 -0000 1.122 --- qcalc.q 10 Nov 2007 13:17:30 -0000 1.123 *************** *** 39,43 **** COPYRIGHT = "Copyright \169 2007 by Albert Gr\228f"; ! import smokeqt, dict, hdict, set, reftypes, system; /* The GUI. ****************************************************************/ --- 39,43 ---- COPYRIGHT = "Copyright \169 2007 by Albert Gr\228f"; ! import smokeqt, dict, hdict, set, system; /* The GUI. ****************************************************************/ |
From: Albert G. <ag...@us...> - 2007-11-10 13:00:32
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5128 Modified Files: calclib.q qcalc.q Log Message: minor bugfixes and optimizations Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** qcalc.q 10 Nov 2007 12:18:25 -0000 1.121 --- qcalc.q 10 Nov 2007 13:00:28 -0000 1.122 *************** *** 3033,3036 **** --- 3033,3037 ---- /* Depth-first postorder. */ + dfs_list [] = ([],[]); dfs_list V = //printf "reverse dfs postorder: %s\n" $ str V || (V,[]) *************** *** 3063,3067 **** group_edges (A,E) N ! = ([X|A],E) where X = map snd $ takewhile ((=N).fst) E, E = dropwhile ((=N).fst) E; --- 3064,3068 ---- group_edges (A,E) N ! = ([list $ set X|A],E) where X = map snd $ takewhile ((=N).fst) E, E = dropwhile ((=N).fst) E; Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** calclib.q 10 Nov 2007 08:04:55 -0000 1.22 --- calclib.q 10 Nov 2007 13:00:28 -0000 1.23 *************** *** 257,261 **** togglebutton (S:String,ICON:String,INIT:Bool) = printf "\f+++ Togglebutton: %s %s\n" ! (str (I,J),str (S,ICON,INIT)) || false where (I,J) = get YYKEY; --- 257,261 ---- togglebutton (S:String,ICON:String,INIT:Bool) = printf "\f+++ Togglebutton: %s %s\n" ! (str (I,J),str (S,ICON,INIT)) || INIT where (I,J) = get YYKEY; *************** *** 410,416 **** = 0 otherwise; yyeval KEY VAL ! = //printf "INTERP: EVAL %s := %s\n" (cellstr KEY,str VAL) || flush || ! YYDATA := insert (get YYDATA) (KEY,VAL) || YYKEY := () || ! yyout VAL where VAL = YYKEY := KEY || VAL; yyset KEY VAL = //printf "INTERP: SET %s := %s\n" (cellstr KEY,str VAL) || flush || --- 410,416 ---- = 0 otherwise; yyeval KEY VAL ! = //printf "INTERP: EVAL %s := %s ==> %s\n" (cellstr KEY,strq 'VAL,str RES) || flush || ! YYDATA := insert (get YYDATA) (KEY,RES) || YYKEY := () || ! yyout RES where RES = YYKEY := KEY || VAL; yyset KEY VAL = //printf "INTERP: SET %s := %s\n" (cellstr KEY,str VAL) || flush || |
From: Albert G. <ag...@us...> - 2007-11-10 12:20:09
|
Update of /cvsroot/q-lang/qcalc/examples In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1461/examples Modified Files: guiexamples.qcalc Log Message: update GUI examples Index: guiexamples.qcalc =================================================================== RCS file: /cvsroot/q-lang/qcalc/examples/guiexamples.qcalc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** guiexamples.qcalc 7 Nov 2007 22:17:29 -0000 1.2 --- guiexamples.qcalc 10 Nov 2007 12:20:02 -0000 1.3 *************** *** 1,4 **** ! // qcalc 1.0, created Wed Nov 7 23:18:25 2007 -*-Q-*- -*- coding: UTF-8 -*- ! // [((0,1),"GUI element"),((0,2),"Value"),((2,0),"Checkbox"),((2,1),"= checkbox (\"test\",true)"),((2,2),"= B3"),((4,0),"Combobox"),((4,1),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((4,2),"= B5"),((5,0),"Comboedit"),((5,1),"= comboedit ([\"apples\",\"bananas\",\"oranges\"],\"bananas\")"),((5,2),"= B6"),((6,0),"Int Spinbox"),((6,1),"= spinbox (0,100,5,40)"),((6,2),"= B7"),((7,0),"Float Spinbox"),((7,1),"= spinbox (0.0,10.0,0.5,4.0)"),((7,2),"= B8"),((9,0),"Spinbox with special value"),((9,1),"= spinbox (-1,10,1,0,\"Any\")"),((9,2),"= B10"),((10,0),"Spinbox with prefix"),((10,1),"= spinbox (-0.1,10,0.1,0,\"Any\",\"$ \")"),((10,2),"= B11"),((11,0),"Spinbox with suffix"),((11,1),"= spinbox (-1,72,1,10,\"Any\",\"\",\"pt\")"),((11,2),"= B12"),((13,0),"Horizontal slider"),((13,1),"= hslider (0,100,1,50)"),((13,2),"= B14"),((14,0),"Vertical slider"),((14,1),"= vslider (0,100,1,50)"),((14,2),"= B15"),((16,0),"Pushbutton"),((16,1),"= pushbutton \"Push me!\""),((16,2),"= B17"),((17,0),"Pushbutton with icon"),((17,1),"= pushbutton (\"Push me!\",which \"pixmaps/1rightarrow.png\")"),((17,2),"= B18"),((18,0),"Togglebutton with icon"),((18,1),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((18,2),"= B19"),((20,0),"Remote control of GUI elements"),((22,0),"GUI element A (click here)"),((22,1),"Transfer A -> B"),((22,2),"GUI element B (display)"),((22,3),"Value of B"),((24,0),"= checkbox \"A\""),((24,1),"= setval 'C25 A25 || A25"),((24,2),"= checkbox \"B\""),((24,3),"= C25"),((25,0),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((25,1),"= setval 'C26 A26 || A26"),((25,2),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((25,3),"= C26"),((26,0),"= spinbox (-5,100,5,40,\"Any\")"),((26,1),"= setval 'C27 A27 || A27"),((26,2),"= spinbox (-1,100,1,40,\"Any\")"),((26,3),"= C27"),((27,0),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((27,1),"= setval 'C28 A28 || A28"),((27,2),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((27,3),"= C28"),((28,0),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((28,1),"= setval 'C29 A29 || A29"),((28,2),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((28,3),"= C29")] // [(14,55)] // [(0,151),(2,139)] --- 1,4 ---- ! // qcalc 1.0, created Sat Nov 10 13:14:46 2007 -*-Q-*- -*- coding: UTF-8 -*- ! // [((0,1),"GUI element"),((0,2),"Value"),((0,3),"Display"),((2,0),"Checkbox"),((2,1),"= checkbox (\"test\",true)"),((2,2),"= B3"),((2,3),"= checkbox (\"test\",B3)"),((4,0),"Combobox"),((4,1),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((4,2),"= B5"),((4,3),"= combobox ([\"apples\",\"bananas\",\"oranges\"],B5)"),((5,0),"Comboedit"),((5,1),"= comboedit ([\"apples\",\"bananas\",\"oranges\"],\"bananas\")"),((5,2),"= B6"),((5,3),"= comboedit ([\"apples\",\"bananas\",\"oranges\"],B6)"),((6,0),"Int Spinbox"),((6,1),"= spinbox (0,100,5,40)"),((6,2),"= B7"),((6,3),"= spinbox (0,100,5,B7)"),((7,0),"Float Spinbox"),((7,1),"= spinbox (0.0,10.0,0.5,4.0)"),((7,2),"= B8"),((7,3),"= spinbox (0.0,10.0,0.5,B8)"),((9,0),"Spinbox with special value"),((9,1),"= spinbox (-1,10,1,0,\"Any\")"),((9,2),"= B10"),((9,3),"= spinbox (-1,10,1,B10,\"Any\")"),((10,0),"Spinbox with prefix"),((10,1),"= spinbox (-0.1,10,0.1,0,\"Any\",\"$ \")"),((10,2),"= B11"),((10,3),"= spinbox (-0.1,10,0.1,B11,\"Any\",\"$ \")"),((11,0),"Spinbox with suffix"),((11,1),"= spinbox (-1,72,1,10,\"Any\",\"\",\"pt\")"),((11,2),"= B12"),((11,3),"= spinbox (-1,72,1,B12,\"Any\",\"\",\"pt\")"),((13,0),"Horizontal slider"),((13,1),"= hslider (0,100,1,50)"),((13,2),"= B14"),((13,3),"= hslider (0,100,1,B14)"),((14,0),"Vertical slider"),((14,1),"= vslider (0,100,1,50)"),((14,2),"= B15"),((14,3),"= vslider (0,100,1,B15)"),((16,0),"Pushbutton"),((16,1),"= pushbutton \"Push me!\""),((16,2),"= B17"),((16,3),"N/A"),((17,0),"Pushbutton with icon"),((17,1),"= pushbutton (\"Push me!\",which \"pixmaps/1rightarrow.png\")"),((17,2),"= B18"),((17,3),"N/A"),((18,0),"Togglebutton with icon"),((18,1),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((18,2),"= B19"),((18,3),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\",B19)"),((20,0),"\"Buddies\" (linked elements)"),((20,1),"= hslider (0,100,1,D21)"),((20,2),"= B21"),((20,3),"= spinbox (0,100,1,B21)"),((22,0),"Alternative \"remote control\" of GUI elements using setval"),((24,0),"GUI element A (click here)"),((24,1),"Transfer A -> B"),((24,2),"GUI element B (display)"),((24,3),"Value of B"),((26,0),"= checkbox \"A\""),((26,1),"= setval 'C27 A27 || A27"),((26,2),"= checkbox \"B\""),((26,3),"= C27"),((27,0),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((27,1),"= setval 'C28 A28 || A28"),((27,2),"= spinbox (-0.1,10,0.1,0,\"Any\")"),((27,3),"= C28"),((28,0),"= spinbox (-5,100,5,40,\"Any\")"),((28,1),"= setval 'C29 A29 || A29"),((28,2),"= spinbox (-1,100,1,40,\"Any\")"),((28,3),"= C29"),((29,0),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((29,1),"= setval 'C30 A30 || A30"),((29,2),"= combobox ([\"apples\",\"bananas\",\"oranges\"],\"oranges\")"),((29,3),"= C30"),((30,0),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((30,1),"= setval 'C31 A31 || A31"),((30,2),"= togglebutton (\"Toggle me!\",which \"pixmaps/flag.png\")"),((30,3),"= C31")] // [(14,55)] // [(0,151),(2,139)] |
From: Albert G. <ag...@us...> - 2007-11-10 12:18:28
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv1383 Modified Files: qcalc.q Log Message: bugfix Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.120 retrieving revision 1.121 diff -C2 -d -r1.120 -r1.121 *** qcalc.q 10 Nov 2007 08:06:14 -0000 1.120 --- qcalc.q 10 Nov 2007 12:18:25 -0000 1.121 *************** *** 337,340 **** --- 337,343 ---- checkstr _ = false otherwise; + checkval X = true where '_ = valq $ str X; + = false otherwise; + unquote S = (X,X) if checkstr 'X where 'X = valq S; = (S,fformat S) otherwise; *************** *** 2948,2956 **** do flag U || // set the new value in the inferior process ! submit_val (I,J) (gui_getval X) || // do the necessary reevaluations if check_interp then compute (I,J) V where (V,U) = eval_list (I,J), ! V = dropwhile (=(I,J)) $ dropwhile (<>(I,J)) V; process1 (CELLS,EVAL) (I,J,S) --- 2951,2961 ---- do flag U || // set the new value in the inferior process ! // (check whether the value is actually transferable) ! if checkval X then submit_val (I,J) X || // do the necessary reevaluations if check_interp then compute (I,J) V where (V,U) = eval_list (I,J), ! V = dropwhile (=(I,J)) $ dropwhile (<>(I,J)) V, ! X = gui_getval X; process1 (CELLS,EVAL) (I,J,S) |
From: Albert G. <ag...@us...> - 2007-11-10 11:27:52
|
Update of /cvsroot/q-lang/qcalc/doc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv19646/doc Modified Files: qcalc.xml Log Message: fix up qdoc.html link in the online documentation Index: qcalc.xml =================================================================== RCS file: /cvsroot/q-lang/qcalc/doc/qcalc.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** qcalc.xml 9 Nov 2007 22:56:48 -0000 1.11 --- qcalc.xml 10 Nov 2007 11:27:47 -0000 1.12 *************** *** 58,62 **** </para> <para> ! Online help is available with the <keycap>F1</keycap> key or any of the options in the <guimenu>Help</guimenu> menu. These options invoke the Qt "assistant" program, which is Qt's HTML help browser. (As you're reading the online manual right now, you probably discovered this already.) The full <ulink url="file:qdoc.html">Q language manual</ulink> is included, too, to assist you on your journey into the "land of Q". Just press <keycap>Shift-F1</keycap> to show the manual in the help browser. </para> --- 58,62 ---- </para> <para> ! Online help is available with the <keycap>F1</keycap> key or any of the options in the <guimenu>Help</guimenu> menu. These options invoke the Qt "assistant" program, which is Qt's HTML help browser. (As you're reading the online manual right now, you probably discovered this already.) The full <ulink url="qdoc.html">Q language manual</ulink> is included, too, to assist you on your journey into the "land of Q". Just press <keycap>Shift-F1</keycap> to show the manual in the help browser. </para> |
From: Albert G. <ag...@us...> - 2007-11-10 08:06:20
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7777 Modified Files: qcalc.q Log Message: bugfix: proper update of GUI values in the inferior process, makes cyclic GUI definitions work properly Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** qcalc.q 10 Nov 2007 07:19:24 -0000 1.119 --- qcalc.q 10 Nov 2007 08:06:14 -0000 1.120 *************** *** 2619,2623 **** and the executing script). */ ! private yyeval KEY X, yyclear X, yyval KEY; parse S = 'X --- 2619,2623 ---- and the executing script). */ ! private yyeval KEY X, yyset KEY X, yyclear X, yyval KEY; parse S = 'X *************** *** 2719,2725 **** cellval (I,J) - where X:QtObject = gui_elem (I,J): - // these values come from the GUI elements in the table - = 'Y where Y = gui_getval X; if member (get EVAL) (I,J): // these are kept in the inferior process --- 2719,2722 ---- *************** *** 2752,2763 **** end_compute_test; - submit (I,J) = send_expr '(yyeval (I,J) X) - where (S,X,DEPS) = get EVAL!(I,J), - 'X = subst X; - - send_expr X = bwrite MASTER (bytestr (unmunge_quals (strq X)++"\n")) - where (_,_,_,MASTER) = get TASK - if get STATE=4; - collect_results U V = begin_recursive || results_loop U V || end_recursive; --- 2749,2752 ---- *************** *** 2893,2902 **** U = all_deps2 U V, U = filter (member (get EVAL)) U; - submit_clear (I,J) - = send_expr '(yyeval (I,J) X) - where (S,X,DEPS) = get EVAL!(I,J), - 'X = subst X; - = send_expr '(yyclear (I,J)) otherwise; - all_deps (I,J) V = all_deps [(I,J)] V; --- 2882,2885 ---- *************** *** 2964,2967 **** --- 2947,2952 ---- = // flag "bad" cells (cyclic computations) do flag U || + // set the new value in the inferior process + submit_val (I,J) (gui_getval X) || // do the necessary reevaluations if check_interp then compute (I,J) V *************** *** 3223,3224 **** --- 3208,3228 ---- = close MASTER || kill SIGTERM PID || waitpid PID 0 || cancel H; + + /* Convenience functions to send expressions to the interpreter. */ + + submit (I,J) = send_expr '(yyeval (I,J) X) + where (S,X,DEPS) = get EVAL!(I,J), + 'X = subst X; + + submit_clear (I,J) + = send_expr '(yyeval (I,J) X) + where (S,X,DEPS) = get EVAL!(I,J), + 'X = subst X; + = send_expr '(yyclear (I,J)) otherwise; + + submit_val (I,J) X + = send_expr '(yyset (I,J) X); + + send_expr X = bwrite MASTER (bytestr (unmunge_quals (strq X)++"\n")) + where (_,_,_,MASTER) = get TASK + if get STATE=4; |
From: Albert G. <ag...@us...> - 2007-11-10 08:05:01
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv7322 Modified Files: calclib.q Log Message: code cleanup, added yyset operation and some (commented out) debugging code Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** calclib.q 10 Nov 2007 07:19:24 -0000 1.21 --- calclib.q 10 Nov 2007 08:04:55 -0000 1.22 *************** *** 168,172 **** /* Implementation. *********************************************************/ ! var YYDATA, YYKEY; index = (I,J) where (I,J) = get YYKEY; --- 168,181 ---- /* Implementation. *********************************************************/ ! /* Internals for use by the inferior Q process. DON'T MESS WITH THESE unless ! you *really* know what you're doing! */ ! ! from hdict import emptyhdict, member, insert, delete; ! ! var YYDATA = ref emptyhdict, YYKEY = ref (); ! ! public yymain, yyval KEY, yyset KEY VAL, yyclear KEY; ! public special yyeval ~KEY VAL; ! private yyloop, yyout X, yyerror X; index = (I,J) where (I,J) = get YYKEY; *************** *** 385,398 **** where (I0:Int,J0:Int) = indexarg KEY; ! /* Internals for use by the inferior Q process. DON'T MESS WITH THESE unless ! you *really* know what you're doing! */ ! ! from hdict import emptyhdict, member, insert, delete; ! ! def YYDATA = ref emptyhdict, YYKEY = ref (); ! ! public yymain, yyval KEY, yyclear KEY; ! public special yyeval ~KEY VAL; ! private yyloop, yyout X, yyerror X; yymain = writes "\f+++ Ready.\n" || flush || yyloop; --- 394,398 ---- where (I0:Int,J0:Int) = indexarg KEY; ! /* Internals. */ yymain = writes "\f+++ Ready.\n" || flush || yyloop; *************** *** 410,415 **** = 0 otherwise; yyeval KEY VAL ! = YYDATA := insert (get YYDATA) (KEY,VAL) || YYKEY := () || yyout VAL where VAL = YYKEY := KEY || VAL; yyclear KEY ! = YYDATA := delete (get YYDATA) KEY; --- 410,421 ---- = 0 otherwise; yyeval KEY VAL ! = //printf "INTERP: EVAL %s := %s\n" (cellstr KEY,str VAL) || flush || ! YYDATA := insert (get YYDATA) (KEY,VAL) || YYKEY := () || yyout VAL where VAL = YYKEY := KEY || VAL; + yyset KEY VAL + = //printf "INTERP: SET %s := %s\n" (cellstr KEY,str VAL) || flush || + YYDATA := insert (get YYDATA) (KEY,VAL) || VAL + where VAL = YYKEY := KEY || VAL; yyclear KEY ! = //printf "INTERP: CLEAR %s\n" (cellstr KEY) || flush || ! YYDATA := delete (get YYDATA) KEY; |
From: Albert G. <ag...@us...> - 2007-11-10 07:19:29
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv30774 Modified Files: calclib.q qcalc.q Log Message: moved main program of the inferior Q process and all support operations to calclib.q Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** qcalc.q 10 Nov 2007 01:12:14 -0000 1.118 --- qcalc.q 10 Nov 2007 07:19:24 -0000 1.119 *************** *** 723,748 **** where (S0,S1) = unquote S; ! def TEMPL = "\ ! %s\nimport hdict, calclib;\n\ ! /* Main program generated by QCalc. */\n\ ! special yyeval ~KEY VAL;\n\ ! yymain = writes \"\\f+++ Ready.\\n\" || flush || yyloop;\n\ ! yyloop where S:String = reads:\n\ ! = yyloop where 'X = valq S, Y = catch yyerror X;\n\ ! = writes \"\\f+++ Syntax error.\\n\" || flush || yyloop otherwise;\n\ ! otherwise:\n\ ! = writes \"\\f+++ Exiting.\\n\" || flush || exit 0;\n\ ! yyout X\n\ ! = writes \"\\f+++ Result: \" || write X || writes \"\\n\" || flush;\n\ ! yyerror X\n\ ! = writes \"\\f+++ Exception: \" || write X || writes \"\\n\" || flush;\n\ ! yyval KEY\n\ ! = get YYDATA!KEY if member (get YYDATA) KEY;\n\ ! = 0 otherwise;\n\ ! yyeval KEY VAL\n\ ! = YYDATA := insert (get YYDATA) (KEY,VAL) || YYKEY := () ||\n\ ! yyout VAL where VAL = YYKEY := KEY || VAL;\n\ ! yyclear KEY\n\ ! = YYDATA := delete (get YYDATA) KEY;\n", CMD = "pwd='%s'; filename='%s'; cd \"$pwd\"; echo '+++ Compile:'; \ if qc -n $filename; then echo '+++ Done.'; q -c yymain -w0 \"$filename\"; \ --- 723,727 ---- where (S0,S1) = unquote S; ! def TEMPL = "%s\nimport calclib;\n/* Main program generated by QCalc. */\n", CMD = "pwd='%s'; filename='%s'; cd \"$pwd\"; echo '+++ Compile:'; \ if qc -n $filename; then echo '+++ Done.'; q -c yymain -w0 \"$filename\"; \ Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** calclib.q 9 Nov 2007 22:14:22 -0000 1.20 --- calclib.q 10 Nov 2007 07:19:24 -0000 1.21 *************** *** 11,21 **** accordingly. */ - from hdict import emptyhdict; - - /* The following should be considered private; this data is for use by the - QCalc-generated main program only. */ - - public var YYDATA = ref emptyhdict, YYKEY = ref (); - /* Public access operations for use in spreadsheets. */ --- 11,14 ---- *************** *** 175,178 **** --- 168,173 ---- /* Implementation. *********************************************************/ + var YYDATA, YYKEY; + index = (I,J) where (I,J) = get YYKEY; row = I where (I,J) = get YYKEY; *************** *** 389,390 **** --- 384,415 ---- = matrix (I0,J0) $ map (push []) Xs || Xs where (I0:Int,J0:Int) = indexarg KEY; + + /* Internals for use by the inferior Q process. DON'T MESS WITH THESE unless + you *really* know what you're doing! */ + + from hdict import emptyhdict, member, insert, delete; + + def YYDATA = ref emptyhdict, YYKEY = ref (); + + public yymain, yyval KEY, yyclear KEY; + public special yyeval ~KEY VAL; + private yyloop, yyout X, yyerror X; + + yymain = writes "\f+++ Ready.\n" || flush || yyloop; + yyloop where S:String = reads: + = yyloop where 'X = valq S, Y = catch yyerror X; + = writes "\f+++ Syntax error.\n" || flush || yyloop otherwise; + otherwise: + = writes "\f+++ Exiting.\n" || flush || exit 0; + yyout X + = writes "\f+++ Result: " || write X || writes "\n" || flush; + yyerror X + = writes "\f+++ Exception: " || write X || writes "\n" || flush; + yyval KEY + = get YYDATA!KEY if member (get YYDATA) KEY; + = 0 otherwise; + yyeval KEY VAL + = YYDATA := insert (get YYDATA) (KEY,VAL) || YYKEY := () || + yyout VAL where VAL = YYKEY := KEY || VAL; + yyclear KEY + = YYDATA := delete (get YYDATA) KEY; |
From: Albert G. <ag...@us...> - 2007-11-10 01:12:18
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5226 Modified Files: qcalc.q Log Message: optimization of dfs routine Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -d -r1.117 -r1.118 *** qcalc.q 9 Nov 2007 23:11:40 -0000 1.117 --- qcalc.q 10 Nov 2007 01:12:14 -0000 1.118 *************** *** 3066,3104 **** dfs_list V = //printf "reverse dfs postorder: %s\n" $ str V || (V,[]) ! where // build a dict mapping cell indices to node numbers ! ALL_CELLS = foldl insert (get CELLS) $ ! map (flip pair true) V, ! ALL_KEYS = keys ALL_CELLS, ! N = #ALL_KEYS, NODES = [0..N-1], ! NODE_NUM = hdict (zip ALL_KEYS NODES), ! // build a dictionary of dependencies ! (KEYS,VALS) = unzip (list (get EVAL)), ! KEYS = map (NODE_NUM!) KEYS, ! VALS = map (map (NODE_NUM!). ! filter (member NODE_NUM).trd) VALS, ! D = mkdict [] NODES, ! D = foldl insert D $ zip KEYS VALS, ! // compute the reversal of the dependencies graph ! ADJ = cat $ zipwith rev_edges NODES $ vals D, ! D = dict $ zip NODES $ reflist $ mklist emptyset N, ! _ = do (add_edge D) ADJ, ! ADJ = map (list.get) (vals D), ! // perform the depth-first traversal ! V = map (NODE_NUM!) V, ! V = dfs ADJ V, ! V = map (ALL_KEYS!) V, // determine the list of cells to be evaluated V = filter (member (get EVAL)) V; ! rev_edges X Ys = map (flip pair X) Ys; ! ! add_edge D (X,Y) ! = D!X := insert (D!!X) Y; ! ! dfs ADJ V = Xs where (_,Xs) = foldl (search ADJ) (emptyset,[]) V; ! search ADJ (V,Xs) X = (V,Xs) if member V X; = (V,[X|Xs]) ! where (V,Xs) = foldl (search ADJ) (insert V X,Xs) (ADJ!X); /* Topological order. */ --- 3066,3108 ---- dfs_list V = //printf "reverse dfs postorder: %s\n" $ str V || (V,[]) ! where // create the dependencies graph ! (K,U,E) = dfs_graph V, V = map (U!) V, ! // traverse it ! V = dfs E V, V = map (K!) V, // determine the list of cells to be evaluated V = filter (member (get EVAL)) V; ! dfs E V = Xs where (_,Xs) = foldl (search E) (emptyset,[]) V; ! search E (V,Xs) X = (V,Xs) if member V X; = (V,[X|Xs]) ! where (V,Xs) = foldl (search E) (insert V X,Xs) (E!X); ! ! // create the depedencies graph for dfs traversal ! ! dfs_graph V = (KEYS,V,E) ! where // create a node numbering ! CELLS = foldl insert (get CELLS) $ ! map (flip pair true) V, ! KEYS = keys CELLS, N = [0..#KEYS-1], ! V = hdict (zip KEYS N), ! // collect the backward edges ! E = sort edgescmp $ cat $ ! map (make_edges V) $ list $ get EVAL, ! (E,_) = foldl group_edges ([],E) N, ! E = reverse E; ! ! group_edges (A,E) N ! = ([X|A],E) ! where X = map snd $ takewhile ((=N).fst) E, ! E = dropwhile ((=N).fst) E; ! ! make_edges V (I,J;_,_,K) ! = map (flip pair X) $ filter isint $ map (V!) K ! where X:Int = V!(I,J); ! = [] otherwise; ! ! edgescmp (I1,J1) (I2,J2) ! = (I1<I2) or else (I1=I2) and then (J1<J2); /* Topological order. */ |
From: Albert G. <ag...@us...> - 2007-11-09 23:11:44
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13657 Modified Files: qcalc.q Log Message: bugfix: prevent double restoration of overridden cursor which causes the wait cursor to stick Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.116 retrieving revision 1.117 diff -C2 -d -r1.116 -r1.117 *** qcalc.q 9 Nov 2007 22:44:01 -0000 1.116 --- qcalc.q 9 Nov 2007 23:11:40 -0000 1.117 *************** *** 492,499 **** /* Application cursor. */ ! def WAIT_CURSOR = qt_new "QCursor" (qt_val "Qt" "WaitCursor"); ! wait_cursor = qt "QApplication" "setOverrideCursor" WAIT_CURSOR; ! normal_cursor = qt "QApplication" "restoreOverrideCursor" (); /* Switch views. */ --- 492,503 ---- /* Application cursor. */ ! def WC = ref false, WAIT_CURSOR = qt_new "QCursor" (qt_val "Qt" "WaitCursor"); ! wait_cursor = WC := true || ! qt "QApplication" "setOverrideCursor" WAIT_CURSOR ! if not get WC; ! normal_cursor = WC := false || ! qt "QApplication" "restoreOverrideCursor" () ! if get WC; /* Switch views. */ |
From: Albert G. <ag...@us...> - 2007-11-09 22:56:52
|
Update of /cvsroot/q-lang/qcalc/doc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv5248/doc Modified Files: qcalc.xml Log Message: update documentation Index: qcalc.xml =================================================================== RCS file: /cvsroot/q-lang/qcalc/doc/qcalc.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** qcalc.xml 8 Nov 2007 22:47:19 -0000 1.10 --- qcalc.xml 9 Nov 2007 22:56:48 -0000 1.11 *************** *** 103,107 **** <para> When you enter a new or edit an existing cell value, the evaluation algorithm used by QCalc will only reevaluate the cells affected by this change. Cyclic computations (e.g., if cell A1 is computed using A1 itself, or if there is a ! cyclic chain of cell dependencies, such as A1=A2+1 and A2=A1-1) are not permitted; the red flag will appear on all affected cells in such cases, and you will have to edit (at least) one of the cells to break the cycle. </para> <para> --- 103,107 ---- <para> When you enter a new or edit an existing cell value, the evaluation algorithm used by QCalc will only reevaluate the cells affected by this change. Cyclic computations (e.g., if cell A1 is computed using A1 itself, or if there is a ! cyclic chain of cell dependencies, such as A1=A2+1 and A2=2*A1) are permitted, but are executed in a "depth-first" order which breaks cycles in an apparently random way. The only thing that you can count on in such cases is that if you edit a given cell, then the change will propagate to other cells from there and each dependent cell will be recomputed at most once using the most recent values of all its requisite cells. </para> <para> |
From: Albert G. <ag...@us...> - 2007-11-09 22:44:05
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv32163 Modified Files: qcalc.q Log Message: eliminate cell clearing in advance to computation, so that each requisite cell keeps its most recent value in cyclic computations Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** qcalc.q 9 Nov 2007 22:14:22 -0000 1.115 --- qcalc.q 9 Nov 2007 22:44:01 -0000 1.116 *************** *** 2911,2915 **** submit_clear (I,J) ! = send_expr '(yyclear (I,J) || yyeval (I,J) X) where (S,X,DEPS) = get EVAL!(I,J), 'X = subst X; --- 2911,2915 ---- submit_clear (I,J) ! = send_expr '(yyeval (I,J) X) where (S,X,DEPS) = get EVAL!(I,J), 'X = subst X; |
From: Albert G. <ag...@us...> - 2007-11-09 22:14:28
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18901 Modified Files: calclib.q qcalc.q Log Message: switch to new depth-first computation order which can also handle cyclic dependencies Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** qcalc.q 9 Nov 2007 10:41:22 -0000 1.114 --- qcalc.q 9 Nov 2007 22:14:22 -0000 1.115 *************** *** 39,43 **** COPYRIGHT = "Copyright \169 2007 by Albert Gr\228f"; ! import smokeqt, hdict, set, system; /* The GUI. ****************************************************************/ --- 39,43 ---- COPYRIGHT = "Copyright \169 2007 by Albert Gr\228f"; ! import smokeqt, dict, hdict, set, reftypes, system; /* The GUI. ****************************************************************/ *************** *** 735,739 **** yyval KEY\n\ = get YYDATA!KEY if member (get YYDATA) KEY;\n\ ! = throw \"NOVAL\" otherwise;\n\ yyeval KEY VAL\n\ = YYDATA := insert (get YYDATA) (KEY,VAL) || YYKEY := () ||\n\ --- 735,739 ---- yyval KEY\n\ = get YYDATA!KEY if member (get YYDATA) KEY;\n\ ! = 0 otherwise;\n\ yyeval KEY VAL\n\ = YYDATA := insert (get YYDATA) (KEY,VAL) || YYKEY := () ||\n\ *************** *** 1610,1616 **** htmlquote $ get FILENAME; ! cellcmp ((I1,J1),_) ((I2,J2),_) = (I1<I2) or else (I1=I2) and then (J1<J2); save_as X D A if is_global: = FILENAME := S || save X D A --- 1610,1619 ---- htmlquote $ get FILENAME; ! indexcmp (I1,J1) (I2,J2) = (I1<I2) or else (I1=I2) and then (J1<J2); + cellcmp ((I1,J1),_) ((I2,J2),_) + = indexcmp (I1,J1) (I2,J2); + save_as X D A if is_global: = FILENAME := S || save X D A *************** *** 2791,2795 **** where S:String = try2 MSGS: // evaluation succeeded, we're good ! = update_cell (I,J) S || results_loop U V where [S] = regex "" "^\\+\\+\\+ Result: (.*)$" S (reg 1); // errors during evaluation (these get the red flag) --- 2794,2798 ---- where S:String = try2 MSGS: // evaluation succeeded, we're good ! = update_cell (I,J) S || results_loop (delete U (I,J)) V where [S] = regex "" "^\\+\\+\\+ Result: (.*)$" S (reg 1); // errors during evaluation (these get the red flag) *************** *** 2948,2952 **** process_all = do flag U || compute_all V ! where (V,U) = eval_list if check_interp; --- 2951,2955 ---- process_all = do flag U || compute_all V ! where (V,U) = eval_list $ sort indexcmp $ keys $ get CELLS if check_interp; *************** *** 2957,2961 **** // do the necessary reevaluations if check_interp then compute (I,J) V ! where (V,U) = eval_list, V = dropwhile (<>(I,J)) V; --- 2960,2964 ---- // do the necessary reevaluations if check_interp then compute (I,J) V ! where (V,U) = eval_list (I,J), V = dropwhile (<>(I,J)) V; *************** *** 2973,2977 **** where S = qt TABLE "text" (I,J), _ = delete_eval (I,J), ! (V,U) = eval_list; process_gui (I,J) X --- 2976,2980 ---- where S = qt TABLE "text" (I,J), _ = delete_eval (I,J), ! (V,U) = eval_list (I,J); process_gui (I,J) X *************** *** 2980,2984 **** // do the necessary reevaluations if check_interp then compute (I,J) V ! where (V,U) = eval_list, V = dropwhile (=(I,J)) $ dropwhile (<>(I,J)) V; --- 2983,2987 ---- // do the necessary reevaluations if check_interp then compute (I,J) V ! where (V,U) = eval_list (I,J), V = dropwhile (=(I,J)) $ dropwhile (<>(I,J)) V; *************** *** 3002,3006 **** _ = set_cells C || set_eval E, W = map (flip (flip sub 0) 1) W, ! (V,U) = eval_list if not null W and then check_interp; --- 3005,3009 ---- _ = set_cells C || set_eval E, W = map (flip (flip sub 0) 1) W, ! (V,U) = eval_list W if not null W and then check_interp; *************** *** 3028,3046 **** _ = set_cells C || set_eval E, W = map (flip (flip sub 0) 1) W, ! (V,U) = eval_list if not null W and then check_interp; clear_sel W = do clear_cell W || compute W V where _ = delete_cells W || delete_eval W, ! (V,U) = eval_list if not null W and then check_interp; ! /* Compute the evaluation order (topological sort of the evaluation graph in ! adjacency list form). This returns a pair of two lists V and U. V contains ! the indices of cells in the order in which they should be evaluated. U ! contains the indices of "bad" cells which couldn't be ordered because they ! are connected to some cyclic computation. */ ! eval_list = (V,U) where (KEYS,VALS) = unzip (list (get EVAL)), NODE_NUM = hdict (zip KEYS [0..#KEYS-1]), --- 3031,3104 ---- _ = set_cells C || set_eval E, W = map (flip (flip sub 0) 1) W, ! (V,U) = eval_list W if not null W and then check_interp; clear_sel W = do clear_cell W || compute W V where _ = delete_cells W || delete_eval W, ! (V,U) = eval_list W if not null W and then check_interp; ! /* Compute the evaluation order. We now provide two alternative routines, ! depth-first search (more precisely, the reversal of a depth-first ! postorder) starting from a given node or list of nodes (which works ok with ! cyclic dependencies, but may consider them in an apparently random order), ! and global topological sort (which refuses to order cyclic computations). ! In any case, the result is a pair of two lists V and U. V contains the ! indices of cells in the order in which they should be evaluated. U contains ! the indices of "bad" cells which is always empty for the depth-first order, ! and for topsort contains the nodes which couldn't be ordered because they ! are connected to some cyclic computation. The topological sort used in ! previous cvs versions is now being phased out in favour of depth-first ! search, which is a little more efficient for incremental computations and ! handles a greater variety of usage cases, but is also less predictable if ! cyclic computations have to be performed. */ ! eval_list (I,J) = eval_list [(I,J)]; ! eval_list V = dfs_list V; ! //eval_list V = topsort_list; ! ! /* Depth-first postorder. */ ! ! dfs_list V = //printf "reverse dfs postorder: %s\n" $ str V || ! (V,[]) ! where // build a dict mapping cell indices to node numbers ! ALL_CELLS = foldl insert (get CELLS) $ ! map (flip pair true) V, ! ALL_KEYS = keys ALL_CELLS, ! N = #ALL_KEYS, NODES = [0..N-1], ! NODE_NUM = hdict (zip ALL_KEYS NODES), ! // build a dictionary of dependencies ! (KEYS,VALS) = unzip (list (get EVAL)), ! KEYS = map (NODE_NUM!) KEYS, ! VALS = map (map (NODE_NUM!). ! filter (member NODE_NUM).trd) VALS, ! D = mkdict [] NODES, ! D = foldl insert D $ zip KEYS VALS, ! // compute the reversal of the dependencies graph ! ADJ = cat $ zipwith rev_edges NODES $ vals D, ! D = dict $ zip NODES $ reflist $ mklist emptyset N, ! _ = do (add_edge D) ADJ, ! ADJ = map (list.get) (vals D), ! // perform the depth-first traversal ! V = map (NODE_NUM!) V, ! V = dfs ADJ V, ! V = map (ALL_KEYS!) V, ! // determine the list of cells to be evaluated ! V = filter (member (get EVAL)) V; ! ! rev_edges X Ys = map (flip pair X) Ys; ! ! add_edge D (X,Y) ! = D!X := insert (D!!X) Y; ! ! dfs ADJ V = Xs where (_,Xs) = foldl (search ADJ) (emptyset,[]) V; ! search ADJ (V,Xs) X ! = (V,Xs) if member V X; ! = (V,[X|Xs]) ! where (V,Xs) = foldl (search ADJ) (insert V X,Xs) (ADJ!X); ! ! /* Topological order. */ ! ! topsort_list = (V,U) where (KEYS,VALS) = unzip (list (get EVAL)), NODE_NUM = hdict (zip KEYS [0..#KEYS-1]), *************** *** 3050,3055 **** V = map (KEYS!) V, U = map (KEYS!) U; ! /* Perform a toplogical sort on a graph given by its adjacency list. Returns a ! pair (V,U) where V is a maximal topological order and U are the remaining nodes which couldn't be ordered as they are connected to cycles in the graph. */ --- 3108,3113 ---- V = map (KEYS!) V, U = map (KEYS!) U; ! /* Perform a topological sort on a graph given by its adjacency list. Returns ! a pair (V,U) where V is a maximal topological order and U are the remaining nodes which couldn't be ordered as they are connected to cycles in the graph. */ Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** calclib.q 9 Nov 2007 10:41:22 -0000 1.19 --- calclib.q 9 Nov 2007 22:14:22 -0000 1.20 *************** *** 135,139 **** cells changes. In particular, you can also use GUI elements to *display* values from other cells by specifying the corresponding cell as the INIT ! parameter of the widget. Moreover, the values of all GUI elements except the push button (which is a --- 135,140 ---- cells changes. In particular, you can also use GUI elements to *display* values from other cells by specifying the corresponding cell as the INIT ! parameter of the widget, or you can define "buddies" which always change ! values in concert, like a slider and an associated spinbox. Moreover, the values of all GUI elements except the push button (which is a |
From: Albert G. <ag...@us...> - 2007-11-09 10:41:27
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv6968 Modified Files: calclib.q qcalc.q Log Message: perform incremental updates of GUI elements, so that they can also be used to display other values Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** qcalc.q 8 Nov 2007 21:42:57 -0000 1.113 --- qcalc.q 9 Nov 2007 10:41:22 -0000 1.114 *************** *** 555,559 **** special local X; ! local X = begin_local || X || end_local; /* Similarly, evaluations triggered by updates of cell and GUI elements are --- 555,559 ---- special local X; ! local X = end_local || Y where Y = begin_local || X; /* Similarly, evaluations triggered by updates of cell and GUI elements are *************** *** 568,572 **** special recursive X; ! recursive X = begin_recursive || X || end_recursive; @1 --- 568,572 ---- special recursive X; ! recursive X = end_recursive || Y where Y = begin_recursive || X; @1 *************** *** 691,695 **** else (process_sel2 [(I,J,X)] || merge_undo (I,J)) ! where X = process_update (I,J) S if get STATE = 4 where [(K,S)] = regex "" --- 691,695 ---- else (process_sel2 [(I,J,X)] || merge_undo (I,J)) ! where X = recursive (process_update (I,J) S) if get STATE = 4 where [(K,S)] = regex "" *************** *** 2044,2049 **** /* GUI elements. ***********************************************************/ ! /* Note that the creation of the GUI elements is handled by the ! collect_results routine below. */ /* Get the value of a GUI element. */ --- 2044,2228 ---- /* GUI elements. ***********************************************************/ ! /* Create a new or update an existing GUI element. */ ! ! checkbox_gui (I,J) () (S,INIT) ! = qt IT "setChecked" INIT || ! qt TABLE "setItem" (I,J,IT) || IT ! if not is_nil IT ! where IT:QtObject = qt_new "QCheckTableItem" (TABLE,S); ! ! checkbox_gui (I,J) X:QtObject (S,INIT) ! = qt X "setText" S || qt X "setChecked" INIT; ! ! combobox_gui (I,J) () (SL,INIT) ! = qt IT "setCurrentItem" INIT || ! qt TABLE "setItem" (I,J,IT) || IT ! if not is_nil IT ! where IT:QtObject = qt_new "QComboTableItem" ! (TABLE,SL,false); ! ! combobox_gui (I,J) X:QtObject (SL,INIT) ! = qt X "setStringList" SL || qt X "setCurrentItem" INIT; ! ! comboedit_gui (I,J) () (SL,INIT) ! = qt IT "setCurrentItem" INIT || ! qt TABLE "setItem" (I,J,IT) || IT ! if not is_nil IT ! where IT:QtObject = qt_new "QComboTableItem" ! (TABLE,SL,true); ! ! comboedit_gui (I,J) X:QtObject (SL,INIT) ! = qt X "setStringList" SL || gui_setval X $ str INIT; ! ! pushbutton_gui (I,J) () (TEXT,ICON) ! = qt_connect X (SIGNAL "pressed()") X (SLOT "guiUpdate()") || ! qt_connect X (SIGNAL "released()") X (SLOT "guiUpdate()") || ! qt TABLE "setItem" (I,J,IT) || ! qt TABLE "setCellWidget" (I,J,X) || ! qt IT "setReplaceable" false || IT ! if not is_nil IT and then not is_nil X ! where ICONSET = ! if null ICON then () ! else qt_new "QIconSet" $ qt_new "QPixmap" ICON, ! X:QtObject = qt_object "QPushButton" ! (if is_qt_object ICONSET then (ICONSET,TEXT,TABLE) ! else (TEXT,TABLE)) ! "MyPushButton" (I,J) [] ! // slots ! [("guiUpdate()",gui_update)] [], ! IT:QtObject = qt_object "QTableItem" ! (TABLE,qt_val "QTableItem" "Never") ! "MyTableItem" X [] [] []; ! ! pushbutton_gui (I,J) X:QtObject (TEXT,ICON) ! = qt X "setText" TEXT || qt X "setIconSet" ICONSET ! where PM = ! if null ICON then NULLPM ! else qt_new "QPixmap" ICON, ! ICONSET = qt_new "QIconSet" PM; ! ! togglebutton_gui (I,J) () (TEXT,ICON,INIT) ! = qt X "setToggleButton" true || ! qt X "setOn" INIT || ! qt_connect X (SIGNAL "toggled(bool)") ! X (SLOT "guiUpdate()") || ! qt TABLE "setItem" (I,J,IT) || ! qt TABLE "setCellWidget" (I,J,X) || ! qt IT "setReplaceable" false || IT ! if not is_nil IT and then not is_nil X ! where ICONSET = ! if null ICON then () ! else qt_new "QIconSet" $ qt_new "QPixmap" ICON, ! X:QtObject = qt_object "QPushButton" ! (if is_qt_object ICONSET then (ICONSET,TEXT,TABLE) ! else (TEXT,TABLE)) ! "MyToggleButton" (I,J) [] ! // slots ! [("guiUpdate()",gui_update)] [], ! IT:QtObject = qt_object "QTableItem" ! (TABLE,qt_val "QTableItem" "Never") ! "MyTableItem" X [] [] []; ! ! togglebutton_gui (I,J) X:QtObject (TEXT,ICON,INIT) ! = qt X "setText" TEXT || qt X "setIconSet" ICONSET || ! qt X "setOn" INIT ! where PM = ! if null ICON then NULLPM ! else qt_new "QPixmap" ICON, ! ICONSET = qt_new "QIconSet" PM; ! ! spinbox_gui (I,J) () (MIN,MAX,STEP,INIT,SPECIAL,PREF,SUFF,V2T,T2V) ! = // FIXME: implement more appropriate validation here ! // currently we just switch it off ! qt X "setValidator" nil || ! qt X "setValue" INIT || ! if not null SPECIAL then ! qt X "setSpecialValueText" SPECIAL || ! if not null PREF then qt X "setPrefix" PREF || ! if not null SUFF then qt X "setSuffix" SUFF || ! qt_connect X (SIGNAL "valueChanged(int)") ! X (SLOT "guiUpdate()") || ! qt TABLE "setItem" (I,J,IT) || ! qt TABLE "setCellWidget" (I,J,X) || ! qt IT "setReplaceable" false || IT ! if not is_nil IT and then not is_nil X ! where X:QtObject = qt_object "QSpinBox" ! (MIN,MAX,STEP,TABLE) ! "MySpinBox" (I,J) ! // override mapValueToText and mapTextToValue methods ! [("mapValueToText",v2t V2T),("mapTextToValue",t2v T2V)] ! // slots ! [("guiUpdate()",gui_update)] [], ! IT:QtObject = qt_object "QTableItem" ! (TABLE,qt_val "QTableItem" "Never") ! "MyTableItem" X [] [] []; ! ! spinbox_gui (I,J) X:QtObject (MIN,MAX,STEP,INIT,SPECIAL,PREF,SUFF,V2T,T2V) ! = qt_set_cb X "mapValueToText" (v2t V2T) || ! qt_set_cb X "mapTextToValue" (t2v T2V) || ! qt X "setMinValue" MIN || qt X "setMaxValue" MAX || ! qt X "setLineStep" STEP || ! qt X "setSpecialValueText" SPECIAL || ! qt X "setPrefix" PREF || qt X "setSuffix" SUFF || ! qt X "setValue" INIT; ! ! slider_gui (I,J) () (MIN,MAX,STEP,INIT,VERT) ! = qt X "setLineStep" STEP || ! qt_connect X (SIGNAL "valueChanged(int)") ! X (SLOT "guiUpdate()") || ! qt TABLE "setItem" (I,J,IT) || ! qt TABLE "setCellWidget" (I,J,X) || ! qt IT "setReplaceable" false || IT ! if not is_nil IT and then not is_nil X ! where X:QtObject = qt_object "QSlider" ! (MIN,MAX,STEP,INIT, ! qt_val "Qt" (if VERT then "Vertical" else "Horizontal"), ! TABLE) ! "MySlider" (I,J) [] ! // slots ! [("guiUpdate()",gui_update)] [], ! IT:QtObject = qt_object "QTableItem" ! (TABLE,qt_val "QTableItem" "Never") ! "MyTableItem" X [] [] []; ! ! slider_gui (I,J) X:QtObject (MIN,MAX,STEP,INIT,VERT) ! = qt X "setMinValue" MIN || qt X "setMaxValue" MAX || ! qt X "setPageStep" STEP || qt X "setValue" INIT; ! ! /* Text<->value conversion routines for spinboxes. */ ! ! v2t V2T X _ V = S if not null S and then (V=MIN) ! where S:String = qt X "specialValueText" (), ! MIN = qt X "minValue" (); ! = S where S:String = V2T V; ! = str V otherwise; ! t2v T2V X _ _ where S:String = qt X "cleanText" (): ! = MIN if not null S and then (S=S1) ! where S1:String = qt X "specialValueText" (), ! MIN = qt X "minValue" (); ! = V where V:Int = T2V S; ! = val S otherwise; ! ! fstr MIN STEP V = sprintf (get FFORMAT) $ MIN+V*STEP; ! fval MIN STEP S = round ((V-MIN)/STEP) where V:Num = val S; ! ! /* Get the "type" (denoted by the creation/update function) of a GUI ! element. */ ! ! gui_gettype X ! where C:String = class_name X: ! = checkbox_gui ! if C = "QCheckTableItem"; ! = if qt X "isEditable" () then comboedit_gui ! else combobox_gui ! if C = "QComboTableItem"; ! = spinbox_gui ! if C = "QSpinBox"; ! = slider_gui ! if C = "QSlider"; ! = if qt X "isToggleButton" () then togglebutton_gui ! else pushbutton_gui ! if C = "QPushButton"; ! // = printf "unknown GUI element %s\n" C || fail otherwise; /* Get the value of a GUI element. */ *************** *** 2073,2083 **** gui_setval X S where C:String = class_name X: ! = recursive (qt X "setChecked" Y) if checkbool 'Y where 'Y = valq S if C = "QCheckTableItem"; = if all (<>S) L then - recursive (qt X "setStringList" $ append L S || qt X "setCurrentItem" N) where S = Y, N = qt X "count" (), L = map (qt X "text") [0..N-1] --- 2252,2263 ---- gui_setval X S where C:String = class_name X: ! = qt X "setChecked" Y if checkbool 'Y where 'Y = valq S if C = "QCheckTableItem"; = if all (<>S) L then (qt X "setStringList" $ append L S || qt X "setCurrentItem" N) + else + qt X "setCurrentItem" S where S = Y, N = qt X "count" (), L = map (qt X "text") [0..N-1] *************** *** 2085,2089 **** if (C = "QComboTableItem") and then qt X "isEditable" (); ! = recursive (qt X "setCurrentItem" S) if any (=S) L where S = Y, --- 2265,2269 ---- if (C = "QComboTableItem") and then qt X "isEditable" (); ! = qt X "setCurrentItem" S if any (=S) L where S = Y, *************** *** 2091,2095 **** if checkstr 'Y where 'Y = valq S if C = "QComboTableItem"; ! = if Y<>Y0 then recursive (qt X "setValue" Y) where Y0 = qt X "value" (), MIN = qt X "minValue" (), --- 2271,2275 ---- if checkstr 'Y where 'Y = valq S if C = "QComboTableItem"; ! = if Y<>Y0 then qt X "setValue" Y where Y0 = qt X "value" (), MIN = qt X "minValue" (), *************** *** 2099,2103 **** where Y:Int = make_spinbox_value X S if C = "QSpinBox"; ! = if Y<>Y0 then recursive (qt X "setValue" Y) where Y0 = qt X "value" (), MIN = qt X "minValue" (), --- 2279,2283 ---- where Y:Int = make_spinbox_value X S if C = "QSpinBox"; ! = if Y<>Y0 then qt X "setValue" Y where Y0 = qt X "value" (), MIN = qt X "minValue" (), *************** *** 2106,2110 **** if checknum 'Y where 'Y = valq S if C = "QSlider"; ! = recursive (qt X "setOn" Y) if checkbool 'Y where 'Y = valq S if (C = "QPushButton") and then qt X "isToggleButton" (); --- 2286,2290 ---- if checknum 'Y where 'Y = valq S if C = "QSlider"; ! = qt X "setOn" Y if checkbool 'Y where 'Y = valq S if (C = "QPushButton") and then qt X "isToggleButton" (); *************** *** 2618,2623 **** if (S = "+++ Syntax error.") or else not null (regex "" "^\\+\\+\\+ Exception: (.*)$" S ()); ! /* Asynchronous message to change a cell. We update the cell right now, but ! defer triggering of dependent cells until we have finished processing. */ = results_loop (insert U ((I1,J1),X)) [(I,J)|V] where X = process_update2 (I1,J1) S1 --- 2798,2802 ---- 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 *************** *** 2626,2719 **** (reg 1,reg 2), (I1,J1) = val K1; ! /* Messages to create GUI elements in cells. */ ! = qt IT "setChecked" INIT || ! qt TABLE "setItem" (I1,J1,IT) || ! insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Checkbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S (reg 1,reg 2), (I1,J1) = val K1, (S1,INIT) = val S1, ! IT = qt_new "QCheckTableItem" (TABLE,S1); ! = qt TABLE "setItem" (I1,J1,IT) || ! qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Pushbutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S (reg 1,reg 2), (I1,J1) = val K1, (TEXT,ICON) = val S1, ! ICONSET = ! if null ICON then () ! else qt_new "QIconSet" $ qt_new "QPixmap" ICON, ! X = qt_object "QPushButton" ! (if is_qt_object ICONSET ! then (ICONSET,TEXT,TABLE) ! else (TEXT,TABLE)) ! "MyPushButton" (I1,J1) [] ! // slots ! [("guiUpdate()",gui_update)] [], ! IT = qt_object "QTableItem" ! (TABLE,qt_val "QTableItem" "Never") ! "MyTableItem" X [] [] [], ! _ = qt_connect X (SIGNAL "pressed()") ! X (SLOT "guiUpdate()") || ! qt_connect X (SIGNAL "released()") ! X (SLOT "guiUpdate()") || ! qt IT "setReplaceable" false; ! = qt X "setToggleButton" true || ! qt TABLE "setItem" (I1,J1,IT) || ! qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Togglebutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S (reg 1,reg 2), ! (I1,J1) = val K1, (TEXT,ICON) = val S1, ! ICONSET = ! if null ICON then () ! else qt_new "QIconSet" $ qt_new "QPixmap" ICON, ! X = qt_object "QPushButton" ! (if is_qt_object ICONSET ! then (ICONSET,TEXT,TABLE) ! else (TEXT,TABLE)) ! "MyToggleButton" (I1,J1) [] ! // slots ! [("guiUpdate()",gui_update)] [], ! IT = qt_object "QTableItem" ! (TABLE,qt_val "QTableItem" "Never") ! "MyTableItem" X [] [] [], ! _ = qt_connect X (SIGNAL "toggled(bool)") ! X (SLOT "guiUpdate()") || ! qt IT "setReplaceable" false; ! = qt IT "setCurrentItem" INIT || ! qt TABLE "setItem" (I1,J1,IT) || ! insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Combobox: (\\([0-9]+,[0-9]+\\)) (.*)$" S (reg 1,reg 2), (I1,J1) = val K1, (SL,INIT) = val S1, ! IT = qt_new "QComboTableItem" (TABLE,SL,false); ! = qt IT "setCurrentItem" INIT || ! qt TABLE "setItem" (I1,J1,IT) || ! insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Comboedit: (\\([0-9]+,[0-9]+\\)) (.*)$" S (reg 1,reg 2), (I1,J1) = val K1, (SL,INIT) = val S1, ! IT = qt_new "QComboTableItem" (TABLE,SL,true); ! = qt X "setValue" INIT || ! if not null SPECIAL then ! qt X "setSpecialValueText" SPECIAL || ! if not null PREF then ! qt X "setPrefix" PREF || ! if not null SUFF then ! qt X "setSuffix" SUFF || ! qt TABLE "setItem" (I1,J1,IT) || ! qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Spinbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2805,2842 ---- (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] where [(K1,S1)] = regex "" "^\\+\\+\\+ Checkbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S (reg 1,reg 2), (I1,J1) = val K1, (S1,INIT) = val S1, ! IT:QtObject = make_gui checkbox_gui (I1,J1) (S1,INIT); ! = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Pushbutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S (reg 1,reg 2), (I1,J1) = val K1, (TEXT,ICON) = val S1, ! IT:QtObject = make_gui pushbutton_gui (I1,J1) ! (TEXT,ICON); ! = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Togglebutton: (\\([0-9]+,[0-9]+\\)) (.*)$" S (reg 1,reg 2), ! (I1,J1) = val K1, (TEXT,ICON,INIT) = val S1, ! IT:QtObject = make_gui togglebutton_gui (I1,J1) ! (TEXT,ICON,INIT); ! = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Combobox: (\\([0-9]+,[0-9]+\\)) (.*)$" S (reg 1,reg 2), (I1,J1) = val K1, (SL,INIT) = val S1, ! IT:QtObject = make_gui combobox_gui (I1,J1) (SL,INIT); ! = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Comboedit: (\\([0-9]+,[0-9]+\\)) (.*)$" S (reg 1,reg 2), (I1,J1) = val K1, (SL,INIT) = val S1, ! IT:QtObject = make_gui comboedit_gui (I1,J1) (SL,INIT); ! = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Spinbox: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2721,2744 **** (I1,J1) = val K1, (MIN,MAX,STEP,INIT,SPECIAL,PREF,SUFF,V2T,T2V) = val S1, ! X = qt_object "QSpinBox" (MIN,MAX,STEP,TABLE) ! "MySpinBox" (I1,J1) ! // override mapValueToText and mapTextToValue methods ! [("mapValueToText",v2t V2T),("mapTextToValue",t2v T2V)] ! // slots ! [("guiUpdate()",gui_update)] [], ! IT = qt_object "QTableItem" ! (TABLE,qt_val "QTableItem" "Never") ! "MyTableItem" X [] [] [], ! _ = qt_connect X (SIGNAL "valueChanged(int)") ! X (SLOT "guiUpdate()") || ! // FIXME: implement more appropriate validation here ! // currently we just switch it off ! qt X "setValidator" nil || ! qt IT "setReplaceable" false; ! = qt X "setLineStep" LSTEP || ! qt TABLE "setItem" (I1,J1,IT) || ! qt TABLE "setCellWidget" (I1,J1,X) || ! insert_cells ((I1,J1),IT) || ! results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Slider: (\\([0-9]+,[0-9]+\\)) (.*)$" S --- 2844,2850 ---- (I1,J1) = val K1, (MIN,MAX,STEP,INIT,SPECIAL,PREF,SUFF,V2T,T2V) = val S1, ! IT:QtObject = make_gui spinbox_gui (I1,J1) ! (MIN,MAX,STEP,INIT,SPECIAL,PREF,SUFF,V2T,T2V); ! = results_loop (insert U ((I1,J1),IT)) [(I,J)|V] where [(K1,S1)] = regex "" "^\\+\\+\\+ Slider: (\\([0-9]+,[0-9]+\\)) (.*)$" S *************** *** 2746,2762 **** (I1,J1) = val K1, (MIN,MAX,STEP,INIT,VERT) = val S1, ! X = qt_object "QSlider" ! (MIN,MAX,STEP,INIT, ! qt_val "Qt" (if VERT then "Vertical" else "Horizontal"), ! TABLE) ! "MySlider" (I1,J1) [] ! // slots ! [("guiUpdate()",gui_update)] [], ! IT = qt_object "QTableItem" ! (TABLE,qt_val "QTableItem" "Never") ! "MyTableItem" X [] [] [], ! _ = qt_connect X (SIGNAL "valueChanged(int)") ! X (SLOT "guiUpdate()") || ! qt IT "setReplaceable" false; // anything else just gets passed to the digest function, and we try again = local (digest S) || results_loop U [(I,J)|V]; --- 2852,2857 ---- (I1,J1) = val K1, (MIN,MAX,STEP,INIT,VERT) = val S1, ! IT:QtObject = make_gui slider_gui (I1,J1) ! (MIN,MAX,STEP,INIT,VERT); // anything else just gets passed to the digest function, and we try again = local (digest S) || results_loop U [(I,J)|V]; *************** *** 2784,2803 **** set_pixmap (I,J) RES; ! /* Text<->value conversion routines for spinboxes. */ ! ! v2t V2T X _ V = S if not null S and then (V=MIN) ! where S:String = qt X "specialValueText" (), ! MIN = qt X "minValue" (); ! = S where S:String = V2T V; ! = str V otherwise; ! t2v T2V X _ _ where S:String = qt X "cleanText" (): ! = MIN if not null S and then (S=S1) ! where S1:String = qt X "specialValueText" (), ! MIN = qt X "minValue" (); ! = V where V:Int = T2V S; ! = val S otherwise; ! fstr MIN STEP V = sprintf (get FFORMAT) $ MIN+V*STEP; ! fval MIN STEP S = round ((V-MIN)/STEP) where V:Num = val S; /* Recompute a single cell, or a collection of cells, and all cells depending --- 2879,2892 ---- set_pixmap (I,J) RES; ! /* Create a new or update an existing GUI element (the actual work is done by ! the creation/update functions under "GUI elements" above). */ ! make_gui TYPE (I,J) ARGS ! = TYPE (I,J) X ARGS || get CELLS!(I,J) ! if eq TYPE TYPE1 ! where X:QtObject = gui_elem (I,J), TYPE1 = gui_gettype X; ! = insert_cells ((I,J),IT) || IT ! where IT:QtObject = TYPE (I,J) () ARGS ! otherwise; /* Recompute a single cell, or a collection of cells, and all cells depending Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** calclib.q 8 Nov 2007 22:15:14 -0000 1.18 --- calclib.q 9 Nov 2007 10:41:22 -0000 1.19 *************** *** 4,11 **** /* This module provides some useful support functions for use in QCalc spreadsheets. You only need to import this if you want to use any of the ! operations of this module in your spreadsheet. However, for QCalc to work ! properly, this script needs to be on the QPATH, therefore it is recommended ! that you install QCalc under the prefix where your Q installation ! lives. Otherwise you will have to set your QPATH accordingly. */ from hdict import emptyhdict; --- 4,13 ---- /* This module provides some useful support functions for use in QCalc spreadsheets. You only need to import this if you want to use any of the ! operations of this module in your spreadsheet script. ! ! However, for QCalc to work properly, this script needs to be on the QPATH, ! therefore it is recommended that you install QCalc under the prefix where ! your Q installation lives. Otherwise you will have to set your QPATH ! accordingly. */ from hdict import emptyhdict; *************** *** 54,60 **** /* Definition of GUI elements in table cells. Currently supported are checkboxes, comboboxes (both non-editable and editable), spinboxes, ! hoirzontal and vertical sliders, push and toggle buttons. You can find ! examples for all of these in the guiexamples.qcalc spreadsheet included in ! the QCalc distribution. The argument tuple ARGS depends on the specific kind of widget: --- 56,60 ---- /* Definition of GUI elements in table cells. Currently supported are checkboxes, comboboxes (both non-editable and editable), spinboxes, ! horizontal and vertical sliders, push and toggle buttons. The argument tuple ARGS depends on the specific kind of widget: *************** *** 73,78 **** false otherwise. ! - togglebutton S or togglebutton (S,ICON): Analogous to push buttons, but ! toggle buttons are switched on and off by clicking them. The value of a toggle button is true if it is currently on and false --- 73,80 ---- false otherwise. ! - togglebutton S, togglebutton (S,ICON) or togglebutton (S,ICON,INIT): ! Analogous to push buttons, but toggle buttons are switched on and off by ! clicking them, and have an optional INIT argument which indicates the ! initial state (true or false, the default is false). The value of a toggle button is true if it is currently on and false *************** *** 124,130 **** as if you typed the corresponding value directly into the cell. ! NOTE: These functions will not work if they are executed asynchronously. ! They *must* be executed, either directly or indirectly, from a formula in a ! spreadsheet cell. */ public checkbox ARGS, combobox ARGS, comboedit ARGS, spinbox ARGS, --- 126,147 ---- as if you typed the corresponding value directly into the cell. ! NOTE: These functions will *not* work if they are run asynchronously (i.e., ! in a secondary Q thread of the user script). They *must* be executed, ! either directly or indirectly, from a formula in a spreadsheet cell. ! ! The parameters of all GUI elements can be computed values which may also ! depend on other cell values (including other GUI elements). In this case ! the GUI element will be updated automatically whenever any of the requisite ! cells changes. In particular, you can also use GUI elements to *display* ! values from other cells by specifying the corresponding cell as the INIT ! parameter of the widget. ! ! Moreover, the values of all GUI elements except the push button (which is a ! read-only element) can also be set with setval (see below). This is useful, ! in particular, if the GUI element displays some value which is updated ! asynchronously. ! ! You can find examples for all types of widgets in the guiexamples.qcalc ! spreadsheet included in the QCalc distribution. */ public checkbox ARGS, combobox ARGS, comboedit ARGS, spinbox ARGS, *************** *** 230,237 **** togglebutton S:String ! = togglebutton (S,""); togglebutton (S:String,ICON:String) = printf "\f+++ Togglebutton: %s %s\n" ! (str (I,J),str (S,ICON)) || false where (I,J) = get YYKEY; --- 247,256 ---- togglebutton S:String ! = togglebutton (S,"",false); togglebutton (S:String,ICON:String) + = togglebutton (S,ICON,false); + togglebutton (S:String,ICON:String,INIT:Bool) = printf "\f+++ Togglebutton: %s %s\n" ! (str (I,J),str (S,ICON,INIT)) || false where (I,J) = get YYKEY; *************** *** 286,295 **** --- 305,326 ---- SPECIAL:String) = (MIN,MAX,STEP,INIT,SPECIAL,"",""); + spinbox_args (MIN:Real,MAX:Real,STEP:Real,SPECIAL:String, + SPECIAL) + = (MIN,MAX,STEP,MIN,SPECIAL,"","") + if not null SPECIAL; spinbox_args (MIN:Real,MAX:Real,STEP:Real,INIT:Real, SPECIAL:String,PREF:String) = (MIN,MAX,STEP,INIT,SPECIAL,PREF,""); + spinbox_args (MIN:Real,MAX:Real,STEP:Real,SPECIAL:String, + SPECIAL,PREF:String) + = (MIN,MAX,STEP,MIN,SPECIAL,PREF,"") + if not null SPECIAL; spinbox_args (MIN:Real,MAX:Real,STEP:Real,INIT:Real, SPECIAL:String,PREF:String,SUFF:String) = (MIN,MAX,STEP,INIT,SPECIAL,PREF,SUFF); + spinbox_args (MIN:Real,MAX:Real,STEP:Real,SPECIAL:String, + SPECIAL,PREF:String,SUFF:String) + = (MIN,MAX,STEP,MIN,SPECIAL,PREF,SUFF) + if not null SPECIAL; spinbox ARGS = myspinbox ARGS where ARGS:Tuple = spinbox_args ARGS; |
From: Albert G. <ag...@us...> - 2007-11-08 23:11:46
|
Update of /cvsroot/q-lang/qt-q In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22426 Modified Files: Makefile NEWS Log Message: bump version number Index: NEWS =================================================================== RCS file: /cvsroot/q-lang/qt-q/NEWS,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NEWS 3 Nov 2007 10:44:19 -0000 1.3 --- NEWS 8 Nov 2007 23:11:43 -0000 1.4 *************** *** 1,3 **** --- 1,8 ---- + * 1.2 November 2007 + + Critical bugfix in the QtQSmokeBinding::deleted() method (see ChangeLog for + details). + * 1.1 November 2007 Index: Makefile =================================================================== RCS file: /cvsroot/q-lang/qt-q/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Makefile 3 Nov 2007 10:44:19 -0000 1.3 --- Makefile 8 Nov 2007 23:11:43 -0000 1.4 *************** *** 5,9 **** # version number: ! version = 1.1 dist = qt-q-$(version) --- 5,9 ---- # version number: ! version = 1.2 dist = qt-q-$(version) |
From: Albert G. <ag...@us...> - 2007-11-08 22:47:25
|
Update of /cvsroot/q-lang/qcalc/doc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv8306/doc Modified Files: qcalc.xml Log Message: update documentation Index: qcalc.xml =================================================================== RCS file: /cvsroot/q-lang/qcalc/doc/qcalc.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** qcalc.xml 5 Nov 2007 11:47:53 -0000 1.9 --- qcalc.xml 8 Nov 2007 22:47:19 -0000 1.10 *************** *** 163,167 **** </para> <para> ! Some special support operations for use in QCalc scripts can be found in the <filename>calclib.q</filename> module which is to be installed on the Q path. These operations allow you to show messages in the QCalc status line while a computation is in progress, and to change spreadsheet cells programmatically. Convenience functions to insert a vector or matrix given as a Q list into a corresponding range of table cells are also provided. It is even possible to perform asynchronous updates of the spreadsheet, using Q threads. Please have a look at the sample spreadsheets in the examples subdirectory of the QCalc distribution which show how these operations are used. </para> <para> --- 163,167 ---- </para> <para> ! Some special support operations for use in QCalc scripts can be found in the <filename>calclib.q</filename> module which is to be installed on the Q path. These operations allow you to show messages in the QCalc status line while a computation is in progress, and to change spreadsheet cells programmatically. Convenience functions to insert a vector or matrix given as a Q list into a corresponding range of table cells are also provided. It is even possible to perform asynchronous updates of the spreadsheet, using Q threads. Last but not least, there are a number of operations to populate cells with GUI elements like buttons, comboboxes, spinboxes and sliders, which provide a convenient means to enter values into your spreadsheet. See the <filename>calclib.q</filename> file for a description of these operations, and please have a look at the sample spreadsheets in the examples subdirectory of the QCalc distribution which show how these operations are used. </para> <para> |
From: Albert G. <ag...@us...> - 2007-11-08 22:35:59
|
Update of /cvsroot/q-lang/qcalc/examples In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv3312/examples Modified Files: calendar.qcalc matrix.qcalc Log Message: updated examples Index: calendar.qcalc =================================================================== RCS file: /cvsroot/q-lang/qcalc/examples/calendar.qcalc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** calendar.qcalc 6 Nov 2007 11:15:05 -0000 1.2 --- calendar.qcalc 8 Nov 2007 22:35:49 -0000 1.3 *************** *** 1,4 **** ! // qcalc 1.0, created Tue Nov 6 12:08:27 2007 -*-Q-*- -*- coding: UTF-8 -*- ! // [((1,0),"Enter year:"),((2,0),"= spinbox (0,9999,1,today!2)"),((3,0),"= matrix (4,0) (mycal A3)")] // [] // [(0,77),(1,26),(2,28),(3,26),(4,30),(5,25),(6,27),(7,26),(8,74),(9,26),(10,28),(11,25),(12,30),(13,26),(14,27),(15,26),(16,77),(17,26),(18,28),(19,25),(20,30),(21,25),(22,29),(23,26)] --- 1,4 ---- ! // qcalc 1.0, created Thu Nov 8 23:31:40 2007 -*-Q-*- -*- coding: UTF-8 -*- ! // [((1,0),"Enter year:"),((2,0),"= spinbox (0,9999,1,today!2)"),((3,0),"= matrix 'A5 (mycal A3) || A3")] // [] // [(0,77),(1,26),(2,28),(3,26),(4,30),(5,25),(6,27),(7,26),(8,74),(9,26),(10,28),(11,25),(12,30),(13,26),(14,27),(15,26),(16,77),(17,26),(18,28),(19,25),(20,30),(21,25),(22,29),(23,26)] Index: matrix.qcalc =================================================================== RCS file: /cvsroot/q-lang/qcalc/examples/matrix.qcalc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** matrix.qcalc 4 Nov 2007 23:46:18 -0000 1.3 --- matrix.qcalc 8 Nov 2007 22:35:49 -0000 1.4 *************** *** 1,3 **** ! // qcalc 1.0, created Mon Nov 5 00:43:20 2007 -*-Q-*- -*- coding: UTF-8 -*- // [((0,0),"Matrix A:"),((0,1),"= B2:D4"),((1,1),"1"),((1,2),"0"),((1,3),"0"),((2,1),"1"),((2,2),"0"),((2,3),"-1"),((3,1),"0"),((3,2),"1"),((3,3),"-1"),((5,0),"Matrix B:"),((5,1),"= B7:D9"),((6,1),"1"),((6,2),"2"),((6,3),"3"),((7,1),"2"),((7,2),"3"),((7,3),"4"),((8,1),"2"),((8,2),"4"),((8,3),"6"),((10,0),"Product A*B:"),((10,1),"= show (B1*B6)"),((11,1),"1"),((11,2),"2"),((11,3),"3"),((12,1),"-1"),((12,2),"-2"),((12,3),"-3"),((13,1),"0"),((13,2),"-1"),((13,3),"-2")] // [] --- 1,3 ---- ! // qcalc 1.0, created Thu Nov 8 23:22:29 2007 -*-Q-*- -*- coding: UTF-8 -*- // [((0,0),"Matrix A:"),((0,1),"= B2:D4"),((1,1),"1"),((1,2),"0"),((1,3),"0"),((2,1),"1"),((2,2),"0"),((2,3),"-1"),((3,1),"0"),((3,2),"1"),((3,3),"-1"),((5,0),"Matrix B:"),((5,1),"= B7:D9"),((6,1),"1"),((6,2),"2"),((6,3),"3"),((7,1),"2"),((7,2),"3"),((7,3),"4"),((8,1),"2"),((8,2),"4"),((8,3),"6"),((10,0),"Product A*B:"),((10,1),"= show (B1*B6)"),((11,1),"1"),((11,2),"2"),((11,3),"3"),((12,1),"-1"),((12,2),"-2"),((12,3),"-3"),((13,1),"0"),((13,2),"-1"),((13,3),"-2")] // [] *************** *** 20,22 **** // helper function to show a matrix ! show A = matrix (I+1,J) A || A where (I,J) = index; --- 20,22 ---- // helper function to show a matrix ! show A = matrix (I+1,J) A where (I,J) = index; |
From: Albert G. <ag...@us...> - 2007-11-08 22:15:18
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv27205 Modified Files: calclib.q Log Message: setval, matrix and firends now return the given value instead of () Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** calclib.q 8 Nov 2007 22:09:21 -0000 1.17 --- calclib.q 8 Nov 2007 22:15:14 -0000 1.18 *************** *** 131,155 **** hslider ARGS, vslider ARGS, pushbutton ARGS, togglebutton ARGS; ! /* 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), and X may be any Q ! expression. If the given cell is an ordinary cell (no GUI element), then ! the current cell value is overwritten, so you should make sure that you do ! not have important data there. For GUI elements, the value of the element ! is changed accordingly, instead of overwriting the cell. In both cases, ! after changing the cell value QCalc will update its display and trigger ! updates in dependent cells as usual. Note, however, that the triggered ! changes will *not* take effect immediately, rather they are processed by ! QCalc when the current computation is finished. */ public setval KEY X; ! /* Convert a list to a matrix or row/column vector of table cells. For the ! matrix function, Xs must be a list of lists which are all of the same size; ! the component lists become the rows of the matrix. rowvect and colvect are ! convenience functions to create matrices with just one row or column for a ! given list of values, respectively. In any case the matrix or vector is ! inserted into the table starting at the given index KEY (given in any of ! the formats supported by setval). */ public matrix KEY Xs, rowvect KEY Xs, colvect KEY Xs; --- 131,155 ---- hslider ARGS, vslider ARGS, pushbutton ARGS, togglebutton ARGS; ! /* Set a cell value (and return that 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), and ! X may be any Q expression. If the given cell is an ordinary cell (no GUI ! element), then the current cell value is overwritten, so you should make ! sure that you do not have important data there. For GUI elements, the value ! of the element is changed accordingly, instead of overwriting the cell. In ! both cases, after changing the cell value QCalc will update its display and ! trigger updates in dependent cells as usual. Note, however, that the ! triggered changes will *not* take effect immediately, rather they are ! processed by QCalc when the current computation is finished. */ public setval KEY X; ! /* Convert a list to a matrix or row/column vector of table cells, and return ! the given list value. For the matrix function, Xs must be a list of lists ! which are all of the same size; the component lists become the rows of the ! matrix. rowvect and colvect are convenience functions to create matrices ! with just one row or column for a given list of values, respectively. In ! any case the matrix or vector is inserted into the table starting at the ! given index KEY (given in any of the formats supported by setval). */ public matrix KEY Xs, rowvect KEY Xs, colvect KEY Xs; *************** *** 340,348 **** indexarg 'X = (I,J) where (I,J) = cellindex 'X; ! setval KEY X = printf "\f+++ Update: %s %s\n" (str (I,J),str X) where (I:Int,J:Int) = indexarg KEY; matrix KEY Xs:List ! = dowith setval Ks (cat Xs) where Ks = [(I0+I,J0+J) : I in [0..N-1], J in [0..M-1]] if all islist Xs and then all ((=M).(#)) Xs --- 340,348 ---- indexarg 'X = (I,J) where (I,J) = cellindex 'X; ! setval KEY X = printf "\f+++ Update: %s %s\n" (str (I,J),str X) || X where (I:Int,J:Int) = indexarg KEY; matrix KEY Xs:List ! = dowith setval Ks (cat Xs) || Xs where Ks = [(I0+I,J0+J) : I in [0..N-1], J in [0..M-1]] if all islist Xs and then all ((=M).(#)) Xs *************** *** 351,358 **** rowvect KEY Xs:List ! = matrix (I0,J0) [Xs] where (I0:Int,J0:Int) = indexarg KEY; colvect KEY Xs:List ! = matrix (I0,J0) $ map (push []) Xs where (I0:Int,J0:Int) = indexarg KEY; --- 351,358 ---- rowvect KEY Xs:List ! = matrix (I0,J0) [Xs] || Xs where (I0:Int,J0:Int) = indexarg KEY; colvect KEY Xs:List ! = matrix (I0,J0) $ map (push []) Xs || Xs where (I0:Int,J0:Int) = indexarg KEY; |
From: Albert G. <ag...@us...> - 2007-11-08 22:09:25
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv24708 Modified Files: calclib.q Log Message: comment changes Index: calclib.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/calclib.q,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** calclib.q 7 Nov 2007 10:06:32 -0000 1.16 --- calclib.q 8 Nov 2007 22:09:21 -0000 1.17 *************** *** 35,39 **** Note that constructions like '(A$4) aren't really symbols in Q, but applications of the built-in $ operator, so they have to be surrounded with ! parentheses as indicated. Also note that, when converting from a numeric index back to its symbolic form, the $ indicators are lost since they aren't included in the numeric representation. --- 35,39 ---- Note that constructions like '(A$4) aren't really symbols in Q, but applications of the built-in $ operator, so they have to be surrounded with ! parentheses, as indicated. Also note that, when converting from a numeric index back to its symbolic form, the $ indicators are lost since they aren't included in the numeric representation. *************** *** 54,59 **** /* Definition of GUI elements in table cells. Currently supported are checkboxes, comboboxes (both non-editable and editable), spinboxes, ! hslider, vslider, push buttons and toggle buttons. You can find examples ! for all of these in guiexamples.qcalc included in the QCalc distribution. The argument tuple ARGS depends on the specific kind of widget: --- 54,60 ---- /* Definition of GUI elements in table cells. Currently supported are checkboxes, comboboxes (both non-editable and editable), spinboxes, ! hoirzontal and vertical sliders, push and toggle buttons. You can find ! examples for all of these in the guiexamples.qcalc spreadsheet included in ! the QCalc distribution. The argument tuple ARGS depends on the specific kind of widget: |
From: Albert G. <ag...@us...> - 2007-11-08 21:43:00
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13281 Modified Files: qcalc.q Log Message: remove debugging output Index: qcalc.q =================================================================== RCS file: /cvsroot/q-lang/qcalc/qcalc.q,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** qcalc.q 8 Nov 2007 21:30:58 -0000 1.112 --- qcalc.q 8 Nov 2007 21:42:57 -0000 1.113 *************** *** 939,944 **** gui_update X (I,J) _ if is_global and then not is_recursive and then not is_nil X: ! = puts "gui_update\n" || ! if (I,J)<>current_cell then (qt TABLE "setCurrentCell" (I,J) || qt TABLE "clearSelection" ()) || --- 939,943 ---- gui_update X (I,J) _ if is_global and then not is_recursive and then not is_nil X: ! = if (I,J)<>current_cell then (qt TABLE "setCurrentCell" (I,J) || qt TABLE "clearSelection" ()) || |
From: Albert G. <ag...@us...> - 2007-11-08 21:33:35
|
Update of /cvsroot/q-lang/qcalc In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv9486 Modified Files: README Log Message: we require Qt/Q 1.2 now; Qt/Q 1.1 has a critical bug causing segfaults with GUI elements Index: README =================================================================== RCS file: /cvsroot/q-lang/qcalc/README,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** README 4 Nov 2007 10:13:11 -0000 1.15 --- README 8 Nov 2007 21:33:27 -0000 1.16 *************** *** 30,34 **** Currently this script needs Qt3, but we're planning to port it to Qt4 asap. ! IMPORTANT: You'll need Qt/Q 1.1 or later. Qt/Q 1.0 will NOT WORK! To install from the source, simply run 'sudo make install' (this installs into --- 30,34 ---- Currently this script needs Qt3, but we're planning to port it to Qt4 asap. ! IMPORTANT: You'll need Qt/Q 1.2 or later. Earlier Qt/Q versions will NOT WORK! To install from the source, simply run 'sudo make install' (this installs into |