The Database Managers, Inc.

Contact The Database Managers, Inc.


Use an RSS enabled news reader to read these articles.Use an RSS enabled news reader to read these articles.

DataFlex Decompiler
Page 5

Compiling DataFlex Programs

by Curtis Krauskopf

More Improvements

Emilio Moura sent an email that gave his solution for compiling multiple DataFlex programs. His solution uses the ERRORLEVEL setting. DFCOMP sets this to 1 when there is a compile-time error. I verified backward compatibility by testing this on an old DataFlex 2.3 development license.

The error reporting in Emilio's solution is also improved by logging the file names of programs with compile-time errors into a text file. When compilation is finished, his batch file checks if the error log file exists -- if so, he simply has it typed to the screen. I like this solution much better than the "File Not Found means there were no compile-time errors" message in my earlier version.

I have merged the best features of Emilio's solution with the dfc.bat batch file. This is the result:

dfc.bat:

@echo off

REM dfc.bat:
REM   Created by Curtis Krauskopf
REM   October 9, 2003
REM   The Database Managers, Inc.
REM   http://www.decompile.com
REM   Permission to use this batch file is granted
REM   provided this banner stays in the file.
REM   June 23, 2006:  Portions improved by Emilio.

if x%1==x goto instructions

REM   Eliminate all .ERR files.  Create one .ERR file
REM   so that the del command doesn't complain that
REM   no files were deleted.
echo x > 1.err
del /q *.err
if exist error.txt del error.txt

REM   Compile the %1 parameter
:compileAgain
for %%s in (%1) do call _dfc.bat %%s
shift
if x%1 NEQ x goto compileAgain
cls
if exist error.txt more error.txt

goto done

:instructions
echo   You need to provide a filename (with optional
echo   wildcards) that is used to compile the programs.
echo     Example:  %0 AP*.src menu.src GL*.src
:done

_dfc.bat:

@echo off

REM _dfc.bat:
REM   This is a helper batch file for dfc.bat

dfcomp %1 -v1fskw
if errorlevel 1 goto errorfound
goto finish                    
:errorfound                    
echo %1 >>error.txt
:finish                        

Emilio's solution uses two batch files. In this implementation, I've named them dfc.bat and _dfc.bat. The second batch file, _dfc.bat, is a helper batch file for the main dfc.bat batch file. The reason we need a second batch file is because the for-do command can only take one parameter but we need to do multiple things (compile the file, check the error level and append to a text file).

The example command line is still the same:

dfc AP*.src menu.src AR*.src

Go Back to Page: 1   2   3   4
Next: Summary
Copyright 2003-2010 The Database Managers, Inc.

 

DataFlex: Tips | Freeware | WebApp Server | Books | Links
Services | Programming | Contact Us | Recent Updates

Send feedback to: