Improve Gambit REPL (toolbar is semi transparent and the alpha can be set with set...
[gambit-c.git] / misc / set-regs
blobd23f7afce12768e188ab4aaa5195a83de8c07391
1 #! /bin/sh
3 # Time-stamp: <2010-01-19 17:56:00 feeley>
5 # Utility to change the number of registers in the virtual machine.
7 # Usage: misc/set-regs [ <NB_GVM_REGS> [ <NB_ARG_REGS> ]]
9 NB_GVM_REGS=$1
10 NB_ARG_REGS=$2
12 if [ "$NB_GVM_REGS" = "" ] ; then
13 NB_GVM_REGS=5
16 if [ "$NB_ARG_REGS" = "" ] ; then
17 NB_ARG_REGS=3
20 if [ "$NB_GVM_REGS" -lt 3 ] ; then
21 echo "NB_GVM_REGS=$NB_ARG_REGS but it must be >= 3"
22 exit 1
25 if [ "$NB_GVM_REGS" -gt 25 ] ; then
26 echo "NB_GVM_REGS=$NB_ARG_REGS but it must be <= 25"
27 exit 1
30 if [ "$NB_ARG_REGS" -lt 1 ] ; then
31 echo "NB_ARG_REGS=$NB_ARG_REGS but it must be >= 1"
32 exit 1
35 if [ "$NB_ARG_REGS" -gt 12 ] ; then
36 echo "NB_ARG_REGS=$NB_ARG_REGS but it must be <= 12"
37 exit 1
40 if [ "$NB_ARG_REGS" -gt `expr $NB_GVM_REGS - 2` ] ; then
41 echo "NB_ARG_REGS=$NB_ARG_REGS but it must be <= `expr $NB_GVM_REGS - 2`"
42 exit 1
45 # Make sure the bootstrap compiler is built.
47 make -j 2
49 # Save the current bootstrap compiler just in case something goes wrong.
51 cp gsc-comp gsc-comp-old
53 # Set the number of registers in the gsc/_t-c-1.scm file.
55 sed -e "s/(set! targ-nb-gvm-regs [0-9]*)/(set! targ-nb-gvm-regs $NB_GVM_REGS)/" -e "s/(set! targ-nb-arg-regs [0-9]*)/(set! targ-nb-arg-regs $NB_ARG_REGS)/" gsc/_t-c-1.scm > gsc/_t-c-1.scm-new
57 mv gsc/_t-c-1.scm-new gsc/_t-c-1.scm
59 # Build the new bootstrap compiler.
61 make -j 2
63 mv gsc/gsc gsc-comp
65 # Set the number of registers in the include/gambit.h file.
67 sed -e "s/#define ___NB_GVM_REGS [0-9]*/#define ___NB_GVM_REGS $NB_GVM_REGS/" -e "s/#define ___NB_ARG_REGS [0-9]*/#define ___NB_ARG_REGS $NB_ARG_REGS/" include/gambit.h.in > include/gambit.h.in-new
69 mv include/gambit.h.in-new include/gambit.h.in
71 # All the .c files previously generated by gsc are now invalid.
73 make bootclean
75 # Build the system using the new compiler.
77 make -j 2