-m4_divert(-1) -*- C -*-
+m4_divert(-1) -*- Autoconf -*-
# C M4 Macros for Bison.
# Copyright (C) 2002 Free Software Foundation, Inc.
# MIN to MAX (included).
m4_define([b4_int_type],
[m4_if(b4_ints_in($@, [0], [255]), [1], [unsigned char],
- b4_ints_in($@, [-128], [128]), [1], [signed char],
+ b4_ints_in($@, [-128], [127]), [1], [yysigned_char],
b4_ints_in($@, [0], [65535]), [1], [unsigned short],
b4_ints_in($@, [-32768], [32767]), [1], [short],
m4_define([b4_token_defines],
[m4_if([$@], [[]], [],
[/* Tokens. */
-#if defined (__STDC__) || defined (__cplusplus)
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
])
+## --------------------- ##
+## Calling C functions. ##
+## --------------------- ##
+
+
+# b4_c_function_call(NAME, RETURN-VALUE, [TYPE1, NAME1], ...)
+# -----------------------------------------------------------
+# Call the function NAME with arguments NAME1, NAME2 etc.
+m4_define([b4_c_function_call],
+[$1 (b4_c_args(m4_shiftn(2, $@)))[]dnl
+])
+
+
+# b4_c_args([TYPE1, NAME1], ...)
+# ------------------------------
+# Output the arguments NAME1, NAME2...
+m4_define([b4_c_args],
+[m4_map_sep([b4_c_arg], [, ], [$@])])
+
+m4_define([b4_c_arg],
+[$2])
+
+
## ---------------------------------------------- ##
## Declaring C functions in both K&R and ANSI-C. ##
## ---------------------------------------------- ##
# b4_c_function(NAME, RETURN-VALUE, [TYPE1, NAME1], ...)
-# ------------------------------------------------
+# ------------------------------------------------------
# Declare the function NAME.
m4_define([b4_c_function],
[$2