home *** CD-ROM | disk | FTP | other *** search
- *┌───────────────────────────────────────────────────────────────────────┐
- *│ draw semigraphic boxes and arrows with cursor keys │
- *│ character address based on values: 1(bot.)+2(le.)+4(ri.)+8(top) │
- *│ added (bitwise-Or isn't available) for connectors, as is for arrows │
- *└───────────────────────────────────────────────────────────────────────┘
- if COMMAND() then 'cursor home'; else if INPREFIX() then 'cursor column';
- C = -1; B = 0; P = 0; E = ''; L = 0; N = 0;
- D = 'down left 3 right 5 6 7 up'; O = 'nomsg coverlay';
- if CURSORSHAPE.1() = 'AUTO' then S = 'set cursorshape AUTO';
- else do; 'modify cursorshape'; S = CURLINE.3(); 'cmsg'; end
- 'set cursorshape USER 0 31 0 31'; A = 'set alt' ALT.1()+1 ALT.2()+1;
- 'preserve'; 'set autosave OFF';
- do forever
- if L > 1 | C = SPACECHAR() then
- do
- 'refresh'; if L > 1 then L = L-1;
- if \ NOQUEUE() then do; 'readv KEY'; L = 0; C = -1; end
- end
- else
- do
- if NOQUEUE() & C >= 0 then 'cursor' WORD( D , 8%N ); C = -1; L = 0;
- if E = '' then 'msg BOXES arrow=move S┌─┬ D╔═╦ H╒═╤ V╓─╥ A'D2C(26)' B L+-+ P÷·÷ SPACE=none ESC=end';
- else 'msg BOXES arrow=line 1back=junction PLUS=cross STAR/ALT=long SDHVABLP 'SUBSTR(E,5,3)' ESC=end';
- 'readv KEY'; R = WORD( READV.1 , 1 ); K = UPPER( READV.2 );
- if R = 'ASCII' & N > 0 then
- do; L = WORD( READV.1 , 2 ); C = 0; end
- else if R = 'STAR' & N > 0 then
- C = SPACECHAR();
- else if R = 'PLUS' & N > 0 & LENGTH( E ) = 15 then
- N = 15;
- else if R = 'CURD' then
- N = 1;
- else if R = 'CURL' then
- N = 2;
- else if R = 'CURR' then
- N = 4;
- else if R = 'CURU' then
- N = 8;
- else
- do
- if R = 'SPACE' then E = '';
- if K = 'S' then E = '│─┐─┌─┬││┘┤└├┴┼';
- if K = 'D' then E = '║═╗═╔═╦║║╝╣╚╠╩╬';
- if K = 'H' then E = '│═╕═╒═╤││╛╡╘╞╧╪';
- if K = 'V' then E = '║─╖─╓─╥║║╜╢╙╟╨╫';
- if K = 'A' then E = ' 'D2C(26)''D2C(26)'';
- if K = 'B' then E = ' ';
- if K = 'L' then E = '|-+-+-+||++++++';
- if K = 'P' then E = ':·÷·÷·÷::÷÷÷÷÷÷';
- if R = 'ESC' then leave;
- iterate;
- end
- end
- if LENGTH( E ) < 15 then
- do; O SUBSTR( E , N , 1 ); P = 8%N; end
- else if N = 15 then
- do; O SUBSTR( E , N , 1 ); N = 8%P; end
- else if N \= P then
- do; O SUBSTR( E , N*(N+8%N\=P)+P , 1 ); B = P; P = 8%N; end
- else if B = N | B = 8%N then
- do; B = P; P = N+8%N; end
- else
- do; 'cursor' WORD( D , N ); P = 8%N; O SUBSTR( E , N+P+B , 1 ); end
- 'cursor' WORD( D , N );
- end
- A; 'restore'; S;
-