Dec 102017
 
Aston Tate dBase IV Tech Notes for Feb 90. Useful information.
File TN9002.ZIP from The Programmer’s Corner in
Category Dbase Source Code
Aston Tate dBase IV Tech Notes for Feb 90. Useful information.
File Name File Size Zip Size Zip Type
COMPILIN.TXT 8565 2975 deflated
DATABASE.TXT 25401 8331 deflated
EXPLODIN.TXT 2480 1068 deflated
IIFY_REP.TXT 17182 6306 deflated
PLAY_IT_.TXT 7681 3086 deflated
PUTTING_.TXT 4650 2040 deflated

Download File TN9002.ZIP Here

Contents of the COMPILIN.TXT file


Compiling From Within

Michael P. Dean

Ever want to compile all of your programs in one easy step? You could
use the BUILD program, but, wouldn't you rather do it from within
dBASE. PrgComp will do just that! Then, if you want just one .DBO
file for distribution, you can use the DBLINK program to link all off
your .DBO files into one .DBO file (see Programming with dBASE IV for
instructions on the dBLINK.EXE program). Programming with dBASE IV
comes with the Developer's Edition of dBASE IV. The documentation for
dBLINK is also available for download from our BBS (DBLINK.DOC)

PrgComp.PRG will also
Compile Screen formats (FMT), Report Forms (FRM), Labels
(LBL), Queries (QBE) or Program files (PRG).

Create a database file of all files in the directory of your
choice with the DOS file size and date.

Create a .DAT file that contains a list of all files that were
compiled with all error Messages that were encountered during the
compile process. All the Object files will be in the directory that
the source code files existed but the .DAT file and the database file
mentioned above will be in the directory that the PrgComp program
exists.

Show the file that is being compiled and a line count of the
lines that are being compiled, except for reports and labels, where it
shows the name of the template of the report/label.

And, here is all that you have to do. Create a database file called
PrgComp with on field called PrgName with a size of 31 and index set
to Y. This file must be in the directory with PrgComp.PRG (which does
not have to be in every directory that you have .PRG files, it only
has to be in one directory). When you start the program, if the
directory that has the PrgComp program in it is in your dBASE path, or
if PrgComp is in the directory that has the programs that you wish to
compile just type

DO PrgComp WITH "",""

and PrgComp will compile all the files of that type in the current
directory. If however, you are in the directory that contains the
PrgComp files and you wish to compile programs in another directory,
just type in

DO PrgComp WITH ":",""

For example

DO PrgComp with "C:\Mydir","FMT"

will compile all screen forms in the Mydir directory of drive C.
Notice that there is no ending backslash.

The file type can be FMT, FRM, LBL, QBE or PRG


Happy compiling! t

* Program ...: PrgComp.PRG
* Author ....: Michael P. Dean
* Date ......: 11/24/89
* Versions ..: dBASE IV Version 1.0 & 1.1
* Notes .....: Create a database of all .PRGs and Compile them.

PARAMETERS sys_dir,sys_filetype

sys_dir = UPPER(sys_dir)
sys_filetype = UPPER(sys_filetype)

*-- The sys_dir memory variable will tell PrgComp which directory has the
* files to compile.

*-- The sys_filetype memory variable will tell PrgComp what type of file it is
* supposed to compile (PRG,FMT,FRM,QBE,...)

*-- Make sure the file type is one of the available formats.
IF sys_filetype # "PRG" .AND. sys_filetype # "FMT" .AND. sys_filetype # "QBE";
.AND. sys_filetype # "FRM" .AND. sys_filetype # "LBL"
CLEAR
@ 7, 5 SAY "The available formats for compiling are:"
@ 9, 5 SAY "PRG - Programs"
@ 10, 5 SAY "FMT - Screen Formats"
@ 11, 5 SAY "QBE - Query By Example"
@ 12, 5 SAY "FRM - Reports"
@ 13, 5 SAY "LBL - Labels"
RETURN
ENDIF

IF RIGHT(sys_dir,1) = "\"
CLEAR
@ 8, 5 SAY "When entering the directory that contains the Programs that you"
@ 9, 5 SAY "wish to compile, do not enter an ending Backslash"
@ 11, 5 SAY 'Correct Example: DO PrgComp WITH "C:\Myprg"'
@ 12, 5 SAY 'Incorrect Example: DO PrgComp WITH "C:\Myprg\"'
RETURN
ENDIF

*-- Set up Working Environment.
sys_clock = SET("CLOCK")
sys_console = SET("CONSOLE")
sys_path = SET("PATH")
sys_safety = SET("SAFETY")
sys_status = SET("STATUS")
sys_talk = SET("TALK")
sys_trap = SET("TRAP")

