diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/com/get_archive_args v15.6301-amd64/pop/com/get_archive_args
--- pp0/v15.61-amd64/pop/com/get_archive_args	2005-03-11 05:30:38.000000000 -0500
+++ v15.6301-amd64/pop/com/get_archive_args	2010-01-03 04:06:09.000000000 -0500
@@ -137,7 +137,10 @@
 # Output commands to set variables in caller shell -- this must be
 # eval'ed by the caller. AR and RANLIB must then be eval'ed after
 # setting LIBNAME.
-if [ $Shell = "csh" ]; then
+
+if [ "$Shell" == "csh" ]; then
+	echo "set CC='$CC'; set IDIRS='$IDIRS'; set CFLAGS='$CFLAGS'; set LIBEXTN='$LIBEXTN'; set AR='$AR'; set LDLIBS='$LDLIBS'; set RANLIB='$RANLIB'"
+elif [ "$Shell" == "tcsh" ]; then
 	echo "set CC='$CC'; set IDIRS='$IDIRS'; set CFLAGS='$CFLAGS'; set LIBEXTN='$LIBEXTN'; set AR='$AR'; set LDLIBS='$LDLIBS'; set RANLIB='$RANLIB'"
 else
 	echo "CC='$CC'; IDIRS='$IDIRS'; CFLAGS='$CFLAGS'; LIBEXTN='$LIBEXTN'; AR='$AR'; LDLIBS='$LDLIBS'; RANLIB='$RANLIB'"
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/extern/lib/c_core.c v15.6301-amd64/pop/extern/lib/c_core.c
--- pp0/v15.61-amd64/pop/extern/lib/c_core.c	2005-03-11 05:30:38.000000000 -0500
+++ v15.6301-amd64/pop/extern/lib/c_core.c	2010-01-03 00:30:40.000000000 -0500
@@ -1,7 +1,10 @@
-/* --- Copyright University of Sussex 1999. All rights reserved. ----------
+/* --- Copyright University of Sussex, University of Birmingham 2008. All rights reserved. ----------
  * File:			C.all/extern/lib/c_core.c
  * Purpose:			C routines for core POPLOG system
  * Author:			John Gibson, Aug 14 1987 (see revisions)
+ * Modified by Waldek Hebisch for new version of GCC, April 2006
+ * Modified by Waldek Hebisch to include linux_setper, 2 Dec 2008
+ * http://www.math.uni.wroc.pl/~hebisch/poplog/c_core.c
  */
 
 #include "c_core.h"
@@ -605,10 +608,16 @@
 #define REG_nPC nPC
 #endif
 
-/* #if defined(REG_RIP) */
-#define REG_PC REG_RIP
-/* #endif */
 
+#if defined(__linux__)
+#if defined(__x86_64__)
+#define REG_PC REG_RIP
+#else
+#if defined(__i386__)
+#define REG_PC REG_EIP
+#endif
+#endif
+#else
 #if defined(i386)
 #if defined(R_EIP)
 #define REG_PC R_EIP
@@ -616,6 +625,8 @@
 #define REG_PC EIP
 #endif
 #endif
+#endif
+
 
 void _pop_errsig_handler(int sig, siginfo_t *info, ucontext_t *context)
 {
@@ -2070,7 +2081,7 @@
 		int i;
                 tmp[0] = first_arg;
 		for (i = 1; i < MAX_N_ARGS; i++) tmp[i] = va_arg(argp,OPAQUE);
-#else 
+#else
 tmp[0] = arg0;
 tmp[1] = arg1;
 tmp[2] = arg2;
@@ -2104,8 +2115,111 @@
 	va_end(argp);
 	}
 
+#if defined(linux)
 
+/* Personality code, stolen from sbcl */
+
+/* Prototype for personality(2). Done inline here since the header file
+ *  * for this isn't available on old versions of glibc. */
+int personality (unsigned long);
+
+#include <sys/utsname.h>
+
+void
+linux_setper(int argc, char * * argv, char * * envp)
+{
+#if defined(__i386__) || defined(__x86_64__)
+    struct utsname name;
+    int major_version = 2;
+    int minor_version = 6;
+    int patch_version = 12;
+    char *p;
+    uname(&name);
+    p = name.release;
+    major_version = atoi(p);
+    p = strchr(p,'.')+1;
+    minor_version = atoi(p);
+    p = strchr(p,'.')+1;
+    patch_version = atoi(p);
+
+    if ((major_version == 2
+         /* Some old kernels will apparently lose unsupported personality
+            flags on exec() */
+         && ((minor_version == 6 && patch_version >= 11)
+             || (minor_version > 6)))
+        || major_version >= 3) {
+        int pers = personality(0xffffffffUL);
+        /* 0x40000 aka. ADDR_NO_RANDOMIZE */
+        if (!(pers & 0x40000)) {
+            int retval = personality(pers | 0x40000);
+            /* Allegedly some Linux kernels (the reported case was
+               "hardened Linux 2.6.7") won't set the new personality,
+               but nor will they return -1 for an error. So as a
+               workaround query the new personality...  */
+            int newpers = personality(0xffffffffUL);
+            /* ... and don't re-execute if either the setting resulted
+               in an error or if the value didn't change. Otherwise
+               this might result in an infinite loop. */
+            if (retval != -1 && newpers != pers) {
+                /* Use /proc/self/exe instead of trying to figure out
+                   the executable path from PATH and argv[0], since
+                   that's unreliable. We follow the symlink instead of
+                   executing the file directly in order to prevent top
+                   from displaying the name of the process as "exe". */
+                char runtime[PATH_MAX+1];
+                int i = readlink("/proc/self/exe", runtime, PATH_MAX);
+                if (i != -1) {
+                    runtime[i] = '\0';
+                    execve(runtime, argv, envp);
+                }
+            }
+            /* Either changing the personality or execve() failed.
+               Either way we might as well continue, and hope that
+               the random memory maps are ok this time around. */
+            {
+                char err_mess[] = "WARNING: Couldn't re-execute Poplog with"
+                            " the proper personality flags (maybe /proc"
+                            " isn't mounted?). Trying to continue anyway.\n";
+                write(2, err_mess, sizeof(err_mess)-1);
+            }
+        }
+    }
+#endif
+}
+#endif
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman and Waldek Hebisch 2 Dec 2008
+	Installed revisions posted by Waldek to poplog-dev on 2 Dec 2008
+	adding linux_setper, invoked from modified amain.s
+	Making invocation of setarch unnecessary
+--- Aaron Sloman and Waldek Hebisch 5 Jan 2007
+	Finally installed revisions posted by Waldek to poplog-dev on
+	3 April 2006
+	http://mailman.cs.bham.ac.uk/archives/poplog-dev/2006q2/000034.html
+
+--- Aaron Sloman and Waldek Hebisch 29 Jun 2003
+	The use of 'errno' which has been deprecated for some time is no longer
+	supported. So the old use is simulated using these two procedures defined
+	in $popexternlib/c_core.c (thanks to Waldek Hebisch):
+		int get_libc_errno(void)
+		int set_libc_errno(int x)
+
+	The are accessed via an active variable defined in $popsrc/errors.p
+	and its updater:
+
+		define active DO_ERRNO_VAL();
+
+		define updaterof active DO_ERRNO_VAL(_x);
+
+	$popsrc/unixdefs.ph was also changed:
+	This macro definition is no longer used
+		lconstant macro _ERRNO = [_extern errno:data!(int)];
+	Instead it is defined thus, to invoke the new active variable
+	or its updater:
+		lconstant macro _ERRNO = [DO_ERRNO_VAL];
+
+	This also required a change to LIB unix_socets
+	
 --- Robert Duncan, Feb 17 1999
 		Added an extra level of indirection to _WEAK_pop_external_callback
 		for HP-UX on PA-RISC.
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/extern/lib/mklibpop v15.6301-amd64/pop/extern/lib/mklibpop
--- pp0/v15.61-amd64/pop/extern/lib/mklibpop	2005-03-11 05:30:39.000000000 -0500
+++ v15.6301-amd64/pop/extern/lib/mklibpop	2009-12-24 15:25:18.000000000 -0500
@@ -80,8 +80,8 @@
 rm -f $LIB
 
 # compile files and create library
-echo $CC -c -O $CC_FLAGS -I$POP_X_INCLUDE *.c
-$CC -c -O $CC_FLAGS -I$POP_X_INCLUDE *.c && \
+echo $CC -c -g -O $CC_FLAGS -I$POP_X_INCLUDE *.c
+$CC -c -g -O $CC_FLAGS -I$POP_X_INCLUDE *.c && \
 $AR $LIB *.o && \
 $RANLIB
 
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/lib/ved/ved_dired.p v15.6301-amd64/pop/lib/ved/ved_dired.p
--- pp0/v15.61-amd64/pop/lib/ved/ved_dired.p	1997-12-11 10:00:40.000000000 -0500
+++ v15.6301-amd64/pop/lib/ved/ved_dired.p	2008-06-20 12:24:32.000000000 -0400
@@ -1,4 +1,4 @@
-/* --- Copyright University of Sussex 1997.  All rights reserved. ---------
+/* --- Copyright University of Sussex 2008.  All rights reserved. ---------
  > File:           C.unix/lib/ved/ved_dired.p
  > Purpose:        EDIT a directory listing and obey commands
  > Author:         Aaron Sloman, Oct 1 1988 (see revisions)
@@ -331,6 +331,7 @@
 	dired_control(%false%)
 enddefine;
 
+/*
 ;;; ------------------------DEFAULT KEY SETTINGS  ???--------------------
 vedsetkey('\^X\^D',vedenter<>vedinsertstring(%default_command%));
 
@@ -343,10 +344,16 @@
 	ved_qdired();
 endprocedure);
 
+*/
+
 endsection;
 
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Jun 20 2008
+		Commented out the suggested default key bindings as they cause
+		autoloading errors, and can interfere with other uses of ^X
+		in Ved
 --- John Williams, Dec 11 1997
 		dired -r and dired -w no longer give an error if executed when
 		cursor is on an empty line (BR joew.15).
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/lisp/src/arrays.p v15.6301-amd64/pop/lisp/src/arrays.p
--- pp0/v15.61-amd64/pop/lisp/src/arrays.p	1996-04-17 07:01:51.000000000 -0400
+++ v15.6301-amd64/pop/lisp/src/arrays.p	2009-12-30 17:03:00.000000000 -0500
@@ -545,8 +545,6 @@
 				;;; defaults
 				if len fi_< 16 then
 					16
-				elseif len fi_> 64 then
-					64
 				else
 					len
 				endif
@@ -758,10 +756,10 @@
 			lq1 fi_+ 1 -> lq1;
 			lq2 fi_+ 1 -> lq2;
 			lq3 fi_+ 1 -> lq3;
-			fast_apply(
+			fi_&&(fast_apply(
 				sub_s(lq1, v1),
 				sub_s(lq2, v2),
-				bit_op) -> sub_s(lq3, v3)
+				bit_op), 255) -> sub_s(lq3, v3)
 		endwhile;
 		returnif (hr1 == 0);    /* No bits left over */
 		lq1 fi_<< 3 fi_+ 1 -> lo1;
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/lisp/src/chars.p v15.6301-amd64/pop/lisp/src/chars.p
--- pp0/v15.61-amd64/pop/lisp/src/chars.p	1995-08-07 11:59:05.000000000 -0400
+++ v15.6301-amd64/pop/lisp/src/chars.p	2009-12-27 00:32:50.000000000 -0500
@@ -106,7 +106,9 @@
 /* Character conversions */
 
 define character(item);
-	if isintegral(item) then
+        if ischaracter(item) then
+                item
+	elseif isintegral(item) then
 		conscharacter(item)
 	else
 		get_simple_string(item) -> item;
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/lisp/src/equals.p v15.6301-amd64/pop/lisp/src/equals.p
--- pp0/v15.61-amd64/pop/lisp/src/equals.p	1995-08-08 06:50:25.000000000 -0400
+++ v15.6301-amd64/pop/lisp/src/equals.p	2009-12-27 00:32:39.000000000 -0500
@@ -194,13 +194,13 @@
 	returnunless ((hi1 fi_- lo1) == (hi2 fi_- lo2)) (false);
 
 	unless b1 do
-		lo1 -> fast_front(Temp_b1);
-		hi1 -> fast_front(Temp_b1_back);
+		0 -> fast_front(Temp_b1);
+		hi1 fi_- lo1 -> fast_front(Temp_b1_back);
 		Temp_b1 -> b1
 	endunless;
 	unless b2 do
-		lo2 -> fast_front(Temp_b2);
-		hi2 -> fast_front(Temp_b2_back);
+		0 -> fast_front(Temp_b2);
+		hi2 fi_- lo2 -> fast_front(Temp_b2_back);
 		Temp_b2 -> b2
 	endunless;
 	returnunless (sys_=(b1, b2)) (false);
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/lisp/src/exporti.p v15.6301-amd64/pop/lisp/src/exporti.p
--- pp0/v15.61-amd64/pop/lisp/src/exporti.p	1996-01-17 11:21:53.000000000 -0500
+++ v15.6301-amd64/pop/lisp/src/exporti.p	2009-12-30 18:38:17.000000000 -0500
@@ -95,7 +95,7 @@
 Exporti(@SECOND,                inline_cadr,                    false);
 Exporti(@SEVENTH,               inline_nth(% 7, pair_key %),    false);
 Exporti(@SIXTH,                 inline_nth(% 6, pair_key %),    false);
-Exporti(@SVREF,                 inline_svref,                   false);
+;;; Exporti(@SVREF,                 inline_svref,                   false);
 Exporti(@TENTH,                 inline_nth(% 10, pair_key %),   false);
 Exporti(@THIRD,                 inline_nth(% 3, pair_key %),    false);
 
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/lisp/src/exports v15.6301-amd64/pop/lisp/src/exports
--- pp0/v15.61-amd64/pop/lisp/src/exports	1999-08-27 09:01:57.000000000 -0400
+++ v15.6301-amd64/pop/lisp/src/exports	2009-12-30 00:04:57.000000000 -0500
@@ -297,7 +297,7 @@
 @GET-DECODED-TIME,               get_decoded_time,                [0 0 9]
 @GET-DISPATCH-MACRO-CHARACTER,   get_dmac_char,                   [2 3 1]
 @GET-INTERNAL-REAL-TIME,         get_internal_real_time,          [0 0 1]
-@GET-INTERNAL-RUN-TIME,          systime,                         [0 0 1]
+@GET-INTERNAL-RUN-TIME,          get_internal_run_time,           [0 0 1]
 @GET-MACRO-CHARACTER,            get_macro_char,                  [1 2 2]
 @GET-OUTPUT-STREAM-STRING,       get_stringout_string,            []
 @GET-PROPERTIES,                 get_properties,                  []
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/lisp/src/hash.p v15.6301-amd64/pop/lisp/src/hash.p
--- pp0/v15.61-amd64/pop/lisp/src/hash.p	1995-11-29 10:19:25.000000000 -0500
+++ v15.6301-amd64/pop/lisp/src/hash.p	2009-12-30 16:15:01.000000000 -0500
@@ -19,7 +19,8 @@
 	dlocal pop_hash_lim;
 
 	#_< syshash(pair_key) >_#;      ;;; Running total kept on stack
-	while ispair(l) do
+	if pop_hash_lim /== 0 then
+	    while ispair(l) do
 		pop_hash_lim fi_- 1 -> pop_hash_lim;
 		fast_apply(fast_destpair(l) -> l, hash_p);
 		unless isinteger(dup()) do
@@ -27,9 +28,10 @@
 		endunless;
 		nonop fi_+ ();
 		returnif(pop_hash_lim == 0);
-	endwhile;
-	if l /== [] then
+	    endwhile;
+	    if l /== [] then
 		fi_+ fast_apply(l, hash_p)
+	    endif
 	endif
 enddefine;
 
@@ -176,7 +178,7 @@
 
 	/* Convert rehash size to power of two */
 	if rehash_size == nil then
-		false
+		1
 	elseif (isinteger(rehash_size) and rehash_size fi_> 0) then
 		1
 	elseif (isdecimal(rehash_size) and rehash_size > 1) then
@@ -194,7 +196,7 @@
 
 	/* Convert rehash threshold (occupancy ratio) into number of entries */
 	if rehash_threshold == nil then
-		false
+		round(size * 0.7)
 	else
 		unless isreal(rehash_threshold)
 		and rehash_threshold >= 0
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/lisp/src/inlines.p v15.6301-amd64/pop/lisp/src/inlines.p
--- pp0/v15.61-amd64/pop/lisp/src/inlines.p	1996-01-17 11:20:50.000000000 -0500
+++ v15.6301-amd64/pop/lisp/src/inlines.p	2009-12-30 18:35:25.000000000 -0500
@@ -356,7 +356,7 @@
 	inline_rplaca   =   Inline_any(% fast_rplaca, 2 %),
 	inline_rplacd   =   Inline_any(% fast_rplacd, 2 %),
 	inline_schar    =   Inline_any(% fast_schar, 2 %),
-	inline_svref    =   Inline_any(% fast_subscrv0, 2 %), /* see note below */
+;;;	inline_svref    =   Inline_any(% fast_subscrv0, 2 %), /* see note below */
 	inline_char_code=   Inline_any(% fast_char_code, 1 %),
 	inline_code_char=   Inline_any(% fast_code_char, 1 %),
 	inline_char_int =   Inline_any(% fast_char_code, 1 %),
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/lisp/src/itemise.p v15.6301-amd64/pop/lisp/src/itemise.p
--- pp0/v15.61-amd64/pop/lisp/src/itemise.p	1995-08-25 10:56:52.000000000 -0400
+++ v15.6301-amd64/pop/lisp/src/itemise.p	2009-12-27 00:31:54.000000000 -0500
@@ -124,17 +124,6 @@
 enddefine;
 
 
-define skipform();
-	;;; used when *READ-SUPPRESS* is true
-	if is_char_mac(lextype) then
-		lextype()
-	else
-		until (lexget(), AT_TOKEN_END) do enduntil, lexput();
-		nil
-	endif
-enddefine;
-
-
 define digit();
 	lvars n;
 	lexchar;
@@ -263,12 +252,32 @@
 			true -> lex_eof_error;          ;;; force an error
 			eof()
 		endif;
-		lexchar
+                if read_suppress == nil then
+		    lexchar
+                endif
 	enduntil;
 	false ->> lex_redo -> lexnum
 enddefine;
 
 
+define skipform();
+	;;; used when *READ-SUPPRESS* is true
+	if is_char_mac(lextype) then
+		lextype()
+	else
+		repeat
+                   if lextype == multiple_escape then
+                       multiple_escape()
+                   elseif lextype == single_escape then
+                       lexget()
+                   endif;
+                   lexget();
+                   quitif(AT_TOKEN_END);
+                endrepeat, lexput();
+		nil
+	endif
+enddefine;
+
 define colon();
 	lvars pkg;
 	if lexpkg then
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/lisp/src/print.p v15.6301-amd64/pop/lisp/src/print.p
--- pp0/v15.61-amd64/pop/lisp/src/print.p	1995-11-29 10:21:19.000000000 -0500
+++ v15.6301-amd64/pop/lisp/src/print.p	2009-12-26 19:31:24.000000000 -0500
@@ -355,7 +355,13 @@
 
 define lconstant Escape_pr(s);
 	cucharout(`|`);
-	appdata(s, cucharout);
+	appdata(s, 
+                procedure(c);
+                    if c = `\\` or c = `|` then
+                        cucharout(`\\`);
+                    endif;
+                    cucharout(c);
+                endprocedure);
 	cucharout(`|`);
 enddefine;
 
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/lisp/src/specs.p v15.6301-amd64/pop/lisp/src/specs.p
--- pp0/v15.61-amd64/pop/lisp/src/specs.p	1995-08-07 10:15:53.000000000 -0400
+++ v15.6301-amd64/pop/lisp/src/specs.p	2009-12-30 21:34:48.000000000 -0500
@@ -8,15 +8,20 @@
 
 lisp_compile_mode;
 
+#include sysdefs.ph
+
 section $-lisp;
 
 /* Field spec <-> element type conversions */
 
 lconstant Word_spec_to_int
