Subject: FVWM: M4 pre-processing: pros and cons

From: Neil Zanella <[email-masked]>
Date: Fri, 6 Nov 1998 03:55:57 -0330 (NST)

Hello,

I am thinking of having M4 pre-process my .fvwm2rc file but before doing 
so I would like to know the following: What does M4 exactly do? What does it 
stand for? What was the motivation behind the creation of M4?
Can I use it define and undefine variables just like within a C program?
What are the pros and cons of M4 pre-processing?

Thanks for your feedback,

Neil
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Richard Lister <[email-masked]>
Date: Mon, 09 Nov 1998 11:21:19 -0500

On Fri, 6 Nov 1998 03:55:57 -0330 (NST)
Neil Zanella <[email-masked]> 
> stand for? What was the motivation behind the creation of M4?

Hey Neil

M4 is a macro processor that has been around in unix for a long time.
Your best bet is to read the man page for it on your system (or info
page if you have GNU M4).

> Can I use it define and undefine variables just like within a C program?

Yes. That is what I mostly use it for. For example I do stuff like this:

  m4_define(FORE_COLOUR, `Gray')
  m4_define(EDITOR_COLOUR, `GoldenRod')

  Style "Emacs" Color FORE_COLOUR/EDITOR_COLOUR
  Style "XJed"  Color FORE_COLOUR/EDITOR_COLOUR
  Style "xedit" Color FORE_COLOUR/EDITOR_COLOUR

Makes changing settings much easier. That's simple. You can do much more
interesting things, too.

> What are the pros and cons of M4 pre-processing?

Read the FvwmM4 and FvwmCpp man pages to compare M4 and cpp.

Ric

Richard J Lister, Georgetown Institute for Cognitive and Computational Sciences
Georgetown University Medical Center, Washington, DC 20007, USA
Phone: +1 202-687 2878
Email: [email-masked] 
Web: http://www.giccs.georgetown.edu/~ric/
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Neil Zanella <[email-masked]>
Date: Fri, 13 Nov 1998 18:08:31 -0330 (NST)

>   Style "xedit" Color FORE_COLOUR/EDITOR_COLOUR

Nice. This might do many of the things I've always wanted to do in my 
.fvwm2rc file...

> > What are the pros and cons of M4 vs. Cpp pre-processing?
> 

Fine, but it would be nice to hear *your* opinion on M4 vs. Cpp as well.

This is precisely what man pages lack: opinion.

Thanks a lot though,

Best Regards,

Neil

(BTW, is 4.0.47 out? Where can I ftp it from? It's not at the official 
Fvwm web page)

---

From: Jason L Tibbitts III <[email-masked]>
Date: 14 Nov 1998 12:16:24 -0600

>>>>> "NZ" == Neil Zanella <[email-masked]> writes:

NZ> (BTW, is 4.0.47 out? Where can I ftp it from? It's not at the official
NZ> Fvwm web page) 

Why do you keep asking this?  There is no 2.0.47, period, and there never
will be.  There's a CVS server at
:pserver:[email-masked]:/home/cvs/fvwm (the password is 'guest')
and testing releases in the the testing subdirectory of version-2 on the
FTP site, but if you want to play with development stuff you should join
fvwm-workers.

 - J<

---

From: Dan Espen <[email-masked]>
Date: Mon, 16 Nov 1998 09:42:34 -0500

> This is precisely what man pages lack: opinion.

Maybe you have been thinking whats in the man pages are facts?

In general, M4  is more capable, but  not as familiar (to some people)
as Cpp.  "man m4" should make that clear.

--
Dan Espen                                Phone: (732) 699-5570
444 Hoes Lane  Room RRC 1C-214           E-mail: [email-masked]
Piscataway, NJ 08854
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Richard Lister <[email-masked]>
Date: Mon, 16 Nov 1998 13:41:36 -0500

On Fri, 13 Nov 1998 18:08:31 -0330 (NST)
Neil Zanella <[email-masked]> 
> Fine, but it would be nice to hear *your* opinion on M4 vs. Cpp as well.

I think the main (pretty trivial) reasons I went with M4 were:

1. CPP would have required me to change all my comments from
   # ... to /* ... */.

2. CPP would require \ escapes for all newlines in macros, whereas M4 doesn't.

e.g. I do stuff like this:

m4_define(DECOR, `AddToDecor $1
+ WindowFont WINDOWFONT
+ HilightColor Yellow $2

+ BorderStyle Active (Solid $2)
+ BorderStyle InActive (Solid $3 -- HiddenHandles)

+ TitleStyle RightJustified
+ TitleStyle Inactive   (VGradient 32 $3 Black -- Raised)
+ TitleStyle ActiveUp   (VGradient 32 $3 Black -- Raised)
+ TitleStyle ActiveDown (VGradient 32 Black $3 -- Flat)

+ ButtonStyle All Simple
+ ButtonStyle All InActive (VGradient 32 $3 Black -- Raised)
+ ButtonStyle All ActiveUp (VGradient 32 $3 Black -- Raised)
+ ButtonStyle All ActiveDown (VGradient 32 Black $3 -- Flat)

+ AddButtonStyle 2 ActiveUp (MiniIcon)
+ AddButtonStyle 2 InActive (MiniIcon)
+ AddButtonStyle 2 ActiveDown (Pixmap mini-exp.xpm)
')

DECOR(editor, EDITOR_COLOUR, LightGoldenRod)
DECOR(xterm, XTERM_COLOUR, Cyan)

In general M4 is more flexible, but for most simple macros that may not
be much of an issue.

Ric