bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: m4 problems


From: Stepan Kasal
Subject: Re: m4 problems
Date: Fri, 17 Jan 2003 09:09:17 +0100
User-agent: Mutt/1.2.5.1i

Hello,
        I beleive your mail doesn't in fact describe any bug.

On Thu, Jan 16, 2003 at 04:28:41PM -0700, Patrick West wrote:
> I am not getting the results that I would expect from some simple
> commands. I am just now learning m4.

  I don't know m4 well but I think I can give you some hints which help
you with fuirther study of the manual.

Your system should support ``info m4''

Or you can get the manual from: http://www.gnu.org/manual/m4 

eg. read it online: http://www.gnu.org/manual/m4/html_node/m4_toc.html

> define('foo', 'hello world')

I guess this is the roo of all bugs you observe: to qoute in m4, you
have to you left quote at the beginning and right quote at the end.
You've used right quote on both cases.

(Left quote, also called backtick can be found in the top left corner
of my keyboard, together with the tilde.)

(I cannot fully explain the behaviour you observed when ysing wrong
quoting but I beleive it not important now.)

Let's continue with an example:

define(`foo', `bar')
foo
`foo'
define(foo, `hello world')
foo
bar
undefine(foo)
dumpdef(`foo')
undefine(`foo')
dumpdef(`foo')

The same again, line numbers indicated:

1:define(`foo', `bar')
2:foo
3:`foo'
4:define(foo, `hello world')
5:foo
6:bar
7:undefine(foo)
8:dumpdef(`foo')
9:undefine(`foo')
10:dumpdef(`foo')

The output looks like this:

1:
2:bar
3:foo
4:
5:hello world
6:hello world
7:
8:foo:  bar
9:
10:
11:d:10: m4: Undefined name foo
12:

A few comments:

2: foo expands
3: foo does not expand, as it is quoted

4: A macro named `bar' is defined here, as foo was not quoted.

5: foo -> bar -> hello world

6: `bar' is being undefined, ...
7: ... but `foo' is still here

8: `foo' is being undefined

HTH,
        Stepan Kasal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]