
# Configuration options for translating the p2c examples.


Language	HP	# All programs are in HP Pascal dialect

VarFiles	0	# This helps basic.p's listtokens procedure work

UseEnum		0	# Not necessary except to keep Sun's pitpicking
			# compiler happy.


# These kludges will get basic.c to compile without extra runtime support:
# External procedures:
FuncMacro	hpm_new(p,n) = (*p = Malloc(n))
FuncMacro	hpm_dispose(p,n) = Free(*p)
#FuncMacro	hpm_new(p,n) = (*p = new char[n])
#FuncMacro	hpm_dispose(p,n) = (delete [] *p)
FuncMacro	misc_getioerrmsg(s,io) = sprintf(s, "I/O Error %d", (int)io)
FuncMacro	misc_printerror(er,io) = printf("Error %d/%d!\n", (int)er, (int)io)
FuncMacro	gotoxy(a,b) = (a,b)
# Functions imported from asm:
FuncMacro	asm_iand(a,b) = (a & b)
FuncMacro	asm_ior(a,b) = (a | b)
# Functions in basic.p; may as well do these, too:
FuncMacro	ixor(a,b) = (a ^ b)
FuncMacro	inot(a) = (~a)

# Give main() an explicit return type.  Without this p2c emits a bare
# "main(argc, argv)", and implicit int has been invalid C since C99, so the
# translated examples fail to compile on any current compiler.
MainType	int

# Read strings with fgets and a length check rather than gets(). gets() was
# removed from the C standard in C11 and glibc no longer declares it, so the
# default makes basic.c fail to compile on Linux. It is also the classic
# buffer-overflow function, so this is the better behaviour regardless.
UseGets	0
