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

Very complicated m4 stuff



El Mon, Jun 28, 1999 at 12:53:42AM +0200, Denis Barbier contaba:

>PS: I did not understand your other post, could you send a simple
>    example to explain what you want?

I have such a group of m4 macros:

This defines a loop executes `_comando' for each element in a list. 
 
m4_define(<`_gira'>,<`m4_ifelse($#,1,<`_comando(<`$1'>)'>,<`_comando(<`$1'>)'><`
_gira(m4_shift($@))'>)'>)

And this is very messy (as I supose m4 is most of the time). I have
to redefine some commands, so the included file has some of this
commands they will not be used (this could make some strange things). 

m4_define(<`_comando'>,<`
m4_divert(-1)
m4_pushdef(<`m4_divert'>)
m4_pushdef(<`m4_sinclude'>)
m4_include(<`macros.m4'>)
m4_include(<`$1'>)
m4_popdef(<`m4_sinclude'>)
m4_popdef(<`m4_divert'>)
m4_divert(0)m4_dnl
_test_macro()
m4_divert(0)m4_dnl
'>)

Well, this probably is not easy understandable. Just an example:


I have several files this way:

---- file3
m4_define(_test_macro,xxxx)
----

---- file2
m4_define(_test_macro,yuyy)
----

---- file1
m4_define(_test_macro,zzzz)
----

And a file that calls the defined macros this way:

------------ 
_gira(file1,file2,file3)
------------

It will output:

 zzzz
 yyyy
 xxxx



Did somebody understand all this?


Another way of explaining it. This code tries to include several
files from a list inside the page. The program can extract certain
information from them, and even do clever things: knowing what his
name is, do not include itself. 

It this could be possible something like:

#include for(file*) do
            if file == $(FILENAME) skip
            else include it

I don't know if I explain myself.

Well, I do this trick inside m4, but the problem is this is pass 4,
so I cannot use Meta-HTML or eperl.
-- 
Saudos:
><ose        xmanoel@bigfoot.com   (Vigo/Galicia/Espaņa)
         http://pagina.de/xmanoel/
         http://w3.to/mikkeli/

07/02	Felix Pappalardi and Leslie West form Mountain, 1969
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com