Subject: FVWM: FvwmCpp

From: Marco Mariani <[email-masked]>
Date: Tue, 20 Aug 1996 00:13:34 -0100 (GMT-0100)

Hi all!

If you use FvwmCpp on the whole .fvwm2rc, how do you protect yourself
against errors like the following:

.fvwm2rc:19: invalid preprocessing directive name
.fvwm2rc:23: invalid preprocessing directive name
.fvwm2rc:29: invalid preprocessing directive name
.fvwm2rc:35: invalid preprocessing directive name
.fvwm2rc:37: invalid preprocessing directive name
.fvwm2rc:44: invalid preprocessing directive name
.fvwm2rc:47: unterminated character constant
.fvwm2rc:77: parse error
.fvwm2rc:85: unterminated string or character constant
.fvwm2rc:229: unterminated string or character constant
.fvwm2rc:77: unterminated `#if' conditional

The first ones are due to the '##' which I use sometimes and is mistaken
for a preprocessor directive (it is triggered by '#*' also), and the
others are quite common if you write a ' in a comment or '#if' or things
like that.

At the moment, I use the following:

----- /var/X11R6/lib/xinit/xinitrc:

[...]

/var/X11R6/lib/fvwm2/precpp.pl <~/.fvwm2rc >~/.fvwm2rc.cpp
fvwm2 -cmd "FvwmCpp -Cppprog /usr/bin/cpp $HOME/.fvwm2rc.cpp"

----- /var/X11R6/lib/fvwm2/precpp.pl:

#!/usr/bin/perl

while(<>) {
   (! /^ *#/ || /^ *# *(include|define|if|endif|ifdef|undef|else|elif|
                 line|error|pragma)/) && print $_;
}

It works, but does not protect against the '# if' at line 77.

If you use '#if' without any space in your preprocessed files, you
can change the "/^ *# *(" with "/^ *#(".

As soon as I find the time, I could implement this thing into FvwmCpp, if
you think it is of any use.

Of course, FvwmCpp is the result of a random mutation, so I can't contact
the author via e-mail.

All The Best,
 Marco

Excuse the waste of bandwidth, please send flames to my alternate address
([email-masked]).

--
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: michael shiplett <[email-masked]>
Date: Tue, 20 Aug 1996 09:48:38 -0400

"mm" == Marco Mariani <[email-masked]> writes:

mm> If you use FvwmCpp on the whole .fvwm2rc, how do you protect yourself
mm> against errors like the following:

mm> .fvwm2rc:19: invalid preprocessing directive name
[...]
mm> .fvwm2rc:77: parse error
[...]
mm> .fvwm2rc:85: unterminated string or character constant
[...]
mm> .fvwm2rc:77: unterminated `#if' conditional

  I suppose the cynical (and possibly unhelpful) answer is to use
FvwmM4 instead. m4 is not very difficult to pick up since cpp is based
on m4. Just make sure to use -m4-prefix to avoid problems with
`include'.

michael

---

From: [email-masked] (David S. Goldberg)
Date: 20 Aug 1996 10:31:47 -0400

> FvwmM4 instead. m4 is not very difficult to pick up since cpp is
> based on m4. Just make sure to use -m4-prefix to avoid problems with
> `include'.

While I agree on the use of m4 (I use it heavily myself), beware that
-m4-prefix depends on an m4 that supports it, such as gnu m4.  Most
stock versions won't.  Since I run the same .fvwm2rc on a machine with
gnu m4 and on one without, I use the -m4-squote and -m4-equote options
to specify new quote characters (I need the default `'s for other
things in .fvwm2rc).  An alternative would be to put a changequote
directive at the top of .fvwm2rc.  I then quote anything that would be
processed by m4.  Note that this occasionally causes a surprise.  I
recently started using the latest FvwmIconMan and found that gnu m4
has a format directive...  I suppose one could quote the entire file,
except for those bits where one wants m4 processing, but that seems to
me to be more a hassle than it's worth.

--
Dave Goldberg
Post: The Mitre Corporation\MS B305\202 Burlington Rd.\Bedford, MA 01730
Phone: 617-271-3887
Email: [email-masked]

---

From: Marco Mariani <[email-masked]>
Date: Sat, 24 Aug 1996 15:33:27 -0100 (GMT-0100)

On Tue, 20 Aug 1996, michael shiplett wrote:

> FvwmM4 instead.

It's not cynical, and it's helpful. I have Yet Another Language to learn,
then master, then get bored of.

> m4 is not very difficult to pick up since cpp is based
> on m4.

The most difficult thing is using info (or emacs) to browse through the
info file. I hate those hyperthings.

> Just make sure to use -m4-prefix to avoid problems with `include'.

Does the -m4-squote option works? I've not been able to use it, and the
example in the man page doesn't work.

stdin:11: m4: Warning: Excess arguments to built-in `m4_define' ignored
stdin:25: m4: Cannot open {/root/.fvwm2rc}: No such file or directory
[FVWM][executeModule]: <<ERROR>> No such module /usr/X11R6/lib/X11/fvwm2 changequote({,

shalott:~# m4 --version
GNU m4 1.4

Is there a way to refer to $HOME within FvwmM4 or Fvwm ?

I'd like to include(`~/.fvwm-whatever'), because I often launch X from a
directory that is not $HOME.

All The Best,
 Marco

---

From: H}vard Fosseng <[email-masked]>
Date: Sat, 24 Aug 1996 23:35:12 +0200

> info file. I hate those hyperthings.

TeX it and print it out, then.

> directory that is not $HOME.

GNU m4:

File: m4.info,  Node: Esyscmd,  Next: Sysval,  Prev: Syscmd,  Up: UNIX commands

Reading the output of commands
==============================

   If you want `m4' to read the output of a UNIX command, use `esyscmd':

     esyscmd(SHELL-COMMAND)

which expands to the standard output of the shell command SHELL-COMMAND.

   Prior to executing the command, `m4' flushes its output buffers.
The default standard input and error output of SHELL-COMMAND are the
same as those of `m4'.  The error output of SHELL-COMMAND is not a part
of the expansion: it will appear along with the error output of `m4'.

   Assume you are positioned into the `checks' directory of GNU `m4'
distribution, then:

     define(`vice', `esyscmd(grep Vice ../COPYING)')
     =>
     vice
     =>  Ty Coon, President of Vice
     =>

   Note how the expansion of `esyscmd' has a trailing newline.

   The builtin macro `esyscmd' is recognized only when given arguments.

Håvard Fosseng

---

From: michael shiplett <[email-masked]>
Date: Mon, 26 Aug 1996 12:52:32 -0400

mm> Does the -m4-squote option works? I've not been able to use it,
mm> and the example in the man page doesn't work.
  I don't know. I haven't tried this. As someone has already pointed
out, the man page example needs to use `fvwm -cmd' not `fvwm -f'.

mm> Is there a way to refer to $HOME within FvwmM4 or Fvwm ?

mm> I'd like to include(`~/.fvwm-whatever'), because I often launch X
mm> from a directory that is not $HOME.
  The FvwmM4 manpage shows `HOME' as a pre-defined symbol in the
EXAMPLE PROLOG, but does not mention it in the CONFIGURATION OPTIONS
section. I just tested which section is correct. It turns out `HOME'
is pre-defined.

  You could use

    m4_include(HOME`/.fvwm-whatever')

michael