Re: Cross reference for 4GL functions?
Posted in 1995
} Subject: Re: Cross reference for 4GL functions? } Date: Fri, 10 Mar 1995 13:35:26 -0500 } To: alan@po.den.mmc.com } From: tschaefe@gate.net (Tim Schaefer) } Newsgroups: comp.databases.informix } Organization: The Computer Business Co., Inc. } [snip] } > } >----- Begin compile script ----- } >#!/bin/csh -f echo '' foreach f ( $* ) } ># Remove pre-existing object file. } >rm -f ../object/$1.o } ># Start cross-ref file. } >echo '' >$f.x } >echo module $1 : >>$f.x } >echo '' >>$f.x } ># Tell user compile is starting. } >echo \\#c4gl $f.4gl } >#c4gl $f.4gl >& temp.x } >c4gl $f.4gl >& temp.x } ># Alert user of errors. } >egrep -e '[^_]error|warning' temp.x } ># Finish making cross-ref file. } >egrep -v -e '_main|warning|Undefined' temp.x | sort >>$f.x } ># Kill temp files. } >rm -f temp.x } >rm -f $f.c $f.ec a.out } ># Move files to appropriate related directories. } >mv $1.x ../xref/$f.x } >mv $1.o ../object/$f.o } ># Tell user compile is done; ls $f.err file, if any. } >echo \\#ls $f\\* } >ls -l $f* end } >echo '' } >----- End compile script ----- } > } >This script assumes a directory structure something like: } >$PROJECT/source } >$PROJECT/object } >$PROJECT/xref } > } >All of the source, object, and cross-ref files are kept in the appropriately } >named directories. [snip] } > } Very nice Alan... Thanks, I think. } The only thing is: It works for ONE program at a time... Boy, some folks are hard to please! :-) The modified script above does multiple names, but does not take wildcards, since you need to pass it names without extensions, and I chose not to bother parsing file names. } I guess you could do ">>" } instead of ">" and some pathing on file names to build a system-wide reference } where programs are located in several directories... Well, no. That's not what it is for. This script is intended for use during development, not for bulk use after the fact. Usually I change one or two modules at a time, so the prior one-at-a-time usage has not been a problem for me. Actually I might start using the multiple name form, tho'. [As a historical note: One reason that I built the compile script is that for a while I was developing on DOS using RDS and on Unix using compiled, all at the same time. I wrote "compile" scripts in each environment, so that I would not need to remember the different compile commands in the two environments, or even which machine I was on. For the same reason, I have "ls", "cp", etc. aliases on my DOS box, and "dir", "copy", etc. aliases on my Unix box.] } There's also a symbol table program you could run against the C code too, called } cxref, and takes multiple file names. Output is a bit more cryptic, but it's } consistent with UNIX tools. } } :-) } } Tim When I'm working in 4gl, I normally ignore the .c and .ec files generated. Note that my script deletes them. I also take a *very* simplified view of projects. I don't use make files. However, since all the object files for a given project are in one directory (with maybe some common utilities elsewhere), my link step can be reduced to: c4gl ../object/*.o $utils/*.o or something similar. After testing the a.out file, I would either toss it or move and rename it to the beta test directory for others to test. Chacon a son gout! Regards, Alan +---------------------------+-----------------------------------------------+ | R. Alan Popiel | Internet: alan@den.mmc.com | | Martin Marietta, SLS | Voice: 303-977-9998 | | P.O. Box 179, M/S 3810 | Standard disclaimers apply. Cutesy ones, too. | | Denver, CO 80201-0179 USA | Your mileage may vary. Void where prohibited. | +---------------------------+-----------------------------------------------+