]> thyrsus.com Git - mad.git/commitdiff
Implement +1 of dimensions.
authorEric S. Raymond <esr@thyrsus,com>
Thu, 19 Feb 2004 04:46:24 +0000 (04:46 +0000)
committerEric S. Raymond <esr@thyrsus,com>
Thu, 19 Feb 2004 04:46:24 +0000 (04:46 +0000)
mad

diff --git a/mad b/mad
index 3350d28236ba3bec56583cdf4e2be22d493f2fec..3382f90913baef89478774c549646e0df2787d00 100755 (executable)
--- a/mad
+++ b/mad
@@ -1024,8 +1024,11 @@ def generate_C_code(out):
             for var in vars:
                 declarations += " " + var
                 if var in dimensions:
-                    for dim in dimensions[var]:
-                        declarations += "[" + print_C_expr(dim) + "]"
+                    # Screwy MAD semantics, all dimensions are bumped up 1.
+                    # Probably designed as a cheap way to prevent fencepost
+                    # errors.
+                    size_expr = ('+', dimensions[var][0], ('intnum', '1'))
+                    declarations += "[" + print_C_expr(size_expr) + "]"
                 declarations += ","
             declarations = declarations[:-1] + "; "
     if declarations: