home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / BASIC / GLIB14.ZIP / GLIB14.QRF < prev    next >
Encoding:
Text File  |  1988-02-06  |  17.4 KB  |  543 lines

  1.  
  2.                GLIB    Quick   Reference   Guide
  3.                  Version 1.4
  4.                Released: February  6, 1987
  5.  
  6.       GLIB 1.4 Index
  7.       --------------
  8.       BOXES ........... Outline one of 6 menu type boxes to the screen.
  9.       CHRP ............ Sound the speaker in a CHiRP fashion.
  10.       CLOFF / CLON .... Disengage-engage keyboard Caps Lock.
  11.       CLRKBD .......... Clear keyboard buffer of type-ahead keys.
  12.       CMDLINE ......... Parse the command line into a string array.
  13.       CPUINFO ......... Returns very low level system info, CPU type etc.
  14.       DATE ............ Returns current day, month, year and DOW as integers.
  15.   **  DAYOFYR ......... Returns the current day of the year (1 - 366).
  16.       DFRMAT .......... Date Formatting.
  17.   **  DLIGHT .......... Trigger a floppy disk light on.
  18.    *  DIR.............. Returns DOS directory in a string array.
  19.       DLRFRMAT ........ Numeric string formatting to Dollar conventions.
  20.       DLY ............. Delay for x number of seconds.
  21.       DOSV............. Return DOS Version installed.
  22.       DRVSPACE ........ Return total and free drive space.
  23.       ERRMSG .......... Display temporary message with color, sound control.
  24.       EXIST ........... Determines if a file exists on disk or not.
  25.       EXTMEM .......... Return the amount of Extended (AT) memory installed.
  26.       FADE ............ Screen fade or dissolve routine, maintains attributes.
  27.   **  FCOPY ........... Copy a file, as quickly as DOS.
  28.       FILCNT........... Returns the number of files in disk matching a mask.
  29.       FED ............. BASIC text input routine.
  30.   **  FEOF ............ Set file pointer to the end of a file.
  31.   **  FCREAT .......... Create a new file, returning a DOS File handle.
  32.   **  FOPEN ........... Open a disk file, getting a DOS file handle.
  33.   **  FUNIQ ........... Create a unique/temporary file.
  34.   **  FWRITE .......... Write a string to s file opened with a DOS handle.
  35.   **  GETCH ........... Allow input from predefined string.
  36.       GETDSEG ......... Returns BASIC's DS (Data Segment)
  37.   **  GET/SET FATTR ... Get, set or reset file attributes.
  38.       GETSTACK ........ Returns the state of BASIC's Stack.
  39.       GET/SET DRV ..... Get or set the default drive.
  40.       GET/SET VERFY ... Get or set the system VERIFY state.
  41.       GRAPH ........... Produce a Vertical or Horizontal graph from an array.
  42.   **  INCR / DECR ..... Replicate TURBO BASIC functions
  43.   **  INSON / INSOFF .. Toggle insert state on or off
  44.       KBLOOP .......... Enter a blind loop until a key is pressed.
  45.   **  LASTDRV ......... Return last logical drive on the system
  46.   **  LCOUNT .......... Count the number of lines in a text file QUICKLY.
  47.   **  LNAMEF .......... Swap names to last-name-first format.
  48.       MDLY ............ Delay processing for a number of milliseconds.
  49.   **  MCSRINC / MCSRDEC Decrement mouse cursor flag
  50.   **  MCSRON / MCSROFF    Mouse cursor on or off.
  51.   **  MGETXY .......... Get mouse cursor location
  52.   **  MLONG /MNORM .... Set / reset mouse Mickey Factor.
  53.   **  MPRESS .......... Get number of mouse button presses.
  54.   **  MRELEASE ........ Get number of mouse button releases.
  55.   **  MSETXY .......... Set mouse cursor location
  56.   **  MSETXRNG / MSETYRNG: Define/limit mouse work area.
  57.   **  MTYPE ........... Test for mouse existence, get number buttons
  58.       NFRMAT .......... Extensive Numeric string formatting.
  59.       NLOFF / NLON .... Disengage-engage Keyboard Num Lock
  60.       PCASE ........... Convert string to proper case.
  61.   **  PGETCH .......... GETCH with centered prompt.
  62.  
  63.  
  64.  
  65.       PINIT ........... Initialize the printer.
  66.       PFILE ........... Send a disk file to printer.
  67.       PRTSCRN ......... Print the current display on the printer.
  68.       PSTAT ........... Return the printer status.
  69.       QUIKPRT ......... Another implementation of BYTE's QPRINT routine.
  70.       RAMFREE ......... Returns memory installed in the system.
  71.   **  RINSTR .......... Returns LAST position of a char in a string
  72.   **  READSCRN ........ Quickly read a string from the CRT at currect location
  73.       RSTSCRN / SVSCRN. Restores a screen previously saved by SVSCRN
  74.       U-,D- SCROLL .... Scroll a portion of the screen up or down.
  75.       SCROLLER ........ Scroll the screen left or right.
  76.       SCRLOFF / SCRLON. Set Scroll Lock Off.
  77.       SCRNDUMP ........ Dump the current display to disk.
  78.       SETERR .......... Sets DOS "ERRORLEVEL" code upon program termination.
  79.       SINFO ........... Equipment info: RAM, parallel, serial, EGA and VGA.
  80.   **  SYSTIME ......... Return system time as integers.
  81.       TFRMAT .......... Time formatting
  82.   **  VFNAME .......... Test a string to see if it is a valid filename.
  83.   **  VIDOFF .......... Turn CRT off.
  84.   **  VIDON ........... Turn CRT back on.
  85.       WDW ............. Windowing subroutine with sound, color control.
  86.  
  87.       *  DIR is actually a facade for a FINDF and FNEXT Functions
  88.      **  NEW with this release.
  89.  
  90.  
  91.  
  92.  
  93.  
  94.                GizLib    Function   Summary
  95.                    Version 1.4
  96.  
  97.  
  98.     VIDEO Routines:
  99.       BOXES, ERRMSG, FADE, GRAPH, QUIKPRT, SCROLL, SCROLLER, SVSCRN,
  100.       RSTSCRN, SCRNDUMP, WDW, VIDON, VIDOFF, READSCRN, PGETCH
  101.  
  102.     STRING Manipulation Routines:
  103.       CMDLINE, DFRMAT, DLRFRMAT, NFRMAT, PCASE, TFRMAT, RINSTR,
  104.       LNAMEF, VFNAME
  105.  
  106.     DATA Entry/Formatting Routines:
  107.       DFRMAT, DLRFRMAT, ERRMSG, FED, KBLOOP, NFRMAT, WDW
  108.  
  109.     HARWARE Info Routines:
  110.       CPUINFO, SINFO, EXTMEM, RAMFREE
  111.  
  112.     KEYBOARD Routines:
  113.       CLON, CLOFF, NLON, NLOFF, SCRLON, SCRLOFF, CLRKBD, GETCH, PGETCH
  114.  
  115.     PRINTER Services:
  116.       PFILE, PINIT, PSTAT, PRTSCRN
  117.  
  118.     DOS and BIOS Sevice Routines:
  119.       DATE, DIR, DOSV, DRVSPACE, EXIST, FILCNT, SCROLL, SCROLLER, SETERR,
  120.       GETDRV, SETDRV, GETVERFY, SETVERFY, SYSTIME, FOPEN, FCLOSE,
  121.       FCREAT, FWRITE, FUNIQ, FCOPY
  122.  
  123.     MISC Routines:
  124.       CHRP, DLY, GETSTACK, GETDSEG, MDLY, DAYOFYR
  125.  
  126.  
  127.     Mouse Routines:
  128.       MCSRON, MCSROFF, MSETCSR, MSETXY, MGETXY, MSETXRNG, MSETYRNG,
  129.       MPRESS, MRELEASE, MTYPE, MCSRINC, MCSRDEC, MLONG, MNORM
  130.  
  131.  
  132.  
  133.     BOXES:  Send a box or frame to the screen via fast printing method.
  134.         box=[1 - 5] : frame=[1-4] : color=[1-31]
  135.         CALL boxes(box%,frame%,color%)
  136.  
  137.  
  138.     CHRP:   Sound speaker in quick ascending or descending "chirp".
  139.         1=up,  0=down
  140.         m=1              A "chirp" of the called tone
  141.         CALL CHRP(m)
  142.  
  143.  
  144.     CLON / CLOFF:  Toggle caps lock.
  145.            CALL CLON        ' toggles CAPS lock ON
  146.            CALL CLOFF        ' toggles CAPS lock off
  147.  
  148.  
  149.     CLRKBD:    Clear keyboard buffer of waiting keystrokes.
  150.            CALL clrkbd
  151.  
  152.  
  153.     CMDLINE:   Parse the command line into a string array using space as a
  154.            delimiter.
  155.            DIM arg$(x) : q=0
  156.            CALL cmdline(arg$(),q)
  157.  
  158.  
  159.     CPUINFO:   Get specific hardware configuration info.  See also SINFO.
  160.            idcode=0 : mhz=0 : cpu=0 : ndp=0
  161.            CALL cpuinfo(idcode%, mhz%, cpu%, ndp%)
  162.  
  163.  
  164.     DATE:  Get date from system clock as integers (vs the string DATE$).     m=0 : d=0 : y=0 : w=0
  165.        CALL date(m, d, y, w)
  166.  
  167.     DAYOFYR:   Get the day count for this year as of today.
  168.            DECLARE FUNCTION dayofyr%
  169.  
  170.     DFRMAT:     Format valid date integers to user friendly string.
  171.          CALL dfrmat(m, d, y, dt$)
  172.          Returns date formatted as "January 3, 1987"
  173.  
  174.  
  175.     DIR:   Fills string array with filenames matching a passed mask.
  176.        See also FILCNT.
  177.  
  178.        CALL dir(mask$, file$() )
  179.  
  180.        DIR.SUB is required (and provided) to simulate this
  181.        interface using separate DOS calls to fill the array.
  182.  
  183.  
  184.     DLIGHT:    Trigger a floppy drive light for demo realism.
  185.            DECLARE FUNCTION dlight%(drive%)
  186.  
  187.  
  188.  
  189.  
  190.     DLRFRMAT:  Format numerical string to specifications via a passed mode.
  191.            INPUT "Enter amount", nst$
  192.            mode=0 : decimalpt=0
  193.            CALL dlrfrmat(nst$, mode%, decimalpt%)
  194.            IF m=0 THEN PRINT nst$ ELSE GOTO getinfo
  195.              ' prints "$12.34"
  196.  
  197.  
  198.     DLY:  Delay processing a given number of seconds.
  199.       sec=3 : CALL dly(sec%)
  200.  
  201.  
  202.     DOSV:    Returns the DOS version as a whole number.
  203.          ver=0
  204.          CALL dosv(ver)         ' ver= Version * 100
  205.          ver= ver / 100         ' now 310 = 3.1 etc
  206.  
  207.  
  208.  
  209.     DRVSPACE:      Get free and or total disk space on designated drive.
  210.           On CALL, drive number to poll, 1= A:, 2=B: etc;
  211.           0=default, returns as sectors per cluster
  212.  
  213.           drv=0        ' read default drive
  214.           CALL drvspace(drv%, AvailClus, BytesSector, TotalClus,)
  215.           total#=CDBL(drv%)*CDBL(BytesSector)*CDBL(TotalClus%)
  216.           free#=CDBL(drv%)*CDBL(BytesSector%)*CDBL(AvailClus%)
  217.  
  218.  
  219.     ERRMSG:     Displays a fully used defined message on any line, with
  220.          built in screen display preservation, sound and color
  221.          control.
  222.  
  223.          msg$= " You goofed.  Try again"
  224.          lin = 24
  225.          attr= colors to use. attr=(back_ground*16)+fore_ground
  226.          sfx = Sound.  (0=none, 1=low tone).
  227.          CALL errmsg(msg$,lin%, attr%, sfx%)
  228.  
  229.  
  230.     EXIST:     Checks for the existance of a file.  Returns 0 if it does
  231.            not exist, nonzero if it does.
  232.  
  233.            fil$="MYPROG.DAT" : ex=0
  234.            CALL exist(fil$, ex%)
  235.  
  236.  
  237.     EXTMEM:    Returns installed Extended (AT's only) memory.
  238.            mem=0 : CALL extmem(mem%)
  239.  
  240.  
  241.     FADE:    Alternative to CLS, decrements each character on the screen by
  242.          17 until they equal 32 (the space).  No parameters are passed.
  243.          CALL fade
  244.  
  245.  
  246.  
  247.     FCOPY:   Copy a file about as quickly as DOS can:
  248.          DECLARE FUNCTIOn fcopy%(afil$, bfil$)
  249.          ErrorCode = fcopy(sourcefile$, destfile$)
  250.  
  251.     FCREAT:  Create a new file, retrieve DOS file handle
  252.          DECLARE FUNCTION fcreat%(fil$, attrib%, fhandle%)
  253.  
  254.     FOPEN:   Open an existing file, retrieving a file handle
  255.          DECLARE FUNCTION fopen%(fil$, mode%, fhandle%)
  256.  
  257.     FEOF:    Set file pointer to the end of a file opened with a handle.
  258.          DECLARE FUNCTION feof%(fhandle%)
  259.  
  260.     FWRITE:  Write a string to a file opened with a handle.
  261.          DECLARE FUNCTION fwrite%(text$, fhandle%)
  262.  
  263.     FUNIQ:   Create a unique or temporary file with a handle.
  264.          DECLARE FUNCTION funiq%(pathfil$, attrib%, fhandle%)
  265.  
  266.  
  267.     FED:     See FED.DOC
  268.  
  269.  
  270.     FILCNT:    Returns the number of files on disk matching a given mask.
  271.            Very useful in conjunction with DIR.
  272.  
  273.            mask$="*.ARC"
  274.            CALL filcnt(mask$, quan)
  275.               ' quan now holds the number of files  matching *.ARC
  276.  
  277.  
  278.     GRAPH.BAS:    Draw scaled graphs
  279.         ' produces vertical graph:
  280.         CALL vgraph(elmts%(), basis%, label$(), title$)
  281.  
  282.         ' produces horizontal graph:
  283.         CALL hgraph(elmts%(), basis%, label$(), title$)
  284.  
  285.  
  286.     GETDRV:     Get the default drive.
  287.          drv$=" "
  288.          CALL getdrv(drv$)
  289.  
  290.     GETFATTR:     Get file attributes.
  291.          DECLARE FUNCTION getfattr%(fil$)
  292.  
  293.     GETVERFY:     Get the system VERIFY switch setting.
  294.          CALL getverfy(switch)
  295.  
  296.     INCR/DECR:     Replicate Turbo BASIC's native functions:
  297.          DECLARE SUB incr%(x%, y%)
  298.          DECLARE SUB decr%(x%, y%)
  299.          ..
  300.          ..
  301.          incr x,y
  302.          decr j,q
  303.  
  304.  
  305.  
  306.     KBLOOP:   Control routine to watch or accept KB input for a specified
  307.           number of seconds, then return with an indicator.  Allows for
  308.           time or screen refresh and security KB input.
  309.  
  310.           label1:              ' demo for a security routine
  311.           kbin$=SPACE$(3) : LoopTime%=30 :    no$=CHR$(225)
  312.           CALL kbloop(kbin$, LoopTime%, no$)
  313.           .
  314.           .    Screen refreshes or security routines
  315.           .
  316.           IF kbin$=no$ THEN GOTO label1
  317.  
  318.     LASTDRV:  Return last logical drive installed on the system.
  319.           DECLARE FUNCTION lastdrv%
  320.  
  321.     LCOUNT:   Quickly count lines in a text file, requires a file handle
  322.           DECLARE FUNCTION lcount%(fhandle%)
  323.  
  324.     LNAMEF:   Swap names in a string to first-name-last format.
  325.           DECLARE FUNCTION lnamef%(text$+" ")
  326.  
  327.  
  328.     MCSRON:   Unconditionally set mouse cursor on or off.
  329.     MCSROFF   CALL mcsron: CALL mcsroff
  330.  
  331.  
  332.     MCSRINC:  Increment or decrement the mouse cursor flag
  333.     MCSRDEC   CALL mcsrinc: CALL mcsrdec
  334.  
  335.  
  336.     MPRESS:   Get number of mouse button presses since last query
  337.           CALL mpress(mleft, mright)
  338.  
  339.  
  340.     MLONG:    Set or reset the mouse's mickey factor.
  341.     MNORM     CALL mlong: CALL mnorm
  342.  
  343.  
  344.     MRELEASE: Get number of mouse button releases since last query.
  345.           CALL mrelease(mleft, mright)
  346.  
  347.     MGETXY:   Set mouse cursor location in 80x25 text modes.
  348.           CALL mgetxy(mrow, mcol)
  349.  
  350.     MSETXY:   Set mouse cursor location.  Works in 80x25 modes.
  351.           CALL msetxy(12,20)
  352.  
  353.     MSETXRNG: Limit the active mouse arena.
  354.     MSETYRNG     CALL msetxrng(1,5,20)        ' limit x in 80*25
  355.          CALL msetyrng(0,100, 150)    ' limit y via pixel coords
  356.  
  357.     MTYPE:    See if mouse is installed, and how many buttons.
  358.           CALL mtype(RatExists)
  359.           IF RatExists...
  360.  
  361.  
  362.  
  363.     MENUCTRL: Traps keyboard input, returning 1 - 10 or 15 indicating
  364.           which number key or Function key was input.
  365.  
  366.           CALL menuctrl(ky)
  367.  
  368.           SELECT CASE ky
  369.           ... etc
  370.  
  371.  
  372.     MDLY:     Delay or halt processing for a number of milliseconds.
  373.           CALL mdly(500)
  374.  
  375.  
  376.     NFRMAT:   Format numeric strings such as phone, account or social
  377.           security numbers
  378.  
  379.           nstring$ = String to process, returns formatted.
  380.           mode = Level or formattting mode (0-6).
  381.           p = Position of delimieter for mode 6
  382.           CALL nfrmat(nstrng$,mode%,p%)
  383.  
  384.           (See full documentation for possibilities on return.)
  385.  
  386.  
  387.     NLOFF/NLON:   Turns on or off the Num Lock key (and LED if applicable).
  388.           CALL nlon              ' NUMS on
  389.           CALL nloff              ' NUMS off
  390.  
  391.  
  392.     PCASE:    Converts string to proper case.
  393.           CALL lcase(text$)          ' QB 3
  394.           text$=lcase$(text$)         ' QB 4
  395.           CALL pcase(text$)          ' Any
  396.  
  397.  
  398.     PFILE:    Send a disk file to the first printer.
  399.           fil$="ANYTEXT.FIL"
  400.           CALL pfile(fil$)
  401.  
  402.  
  403.     PINIT:    Initialize a designated printer in the range of 1-3.
  404.           ptrnum=1
  405.           CALL pinit(ptrnum)
  406.  
  407.  
  408.     PRTSCRN:  Sends the current screen display to the printer.
  409.           CALL prtscrn
  410.  
  411.  
  412.     PSTAT:    Returns the status of a given printer 1 - 3.
  413.           ptrnum=1
  414.           CALL pstat(ptrnum)
  415.           IF ptrnum THEN PRINT "Printer is rip-roarin' ready!"
  416.  
  417.  
  418.  
  419.     QUIKPRT:  Very fast replacement for BASIC's PRINT statement.
  420.           text$ - Text string to QUIKPRT to the screen
  421.           row - Row of screen to print text to.
  422.           col - Column of screen to print to
  423.           attr - color attributes to use for the text.  This is
  424.              calculated in the same manner as the attribute is
  425.              for WDW, ERRMSG and others that use it:
  426.              attr=(BACKGROUND * 16) + FOREGROUND
  427.  
  428.           CALL quikprt(msg$, row%, col%, attr%)
  429.  
  430.  
  431.     RAMFREE:  Return RAM installed on machine. See also SINFO, CPUINFO.
  432.           mem=0 : CALL ramfree(mem%)
  433.           PRINT "Free memory amount is: ";mem
  434.  
  435.  
  436.     RINSTR:   Return the last occasion of a cahr in a string:
  437.           DECLARE FUNCTION rinstr%(strng$, char$)
  438.  
  439.  
  440.     READSCR:  Read characters from the screen, much faster than BASIC's
  441.           SCREEN x,y could HOPE to.
  442.           text$=SPACE$(20)
  443.           LOCATE 12,15
  444.           CALL readscrn(text$)     ' read 20 chars from 12,15
  445.  
  446.  
  447.     RSTSCRN / SVSCRN:  Screen save and restore from dynamic array.
  448.  
  449.          REM $DYNAMIC
  450.          REDIM scrnarry(6000)
  451.  
  452.          segptr1=VARSEG(scrnarry(1))
  453.          sptr1=VARPTR(scrnarry%(1))
  454.  
  455.          segptr3=VARSEG(scrnarry(4000))
  456.          sptr3=VARPTR(scrnarry%(4000))
  457.  
  458.          CALL rstscrn(segptr1, sptr1)
  459.          CALL svscrn(segptr3, sptr3)
  460.  
  461.  
  462.  
  463.      D-, USCROLL:    Scroll a "window" on the screen up or down a given
  464.              number of lines. Scrolled lines are lost.
  465.  
  466.            num - number of lines to scroll up or down
  467.            top and bttm are the top and bottom lines to scroll [1-25]
  468.            lft and rt are the left and right columns to scroll [1-80]
  469.  
  470.            CALL dscroll(num%, top%, lft%, bttm%, rt%)
  471.            CALL uscroll(num%, top%, lft%, bttm%, rt%)
  472.  
  473.  
  474.     SCRLOFF/SCRLON:  Turns the scrtoll lock keys on or off.
  475.              CALL scrloff
  476.              CALL scrlon
  477.  
  478.  
  479.  
  480.     SCRNDUMP: Saves the surrent screen to a disk file.
  481.           OPEN "scrndump.fil" FOR APPEND AS #6
  482.           CALL scrndump(6)
  483.           CLOSE #6
  484.  
  485.  
  486.     SCROLLER:  Scroll the screen left or right.
  487.            CALL scroller(5)
  488.            CALL scroller(-15)
  489.  
  490.  
  491.     SETERR:  Terminates program execution and sets return code.
  492.          ercode = 5
  493.          CALL seterr(ercode%)
  494.  
  495.  
  496.     SETFATTR:     Set file attributes.
  497.          DECLARE FUNCTION setfattr%(fil$)
  498.  
  499.     SINFO:   Returns basic hardware configuration:
  500.          RAM installed, serial and parallel ports, EGA RAM, and if VGA
  501.          is installed.
  502.  
  503.          CALL sinfo(mem, ser, par, ega, vga)
  504.  
  505.          Note: EGA returns as RAM Kb amount: 64k, 128k, 256k or 0 for
  506.          no EGA.  VGA returns 0/1 as yes or no, one is installed.  All
  507.          GLIB video routines automatically check if EGA is instaled and
  508.          act accordingly.
  509.  
  510.  
  511.     SYSTIME: Read the system clock and convert to hours, minutes, seconds
  512.          and hundredths.  Faster than parsing TIME$.
  513.          CALL systime(h, m, s, hh)
  514.  
  515.  
  516.     TFRMAT:  Formats time to 12 hour clock.  Mode indicates label on/off.
  517.          CALL tfrmat(nutime$, mode)
  518.          PRINT nutime$
  519.  
  520.  
  521.  
  522.     VFNAME:  Test a string to see if it is a valid filename.
  523.          DECLARE FUNCTION vfname%(fil$, DosCode%)
  524.          LINE INPUT "", fil$
  525.          InvalidCahr=vfname(fil$, DosCode)
  526.  
  527.  
  528.  
  529.     VIDOFF:  Turn off the CRT beam for mono, EGA, and CGA.
  530.          CALL vidoff
  531.  
  532.     VIDON:   Turn on CRT beam.
  533.          CALL vidon
  534.  
  535.     WDW:  Put window on screen with full color, frame and sound control.
  536.         FR    -  Frame Style:
  537.            1 - DBL H / DBL V      2 - DBL H / SGL V
  538.            3 - SGL H / SGL V      4 - SGL H / DBL V
  539.  
  540.        ATTR -  Color attributes for the window.   attr= (bg*16)+fg
  541.  
  542.        CALL wdw(top, left, bot, rt, sfx, gro, fr, attr, l$)
  543.