support nested #if/#else/#endif sets, to allow ULTRIX compat code to handle

Mips ULTRIX and VAX ULTRIX from the same syscall table.
This commit is contained in:
cgd 1996-03-15 01:25:12 +00:00
parent 1079c8c2aa
commit 1b7b5cb771

View File

@ -1,5 +1,5 @@
#! /bin/sh - #! /bin/sh -
# $NetBSD: makesyscalls.sh,v 1.17 1995/10/07 06:28:31 mycroft Exp $ # $NetBSD: makesyscalls.sh,v 1.18 1996/03/15 01:25:12 cgd Exp $
# #
# Copyright (c) 1994 Christopher G. Demetriou # Copyright (c) 1994 Christopher G. Demetriou
# All rights reserved. # All rights reserved.
@ -108,6 +108,9 @@ s/\$//g
' < $2 | $awk " ' < $2 | $awk "
$toupper $toupper
BEGIN { BEGIN {
# to allow nested #if/#else/#endif sets
savedepth = 0
sysnames = \"$sysnames\" sysnames = \"$sysnames\"
sysprotos = \"$sysprotos\" sysprotos = \"$sysprotos\"
sysnumhdr = \"$sysnumhdr\" sysnumhdr = \"$sysnumhdr\"
@ -177,17 +180,30 @@ $1 ~ /^#[ ]*if/ {
print > sysent print > sysent
print > sysprotos print > sysprotos
print > sysnames print > sysnames
savesyscall = syscall savesyscall[++savedepth] = syscall
next next
} }
$1 ~ /^#[ ]*else/ { $1 ~ /^#[ ]*else/ {
print > sysent print > sysent
print > sysprotos print > sysprotos
print > sysnames print > sysnames
syscall = savesyscall if (savedepth <= 0) {
printf "%s: line %d: unbalenced #else\n", \
infile, NR
exit 1
}
syscall = savesyscall[savedepth]
next next
} }
$1 ~ /^#/ { $1 ~ /^#/ {
if ($1 ~ /^#[ ]*endif/) {
if (savedepth <= 0) {
printf "%s: line %d: unbalenced #endif\n", \
infile, NR
exit 1
}
savedepth--;
}
print > sysent print > sysent
print > sysprotos print > sysprotos
print > sysnames print > sysnames