Debian Codegraph @

editors/dumpbuiltin.sh

raw
1 #!/bin/sh -
2 # Copyright 1996-20xx The NASM Authors - All Rights Reserved
3 # SPDX-License-Identifier: BSD-2-Clause
4
5 #
6 # Run the nasm binary and extract the list of macros that may or may
7 # not be defined in .mac files.
8 #
9
10 tmp="$(mktemp -d)"
11 [ -n "$tmp" ] || exit 1
12
13 if [ -n "$1" ]; then
14 NASM="$1"
15 fi
16
17 : > "$tmp/junk.asm"
18 "$NASM" -f bin -o "$tmp/junk.bin" -Lsb -l "$tmp/junk.lst" "$tmp/junk.asm"
19 printf ';;; Automatically generated list of builtin macros\n'
20 sed -n -E -e 's/^[^;]*;;; *(%i?(define|defalias|macro)) ([^ ]*) .*$/\1 \3/p'\
21 < "$tmp/junk.lst"
22 rm -rf "$tmp"