Thread: [Autogen-users] basic help
Brought to you by:
bkorb
From: Olya <oly...@gm...> - 2014-04-30 13:32:50
|
Hi all. I'm trying to go through autogen manual but stuck even with very basic example The header is specifies files with which extensions should be produced - like .c or .h for example. What if I would like to produce configuration file without extension? For example: [+ AutoGen5 template interfaces +] iface [+iface+] inet [+IF type == dhcp +] dhcp [+ELSE "static ip" +] static address [+addr+] netmask [+mask+] [+ENDIF "End of if" +] Results in cryptic warning: "attempted to use block macro in eval expression" and no output at all. -- best regards, Olga. |
From: Olya <oly...@gm...> - 2014-04-30 13:40:05
|
Hi all. I'm trying to go through autogen manual but stuck even with very basic example The header is specifies files with which extensions should be produced - like .c or .h for example. What if I would like to produce configuration file without extension? For example: [+ AutoGen5 template interfaces +] iface [+iface+] inet [+IF type == dhcp +] dhcp [+ELSE "static ip" +] static address [+addr+] netmask [+mask+] [+ENDIF "End of if" +] Results in cryptic warning: "attempted to use block macro in eval expression" and no output at all. -- best regards, Olga. |
From: Olya <oly...@gm...> - 2014-04-30 14:17:03
|
Ah, got it - I can set output filename directly in the template. But is there a way to specify access rights for it? I mean smth like 0644 - standard unix rights. To get a complete example: my.xml: <?xml version="1.0"?> <ag_network template="etc-network-interfaces.tpl"> <iface> eth0 </iface> <type> dhcp </type> <addr> 192.168.1.2 </addr> <mask> 255.255.255.0 </mask> </ag_network> etc-network-interfaces.tpl: [+ autogen5 template /tmp/network/interfaces +] iface [+iface+] inet [+IF (== (get "type") "dhcp") +] dhcp [+ELSE "error is in the line above" +] static address [+ addr +] netmask [+ mask +] [+ENDIF "End of static/dynamic choice" +] Now it fails on a line with IF due to "macros cannot nest" but I do not see any nested macro in here. best regards, Olga. |
From: Bruce K. <bru...@gm...> - 2014-04-30 14:48:47
|
Hi, On Wed, Apr 30, 2014 at 7:16 AM, Olya <oly...@gm...> wrote: > Ah, got it - I can set output filename directly in the template. But is there a way > to specify access rights for it? I mean smth like 0644 - standard unix rights. > > To get a complete example: > > my.xml: > <?xml version="1.0"?> > <ag_network template="etc-network-interfaces.tpl"> > <iface> > eth0 > </iface> > <type> > dhcp > </type> > <addr> > 192.168.1.2 > </addr> > <mask> > 255.255.255.0 > </mask> > </ag_network> > > etc-network-interfaces.tpl: > [+ autogen5 template /tmp/network/interfaces +] The first "/" before "tmp" is interpreted as the end of macro marker. That character is not a valid file *NAME* character. Try this: [+ autogen5 template if=/tmp/network/interfaces +] > > iface [+iface+] inet [+IF (== (get "type") "dhcp") +] dhcp > [+ELSE "error is in the line above" +] static > address [+ addr +] > netmask [+ mask +] > [+ENDIF "End of static/dynamic choice" +] > > Now it fails on a line with IF due to "macros cannot nest" but I do not see any > nested macro in here. > > best regards, > Olga. > > > ------------------------------------------------------------------------------ > "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE > Instantly run your Selenium tests across 300+ browser/OS combos. Get > unparalleled scalability from the best Selenium testing platform available. > Simple to use. Nothing to install. Get started now for free." > http://p.sf.net/sfu/SauceLabs > _______________________________________________ > Autogen-users mailing list > Aut...@li... > https://lists.sourceforge.net/lists/listinfo/autogen-users |
From: Bruce K. <bru...@gm...> - 2014-04-30 13:49:04
|
HI, On Wed, Apr 30, 2014 at 6:32 AM, Olya <oly...@gm...> wrote: > Hi all. > > I'm trying to go through autogen manual but stuck even with very basic example > > The header is specifies files with which extensions should be produced - like .c or > .h for example. What if I would like to produce configuration file without extension? > > For example: > > [+ AutoGen5 template interfaces +] That specifies a suffix of ".interfaces". Somewhere in there is an explanation that you can use a formatting specification after a '=' thus: [+ AutoGen5 template interfaces=%s +] http://autogen.sourceforge.net/doc/pseudo-macro.html#pseudo-macro ``The suffix specification consists of a sequence of POSIX compliant file name characters and, optionally, an equal sign and a file name formatting specification. That specification may be either an ordinary sequence of file name characters with zero, one or two "%s" formatting sequences in it, or else it may be a Scheme expression that, when evaluated, produces such a string. The Scheme result may not be empty. The two string arguments allowed for that string are the base name of the definition file, and the current suffix (that being the text to the left of the equal sign). (Note: "POSIX compliant file name characters" consist of alphanumerics plus the period (.), hyphen (-) and underscore (_) characters.)'' > iface [+iface+] inet [+IF type == dhcp +] dhcp You must mean: [+IF (== (get "type") "dhcp") +] expressions are typically in schemy style. > [+ELSE "static ip" +] static > address [+addr+] > netmask [+mask+] > [+ENDIF "End of if" +] > > Results in cryptic warning: > "attempted to use block macro in eval expression" > and no output at all. It should also reference a line. That should give a hint, too. Cheers - Bruce |