bug-m4
[Top][All Lists]
Advanced

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

FYI: Comments


From: Akim Demaille
Subject: FYI: Comments
Date: 07 Aug 2001 12:39:50 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Academic Rigor)

Index: m4/evalparse.c
===================================================================
RCS file: /cvs/m4/m4/evalparse.c,v
retrieving revision 1.2
diff -u -u -w -r1.2 evalparse.c
--- m4/evalparse.c 2000/12/01 01:22:41 1.2
+++ m4/evalparse.c 2001/08/07 10:33:58
@@ -1,5 +1,6 @@
 /* GNU m4 -- A simple macro processor
-   Copyright 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc.
+   Copyright 1989, 1990, 1991, 1992, 1993, 1994, 2001
+   Free Software Foundation, Inc.
   
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,10 +18,30 @@
    02111-1307  USA
 */
 
-/* This file contains the functions to evaluate integer expressions for
-   the "eval" macro.  It is a little, fairly self-contained module, with
-   its own scanner, and a recursive descent parser.  The only entry point
-   is evaluate ().  */
+/* This file contains the functions to evaluate integer expressions
+   for the "eval" macro.  It is a little, fairly self-contained
+   module, with its own scanner, and a recursive descent parser.  The
+   only entry point is evaluate ().
+
+   It has been carefully written to be also used for the GMP module,
+   mpeval: any actual operation performed on numbers is abstracted by
+   a set of macro definitions.  For plain `eval', `number' is some
+   long int type, and `numb_*' manipulates those long ints, while when
+   using GMP, `number' is typedef'd to `mpq_t' (the arbritrary
+   precision fractional numbers type of GMP), and `numb_*' are mapped
+   to GMP functions.
+
+   There is only one entry point, `m4_do_eval', a single function for
+   both `eval' and `mpeval', but which is given a function pointer to
+   either `m4_evaluate' (for plain `eval'), and `m4_mp_evaluate' (for
+   GMP `mpeval').
+
+   This allows to factor the `user interface' of `eval' and `mpeval',
+   i.e., sanity checks on the input arguments.
+
+   FIXME: it makes no sense to me, since anyway both `modules' own
+   their copy of `m4_do_eval': why don't we just also use a macro for
+   that part instead of a function pointer? --akim.  */
 
 /* Evaluates token types.  */
 
@@ -827,11 +848,9 @@
 }
 
 void
-m4_do_eval (obs, argc, argv, func)
-     struct obstack *obs;
-     int argc;
-     m4_token_data **argv;
-     m4_eval_func func;
+m4_do_eval (struct obstack *obs,
+           int argc, m4_token_data **argv,
+           m4_eval_func func)
 {
   int radix = 10;
   int min = 1;
@@ -858,6 +877,9 @@
       return;
     }
 
+  /* FIXME: Huh?  What's these `if' and `return' doing here?  Makes no
+     sense to me. Furthermore, then what is the point of returning a
+     bool (m4_evaluate) if we just ignore it? --akim */
   if ((*func) (obs, M4ARG (1), radix, min))
     return;
 }
Index: m4/m4module.h
===================================================================
RCS file: /cvs/m4/m4/m4module.h,v
retrieving revision 1.6
diff -u -u -w -r1.6 m4module.h
--- m4/m4module.h 2000/12/01 01:22:41 1.6
+++ m4/m4module.h 2001/08/07 10:33:58
@@ -240,7 +240,7 @@
 #define M4_DEBUG_PRINT2(Fmt, Arg1, Arg2) \
   do                                                           \
     {                                                          \
-      if (M4_debug != NULL)                                    \
+      if (m4_debug != NULL)                                    \
        fprintf (m4_debug, Fmt, Arg1, Arg2);                    \
     }                                                          \
   while (0)
Index: m4/macro.c
===================================================================
RCS file: /cvs/m4/m4/macro.c,v
retrieving revision 1.1
diff -u -u -w -r1.1 macro.c
--- m4/macro.c 2000/11/24 23:24:34 1.1
+++ m4/macro.c 2001/08/07 10:33:58
@@ -233,14 +233,15 @@
 }
 
 
-/*------------------------------------------------------------------------.
-| The actual call of a macro is handled by call_macro ().  call_macro ()  |
-| is passed a symbol SYM, whose type is used to call either a builtin    |
-| function, or the user macro expansion function expand_predefine ()     |
-| (lives in builtin.c).  There are ARGC arguments to the call, stored in  |
-| the ARGV table.  The expansion is left on the obstack EXPANSION.  Macro |
-| tracing is also handled here.                                                
  |
-`------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------.
+| The actual call of a macro is handled by m4_call_macro ().         |
+| m4_call_macro () is passed a symbol SYM, whose type is used to     |
+| call either a builtin function, or the user macro expansion        |
+| function expand_predefine () (lives in builtin.c).  There are ARGC |
+| arguments to the call, stored in the ARGV table.  The expansion is |
+| left on the obstack EXPANSION.  Macro tracing is also handled      |
+| here.                                                              |
+`-------------------------------------------------------------------*/
 
 void
 m4_call_macro (m4_symbol *symbol, int argc, m4_token_data **argv,
Index: modules/README
===================================================================
RCS file: /cvs/m4/modules/README,v
retrieving revision 1.3
diff -u -u -w -r1.3 README
--- modules/README 2000/12/01 01:22:41 1.3
+++ modules/README 2001/08/07 10:33:58
@@ -52,7 +52,7 @@
 "m4_builtin_table", "m4_macro_table" and "m4_init_module".  The symbol
 "m4_builtin_table" is a pointer to a table of "m4_builtin" (defined in
 m4module.h), listing each new builtin that it implements.  The symbol
-"m4_macro_table", is a pointer to a table of "m4)macro", listing each
+"m4_macro_table", is a pointer to a table of "m4_macro", listing each
 text macro initialised by the module.  These tables end with an
 entry where name == NULL.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]