In message <199512291531.KAA26672_at_mailbox.sura.net>,
Nicholas Vargish writes:
>Hi,
>
>Sorry to be an idiot, but I can't figure this m4 macro language out.
[...]
>I think I must be confused about m4 quoting rules, but I'm not sure
>exactly where I'm going wrong. I'd appreciate any advice people might
>have... Examples would be especially welcome -- I learn well from those.
>
>Nick
>
>p.s. Is there any way to make those m4 definitions "prettier"? I'm just not
>a big fan of 220-character lines...
>
I'm using m4 to an almost obscene degree (according to my workmates :-)
Your code looks fine, and I can't at first glance see much wrong with
it, but a few things need clarifying.
The m4_* forms imply that you're using gnu m4, and invoking it
with the -P option, i.e. your .xsession/.xinitrc starts fvwm2
with something like:
fvwm2 -f "FvwmM4 -m4prog g4 -m4-prefix .fvwm2rc"
(I have gnu m4 installed as `g4', and the `-m4-prefix' switch not only
tells FvwmM4 to pass g4 the -P switch, but also to pass in the prologue
as `m4_define(...) etc. instead of just `define(...))
How do you know what FvwmM4 is defining HOSTNAME to be?
I have the following:
m4_define(`BASEHOSTNAME',m4_substr(HOSTNAME, 0, m4_index(HOSTNAME, .)))
AddToMenu "FvwmInfo" "Constants Known to FVWM" Title
m4_define(`ShowValue', `AddToMenu "FvwmInfo" "`$1' is $1" Nop')
ShowValue(`WIDTH')
ShowValue(`HEIGHT')
ShowValue(`TWM_TYPE')
ShowValue(`SERVERHOST')
ShowValue(`CLIENTHOST')
ShowValue(`HOSTNAME')
ShowValue(`BASEHOSTNAME')
ShowValue(`OSTYPE')
ShowValue(`USER')
ShowValue(`VERSION')
ShowValue(`REVISION')
ShowValue(`VENDOR')
ShowValue(`RELEASE')
ShowValue(`X_RESOLUTION')
ShowValue(`Y_RESOLUTION')
ShowValue(`PLANES')
ShowValue(`BITS_PER_RGB')
ShowValue(`CLASS')
ShowValue(`COLOR')
ShowValue(`FVWM_VERSION')
ShowValue(`OPTIONS')
ShowValue(`FVWMDIR')
Then just pop up the FvwmInfo Menu as you wish.
There exists the `dnl' macro, invoked in your case as `m4_dnl'
which will discard all subsequent text up to and including the
next new line, so I have:
PixmapPath m4_dnl
/home/bill/lib/images/icons/xpm:m4_dnl
/home/bill/trees:m4_dnl
/vol/images/3d_pixmaps_1.0/3dpixmaps_100colors
which looks a little prettier than one long line.
Persevere with m4. It's well worth the effort of learning, and
you can get a *lot* more out of it than cpp (for example recursive
macros, macros which define macros, macro stacks etc. etc. etc.)
Hope this helps.
Cheers
Bill
Bill Hails <bill_at_clic.co.uk>
Tel (UK) 01483 300 200 x415
Fax (UK) 01483 461 046
--
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Tue Jan 02 1996 - 03:48:55 GMT