From: Eric S. Raymond Date: Thu, 19 Feb 2004 04:46:24 +0000 (+0000) Subject: Implement +1 of dimensions. X-Git-Tag: 1.0~65 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=74dce372f42f90885f2c590639dd0f6ad63cd7f5;p=mad.git Implement +1 of dimensions. --- diff --git a/mad b/mad index 3350d28..3382f90 100755 --- 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: