Description: <short summary of the patch>
 TODO: Put a short summary on the line above and replace this paragraph
 with a longer explanation of this change. Complete the meta-information
 with other relevant fields (see below for details). To make it easier, the
 information below has been extracted from the changelog. Adjust it or drop
 it.
 .
 gcl (2.6.10-8) unstable; urgency=high
 .
   * 2.6.11pre test 7
Author: Camm Maguire <camm@debian.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- gcl-2.6.10.orig/configure
+++ gcl-2.6.10/configure
@@ -3187,7 +3187,10 @@ if test "$enable_static" = "yes" ; then
 $as_echo "#define STATIC_LINKING 1" >>confdefs.h
 
 fi
-
+case $use in
+     *gnuwin*)
+	TLDFLAGS="$TLDFLAGS -Wl,--stack,8000000";;
+esac
 
 ## finally warn if we did not find a recognized machine.s
 ##
--- gcl-2.6.10.orig/configure.in
+++ gcl-2.6.10/configure.in
@@ -433,7 +433,10 @@ if test "$enable_static" = "yes" ; then
    TLDFLAGS="-static -Wl,-zmuldefs $TLDFLAGS"; #FIXME should be in unixport/makefile
    AC_DEFINE(STATIC_LINKING,1,[staticly linked images])
 fi
-
+case $use in
+     *gnuwin*)
+	TLDFLAGS="$TLDFLAGS -Wl,--stack,8000000";;
+esac
 
 ## finally warn if we did not find a recognized machine.s
 ##
--- /dev/null
+++ gcl-2.6.10/h/apply_n.h
@@ -0,0 +1,101 @@
+static inline object
+c_apply_n(object (*f)(), int n, object *x) {
+
+  switch (n) {
+  case  0: return f();
+  case  1: return f(x[0]);
+  case  2: return f(x[0],x[1]);
+  case  3: return f(x[0],x[1],x[2]);
+  case  4: return f(x[0],x[1],x[2],x[3]);
+  case  5: return f(x[0],x[1],x[2],x[3],x[4]);
+  case  6: return f(x[0],x[1],x[2],x[3],x[4],x[5]);
+  case  7: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6]);
+  case  8: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7]);
+  case  9: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8]);
+  case 10: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9]);
+  case 11: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10]);
+  case 12: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11]);
+  case 13: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12]);
+  case 14: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13]);
+  case 15: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14]);
+  case 16: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15]);
+  case 17: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16]);
+  case 18: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17]);
+  case 19: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18]);
+  case 20: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19]);
+  case 21: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20]);
+  case 22: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21]);
+  case 23: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22]);
+  case 24: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23]);
+  case 25: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24]);
+  case 26: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25]);
+  case 27: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26]);
+  case 28: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27]);
+  case 29: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28]);
+  case 30: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29]);
+  case 31: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30]);
+  case 32: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31]);
+  case 33: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32]);
+  case 34: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33]);
+  case 35: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34]);
+  case 36: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35]);
+  case 37: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36]);
+  case 38: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37]);
+  case 39: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38]);
+  case 40: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39]);
+  case 41: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40]);
+  case 42: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41]);
+  case 43: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42]);
+  case 44: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43]);
+  case 45: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44]);
+  case 46: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45]);
+  case 47: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46]);
+  case 48: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47]);
+  case 49: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48]);
+  case 50: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49]);
+  case 51: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50]);
+  case 52: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51]);
+  case 53: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52]);
+  case 54: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53]);
+  case 55: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54]);
+  case 56: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55]);
+  case 57: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56]);
+  case 58: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57]);
+  case 59: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57],x[58]);
+  case 60: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57],x[58],x[59]);
+  case 61: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57],x[58],x[59],x[60]);
+  case 62: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57],x[58],x[59],x[60],x[61]);
+  case 63: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57],x[58],x[59],x[60],x[61],x[62]);
+  case 64: return f(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9],x[10],x[11],x[12],x[13],x[14],x[15],x[16],x[17],x[18],x[19],x[20],x[21],x[22],x[23],x[24],x[25],x[26],x[27],x[28],x[29],x[30],x[31],x[32],x[33],x[34],x[35],x[36],x[37],x[38],x[39],x[40],x[41],x[42],x[43],x[44],x[45],x[46],x[47],x[48],x[49],x[50],x[51],x[52],x[53],x[54],x[55],x[56],x[57],x[58],x[59],x[60],x[61],x[62],x[63]);
+  default: FEerror("Exceeded call-arguments-limit ",0);return Cnil;
+  }
+}
+
+#include <string.h>
+
+static inline object
+c_apply_vp1(object (*f)(),int n,object *b) {
+
+  object *b1=alloca((n+1)*sizeof(object));
+
+  memcpy(b1,b,n*sizeof(object));
+  b1[n]=OBJNULL;
+
+  return c_apply_n(f,n+1,b1);
+
+}
+
+static inline object
+c_apply_n_fun(object fun,int n,object *b) {
+
+  return !n && type_of(fun)==t_vfun && n==fun->vfn.vfn_minargs && n<fun->vfn.vfn_maxargs ? 
+    c_apply_vp1(fun->vfn.vfn_self,n,b) : c_apply_n(fun->vfn.vfn_self,n,b);
+
+}
+
+static inline object
+c_apply_n_f(object (*f)(),int n,object *b,int min,int max) {
+
+  return !n && n==min && n<max ? c_apply_vp1(f,n,b) : c_apply_n(f,n,b);
+
+}
--- gcl-2.6.10.orig/h/att_ext.h
+++ gcl-2.6.10/h/att_ext.h
@@ -623,7 +623,6 @@ object list_vector_new();
 object Iapply_ap();
 object IisFboundp();
 object IapplyVector();
