Related articles |
---|
Code Generators kwheinri@sunee.uwaterloo.ca (Kenn Heinrich) (1991-04-12) |
Code Generators michael_lichak@powersurfr.com (Mike Lichak) (1998-08-22) |
Re: Code Generators cfc@world.std.com (Chris F Clark) (1998-08-24) |
Re: Code Generators genew@vip.net (1998-08-24) |
Re: Code Generators joachim.durchholz@munich.netsurf.de (Joachim Durchholz) (1998-08-25) |
Re: Code Generators khays@sequent.com (1998-08-25) |
Re: Code Generators amoroso@mclink.it (1998-08-25) |
From: | Mike Lichak <michael_lichak@powersurfr.com> |
Newsgroups: | comp.compilers |
Date: | 22 Aug 1998 23:30:14 -0400 |
Organization: | Compilers Central |
Keywords: | tools, practice |
Here's the input file for an report generator I wrote several years ago.
Forgive the length John. It the shortest one I could find.
PROC DEF2
REP( ;
REPDEF([mNAME],["Product
List"],'131','57','MKPRNSTR(TRIM(gcpCOMP))','&gcpPRNPORT'),;
QUERY("Vendor" ,"ABINVDEP","IDVENDOR","lcVENDOR"),;
QUERY("Bin" ,"ABINVDEP","IDLOC","lcSTART","lcEND"), ;
QUERY("Cls" ,"ABINVENT","IVCLS","lcCLS"),;
SORT("IDVENDOR","IVNO"),;
SUBHEADING( ;
DBFLD("VENDOR: " ,"ABINVDEP","IDVENDOR"),;
DBFLD(":" ,"ABVENDOR","VNAME"),;
DBFLD("Contact: " ,"ABVENDOR","VCO"),;
DBFLD(":" ,"ABVENDOR","VPH");
), ;
COLUMNS( ;
DBFLD("Part Number" ,"ABINVENT","IVNO",'C',10),;
DBFLD("Description" ,"ABINVENT","IVDS",'C',35),;
DBFLD("Cls" ,"ABINVENT","IVCLS"),;
DBFLD("Vendor Part
Number","ABINVQUK","IQUICK"),;
DBFLD("Last Order Date" ,"ABINVDEP","IDODAY"), ;
DBFLD("Last Order Cost" ,"ABINVDEP","IDLCOST") ;
),;
t( .F.,"ABINVENT",.F.,.F.,.F.,.F.,;
t( .T.,"ABINVDEP",.F.,.F.,"ABINVENT->IVNO","ABINVDEP", ;
t(.F.,"ABINVQUK",.F.,.F.,"ABINVENT->IVNO+'000'+ABINVDEP->IDVENDOR+'P'","ABINVQU2"),
;
t(.F.,"ABVENDOR",.F.,.F.,"ABINVDEP->IDVENDOR","ABVENDOR");
));
)
*----------------------------------------------------------------------------------
It's one big function call to the code generator. It generates about
1200 lines of well commented xBASE code. Not too pretty, but it sure
beats having to ever line-up headings ever again. The nested t()
functions do the navigation (is that the right word?) through the
indexed .DBF files.
It generates a bunch of standard functions, ie: opening files,
presents a consistent user interface, sticks in all sorts of error
checking I would never do if hand-coding (especially on Friday
afternoon), and allows me to tweek the database navigation path for
the best performance.
I have written several of these type of code generators the last 15
years, and they save a lot of time. And it's time to write something
similiar for a large Windows project.
BUT....
Here's the problems I always run into. The code can be compiled and
delivered, as is, to the end-user, about 80% of the time. The rest of
the time, I have to hand-edit parts of the code.
Once I do that, and find a bug in my code-generator, or add a nifty
new feature to the code-generator, I have to hand modify or cut and
pasted that 20% of customized code.
The hand-edited parts are usually quite site-specific to fufill a
contract, and too intense to justify adding them to the
code-generator. Or all the hacks I've added make it too hard or
time-consuming to modify at all. Or the growth of the poorly designed
input syntax catches up to me. And it's nice to be backward compatible
with early projects that need mods and additions.
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.