Make m4 only call macros surrounded by brackets.
Demetrios Obenour <[email protected]> Sun, 01 Mar 2015 21:16:17 -0500
| Newsgroups | gmane.comp.gnu.m4.general |
|---|---|
| Message-ID | <[email protected]> |
[email protected] writes: > Send m4-discuss mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.gnu.org/mailman/listinfo/m4-discuss > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of m4-discuss digest..." > > > Today's Topics: > > 1. Make m4 only call macros surrounded by brackets. (Zack Piper) > 2. Re: Make m4 only call macros surrounded by brackets. (Zack Piper) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Sat, 28 Feb 2015 21:37:30 +0000 > From: Zack Piper <[email protected]> > To: [email protected] > Subject: Make m4 only call macros surrounded by brackets. > Message-ID: <[email protected]> > Content-Type: text/plain; charset="us-ascii" > > Hello, > > I'm currently trying to figure out how to make m4 only call macros within certain brackets, for example: > > ``` > define(`test', '2') > test > ->test > > <test> > ->2 > ``` > > It would be even better if this was possible. > > ``` > define(`test', '2') > <test> > -><test> > > <#test> > ->2 > ``` > > Above is exactly what the `-H` flag does on GPP (Generic Preprocessor) (http://files.nothingisreal.com/software/gpp/gpp.html). > > Any help would be great, thanks! > -- > I have nothing fancy or intelligent to put here. > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: not available > Type: application/pgp-signature > Size: 819 bytes > Desc: not available > URL: <http://lists.gnu.org/archive/html/m4-discuss/attachments/20150228/69e7800a/attachment.pgp> > > ------------------------------ > > Message: 2 > Date: Sat, 28 Feb 2015 23:21:07 +0000 > From: Zack Piper <[email protected]> > To: [email protected] > Subject: Re: Make m4 only call macros surrounded by brackets. > Message-ID: <[email protected]> > Content-Type: text/plain; charset="us-ascii" > > On Sat, Feb 28, 2015 at 09:37:30PM +0000, Zack Piper wrote: >> Hello, >> >> I'm currently trying to figure out how to make m4 only call macros within certain brackets, for example: >> >> ``` >> define(`test', '2') >> test >> ->test >> >> <test> >> ->2 >> ``` >> >> It would be even better if this was possible. >> >> ``` >> define(`test', '2') >> <test> >> -><test> >> >> <#test> >> ->2 >> ``` >> >> Above is exactly what the `-H` flag does on GPP (Generic Preprocessor) (http://files.nothingisreal.com/software/gpp/gpp.html). >> >> Any help would be great, thanks! >> -- >> I have nothing fancy or intelligent to put here. > > Hm, I found out how to do it. Unfortuently it seems to segfault when using "changeword(`#<\([_a-zA-Z0-9]*\)>)')", and then trying to invoke a macro: > > (gdb) run gpp.m4 > Starting program: /usr/local/bin/m4 gpp.m4 > Got object file from memory but can't read symbols: File truncated. > > > > > > Program received signal SIGSEGV, Segmentation fault. > next_token (td=td@entry=0x7fffffffd0b0, line=line@entry=0x7fffffffd0ac) at input.c:918 > 918 if (regs.start[1] != -1) Couldn't reproduce with my (old) version. Sounds like regs.start is NULL or uninitialized.