[comp.windows.x] .twmrc parsed by m4 or cpp

felix@ai.sri.com (Francois Felix INGRAND) (08/04/90)

Could it be possible to modify the next release of twm such that the twmrc file
is parsed through m4 or cpp (as xrdb does).

Thanks in advance,
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Francois Felix INGRAND                          SRI International, AIC
felix@AI.SRI.COM                                333, Ravenswood Avenue
felix%AI.SRI.COM@UUNET.UU.NET                   MENLO PARK, CA 94025, USA
"Pourquoi tant de haine..." (Edika)      "Read my Lisp... No new syntax" (nil)

grunwald@foobar.colorado.edu (Dirk Grunwald) (08/04/90)

>> 
>> 
>> Could it be possible to modify the next release of twm such that the twmrc file
>> is parsed through m4 or cpp (as xrdb does).
>> 
>> Thanks in advance,
>> --
--
This would be very nice - I'd like to be able to #ifdef things for different
servers (sun, DEC, IBM, etc). I had hacked twm to specify an alternative
.twmrc for each host, but would prefer something a little more standard.

stripes@eng.umd.edu (Joshua Osborne) (08/06/90)

In article <FELIX.90Aug3142321@cayucos.ai.sri.com> felix@ai.sri.com (Francois Felix INGRAND) writes:
>
>Could it be possible to modify the next release of twm such that the twmrc file
>is parsed through m4 or cpp (as xrdb does).

TWM can not send it's input files thru cpp, because cpp's use of "#" conflicts
with twm's use of "#" as the comment symbol.  I have hacked twm to use m4
to pre-parse the .twmrc files.  I also took a look at the info xrdb 
gives cpp and make that available to m4.  Almost all of the changes are in
parse.c (about 3 lines needed to be added to twm.c, or whatever .c has
main() in it).  If the X Consortium would like these changes I will attempt
to extract them from my twm (I have applyed some other non-standard patches
to twm give to me by others so I can't just diff it).  If not I will try
to put the whole thing up for ftp somewhere.  I don't want to spend the
rest of my life mailing out source 'tho...
-- 
           stripes@eng.umd.edu          "Security for Unix is like
      Josh_Osborne@Real_World,The          Mutitasking for MS-DOS"
      "The dyslexic porgramer"                  - Kevin Lockwood
"Don't try to change C into some nice, safe, portable programming language
 with all sharp edges removed, pick another language."  - John Limpert

toml@ninja.Solbourne.COM (Tom LaStrange) (08/06/90)

>
>Could it be possible to modify the next release of twm such that the
twmrc file
>is parsed through m4 or cpp (as xrdb does).

The real thing that should be done IMHO is to convert twm to use the resource
manager to get its defaults rather than using a seperate initialization file.

--
Tom LaStrange

Solbourne Computer Inc.    ARPA: toml@Solbourne.COM
1900 Pike Rd.              UUCP: ...!{boulder,sun}!stan!toml
Longmont, CO  80501

jim@ncd.COM (Jim Fulton) (08/06/90)

If you don't have time to hack twm code, you might be able to use the 
following (fairly gross) shell script:

#!/bin/sh
tmp=/tmp/twm.$$
(echo cpp ; xrdb -s; echo "<$HOME/.twmrc.master >$tmp") | tr '\012' ' ' | sh
twm -f $tmp $*
rm $tmp