*-- The memory variable sys_error will determine if any errors occur during
* the compilation of a program.
sys_error = .F.

SET CLOCK OFF
SET PATH TO &sys_dir
SET SAFETY OFF
SET STATUS OFF
SET TALK OFF
SET TRAP OFF

*-- See if the an old text file listing of all .PRGs exists and delete
* it if it does.
IF FILE("PrgComp.TXT")
ERASE PrgComp.TXT
ENDIF

*-- Start Procedure.
CLEAR
IF "" # sys_dir
@ 10,5 SAY "Putting together a list of all ." + sys_filetype ;
+ " Files for " + sys_dir
ELSE
@ 10,5 SAY "Putting together a list of all ." + sys_filetype ;
+ " Files in current directory"
ENDIF

*-- Create the file listing in a text file.
IF "" # sys_dir
sys_filespec = sys_dir + "\*." + sys_filetype
ELSE
sys_filespec = "*." + sys_filetype
ENDIF
RUN DIR &sys_filespec >PrgComp.TXT

*-- Use the database that will contain the list of .PRG files, and Erase all
* current records.
SELECT 10
USE PrgComp ORDER PrgName
ZAP

*-- Append the text file into the database.
APPEND FROM PrgComp.TXT SDF

*-- Delete all records that do contain a valid filename.
DELETE FOR .NOT. sys_filetype $ PrgName

*-- Delete the record that has this file listed.
SEEK "PRGCOMP"
IF FOUND()
DELETE
ENDIF
PACK
GO TOP
IF RECCOUNT() = 0
CLEAR
SET CLOCK &sys_clock
SET CONSOLE &sys_console
SET PATH TO &sys_path
SET SAFETY &sys_safety
SET STATUS &sys_status
SET TALK &sys_talk
SET TRAP &sys_trap
@ 8,5 SAY "There are no files with a " + sys_filetype + " extension."
CLOSE ALL
RETURN
ENDIF
CLEAR

*-- Disable the error checking.
ON ERROR ?? ""

*-- See if an old copy of the data file that contains the results of the
* compilations exists and delete it if it does.
sys_dat = "\PrgComp.DAT"
IF FILE(sys_dat)
ERASE &sys_dat
ENDIF

*-- Setup the new Data file.
SET ALTERNATE TO PrgComp.DAT
SET ALTERNATE ON

*-- Insert the current date and time into the PrgComp.DAT file
? "Current Date: " + DTOC(DATE())
? "Time: " + TIME()
?

*-- Start the loop that will compile all programs.
DO WHILE .NOT. EOF()
IF "" # sys_dir
sys_file = sys_dir + "\" + RTRIM(SUBSTR(prgname, 1, 8))
ELSE
sys_file = RTRIM(SUBSTR(prgname, 1, 8))
ENDIF

*-- Erase the current compiled file for a clean compilation.
sys_compiled = sys_file + "." + SUBSTR(sys_filetype, 1, 2) + "O"
ERASE &sys_compiled

@ 9,14 SAY ""
?? "Compiling: " + sys_file + "." + sys_filetype + SPACE(10)
SET TALK on
DO CASE
CASE sys_filetype = "PRG"
COMPILE (sys_file)

CASE sys_filetype = "FMT"
SET FORMAT TO (sys_file)
SET FORMAT TO

CASE sys_filetype = "QBE"
SELECT 1
SET VIEW TO (sys_file)
USE
SELECT 10

CASE sys_filetype = "FRM"
REPORT FORM (sys_file) NEXT 1

CASE sys_filetype = "LBL"
LABEL FORM (sys_file) NEXT 1

ENDCASE
SET TALK off
sys_error = IIF(ERROR() > 0 .AND. ERROR() # 12 ,.T.,;
IIF(sys_error, .T., .F.))

* Error number 12 is "VARIABLE NOT FOUND", which you will get when running
* reports and labels because the correct database will not be used; however,
* this will not affect the compile process

?
?
CLEAR
SKIP
ENDDO
?
? "********************* End of Program List *********************"

*-- Close the Alternate file
SET ALTERNATE TO
ON ERROR
CLEAR

*-- Reset Environment.
USE
SET CLOCK &sys_clock
SET CONSOLE &sys_console
SET PATH TO &sys_path
SET SAFETY &sys_safety
SET STATUS &sys_status
SET TALK &sys_talk
SET TRAP &sys_trap

*-- Display exit message
IF sys_error
@ 10,13 SAY "There were some compile errors, please see PrgComp.DAT"
ELSE
@ 10,8 SAY "For a list of the Programs that were compiled, See PrgComp.DAT"
ENDIF

*-- Release all used memory variables
RELEASE ALL LIKE sys_*

* EoF: PrgComp.PRG




 December 10, 2017  Add comments

Leave a Reply