Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : NEWBAR.ZIP
Filename : BAR.PRG

 
Output of file : BAR.PRG contained in archive : NEWBAR.ZIP
* Program..: Bar.PRG
* Author...: Jon Wind (original dBASE code)
* Author 2.: John Wright (modified for Clipper)
* Version..: Clipper - Summer '87 & Autumn '86
* Note(s)..: This program generates a status bar, for use when
* performing multiple searches, or lengthy calculations
* to graphically illustrate program status to the user.
*
* To show indexing type: BAR
*
IF PCOUNT() = 2
PARAMETERS dbf_ntx,fld_ntx
IF .NOT. FILE(dbf_ntx+".DBF")
??"Database not found..."
QUIT
ENDIF
STORE .T. TO data_ind
ELSE
STORE .F. TO data_ind
ENDIF

SET CURSOR OFF
CLEAR

* change color and draw box
SETCOLOR("G/N")
BUILDBAR(15,"Percent Completed")
SETCOLOR("W/N")

IF data_ind
SET DECIMALS TO 0
SET FIXED ON
* DO NOT show a bar while doing first index
@ 05,10 SAY "Indexing "+UPPER(dbf_ntx)+" database - no bar"
STORE TIME() TO tm1
USE (dbf_ntx)
STORE LASTREC() TO hmny
INDEX ON &fld_ntx TO BARTEST
STORE TIME() TO tm2
CLOS DATA
@ 07,10 SAY "No bar took "+ELAPSED(tm1,tm2)+" to index "+LSTR(hmny)+" records"

* show a bar while indexing a database
@ 10,10 SAY "Indexing "+UPPER(dbf_ntx)+" database - with bar"
STORE TIME() TO tm1
USE (dbf_ntx)
STORE LASTREC() TO hmny
INDEX ON &fld_ntx+BARSTAT(15,BAR_PCT()) TO BARTEST
STORE TIME() TO tm2
CLOS DATA
@ 12,10 SAY "With bar took "+ELAPSED(tm1,tm2)+" to index "+LSTR(hmny)+" records"

ERASE BARTEST.NTX

ELSE
* show a simple bar if not command line arguments were given.
cnt=0
DO WHIL cnt<101
BARSTAT(15,cnt,"w")
INKEY(.1)
cnt=cnt+1
ENDDO
ENDIF

@ 23,0
SET CURSOR ON
RETURN

******************************************************************************

FUNCTION BUILDBAR
PARAMETERS row,title
@ row,(80-LEN(title))/2 SAY title
@ row+2,13 SAY "0 10 20 30 40 50 60 70 80 90 100"
@ row+3,12 TO row+5,65 DOUB
@ row+4,14 SAY ""
RETURN ""


FUNCTION BARSTAT
PARAMETERS row,cnt
IF cnt > 0
@ row+4,14 SAY REPLICATE(CHR(219),cnt/2)
IF cnt/2 > INT(cnt/2) && odd #'s
??CHR(221)
ENDIF
ENDIF
RETURN ""


FUNCTION BAR_PCT
* Show the percentage done while indexing a database; used in BARSTAT.
* When an index starts the record pointer hits EOF first!
* Do not let this affect the display of percentage done.
RETURN IF(EOF(),0,INT((RECNO()/RECCOUNT())*100))


***********************>>> Misc UDFs <<<****************************

FUNCTION ELAPSED
* Syntax: ELAPSED(

  3 Responses to “Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : NEWBAR.ZIP
Filename : BAR.PRG

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/