use of m4

use of m4

Post by templatest » Sat, 14 May 2005 18:37:33


Hello,

I heard that m4 can be used for preprocessing. The language, I am
trying to
parse has pre-processor symbols just like 'C'(not exactly though). So
lets
take the following c file for example.


#define MAX 10

int main()
{
int arr[MAX];

#ifdef MAX
printf(" Max is defined\n");
#else
printf(" Max is not defined\n");
#endif
return 0;
}


Now using 'cpp', I can correctly pre-process this file . cpp outputs on
the
given file ...

# 1 "c.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "c.c"



int main()
{
int arr[10];


printf(" Max is defined\n");



return 0;
}

Can m4 do the same thing like cpp? I just give a quick look on m4
manual. Yes,
you can define macro, ifelse and so on. But I dont know what are the
preprocessor symbols will be there in input file in advance.

How can I use m4 here ? or m4 cannot be used like cpp ??

Thanks,
 
 
 

1. Using local m4 files

2. M4 Questions - cf/m4/proto.m4 - Basic_check_relay (also, a suggested change)

Basic_check_relay [optionally] does several things:
1) Checks for deferred mode
2) Checks the access table (for "Connect:...") - white/black lists.
3) Checks for rate and connection controls.
4) Checks DNSBLs - "divert(8)"
5) Checks for reverse DNS lookup.

My questions specifically involve steps #4 and #5 above.

A) "_RBL_" - is this legacy code that can now be replaced with
"FEATURE(`dnsbl',`_RBL_')"? Although it appears before the rate and
connection controls where the dnsbl lookups appear after, I don't see any
significance to the order of the checks. However, as the control checks are
access database based, they look less expensive.

B) The reverse DNS lookup is a less resource costly test than dnsbl
lookups. Therefore, shouldn't it come before the dnsbl section?

(Although both checks do query DNS, the dnsbl query (or queries) have not
been done, while the reverse lookup query was already performed before the
ruleset was invoked in order to set the macro variables {client_*}, so it's
really a "no additional cost" check.)

In reordering the checks, drop (or change to OK) the r-dns check on relay
hosts (i.e. RELAY and OK rules disappear or are altered).

Questions A and B imply that perhaps cf/m4/proto.m4 should be altered:
- to remove _RBL_ (or at least redefine it as invoking dnsbl feature)
- to reorder the ruleset segments to have DNSBL checking last.
Comments?

3. m4: tool to auto-correct the indentation of m4 scripts

4. FEATURE(`require_rdns') : Why it is implemented via cf/m4/proto.m4?

5. header ESMTP?by m4/cfhead.m4

6. [ace-users] m4/aio.m4 dead reference to iostream.h

7. Sendmail m4 make can't find file masquerade_domain.m4

8. m4/aio.m4 dead reference to iostream.h

9. How to simulate CTRL key when using pen on Tecra M4?

10. Using M4 macros to setup masquerade and smart host newer Sunboxes

11. preprocessing using m4

12. Using autoconf with a revised m4sh.m4

13. Toshiba Tecra M4 crashes after it goes to sleep

14. Flowcharts with graphviz? Preprocessors/m4?

15. how can make a mirror like surface in M4?