Generalize somewhat (now works for alpha too).
This commit is contained in:
parent
4fb8bf7262
commit
b1fe1c2452
@ -1,4 +1,4 @@
|
|||||||
# $NetBSD: genassym.awk,v 1.1 1997/02/03 21:31:17 gwr Exp $
|
# $NetBSD: genassym.awk,v 1.2 1997/09/10 16:25:07 gwr Exp $
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 1997 The NetBSD Foundation, Inc.
|
# Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||||
@ -44,30 +44,38 @@ BEGIN {
|
|||||||
len = 0;
|
len = 0;
|
||||||
val = 0;
|
val = 0;
|
||||||
str = "";
|
str = "";
|
||||||
|
translate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/\t\.ascii/ {
|
# This marks the beginning of the part we should translate.
|
||||||
|
# Note: leading _ is absent on some platforms (e.g. alpha).
|
||||||
|
/^_?assyms:/ {
|
||||||
|
translate = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/^\t\.ascii/ {
|
||||||
|
if (!translate)
|
||||||
|
next;
|
||||||
|
# Get NAME from "NAME\0"
|
||||||
len = length($2);
|
len = length($2);
|
||||||
str = substr($2,2,len-4);
|
str = substr($2,2,len-4);
|
||||||
printf("#define\t%s\t", str);
|
printf("#define\t%s\t", str);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/\t\.skip/ {
|
/^\t\.(skip|zero)/ {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/\t\.long/ {
|
/^\t\.(long|quad)/ {
|
||||||
val = 0 + $2;
|
if (!translate)
|
||||||
if ((val < 0) || (val > 999))
|
next;
|
||||||
printf("0x%x\n", val);
|
printf("%s\n", $2);
|
||||||
else
|
|
||||||
printf("%d\n", val);
|
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# This marks the end of the part we should translate.
|
# This marks the end of the part we should translate.
|
||||||
# Note: leading _ is allowed but not required.
|
# Note: leading _ is absent on some platforms (e.g. alpha).
|
||||||
/nassyms:/ {
|
/^_?nassyms:/ {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# $NetBSD: genassym.awk,v 1.1 1997/02/03 21:31:17 gwr Exp $
|
# $NetBSD: genassym.awk,v 1.2 1997/09/10 16:25:07 gwr Exp $
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 1997 The NetBSD Foundation, Inc.
|
# Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||||
@ -44,30 +44,38 @@ BEGIN {
|
|||||||
len = 0;
|
len = 0;
|
||||||
val = 0;
|
val = 0;
|
||||||
str = "";
|
str = "";
|
||||||
|
translate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/\t\.ascii/ {
|
# This marks the beginning of the part we should translate.
|
||||||
|
# Note: leading _ is absent on some platforms (e.g. alpha).
|
||||||
|
/^_?assyms:/ {
|
||||||
|
translate = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/^\t\.ascii/ {
|
||||||
|
if (!translate)
|
||||||
|
next;
|
||||||
|
# Get NAME from "NAME\0"
|
||||||
len = length($2);
|
len = length($2);
|
||||||
str = substr($2,2,len-4);
|
str = substr($2,2,len-4);
|
||||||
printf("#define\t%s\t", str);
|
printf("#define\t%s\t", str);
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/\t\.skip/ {
|
/^\t\.(skip|zero)/ {
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
/\t\.long/ {
|
/^\t\.(long|quad)/ {
|
||||||
val = 0 + $2;
|
if (!translate)
|
||||||
if ((val < 0) || (val > 999))
|
next;
|
||||||
printf("0x%x\n", val);
|
printf("%s\n", $2);
|
||||||
else
|
|
||||||
printf("%d\n", val);
|
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
# This marks the end of the part we should translate.
|
# This marks the end of the part we should translate.
|
||||||
# Note: leading _ is allowed but not required.
|
# Note: leading _ is absent on some platforms (e.g. alpha).
|
||||||
/nassyms:/ {
|
/^_?nassyms:/ {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user