-	= newproperty([[uint     32]
+	= newproperty([
+                                   [ulong    64]
+                                   [long    -64]
+                                   [uint     32]
 				   [int     -32]
-				   [ulong    32]
-				   [long    -32]
+				   [uint    32]
+				  ;;;  [long    -32]
 				   [pint    -30]
 				   [ushort   16]
 				   [short   -16]
@@ -25,8 +30,11 @@
 
 
 lconstant Int_spec_to_word
-	= newproperty([[-32     long]
-				   [32      ulong]
+	= newproperty([
+                                   [64    ulong]
+                                   [-64    long]
+                                   [-32     int]
+				   [32      uint]
 				   [-30     pint]
 				   [-16     short]
 				   [16      ushort]
@@ -133,17 +141,32 @@
 /* Key <-> spec/element-type conversions */
 
 lconstant Spec_to_key
-	= newproperty([[1           ^bitvector_key]
-				   [character   ^string_key]
-				   [short       ^shortvec_key]
-				   [int         ^intvec_key]
-				   [long        ^intvec_key]
-				   [full        ^vector_key]], 31, false, true);
+    = newproperty([[1           ^bitvector_key]
+                   [character   ^string_key]
+                   [byte        ^bytevec_key]
+                   [sbyte       ^sbytevec_key]
+                   [ushort      ^ushortvec_key]
+                   [short       ^shortvec_key]
+                   [uint        ^untvec_key]
+                   [int         ^intvec_key]
+                   [ulong       ^ulongvec_key]
+                   [long        ^longvec_key]
+                   [full        ^vector_key]], 31, false, true);
 
 
 define spec_->_key(spec) -> key;
-	if isintegral(spec) and abs(spec) > 32 then
-		"full" -> spec
+	if isintegral(spec) then
+            if abs(spec) > 64 then
+		"full"
+            elseif abs(spec) > 32 then
+               if spec > 0 then "ulong" else "long" endif;
+            elseif abs(spec) > 16 then
+               if spec > 0 then "uint" else "int" endif;
+            elseif abs(spec) > 8 then
+               if spec > 0 then "ushort" else "short" endif;
+            elseif abs(spec) > 1 then
+               if spec > 0 then "byte" else "sbyte" endif;
+            else spec endif -> spec;
 	elseif spec == "decimal" then
 		"sfloat" -> spec
 	elseif spec == "ddecimal" then
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/lisp/src/time.p v15.6301-amd64/pop/lisp/src/time.p
--- pp0/v15.61-amd64/pop/lisp/src/time.p	1995-11-29 10:21:51.000000000 -0500
+++ v15.6301-amd64/pop/lisp/src/time.p	2009-12-30 08:24:25.000000000 -0500
@@ -11,7 +11,7 @@
 section $-lisp;
 
 
-constant internal_time_units_per_sec = 100;
+constant internal_time_units_per_sec = 1000000;
 
 constant _1900_1970 = 70 * 365 * 86400 /* 17 leap years */ + (17 * 86400);
 
@@ -20,9 +20,12 @@
 	sys_real_time() + _1900_1970
 enddefine;
 
+define get_internal_run_time();
+    systime()*10000 ;;; internal_time_units_per_sec/100
+enddefine;
 
 define get_internal_real_time();
-	sys_real_time() * internal_time_units_per_sec
+    sys_microtime()
 enddefine;
 
 
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/com/poplogout.sh v15.6301-amd64/pop/packages/com/poplogout.sh
--- pp0/v15.61-amd64/pop/packages/com/poplogout.sh	2001-08-23 18:35:02.000000000 -0400
+++ v15.6301-amd64/pop/packages/com/poplogout.sh	2009-07-16 16:26:06.000000000 -0400
@@ -1,9 +1,11 @@
-#!/bin/csh
+#!/bin/bash
 # J. Meyer, Nov 1990
+# Modified A.Sloman for bash 16 Jul 2009
 # poplogout - remove Poplog from environment
 # usage: source poplogout
 
-if ( ! ($?usepop || $?popsys )) exit 0 # no poplog to logout from
+if [ ! ${usepop} ]; then exit 0 ; fi
+# no poplog to logout from
 
 # print a brief message
 echo "poplogout":  poplog, usepop = $usepop
@@ -12,7 +14,7 @@
 # BASIC UNSETS: remove variables listed in $usepop/pop/com/popenv
 # And others added by A.Sloman
 
-foreach i ( \
+for i  in \
         popcom \
         popsrc \
         popsys \
@@ -42,24 +44,26 @@
         pop_xved     \
         pop_xvedpro  \
         pop_xvedlisp \
-    )
-    unsetenv $i
-end
-
-# UNSET PATH: remove $usepop and $poplocal from path
-set npath=
-foreach i ( $path )
-if (("$i" !~ "$usepop"*) && ("$i" !~ "$poplocal"*) ) set npath=($npath $i)
-end
-set path=($npath)
-unset npath
-
-# TESTED UNSETS: unset conditionally set variables
-if ("$poplocal" == "$usepop/pop") unsetenv poplocal
-if ("$popcontrib" == "$usepop/pop/contrib") unsetenv popcontrib
-if ("$poplib" == "$HOME") unsetenv poplib
-if ($?pop_pop11) unsetenv pop_pop11
-# UNSET USEPOP
-unsetenv usepop
+    ;
+do
+    ## echo $i
+    unset $i
+done
+
+## # UNSET PATH: remove $usepop and $poplocal from path
+## set npath=
+## foreach i ( $path )
+## if (("$i" !~ "$usepop"*) && ("$i" !~ "$poplocal"*) ) set npath=($npath $i)
+## end
+## set path=($npath)
+## unset npath
+##
+## # TESTED UNSETS: unset conditionally set variables
+## if ("$poplocal" == "$usepop/pop") unsetenv poplocal
+## if ("$popcontrib" == "$usepop/pop/contrib") unsetenv popcontrib
+## if ("$poplib" == "$HOME") unsetenv poplib
+## if ($?pop_pop11) unsetenv pop_pop11
+## # UNSET USEPOP
+unset usepop
 
 # DONE
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/popvision/lib/Xcolour_to_rgb.p v15.6301-amd64/pop/packages/popvision/lib/Xcolour_to_rgb.p
--- pp0/v15.61-amd64/pop/packages/popvision/lib/Xcolour_to_rgb.p	1999-09-24 05:18:18.000000000 -0400
+++ v15.6301-amd64/pop/packages/popvision/lib/Xcolour_to_rgb.p	2009-02-19 20:33:39.000000000 -0500
@@ -1,4 +1,5 @@
-/* --- Copyright University of Sussex 1999. All rights reserved. ----------
+/* --- Copyright University of Sussex 2009. All rights reserved. ----------
+	--- Copyright University of Sussex 1999. All rights reserved. ----------
  > File:            $popvision/lib/Xcolour_to_rgb.p
  > Purpose:         Get r, g, b components of X colour specifications
  > Author:          David S Young, Feb 20 1994 (see revisions)
@@ -11,6 +12,7 @@
 section;
 
 vars Xcolour_to_rgb_filelist = [
+	'/usr/share/X11/rgb.txt'
     '/usr/lib/X11/rgb.txt'
     '$Xroot/lib/X11/rgb.txt'
     '/usr/openwin/lib/rgb.txt'
@@ -110,6 +112,9 @@
 endsection;
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, 20 Feb 2009
+		Added '/usr/share/X11/rgb.txt' to
+		Xcolour_to_rgb_*filelist
 --- David Young, Sep 24 1999
         Added Anthony Worrall's modification for iris to readcolours
         (looks like it allows space-separated numbers in colour names)
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/popvision/lib/sunrasterfile.p v15.6301-amd64/pop/packages/popvision/lib/sunrasterfile.p
--- pp0/v15.61-amd64/pop/packages/popvision/lib/sunrasterfile.p	2004-12-06 17:02:41.000000000 -0500
+++ v15.6301-amd64/pop/packages/popvision/lib/sunrasterfile.p	2009-02-20 23:00:06.000000000 -0500
@@ -1,4 +1,4 @@
-/* --- Copyright University of Sussex 2004. All rights reserved. ----------
+/* --- Copyright University of Sussex 2009. All rights reserved. ----------
  > File:            $popvision/lib/sunrasterfile.p
  > File:            $poplocal/local/popvision/lib/sunrasterfile.p
  > Purpose:         Read and write Sun rasterfiles
@@ -16,14 +16,14 @@
 /* Rasterfile constants from /usr/include/rasterfile.h */
 
 defclass lconstant rasterfile {
-    >-> ras_magic       :int,       /* magic number */
-        ras_width       :int,       /* width (pixels) of image */
-        ras_height      :int,       /* height (pixels) of image */
-        ras_depth       :int,       /* depth (1, 8, or 24 bits) of pixel */
-        ras_length      :int,       /* length (bytes) of image */
-        ras_type        :int,       /* type of file; see RT_* below */
-        ras_maptype     :int,       /* type of colormap; see RMT_* below */
-        ras_maplength   :int        /* length (bytes) of following map */
+    >-> ras_magic       :uint,       /* magic number */
+        ras_width       :uint,       /* width (pixels) of image */
+        ras_height      :uint,       /* height (pixels) of image */
+        ras_depth       :uint,       /* depth (1, 8, or 24 bits) of pixel */
+        ras_length      :uint,       /* length (bytes) of image */
+        ras_type        :uint,       /* type of file; see RT_* below */
+        ras_maptype     :uint,       /* type of colormap; see RMT_* below */
+        ras_maplength   :uint        /* length (bytes) of following map */
     /* color map follows for ras_maplength bytes, followed by image */
 };
 
@@ -373,6 +373,20 @@
     endunless;
 enddefine;
 
+;;; Hackish method to convert from little-endian int to big-endian int if
+;;; on little-endian platform. Needed to write the headers correctly.
+define lconstant to_bigendian(integer) -> big_endian;
+    #_IF (fsub_b(1, consintvec(1,1)) /== 0)
+       lvars result = 0;
+       result + ( ( integer && 16:FF000000 ) >> 24) -> result;
+       result + ( ( integer && 16:00FF0000 ) >> 8 ) -> result;
+       result + ( ( integer && 16:0000FF00 ) << 8 ) -> result;
+       result + ( ( integer && 16:000000FF ) << 24) -> result;
+       result -> big_endian;
+    #_ELSE
+        integer -> big_endian;
+    #_ENDIF;
+enddefine;
 
 define sunrasterfile(filename) /* -> (array, [cmap])*/;
     lvars return_cmap = false, tag = false, array, cmap;
@@ -533,6 +547,7 @@
 
 define updaterof sunrasterfile(array, filename);
     lvars array, cmap = false, filename;
+    lvars cmap_type, cmap_length; ;;; Calculated later on
     if array.isvector then
         ;;; There is a colour map argument.
         (array, filename) -> (array, cmap, filename)
@@ -570,32 +585,36 @@
         mishap(datakey(data), 1, 'Illegal type of array for rasterfile')
     endunless;
 
-    ;;; Set up header
-    RAS_MAGIC -> rasheader.ras_magic;
-    wid -> rasheader.ras_width;
-    ht -> rasheader.ras_height;
-    dep -> rasheader.ras_depth;
-    len -> rasheader.ras_length;
-    RT_STANDARD -> rasheader.ras_type;
-
     ;;; Deal with colour map
     if cmap then
-        RMT_EQUAL_RGB -> rasheader.ras_maptype;
-        length(cmap(1)) * NRGB -> rasheader.ras_maplength;
+        RMT_EQUAL_RGB -> cmap_type;
+        length(cmap(1)) * NRGB -> cmap_length;
         cmap_vec_to_buff(cmap) -> cmap;
     elseif dep == 1 or dep == 24 then
-        RMT_NONE -> rasheader.ras_maptype;
-        0 -> rasheader.ras_maplength
+        RMT_NONE -> cmap_type;
+        0 -> cmap_length
     else
-        RMT_EQUAL_RGB -> rasheader.ras_maptype;
-        NRGB * cmap_max -> rasheader.ras_maplength;
+        RMT_EQUAL_RGB -> cmap_type;
+        NRGB * cmap_max -> cmap_length;
         cmap_default -> cmap;
     endif;
 
+    ;;; Set up header
+    ;;; Hack: On little-endian machines the fields will need to be reversed.
+    ;;; Calling to_bigendian(int) does this if it needs to be done.
+    to_bigendian(RAS_MAGIC) -> rasheader.ras_magic;
+    to_bigendian(wid) -> rasheader.ras_width;
+    to_bigendian(ht) -> rasheader.ras_height;
+    to_bigendian(dep) -> rasheader.ras_depth;
+    to_bigendian(len) -> rasheader.ras_length;
+    to_bigendian(RT_STANDARD) -> rasheader.ras_type;
+    to_bigendian(cmap_type) -> rasheader.ras_maptype;
+    to_bigendian(cmap_length) -> rasheader.ras_maplength;
+
     ;;; Write header and colour map
     syswrite(dev, rasheader, rasheadbytes);
     if cmap then
-        syswrite(dev, cmap, rasheader.ras_maplength)
+        syswrite(dev, cmap, cmap_length)
     endif;
 
     ;;; Write the data itself.
@@ -621,6 +640,16 @@
 endsection;
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Feb 21 2009
+	Modified to avoid repeatedly checking for endianness
+
+--- Aaron Sloman, Feb 20 2009
+	Installed Jack Hollingworth's fix for updater of sunrasterfile
+	for use on little-endian machines.
+
+--- Jack Hollingworth (Reading University), Feb 17 2009
+    Fixed writing of file header on little-endian machines
+
 --- Aaron Sloman, Dec  6 2004
 	For linux set the default value of -sunrasterfile_converter-
 	to "convert"
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/rclib/auto/ved_rcdemo.p v15.6301-amd64/pop/packages/rclib/auto/ved_rcdemo.p
--- pp0/v15.61-amd64/pop/packages/rclib/auto/ved_rcdemo.p	1997-03-30 15:20:15.000000000 -0500
+++ v15.6301-amd64/pop/packages/rclib/auto/ved_rcdemo.p	2009-07-03 21:11:37.000000000 -0400
@@ -1,8 +1,8 @@
-/* --- Copyright University of Birmingham 1997. All rights reserved. ------
+/* --- Copyright University of Birmingham 2009. All rights reserved. ------
  > File:            $poplocal/local/rclib/auto/ved_rcdemo.p
  > Purpose:         Accessing demonstration programs in the
 					RCLIB demo library
- > Author:          Aaron Sloman, Mar 30 1997
+ > Author:          Aaron Sloman, Mar 30 1997 (see revisions)
  > Documentation:
  > Related Files:
  */
@@ -15,7 +15,14 @@
 		vedargument sys_>< '.p' -> vedargument
 	endunless;
 
-	veddo('pved $poplocal/local/rclib/demo/' dir_>< vedargument)
+;;;	veddo('pved $poplocal/local/rclib/demo/' dir_>< vedargument)
+	veddo('pved ' >< poprclibdir dir_>< 'demo' dir_>< vedargument)
 enddefine;
 
+
 endsection;
+
+/* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Jul  4 2009
+		Changed to use poprclibdir
+ */
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/rclib/install_rclib v15.6301-amd64/pop/packages/rclib/install_rclib
--- pp0/v15.61-amd64/pop/packages/rclib/install_rclib	2000-03-07 17:56:11.000000000 -0500
+++ v15.6301-amd64/pop/packages/rclib/install_rclib	2009-07-03 21:43:17.000000000 -0400
@@ -1,4 +1,8 @@
 #!/bin/sh
+##
+## NO LONGER NEEDED: 4 Jul 2009
+
+
 # $poplocal/local/rclib/install_rclib
 #   Aaron Sloman Last Modified:  7 Mar 2000
 #   (Name of file changed.)
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/teaching/auto/ttt.p v15.6301-amd64/pop/packages/teaching/auto/ttt.p
--- pp0/v15.61-amd64/pop/packages/teaching/auto/ttt.p	1996-02-17 10:17:56.000000000 -0500
+++ v15.6301-amd64/pop/packages/teaching/auto/ttt.p	2009-07-05 19:11:19.000000000 -0400
@@ -1,7 +1,7 @@
-/*  --- Copyright University of Sussex 1986.  All rights reserved. ---------
+/*  --- Copyright University of Sussex 2009.  All rights reserved. ---------
  >  File:           C.all/lib/auto/ttt.p
  >  Purpose:        typing tutor program
- >  Author:         Aaron Sloman 1979
+ >  Author:         Aaron Sloman 1979 (see revisions)
  >  Documentation:  TEACH * TTT
  >  Related Files:
  */
@@ -120,6 +120,8 @@
 dlocal count;
 
 	pr('Try this:\n');
+	;;; add a space to match ved's prompt character.
+	if vedediting then pr(' ') endif;
 	pr(l);
 	pr(newline);
 	readstrip() -> inchar;
@@ -133,6 +135,7 @@
 		pr('\ninstead of          : ');
 		pr(l);
 		pr('\nTry again\n');
+		if vedediting then pr(' ') endif;
 		pr(l);
 		pr(newline);
 		readstrip() ->inchar;
@@ -278,5 +281,8 @@
 
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Jul  6 2009
+	Altered printout if used in ved so that an extra space is used to make
+	output match what the user will type.
 --- A Sloman, Sep 1986 tidied and tabified
 */
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/teaching/lib/elizaprog.p v15.6301-amd64/pop/packages/teaching/lib/elizaprog.p
--- pp0/v15.61-amd64/pop/packages/teaching/lib/elizaprog.p	2007-04-19 15:43:50.000000000 -0400
+++ v15.6301-amd64/pop/packages/teaching/lib/elizaprog.p	2009-07-18 08:40:44.000000000 -0400
@@ -1,4 +1,4 @@
-/*  --- Copyright University of Sussex 2007.  All rights reserved. ---------
+/*  --- Copyright University of Sussex 2009.  All rights reserved. ---------
  >  File:           $usepop/pop/packages/teaching/lib/elizaprog.p
  >  Purpose:        Sussex Mini ELIZA programme
  >  Author:         Mostly A.Sloman 1978 (see revisions)
@@ -47,6 +47,8 @@
 
 global vars eliza_debug = false;
 
+global vars procedure eliza_output;
+
 
 lvars procedure inchar;   ;;; reassigned in eliza.
 
@@ -1359,7 +1361,7 @@
             ['what if you were' ??L2 ?]
             ['am I really not' ??L2 ?]
 			['Have you ever been' ??L2 ?]
-			['Being' ?LL2 'is not a good qualification for a therapist']
+			['Being' ?L2 'is not a good qualification for a therapist']
 			['i prefer not to be' ??L2]
             ['What, then, is' ??L2 ?]
 			['You are not good enough to be' ??L2]
@@ -1673,7 +1675,7 @@
 			['What or who can' ??L2?]
 			['What can be expected of' ??L1 ?]
 			['Will you ever' ??L2 ?]
-			['Did' ??L1 ?LL2 'last year?']
+			['Did' ??L1 ?L2 'last year?']
 			'The future isn\'t always like the past.'
 			['Can you say any more about' ??L1?]
 			['Can you' ??L2?]
@@ -2352,6 +2354,11 @@
 Good day what is your problem?\n\n'
 ;
 
+define global vars procedure eliza_output(answer);
+		ppr(answer);
+		pr(newline);
+enddefine;
+
 define eliza();
 	dlocal inchar, sentence, problem, cucharin, earlycount = 1;
 
@@ -2390,15 +2397,25 @@
 	readsentence() ->> problem -> sentence;
 	while true do
 		earlycount + 1 -> earlycount;
-		ppr(replyto(sentence,shuffle(eliza_rules) ->> eliza_rules));
-		pr(newline);
+		lvars answer;
+		replyto(sentence,shuffle(eliza_rules) ->> eliza_rules) -> answer;
+		;;; ppr(answer);
+		;;; pr(newline);
+		eliza_output(answer);
 		readsentence() -> sentence;
 	endwhile
 enddefine;
 
+pr('\n\nPlease type\n\n\s\s\seliza();\n\n');
+
 endsection;
 
 /*  --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Jul 18 2009
+		fixed a minor old bug -- local variable wrongly named
+--- Aaron Sloman, Jul 18 2009
+		Introduced procedure eliza_output to make it easy to change
+		how eliza responds.
 --- Aaron Sloman, Apr 14 2007
 	Copied over latest changes from online eliza
 	http://www.cs.bham.ac.uk/research/projects/cogaff/eliza/
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/teaching/lib/schema.p v15.6301-amd64/pop/packages/teaching/lib/schema.p
--- pp0/v15.61-amd64/pop/packages/teaching/lib/schema.p	1994-07-25 07:38:56.000000000 -0400
+++ v15.6301-amd64/pop/packages/teaching/lib/schema.p	2008-07-08 11:41:48.000000000 -0400
@@ -1,4 +1,4 @@
-/*	--- Copyright University of Sussex 1994.  All rights reserved. ---------
+/*	--- Copyright University of Sussex 2008.  All rights reserved. ---------
  >	File:			C.all/lib/lib/schema.p
  >	Purpose:		planning demonstration program?
  >	Author:			Steven Hardy, June 1982 (see revisions)
@@ -52,7 +52,7 @@
 	them -> same;
 	for X in same do if present(X) then remove(X) endif endfor;
 	database -> extra;
-	instance(S) -> database;
+	pattern_instance(S) -> database;
 	for X in same do if present(X) then remove(X) endif endfor;
 	database -> missing;
 enddefine;
@@ -92,6 +92,8 @@
 
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Jul  8 2008
+		Changed "instance" to "pattern_instance"
 --- John Williams, Jul 25 1994
 		dlocal instead of vars in procedure scheck (cf. BR isl-fr.4553)
 --- Andrew Law, Jul 22 1987 added correct documentation reference
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/teaching/lib/solver.p v15.6301-amd64/pop/packages/teaching/lib/solver.p
--- pp0/v15.61-amd64/pop/packages/teaching/lib/solver.p	1995-11-28 12:00:14.000000000 -0500
+++ v15.6301-amd64/pop/packages/teaching/lib/solver.p	2008-06-17 19:01:04.000000000 -0400
@@ -1,4 +1,4 @@
-/*  --- Copyright University of Sussex 1995.  All rights reserved. ---------
+/*  --- Copyright University of Sussex 2008.  All rights reserved. ---------
  >  File:           C.all/lib/lib/solver.p
  >  Purpose:        problem solver?
  >  Author:         S.Hardy, 1982 (see revisions)
@@ -16,6 +16,12 @@
 	report, schemalist, showplan, ShowTree, splice, splitup, startstrips, stripsstate,
 	treenumber, unique, uppr, verbose;
 
+global vars solverdelay;
+
+unless isinteger(solverdelay) then
+	50 -> solverdelay
+endunless;
+
 0 -> treenumber;
 true -> check;
 [[b1 on b2] [b2 on b3]] -> lastgoals;
@@ -81,7 +87,7 @@
 	endfor;
 	for schema on schemalist do
 		for datum on tl(schema) do
-			if instance(hd(hd(schema))) matches hd(hd(datum)) then
+			if pattern_instance(hd(hd(schema))) matches hd(hd(datum)) then
 				mishap('TWO SCHEMA HAVE MATCHING NAMES',
 					[%'THE SCHEMA NAMED', hd(hd(schema)),
 							'AND THE SCHEMA NAMED', hd(hd(datum))%])
@@ -181,6 +187,9 @@
 		ShowTree(treenumber, tree);
 		front(back(current)) -> front(current);
 		back(back(current)) -> back(current);
+		if isinteger(solverdelay) and solverdelay /== 0 then
+			syssleep(solverdelay)
+		endif;
 	endrepeat
 enddefine;
 
@@ -228,7 +237,7 @@
 	perform(plan);
 	prune([%for schema in schemalist do
 		forevery front(back(schema)) do
-			instance(front(schema)) -> action;
+			pattern_instance(front(schema)) -> action;
 			if unique(action, front(schema)) then action endif;
 		endforevery
 	  endfor%])
@@ -312,7 +321,7 @@
 				howdo([], goal) -> actions;
 				if actions = [] then 100000 -> result; return endif;
 				for newgoal
-					in instance(front(back(getschema(front(actions)))))
+					in pattern_instance(front(back(getschema(front(actions)))))
 				do
 					unless member(newgoal, considered) then
 						newgoal :: considered -> considered;
@@ -348,7 +357,7 @@
 			report('CANNOT REDUCE ' sys_>< front(back(current)));
 		else
 			for action in actions do
-				instance(front(back(getschema(action)))) -> goals;
+				pattern_instance(front(back(getschema(action)))) -> goals;
 				if achieves(plan, goals) then
 					[[* perform ^action]] -> node;
 					raise(raise(splice(tree)))
@@ -392,7 +401,7 @@
 		if unique(action, front(schema)) then
 			insert(
 				estimate(%[],
-					instance(front(back(getschema(action))))%) :: action,
+					pattern_instance(front(back(getschema(action))))%) :: action,
 				actions)
 				-> actions;
 			if estimating then
@@ -433,7 +442,7 @@
 	[] -> history;
 	for action in plan do
 		database :: history -> history;
-		instance(back(back(getschema(action)))) -> schema;
+		pattern_instance(back(back(getschema(action)))) -> schema;
 		allremove(front(schema));
 		alladd(front(back(schema)));
 	endfor;
@@ -492,7 +501,7 @@
 define perform(plan);
 	vars action, schema;
 	for action in plan do
-		instance(back(back(getschema(action)))) -> schema;
+		pattern_instance(back(back(getschema(action)))) -> schema;
 		allremove(front(schema));
 		alladd(front(back(schema)));
 	endfor
@@ -715,6 +724,9 @@
 		else
 			[%expand(current, plan, tree)%] <> stripsstate -> stripsstate;
 		endif;
+		if isinteger(solverdelay) and solverdelay /== 0 then
+			syssleep(solverdelay)
+		endif;
 	endrepeat
 enddefine;
 
@@ -802,6 +814,12 @@
 
 
 /*  --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Jun 18 2008
+		Also introduced solverdelay to slow down display: it's too fast
+		for modern computers otherwise.
+--- Aaron Sloman, Jun 17 2008
+		Replaced all occurrences of inst*ance with pattern_inst*ance,
+		because the former clashes with objectclass.
 --- John Williams, Nov 28 1995
 		Uses readstringline instead of readline due to problems with
 		the latter if strips commands are loaded with ved_lmr.
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/vedlatex/auto/findcite.p v15.6301-amd64/pop/packages/vedlatex/auto/findcite.p
--- pp0/v15.61-amd64/pop/packages/vedlatex/auto/findcite.p	2008-03-30 20:57:58.000000000 -0400
+++ v15.6301-amd64/pop/packages/vedlatex/auto/findcite.p	2008-05-05 05:12:43.000000000 -0400
@@ -109,7 +109,7 @@
 5000000 ->	popmemlim;
 
 ;;; These will be indicators of bibtex citations
-vars citewords = [cite nocite citea citep citet];
+vars citewords = [cite nocite citea citep citet citeauthor citeyear];
 
 ;;; convert bibtex types to lower case to simplify matching
 ;;; add more if needed
@@ -142,7 +142,8 @@
 	;;; Leave newlines on the stack. They will be put in a list	
 	;;; by the caller.
 	while next == newline then next; repeater() -> next endwhile;
-[next ^next] ==>
+	;;; [next ^next] ==>
+
 	;;; first non-newline should be item (e.g. "{" )
 	unless next == item then
 		mishap('Expecting ' >< item >< ' found: ' >< next, [])
@@ -781,6 +782,8 @@
 global vars findcite = true;
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, May  5 2008
+		Added \citeyear \citeauthor
 --- Aaron Sloman, Mar 31 2008
 		Removed spurious repeater in process_bib (filein)
 		Fixed item repeater in process_bib not to be upset by
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/vedlatex/auto/ved_bib.p v15.6301-amd64/pop/packages/vedlatex/auto/ved_bib.p
--- pp0/v15.61-amd64/pop/packages/vedlatex/auto/ved_bib.p	2003-02-08 09:57:39.000000000 -0500
+++ v15.6301-amd64/pop/packages/vedlatex/auto/ved_bib.p	2009-04-13 19:39:53.000000000 -0400
@@ -1,4 +1,4 @@
-/* --- Copyright University of Birmingham 2003. All rights reserved. ------
+/* --- Copyright University of Birmingham 2009. All rights reserved. ------
  > File:            $poplocal/local/ved_latex/auto/ved_bib.p
  > Linked to        $poplocal/local/auto/ved_bib.p
  > Purpose:         Create BIBTEX file entry
@@ -197,7 +197,7 @@
 		vedwordrightdelete();
 		vedinsertstring('  ');
 		vedinsertstring(field);
-		vedinsertstring(' = "');
+		vedinsertstring(' = {');
 		if insert_brace then vedcharinsert(`{`) endif;
 		while (vednextline(); strmember(vedcurrentchar(), '\s\t')) do
 			;;; leading space or tab. Treat as continuation
@@ -207,7 +207,7 @@
 		vedcharup();
 		vedtextright();
 		if insert_brace then vedcharinsert(`}`) endif;
-		vedinsertstring('",');
+		vedinsertstring('},');
 	endrepeat;
 	vedlineabove();
 	vedcharinsert(`}`);
@@ -218,6 +218,8 @@
 endsection;
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Apr 14 2009
+		altered to use braces for all lines instead of double quotes.
 --- Aaron Sloman, Feb  8 2003
 	Added URL field
 --- Aaron Sloman, Feb  4 2001
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/vedlatex/auto/ved_dobib.p v15.6301-amd64/pop/packages/vedlatex/auto/ved_dobib.p
--- pp0/v15.61-amd64/pop/packages/vedlatex/auto/ved_dobib.p	2004-08-11 10:30:02.000000000 -0400
+++ v15.6301-amd64/pop/packages/vedlatex/auto/ved_dobib.p	2009-06-24 16:59:18.000000000 -0400
@@ -1,4 +1,4 @@
-/* --- Copyright University of Birmingham 2004. All rights reserved. ------
+/* --- Copyright University of Birmingham 2009. All rights reserved. ------
  > File:			$poplocal/local/ved_latex/auto/ved_latex.p
  > Linked to:		$poplocal/local/ved_latex/auto/ved_dobib.p
  > Linked to:		$poplocal/local/ved_latex/auto/ved_latex2.p
@@ -31,7 +31,7 @@
 lconstant
 	dvi = '.dvi',
 
-	latex_clear = ['.aux' ^dvi '.log' '.bbl' '.blg' '.toc'],
+	latex_clear = ['.aux' ^dvi '.log' '.bbl' '.blg' '.toc' '.out'],
 
 	latex_pr_command = 'dvips -f -t a4 ',
 ;
@@ -633,6 +633,8 @@
 endsection;
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Jun 24 2009
+		Altered latex_clear list to include '.out'
 --- Aaron Sloman, Aug 11 2004
 		Altered latex_quotes to transform "('" to "(`"
 --- Aaron Sloman, Apr 28 2001
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/vedlatex/auto/ved_latex.p v15.6301-amd64/pop/packages/vedlatex/auto/ved_latex.p
--- pp0/v15.61-amd64/pop/packages/vedlatex/auto/ved_latex.p	2004-08-11 10:30:02.000000000 -0400
+++ v15.6301-amd64/pop/packages/vedlatex/auto/ved_latex.p	2009-06-24 16:59:18.000000000 -0400
@@ -1,4 +1,4 @@
-/* --- Copyright University of Birmingham 2004. All rights reserved. ------
+/* --- Copyright University of Birmingham 2009. All rights reserved. ------
  > File:			$poplocal/local/ved_latex/auto/ved_latex.p
  > Linked to:		$poplocal/local/ved_latex/auto/ved_dobib.p
  > Linked to:		$poplocal/local/ved_latex/auto/ved_latex2.p
@@ -31,7 +31,7 @@
 lconstant
 	dvi = '.dvi',
 
-	latex_clear = ['.aux' ^dvi '.log' '.bbl' '.blg' '.toc'],
+	latex_clear = ['.aux' ^dvi '.log' '.bbl' '.blg' '.toc' '.out'],
 
 	latex_pr_command = 'dvips -f -t a4 ',
 ;
@@ -633,6 +633,8 @@
 endsection;
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Jun 24 2009
+		Altered latex_clear list to include '.out'
 --- Aaron Sloman, Aug 11 2004
 		Altered latex_quotes to transform "('" to "(`"
 --- Aaron Sloman, Apr 28 2001
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/vedlatex/auto/ved_latex2.p v15.6301-amd64/pop/packages/vedlatex/auto/ved_latex2.p
--- pp0/v15.61-amd64/pop/packages/vedlatex/auto/ved_latex2.p	2004-08-11 10:30:02.000000000 -0400
+++ v15.6301-amd64/pop/packages/vedlatex/auto/ved_latex2.p	2009-06-24 16:59:18.000000000 -0400
@@ -1,4 +1,4 @@
-/* --- Copyright University of Birmingham 2004. All rights reserved. ------
+/* --- Copyright University of Birmingham 2009. All rights reserved. ------
  > File:			$poplocal/local/ved_latex/auto/ved_latex.p
  > Linked to:		$poplocal/local/ved_latex/auto/ved_dobib.p
  > Linked to:		$poplocal/local/ved_latex/auto/ved_latex2.p
@@ -31,7 +31,7 @@
 lconstant
 	dvi = '.dvi',
 
-	latex_clear = ['.aux' ^dvi '.log' '.bbl' '.blg' '.toc'],
+	latex_clear = ['.aux' ^dvi '.log' '.bbl' '.blg' '.toc' '.out'],
 
 	latex_pr_command = 'dvips -f -t a4 ',
 ;
@@ -633,6 +633,8 @@
 endsection;
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Jun 24 2009
+		Altered latex_clear list to include '.out'
 --- Aaron Sloman, Aug 11 2004
 		Altered latex_quotes to transform "('" to "(`"
 --- Aaron Sloman, Apr 28 2001
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/vedlatex/com/findcites v15.6301-amd64/pop/packages/vedlatex/com/findcites
--- pp0/v15.61-amd64/pop/packages/vedlatex/com/findcites	2008-01-08 15:20:41.000000000 -0500
+++ v15.6301-amd64/pop/packages/vedlatex/com/findcites	2008-05-05 05:00:34.000000000 -0400
@@ -11,12 +11,15 @@
 
 setenv TEXFILE $2
 
+#echo "BIB $1 TEX $2"
+
 #source /bham/common/com/packages/poplog/Login/poplogin
 
 $popsys/basepop11 %noinit << \\\\
 
 ;;; pop11_compile('~axs/temp/findcite.p');
 
+uses vedlatex
 loadlib('findcite.p');
 
 ;;; Global variables needed for scanning the bibtex file analysing it
@@ -56,7 +59,9 @@
 
 ;;; These will be indicators of bibtex citations
 ;;; Added 'citenp' for APA style
-vars citewords = [cite nocite citea citenp citep citet];
+;;; Added citeauthor citeyear for AAAI style
+vars citewords =
+    [cite nocite citea citeA citenp citeNP citep citet citeauthor citeyear];
 
 ;;; convert bibtex types to lower case to simplify matching
 vars bibtypes =
@@ -98,6 +103,8 @@
 
 endif;
 
+;;;cited ==>
+
 process_bib(cited, bibfile);
 
 sysexit();
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/vedmail/auto/ved_Reply.p v15.6301-amd64/pop/packages/vedmail/auto/ved_Reply.p
--- pp0/v15.61-amd64/pop/packages/vedmail/auto/ved_Reply.p	2007-01-30 12:18:32.000000000 -0500
+++ v15.6301-amd64/pop/packages/vedmail/auto/ved_Reply.p	2009-07-07 17:17:39.000000000 -0400
@@ -1,5 +1,5 @@
-/* --- Copyright University of Birmingham 2007. All rights reserved. ------
- > File:            $poplocal/local/auto/ved_reply.p
+/* --- Copyright University of Birmingham 2009. All rights reserved. ------
+ > File:            $usepop/pop/packages/vedmail/auto/ved_reply.p
  > Purpose:			Reply to email message
  > Author:          Aaron Sloman, Updated Sept 1994 (see revisions)
  > Documentation:	See below
@@ -135,14 +135,18 @@
 define lconstant vedgetrest(string) -> string with_props 601;
 	;;; used to get continuation of "To:" or "CC:" line, etc.
 	;;; if next line starts with space or tab
-	lvars string, line;
+	lvars string, line, strings;
 	prune_leader(string) -> string;
 	repeat
 		vednextline();
 		vedthisline() -> line;
 	quitif(vvedlinesize == 0 or strmember(`:`,line)
 			or not(strmember(line(1),'\s\t')));
-		string  sys_>< prune_leader(line) -> string
+	sysparse_string(string) <> sysparse_string(line) -> strings;
+	destpair(strings) -> (string, strings);
+	for line in strings do
+		string  sys_>< vedspacestring sys_>< line -> string
+	endfor;
 	endrepeat;
 enddefine;
 
@@ -154,7 +158,7 @@
 	vedjumpto(lo,1);
 	repeat
 		if vvedlinesize == 0 then false -> found; return() endif;
-		vedthisline() -> found;
+		veddecodetabs(vedthisline()) -> found;
 		if isstring(string) then
 			returnif(isstartstring(string, found));
 		else ;;; string must be a list of strings...
@@ -239,6 +243,8 @@
 		else
 			'Subject: Re: ' sys_>< allbutfirst(9, subject) -> subject
 		endif;
+		vedgetrest(subject) -> subject;
+		;;; Veddebug(subject);
 	else 'Subject: ' -> subject
 	endif
 enddefine;
@@ -296,7 +302,9 @@
 		;;; extract the string and if appropriate, the key
 		if ispair(key) then destpair(field) ->(key, field) endif;
 		;;; remove field stuff from beginning of string
-		allbutfirst(datalength(key), field) -> field
+		allbutfirst(datalength(key), field) -> field;
+    	;;; see if there is a continuation
+	 	vedgetrest(field) -> field;
 	endif;
 	;;; Veddebug([key ^key field ^field]);
 enddefine;
@@ -308,7 +316,7 @@
 enddefine;
 
 define lconstant vedgetreferences(lo,hi) -> references;
-	;;; Get subject from line 'Subject: ...   '
+	;;; Get references from line 'References: ...   '
 	lvars lo,hi,references;
 	vedgetfield(ved_references_field , lo, hi) -> references;
 	;;; Veddebug([references ^references]);
@@ -375,6 +383,7 @@
 		endif;
 	else false -> Cc
 	endif;
+
 	;;; Veddebug(Cc);
 	;;; Find where to start reply
 	if Where = '@t' then lo
@@ -398,7 +407,8 @@
 		unless vvedlinesize == 0 then vedlinebelow() endunless
 	endif;
 	unless vedline==1 then vedlinebelow() endunless;
-	unless vedline >= vvedbuffersize then vedlinebelow(); vedcharup();
+	unless vedline >= vvedbuffersize then
+		vedlinebelow(); vedlinebelow(); vedcharup();
 	endunless;
 	;;; insert 'From ' line to conform to mail format.
 	vedcheck();
@@ -420,18 +430,23 @@
 	vedlinebelow(); vedinsertstring(subject);
 
 	;;; insert messageid
-	vedlinebelow();
-	vedinsertstring(ved_inreplyfield); vedinsertstring(messageid);
+	if messageid then
+		vedlinebelow();
+		vedinsertstring(ved_inreplyfield); vedinsertstring(messageid);
+	endif;
+
 	;;; insert references
-	vedlinebelow();
-	vedinsertstring(ved_references_field);
+	if messageid or references /== nullstring then
+		vedlinebelow();
+		vedinsertstring(ved_references_field);
 		unless datalength(references) == 0 then
-			;;; this may be a null string
 			vedinsertstring(references);
 			vedcharright();
 		endunless;
 		;;; make sure at least messageid is in references field.
-		vedinsertstring(messageid);
+		if messageid then vedinsertstring(messageid) endif;
+
+	endif;
 
 	if Cc then
 		;;; insert copy list
@@ -466,10 +481,10 @@
 				vedtextright(); vedcheck(); vedrefreshrange(vedline,vedline,undef);
 			endif;
 		endif;
-		vedcharup(); vedtextright()
+		vedcharup(); vedtextright();vedmarkhi();
 	endif;
 	if oldc then oldc + 1 else 1 endif -> vedchanged;
-	chain(ved_mcm);
+	chain(ved_mcm<>vedrefresh);
 enddefine;
 
 define global vars procedure ved_reply =
@@ -485,6 +500,11 @@
 nil -> proglist;
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Jul  7 2009
+	Altered to cope with 'wrapped' Subject line.
+--- Aaron Sloman, Feb  7 2007
+	Fixed some problems with continuation lines, and dealt with missing
+	references field	
 --- Aaron Sloman, Jan 30 2007
 	Altered to insert In-Reply-To: field and References: field
 	(Users who don't want them can delete them before sending.)
@@ -543,4 +563,24 @@
 	Simplified vedgetsubject. Made it insert "Re:" after subject, if
 	it isn't already there. Used pdr_valof
 
+         CONTENTS - (Use <ENTER> g to access required sections)
+
+ define lconstant charsbetween(start,fin,string) with_props 501;
+ define lconstant prune_leader(string) -> string;
+ define lconstant prunesitename(string) -> string with_props 505;
+ define lconstant Veddo(vedcommand) with_props 600;
+ define lconstant vedgetrest(string) -> string with_props 601;
+ define lconstant vedtryfind(string,lo,hi) -> found with_props 602;
+ define lconstant vedgetsender(lo,hi) -> line with_props 603;
+ define lconstant vedgetsubject(lo,hi) -> subject with_props 604;
+ define lconstant vedgetCc(lo,hi,) -> Cc with_props 605;
+ define lconstant vedgetTo(lo,hi,) -> string with_props 606;
+ define lconstant vedgetfield(key, lo, hi) -> field;
+ define lconstant vedgetmesssageid(lo,hi) -> messageid;
+ define lconstant vedgetreferences(lo,hi) -> references;
+ define lconstant vedtry(proc,lo,hi);
+ define lconstant veddoreply(all_?) with_props ved_reply;
+ define global vars procedure ved_reply =
+ define global vars procedure ved_Reply =
+
  */
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/vedmail/auto/ved_decode.p v15.6301-amd64/pop/packages/vedmail/auto/ved_decode.p
--- pp0/v15.61-amd64/pop/packages/vedmail/auto/ved_decode.p	2007-02-12 12:28:25.000000000 -0500
+++ v15.6301-amd64/pop/packages/vedmail/auto/ved_decode.p	2008-11-13 15:07:23.000000000 -0500
@@ -1,5 +1,6 @@
-/* --- Copyright University of Birmingham 2007. All rights reserved. ------
- > File:            $poplocal/local/auto/ved_decode.p
+/* --- Copyright University of Birmingham 2008. All rights reserved. ------
+ > File:            $usepop/pop/packages/vedmail/auto/ved_decode.p
+ > previously:            $poplocal/local/auto/ved_decode.p
  > Purpose:			Decode attachment in mail file
  > Author:          Aaron Sloman, Mar 23 1998 (see revisions)
  > Documentation:	See HELP VED_DECODE
@@ -114,6 +115,7 @@
 	jpegtype = '.jpeg',
 	pbmtype  = '.pbm',
 	mpegtype = '.mpeg',
+	mp3type = '.mp3',
 	mpgtype = '.mpg',
 	avitype = '.avi',
 	;;; I don't know what this is!
@@ -135,7 +137,7 @@
 
 	no_decode_types =
 	[^pstype ^htmltype ^htmtype ^texttype ^txttype ^latextype ^bibtype ^rtftype
-			^mpegtype ^mpgtype ^avitype ^pcxtype ^false],
+			^mpegtype ^mp3type ^mpgtype ^avitype ^pcxtype ^false],
 	soffice_types =
 	[^ppttype ^doctype ^xlstype ^htmltype ^sdwtype ^sxwtype ^odttype ^odstype ^odptype],
 	pdf_types = [^pdftype],
@@ -226,6 +228,7 @@
 		;;; next two deal with wrapped lines due to editing name field, etc.
 		or isstartstring('charset=', textline)
 		or isstartstring('name=', textline)
+		or isstartstring('NAME=', textline)
 		or isstartstring('\s', textline)
 		or isstartstring('\t', textline)
 	do
@@ -421,12 +424,16 @@
 	lconstant
 		namestring1 = 'name=',
 		len1 = datalength(namestring1),
+		upnamestring1 = 'NAME=',
 		namestring2 = 'filename=',
 		len2 = datalength(namestring2);
 
 	lvars loc, name = false;
 
-	if content_type and issubstring(namestring1, content_type)->>loc then
+	if content_type and
+			((issubstring(namestring1, content_type)->>loc)
+			or issubstring(upnamestring1, content_type)->>loc)
+		then
 		;;; get name
 		allbutfirst(loc+len1-1, content_type) -> name;
 			
@@ -434,6 +441,8 @@
 		allbutfirst(loc+len2-1, content_disposition) -> name;
 	endif;
 
+	;;; Veddebug('Name: ' >< name);
+
 	if name then
 		if strmember(`;`, name) ->> loc then
 			substring(1, loc - 1, name) -> name;
@@ -559,6 +568,9 @@
 	elseif Isendstring(mpgtype, file_name)
 	then
 		mpgtype -> filetype;
+	elseif Isendstring(mp3type, file_name)
+	then
+		mp3type -> filetype;
 	elseif Issubstring('mpeg', content_type)
 		or Isendstring(mpegtype, file_name)
 	then
@@ -1280,8 +1292,10 @@
 endsection;
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Nov 13 2008
+		allowed mp3 as a category type. Changed file path name.
 --- Aaron Sloman, Feb 12 2007
-	Moved latex type to later, incase it clashes with something
+	Moved latex type to later, in case it clashes with something
 	like Zip type.
 --- Aaron Sloman, Nov 23 2006
 	Altered find_file_type to keep '.txt' for files that already	
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/vedmail/auto/ved_decode.p.orig v15.6301-amd64/pop/packages/vedmail/auto/ved_decode.p.orig
--- pp0/v15.61-amd64/pop/packages/vedmail/auto/ved_decode.p.orig	2005-07-11 17:02:28.000000000 -0400
+++ v15.6301-amd64/pop/packages/vedmail/auto/ved_decode.p.orig	2007-02-12 12:28:25.000000000 -0500
@@ -1,4 +1,4 @@
-/* --- Copyright University of Birmingham 2005. All rights reserved. ------
+/* --- Copyright University of Birmingham 2007. All rights reserved. ------
  > File:            $poplocal/local/auto/ved_decode.p
  > Purpose:			Decode attachment in mail file
  > Author:          Aaron Sloman, Mar 23 1998 (see revisions)
@@ -50,6 +50,7 @@
 
 define decode_file_into(command, infile, outfile);
 	;;; use `%` option in case path names include '~'
+	;;; Veddebug([decoding %infile% to %outfile%]);
 	sysobey(command >< infile >< ' > ' >< outfile);
 	;;; Veddebug([decoded to %outfile%]);
 enddefine;
@@ -100,6 +101,9 @@
 	doctype  = '.doc',
 	sdwtype  = '.sdw', 	;;; staroffice/openoffice
 	sxwtype  = '.sxw', 	;;; staroffice/openoffice
+	odttype	 = '.odt',	;;; OpenDocument Text
+	odstype	 = '.ods',	;;; OpenDocument Spreadsheet
+	odptype	 = '.odp',	;;; OpenDocument Presentation
 	xlstype  = '.xls',
 	wpdtype  = '.wpd',
 	bmptype  = '.bmp',
@@ -132,10 +136,8 @@
 	no_decode_types =
 	[^pstype ^htmltype ^htmtype ^texttype ^txttype ^latextype ^bibtype ^rtftype
 			^mpegtype ^mpgtype ^avitype ^pcxtype ^false],
-	pcv_types =
-	[^ppttype ^doctype ^xlstype ^wpdtype ^rtftype ^sdwtype ^sxwtype],
 	soffice_types =
-	[^ppttype ^doctype ^xlstype ^htmltype ^sdwtype ^sxwtype],
+	[^ppttype ^doctype ^xlstype ^htmltype ^sdwtype ^sxwtype ^odttype ^odstype ^odptype],
 	pdf_types = [^pdftype],
 	netscape_types =
 	[^pstype ^htmltype ^pdftype],
@@ -220,6 +222,7 @@
 		vvedlinesize == 0
 		or issubstring('content', (uppertolower(vedthisline()) ->> textline))
 		or issubstring('decoding', textline)
+		or issubstring('attachment', textline)
 		;;; next two deal with wrapped lines due to editing name field, etc.
 		or isstartstring('charset=', textline)
 		or isstartstring('name=', textline)
@@ -271,11 +274,12 @@
 			show_output_on_status = false,
 			vedargument = all_files;
 
+		;;; Veddebug('showing ' <> all_files);
 		vedgenshell('/bin/sh', '');
 		vedtopfile();
 		vedlineabove();
 		vedinsertstring('NEW FILE(S) CREATED. DELETE IF NOT WANTED');
-		;;; Veddebug('shown ' <> files);
+		;;; Veddebug('shown ' <> all_files);
 		unless oldfile = vedcurrentfile then
 			oldfile -> ved_current_file
 		endunless;
@@ -284,7 +288,7 @@
 
 define lconstant delete_coded(file);
 	dlocal ved_current_file;
-	;;; Veddebug('Check deleting in ' >< vedpathname);
+	;;;Veddebug('Check deleting in ' >< vedpathname);
 	if getanswer('Delete attachment from message?(y/n)') then
 		lvars oldfile = vedcurrentfile;
 		file -> ved_current_file;
@@ -293,7 +297,7 @@
 		ved_d();
 		oldfile -> ved_current_file;
 	endif;
-
+    ;;;Veddebug('No delete: '>< file);
 enddefine;
 
 define Isstartstring(string, item);
@@ -476,7 +480,10 @@
 		;;; filetype already known.
 	elseif getanswer('Is it a DOC (Word) file? (y/n)') then
 		doctype -> filetype
-	elseif getanswer('Is it a SDW (StarOffice) file? (y/n)') then
+	elseif getanswer('Just save file? (y/n)') then
+		;;; treat as unknown.
+		anytype -> filetype;
+	 elseif getanswer('Is it a SDW (StarOffice) file? (y/n)') then
 		sdwtype -> filetype
 	elseif getanswer('Is it a SXW (StarOffice) file? (y/n)') then
 		sxwtype -> filetype
@@ -535,6 +542,7 @@
 		or Issubstring('.gif"', content_type)) then
 		giftype -> filetype;
 	elseif (Issubstring('image/tif', content_type)
+		or Issubstring('image/tiff', content_type)
 		or Isendstring(tiftype, file_name)
 		or Issubstring('.tif"', content_type)) then
 		tiftype -> filetype;
@@ -575,6 +583,12 @@
 		sxwtype -> filetype;
 	elseif Isendstring(sdwtype, file_name) then
 		sdwtype -> filetype;
+	elseif Isendstring(odttype, file_name) then
+		odttype -> filetype;
+	elseif Isendstring(odstype, file_name) then
+		odstype -> filetype;
+	elseif Isendstring(odptype, file_name) then
+		odptype -> filetype;
 	elseif Issubstring('text/richtext', content_type)
 		or Isendstring(rtftype, file_name)
 	then
@@ -595,10 +609,6 @@
 		or Isendstring(ppttype, file_name)
 	then
 		ppttype -> filetype;
-	elseif Issubstring('latex', content_type)
-		or Isendstring(latextype, file_name)
-	then
-		latextype -> filetype;
 	elseif Isendstring(dvitype, file_name) then
 		dvitype -> filetype;
 	elseif Issubstring('bibtex', content_type)
@@ -624,10 +634,13 @@
 	elseif Issubstring('text/plain', content_type)
 		or Issubstring('message/rfc822', content_type)
 		or Isendstring(texttype, file_name)
+		or Isendstring(txttype, file_name)
 	then
-		texttype -> filetype;
-	elseif Isendstring(txttype, file_name) then
-		txttype -> filetype;
+		if Isendstring(txttype, file_name) then
+			txttype -> filetype;
+		else
+			texttype -> filetype;
+		endif
 	elseif Isendstring(exetype, file_name) then
 		exetype -> filetype;
 	elseif Isendstring(pltype, file_name) then
@@ -652,14 +665,18 @@
 			sxwtype -> filetype;
 	elseif Issubstring(sdwtype, file_name) then
 			sdwtype -> filetype;
+	elseif Issubstring(odptype, file_name) then
+			odptype -> filetype;
+	elseif Issubstring(odstype, file_name) then
+			odstype -> filetype;
+	elseif Issubstring(odttype, file_name) then
+			odttype -> filetype;
 	elseif Issubstring(wpdtype, file_name) then
 			wpdtype -> filetype;
 	elseif Issubstring(pdftype, file_name) then
 			pdftype -> filetype;
 	elseif Issubstring(rtftype, file_name) then
 			rtftype -> filetype;
-	elseif Issubstring(latextype, file_name) then
-			latextype -> filetype;
 	elseif Issubstring(htmltype, file_name)
 		or Issubstring(htmtype, file_name) then
 			htmltype -> filetype;
@@ -669,6 +686,13 @@
 			tgztype -> filetype;
 	elseif Issubstring(ziptype, file_name) then
 			ziptype -> filetype;
+	;;; next one should be after zip and gz
+	elseif Issubstring('latex', content_type)
+		or Isendstring(latextype, file_name)
+	then
+		latextype -> filetype;
+	elseif Issubstring(latextype, file_name) then
+			latextype -> filetype;
 	elseif Issubstring(jartype, file_name) then
 			jartype -> filetype;
 	else
@@ -707,8 +731,10 @@
 enddefine;
 
 define process_html(savedfile, lynx_path);
+	;;; Veddebug('SAVED: ' >< savedfile);
 	lvars
-		basename = sys_fname_path(savedfile)dir_><sys_fname_nam(savedfile);
+		basename = sys_fname_path(savedfile)dir_><sys_fname_nam(savedfile),
+		type = sys_fname_extn(savedfile);
 
 	;;; If lynx available, then get text version
 	;;; Veddebug(' checking for html');
@@ -718,10 +744,13 @@
 		show_info(finalname);
 		finalname -> savedfile;
 	else
-		;;; Veddebug('About to show ' <> savedfile);
+		;;;Veddebug('Show_info: ' >< savedfile);
 		show_info(savedfile)
 	endif;
-	edit(savedfile);
+	if member(type, text_types) then
+		;;; Veddebug(['About to edit' ^savedfile]);
+		edit(savedfile);
+	endif;
 enddefine;
 
 define process_qp(savedfile, quoted_printable, lynx_path) -> savedfile;
@@ -742,11 +771,13 @@
 		;;; Veddebug([running: ^mime_decode_quoted_printable_command]);
 		decode_file_into(mime_decode_quoted_printable_command, savedfile, newnewname);
         ;;; qp encoded file is generally not worth saving
-		;;; Veddebug([DELETING ^savedfile]);
+		;;; Veddebug([DELETING QP file ^savedfile]);
 		sysdelete(savedfile) ->;
 		newnewname -> savedfile;
 	endif;
+	;;;; Veddebug([show_info ^savedfile]);
 	show_info(savedfile);
+	;;; Veddebug([process_html ^savedfile]);
 	process_html(savedfile, lynx_path);
 enddefine;
 
@@ -790,7 +821,7 @@
 		return;
 	endif;
 	
-	;;;Veddebug('savedir '>< savedir);
+	;;; Veddebug('savedir '>< savedir);
 
 	if member(savedir, ['/var/mail/' '/var/spool/mail/' '/usr/spool/mail/']) then
 		;;; if reading system mail file, store files in user's mail directory,
@@ -894,6 +925,7 @@
 		if issubstring(qp_field, content_transfer_encoding) then
 			true -> quoted_printable;
 		elseif issubstring('base64', content_transfer_encoding) then
+			;;; Veddebug('ENCODING: ' >< content_transfer_encoding);
 			true -> mimencoded;
 			mimetype -> saved_file_type;
 		elseif isstartstring('7bit', content_transfer_encoding)
@@ -910,10 +942,12 @@
 			;;; not sure this is possible
 			true -> rtfcoded;
 			rtftype -> saved_file_type;
+		else
+			'undefined' -> saved_file_type;
 		endif;
 	endif;
 	;;; Veddebug('qp type ' >< quoted_printable);
-	;;; Veddebug('saved file type ' >< saved_file_type);
+	;;; Veddebug(['saved file type '  ^saved_file_type]);
 
 	;;; Find out type (suffix) of ultimate file to be saved
 	;;; e.g. after decoding
@@ -935,6 +969,7 @@
 	markmime_contents();
 
 	;;; now should have filetype, content_transfer_encoding, content_type, file_name etc.
+	;;; Veddebug([saved_file_type ^saved_file_type]);
 
 	lvars string = vedthisline();
 	;;; find out if it is uuencoded
@@ -971,7 +1006,7 @@
 		ppttype -> saved_file_type;
 	else
 		;;; use null string as type, by default
-		;;; vederror('Unknown coding type')
+		vederror('Unknown coding type')
 	endif;
 
 	;;; Veddebug('Revised saved file type ' >< saved_file_type);
@@ -988,14 +1023,14 @@
 	;;; Veddebug([filetype ^filetype saved ^saved_file_type]);
 
 	if member(filetype, no_decode_types) and
-		saved_file_type = texttype then
+		(saved_file_type = texttype or saved_file_type = txttype) then
 		;;; don't add file suffix
 
 	elseunless Isendstring(saved_file_type, savedfile) then
 		;;; empty type works OK
 		;;; see if it is necessary to add a suffix.
 		lvars suff = uppertolower(sys_fname_extn(savedfile));
-		
+	
 		savedfile >< saved_file_type-> savedfile;
 	endif;
 	if quoted_printable then savedfile<>'-qp' -> savedfile endif;
@@ -1028,6 +1063,8 @@
 		else savedpath >< filetype
 		endif -> decodedfile;
 
+		;;; Veddebug('DECODEDNAME: ' >< decodedfile);
+
 		unless Isendstring(filetype, decodedfile) then
 			decodedfile >< filetype -> decodedfile;
 		endunless;
@@ -1039,6 +1076,7 @@
 			;;; remove crlf from text files sent by PC users
 			decode_file_into(mime_decode_and_crlf_command, savedfile, decodedfile);
 		else
+			;;; Veddebug('decoding non text_type: ' >< filetype);
 			decode_file_into(mime_decode_command, savedfile, decodedfile);
 		endif;
 
@@ -1048,15 +1086,14 @@
 			if decode_protect then 'chmod 640 ' else 'chmod 644 '
 			endif >< decodedfile);
 
-		;;; work out length of file excluding last 22 chars
-		lvars len = max(0, datalength(savedfile) - 22);
-
+		;;; work out length of file name excluding last 22 chars
+		;;; lvars len = max(0, datalength(savedfile) - 22);
 		;;; Ask if the original and mime file should be deleted, and show the results.
 		;;; if getanswer('Decoded! Delete mime file (...' <> allbutfirst(len, savedfile) <>') y/n?') then
 		vedputmessage('Decoded! Deleting mime file');
         syssleep(50);
 		sysdelete(savedfile) ->;
-			false -> savedfile;
+		false -> savedfile;
 		;;; else
 		;;;	show_info(savedfile)
 		;;; endif;
@@ -1068,8 +1105,12 @@
 			true -> deleteasked;
 		endunless;
 
+		;;;; Veddebug('Decoded: ' >< decodedfile);
+
 		;;; Attempt some processing, or advice for user
 		if member(filetype, text_types) then
+			;;; Altered. AS 23 Nov 2006
+			;;; process_html(savedfile, lynx_path);
 			process_html(decodedfile, lynx_path);
 			if isendstring(htmltype, decodedfile) then
 				if do_not_display_file then
@@ -1107,18 +1148,19 @@
 				vedlinebelow();
 			endif;
 			endlblock;
-		elseif filetype = sdwtype or filetype = sxwtype then
-			;;; try to decode StarOffice/OpenOffice file. Probably won't work
-			veddo(lhalw_command >< decodedfile);
-			;;; Rename output
-			veddo('name ' <> decodedfile >< texttype);
-			ved_w1();
-			show_info(vedpathname);
-			vedtopfile();
-			vedlinebelow();
-			vedinsertstring('RESULT OF DECODING BY LHALW: EDIT AS NEEDED');
-			vedlinebelow();
+;;; 		elseif filetype = sdwtype or filetype = sxwtype then
+;;; 			;;; try to decode StarOffice/OpenOffice file. Probably won't work
+;;; 			veddo(lhalw_command >< decodedfile);
+;;; 			;;; Rename output
+;;; 			veddo('name ' <> decodedfile >< texttype);
+;;; 			ved_w1();
+;;; 			show_info(vedpathname);
+;;; 			vedtopfile();
+;;; 			vedlinebelow();
+;;; 			vedinsertstring('RESULT OF DECODING BY LHALW: EDIT AS NEEDED');
+;;; 			vedlinebelow();
 		elseif member(filetype, text_types) then
+			;;; Veddebug(['Reading in ' ^decodedfile]);
 			veddo('ved ' >< decodedfile);
 		elseif filetype = pstype then
 			vedputmessage('Try ghostview to view');
@@ -1189,6 +1231,9 @@
 		endunless;
 		;;; showfiles();
 		;;; return();
+	else
+		;;; Veddebug([Uncategorised ^filetype]);
+		vederror('Uncategorised type: ' >< filetype);
 	endif;
 
 	vedcheck();
@@ -1214,14 +1259,10 @@
 		and getanswer('Try netscape? (y/n)') then
 			veddo('bg netscape ' <> displayfile);
 			vedputmessage('netscape launched. Please wait')
-		elseif DISPLAY and member(filetype, pcv_types)
-		and getanswer('Try PcFileViewer? (y/n)') then
-			veddo('bg /bham/ums/solaris/com/bin/pcv ' <> displayfile);
-			vedputmessage('Viewer launched. Please wait')
 		elseif DISPLAY and member(filetype, soffice_types)
-		and getanswer('Try StarOffice? (y/n)') then
+		and getanswer('Try StarOffice? OpenOffice (y/n)') then
 			veddo('bg soffice ' <> displayfile);
-			vedputmessage('Star Office launched. Please wait')
+			vedputmessage('Star/Open Office launched. Please wait')
 		elseif DISPLAY and member(filetype, pdf_types)
 		and getanswer('Try acroread? (y/n)') then
 			veddo('bg acroread ' <> displayfile);
@@ -1239,6 +1280,31 @@
 endsection;
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Feb 12 2007
+	Moved latex type to later, incase it clashes with something
+	like Zip type.
+--- Aaron Sloman, Nov 23 2006
+	Altered find_file_type to keep '.txt' for files that already	
+	have that.
+
+	Replaced
+			process_html(savedfile, lynx_path);
+	with
+			process_html(decodedfile, lynx_path);
+
+	Commented out more calls of Veddebug
+
+--- Aaron Sloman, 6 Nov 2006
+	Stopped it reading in image files encoded as QP e.g. tiff
+
+--- Aaron Sloman, 1 Oct 2006
+	Modified to allow things like
+		X-Attachment-Id: f_esryfy1c
+--- Aaron Sloman, May 29 2006
+		Added odttype, odptype, odstype, and removed some junk relating to
+		StarOffice types.
+--- Aaron Sloman, May 29 2006
+		Removed pcvtypes
 --- Aaron Sloman, Jul 11 2005
 		Added jar type.
 --- Aaron Sloman, Jun  9 2004
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/vedmail/auto/ved_reply.p v15.6301-amd64/pop/packages/vedmail/auto/ved_reply.p
--- pp0/v15.61-amd64/pop/packages/vedmail/auto/ved_reply.p	2007-01-30 12:18:32.000000000 -0500
+++ v15.6301-amd64/pop/packages/vedmail/auto/ved_reply.p	2009-07-07 17:17:39.000000000 -0400
@@ -1,5 +1,5 @@
-/* --- Copyright University of Birmingham 2007. All rights reserved. ------
- > File:            $poplocal/local/auto/ved_reply.p
+/* --- Copyright University of Birmingham 2009. All rights reserved. ------
+ > File:            $usepop/pop/packages/vedmail/auto/ved_reply.p
  > Purpose:			Reply to email message
  > Author:          Aaron Sloman, Updated Sept 1994 (see revisions)
  > Documentation:	See below
@@ -135,14 +135,18 @@
 define lconstant vedgetrest(string) -> string with_props 601;
 	;;; used to get continuation of "To:" or "CC:" line, etc.
 	;;; if next line starts with space or tab
-	lvars string, line;
+	lvars string, line, strings;
 	prune_leader(string) -> string;
 	repeat
 		vednextline();
 		vedthisline() -> line;
 	quitif(vvedlinesize == 0 or strmember(`:`,line)
 			or not(strmember(line(1),'\s\t')));
-		string  sys_>< prune_leader(line) -> string
+	sysparse_string(string) <> sysparse_string(line) -> strings;
+	destpair(strings) -> (string, strings);
+	for line in strings do
+		string  sys_>< vedspacestring sys_>< line -> string
+	endfor;
 	endrepeat;
 enddefine;
 
@@ -154,7 +158,7 @@
 	vedjumpto(lo,1);
 	repeat
 		if vvedlinesize == 0 then false -> found; return() endif;
-		vedthisline() -> found;
+		veddecodetabs(vedthisline()) -> found;
 		if isstring(string) then
 			returnif(isstartstring(string, found));
 		else ;;; string must be a list of strings...
@@ -239,6 +243,8 @@
 		else
 			'Subject: Re: ' sys_>< allbutfirst(9, subject) -> subject
 		endif;
+		vedgetrest(subject) -> subject;
+		;;; Veddebug(subject);
 	else 'Subject: ' -> subject
 	endif
 enddefine;
@@ -296,7 +302,9 @@
 		;;; extract the string and if appropriate, the key
 		if ispair(key) then destpair(field) ->(key, field) endif;
 		;;; remove field stuff from beginning of string
-		allbutfirst(datalength(key), field) -> field
+		allbutfirst(datalength(key), field) -> field;
+    	;;; see if there is a continuation
+	 	vedgetrest(field) -> field;
 	endif;
 	;;; Veddebug([key ^key field ^field]);
 enddefine;
@@ -308,7 +316,7 @@
 enddefine;
 
 define lconstant vedgetreferences(lo,hi) -> references;
-	;;; Get subject from line 'Subject: ...   '
+	;;; Get references from line 'References: ...   '
 	lvars lo,hi,references;
 	vedgetfield(ved_references_field , lo, hi) -> references;
 	;;; Veddebug([references ^references]);
@@ -375,6 +383,7 @@
 		endif;
 	else false -> Cc
 	endif;
+
 	;;; Veddebug(Cc);
 	;;; Find where to start reply
 	if Where = '@t' then lo
@@ -398,7 +407,8 @@
 		unless vvedlinesize == 0 then vedlinebelow() endunless
 	endif;
 	unless vedline==1 then vedlinebelow() endunless;
-	unless vedline >= vvedbuffersize then vedlinebelow(); vedcharup();
+	unless vedline >= vvedbuffersize then
+		vedlinebelow(); vedlinebelow(); vedcharup();
 	endunless;
 	;;; insert 'From ' line to conform to mail format.
 	vedcheck();
@@ -420,18 +430,23 @@
 	vedlinebelow(); vedinsertstring(subject);
 
 	;;; insert messageid
-	vedlinebelow();
-	vedinsertstring(ved_inreplyfield); vedinsertstring(messageid);
+	if messageid then
+		vedlinebelow();
+		vedinsertstring(ved_inreplyfield); vedinsertstring(messageid);
+	endif;
+
 	;;; insert references
-	vedlinebelow();
-	vedinsertstring(ved_references_field);
+	if messageid or references /== nullstring then
+		vedlinebelow();
+		vedinsertstring(ved_references_field);
 		unless datalength(references) == 0 then
-			;;; this may be a null string
 			vedinsertstring(references);
 			vedcharright();
 		endunless;
 		;;; make sure at least messageid is in references field.
-		vedinsertstring(messageid);
+		if messageid then vedinsertstring(messageid) endif;
+
+	endif;
 
 	if Cc then
 		;;; insert copy list
@@ -466,10 +481,10 @@
 				vedtextright(); vedcheck(); vedrefreshrange(vedline,vedline,undef);
 			endif;
 		endif;
-		vedcharup(); vedtextright()
+		vedcharup(); vedtextright();vedmarkhi();
 	endif;
 	if oldc then oldc + 1 else 1 endif -> vedchanged;
-	chain(ved_mcm);
+	chain(ved_mcm<>vedrefresh);
 enddefine;
 
 define global vars procedure ved_reply =
@@ -485,6 +500,11 @@
 nil -> proglist;
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Jul  7 2009
+	Altered to cope with 'wrapped' Subject line.
+--- Aaron Sloman, Feb  7 2007
+	Fixed some problems with continuation lines, and dealt with missing
+	references field	
 --- Aaron Sloman, Jan 30 2007
 	Altered to insert In-Reply-To: field and References: field
 	(Users who don't want them can delete them before sending.)
@@ -543,4 +563,24 @@
 	Simplified vedgetsubject. Made it insert "Re:" after subject, if
 	it isn't already there. Used pdr_valof
 
+         CONTENTS - (Use <ENTER> g to access required sections)
+
+ define lconstant charsbetween(start,fin,string) with_props 501;
+ define lconstant prune_leader(string) -> string;
+ define lconstant prunesitename(string) -> string with_props 505;
+ define lconstant Veddo(vedcommand) with_props 600;
+ define lconstant vedgetrest(string) -> string with_props 601;
+ define lconstant vedtryfind(string,lo,hi) -> found with_props 602;
+ define lconstant vedgetsender(lo,hi) -> line with_props 603;
+ define lconstant vedgetsubject(lo,hi) -> subject with_props 604;
+ define lconstant vedgetCc(lo,hi,) -> Cc with_props 605;
+ define lconstant vedgetTo(lo,hi,) -> string with_props 606;
+ define lconstant vedgetfield(key, lo, hi) -> field;
+ define lconstant vedgetmesssageid(lo,hi) -> messageid;
+ define lconstant vedgetreferences(lo,hi) -> references;
+ define lconstant vedtry(proc,lo,hi);
+ define lconstant veddoreply(all_?) with_props ved_reply;
+ define global vars procedure ved_reply =
+ define global vars procedure ved_Reply =
+
  */
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/vedmail/auto/ved_respond.p v15.6301-amd64/pop/packages/vedmail/auto/ved_respond.p
--- pp0/v15.61-amd64/pop/packages/vedmail/auto/ved_respond.p	2003-08-02 12:13:31.000000000 -0400
+++ v15.6301-amd64/pop/packages/vedmail/auto/ved_respond.p	2009-07-07 18:48:57.000000000 -0400
@@ -1,5 +1,5 @@
-/* --- Copyright University of Birmingham 2003. All rights reserved. ------
- > File:            $poplocal/local/auto/ved_respond.p
+/* --- Copyright University of Birmingham 2009. All rights reserved. ------
+ > File:            $usepop/pop/packages/vedmail/auto/ved_respond.p
  > Purpose:			Reply to message, quoting it indented.
  > Author:          Aaron Sloman, Feb  6 1992 (see revisions)
  > Documentation:	HELP * VED_GETMAIL
@@ -41,10 +41,20 @@
 	ved_mcm();
 	vedmarklo();
 	unless arg = nullstring then
+		;;; use arg to set 'quotation indicator'
 		'gsr/@a/' <> arg <> ' /' -> commandstring
 	endunless;
 	veddo(commandstring);
 	ved_mcm();
+	vedpositionpush();
+	vedendrange();
+	;;; add a line
+	vedlinebelow();
+	;;; unmark new line
+	vedcharup(); vedmarkhi();
+	;;; go back
+	vedpositionpop();
+
 	;;; move range off From line
 	vvedmarklo+1 -> vvedmarklo;
 	chain(vedrefresh);
@@ -59,6 +69,9 @@
 endsection;
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Jul  7 2009
+		add unmarked blank line at end of new message, to avoid
+		marked range commands affecting next message.
 --- Aaron Sloman, Aug  2 2003
 	Made to cal ved_mcm at end
 --- Aaron Sloman, Jul 11 1992
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/packages/vedutils/auto/ved_jlp.p v15.6301-amd64/pop/packages/vedutils/auto/ved_jlp.p
--- pp0/v15.61-amd64/pop/packages/vedutils/auto/ved_jlp.p	1999-05-23 08:17:00.000000000 -0400
+++ v15.6301-amd64/pop/packages/vedutils/auto/ved_jlp.p	2008-06-12 11:46:45.000000000 -0400
@@ -1,4 +1,4 @@
-/* --- Copyright University of Birmingham 1999. All rights reserved. ------
+/* --- Copyright University of Birmingham 2008. All rights reserved. ------
  > File:            $poplocal/local/ved_latex/auto/ved_jlp.p
  > File:            $poplocal/local/auto/ved_jlp.p
  > Purpose:			justify paragraph in .tex files specially
@@ -28,9 +28,9 @@
 
 global vars non_latex_para_breaks;
 unless isstring(non_latex_para_breaks) then
-	;;; use '.' at begining of line as an indication that line should not
-	;;; be joined, as in nroff/troff files.
-	'.' -> non_latex_para_breaks
+	;;; use '.' or '>' at begining of line as an indication that line should not
+	;;; be joined, as in nroff/troff files and mail files with quotes.
+	'>.' -> non_latex_para_breaks
 endunless;
 
 
@@ -69,7 +69,7 @@
 		until vedline == vvedbuffersize or vvedlinesize == 0 or formatline() do
 			vedchardown();
 			if isstartstring('Received: ', vedthisline()) then
-				Veddebug('In mail header. Are you sure?')
+				veddebug('In mail header. Are you sure?')
 			endif;
 		enduntil;
 		if vvedlinesize == 0 or formatline() then vedcharup() endif;
@@ -87,6 +87,8 @@
 endsection;
 
 /* --- Revision History ---------------------------------------------------
+--- Aaron Sloman, Jun 12 2008
+		Replaced 'Veddebug' with 'veddebug'
 --- Aaron Sloman, May 23 1999
 	Extended to work better with teach files ending in .p
 --- Aaron Sloman, Mar 24 1999
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/aextern.s v15.6301-amd64/pop/src/aextern.s
--- pp0/v15.61-amd64/pop/src/aextern.s	2005-03-11 05:30:39.000000000 -0500
+++ v15.6301-amd64/pop/src/aextern.s	2010-01-03 05:55:39.000000000 -0500
@@ -187,6 +187,16 @@
 	leaq	8(%rsp), %rbp
 	movq	%rbp, SAVED_SP
 
+        ;;; save registers.  XXXX What to do about garbage collection
+        ;;; of Pop values ???
+        push    %r8
+        push    %r10
+        push    %r11
+        push    %r12
+        push    %r13
+        push    %r14
+        push    %r15
+
 	;;; Load fixed arguments
 
 	movq	(%USP), %r12	;;; _________fltsingle
@@ -203,6 +213,7 @@
 ;;;     fits into a register this gives 3+nargs, push allocate 1
 ;;;     so we put another two into alignment code
 
+        subq    $56, %rbp
         push    %r10
         xorq    %r14, %r14
         subq    %r15, %rsp       ;;; allocate space for arguments
@@ -347,6 +358,13 @@
 
 	movq	SAVED_SP, %rax
         movq    (%rax), %rbp
+        movq    -16(%rax), %r8
+        movq    -24(%rax), %r10
+        movq    -32(%rax), %r11
+        movq    -40(%rax), %r12
+        movq    -48(%rax), %r13
+        movq    -56(%rax), %r14
+        movq    -64(%rax), %r15
 	leaq	-8(%rax), %rsp
 	movq	$0, SAVED_SP		;;; Indicates external call over
 
@@ -527,6 +545,26 @@
 	.align  16
 
 
+EXTERN_NAME(pop_print):
+#_IF CHECK_BREAK
+
+        ;;; Save the current break so that callback code has correct
+        ;;; info 
+
+        movq    EXTERN_NAME(___brk_addr), %rax
+        movq    %rax, save_curbrk
+        movl    $0, %eax
+#_ENDIF
+    movq %rdi, SAVED_SP
+    movq %rsi, SAVED_USP
+    pushq %rdx
+    movq $C_LAB(sys_syspr), %rdi
+    movq %rsp, %rsi
+    call pop_call
+    addq $8, %rsp
+    ret
+    .align  16
+
 	.data
 
 #_IF CHECK_BREAK
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/amain.s v15.6301-amd64/pop/src/amain.s
--- pp0/v15.61-amd64/pop/src/amain.s	2005-03-11 05:30:39.000000000 -0500
+++ v15.6301-amd64/pop/src/amain.s	2009-12-25 02:56:37.000000000 -0500
@@ -59,6 +59,14 @@
 
 	movq    %rsi,  I_LAB(Sys$- _init_args)
 
+#_IF DEF LINUX
+
+        ;;; set personality
+
+        call linux_setper
+
+#_ENDIF
+
 	;;; Initialise the floating-point unit
 
 	call	fpu_init
@@ -67,8 +75,12 @@
 
 	movq	SAVED_USP, %USP
 
-	;;; Start the system
-
+	;;; clear Pop registers
+        movq    $3, %r13
+        movq    $3, %r14
+        movq    $3, %r15
+        
+        ;;; Start the system
 	call	XC_LAB(setpop)
 
 	;;; Exit with 0
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/amisc.s v15.6301-amd64/pop/src/amisc.s
--- pp0/v15.61-amd64/pop/src/amisc.s	2005-03-11 05:30:39.000000000 -0500
+++ v15.6301-amd64/pop/src/amisc.s	2009-12-27 15:49:45.000000000 -0500
@@ -17,7 +17,8 @@
 
 constant
 	procedure (Call_overflow, User_overflow, Callstack_reset,
-	Conspair, Plog$-Area_overflow, Async_raise_signal)
+	Conspair, Plog$-Area_overflow, Async_raise_signal,
+        dummy_procedure_callback_helper)
 	;
 
 endsection;
@@ -42,6 +43,14 @@
 
 );
 
+lconstant macro MOVFL   = if DEF FRAME_LEN_16BIT then "movzwl"
+                          elseif DEF FRAME_LEN_32BIT then "movl"
+                          else "movzbl"
+                          endif;
+
+lconstant macro RAX = if DEF FRAME_LEN_32BIT then "eax" else "rax" endif;
+lconstant macro RCX = if DEF FRAME_LEN_32BIT then "ecx" else "rcx" endif;
+
 >_#
 
 	.file	"amisc.s"
@@ -261,7 +270,7 @@
 	;;; Find the length of the frame (in longwords) from the owner's
 	;;; procedure header
 
-	movzbq	_PD_FRAME_LEN(%rcx), %rcx
+	MOVFL	_PD_FRAME_LEN(%rcx), %ecx
 
 	;;; Add the frame length in bytes (ECX * 4) to the given frame
 	;;; pointer to get the next frame pointer.
@@ -298,7 +307,7 @@
 	;;; Extract the length of the previous stack frame (in longwords)
 	;;; from its owner procedure, whose address should be in PB
 
-	movzbq	_PD_FRAME_LEN(%PB), %rax
+	MOVFL	_PD_FRAME_LEN(%PB), %eax
 
 	;;; The last word in that frame will be the return address:
 	;;; copy that to CHAIN_REG, then replace it with our return
@@ -1006,6 +1015,31 @@
 
 	.align  16
 
+        .data
+mess33:
+        .string "sp = 0x%lx\\n"
+
+        .text
+EXTERN_NAME(pop_print_sp):
+        movq    $mess33, %rdi
+        movq    %rsp, %rsi
+        movl    $0, %eax
+        call    printf
+        ret
+
+/*
+EXTERN_NAME(pop_print):
+        pushq %rbp
+        mov XC_LAB(Sys$-dummy_procedure_callback_helper),%rbp
+        pushq %rbp
+        subq    $8, %USP
+        movq    %rdi, (%USP)
+        call     XC_LAB(sys_syspr)
+        popq %rbp
+        popq %rbp
+        ret
+        .align  16
+*/
 
 /***************** end labels for wrapping structures *****************/
 
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/aprocess.s v15.6301-amd64/pop/src/aprocess.s
--- pp0/v15.61-amd64/pop/src/aprocess.s	2005-03-11 05:30:39.000000000 -0500
+++ v15.6301-amd64/pop/src/aprocess.s	2009-12-24 15:36:33.000000000 -0500
@@ -31,6 +31,11 @@
 	_PS_STATE		= @@PS_STATE,
 );
 
+lconstant macro MOVFL   = if DEF FRAME_LEN_16BIT then "movzwl"
+                          elseif DEF FRAME_LEN_32BIT then "movl"
+                          else "movzbl"
+                          endif;
+
 >_#
 
 	.file	"aprocess.s"
@@ -107,7 +112,7 @@
 	;;; record; we compute the position of the next frame by subtracting
 	;;; the length of the current stack frame
 
-	movzbq	_PD_FRAME_LEN(%PB), %rax
+	MOVFL	_PD_FRAME_LEN(%PB), %eax
 	salq	$3, %rax
 	subq	%rax, %rdi
 	movq	%rdi, NEXT_FRAME
@@ -122,7 +127,7 @@
 	;;; Copy any on-stack lvars into the process record
 
 	cld
-	movzbq	_PD_NUM_STK_VARS(%PB), %rcx
+	MOVFL	_PD_NUM_STK_VARS(%PB), %ecx
 	leaq	8(%rsp), %rsi
 	rep
 	smovq
@@ -130,7 +135,7 @@
 
 	;;; Test if there are any dynamic locals
 
-	movzbq	_PD_NLOCALS(%PB), %rcx
+	MOVFL	_PD_NLOCALS(%PB), %ecx
 	cmpq	$0, %rcx
 	je	L2.1
 
@@ -253,7 +258,7 @@
 	;;; Compute the position of the next frame in the record by adding
 	;;; the length of the current frame
 
-	movzbq	_PD_FRAME_LEN(%PB), %rax
+	MOVFL	_PD_FRAME_LEN(%PB), %eax
 	leaq	(%rsi, %rax, 8), %rsi
 	movq	%rsi, NEXT_FRAME
 	subq	$8, %rsi
@@ -261,7 +266,7 @@
 	;;; Check for any dynamic locals
 
 	std
-	movzbq	_PD_NLOCALS(%PB), %rcx
+	MOVFL	_PD_NLOCALS(%PB), %ecx
 	cmpq	$0, %rcx
 	je	L2.2
 
@@ -283,7 +288,7 @@
 L2.2:	;;; Copy any on-stack lvars from the saved frame,
 	;;; adjusting ESP first in case of interrupts
 
-	movzbq	_PD_NUM_STK_VARS(%PB), %rcx
+	MOVFL	_PD_NUM_STK_VARS(%PB), %ecx
 	leaq	-8(%rsp), %rdi
 
 	leaq	(, %rcx, 8), %rax
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/asignals.s v15.6301-amd64/pop/src/asignals.s
--- pp0/v15.61-amd64/pop/src/asignals.s	2005-03-11 05:30:39.000000000 -0500
+++ v15.6301-amd64/pop/src/asignals.s	2009-12-26 14:02:54.000000000 -0500
@@ -167,6 +167,13 @@
 
 	leaq	8(%rsp), %rax
 	movq	%rax, SAVED_SP
+        pushq   %r8
+        pushq   %r10
+        pushq   %r11
+        pushq   %r12
+        pushq   %r13
+        pushq   %r14
+        pushq   %r15
 
 	;;; Get the system call address in R10 and the argument count in RAX
 
@@ -235,6 +242,13 @@
 	;;; Restore the stack pointer and return
 
 	movq	SAVED_SP, %rax
+        movq    -16(%rax), %r8
+        movq    -24(%rax), %r10
+        movq    -32(%rax), %r11
+        movq    -40(%rax), %r12
+        movq    -48(%rax), %r13
+        movq    -56(%rax), %r14
+        movq    -64(%rax), %r15
 	leaq	-8(%rax), %rsp
 	movq	$0, SAVED_SP		;;; indicates external call over
 	ret
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/ass.p v15.6301-amd64/pop/src/ass.p
--- pp0/v15.61-amd64/pop/src/ass.p	2005-03-11 06:06:51.000000000 -0500
+++ v15.6301-amd64/pop/src/ass.p	2009-12-26 17:40:45.000000000 -0500
@@ -64,7 +64,8 @@
 section $-Sys$-Vm;
 
 lvars
-	_strsize,			;;; size of structure table in bytes
+      _regmask,
+      _strsize, ;;; size of structure table in bytes
 ;
 
 
@@ -110,9 +111,10 @@
 	_MOVZX	= _16:B7 _biset  _NO_REX_W,	;;; move and zero-extend R/M-16 -> Reg32
 	_NOP	= _16:90,
 	_POP	= _16:8F,
+        _POPs   = _16:58,   ;;; short (1-byte) form
 	_PUSH	= _16:FF,
 	_PUSHI	= _16:68,
-	_PUSHs	= _16:50,			;;; short (1-byte) form
+	_PUSHs	= _16:50,	;;; short (1-byte) form
 	_RET	= _16:C3,
 	_SHIFTI = _16:C1,			;;; shift/rotate by imm8 (modified by TTT)
 	_SUB	= _16:29,
@@ -228,6 +230,7 @@
 	;;; (available to the VM)
 
 	;;; The value is a popint register number shifted left 1
+        ;;; plus bit 0 if pop reg
 
 	;;; arg_reg_0, _1, & _2 :
 	;;; for passing arguments to subroutines. _1 & _2 are (currently) used
@@ -243,18 +246,36 @@
 
 	chain_reg	= _pint(_CHAIN_REG) << 1,		;;; EDX
 
+        pop_reg_A     = _pint(_R13) <<1 || 1,
+        pop_reg_B     = _pint(_R14) <<1 || 1,
+        pop_reg_C     = _pint(_R15) <<1 || 1,
+        nonpop_reg_A = _pint(_R8) <<1,
+        nonpop_reg_B = _pint(_R10) <<1,
+        nonpop_reg_C = _pint(_R11) <<1,
+        nonpop_reg_D = _pint(_R12) <<1,
+
 ;
 
 constant
 
 	;;; REGISTER LVARS
-	;;; (there aren't any!)
 
-	asm_pop_registers		= [[]],
-	asm_nonpop_registers	= [[]],
+        asm_pop_registers = [[]],
+
+        asm_nonpop_registers = [[]],
+
+/*
+
+        asm_pop_registers = [%[], ident pop_reg_A, ident pop_reg_B,
+                                  ident pop_reg_C %],
+        asm_nonpop_registers = [%[], ident nonpop_reg_A, ident nonpop_reg_B,
+                                 ident nonpop_reg_C, ident nonpop_reg_D %],
 
+        asm_nonpop_registers = [%[], ident nonpop_reg_A, ident nonpop_reg_D %],
+*/
 ;
 
+
 lvars
 	_USP_offset,	;;; "static offset" for accumulating adjustments to USP
 ;
@@ -285,7 +306,7 @@
 
 define Drop_w(_word);
 	lvars _word;
-        lvars _pword = _word;
+;;;        lvars _pword = _word;
 	unless _asm_pass then
 		;;; only output the data on the last pass
 ;;;                _extern printf('Drop_w(0x%04x)\n', _word);
@@ -300,7 +321,7 @@
 
 define Drop_l(_long);
 	lvars _long;
-        lvars _pword = _long;
+;;;     lvars _pword = _long;
 	unless _asm_pass then
 		;;; only output the data on the last pass
 ;;;                _extern printf('Drop_l(0x%08x)\n', _long);
@@ -373,7 +394,7 @@
 define constant Drop_short( _opcode, _reg ) with_nargs 2;
         lvars _opcode, _reg, _rex = Get_rex_short(_reg);
         _reg _bimask _7 -> _reg;
-        if _opcode /== _PUSHs or _rex /== _REX_W then
+        if _not(_opcode == _PUSHs or _opcode == _POPs) or _rex /== _REX_W then
             Drop_b(_rex);
         endif;
 	Drop_b(_opcode _add _reg);
@@ -390,9 +411,7 @@
             Drop_b(_rex _sub _8);
           endif;
           _opcode _sub _NO_REX_W -> _opcode;
-;;; needed to be fixed for AMD64
-;;;        elseif _opcode /== _LEA and _opcode /== _BR_IND or _rex /== _REX_W then
-		  elseif _opcode /== _BR_IND or _rex /== _REX_W then
+        elseif _opcode /== _BR_IND or _rex /== _REX_W then
           Drop_b(_rex);
         endif;
 enddefine;
@@ -522,25 +541,20 @@
 ;;; 	plant test against immediate value (different format again)
 
 define constant Drop_test_imm(_imm, _mod, _rm, _disp);
-        lvars _imm, _mod, _rm, _disp;
-        if _-2147483648 _slteq _imm and _imm _slteq _2147483647 then
-           Drop_move_imm(_imm, _REG, _R9, false);
-;;;           mishap(0, 'Drop_test_imm: IMMEDIATE TOO BIG FOR 32-BITS');
-           if _mod /== _REG then
-              Drop_std(_MOV_IN, _R10, _mod, _rm, _disp);
-              _R10 -> _rm;
-           endif;
-           Drop_std(_TEST, _rm, _REG, _R9, false);
+    lvars _imm, _mod, _rm, _disp;
+    if _-2147483648 _slteq _imm and _imm _slteq _2147483647 then
+        if _mod == _REG and _rm == _EAX then
+            ;;; short form
+            Drop_b(_REX_W);
+            Drop_b(_TESTIs);
         else
-	    if _mod == _REG and _rm == _EAX then
-		;;; short form
-                Drop_b(_REX_W);
-		Drop_b(_TESTIs);
-	    else
-		Drop_std(_TESTI, _0, (_mod, _rm, _disp));
-	    endif;
-	    Drop_l(_imm);
+            Drop_std(_TESTI, _0, (_mod, _rm, _disp));
         endif;
+        Drop_l(_imm);
+    else
+        Drop_move_imm(_imm, _REG, _R9, false);
+        Drop_std(_TEST, _R9, _mod, _rm, _disp);
+    endif;
 enddefine;
 
 ;;;	Drop_call_indir:
@@ -1013,7 +1027,7 @@
 		;;; structure is in a stack lvar (from -conskey-)
 		Drop_std(_MOV_IN, _reg, Get_regindir_efa(_SP, _disp));
 	else
-		mishap(0, 'SYSTEM ERROR 1 IN Do_field');
+		mishap(structure, 1, 'SYSTEM ERROR 1 IN Do_field');
 	endif;
 	;;; If it's an external structure, get the real address
 	if exptr then
@@ -1038,7 +1052,7 @@
 			;;; index is in a stack lvar (from -conskey-)
 			Drop_std(_MOV_IN, _ECX, Get_regindir_efa(_SP, _disp));
 		else
-			mishap(0, 'SYSTEM ERROR 2 IN Do_field');
+			mishap(offset, 1, 'SYSTEM ERROR 2 IN Do_field');
 		endif;
 		;;; If updating, load new value from stack to EAX
 		if upd then Drop_std(_MOV_IN, _EAX, Get_upop_efa()) endif;
@@ -1688,13 +1702,24 @@
 /*	Procedure Entry and Exit  */
 
 define I_CREATE_SF();
-	lvars	_offs;
+	lvars	_offs, _num;
 
 	;;; Set the procedure base register.
 	;;; If all is well, the procedure address should be in ARG_REG_0.
 	;;; movl %ARG_REG_0, %PB
 	Drop_std(_MOV, _ARG_REG_0, (_REG, _PB, false));
 
+        ;;; save registers
+        unless _zero(_regmask) then
+            _8 -> _num;
+            until _num == _16 do
+                if _regmask _bitst _shift(_1, _num) then
+                    Drop_short(_PUSHs, _num);
+                endif;
+                _num _add _1 -> _num;
+            enduntil;
+        endunless;
+
 	;;; Save dynamic locals
 	@@PD_TABLE -> _offs;
 	fast_repeat _pint(_Nlocals) times
@@ -1724,7 +1749,7 @@
 
 
 define I_UNWIND_SF();
-	lvars _offs;
+	lvars _offs, _num;
 
 	;;; Remove owner address and on-stack lvars
 	Drop_imm(_ARITHI, _ADDI, @@(w)[_Nstkvars _add _1], (_REG, _SP, false));
@@ -1739,6 +1764,17 @@
 		Drop_std(_POP, _0, _DISP0, _EAX, _0);
 	endrepeat;
 
+        ;;; restore registers
+        unless _zero(_regmask) then
+            _15 -> _num;
+            until _num == _7 do
+                if _regmask _bitst _shift(_1, _num) then
+                    Drop_std(_POP, _0, _REG, _num, false);
+                endif;
+                _num _sub _1 -> _num;
+            enduntil;
+        endunless;
+
 	;;; Restore procedure base register by reaching over return address
 	;;; to get the previous stack-frame owner:
 	;;; movl [4](%SP), %PB
@@ -1871,19 +1907,27 @@
 ;;;		input
 
 define Do_consprocedure(codelist, reg_locals) -> pdr;
-	lvars	codelist, reg_locals, pdr, _code_offset, _size, _reg_spec;
-        lvars _buff, _cnt;
-	dlocal	_asm_drop_ptr, _asm_pass, _strsize;
-
+    lvars codelist, reg_locals, pdr, _code_offset, _size, _reg_spec;
+    lvars reg, _buff, _cnt;
+    dlocal _regmask, _asm_drop_ptr, _asm_pass, _strsize;
 
+/*
 	;;; Check there are no register locals and set _reg_spec to 0
 ;;;        _extern printf('Do_consprocedure, Pass 1\n');
 ;;;        _extern fflush (_0);
 	unless null(reg_locals) then
 		mishap(reg_locals, 1, 'UNEXPECTED REGISTER LOCALS');
 	endunless;
+*/
 	_0 -> _reg_spec;
 
+        ;;; construct reg mask from reg_locals
+        _0 -> _regmask;
+        for reg in reg_locals do
+                _shift(_1, _int(Is_register(reg))) _biset _regmask -> _regmask
+        endfor;
+
+
 	;;; Pass 1 -- calculate instruction offsets
 	_0 ->> _USP_offset -> _strsize;
 	Code_pass(0, codelist) -> _code_offset;
@@ -1929,8 +1973,6 @@
 
 
 /* --- Revision History ---------------------------------------------------
---- Aaron Sloman and Waldek Hebisch
-		altered Drop_rex to fix exacc
 --- Robert Duncan, Sep 30 1996
 		Added I_IF_TAG for issimple/isinteger tests
 --- Robert John Duncan, Dec 15 1994
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/declare.ph v15.6301-amd64/pop/src/declare.ph
--- pp0/v15.61-amd64/pop/src/declare.ph	2003-11-01 16:15:27.000000000 -0500
+++ v15.6301-amd64/pop/src/declare.ph	2009-12-30 21:24:12.000000000 -0500
@@ -20,7 +20,8 @@
 		;;; system variables
 weak vars
 		_disable, _trap, _system_end, _userlim, _userhi,
-		_call_stack_hi, _call_stack_seg_hi, _plog_save_contn_sp
+		_call_stack_hi, _call_stack_seg_hi, _plog_save_contn_sp,
+                _user_base
 	;
 
 
@@ -40,6 +41,8 @@
 		undef_key, prologvar_key, prologterm_key,
 		intvec_key, shortvec_key, stackmark_key,
 		external_ptr_key, exptr_mem_key,
+                bytevec_key, sbytevec_key, ushortvec_key,
+                uintvec_key, ulongvec_key, longvec_key,
 
 	;
 
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/fields.p v15.6301-amd64/pop/src/fields.p
--- pp0/v15.61-amd64/pop/src/fields.p	2005-01-06 10:13:58.000000000 -0500
+++ v15.6301-amd64/pop/src/fields.p	2009-12-30 21:15:11.000000000 -0500
@@ -282,7 +282,7 @@
 		round_mult(bitoffs,	bitalign) -> bitoffs
 
 	elseif isinteger(spec) and spec /== 0
-	and #_< -INT_BITS >_# fi_<= spec and spec fi_<= INT_BITS then
+	and #_< -WORD_BITS >_# fi_<= spec and spec fi_<= WORD_BITS then
 		if spec fi_< 0 then 0 fi_- spec else spec endif -> bitsize;
 		t_BIT -> type
 
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/initial.p v15.6301-amd64/pop/src/initial.p
--- pp0/v15.61-amd64/pop/src/initial.p	2008-06-05 09:49:08.000000000 -0400
+++ v15.6301-amd64/pop/src/initial.p	2010-01-03 07:24:11.000000000 -0500
@@ -1,4 +1,4 @@
-/* --- Copyright University of Sussex 2008. All rights reserved. ----------
+/* --- Copyright University of Sussex 2003. All rights reserved. ----------
  > File:            C.all/src/initial.p
  > Purpose:         Global initialisation
  > Author:          John Gibson (see revisions)
@@ -23,8 +23,7 @@
 	;;; know about new versions. Used as the version number in the string
 	;;; popversion.
 	;;; (See declaration in declare.ph -- in AIX this is a vars.)
-	;;; 156000 -> pop_internal_version;
-	156102 -> pop_internal_version;
+	156301 -> pop_internal_version;
 
 
 	;;; Initialise variables
@@ -86,18 +85,6 @@
 
 
 /* --- Revision History ---------------------------------------------------
---- Aaron Sloman, Feb  4 2008
-		pop_internal_version = 156102
-		Only minor changes, including addition of a simple highlighting
-		extension to ved, and improvements to installation scripts
-	Items copied from 32 bit poplog
-	--- Aaron Sloman, Oct  1 2007
-		pop_internal_version = 156101 (various changes, especially unix_dir.p)
-	--- Aaron Sloman, Apr 11 2007
-		pop_internal_version = 156100 (various changes)
---- Aaron Sloman, Jan 18 2005
-		Chnaged version to
-		pop_internal_version = 156000 (various changes)
 --- Aaron Sloman, 1 Nov 2003
 		Added pop_translate_envvars
 		syfileok will translate environment variables if it is true (default)
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/int_convert.p v15.6301-amd64/pop/src/int_convert.p
--- pp0/v15.61-amd64/pop/src/int_convert.p	2005-03-13 04:53:19.000000000 -0500
+++ v15.6301-amd64/pop/src/int_convert.p	2009-12-24 15:49:43.000000000 -0500
@@ -1,4 +1,4 @@
-/* --- Copyright University of Sussex 2005. All rights reserved. ----------
+/* --- Copyright University of Sussex 1995. All rights reserved. ----------
  > File:            C.all/src/int_convert.p
  > Purpose:
  > Author:          John Gibson, Feb  2 1988 (see revisions)
@@ -15,7 +15,6 @@
 
 	;;; values used for converting between sysints and bigints, etc
 lconstant
-;;;	ICVT_SHIFT			= WORD_BITS-POPINT_BITS+1,
 	ICVT_SHIFT			= WORD_BITS-POPINT_BITS,
 	_ICVT_SHIFT			= _int(ICVT_SHIFT),
 	_ICVT_LOMASK		= _int(2**ICVT_SHIFT-1),
@@ -37,8 +36,9 @@
 	SAVEWORKBGI(_work, _save1, _save2);
 	BGWEAK Bigint_<< (
 		BGWEAK Pint_to_bigint(
-			_pint( _shift(_n, _negate(_ICVT_SHIFT)) _bimask _ICVT_HIMASK ),
-												_work),
+			_pint( _shift(_n, _negate(_ICVT_SHIFT)) 
+                                  _bimask _ICVT_HIMASK),
+			_work),
 		_ICVT_SHIFT) -> res;
 	RESTWORKBGI(_work, _save1, _save2);
 	_n _bimask _ICVT_LOMASK -> _n;
@@ -81,7 +81,8 @@
 	lvars n, _hi, _lo, _rangemask;
 	if isinteger(n) then
                 _int(n) -> _hi;
-		returnif(_nonneg(_hi) and _hi _lteq _rangemask) (_hi)
+		returnif(_nonneg(_hi) and _hi _lteq _rangemask) (_hi);
+
 	elseif iscompound(n) and n!KEY == weakref biginteger_key then
 		n!BGI_SLICES[_0] _bimask _ICVT_LOMASK -> _lo;
 		BGWEAK Bigint_>>(n, _ICVT_SHIFT) -> _hi;
@@ -91,7 +92,7 @@
 				_shift(_hi, _ICVT_SHIFT) _add _lo -> _hi;
 				returnif(_hi _lteq _rangemask) (_hi)
 			endif
-		endif
+		endif;
 	endif;
 	Err(n, _rangemask, false)
 enddefine;
@@ -146,10 +147,6 @@
 
 
 /* --- Revision History ---------------------------------------------------
---- Aaron Sloman, Mar 13 2005
-		Patch for AMD64 poplog provided by Waldek Hebisch
-		ICVT_SHIFT			= WORD_BITS-POPINT_BITS,
-		
 --- John Gibson, Sep 19 1995
 		Used new macros SAVEWORKBGI/RESTWORKBGI to localise use of
 		work_bigint1.
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/intvec.p v15.6301-amd64/pop/src/intvec.p
--- pp0/v15.61-amd64/pop/src/intvec.p	1995-06-03 12:31:03.000000000 -0400
+++ v15.6301-amd64/pop/src/intvec.p	2009-12-30 22:05:52.000000000 -0500
@@ -13,6 +13,19 @@
 
 defclass intvec :int;
 
+defclass untvec :uint;
+
+defclass bytevec :byte;
+
+defclass sbytevec :sbyte;
+
+defclass shortvec :short;
+
+defclass ushortvec :ushort;
+
+defclass longvec :long;
+
+defclass ulongvec :ulong;
 
 /* --- Revision History ---------------------------------------------------
 --- John Gibson, Apr  5 1995
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/lispcore.p v15.6301-amd64/pop/src/lispcore.p
--- pp0/v15.61-amd64/pop/src/lispcore.p	1998-02-12 09:38:38.000000000 -0500
+++ v15.6301-amd64/pop/src/lispcore.p	2009-12-26 21:58:50.000000000 -0500
@@ -1400,7 +1400,7 @@
 enddefine;
 
 
-define lconstant App_package(pkg, procedure pdr, _do_internals);
+define lconstant App_package(pkg, procedure pdr, _do_internals, check_access);
 	lvars _sl, _offs, _lim, entry;
 	stacklength() -> _sl;
 	pkg!PKG_VECTOR -> pkg;
@@ -1409,7 +1409,10 @@
 	while _offs _lt _lim do
 		pkg!(w){_offs} -> entry;
 		while iscompound(entry) do
-			if _do_internals or (entry!KEY == package_external_entry_key) then
+			if (_do_internals or 
+                             (entry!KEY == package_external_entry_key))
+                           and (not(check_access) 
+                                or check_access(entry!PGE_SYM)) then
 				_CHECKUSER;
 				lisp_apply(Return_symbol(entry!PGE_SYM), pdr, 1, 0)
 			endif;
@@ -1421,15 +1424,21 @@
 
 
 define apppackage(pkg, pdr, do_internals, do_inherits);
-	lvars p;
-	Checkr_package(pkg) -> pkg;
-	$-Sys$-Check_procedure(pdr);
-	App_package(pkg, pdr, pop_true(do_internals));
-	if pop_true(do_inherits) then
-		for p in pkg!PKG_USES do
-			App_package(p, pdr, false)
-		endfor
-	endif
+    lvars p;
+    Checkr_package(pkg) -> pkg;
+    $-Sys$-Check_procedure(pdr);
+    App_package(pkg, pdr, pop_true(do_internals), false);
+    if pop_true(do_inherits) then
+        for p in pkg!PKG_USES do
+            App_package(p, pdr, false,
+                 procedure(sym);
+                     lvars entry, name;
+                     sym!SYM_NAME -> name;
+                     Find_pkg_entry(name, pkg, pkg!PKG_USES) -> (entry, , );
+                     entry and (entry!PGE_SYM == sym);
+                 endprocedure)
+        endfor
+    endif
 enddefine;
 
 
@@ -1551,8 +1560,8 @@
 	endif -> (pkgs, do_inherits);
 
 	fast_for pkg in pkgs do
-		apppackage(
 			pkg,
+		apppackage(
 			procedure(sym);
 				if issubstring(string, symbol_string(sym)) then
 					conspair(sym, list) -> list
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/mksyscomp v15.6301-amd64/pop/src/mksyscomp
--- pp0/v15.61-amd64/pop/src/mksyscomp	1993-07-13 11:41:50.000000000 -0400
+++ v15.6301-amd64/pop/src/mksyscomp	2009-12-24 13:00:41.000000000 -0500
@@ -23,7 +23,7 @@
 for IMAGE
 do
 
-corepop11 %nort %noinit << ****
+corepop %nort %noinit << ****
 	lvars savedir = current_directory;
 	'$popsrc/syscomp' -> current_directory;
 	$DEBUG -> pop_debugging;
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/newpop v15.6301-amd64/pop/src/newpop
--- pp0/v15.61-amd64/pop/src/newpop	1993-07-09 23:55:48.000000000 -0400
+++ v15.6301-amd64/pop/src/newpop	2008-06-13 05:30:10.000000000 -0400
@@ -15,9 +15,13 @@
 
 # Run the NEWPOP saved image based on corepop
 if [ $# -eq 0 ]; then
-	corepop +$popsys/newpop.psv
+#	echo corepop +$popsys/newpop.psv
+        corepop +$popsys/newpop.psv
+#        gdb /home/hebisch/poplog/v15.61-amd64/pop/pop/corepop
 else
-	corepop +$popsys/newpop.psv "$@"
+#	echo corepop +$popsys/newpop.psv "$@"
+        corepop +$popsys/newpop.psv "$@"
+#        gdb /home/hebisch/poplog/v15.61-amd64/pop/pop/corepop
 fi
 
 # --- Revision History ---------------------------------------------------
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/setpop.p v15.6301-amd64/pop/src/setpop.p
--- pp0/v15.61-amd64/pop/src/setpop.p	2000-01-06 06:58:07.000000000 -0500
+++ v15.6301-amd64/pop/src/setpop.p	2009-12-27 11:03:55.000000000 -0500
@@ -43,6 +43,7 @@
 		Vms_jpi_string, Vms_jpi_int, Vms_get_image_name,
 		Io$-Cons_device, Io$-Get_char, Io$-Rms_parse, Io$-Rms_search,
 		Io$-Cons_stddev, Explode_substring,
+                dummy_procedure_callback_helper,
 		),
 		image_version
 	;
@@ -73,7 +74,8 @@
 				poppid, popusername, popdirectory, popheader,
 				pop_runtime, pop_runtime_actions,
 				pop_first_setpop, pop_nobanner, pop_noinit, popunderx,
-				setpop
+				setpop,
+              dummy_procedure_callback_helper
 			;
 
 constant
@@ -892,6 +894,7 @@
 enddefine;		/* Setup_system */
 
 define lvars Setpop_setup_system();
+        Get_mem_break() -> _user_base;
 	chain(_nextframe(_caller_sp_flush()), _0, Setup_system)
 enddefine;
 
@@ -923,6 +926,11 @@
 	sysexit()
 enddefine;
 
+define dummy_procedure_callback_helper();
+   lvars _dummy1 = 666, _dummy2 = 42;
+   _extern printf('%d, %d\n', _dummy1, _dummy2);
+enddefine;
+
 endsection;		/* $-Sys */
 
 
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/sys_file_stat.p v15.6301-amd64/pop/src/sys_file_stat.p
--- pp0/v15.61-amd64/pop/src/sys_file_stat.p	2005-03-11 13:56:39.000000000 -0500
+++ v15.6301-amd64/pop/src/sys_file_stat.p	2009-12-24 15:34:16.000000000 -0500
@@ -1,4 +1,4 @@
-/* --- Copyright University of Sussex 2005. All rights reserved. ----------
+/* --- Copyright University of Sussex 1997. All rights reserved. ----------
  > File:            C.unix/src/sys_file_stat.p
  > Purpose:			sys_file_stat	(unix)
  > Author:          John Gibson (see revisions)
@@ -112,8 +112,6 @@
 
 
 /* --- Revision History ---------------------------------------------------
---- Aaron Sloman, Mar 11 2005
-		changes for AMD64 poplog
 --- John Gibson, Mar 20 1999
 		Changes to fix x86 Linux "dev_t" type problem
 --- John Gibson, Mar  8 1997
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/sys_real_time.p v15.6301-amd64/pop/src/sys_real_time.p
--- pp0/v15.61-amd64/pop/src/sys_real_time.p	1995-06-30 12:19:46.000000000 -0400
+++ v15.6301-amd64/pop/src/sys_real_time.p	2009-12-29 23:55:34.000000000 -0500
@@ -14,7 +14,7 @@
 
 ;;; -------------------------------------------------------------------
 
-section $-Sys => sys_real_time;
+section $-Sys => sys_real_time, sys_microtime;
 
 	/*	Time in seconds since midnight 1 Jan 1970 GMT
 	*/
@@ -28,6 +28,16 @@
 #_ENDIF
 enddefine;
 
+define sys_microtime();
+#_IF DEFV BERKELEY >= 4.2
+    lstackmem struct TIMEVAL _tvp;
+    _extern gettimeofday(_tvp, _NULL) -> ;
+    Sint_->_pint(_tvp!TIM_SEC)*1000000 + Sint_->_pint(_tvp!TIM_USEC)
+#_ELSE
+    Sint_->_pint(_extern time(_NULL))*1000000
+#_ENDIF
+enddefine;
+
 endsection;
 
 
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/syscomp/genproc.p v15.6301-amd64/pop/src/syscomp/genproc.p
--- pp0/v15.61-amd64/pop/src/syscomp/genproc.p	2005-03-11 05:30:40.000000000 -0500
+++ v15.6301-amd64/pop/src/syscomp/genproc.p	2010-01-03 07:29:42.000000000 -0500
@@ -132,6 +132,18 @@
 
 ;;; === REGISTER USAGE ================================================
 
+/*
+   rax - work                rcx - work
+   rdx - chain               rbx - pop user stack
+   rsp - stack               rbp - base
+   rsi - work                rdi - work
+   r8  - non pop lvar        r9  - helper for immediate constants
+   r10 - non pop lvar        r11 - non pop lvar
+   r12 - non pop lvar        r13 - pop lvar
+   r14 - pop lvar            r15 - pop lvar
+
+*/
+
 lconstant
 
 	;;; 80x86 register names and their usage
@@ -194,8 +206,18 @@
 	;;;	Lists of pop/non-pop registers for register locals
 	;;; (none on this machine)
 
-	pop_registers = [[]],
-	nonpop_registers = [[]],
+/*
+        pop_registers = [[] 13 14 15],
+	nonpop_registers = [[] 8 10 11 12],
+
+        pop_registers = [[]],
+
+        nonpop_registers = [[]],
+*/
+        pop_registers = [[]],
+        nonpop_registers = [[] 8 10 11 12],
+/*       nonpop_registers = [[] 8 12], */
+
 ;
 
 ;;; regnumber:
@@ -231,6 +253,39 @@
 	])
 enddefine;
 
+define int_reglabel = newassoc([]); enddefine;
+
+define word_reglabel = newassoc([]); enddefine;
+
+define byte_reglabel = newassoc([]); enddefine;
+
+procedure();
+        lvars n, l, li, lw, lb;
+        for n from 0 to 7 do
+            reglabel(n) -> l;
+            consword(`e`, l(2), l(3), 3) -> li;
+            allbutfirst(1, l) -> lw;
+            if n < 4 then
+                consword(lw(1), `l`, 2)
+            else
+                consword(lw(1), lw(2), `l`, 3)
+            endif -> lb;
+            li ->  int_reglabel(n);
+            lw -> word_reglabel(n);
+            lb -> byte_reglabel(n);
+        endfor;
+        for n from 8 to 15 do
+                consword('r' >< n) -> l;
+                consword('r' >< n >< 'd') -> li;
+                consword('r' >< n >< 'w') -> lw;
+                consword('r' >< n >< 'b') -> lb;
+                n -> regnumber(l);
+                l -> reglabel(n);
+                li -> int_reglabel(n);
+                lw -> word_reglabel(n);
+                lb -> byte_reglabel(n);
+        endfor
+endprocedure();
 
 ;;; Local register operands:
 
@@ -603,7 +658,8 @@
         adjust(opd, INT_OFFS) -> opd;
         if isreg(opd) then
                 ;;; replace with 32-bit register name
-                consword(`e`, opd(2), opd(3), 3) -> opd;
+                int_reglabel(regnumber(opd)) -> opd;
+                ;;; consword(`e`, opd(2), opd(3), 3) -> opd;
 #_IF DEF MASM
         elseif ismem(opd) then
                 consTypedOperand("dword", opd) -> opd;
@@ -617,7 +673,8 @@
 	adjust(opd, SHORT_OFFS) -> opd;
 	if isreg(opd) then
 		;;; replace with 16-bit register name
-		allbutfirst(1, opd) -> opd;
+		;;; allbutfirst(1, opd) -> opd;
+                word_reglabel(regnumber(opd)) -> opd;
 #_IF DEF MASM
 	elseif ismem(opd) then
 		consTypedOperand("word", opd) -> opd;
@@ -630,10 +687,13 @@
 	adjust(opd, BYTE_OFFS) -> opd;
 	if isreg(opd) then
 		;;; replace with 8-bit register name (if allowed)
+/*
 		unless regnumber(opd) < 4 then
 			mishap(opd, 1, 'ILLEGAL 8-BIT REGISTER NAME');
 		endunless;
 		consword(opd(2), `l`, 2) -> opd;
+*/
+                byte_reglabel(regnumber(opd)) -> opd;
 #_IF DEF MASM
 	elseif ismem(opd) then
 		consTypedOperand("byte", opd) -> opd;
@@ -994,7 +1054,7 @@
 define lconstant gen_move_from_l(asm_op);
 	lvars asm_op, (, src, dst) = explode(m_instr);
 	if ismem(src)
-	or isreg(src) and asm_op == asmMOVB and regnumber(src) fi_>= 4
+	;;; or isreg(src) and asm_op == asmMOVB and regnumber(src) fi_>= 4
 	then
 		asmMOVL(src, EAX ->> src);
 	endif;
@@ -1740,7 +1800,9 @@
 
 	dlocal_labs,
 		;;; Names of dynamic local variables
+        regmask,
 	Nstkvars,
+        Nregs,
 		;;; Number of on-stack vars
 ;
 
@@ -1750,17 +1812,32 @@
 
 define M_CREATE_SF();
 	lconstant popint_zero = popint(0);
-	lvars reg_spec_id, Npopstkvars, reg_locals;
+	lvars reg_spec_id, Npopregs, Npopstkvars, reg_locals, n;
 
 	explode(m_instr) -> reg_spec_id -> dlocal_labs -> Npopstkvars
-		-> Nstkvars -> /* Npopregs */ -> reg_locals -> ;
+		-> Nstkvars -> Npopregs -> reg_locals -> ;
 
+/*
 	;;; Check there are no register locals and set the register spec to zero
 	unless null(reg_locals) then
 		mishap(reg_locals, 1, 'UNEXPECTED REGISTER LOCALS');
 	endunless;
+*/
 	0 -> idval(reg_spec_id);
 
+        listlength(reg_locals) -> Nregs;
+
+        ;;; create register mask from reg locals
+        0 -> regmask;
+        fast_for n in reg_locals do regmask || (1 << n) -> regmask endfast_for;
+
+        ;;; Save registers
+        for n from 8 to 15 do
+            if regmask &&/=_0 (1 << n) then
+                asmPUSHL(reglabel(n));
+            endif;
+        endfor;
+
 	;;; Set the procedure base register
 	asmMOVL(immrep(current_pdr_label), PB);
 	;;; Push dynamic locals
@@ -1779,10 +1856,19 @@
 ;;;		plant code to unwind a procedure stack frame
 
 define M_UNWIND_SF();
+        lvars n;
 	;;; Remove owner address and on-stack vars (POP and non-POP)
 	asmADDL((Nstkvars + 1) * 8, SP);
 	;;; Pop dynamic locals
 	applist(rev(dlocal_labs), asmPOPL);
+        ;;; restore registers
+
+        for n from 15 by -1 to 8 do
+            if regmask &&/=_0 (1 << n) then
+                asmPOPL(reglabel(n));
+            endif;
+        endfor;
+
 	;;; Restore procedure base register from previous owner address
 	asmMOVL({^SP 8}, PB);
 enddefine;
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/syscomp/m_trans.p v15.6301-amd64/pop/src/syscomp/m_trans.p
--- pp0/v15.61-amd64/pop/src/syscomp/m_trans.p	1998-03-25 09:22:57.000000000 -0500
+++ v15.6301-amd64/pop/src/syscomp/m_trans.p	2009-12-24 15:33:20.000000000 -0500
@@ -2094,7 +2094,7 @@
 	endunless;
 #_ENDIF
 
-	if pd_frame_len > 16:FF then
+	if pd_frame_len > MAX_STACK_FRAME_SIZE then
 		mishap(p, 1, 'PROCEDURE STACK FRAME TOO LARGE (too many lvars)')
 	endif;
 
@@ -2181,8 +2181,19 @@
 				2);
 
 	asm_outshort(reg_spec, 1);				;;; PD_REGMASK
-
-	asm_outbyte(
+#_IF DEF FRAME_LEN_16BIT
+        asm_outshort(0, 1);
+        asm_outshort
+#_ELSE
+#_IF DEF FRAME_LEN_32BIT
+        asm_outshort(0, 1);
+        asm_outint(0, 1);
+        asm_outint
+#_ELSE
+        asm_outbyte
+#_ENDIF
+#_ENDIF
+	(
 			;;; stack frame length in words
 			pd_frame_len,					;;; PD_FRAME_LEN
 			;;; see above
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/syscomp/mcdata.p v15.6301-amd64/pop/src/syscomp/mcdata.p
--- pp0/v15.61-amd64/pop/src/syscomp/mcdata.p	1995-08-24 13:17:32.000000000 -0400
+++ v15.6301-amd64/pop/src/syscomp/mcdata.p	2009-12-24 15:32:59.000000000 -0500
@@ -107,6 +107,15 @@
 endsection;		/* $- */
 
 
+constant macro MAX_STACK_FRAME_SIZE =
+  #_IF DEF FRAME_LEN_16BIT 
+          16:FFFF
+  #_ELSEIF DEF FRAME_LEN_32BIT
+          16:FFFFFFFF
+  #_ELSE
+          16:FF
+  #_ENDIF;
+
 section $-Popas;
 
 constant macro (
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/syscomp/os_comms.p v15.6301-amd64/pop/src/syscomp/os_comms.p
--- pp0/v15.61-amd64/pop/src/syscomp/os_comms.p	2008-06-05 09:45:12.000000000 -0400
+++ v15.6301-amd64/pop/src/syscomp/os_comms.p	2009-12-24 15:48:52.000000000 -0500
@@ -1,4 +1,4 @@
-/* --- Copyright University of Sussex 2008. All rights reserved. ----------
+/* --- Copyright University of Sussex 1999. All rights reserved. ----------
  > File:			C.unix/src/syscomp/os_comms.p
  > Purpose:
  > Author:			John Gibson (see revisions)
@@ -120,23 +120,12 @@
 	if exlink then
 				out_obj_files(wobj_files)
 	else
-
-		;;; Altered by A.S. to produce a 'sh' file. 4 Jan 2005
-		;;; Altered by A.S. to produce a 'bash' file. 10 Sep 2007
-		;;; asmf_pr('#!/bin/csh -f\n');
-		;;; asmf_pr('#!/bin/sh\n');
-		asmf_pr('#!/bin/bash\n');
-
-		;;; asmf_printf(image_name, 'set IM=$1; if $IM == "" set IM=%p\n');
-		asmf_printf(image_name, 'IM=$1\n if [ ! ${IM} ]; then IM=%p ; fi\n');
+		asmf_pr('#!/bin/sh\n');
+		asmf_printf(image_name, 'IM=$1\nIM=${IM:-%p}\n');
 
 #_IF DEF cc_link_command_header
 		;;; Using C compiler to link (uses $POP__cc as command)
-		;;; asmf_pr('if ! $?POP__cc set POP__cc=cc\n');
-		asmf_pr('if [ ! ${POP__cc} ]; then POP__cc=cc; fi\n');
-
-		;;; shell-neutral bits follow.
-
+		asmf_pr('POP__cc=${POP__cc:-cc}\n');
 		asmf_pr(cc_link_command_header);
 		for f in link_flags do asmf_printf(f, '-Wl,%p \\\n') endfor;
 				out_obj_files(wobj_files);
@@ -190,13 +179,11 @@
 		endif);
 
 	unless exlink then
-		;;; asmf_pr('set ST = $status\n');
-		asmf_pr('ST=$status\n');
+		asmf_pr('ST=$?\n');
 
 		if cleanup_command then asmf_printf(cleanup_command, '%p\n') endif;
 		if makebase then
-			;;; asmf_pr('if ($ST == 0) rm -f $IM.stb\n')
-			asmf_pr('if [[ $ST == 0 ]]; then rm -f $IM.stb ; fi\n')
+			asmf_pr('if [ $ST == 0 ] ; then rm -f $IM.stb ; fi\n')
 		endif;
 		asmf_pr('exit $ST\n')
 	endunless;
@@ -322,113 +309,97 @@
 
 
 /* --- Revision History ---------------------------------------------------
---- Aaron Sloman, 5 Jun 2008
-		Altered to create a bash script header instead of sh for $popsys/poplink_cmnd
-		(Copied from 32 bit version)
---- Aaron Sloman and Waldek Hebisch 11 Mar 2005
-		Patched for AMD64
---- Aaron Sloman, Jan  4 2005
-        Changed gen_link_command to produce a version of $popsys/poplink_cmnd
-        that uses 'sh' syntax rather than 'csh', because not all linux systems
-        now come with csh or tcsh installed, which prevents re-linking.
---- Aaron Sloman, Dec 31 2004
-        Altered gen_link_command so that if motif is included it uses a link to
-        the appropriate file is made in
-            $popexternlib/libXm.so
-        e.g. in case there is not a libXm.so link in /usr/X11R6/lib
-        This requires the installation scripts to insert the link in
-        $popexternlib
 --- John Gibson, Apr  9 1999
-        Made out_obj_files convert -R<dirname> to appropriate -rpath args
-        for Linux
+		Made out_obj_files convert -R<dirname> to appropriate -rpath args
+		for Linux
 --- Julian Clinton, Aug  7 1998
-        Add '-lmw' for NCR.
+		Add '-lmw' for NCR.
 --- Robert Duncan, Jul  2 1998
-        Allowed for extra libraries in HP-UX link command
+		Allowed for extra libraries in HP-UX link command
 --- Robert Duncan, Jun 05 1998
-        Added libgen to link command for DG/UX (used at least by libXm)
+		Added libgen to link command for DG/UX (used at least by libXm)
 --- Robert Duncan, Aug 13 1996
-        Added libgen to link command for NCR (used at least by libXm)
+		Added libgen to link command for NCR (used at least by libXm)
 --- John Gibson, Dec  7 1995
-        Now allows env vars POP__as, POP__ar and POP__crt0 (if set) to
-        override AS_CMD, AR_CMD and unix_ld_crt_objects
+		Now allows env vars POP__as, POP__ar and POP__crt0 (if set) to
+		override AS_CMD, AR_CMD and unix_ld_crt_objects
 --- John Gibson, Mar 10 1995
-        OSF changes
+		OSF changes
 --- Poplog System, Jan 18 1995 (Julian Clinton)
-        Set options for Linux and SCO Open Desktop 3.0.
+		Set options for Linux and SCO Open Desktop 3.0.
 --- Robert John Duncan, Mar 21 1994
-        Changes for SG IRIX 5+
+		Changes for SG IRIX 5+
 --- John Gibson, Nov 19 1993
-        Changed gen_link_command to take ______exlink arg to say just produce
-        file containing object/library args
+		Changed gen_link_command to take ______exlink arg to say just produce
+		file containing object/library args
 --- John Gibson, Nov 13 1993
-        -lpop now the only pop library in link command
+		-lpop now the only pop library in link command
 --- John Gibson, Aug 30 1993
-        Replaced run*_poplink with run_comp_util
+		Replaced run*_poplink with run_comp_util
 --- John Gibson, Jul 10 1993
-        Added ________makebase argument to gen_link_command and assemble_and_link
+		Added ________makebase argument to gen_link_command and assemble_and_link
 --- Robert John Duncan, Jun 11 1993
-        Changed gen_link_command to write out explicit references to the pop
-        external libraries using the '-L' and '-l' options to ld and made it
-        take an additional argument -- _____________extern_libdir -- which is the
-        directory containing the libraries as determined by poplink. This is
-        necessary when the libraries are shared, because they may not be in
-        the same directory when the image is run.
-        Also tidied up references to the crt*.o files -- their location can
-        now be specified by defining unix_ld_crt_objects in "asmout.p".
+		Changed gen_link_command to write out explicit references to the pop
+		external libraries using the '-L' and '-l' options to ld and made it
+		take an additional argument -- _____________extern_libdir -- which is the
+		directory containing the libraries as determined by poplink. This is
+		necessary when the libraries are shared, because they may not be in
+		the same directory when the image is run.
+		Also tidied up references to the crt*.o files -- their location can
+		now be specified by defining unix_ld_crt_objects in "asmout.p".
 --- Simon Nichols, Jun  2 1993
-        Removed addition of -ldl/-ldld to link command -- now done with
-        a dummy exload in src/unixextern.p.
+		Removed addition of -ldl/-ldld to link command -- now done with
+		a dummy exload in src/unixextern.p.
 --- Robert John Duncan, Jun  2 1993
-        Changes for SVR4
+		Changes for SVR4
 --- John Gibson, May 23 1993
-        Removed addition of -lt*ermcap to link command -- now done with
-        a dummy exload in src/termcap.p.
+		Removed addition of -lt*ermcap to link command -- now done with
+		a dummy exload in src/termcap.p.
 --- John Gibson, May 14 1993
-        Added _______________cleanup_command arg to gen_link_command
+		Added _______________cleanup_command arg to gen_link_command
 --- John Gibson, May  6 1993
-        Removed addition of c_c*ore.obj from gen_link_command -- this is
-        now part of $popexternlib/libpop.olb.
+		Removed addition of c_c*ore.obj from gen_link_command -- this is
+		now part of $popexternlib/libpop.olb.
 --- Simon Nichols, Mar  2 1993
-        Changed location of crt?.o in Solaris 2.1
+		Changed location of crt?.o in Solaris 2.1
 --- Simon Nichols, Jan 29 1993
-        Changed name of conditional compilation flag SU*NOS_DYNAMIC to
-        SHARED_LIBRARIES, as it's more descriptive and not SunOS specific.
-        Added support for shared libraries on HP-UX.
+		Changed name of conditional compilation flag SU*NOS_DYNAMIC to
+		SHARED_LIBRARIES, as it's more descriptive and not SunOS specific.
+		Added support for shared libraries on HP-UX.
 --- John Gibson, Oct 20 1992
-        Changed os_library_command to hash-encode module names longer
-        than 14 chars
+		Changed os_library_command to hash-encode module names longer
+		than 14 chars
 --- Robert John Duncan, Jul 24 1992
-        Changed location of commands for SunOS 5.0 and the list of
-        libraries to be given to ld
+		Changed location of commands for SunOS 5.0 and the list of
+		libraries to be given to ld
 --- Robert John Duncan, Jul 21 1992
-        Added SYSTEM_V to list of systems which don't need ranlib
+		Added SYSTEM_V to list of systems which don't need ranlib
 --- Simon Nichols, Mar  3 1992
-        Changes to support SunOS dynamic linking (temporarily flagged by
-        SU*NOS_DYNAMIC).
+		Changes to support SunOS dynamic linking (temporarily flagged by
+		SU*NOS_DYNAMIC).
 --- Robert John Duncan, Jun 24 1991
-        Added code for SG IRIX
+		Added code for SG IRIX
 --- John Gibson, Jan 21 1991
-        Added -share- arg to -gen_link_command-
+		Added -share- arg to -gen_link_command-
 --- John Gibson, Nov 22 1990
-        Changed malloc.o to c_c*ore.obj
+		Changed malloc.o to c_c*ore.obj
 --- John Gibson, Nov 22 1990
 --- John Gibson, Sep 27 1990
-        Replaced calls of -interrupt- with mishaps
+		Replaced calls of -interrupt- with mishaps
 --- Rob Duncan, May 31 1990
-        Added non-standard run-time library for DECSTATION
+		Added non-standard run-time library for DECSTATION
 --- John Gibson, May 10 1990
-        Made $popsrc/malloc.o be systranslated (so it gets current
-        value of $popsrc).
+		Made $popsrc/malloc.o be systranslated (so it gets current
+		value of $popsrc).
 --- Rob Duncan, May  8 1990
-        Added patch for MIPS and funny runtime libraries for MIPS/RISCOS
+		Added patch for MIPS and funny runtime libraries for MIPS/RISCOS
 --- Rob Duncan, Nov  7 1989
-        Added t*ermcap library ('-lt*ermcap') to end of link command
+		Added t*ermcap library ('-lt*ermcap') to end of link command
 --- John Gibson, Aug  4 1989
-        Version 13.66+
+		Version 13.66+
 --- John Gibson, Jul 24 1989
-        -os_library_command- moved here from poplibr_main.p
+		-os_library_command- moved here from poplibr_main.p
 --- John Gibson, Jul 17 1989
-        Extracted from Unix versions of asmout.p
-        Added -run*_poplink-
+		Extracted from Unix versions of asmout.p
+		Added -run*_poplink-
  */
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/syscomp/symdefs.p v15.6301-amd64/pop/src/syscomp/symdefs.p
--- pp0/v15.61-amd64/pop/src/syscomp/symdefs.p	1997-03-05 10:35:08.000000000 -0500
+++ v15.6301-amd64/pop/src/syscomp/symdefs.p	2009-12-24 15:32:15.000000000 -0500
@@ -131,6 +131,26 @@
 	word	K_END_V[0];			;;; dummy field to get word length of key
   };
 
+#_IF DEF FRAME_LEN_16BIT
+deftype
+  stk_off_t = short;
+constant macro PD_FRAME_SPARE = [ short PD_FRAME_SPARE_S ; ] ;
+#_ELSE
+#_IF DEF FRAME_LEN_32BIT
+deftype
+  stk_off_t = int;
+constant macro PD_FRAME_SPARE = [ 
+        short PD_FRAME_SPARE_S ;
+        int PD_FRAME_SPARE_I;
+] ;
+#_ELSE 
+deftype
+  stk_off_t = byte;
+constant macro PD_FRAME_SPARE = [] ;
+#_ENDIF
+#_ENDIF
+
+
 
 constant macro (
 	;;; start of all procedures
@@ -150,7 +170,8 @@
 		byte	PD_FLAGS2,			;;; second flags byte
 				PD_SPARE;			;;; currently unused
 		short	PD_REGMASK;			;;; mask for register locals
-		byte	PD_FRAME_LEN,		;;; total size of stack frame in words
+                PD_FRAME_SPARE
+		stk_off_t	PD_FRAME_LEN,		;;; total size of stack frame in words
 				PD_GC_OFFSET_LEN,	;;; word index from frame pointer to lowest addr lword for gc scan
 				PD_GC_SCAN_LEN,		;;; no of stack frame words for gc scan
 				PD_NUM_STK_VARS,	;;; no of stack allocated locals
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/syscomp/sysdefs.p v15.6301-amd64/pop/src/syscomp/sysdefs.p
--- pp0/v15.61-amd64/pop/src/syscomp/sysdefs.p	2005-03-13 04:58:29.000000000 -0500
+++ v15.6301-amd64/pop/src/syscomp/sysdefs.p	2009-12-26 11:41:20.000000000 -0500
@@ -45,6 +45,8 @@
 	CODE_POINTER_TYPE = "byte",	;;; type of pointer to machine code
 	BIT_POINTER_TYPE = "byte",	;;; type of pointer for bitfield access
 
+        ;;; FRAME_LEN_32BIT = true,
+
 
 ;;; === OPERATING SYSTEM (UNIX BSD) ==================================
 
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/syscomp/w_util.p v15.6301-amd64/pop/src/syscomp/w_util.p
--- pp0/v15.61-amd64/pop/src/syscomp/w_util.p	1995-11-10 09:15:14.000000000 -0500
+++ v15.6301-amd64/pop/src/syscomp/w_util.p	2009-12-30 14:27:21.000000000 -0500
@@ -179,7 +179,7 @@
 	*/
 define word_dict_cell(word);
 	lvars string = fast_word_string(word), len = datalength(string), word;
-
+#_IF false
 	if len fi_> 2 then
 		;;; use first, middle and last chars and length
 		f_subs(1,string) fi_+ len
@@ -195,7 +195,29 @@
 	else
 		0
 	endif -> len;
-	(len fi_&& 16:3FF) fi_+ 1
+#_ELSE
+    lvars res = len, i = 1;
+    while len fi_> 3 do
+        (f_subs(i, string) fi_+ (f_subs(i fi_+ 1, string) fi_<< 8) 
+           fi_+ (f_subs(i fi_+ 2, string) fi_<< 16))
+           + (f_subs(i fi_+ 3, string) << 24) + res -> res;
+        len fi_- 4 -> len;
+        i fi_+ 4 -> i;
+    endwhile;
+    if len == 3 then
+        (f_subs(i, string) fi_+ (f_subs(i fi_+ 1, string) fi_<< 8) 
+           fi_+ (f_subs(i fi_+ 2, string) fi_<< 16))
+             + res -> res;
+    elseif len == 2 then
+        (f_subs(i, string) fi_+ (f_subs(i fi_+ 1, string) fi_<< 8))
+             +  res -> res;
+    elseif len == 1 then
+        f_subs(i, string) + res -> res;
+    endif;
+    ;;; Mix bits
+    ((res && 16:FFFE0000) >> 17) ||/& res -> res;
+#_ENDIF
+    (res && 16:3FF) fi_+ 1
 enddefine;
 
 define path_index_cell(pathstr, word);
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/termcap.p v15.6301-amd64/pop/src/termcap.p
--- pp0/v15.61-amd64/pop/src/termcap.p	2005-03-13 18:49:05.000000000 -0500
+++ v15.6301-amd64/pop/src/termcap.p	2009-12-24 15:31:23.000000000 -0500
@@ -1,4 +1,4 @@
-/* --- Copyright University of Sussex 2005. All rights reserved. ----------
+/* --- Copyright University of Sussex 1998. All rights reserved. ----------
  > File:            C.unix/src/termcap.p
  > Purpose:         Simple interface to C termcap library
  > Author:          Rob Duncan, Apr 11 1989 (see revisions)
@@ -11,8 +11,6 @@
 	*/
 #_TERMIN_IF DEF NCR
 
-/* Too many problems with termcap on linux systems. */
-/* But include the rest of this for now, for ncurses */
 #_TERMIN_IF false
 
 #_INCLUDE 'declare.ph'
@@ -600,14 +598,6 @@
 
 
 /* --- Revision History ---------------------------------------------------
---- Aaron Sloman, Mar 13 2005
-		Reinstated
-			 #_TERMIN_IF false
-		to enable Waldek's changes to operate
-		(for ncurses)
---- Aaron Sloman, Mar 13 2005
-		Reinstated this for AMD64 poplog
-			 #_TERMIN_IF DEF LINUX
 --- John Gibson, Mar 26 1998
 		Set -lcurses for AIX
 --- Robert Duncan, Aug 14 1997
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/unixdefs.ph v15.6301-amd64/pop/src/unixdefs.ph
--- pp0/v15.61-amd64/pop/src/unixdefs.ph	2005-03-11 13:59:38.000000000 -0500
+++ v15.6301-amd64/pop/src/unixdefs.ph	2009-12-24 15:31:05.000000000 -0500
@@ -1,4 +1,4 @@
-/* --- Copyright University of Sussex 2005. All rights reserved. ----------
+/* --- Copyright University of Sussex 1999. All rights reserved. ----------
  > File:			C.unix/src/unixdefs.ph
  > Purpose:
  > Author:			John Gibson (see revisions)
@@ -52,7 +52,6 @@
 	dev_t	= double,
 	ino_t	= long,
 	mode_t	= int,
-;;;	nlink_t	= int,
 	nlink_t	= long,
 	time_t	= -long,
 	uid_t	= int,
@@ -640,8 +639,6 @@
 
 
 /* --- Revision History ---------------------------------------------------
---- Aaron Sloman, Mar 11 2005
-		Changed for AMD64
 --- John Gibson, Apr  9 1999
 		Replaced test ALPHA_LINUX or (X86_LINUX and LIN*UX_GLI*BC) with
 		DEFV LINUX >= 2.0
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/vec_generic.p v15.6301-amd64/pop/src/vec_generic.p
--- pp0/v15.61-amd64/pop/src/vec_generic.p	1997-02-12 12:29:00.000000000 -0500
+++ v15.6301-amd64/pop/src/vec_generic.p	2009-12-30 14:59:15.000000000 -0500
@@ -44,8 +44,26 @@
 enddefine;
 
 define Byte_hash(_cptr, _len);
+#_IF false
 	lvars _len, _cptr;
 	CHAR_HASH(b)
+#_ELSE
+    lvars _res = _len;
+    while _len _sgr _3 do
+        _cptr!(i) _add _res -> _res;
+        _len _add _-4 -> _len;
+        _cptr _add _4 -> _cptr;
+    endwhile;
+    if _len == _3 then
+        (_cptr!(i) _bimask _16:FFFFFF) _add _res -> _res;
+    elseif _len == _2 then
+        _cptr!(s) _add _res -> _res;
+    elseif _len == _1 then
+        _cptr!(b)[_0] _add _res -> _res;
+    endif;
+   ;;; Mix bits
+   _shift(_res _bimask _16:FFFE0000, _-17) _bixor _res
+#_ENDIF
 enddefine;
 
 define Short_hash(_cptr, _len);
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/src/vm_conspdr.p v15.6301-amd64/pop/src/vm_conspdr.p
--- pp0/v15.61-amd64/pop/src/vm_conspdr.p	2005-02-12 15:05:49.000000000 -0500
+++ v15.6301-amd64/pop/src/vm_conspdr.p	2009-12-27 00:36:41.000000000 -0500
@@ -1,4 +1,4 @@
-/* --- Copyright University of Sussex 2005. All rights reserved. ----------
+/* --- Copyright University of Sussex 2003. All rights reserved. ----------
  > File:            C.all/src/vm_conspdr.p
  > Purpose:
  > Author:          John Gibson, Mar 11 1988 (see revisions)
@@ -387,6 +387,9 @@
 	enduntil;
 	instr!INST_OP -> _op;
 	if _op == I_NOT then
+                ;;; Check for double negation, we could do better but
+                ;;; this is very rare.
+                returnif(is_not)(false);
 		Optimise_clist_tl(next_clist, true)
 	else
 		if IS_UNOPT_JUMP(_op) ->> _op then
@@ -1176,11 +1179,10 @@
 	endif;
 
 	Incr_lab_refcount(asm_exit_lab);
-	;;; check proposed by Waldek Hebisch
-	if _Nframewords _gr _16:FF then
-		mishap(0, 'PROCEDURE STACK FRAME TOO LARGE (too many lvars?)');
-	endif;
 
+        if _Nframewords _gr _:MAX_STACK_FRAME_SIZE then
+          mishap(0, 'PROCEDURE STACK FRAME TOO LARGE (too many lvars?)');
+        endif;
 	;;; first instruction creates stack frame on entry
 	Cons_inst(I_CREATE_SF, 1) :: codelist -> codelist;
 
@@ -1235,8 +1237,6 @@
 
 
 /* --- Revision History ---------------------------------------------------
---- Aaron Sloman, Feb 12 2005
-		Check for stack frame limit exceeded suggested by Waldek Hebisch
 --- David Young, Oct  8 2003
         Fixed bug in Optimise_conditions which caused a sequence of I_NOTs
         followed by an I_GOTO to be incorrectly ignored. This was
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/ved/src/vdfiles.p v15.6301-amd64/pop/ved/src/vdfiles.p
--- pp0/v15.61-amd64/pop/ved/src/vdfiles.p	2008-06-05 09:55:33.000000000 -0400
+++ v15.6301-amd64/pop/ved/src/vdfiles.p	2008-02-06 18:06:20.000000000 -0500
@@ -710,7 +710,6 @@
 #_ELSE
 				sysfileok(file) -> file;
 				current_directory -> dir;
-				;;; datalength(dir) fi_+ datalength(file) -> totlen;
 				datalength(dir) fi_+ 1 fi_+ datalength(file) -> totlen;
 				fast_for tempfile in vedbufferlist do
 					fast_subscrv(VF_PATHNAME,tempfile) -> vfname;
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/ved/src/vdwindows.p v15.6301-amd64/pop/ved/src/vdwindows.p
--- pp0/v15.61-amd64/pop/ved/src/vdwindows.p	2005-03-11 21:06:41.000000000 -0500
+++ v15.6301-amd64/pop/ved/src/vdwindows.p	1999-07-12 14:08:41.000000000 -0400
@@ -1,4 +1,4 @@
-/* --- Copyright University of Sussex 2005.  All rights reserved. ---------
+/* --- Copyright University of Sussex 1997.  All rights reserved. ---------
  > File:        C.all/ved/src/vdwindows.p
  > Purpose:     Manipulating windows on screen
  > Author:      Aaron Sloman & John Gibson (see revisions)
@@ -94,8 +94,8 @@
 ;;;     of ratios.
 
 lvars
-	startwindow_size    = 18,
-	startwindow_base    = 36,
+	startwindow_size    = 12,
+	startwindow_base    = 24,
 ;
 
 /*
@@ -758,7 +758,7 @@
 		vederror('\{b}only editing one file');
 	endif;
 
-	syssleep(40);
+	syssleep(40);	;;; Added by A.Sloman 12 Jul 1999
 
 	if vedinputwaiting() then
 		;;; don't display message if char is waiting
@@ -897,13 +897,9 @@
 
 
 /* --- Revision History ---------------------------------------------------
---- Aaron Sloman, Mar 12 2005
-		Changed these two
-			startwindow_size    = 18,
-			startwindow_base    = 36,
 --- Aaron Sloman, 12 Jul 1999
-		Removed spurious "true" in call of vedputmessage in vedfileselect
-		added syssleep
+		Removed spurious true in call to vedputmessage, and added
+		syssleep in vedfileselect.
 --- John Gibson, Aug 15 1997
 		Changes for XVed variable-width mode
 --- John Gibson, May  2 1997
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/x/pop/lib/Xm/xmTextFieldWidget.p v15.6301-amd64/pop/x/pop/lib/Xm/xmTextFieldWidget.p
--- pp0/v15.61-amd64/pop/x/pop/lib/Xm/xmTextFieldWidget.p	2005-02-23 16:01:51.000000000 -0500
+++ v15.6301-amd64/pop/x/pop/lib/Xm/xmTextFieldWidget.p	2009-12-24 16:14:31.000000000 -0500
@@ -1,4 +1,4 @@
-/* --- Copyright University of Sussex 2005. All rights reserved. ----------
+/* --- Copyright University of Sussex 1999. All rights reserved. ----------
  > File:			C.x/x/pop/lib/Xm/xmTextFieldWidget.p
  > Purpose:			Motif widgetclass
  > Author:			John Gibson, Apr 14 1993 (see revisions)
@@ -55,8 +55,10 @@
 	XmTextFieldClearSelection(widget,time) :void,
 	XmTextFieldCopy(widget,time) :XptBoolean,
 	XmTextFieldCut(widget,time) :XptBoolean,
-;;; No longer causes problem with lesstif
+;;; Now one that doesn't work with lesstif
+#_IF not(DEF LINUX)
 	XmTextFieldGetAddMode(widget) :XptBoolean,
+#_ENDIF
 	XmTextFieldGetBaseLine(widget) :int,
 	XmTextFieldGetBaseline(widget) :int,
 	XmTextFieldGetCursorPosition(widget) :XmTextPosition,
@@ -111,8 +113,6 @@
 
 
 /* --- Revision History ---------------------------------------------------
---- Aaron Sloman, Feb 23 2005
-		Undid last change, since it now works with Lesstif
 --- Aaron Sloman, Nov  6 1999
 	On Julian Clinton's advice, prevented compilation of this line
 		XmTextFieldGet*AddMode(widget) :XptBoolean,
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/x/pop/lib/Xm/xmTextWidget.p v15.6301-amd64/pop/x/pop/lib/Xm/xmTextWidget.p
--- pp0/v15.61-amd64/pop/x/pop/lib/Xm/xmTextWidget.p	2005-02-23 15:59:18.000000000 -0500
+++ v15.6301-amd64/pop/x/pop/lib/Xm/xmTextWidget.p	2010-01-03 06:49:16.000000000 -0500
@@ -1,4 +1,4 @@
-/* --- Copyright University of Sussex 2005. All rights reserved. ----------
+/* --- Copyright University of Sussex 1999. All rights reserved. ----------
  > File:			C.x/x/pop/lib/Xm/xmTextWidget.p
  > Purpose:			Motif widgetclass
  > Author:			John Gibson, Apr 14 1993 (see revisions)
@@ -58,8 +58,10 @@
 	XmTextClearSelection(widget,time) :void,
 	XmTextCopy(widget,time) :XptBoolean,
 	XmTextCut(widget,time) :XptBoolean,
-;;; No longer causes problem with lesstif
+;;; Now one that doesn't work with lesstif
+#_IF not( DEF LINUX )
 	XmTextGetAddMode(widget) :XptBoolean,
+#_ENDIF
 	XmTextGetBaseLine(widget) :int,
 	XmTextGetBaseline(widget) :int,
 	XmTextGetCursorPosition(widget) :XmTextPosition,
@@ -128,8 +130,6 @@
 
 
 /* --- Revision History ---------------------------------------------------
---- Aaron Sloman, Feb 23 2005
-		Undid last change, since it now works with Lesstif
 --- Aaron Sloman, Nov  6 1999
 	On Julian Clinton's advice, prevented compilation of this line
 		XmTextGet*AddMode(widget) :XptBoolean,
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/x/ui/lib/pop_ui_logo.p v15.6301-amd64/pop/x/ui/lib/pop_ui_logo.p
--- pp0/v15.61-amd64/pop/x/ui/lib/pop_ui_logo.p	1996-07-18 04:36:09.000000000 -0400
+++ v15.6301-amd64/pop/x/ui/lib/pop_ui_logo.p	2009-12-24 15:29:59.000000000 -0500
@@ -58,7 +58,7 @@
 	POPUIBITMAPS  dir_>< 'poplog_64.xbm', ;;; filename of xbm
 
 	sprintf(pop_internal_version / 10000.0, 'Sussex Poplog Version %p'),
-	'   Copyright \(169) 1982-1996, The University of Sussex   ',
+	'   Copyright \(169) 1982-2005, The University of Sussex   ',
 	'All Rights Reserved.',
 	'',
 	popmemused div 256 sys_>< ' Kilobytes used, ' sys_><
@@ -66,7 +66,12 @@
 	'    (editing ' sys_>< len sys_>< ' file',
 	if len ==  1 then sys_>< ')    ' else sys_>< 's)    ' endif,
 	'',
-	'Marketed under licence by:', 'Integral Solutions Ltd.',
+	'Poplog is free sftware, see:',
+        'http://www.cs.bham.ac.uk/research/poplog/freepoplog.html',
+        'and ftp://ftp.cs.bham.ac.uk/pub/dist/poplog/',
+        '',
+        'Previously marketed by:',
+        'Integral Solutions Ltd.',
 	'Berk House, Basing View',
 	'Basingstoke, Hants.',
 	'RG21 4RG, UK',
@@ -74,8 +79,6 @@
 	'Tel: +44 (0)1256 55899',
 	'Fax: +44 (0)1256 63467',
 	'',
-	'Email: isl@isl.co.uk',
-	'URL: http://www.isl.co.uk',
 	''
 	%]
 enddefine;
diff -ru --exclude=CVS --exclude='*index' --exclude=basepop11.map --exclude=ref --exclude=help --exclude=teach pp0/v15.61-amd64/pop/x/ved/src/xvedinput.p v15.6301-amd64/pop/x/ved/src/xvedinput.p
--- pp0/v15.61-amd64/pop/x/ved/src/xvedinput.p	2005-03-11 05:30:40.000000000 -0500
+++ v15.6301-amd64/pop/x/ved/src/xvedinput.p	2010-01-03 03:47:30.000000000 -0500
@@ -55,7 +55,7 @@
 
 define xved_raise_event(window, name, data);
 	lvars next_pos;
-;;; printf('xved_raise_event0\n');
+
 	if name == "userInterrupt" and vedinvedprocess then
 		;;; user interrupt bypass the event dispatching process
 #_IF DEF sys_send_signal
@@ -79,7 +79,6 @@
 		next_pos -> write_pos
 	endif;
 
-
 	returnif((ADVANCE_POS(write_pos) ->> next_pos) == read_pos);
 	;;; set input at write position
 	conspair(name, data) -> BUF_ENTRY(write_pos);
@@ -106,7 +105,7 @@
 
 define xved_raise_ascii(window, string);
 	lvars window, string, n, m, c1, next_pos;
-;;; printf('xved_raise_ascii\n');
+
 	unless window.wved_is_live_window then
 		vederror('xved_raise_ascii: not a valid window');
 	endunless;
