view tpc @ 251:2557ce4e671f

Fix a couple of compiler bugs. topenv was getting initialized in multiple places. This resulted in multiple copies of modules getting created which caused problems for macro expansion. Additionally, arguments were not being marked as declared during code generation so assigning to an argument that was not closed over generated invalid C code.
author Michael Pavone <pavone@retrodev.com>
date Fri, 11 Apr 2014 22:29:32 -0700
parents c801dccdb4fb
children
line wrap: on
line source

#!/bin/sh

args=
dir=`dirname $0`
while [ $# -gt 0 ]; do
	if [ "-o" = "$1" ]; then
		shift
		output="$1"
	else	
		args="$args $1"
	fi
	shift
done

if [ $output ]; then
	if d8 $dir/tpc.js -- $args > $output; then
		exit
	else
		code=$?
		cat $output 1>&2
		rm -f $output
		exit $code
	fi
else
	d8 $dir/tpc.js -- $args
fi