home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / p / windoman.lbr / WINDOW.PZS / WINDOW.PAS
Encoding:
Pascal/Delphi Source File  |  1993-10-25  |  18.4 KB  |  798 lines

  1. { **********  Window Management Services    ********** }
  2. { **********  Version 1.0   8/06/84         ********** }
  3.  
  4. { (c) Copyright 1984  Timothy E. Ide  All commercial rights reserved }
  5.  
  6. { ********** constant and variable declarations ********** }
  7.  
  8. const
  9.   _wxa = 1;  {min col}
  10.   _wya = 1;  {min row}
  11.   _wxz = 80;  {max col}
  12.   _wyz = 23;  {max row}
  13.   _wlz = 1840;  {max length}
  14.   _wxv : set of byte = [_wxa.._wxz];
  15.   _wyv : set of byte = [_wya.._wyz];
  16.   _wzr : integer = 0;
  17.  
  18. type
  19.   _wbs = string[4];  {border character string}
  20.   _wpt = ^_wcb;
  21.   _wcb = record  {window control block}
  22.            _wno,  {window number}
  23.            _wx,   {window col}
  24.            _wy,   {window row}
  25.            _ww,   {window width}
  26.            _wh : byte;  {window height}
  27.            _wxo,  {window origin col}
  28.            _wyo,  {window origin row}
  29.            _wl : integer;  {window length}
  30.            _wb : boolean; {window border flag}
  31.            _wbc : array [1..4] of char; {window border char}
  32.            _wc,  {window cols}
  33.            _wr : byte;  {window rows}
  34.            _wcv : set of _wxa.._wxz;  {available width}
  35.            _wrv : set of _wya.._wyz;  {available height}
  36.            _wrp : array [_wya.._wyz] of integer;  {window row positions}
  37.            _wnx : _wpt;  {next pointer}
  38.            _wch : array [1.._wlz] of char;  {window contents}
  39.          end;
  40.   _wst = string[_wxz];
  41.  
  42. var
  43. { global variables available to user }
  44.   wi_status : boolean; { true = success, false = failure }
  45.   wi_eow, wi_eoln : boolean;
  46.  
  47. { for use by window management services }
  48.   _whd, _wp0, _wp1 : _wpt;
  49.  
  50.  
  51.  
  52. { ********** internal function and procedure declarations ********** }
  53.  
  54. function _wi_find ( no : integer ) : boolean; forward;
  55. procedure  _wi_stb ( var c; l : integer; var st : _wst); forward;
  56. procedure _wi_bord1 ( var b : _wbs ); forward;
  57. procedure _wi_bord2; forward;
  58. procedure _wi_out ( var no : integer;
  59.                     var st : _wst; out : boolean ); forward;
  60. procedure _wi_outln ( var no : integer;
  61.                       var st : _wst; out : boolean ); forward;
  62. procedure _wi_getst ( l, x, y : integer; var s : _wst ); forward;
  63. procedure _wi_inp ( var no, l : integer;
  64.                     var st : _wst; inp : boolean ); forward;
  65. procedure _wi_inpln ( var no, l : integer;
  66.                       var st : _wst; inp : boolean ); forward;
  67. procedure _wi_sher ( var no : integer; show : boolean ); forward;
  68.  
  69.  
  70.  
  71. { **********  Window Management Services  ********** }
  72.  
  73. { *********  wi_delln  ********** }
  74. { delete line from window }
  75.  
  76. procedure wi_delln ( no, y : integer );
  77. var
  78.   i : integer;
  79. begin
  80.   wi_status := false;
  81.   if (_wi_find(no)) then begin
  82.     with _wp1^ do begin
  83.       if not (y in _wrv) then
  84.         wi_status := false
  85.       else begin
  86.         for i := y to pred(_wr) do
  87.           move(_wch[(succ(_wrp[succ(i)]))],_wch[(succ(_wrp[i]))],_wc);
  88.         fillchar(_wch[(succ(_wrp[_wr]))],_wc,' ');
  89.         _wx := 1;
  90.         _wy := y;
  91.         wi_status := true;
  92.       end;
  93.     end;
  94.   end;
  95. end; {wi_delln}
  96.  
  97.  
  98. { **********  wi_insln  ********** }
  99. { insert line into window }
  100.  
  101. procedure wi_insln ( no, y : integer );
  102. var
  103.   i : integer;
  104. begin
  105.   wi_status := false;
  106.   if (_wi_find(no)) then begin
  107.     with _wp1^ do begin
  108.       if not (y in _wrv) then begin
  109.         if (y < 1) then
  110.           wi_status := false
  111.         else begin
  112.           wi_delln(no,1);
  113.           _wy := _wr;
  114.         end
  115.       end
  116.       else begin
  117.         for i := _wr downto y do
  118.           move(_wch[(succ(_wrp[pred(i)]))],_wch[(succ(_wrp[i]))],_wc);
  119.         fillchar(_wch[(succ(_wrp[y]))],_wc,' ');
  120.         _wy := y;
  121.         _wx := 1;
  122.         wi_status := true;
  123.       end;
  124.     end;
  125.   end;
  126. end; {wi_insln}
  127.  
  128.  
  129. { **********  wi_clreol  ********** }
  130. { clear from current window position to end of line }
  131.  
  132. procedure wi_clreol ( no : integer );
  133. begin
  134.   wi_status := false;
  135.   if (_wi_find(no)) then begin
  136.     with _wp1^ do begin
  137.       if (_wy in _wrv) and (_wx in _wcv) then begin
  138.         fillchar(_wch[(_wrp[_wy]+_wx)],(succ(_wc-_wx)),' ');
  139.         wi_status := true;
  140.       end;
  141.     end;
  142.   end;
  143. end; {wi_clreol}
  144.  
  145.  
  146. { **********  wi_clear  ********* }
  147. { blank window contents }
  148.  
  149. procedure wi_clear ( no : integer );
  150. begin
  151.   wi_status := false;
  152.   if (_wi_find(no)) then begin
  153.     with _wp1^ do begin
  154.       fillchar(_wch[1],_wl,' ');
  155.       _wx := 1;
  156.       _wy := 1;
  157.       _wi_bord2;
  158.     end;
  159.     wi_status := true;
  160.   end;
  161. end; {wi_clear}
  162.  
  163.  
  164. { *********  wi_home  ********** }
  165. { set window position to beginning of first line }
  166.  
  167. procedure wi_home ( no : integer );
  168. begin
  169.   wi_status := false;
  170.   if (_wi_find(no)) then begin
  171.     with _wp1^ do begin
  172.       _wx := 1;
  173.       _wy := 1;
  174.     end;
  175.     wi_status := true;
  176.   end;
  177. end; {wi_clear}
  178.  
  179.  
  180. { *********  wi_border ********** }
  181. { set/reset window border characters }
  182.  
  183. { overlay }
  184. procedure wi_border ( no : integer; b : _wbs );
  185. begin
  186.   wi_status := false;
  187.   if (_wi_find(no)) then begin
  188.     with _wp1^ do begin
  189.       if (_wb) then begin
  190.         _wi_bord1(b);
  191.         _wi_bord2;
  192.         wi_status := true;
  193.       end;
  194.     end;
  195.   end;
  196. end; {wi_border}
  197.  
  198.  
  199. { *********  wi_open  ********** }
  200. { open window - allocate dynamic memory for window control block }
  201.  
  202. { overlay }
  203. procedure wi_open ( no, x, y, w ,h : integer; b : _wbs );
  204. var
  205.   i, l : integer;
  206. begin
  207.   wi_status := false;
  208.   if (w in _wxv) and (h in _wyv)
  209.       and not (_wi_find(no)) then begin
  210.     l := w * h;
  211.     getmem (_wp1, ((sizeof(_wcb)-_wlz)+l));
  212.     with _wp1^ do begin
  213.       _wno := no;
  214.       _wx := 1;
  215.       _wy := 1;
  216.       _wxo := x;
  217.       _wyo := y;
  218.       _ww := w;
  219.       _wh := h;
  220.       _wl := l;
  221.       if (length(b) > 0) then begin
  222.         _wb := true;
  223.         _wc := _ww-2;
  224.         _wr := _wh-2;
  225.         _wcv := [1.._wc];
  226.         _wrv := [1.._wr];
  227.         _wi_bord1(b);
  228.         for i := _wya to _wyz do
  229.           _wrp[i] := (succ(i*_ww));
  230.       end
  231.       else begin
  232.         _wb := false;
  233.         _wc := _ww;
  234.         _wr := _wh;
  235.         _wcv := [_wxa.._ww];
  236.         _wrv := [_wya.._wh];
  237.         for i := _wya to _wyz do
  238.           _wrp[i] := (pred(i)*_wc);
  239.       end;
  240.       _wnx := _whd;
  241.       _whd := _wp1;
  242.     end;
  243.     wi_clear(no);
  244.   end;
  245. end; {wi_open}
  246.  
  247.  
  248. { **********  wi_close  ********** }
  249. { close window - release dynamic memory }
  250.  
  251. { overlay }
  252. procedure wi_close ( no : integer );
  253. begin
  254.   wi_status := false;
  255.   if (_wi_find(no)) then begin
  256.     if _wp1 = _whd then
  257.       _whd := _wp1^._wnx
  258.     else begin
  259.       _wp0^._wnx := _wp1^._wnx
  260.     end;
  261.     with _wp1^ do
  262.       freemem(_wp1,((sizeof(_wcb)-_wlz)+_wl));
  263.     _wp1 := nil;
  264.     wi_status := true;
  265.   end;
  266. end; {wi_close}
  267.  
  268.  
  269. { **********  wi_getpos  ********** }
  270. { get window position }
  271.  
  272. { overlay }
  273. procedure wi_getpos ( no : integer; var x, y : integer );
  274. begin
  275.   wi_status := false;
  276.   if (_wi_find(no)) then begin
  277.     with _wp1^ do begin
  278.       x := _wx;
  279.       y := _wy;
  280.     end;
  281.     wi_status := true;
  282.   end;
  283. end; {wi_getpos}
  284.  
  285.  
  286. { *********  wi_getorg  ********** }
  287. { get window screen origin }
  288.  
  289. { overlay }
  290. procedure wi_getorg ( no : integer; var x, y : integer );
  291. begin
  292.   wi_status := false;
  293.   if (_wi_find(no)) then begin
  294.     with _wp1^ do begin
  295.       x := _wxo;
  296.       y := _wyo;
  297.     end;
  298.   end;
  299. end; {wi_getorg}
  300.  
  301.  
  302. { **********  wi_setpos  ********** }
  303. { set window position }
  304.  
  305. procedure wi_setpos ( no, x, y : integer );
  306. begin
  307.   wi_status := false;
  308.   if (_wi_find(no)) then begin
  309.     with _wp1^ do begin
  310.       if (x in _wcv) and (y in _wrv) then begin
  311.         _wx := x;
  312.         _wy := y;
  313.         wi_status := true;
  314.       end
  315.       else
  316.         wi_status := false;
  317.     end;
  318.   end;
  319. end; {wi_setpos}
  320.  
  321.  
  322. { **********  wi_setorg  ********** }
  323. { set window screen origin }
  324.  
  325. procedure wi_setorg ( no, x, y : integer );
  326. begin
  327.   wi_status := false;
  328.   if (_wi_find(no)) then begin
  329.     with _wp1^ do begin
  330.       _wxo := x;
  331.       _wyo := y;
  332.     end;
  333.     wi_status := true;
  334.   end;
  335. end; {wi_setorg}
  336.  
  337.  
  338. { **********  wi_put  ********* }
  339. { store string in window }
  340.  
  341. procedure wi_put ( no : integer; st : _wst );
  342. begin
  343.   _wi_out(no,st,false);
  344. end; {wi_put}
  345.  
  346.  
  347. { *********  wi_putln  ********* }
  348. { store string in window }
  349.  
  350. procedure wi_putln ( no : integer ; st : _wst );
  351. begin
  352.   _wi_outln(no,st,false);
  353. end; {wi_putln}
  354.  
  355.  
  356. { *********  wi_get  ********* }
  357. { retrieve string from window }
  358.  
  359. procedure wi_get ( no, l : integer; var  st : _wst );
  360. begin
  361.   _wi_inp(no,l,st,false);
  362. end; {wi_get}
  363.  
  364.  
  365. { *********  wi_getln  ********* }
  366. { retrieve string from window }
  367.  
  368. procedure wi_getln ( no, l : integer; var  st : _wst );
  369. begin
  370.   _wi_inpln(no,l,st,false)
  371. end; {wi_getln}
  372.  
  373.  
  374. { *********  wi_write  ********* }
  375. { write string to screen thru window }
  376.  
  377. procedure wi_write ( no : integer; st : _wst );
  378. begin
  379.   _wi_out(no,st,true);
  380. end; {wi_write}
  381.  
  382.  
  383. { *********  wi_writeln  ********** }
  384. { write string to screen thru window }
  385.  
  386. procedure wi_writeln ( no : integer; st : _wst );
  387. begin
  388.   _wi_outln(no,st,true);
  389. end; {wi_writeln}
  390.  
  391.  
  392. { *********  wi_read  ********* }
  393. { read string from keyboard thru window }
  394.  
  395. procedure wi_read ( no : integer; l : integer; var st : _wst );
  396. begin
  397.   _wi_inp(no,l,st,true);
  398. end; {wi_read}
  399.  
  400.  
  401. { **********  wi_readln  ********** }
  402. { read string from keyboard thru window }
  403.  
  404. procedure wi_readln ( no : integer; l : integer; var st : _wst );
  405. begin
  406.   _wi_inpln(no,l,st,true);
  407. end; {wi_readln}
  408.  
  409.  
  410. { **********  wi_show  ********* }
  411. { display window to screen }
  412.  
  413. procedure wi_show ( no : integer );
  414. begin
  415.   _wi_sher(no,true);
  416. end; {wi_show}
  417.  
  418.  
  419. { *********  wi_erase  ********** }
  420. { blank window region on screen }
  421.  
  422. procedure wi_erase ( no : integer );
  423. begin
  424.   _wi_sher(no,false);
  425. end; {wi_erase}
  426.  
  427.  
  428.  
  429. { ********** internal functions and procedures ********** }
  430.  
  431. { **********  _wi_find  ********** }
  432. { locate window record in defined window list }
  433.  
  434. function _wi_find { no : integer ) : boolean};
  435. const
  436.   first : boolean = true;
  437. var
  438.   fnd : boolean;
  439. begin
  440.   _wi_find := false;
  441.   if first then begin
  442.     first := false;
  443.     _whd := nil;
  444.     _wp0 := nil;
  445.     _wp1 := nil;
  446.   end;
  447.   if (_wp1 <> nil) and (_wp1^._wno = no) then
  448.     _wi_find := true
  449.   else begin
  450.     _wp1 := _whd;
  451.     fnd := false;
  452.     while ((_wp1 <> nil) and (not fnd)) do begin
  453.       with _wp1^ do begin
  454.         if _wno = no then begin
  455.             _wi_find := true;
  456.             fnd := true;
  457.         end
  458.         else begin
  459.           _wp0 := _wp1;
  460.           _wp1 := _wnx;
  461.         end;
  462.       end;
  463.     end;
  464.   end;
  465. end; {_wi_find}
  466.  
  467.  
  468. { **********  _wi_stb  ********* }
  469. { build string }
  470.  
  471. procedure _wi_stb { var c; l : integer; var st : _wst};
  472. var
  473.   a : byte absolute c;
  474. begin
  475.   move(a,st[1],l);
  476.   move(l,st[0],1);
  477. end; {_wi_stb}
  478.  
  479.  
  480. { **********  _wi_bord1  ********** }
  481. { store window border string }
  482.  
  483. procedure _wi_bord1 { var b: _wbs };
  484. var
  485.   i : integer;
  486. begin
  487.   with _wp1^ do begin
  488.     for i := 1 to 4 do begin
  489.       if (length(b) >= i) then
  490.         _wbc[i] := b[i]
  491.       else
  492.         _wbc[i] := chr(0);
  493.     end;
  494.     if (_wbc[2] = chr(0)) then
  495.       _wbc[2] := _wbc[1];
  496.     if (_wbc[3] = chr(0)) then
  497.       _wbc[3] := _wbc[1];
  498.     if (_wbc[4] = chr(0)) then
  499.       _wbc[4] := _wbc[2];
  500.   end;
  501. end; {wi_bord1}
  502.  
  503.  
  504. { **********  _wi_bord2  ********* }
  505. { insert border into window }
  506.  
  507. procedure _wi_bord2;
  508. var
  509.   i : integer;
  510. begin
  511.   with _wp1^ do begin
  512.     if (_wb) then begin
  513.       for i := 1 to _wh do begin
  514.         _wch[(succ(pred(i)*_ww))] := _wbc[1];
  515.         _wch[((pred(i)*_ww)+_ww)] := _wbc[3];
  516.       end;
  517.       for i := 1 to _ww do begin
  518.         _wch[i] := _wbc[2];
  519.         _wch[(_wl-_ww+i)] := _wbc[4];
  520.       end;
  521.     end;
  522.   end;
  523. end; {_wi_bord2}
  524.  
  525.  
  526. { **********  _wi_out  ********** }
  527. { store string to window at current window position }
  528. { optionally, write string to screen at current screen position }
  529.  
  530. procedure _wi_out { var no : integer; var st : _wst; out : boolean};
  531. var
  532.   i, x, y : integer;
  533. begin
  534.   wi_status := false;
  535.   wi_eoln := false;
  536.   wi_eow := false;
  537.   if (_wi_find(no)) then begin
  538.     with _wp1^ do begin
  539.       if (_wy > _wr) then begin
  540.         wi_insln(no,_wy);
  541.         if (out) then
  542.           wi_show(no);
  543.       end;
  544.       i := 1;
  545.       while (i <= length(st)) and (_wx <= _wc) do begin
  546.         _wch[(_wrp[_wy]+_wx)] := st[i];
  547.         if (out) then begin
  548.           x := _wxo+_wx;
  549.           y := _wyo+_wy;
  550.           if (not _wb) then begin
  551.             x := pred(x);
  552.             y := pred(y);
  553.           end;
  554.           if ((x in _wxv) and (y in _wyv)) then  begin
  555.             gotoxy(x,y);
  556.             write(st[i]);
  557.           end;
  558.         end;
  559.         _wx := succ(_wx);
  560.         i := succ(i);
  561.       end;
  562.       if (_wx > _wc) then begin
  563.         _wx := 1;
  564.         _wy := succ(_wy);
  565.         wi_eoln := true;
  566.         if (_wy > _wr) then
  567.           wi_eow := true;
  568.       end;
  569.       wi_status := true;
  570.     end;
  571.   end;
  572. end; {_wi_out}
  573.  
  574.  
  575. { *********  _wi_outln  ********** }
  576. { store string to window at current window position }
  577. { optionally, write string to screen at current screen position }
  578.  
  579. procedure _wi_outln { var no : integer; var st : _wst; out : boolean};
  580. begin
  581.   _wi_out(no,st,out);
  582.   if (wi_status) then begin
  583.     with _wp1^ do begin
  584.       if (_wx > 1) then begin
  585.         fillchar(_wch[(_wrp[_wy]+_wx)],(succ(_wc-_wx)),' ');
  586.         if (out) then begin
  587.           if (pred(_wxo+_wx) in _wxv)
  588.               and (pred(_wyo+_wy) in _wyv) then begin
  589.             wi_clreol(no);
  590.           end;
  591.         end;
  592.         _wx := 1;
  593.         _wy := succ(_wy);
  594.         wi_eoln := true;
  595.         if (_wy > _wr) then
  596.           wi_eow := true;
  597.       end;
  598.     end;
  599.   end;
  600. end; {_wi_outln}
  601.  
  602.  
  603. { **********  _wi_getst  ********** }
  604. { get character string from terminal }
  605.  
  606. procedure _wi_getst { var l, x, y : integer; var s : _wst };
  607. const
  608.   bel = ^G;
  609.   bs = 08;
  610.   cr = 13;
  611.   del = 127;
  612. var
  613.   c : char;
  614.   bgn : integer;
  615.   eos : boolean;
  616. begin
  617.   s := '';
  618.   eos := false;
  619.   bgn := x;
  620.   repeat
  621.     gotoxy(x,y);
  622.     read(kbd,c);
  623.     case ord(c) of
  624.       del,bs : if (x > bgn) then begin
  625.               x := pred(x);
  626.               gotoxy(x,y);
  627.               write(' ');
  628.               delete(s,length(s),1);
  629.             end
  630.             else
  631.               write(bel);
  632.       $20..$7E : if (length(s) >= l) then
  633.                    write(bel)
  634.                  else begin
  635.                    s := s+c;
  636.                    gotoxy(x,y);
  637.                    write(c);
  638.                    x := succ(x);
  639.                  end;
  640.       cr : eos := true;
  641.       else  write(bel);
  642.     end;
  643.   until eos;
  644. end; { _wi_getst }
  645.  
  646.  
  647. { **********  _wi_inp  ********* }
  648. { retrieve string from window or from keyboard }
  649.  
  650. procedure _wi_inp { var no, l : integer;
  651.                        var st : _wst; inp : boolean};
  652. var
  653.   i, j, x, y : integer;
  654.   s : _wst;
  655. begin
  656.   wi_status := false;
  657.   if (_wi_find(no)) then begin
  658.     with _wp1^ do begin
  659.       st := '';
  660.       wi_eoln := false;
  661.       wi_eow := false;
  662.       if (_wy <= _wr) then begin
  663.         i := 1;
  664.         if (inp) then begin
  665.           s := '';
  666.           x := pred(_wxo+_wx);
  667.           y := pred(_wyo+_wy);
  668.           if (_wb) then begin
  669.             x := succ(x);
  670.             y := succ(y);
  671.           end;
  672.           if (_wxo in _wxv)
  673.               and (pred(_wxo+_ww) in _wxv)
  674.               and (_wyo in _wyv)
  675.               and (pred(_wyo+_wh) in _wyv) then begin
  676.             wi_status := true;
  677.             j := succ(_wc-_wx);
  678.             if (l > j) then
  679.               _wi_getst(j,x,y,s)
  680.             else
  681.               _wi_getst(l,x,y,s);
  682.           end
  683.           else begin
  684.             write(chr(7));
  685.             wi_status := false;
  686.           end;
  687.           if (length(s) < l) then begin
  688.             l := length(s);
  689.             if (l = 0) then
  690.               _wx := succ(_wx);
  691.           end;
  692.         end;
  693.         while (not wi_eoln) and (i <= l) do begin
  694.           with _wp1^ do begin
  695.             if (_wy <= _wr) then begin
  696.               j := (_wrp[_wy]+_wx);
  697.               if (inp) then
  698.                 _wch[j] := s[i];
  699.               st := st+_wch[j];
  700.               i := succ(i);
  701.               _wx := succ(_wx);
  702.               if (_wx > _wc) then begin
  703.                 _wy := succ(_wy);
  704.                 _wx := 1;
  705.                 wi_eoln := true;
  706.                 if (_wy > _wc) then
  707.                   wi_eow := true;
  708.               end;
  709.             end
  710.             else begin
  711.               wi_eow := true;
  712.               wi_eoln := true;
  713.             end;
  714.           end;
  715.           wi_status := true;
  716.         end;
  717.       end
  718.       else
  719.         wi_status := false;
  720.     end;
  721.   end;
  722. end; {_wi_inp}
  723.  
  724.  
  725. { *********  _wi_inpln  ********* }
  726. { retrieve string from window or from keyboard }
  727.  
  728. procedure _wi_inpln { var no, l : integer;
  729.                        var st : _wst; inp : boolean};
  730. begin
  731.   _wi_inp(no,l,st,inp);
  732. {gotoxy(1,23);}
  733. {clreol;}
  734. {write('stat=',wi_status,' eoln=',wi_eoln,' eow=',wi_eow);}
  735.   if (wi_status) then begin
  736.     if (not wi_eow) then begin
  737.       with _wp1^ do begin
  738.         if (_wy <= _wr) and (_wx > 1) then begin
  739.            _wx := 1;
  740.            _wy := succ(_wy);
  741.            wi_eoln := true;
  742.            if (_wy > _wr) then
  743.              wi_eow := true;
  744.         end;
  745.       end;
  746.     end;
  747.   end;
  748. end; {_wi_inpln}
  749.  
  750.  
  751. { **********  _wi_sher  ********* }
  752. { show/erase window from screen }
  753.  
  754. procedure _wi_sher { var no : integer; show : boolean };
  755. var
  756.   i, j, k, x, y : integer;
  757.   st : _wst;
  758. begin
  759.   wi_status := false;
  760.   if (_wi_find(no)) then begin
  761.     with _wp1^ do begin
  762.       j := pred(_wxo+_ww);
  763.       if (j <= _wxz) then
  764.         j := _ww
  765.       else
  766.         j := _ww-(j-_wxz);
  767.       if (_wxo >= 1) then begin
  768.         k := 1;
  769.         x := _wxo;
  770.       end
  771.       else begin
  772.         j := pred(_wxo+_ww);
  773.         k := succ(_ww-j);
  774.         x := 1;
  775.       end;
  776.       if (j > 0) then begin
  777.         if (not show) then begin
  778.           fillchar(st[1],j,' ');
  779.           move(j,st[0],1);
  780.         end;
  781.         for i := 1 to _wh do begin
  782.           y := pred(_wyo+i);
  783.           if (x in _wxv) and (y in _wyv) then begin
  784.             if (show) then begin
  785.               _wi_stb(_wch[((pred(i)*_ww)+k)],j,st);
  786.             end;
  787.             gotoxy(x,y);
  788.             write(st);
  789.           end;
  790.         end;
  791.       end;
  792.     end;
  793.     wi_status := true;
  794.   end;
  795. end; {_wi_sher}
  796.  
  797. { **********  End of Window Management Services  ********* }
  798.