At Tue, 07 Jan 2003 15:17:07 +1100, Bruce Badger wrote:
> I guess if i could have a file like "next-tuesday-talk.mgp.spec" that 
> looked like:
>     $include 'common-header.mgp'
>     $include 'funny-story-1.mgp'
>     $include 'technical-bit-1.mgp'
>     ...etc...
> 
> ... and have a script to bolt it all together to make 
> "next-tuesday-talk.mgp'.  Is there any tool around that will just do 
> this kind of thing, or do I need to write my own script?

plenty of tools around.

cpp (or "gcc -E") is one you might already be familiar with:

 #include "common-header.mgp"
 #include "funny-story-1.mgp"
 #include "technical-bit-1.mgp

 %  cpp next-tuesday-talk.mgp.spec next-tuesday-talk.mgp

you may have problems with extra blank lines and "#line 75" directives
inserted in the output.  iirc, mgp will see these as harmless comments
and they will probably be very useful to your debugging, but you can
use -P to turn them off.


one of the more generic and powerful tools around is probably m4 (as
used by autoconf to generate configure.in for example), but it can
take a bit of getting used to if you wish:

 include(`common-header.mgp')
 include(`funny-story-1.mgp')
 include(`technical-bit-1.mgp')

 %  m4 next-tuesday-talk.mgp.spec > next-tuesday-talk.mgp

if the quoting characters conflict with your normal text too often,
one of the first things you may want to do is redefine them (autoconf
sets them to [ and ]) - see m4 docs.


both of these tools will also allow substitutions and conditionals. m4
even allows you to define fairly complex functions.


almost any talk i give that has more than one source file, has a
Makefile to help me avoid typing (and remember command lines). you
might want to consider doing the same.

-- 
 - Gus
-- 
SLUG - Sydney Linux User's Group - http://slug.org.au/
More Info: http://lists.slug.org.au/listinfo/slug

Reply via email to