build: Add pointer.sh.

* build-aux/pointer.sh: New script.
This commit is contained in:
Jan Nieuwenhuizen 2019-10-22 08:13:47 +02:00
parent 1355801104
commit 630e11422c
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 47 additions and 0 deletions

47
build-aux/pointer.sh Executable file
View File

@ -0,0 +1,47 @@
#! /bin/sh
set -x
ptr_once='s,([^N])(MACRO|NAME|VALUE) \(([^()]*)\),\1\3->\L\2,'
ptr_once='s,([^N])(BYTES|CAR|CDR|CLOSURE|CONTINUATION|LENGTH|MACRO|NAME|PORT|REF|STRING|STRUCT|TYPE|VALUE|VARIABLE|VECTOR) \(([^()]*)\),\1\3->\L\2,'
ncbytes='s,NC(BYTES) \(([^()]*)\),news_\L\1 (\2),'
cbytes='s,([^N])C(BYTES) \(([^()]*)\),\1cell_\L\2 (\3),'
cstring='s,C(STRING) \(([^()]*)\),cell_bytes (STRING (\2)),'
sed -ri \
-e "$ncbytes" \
-e "$cbytes" \
-e "$cstring" \
\
-e "$ncbytes" \
-e "$cbytes" \
-e "$cstring" \
\
-e "$ptr_once" \
-e "$ptr_once" \
-e "$ptr_once" \
-e 's,->struct,->structure,g' \
\
-e 's,CAAR \(([^()]*)\),\1->car->car,' \
-e 's,CADR \(([^()]*)\),\1->cdr->car,' \
-e 's,CDAR \(([^()]*)\),\1->car->cdr,' \
-e 's,CDDR \(([^()]*)\),\1->cdr->cdr,' \
-e 's,CADAR \(([^()]*)\),\1->car->cdr->car,' \
-e 's,CDDDR \(([^()]*)\),\1->cdr->cdr->cdr,' \
-e 's,CDADAR \(([^()]*)\),\1->cdr->car->cdr->car,' \
\
src/builtins.c \
src/display.c \
src/eval-apply.c \
src/gc.c \
src/hash.c \
src/lib.c \
src/math.c \
src/mes.c \
src/module.c \
src/posix.c \
src/reader.c \
src/string.c \
src/struct.c \
src/symbols.c \
src/vector.c