The Clarion Advisor: Speed up your APP debugging with a PRJ

by Dave Harms

Published 1999-02-08    Printer-friendly version

If you get an error when compiling an application, and the offending code is in an embed point, the IDE will (usually) take you to that embed point so you can correct the problem. If the error is in the generated code, or in an included source file (such as class source), you'll be taken to the source editor.

The only problem with this is that when you're fixing errors, the editor window is modal. You can't switch to or load another file. This is only a problem when you're using applications, however. If you're hand coding, you get a normal MDI source window on a compile error. Therefore the way to get around the modal error editor window is to temporarily treat your application as if it's a hand coded program, and to do this you need to create a project file.

In order for the compiler and linker to create an EXE or DLL from Clarion source, they need a set of project statements. A typical set of these statements is shown in Listing 1.

Applications have the project statements embedded in the .APP file, but it's quite easy to get the information out of the app and into a project file.

First, export the application to an appname.TXA file, using the File|Export Text menu option. Then search appname.TXA for this string:

[PROJECT]

Copy everything from the line following [PROJECT] to the start of the next header, which should be [PROGRAM]. The last line in the project is normally the #link statement. Paste this source into a new file, and give it the name appname.PR or appname.PRJ.

There's no difference between a PR file and a PRJ file except that if you open a PR file with Clarion it will open as a straight text file, and if you open a PRJ file Clarion brings up the project editor, which is what you're used to seeing when you choose Project|Edit while you have your application open.

Close your application and use Project|Set to choose the .PR or .PRJ file you created. Now compile your application. When the compiler comes to an error, it will display it in a non-modal editor window, and you can load whatever other source files you like.

This approach is also helpful when you have a really nasty bug to fix. Sometimes the only way to do this is to cut away at your program until you've reduced it to the smallest possible program that duplicates the error. Rather than go through a bunch of change/generate/compile cycles, create a text project and hack away at the source to your heart's content. You only need to regenerate the app to get back to your original code.

Listing 1: Project statements for compiling a small 32 bit application with full debug.
#noedit
#system win32
#model clarion dll
#pragma debug(vid=>full)
#pragma define(profile=>on)
#compile "cciprof.clw" /define(profile=>off)
#compile "ccidebug.clw" /define(profile=>off)
#compile "TESTBC0.CLW" /define(GENERATED=>on) -- GENERATED
#compile "TESTBC.CLW" /define(GENERATED=>on) -- GENERATED
#compile "test.clw" /define(GENERATED=>on) -- GENERATED
#compile "test001.clw" /define(GENERATED=>on) -- GENERATED
#compile "test002.clw" /define(GENERATED=>on) -- GENERATED
#compile "test003.clw" /define(GENERATED=>on) -- GENERATED
#compile "test004.clw" /define(GENERATED=>on) -- GENERATED
#compile "test005.clw" /define(GENERATED=>on) -- GENERATED
#compile "test006.clw" /define(GENERATED=>on) -- GENERATED
#compile "test007.clw" /define(GENERATED=>on) -- GENERATED
#compile "test008.clw" /define(GENERATED=>on) -- GENERATED
#pragma link("C5ASC%X%%L%.LIB")
#pragma link("C5MSS%X%%L%.LIB") -- GENERATED
#pragma link("C5ODB%X%%L%.LIB") -- GENERATED
#link "test.EXE"

David Harms is an independent software developer and the editor and publisher of Clarion Magazine. He is also co-author with Ross Santos of Developing Clarion for Windows Applications, published by SAMS (1995), and has written or co-written several Java books. David is a member of the American Society of Journalists and Authors (ASJA).

Printer-friendly version

 
 

Search

 

Advanced Search
Topical Index

Related Articles

Subscribe to
ClarionMag

One year: $184

(includes all back issues since '99)

Renewals from $134

Two years: $274

Renewals from $224

More Info

Subscribe Now!

ClarionMag Blog

RSS Feeds

Updates via Email

Enter your Email


Powered by FeedBlitz

Quick Links