res = t[1]
if len(t) > 2:
for dim in t[2]:
- res += '[' + print_C_expr(('-', dim[1], ('intnum', '1'))) + ']'
+ res += '[' + print_C_expr(dim) + ']'
return res
elif t[0] == 'apply':
madfunc = t[1][:-1]
elif not target and len(arguments) > 1:
sys.stderr.write("mad: -o is required with multiple sourcefiles.\n")
sys.exit(1)
- out = open(target + ".c", "w")
+ stem = target
+ if target[-2] == '.':
+ stem = target[:2]
+ out = open(stem + ".c", "w")
generate_C_code(out)
out.close()
if binary:
if hasmain:
if not target:
target = arguments[0][:-4]
- compile = "gcc -std=c99 %s.c -lm -o %s" % (target, target)
+ compile = "gcc -std=c99 %s.c -lm -o %s" % (stem, target)
else:
if not target:
target = arguments[0][:-4] + ".o"
- compile = "gcc -std=c99 -c %s.c -o %s" % (target, target)
+ compile = "gcc -std=c99 -c %s.c -o %s" % (stem, target)
if os.system(compile) == 0:
- os.system("rm -f " + target + ".c")
+ os.system("rm -f " + stem + ".c")
# end