-object c_apply_n();
 EXTER object sSPmemory;
 EXTER object sSPinit;
 object sLfset();
--- gcl-2.6.10.orig/h/protoize.h
+++ gcl-2.6.10/h/protoize.h
@@ -232,7 +232,6 @@ typedef void (*funcvoid)(void);
 /* frame.c:69:OF */ extern frame_ptr frs_sch_catch (object frame_id); /* (frame_id) object frame_id; */
 /* funlink.c:19:OF */ extern void call_or_link (object sym, void **link); /* (sym, link) object sym; void **link; */
 /* funlink.c:41:OF */ extern void call_or_link_closure (object sym, void **link, void **ptr); /* (sym, link, ptr) object sym; void **link; object *ptr; */
-/* funlink.c:230:OF */ extern object c_apply_n (object (*fn)(), int n, object *x); /* (fn, n, x) long int (*fn)(); int n; object *x; */
 /* funlink.c:696:OF */ extern object call_proc0 (object sym, void *link); /* (sym, link) object sym; void *link; */
 /* funlink.c:784:OF */ extern int clear_stack (object *beg, object *limit); /* (beg, limit) object *beg; object *limit; */
 /* funlink.c:821:OF */ extern void gcl_init_links (void); /* () */
@@ -558,6 +557,9 @@ typedef void (*funcvoid)(void);
 /*  readline.d */
 extern int readline_on;
 void
+gcl_init_readline(void);
+
+void
 gcl_init_readline_function(void);
 
 /*  sys_gcl.c */
--- gcl-2.6.10.orig/o/eval.c
+++ gcl-2.6.10/o/eval.c
@@ -55,38 +55,7 @@ warn_avma()
 object sSAbreak_pointsA;
 object sSAbreak_stepA;
 
-
-/* This is a temporary workaround.  m68k cannot find the result 
-   of a function returning long when invoked via a function pointer
-   declared as a function returning a pointer, in this case, an 
-   object.  A proper fix will require rewriting sections of the lisp
-   compiler to separate the calling procedures for functions returning
-   an object from functions returning a long.  CM  20020801 */
-/*  #if defined(__mc68020__) */
-/*  #define LCAST(a) (object)(*(long(*)())a) */
-/*  #else */
-#define LCAST(a) (*a)
-/*  #endif */
-
-#define SET_TO_APPLY(res,f,n,x) \
- switch(n) {\
- case 0:   res=LCAST(f)(); break;\
-  case 1:  res=LCAST(f)(x[0]); break; \
-  case 2:  res=LCAST(f)(x[0],x[1]);break; \
-  case 3:  res=LCAST(f)(x[0],x[1],x[2]);break; \
-  case 4:  res=LCAST(f)(x[0],x[1],x[2],x[3]);break; \
-  case 5:  res=LCAST(f)(x[0],x[1],x[2],x[3],x[4]);break; \
-  case 6:  res=LCAST(f)(x[0],x[1],x[2],x[3],x[4],x[5]);  break;\
-  case 7:  res=LCAST(f)(x[0],x[1],x[2],x[3],x[4],x[5], x[6]); break;\
-  case 8:  res=LCAST(f)(x[0],x[1],x[2],x[3],x[4],x[5], x[6],x[7]); break;\
-  case 9:  res=LCAST(f)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8]);break;\
-  case 10: res=LCAST(f)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],x[8],x[9]);break;\
-   default: res=c_apply_n(*f,n,x); break;}
-
-/*
-#undef SET_TO_APPLY
-#define SET_TO_APPLY(res,f,n,x)  res=c_apply_n(f,n,x);
-*/
+#include "apply_n.h"
 
 /* for t_sfun,t_gfun with args on vs stack */
 
@@ -114,7 +83,7 @@ quick_call_sfun(object fun)
      for (j=0; j<n ; j++)
        {enum ftype typ=SFUN_NEXT_TYPE(i);
 	x[j]=COERCE_ARG(vs_base[j],typ);}}
