4 PIC16DEVICES
="${2:-pic16devices.txt}";
8 echo "Usage: $0 path-to-gputils-sources name-of-pic16devices.txt";
13 if [ ! -f "$GPUTILS/libgputils/gpprocessor.c" ]; then
14 echo "$GPUTILS/libgputils/gpprocessor.c not found.";
18 if [ ! -f "$PIC16DEVICES" ]; then
19 echo "$PIC16DEVICES not found.";
23 BASE
=$
(readlink
-f $
(dirname "$0"));
24 SEDSCRIPT
="update_xinst.sed";
25 FULL
="${PIC16DEVICES}-full";
26 OUTPUT
="${PIC16DEVICES}-xinst";
28 grep 'PROC_CLASS_PIC16' "$1/libgputils/gpprocessor.c" \
29 |
sed -e '/"p1\w*"/ { s/^.*"p\(1\w*\)".*,\s*\([01]\)\s*}[^}]*$/\1 \2/; p }; d' \
30 |
while read p xinst
; do \
31 printf '/name\s*'"$p"'\s*$/ {a\\\nXINST '"$xinst"'\n}\n'; \
33 perl
"$BASE/optimize_pic16devices.pl" -u "$PIC16DEVICES" | \
34 grep -v '^XINST\s*[01]\s*$' | \
35 sed -f "$SEDSCRIPT" > "$FULL";
37 perl
"$BASE/optimize_pic16devices.pl" -o "$FULL" > "$OUTPUT";
39 if diff -up "$PIC16DEVICES" "$OUTPUT"; then
40 echo "No update required.";
43 echo "Update $PIC16DEVICES from $OUTPUT [y/N]? ";
48 mv "$OUTPUT" "$PIC16DEVICES";