home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / GFXFX2.ZIP / UNITINT.ZIP / U_MISC.INT < prev    next >
Text File  |  1995-02-14  |  4KB  |  186 lines

  1.  
  2. (*
  3. ** General purpose unit. Formaly named 'BCRT' from Bas-CRT.
  4. ** Made by Bas van Gaalen
  5. *)
  6.  
  7. {$v-}
  8.  
  9. unit u_misc;
  10.  
  11. interface
  12.  
  13. uses dos,u_txt,u_kb;
  14.  
  15. const
  16.   pos_hi=1; pos_lo=2; pos_le=4; pos_mi=8; pos_ri=16;
  17.   menuitems:byte=1;
  18.  
  19.   crsrins   = 20992;
  20.   crsrup    = 18432;
  21.   crsrdown  = 20480;
  22.   crsrleft  = 19200;
  23.   crsrright = 19712;
  24.   crsrhome  = 18176;
  25.   crsrend   = 20224;
  26.   crsrpgup  = 18688;
  27.   crsrpgdn  = 20736;
  28.   crsresc   = 27;
  29.   crsrcr    = 13;
  30.   crsrtab   = 9;
  31.   crsrbs    = 8;
  32.   crsrstab  = 3840;
  33.   crsrchome = 30464;
  34.   crsrcend  = 29952;
  35.   crsrdel   = 21248;
  36.   crsrf1    = 15104;
  37.   crsrf2    = 15360;
  38.   crsrf3    = 15616;
  39.   crsrf4    = 15872;
  40.   crsrf5    = 16128;
  41.   crsrf6    = 16384;
  42.   crsrf7    = 16640;
  43.   crsrf8    = 16896;
  44.   crsrf9    = 17152;
  45.   crsrf10   = 17408;
  46.   crsr0     = 48;
  47.   crsr1     = 49;
  48.   crsr2     = 50;
  49.   crsr3     = 51;
  50.   crsr4     = 52;
  51.   crsr5     = 53;
  52.   crsr6     = 54;
  53.   crsr7     = 55;
  54.   crsr8     = 56;
  55.   crsr9     = 57;
  56.  
  57. type
  58.   str80=string[80];
  59.   casetype=(efirst,ofirst,all,nocap);
  60.   charset=set of char;
  61.   menutype=array[1..20,1..2] of str80;
  62.   inputbtype=record
  63.     destructive,
  64.     persistant,
  65.     initinsert,
  66.     updownescape:boolean; { updownescape not implemented yet }
  67.   end;
  68.  
  69. var
  70.   inputbehave:inputbtype;
  71.  
  72. {----------------------------------------------------------------------------}
  73.  
  74. procedure fillx(                         { write string and fill out to xlen }
  75.   targetstr:string;
  76.   fillcharac:char;
  77.   xposition,
  78.   yposition,
  79.   xlen,
  80.   strcolour:byte);
  81.  
  82. procedure nwindow(                                             { draw window }
  83.   xi,yi,xf,yf:byte;
  84.   title:str80;
  85.   titlepos,
  86.   titleattr,
  87.   boxattr,
  88.   shadowattr:byte);
  89.  
  90. function input(                                     { Enhanced input routine }
  91.   xi,yi:byte;
  92.   var editline:str80;
  93.   allowed:charset;
  94.   maxlen,
  95.   color,
  96.   endcolor:byte;
  97.   uppcase:casetype;
  98.   endpos:byte):word;
  99.  
  100. procedure ansiwrite(                                     { Display ansi file }
  101.   var addr1,addr2;
  102.   blklen:integer);
  103.  
  104. function dncase(                                                  { downcase }
  105.   c:char):char;
  106.  
  107. function strup(const                           { convert string to uppercase }
  108.   source:string):string;
  109.  
  110. function strdn(const                            { convert string to downcase }
  111.   source:string):string;
  112.  
  113. function epos(                                      { Enhanced 'pos'-command }
  114.   const str:string;
  115.   ch:charset;
  116.   xst:byte):byte;
  117.  
  118. function rpos(                                       { reversed enhanced pos }
  119.   schars:charset;
  120.   sstr:string):byte;
  121.  
  122. procedure scrollbar(                            { display vertical scrollbar }
  123.   xi,
  124.   yi:byte;
  125.   curpos,
  126.   scrlen,
  127.   nofitems:word;
  128.   colattr:byte);
  129.  
  130. function menubar(                      { 'tagbar' a-la GEcho and compatibles }
  131.   mx,
  132.   my,
  133.   cx,
  134.   cy,
  135.   by,
  136.   ma,
  137.   ca,
  138.   ba,
  139.   barwi,
  140.   items:byte;
  141.   menu:menutype):byte;
  142.  
  143. function askyesno:boolean;
  144.  
  145. function lz(                                                { leading zero's }
  146.   w:word;
  147.   maxlen:byte):string;
  148.  
  149. function equal(                                     { compare two structures }
  150.   var struc1,struc2;
  151.   size:word):boolean;
  152.  
  153. function bitson(                             { check if bits in byte are set }
  154.   testbyte,bitsnr:byte):boolean;
  155.  
  156. procedure trim(                                     { trim chars from string }
  157.   var data:string;
  158.   check:char);
  159.  
  160. function forceslash(                       { add back-slash, if none present }
  161.   data:pathstr):string;
  162.  
  163. function noslash(                            { delete back-slash, if present }
  164.   data:pathstr):string;
  165.  
  166. procedure timerbar(                                     { 'percent-done' bar }
  167.   xi,
  168.   yi,
  169.   len,
  170.   setcol,
  171.   notsetcol:byte;
  172.   curnum,
  173.   maxnum:word);
  174.  
  175. function dotted(                            { add dots at thousand-intervals }
  176.   var s:string):string;
  177.  
  178. function hexbyte(                        { convert byte-value to hexadecimal }
  179.   v:byte):string;
  180.  
  181. function hexword(                        { convert word-value to hexadecimal }
  182.   v:word):string;
  183.  
  184. implementation
  185.  
  186.