-  SET_TO_APPLY(res,fun->sfn.sfn_self,n,x);
+  res=c_apply_n_fun(fun,n,x);
   base[0]=
     (restype==f_object ?  res :
      restype==f_fixnum ? make_fixnum((long)res)
@@ -131,7 +100,7 @@ call_sfun_no_check(object fun)
   int n;
   object *base=vs_base;
   n=vs_top - base;
-  SET_TO_APPLY(base[0],fun->sfn.sfn_self,n,base);
+  base[0]=c_apply_n_fun(fun,n,base);
   vs_top=(vs_base=base)+1;
   CHECK_AVMA;
   return;
@@ -147,7 +116,7 @@ call_vfun(object fun)
   if (n > fun->vfn.vfn_maxargs)
     {FEtoo_many_arguments(base,vs_top); return;}
   VFUN_NARGS = n;
-  SET_TO_APPLY(base[0],fun->sfn.sfn_self,n,base);
+  base[0]=c_apply_n_fun(fun,n,base);
   vs_top=(vs_base=base)+1;
   CHECK_AVMA;
   return;
@@ -1455,7 +1424,7 @@ fcalln_vfun(object first,va_list vl)
 {object *new,res;
  DEBUG_AVMA
  COERCE_VA_LIST_NEW(new,first,vl,fcall.argd);
- res = c_apply_n(fcall.fun->vfn.vfn_self,fcall.argd,new);
+ res = c_apply_n_fun(fcall.fun,fcall.argd,new);
  CHECK_AVMA;
  return res;
 }
--- gcl-2.6.10.orig/o/file.d
+++ gcl-2.6.10/o/file.d
@@ -322,12 +322,7 @@ deallocate_stream_buffer(object strm) {
   if (strm->sm.sm_buffer==NULL)
     return;
 
-/* SGC contblock pages: Its possible this is on an old page CM 20030827 */
-#ifdef SGC
-  insert_maybe_sgc_contblock(strm->sm.sm_buffer,BUFSIZ); 
-#else
-  insert_contblock(strm->sm.sm_buffer,BUFSIZ); 
-#endif
+  free(strm->sm.sm_buffer);
 
   massert(!setvbuf(strm->sm.sm_fp,strm->sm.sm_buffer=NULL,_IONBF,0));
 
--- gcl-2.6.10.orig/o/funlink.c
+++ gcl-2.6.10/o/funlink.c
@@ -254,344 +254,7 @@ clean_link_array(object *ar, object *ar_
  return(i*sizeof(object *));
  }
 
-/* This is a temporary workaround.  m68k cannot find the result 
-   of a function returning long when invoked via a function pointer
-   declared as a function returning a pointer, in this case, an 
-   object.  A proper fix will require rewriting sections of the lisp
-   compiler to separate the calling procedures for functions returning
-   an object from functions returning a long.  CM  20020801 */
-/*  #if defined(__mc68020__) */
-/*  #define LCAST(a) (object)(*(long(*)())a) */
-/*  #else */
-#define LCAST(a) (*a)
-/*  #endif */
-
-object
-c_apply_n(object (*fn)(), int n, object *x)
-{object res=Cnil;
- switch(n){
-    case 0:  res=LCAST(fn)();break;
-    case 1:  res=LCAST(fn)(x[0]);break;
-    case 2:  res=LCAST(fn)(x[0],x[1]);break;
-    case 3:  res=LCAST(fn)(x[0],x[1],x[2]);break;
-    case 4:  res=LCAST(fn)(x[0],x[1],x[2],x[3]);break;
-    case 5:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4]);break;
-    case 6:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5]);break;
-    case 7:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6]);break;
-    case 8:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7]);break;
-    case 9:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8]);break;
-    case 10:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9]);break;
-    case 11:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10]);break;
-    case 12:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11]);break;
-    case 13:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12]);break;
-    case 14:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13]);break;
-    case 15:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14]);break;
-    case 16:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15]);break;
-    case 17:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16]);break;
-    case 18:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17]);break;
-    case 19:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18]);break;
-    case 20:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19]);break;
-    case 21:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20]);break;
-    case 22:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21]);break;
-    case 23:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22]);break;
-    case 24:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23]);break;
-    case 25:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24]);break;
-    case 26:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25]);break;
-    case 27:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26]);break;
-    case 28:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27]);break;
-    case 29:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28]);break;
-    case 30:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29]);break;
-    case 31:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30]);break;
-    case 32:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31]);break;
-    case 33:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32]);break;
-    case 34:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33]);break;
-    case 35:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34]);break;
-    case 36:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35]);break;
-    case 37:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36]);break;
-    case 38:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37]);break;
-    case 39:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38]);break;
-    case 40:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39]);break;
-    case 41:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40]);break;
-    case 42:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41]);break;
-    case 43:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42]);break;
-    case 44:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43]);break;
-    case 45:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44]);break;
-    case 46:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45]);break;
-    case 47:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46]);break;
-    case 48:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47]);break;
-    case 49:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48]);break;
-    case 50:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49]);break;
-    case 51:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50]);break;
-    case 52:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50],x[51]);break;
-    case 53:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50],x[51],x[52]);break;
-    case 54:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50],x[51],x[52],x[53]);break;
-    case 55:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50],x[51],x[52],x[53],x[54]);break;
-    case 56:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50],x[51],x[52],x[53],x[54],x[55]);break;
-    case 57:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50],x[51],x[52],x[53],x[54],x[55],x[56]);break;
-    case 58:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50],x[51],x[52],x[53],x[54],x[55],x[56],
-         x[57]);break;
-    case 59:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50],x[51],x[52],x[53],x[54],x[55],x[56],
-         x[57],x[58]);break;
-    case 60:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50],x[51],x[52],x[53],x[54],x[55],x[56],
-         x[57],x[58],x[59]);break;
-    case 61:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50],x[51],x[52],x[53],x[54],x[55],x[56],
-         x[57],x[58],x[59],x[60]);break;
-    case 62:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50],x[51],x[52],x[53],x[54],x[55],x[56],
-         x[57],x[58],x[59],x[60],x[61]);break;
-    case 63:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50],x[51],x[52],x[53],x[54],x[55],x[56],
-         x[57],x[58],x[59],x[60],x[61],x[62]);break;
-    case 64:  res=LCAST(fn)(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],
-         x[8],x[9],x[10],x[11],x[12],x[13],x[14],
-         x[15],x[16],x[17],x[18],x[19],x[20],x[21],
-         x[22],x[23],x[24],x[25],x[26],x[27],x[28],
-         x[29],x[30],x[31],x[32],x[33],x[34],x[35],
-         x[36],x[37],x[38],x[39],x[40],x[41],x[42],
-         x[43],x[44],x[45],x[46],x[47],x[48],x[49],
-         x[50],x[51],x[52],x[53],x[54],x[55],x[56],
-         x[57],x[58],x[59],x[60],x[61],x[62],x[63]);break;
-  default: FEerror("Exceeded call-arguments-limit ",0);
-  } 
-
- return res;
-}
+#include "apply_n.h"
   
 /* Used for calling cfunctions which take object args, and return object 
 value.  This function is called by the static lnk function in the reference
@@ -634,51 +297,12 @@ call_proc(object sym, void **link, int a
     *link = (void *)fn;
   AFTER_LINK:	
  
-    if (nargs < 10) 
-    /* code below presumes sizeof(int) == sizeof(object)
-       Should probably not bother special casing the < 10 args
-     */
-      {object x0,x1,x2,x3,x4,x5,x6,x7,x8,x9;    
-       if (nargs-- > 0)
-	 x0=va_arg(ll,object);
-       else
-	 {return(LCAST(fn)());}
-       if (nargs-- > 0)
-	 x1=va_arg(ll,object);
-       else
-	 { return(LCAST(fn)(x0));}
-       if (nargs-- > 0)
-	 x2=va_arg(ll,object);
-       else
-	 {return(LCAST(fn)(x0,x1));}
-       if (nargs-- > 0)  x3=va_arg(ll,object);
-       else
-	 return(LCAST(fn)(x0,x1,x2));
-       if (nargs-- > 0)  x4=va_arg(ll,object);
-       else
-	 return(LCAST(fn)(x0,x1,x2,x3));
-       if (nargs-- > 0)  x5=va_arg(ll,object);
-       else
-	 return(LCAST(fn)(x0,x1,x2,x3,x4));
-       if (nargs-- > 0)  x6=va_arg(ll,object);
-       else
-	 return(LCAST(fn)(x0,x1,x2,x3,x4,x5));
-       if (nargs-- > 0)  x7=va_arg(ll,object);
-       else
-	 return(LCAST(fn)(x0,x1,x2,x3,x4,x5,x6));
-       if (nargs-- > 0)  x8=va_arg(ll,object);
-       else
-	 return(LCAST(fn)(x0,x1,x2,x3,x4,x5,x6,x7));
-       if (nargs-- > 0)  x9=va_arg(ll,object);
-       else
-	 return(LCAST(fn)(x0,x1,x2,x3,x4,x5,x6,x7,x8));
-       return(LCAST(fn)(x0,x1,x2,x3,x4,x5,x6,x7,x8,x9));
- 
-     }
-  else {object *new;
-	COERCE_VA_LIST(new,ll,nargs);
-	return(c_apply_n(fn,nargs,new));}
-  }
+    {
+      object *new;
+      COERCE_VA_LIST(new,ll,nargs);
+      return(c_apply_n_fun(fun,nargs,new));
+    }
+   }
  else				/* there is no cdefn property */
 /* regular_call: */
    { 
@@ -761,52 +385,12 @@ call_proc_new(object sym, void **link, i
    *link = (void *)fn;
    AFTER_LINK:	
    
-   if (nargs < 10) 
-     /* code below presumes sizeof(int) == sizeof(object)
-	Should probably not bother special casing the < 10 args
-     */
-     {object x0,x1,x2,x3,x4,x5,x6,x7,x8,x9;    
-     if (nargs-- > 0)
-       /* 	 x0=va_arg(ll,object); */
-       x0=first;
-     else
-       {return(LCAST(fn)());}
-     if (nargs-- > 0)
-       x1=va_arg(ll,object);
-     else
-       { return(LCAST(fn)(x0));}
-     if (nargs-- > 0)
-       x2=va_arg(ll,object);
-     else
-       {return(LCAST(fn)(x0,x1));}
-     if (nargs-- > 0)  x3=va_arg(ll,object);
-     else
-       return(LCAST(fn)(x0,x1,x2));
-     if (nargs-- > 0)  x4=va_arg(ll,object);
-     else
-       return(LCAST(fn)(x0,x1,x2,x3));
-     if (nargs-- > 0)  x5=va_arg(ll,object);
-     else
-       return(LCAST(fn)(x0,x1,x2,x3,x4));
-     if (nargs-- > 0)  x6=va_arg(ll,object);
-     else
-       return(LCAST(fn)(x0,x1,x2,x3,x4,x5));
-     if (nargs-- > 0)  x7=va_arg(ll,object);
-     else
-       return(LCAST(fn)(x0,x1,x2,x3,x4,x5,x6));
-     if (nargs-- > 0)  x8=va_arg(ll,object);
-     else
-       return(LCAST(fn)(x0,x1,x2,x3,x4,x5,x6,x7));
-     if (nargs-- > 0)  x9=va_arg(ll,object);
-     else
-       return(LCAST(fn)(x0,x1,x2,x3,x4,x5,x6,x7,x8));
-     return(LCAST(fn)(x0,x1,x2,x3,x4,x5,x6,x7,x8,x9));
-     
-     }
-   else {
+   {
      object *new;
      COERCE_VA_LIST_NEW(new,first,ll,nargs);
-     return(c_apply_n(fn,nargs,new));}
+     return(c_apply_n_fun(fun,nargs,new));
+   }
+   
    }
  else				/* there is no cdefn property */
    /* regular_call: */
--- gcl-2.6.10.orig/o/gcl_readline.d
+++ gcl-2.6.10/o/gcl_readline.d
@@ -60,50 +60,14 @@ static char *rl_putc_em_line = NULL;
 
 /* New completion generator avoids malloc excet where required, and
    dynamically searches current package lists -- 20040102 CM */
-#if 0
-
-static char **completion_list = NULL;
-static int case_sensitivity = 0;	/* 0 = case sensitive */
-					/* 1 = complete to lower case */
-					/* 2 = complete to upper case */
-
-/* Generator function for command completion.  STATE lets us know whether
-   to start from scratch; without any state (i.e. STATE == 0), then we
-   start at the top of the list. */
-static char *rl_completion_words(char *text, int state) {
-	static int list_index, len;
-	char *name;
-
-	/* If this is a new word to complete, initialize now.  This includes
-	  saving the length of TEXT for efficiency, and initializing the index
-	  variable to 0. */
-	if (state==0) {
-		list_index = 0;
-		len = strlen(text);
-	}
-
-	/* Return the next name which partially matches from the command list. */
-	while (completion_list!=NULL && (name=completion_list[list_index])!=NULL) {
-		list_index++;
-		if ( (case_sensitivity==0) ?
-			(strncmp(name, text, len)==0) :
-			(strncasecmp(name, text, len)==0) ) return strdup(name);
-	}
-
-	/* If no names matched, then return NULL. */
-	return NULL;
-}
-
-#endif
-
-/* New completion generator avoids malloc excet where required, and
-   dynamically searches current package lists -- 20040102 CM */
 
 /* FIXME -- consider mapping malloc to alloca for this function only */
 
 DEFVAR("*READLINE-PREFIX*",sSAreadline_prefixA,SI,Cnil,"");
 
-static char *rl_completion_words_new(char *text, int state) {
+static char *
+rl_completion_words(const char *text, int state) {
+
   static int i,len,internal,size,prefl;
   static object package,use,tp,*base,l;
   static const char *ftext,*wtext,*pref;
@@ -215,226 +179,88 @@ static char *rl_completion_words_new(cha
 typedef char *rl_compentry_func_t(const char *, int);
 #endif
 
-/* Attempt to complete on the contents of TEXT.  START and END bound the
-   region of rl_line_buffer that contains the word to complete.  TEXT is
-   the word to complete.  We can use the entire contents of rl_line_buffer
-   in case we want to do some simple parsing.  Return the array of matches,
-   or NULL if there aren't any. */
-/* extern char **rl_completion_matches(char *,char *(*)(char *,int)); */
-static char **rl_completion(const char *text, int start, int end) {
-	return rl_completion_matches(text, (rl_compentry_func_t *)rl_completion_words_new);
-}
 #endif
 
 int rl_putc_em(int c, FILE *f) {
-	static int allocated_length = 0;
-	static int current_length = 0;
-	char *old_line;
-
-	if (f!=stdout || !isatty(fileno(f)) ) goto tail;
-
-	if (c=='\r' || c=='\n') {
-		current_length = 0;
-		if (allocated_length>0) rl_putc_em_line[0] = 0;
-		goto tail;
-	}
-	
-	if (current_length+2 > allocated_length) {
-		allocated_length = (current_length+8)*2;
-		old_line = rl_putc_em_line;
-		rl_putc_em_line = realloc(old_line, allocated_length);
-		if (rl_putc_em_line==NULL) {
-			free(old_line);
-			allocated_length = 0;
-			current_length = 0;
-			goto tail;
-		}
-	}
-	
-	rl_putc_em_line[current_length++] = (unsigned char)c;
-	rl_putc_em_line[current_length] = 0;
 
-	tail:
-	return putc(c, f);
+  static int allocated_length = 0;
+  static int current_length = 0;
+  char *old_line;
+  
+  if (f!=stdout || !isatty(fileno(f)) ) goto tail;
+  
+  if (c=='\r' || c=='\n') {
+    current_length = 0;
+    if (allocated_length>0) rl_putc_em_line[0] = 0;
+    goto tail;
+  }
+  
+  if (current_length+2 > allocated_length) {
+    allocated_length = (current_length+8)*2;
+    old_line = rl_putc_em_line;
+    rl_putc_em_line = realloc(old_line, allocated_length);
+    if (rl_putc_em_line==NULL) {
+      free(old_line);
+      allocated_length = 0;
+      current_length = 0;
+      goto tail;
+    }
+  }
+  
+  rl_putc_em_line[current_length++] = (unsigned char)c;
+  rl_putc_em_line[current_length] = 0;
+  
+ tail:
+  return putc(c, f);
+
 }
 
 int rl_getc_em(FILE *f) {
-	static char *line = NULL;
-	static int linepos = 0;
-	int r;
-	
-	if (f!=stdin || !isatty(fileno(f)) ) return getc(f);
-	
-	if (rl_ungetc_em_char!=-1) {
-		r = rl_ungetc_em_char;
-		rl_ungetc_em_char = -1;
-		return r;
-	}
-	
-	if (line==NULL) {
-		if (readline_on==1) {
- 			putc('\r', stdout);
-			line = readline(rl_putc_em_line);
- 			rl_putc_em('\r', stdout);
-			if (line==NULL) return *rl_line_buffer=EOF;
-			if (line[0] != 0) add_history(line);
-		} else {
-			return getc(f);
-		}
-	}
 
-	if (line[linepos]==0) {
-		free(line);
-		line = NULL;
-		linepos = 0;
-		if (rl_line_buffer) *rl_line_buffer=0;
-		return '\n';
-	}
+  static char *line = NULL;
+  static int linepos = 0;
+  int r;
+  
+  if (f!=stdin || !isatty(fileno(f)) ) return getc(f);
+  
+  if (rl_ungetc_em_char!=-1) {
+    r = rl_ungetc_em_char;
+    rl_ungetc_em_char = -1;
+    return r;
+  }
+  
+  if (line==NULL) {
+    if (readline_on==1) {
+      putc('\r', stdout);
+      line = readline(rl_putc_em_line);
+      rl_putc_em('\r', stdout);
+      if (line==NULL) return *rl_line_buffer=EOF;
+      if (line[0] != 0) add_history(line);
+    } else {
+      return getc(f);
+    }
+  }
+  
+  if (line[linepos]==0) {
+    free(line);
+    line = NULL;
+    linepos = 0;
+    if (rl_line_buffer) *rl_line_buffer=0;
+    return '\n';
+  }
+  
+  return line[linepos++];
 
-	return line[linepos++];
 }
 
 int rl_ungetc_em(int c, FILE *f) {
-	if (f!=stdin || !isatty(fileno(f)) ) return ungetc(c, f);
-	rl_ungetc_em_char = ((unsigned char)c);
-	return c;
-}
 
+  if (f!=stdin || !isatty(fileno(f)) ) return ungetc(c, f);
+  rl_ungetc_em_char = ((unsigned char)c);
+  return c;
 
-/* readline support now initialized automatically -- 20040102 CM */
-#if 0
-
-static int qsort_compare(const void *a, const void *b) {
-	const char *ac = *((const char **)a);
-	const char *bc = *((const char **)b);
-	return strcmp(ac, bc);
 }
 
-/* Usage: 
- * (si::READLINE-INIT <onoff> <progname> <case> <wordlist>)
- * Where
- *	onoff: T or NIL. T enables Readline support, NIL disables.
- *		When disabled, uses normal getc calls to read input.
- *	progname: STRING. Program name for Readline. This is used to specify
- *		program specific key binding in ~/.inputrc. For more
- *		information about .inputrc, read Readline documentation.
- *	case: 0, 1 or 2. Defines how different cases in word completion
- *		are handled.
- *		0 = case sensitive completion.
- *		1 = case insensitive completion. Everything completed to lower case.
- *		2 = case insensitive completion. Everything completed to upper case.
- *	wordlist: LIST of STRINGs. These are the candidate words for completion.
- *		NIL disables word completion.
- * Examples:
- * (si::READLINE-INIT nil nil nil nil)		; Disable Readline
- * (si::READLINE-INIT t "Gcl" 1 '("first" "second" "third" "rest"))
- */
-
-/* Should this return void or what? Should input args be void? */
-static void
-FFN(siLreadline_init)() {
-	object on_or_off;
-	object program_name;
-	object case_type;
-	object word_list;
-
-	object con, word;
-	char **charp;
-	int words, i, j;
-	char c,*cp;
-
-	if (!isatty(0))
-	   return;
-
-	if ((cp=getenv("TERM")) && !strcmp(cp,"dumb"))
-	   return;
-
-	check_arg(4);
-
-	on_or_off    = vs_base[0];
-	program_name = vs_base[1];
-	case_type    = vs_base[2];
-	word_list    = vs_base[3];
-
-	if (on_or_off==Cnil) {
-		/* Disable Readline support */
-		readline_on = 0;
-	} else {
-		/* Enable Readline support */
-		readline_on = 1;
-
-		if (type_of(program_name)==t_string) {
-
-			static char *mrln;
-
-			if (mrln)
-				free(mrln);
-			mrln = malloc(program_name->st.st_fillp+1);
-			if (!mrln) FEerror("Out of memory.", 0); 
-			for (i=0; i<program_name->st.st_fillp; i++)
-				mrln[i] = program_name->ust.ust_self[i];
-			mrln[i] = 0;
-			rl_readline_name=mrln;
-			rl_initialize();
-		} else {
-			FEerror("~S is not a string.", 1, program_name);
-		}
-
-		if (type_of(case_type)==t_fixnum) {
-			i = fix(case_type);
-			if (i<0 || i>2) FEerror("Case sensitivity must be between 0 and 2", 0);
-			case_sensitivity = i;
-		} else {
-			FEerror("~S is not a fixnum.", 1, case_type);
-		}
-
-		if (type_of(word_list)==t_cons || word_list==Cnil) {
-#ifdef RL_COMPLETION
-			/* First count the number of completion words and check their type */
-			words = 0;
-			for (con=word_list; con!=Cnil; con=con->c.c_cdr) {
-				word = con->c.c_car;
-				if (type_of(word)!=t_string)
-					FEerror("Completion list ~S contains non-strings.", 1, word_list);
-				words++;
-			}
-
-			/* Free old list */
-			if (completion_list!=NULL) {
-				for (charp=completion_list; *charp!=NULL; charp++)
-					free(*charp);
-				free(completion_list);
-			}
-
-			/* Set up the new completion list */
-			completion_list = malloc(sizeof(*completion_list) * (words+1));
-			if (completion_list==NULL) FEerror("Out of memory.", 0);
-			for (con=word_list,i=0; con!=Cnil; con=con->c.c_cdr,i++) {
-				word = con->c.c_car;
-				completion_list[i] = malloc(sizeof(char) * (word->st.st_fillp+1));
-				if (completion_list[i]==NULL) FEerror("Out of memory.", 0);
-				for (j=0; j<word->st.st_fillp; j++) {	
-					c = word->ust.ust_self[j];
-					if (case_sensitivity!=0) 
-						c = (case_sensitivity==1) ? tolower(c) : toupper(c);
-					(completion_list[i])[j] = c;
-				}
-				(completion_list[i])[j] = 0;
-			}
-			completion_list[i] = NULL;
-
-			/* Sort the completion list */
-			qsort(completion_list, words, sizeof(*completion_list), &qsort_compare);
-#endif
-		} else {
-			FEerror("~S is not a list.", 1, word_list);
-			/* or maybe use FEwrong_type_argument(...); */
-		}
-	}
-}
-#endif
-
-
 static void
 FFN(siLreadline_on)() {
 
@@ -465,19 +291,21 @@ FFN(siLreadline_off)() {
 
 void
 gcl_init_readline_function(void) {
-  static int n;
-  char *pn="GCL",*cp=getenv("TERM");
-  rl_readline_name=pn;
+  char *cp=getenv("TERM");
+
+  rl_readline_name="GCL";
 #ifdef RL_COMPLETION
-  rl_attempted_completion_function = rl_completion;
+  rl_completion_entry_function = rl_completion_words;
 #endif			
   if (isatty(0) && (!cp || strcmp(cp,"dumb")))
     readline_on=1;
-  if (!n) {
-    make_si_function("READLINE-ON", siLreadline_on);
-    make_si_function("READLINE-OFF", siLreadline_off);
-    n=1;
-  }
+
+}
+
+void
+gcl_init_readline(void) {
+  make_si_function("READLINE-ON", siLreadline_on);
+  make_si_function("READLINE-OFF", siLreadline_off);
 }
 
 #endif /* HAVE_READLINE */
--- gcl-2.6.10.orig/o/main.c
+++ gcl-2.6.10/o/main.c
@@ -304,8 +304,7 @@ main(int argc, char **argv, char **envp)
     
     if (argc>1) {
       massert(argv[1][strlen(argv[1])-1]=='/');
-      system_directory= (char *) malloc(strlen(argv[1])+3);
-      strcpy(system_directory, argv[1]);
+      system_directory=argv[1];
     }
 
     initlisp();
@@ -326,13 +325,16 @@ main(int argc, char **argv, char **envp)
     reinit_gmp();
 #endif
     gcl_init_big1();
+#ifdef HAVE_READLINE
+    gcl_init_readline_function();
+#endif
 
   }
 
 #ifdef _WIN32
   detect_wine();
 #endif
-  
+
   sSAlisp_maxpagesA->s.s_dbind = make_fixnum(real_maxpage);
 
   ihs_push(Cnil);
@@ -527,7 +529,7 @@ initlisp(void) {
 	gcl_init_cmac();
 #endif	
 #ifdef HAVE_READLINE
-        gcl_init_readline_function();
+	gcl_init_readline();
 #endif
 
 }
--- gcl-2.6.10.orig/o/makefun.c
+++ gcl-2.6.10/o/makefun.c
@@ -82,12 +82,17 @@ closure.")
   return sym;
 }
 
+#include "apply_n.h"
+
 DEFUN_NEW("INITMACRO",object,fSinitmacro,SI,4,ARG_LIMIT,NONE,OO,OO,OO,OO,(object first,...),
       "Like INITFUN, but makes then sets the 'macro' flag on this symbol")
 {va_list ap;
  object res;
+ int n = VFUN_NARGS;
+ object *new;
  va_start(ap,first);
- res = Iapply_ap_new((object (*)())FFN(fSinitfun),first,ap);
+ COERCE_VA_LIST_NEW(new,first,ap,n);
+ res= c_apply_n_f((void *)FFN(fSinitfun),n,new,3,ARG_LIMIT);
  va_end(ap);
  res->s.s_mflag = 1;
  return res;
--- gcl-2.6.10.orig/o/nfunlink.c
+++ gcl-2.6.10/o/nfunlink.c
@@ -175,6 +175,8 @@ union {int i;
 /*     return bil.f;} */
 /* } */
 
+#include "apply_n.h"
+
 object
 IapplyVector(object fun, int nargs, object *base)
                       
@@ -226,7 +228,7 @@ IapplyVector(object fun, int nargs, obje
 	       vs_push(next);}
 
 	 }
-    res = c_apply_n(fun->sfn.sfn_self,nargs,abase);
+    res = c_apply_n_fun(fun,nargs,abase);
     res = COERCE_F_TYPE(res,F_RESULT_TYPE(fun->sfn.sfn_argd),F_object);
     if (F_ARG_FLAGS_P(fun->sfn.sfn_argd,F_caller_sets_one_val))
       { fcall.nvalues = 1;}
@@ -290,7 +292,7 @@ Iinvoke_c_function_from_value_stack(obje
 	    x[i] = COERCE_F_TYPE(next,F_object,F_double_ptr);}
       else {FEerror("cant get here!",0);}}
   VFUN_NARGS = nargs;
-  res = c_apply_n(f,nargs,x);
+  res = c_apply_n_f(f,nargs,x,min,max);
   res = COERCE_F_TYPE(res,F_RESULT_TYPE(fargd),F_object);
   base[0]=res;
   if (F_ARG_FLAGS_P(fargd,F_caller_sets_one_val))
--- gcl-2.6.10.orig/o/unixsave.c
+++ gcl-2.6.10/o/unixsave.c
@@ -146,7 +146,6 @@ LFD(Lsave)() {
   check_arg(1);
   check_type_or_pathname_string_symbol_stream(&vs_base[0]);
   coerce_to_filename(vs_base[0], filename);
-  malloc_list=Cnil;
   
   _cleanup();
   
--- gcl-2.6.10.orig/o/utils.c
+++ gcl-2.6.10/o/utils.c
@@ -64,18 +64,6 @@ void Wrong_type_error(char *str,int n,..
 /* } */
 
 object
-Iapply_ap_new(object (*f) (/* ??? */), object first, va_list ap)
-/* Apply f to the va_list ap, with an implicit number of args
-   passed in VFUN_NARGS */
-           
-              
-{ int n = VFUN_NARGS;
-  object *new;
-  COERCE_VA_LIST_NEW(new,first,ap,n);
-  return c_apply_n(f,n,new);
-}
-
-object
 Ifuncall_n(object fun,int n,...) {
 /* call fun on the n optional args supplied, and set the fcall.nvalues etc
    return the first value */
