Commits

Volker Braun  committed 38066b7

update to gap 4.7.5

  • Participants
  • Parent commits 9eebe84

Comments (0)

Files changed (13)

 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libGAP 4.7.4.
+# Generated by GNU Autoconf 2.69 for libGAP 4.7.5.
 #
 # Report bugs to <sage-devel@googlegroups.com>.
 #
 # Identity of this package.
 PACKAGE_NAME='libGAP'
 PACKAGE_TARNAME='libgap'
-PACKAGE_VERSION='4.7.4'
-PACKAGE_STRING='libGAP 4.7.4'
+PACKAGE_VERSION='4.7.5'
+PACKAGE_STRING='libGAP 4.7.5'
 PACKAGE_BUGREPORT='sage-devel@googlegroups.com'
 PACKAGE_URL=''
 
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libGAP 4.7.4 to adapt to many kinds of systems.
+\`configure' configures libGAP 4.7.5 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libGAP 4.7.4:";;
+     short | recursive ) echo "Configuration of libGAP 4.7.5:";;
    esac
   cat <<\_ACEOF
 
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libGAP configure 4.7.4
+libGAP configure 4.7.5
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libGAP $as_me 4.7.4, which was
+It was created by libGAP $as_me 4.7.5, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
 
 # Define the identity of the package.
  PACKAGE='libgap'
- VERSION='4.7.4'
+ VERSION='4.7.5'
 
 
 cat >>confdefs.h <<_ACEOF
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libGAP $as_me 4.7.4, which was
+This file was extended by libGAP $as_me 4.7.5, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libGAP config.status 4.7.4
+libGAP config.status 4.7.5
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

File configure.ac

 AC_PREREQ([2.66])
 
 # Note: the version number must match the GAP version number
-AC_INIT([libGAP], [4.7.4], [sage-devel@googlegroups.com])
+AC_INIT([libGAP], [4.7.5], [sage-devel@googlegroups.com])
 
 AC_CANONICAL_TARGET
 AM_INIT_AUTOMAKE

File patches/gap-4.7.5.patch

+diff -urd upstream-gap-4.7.5/src/c_filt1.c src/c_filt1.c
+--- upstream-gap-4.7.5/src/c_filt1.c	2014-05-24 21:12:44.000000000 +0100
++++ src/c_filt1.c	2014-06-04 15:43:58.435707677 +0100
+@@ -1,6 +1,6 @@
+ #ifndef AVOID_PRECOMPILED
+ /* C file produced by GAC */
+-#include "src/compiled.h"
++#include "compiled.h"
+ 
+ /* global variables used in handlers */
+ static GVar G_IS__FUNCTION;
+diff -urd upstream-gap-4.7.5/src/c_meths1.c src/c_meths1.c
+--- upstream-gap-4.7.5/src/c_meths1.c	2014-05-24 21:12:44.000000000 +0100
++++ src/c_meths1.c	2014-06-04 15:43:58.436707664 +0100
+@@ -1,6 +1,6 @@
+ #ifndef AVOID_PRECOMPILED
+ /* C file produced by GAC */
+-#include "src/compiled.h"
++#include "compiled.h"
+ 
+ /* global variables used in handlers */
+ static GVar G_METHOD__0ARGS;
+Only in src: config.h
+Only in src: config.h.in
+Only in src: config.h.in~
+diff -urd upstream-gap-4.7.5/src/c_oper1.c src/c_oper1.c
+--- upstream-gap-4.7.5/src/c_oper1.c	2014-05-24 21:12:44.000000000 +0100
++++ src/c_oper1.c	2014-06-04 15:43:58.437707651 +0100
+@@ -1,6 +1,6 @@
+ #ifndef AVOID_PRECOMPILED
+ /* C file produced by GAC */
+-#include "src/compiled.h"
++#include "compiled.h"
+ 
+ /* global variables used in handlers */
+ static GVar G_REREADING;
+diff -urd upstream-gap-4.7.5/src/c_random.c src/c_random.c
+--- upstream-gap-4.7.5/src/c_random.c	2014-05-24 21:12:44.000000000 +0100
++++ src/c_random.c	2014-06-04 15:43:58.437707651 +0100
+@@ -1,6 +1,6 @@
+ #ifndef AVOID_PRECOMPILED
+ /* C file produced by GAC */
+-#include "src/compiled.h"
++#include "compiled.h"
+ 
+ /* global variables used in handlers */
+ static GVar G_QUO__INT;
+diff -urd upstream-gap-4.7.5/src/c_type1.c src/c_type1.c
+--- upstream-gap-4.7.5/src/c_type1.c	2014-05-24 21:12:44.000000000 +0100
++++ src/c_type1.c	2014-06-04 15:43:58.437707651 +0100
+@@ -1,6 +1,6 @@
+ #ifndef AVOID_PRECOMPILED
+ /* C file produced by GAC */
+-#include "src/compiled.h"
++#include "compiled.h"
+ 
+ /* global variables used in handlers */
+ static GVar G_NAME__FUNC;
+Only in src: .deps
+diff -urd upstream-gap-4.7.5/src/gap.c src/gap.c
+--- upstream-gap-4.7.5/src/gap.c	2014-05-24 21:12:44.000000000 +0100
++++ src/gap.c	2014-06-04 15:43:58.438707637 +0100
+@@ -217,17 +217,17 @@
+ #endif
+ 
+ static StructImportedGVars ImportedGVars[MAX_IMPORTED_GVARS];
+-static Int NrImportedGVars;
++Int NrImportedGVars;
+ 
+ static StructImportedGVars ImportedFuncs[MAX_IMPORTED_GVARS];
+-static Int NrImportedFuncs;
++Int NrImportedFuncs;
+ 
+ /* int restart_argc; 
+    char **restart_argv; */
+ 
+ char *original_argv0;
+ static char **sysargv;
+-static char **sysenviron;
++char **sysenviron;
+ 
+ /* 
+ syJmp_buf SyRestartBuf;
+@@ -743,11 +743,7 @@
+ }
+ #endif
+ 
+-#ifdef COMPILECYGWINDLL
+-#define main realmain
+-#endif
+-
+-int main (
++int gap_main_loop (
+           int                 argc,
+           char *              argv [],
+           char *              environ [] )
+@@ -1382,6 +1378,7 @@
+ 
+ Obj FuncJUMP_TO_CATCH( Obj self, Obj payload)
+ {
++  libgap_call_error_handler();
+   ThrownObject = payload;
+   syLongjmp(ReadJmpError, 1);
+   return 0;
+diff -urd upstream-gap-4.7.5/src/gasman.c src/gasman.c
+--- upstream-gap-4.7.5/src/gasman.c	2014-05-24 21:12:44.000000000 +0100
++++ src/gasman.c	2014-06-04 15:43:58.438707637 +0100
+@@ -120,8 +120,7 @@
+ #include        "objects.h"             /* objects                         */
+ #include        "scanner.h"             /* scanner                         */
+ 
+-
+-
++#include        "libgap_internal.h"     /* gasman callback                 */
+ 
+ /****************************************************************************
+ **
+@@ -1772,6 +1771,9 @@
+     /* prepare the list of marked bags for the future                      */
+     MarkedBags = 0;
+ 
++    /* call the libgap callback so library users can mark their own bags   */
++    libgap_call_gasman_callback();
++
+     /* mark from the static area                                           */
+     for ( i = 0; i < GlobalBags.nr; i++ )
+         MARK_BAG( *GlobalBags.addr[i] );
+diff -urd upstream-gap-4.7.5/src/iostream.c src/iostream.c
+--- upstream-gap-4.7.5/src/iostream.c	2014-05-24 21:12:44.000000000 +0100
++++ src/iostream.c	2014-06-04 15:43:58.439707624 +0100
+@@ -42,6 +42,8 @@
+ #include        "records.h"             /* generic records                 */
+ #include        "bool.h"                /* True and False                  */
+ 
++#include        "libgap_internal.h"     /* GAP shared library              */
++
+ #include <stdio.h>                      /* standard input/output functions */
+ #include <stdlib.h>
+ #include <string.h>
+@@ -879,8 +881,9 @@
+   InitHdlrFuncsFromTable( GVarFuncs );
+   
+   /* Set up the trap to detect future dying children */
++#ifdef LIBGAP_SIGNALS
+   signal( SIGCHLD, ChildStatusChanged );
+-
++#endif
+   return 0;
+ }
+ 
+Only in src: libgap.c
+Only in src: libgap.h
+Only in src: libgap_internal.h
+Only in src: libgap.la
+Only in src: libgap_la-ariths.lo
+Only in src: libgap_la-ariths.o
+Only in src: libgap_la-blister.lo
+Only in src: libgap_la-blister.o
+Only in src: libgap_la-bool.lo
+Only in src: libgap_la-bool.o
+Only in src: libgap_la-calls.lo
+Only in src: libgap_la-calls.o
+Only in src: libgap_la-c_filt1.lo
+Only in src: libgap_la-c_filt1.o
+Only in src: libgap_la-c_meths1.lo
+Only in src: libgap_la-c_meths1.o
+Only in src: libgap_la-code.lo
+Only in src: libgap_la-code.o
+Only in src: libgap_la-compiler.lo
+Only in src: libgap_la-compiler.o
+Only in src: libgap_la-compstat.lo
+Only in src: libgap_la-compstat.o
+Only in src: libgap_la-c_oper1.lo
+Only in src: libgap_la-c_oper1.o
+Only in src: libgap_la-costab.lo
+Only in src: libgap_la-costab.o
+Only in src: libgap_la-c_random.lo
+Only in src: libgap_la-c_random.o
+Only in src: libgap_la-c_type1.lo
+Only in src: libgap_la-c_type1.o
+Only in src: libgap_la-cyclotom.lo
+Only in src: libgap_la-cyclotom.o
+Only in src: libgap_la-dteval.lo
+Only in src: libgap_la-dteval.o
+Only in src: libgap_la-dt.lo
+Only in src: libgap_la-dt.o
+Only in src: libgap_la-exprs.lo
+Only in src: libgap_la-exprs.o
+Only in src: libgap_la-finfield.lo
+Only in src: libgap_la-finfield.o
+Only in src: libgap_la-funcs.lo
+Only in src: libgap_la-funcs.o
+Only in src: libgap_la-gap.lo
+Only in src: libgap_la-gap.o
+Only in src: libgap_la-gasman.lo
+Only in src: libgap_la-gasman.o
+Only in src: libgap_la-gmpints.lo
+Only in src: libgap_la-gmpints.o
+Only in src: libgap_la-gvars.lo
+Only in src: libgap_la-gvars.o
+Only in src: libgap_la-integer.lo
+Only in src: libgap_la-integer.o
+Only in src: libgap_la-intfuncs.lo
+Only in src: libgap_la-intfuncs.o
+Only in src: libgap_la-intrprtr.lo
+Only in src: libgap_la-intrprtr.o
+Only in src: libgap_la-iostream.lo
+Only in src: libgap_la-iostream.o
+Only in src: libgap_la-libgap.lo
+Only in src: libgap_la-libgap.o
+Only in src: libgap_la-listfunc.lo
+Only in src: libgap_la-listfunc.o
+Only in src: libgap_la-listoper.lo
+Only in src: libgap_la-listoper.o
+Only in src: libgap_la-lists.lo
+Only in src: libgap_la-lists.o
+Only in src: libgap_la-macfloat.lo
+Only in src: libgap_la-macfloat.o
+Only in src: libgap_la-objccoll.lo
+Only in src: libgap_la-objccoll.o
+Only in src: libgap_la-objcftl.lo
+Only in src: libgap_la-objcftl.o
+Only in src: libgap_la-objects.lo
+Only in src: libgap_la-objects.o
+Only in src: libgap_la-objfgelm.lo
+Only in src: libgap_la-objfgelm.o
+Only in src: libgap_la-objpcgel.lo
+Only in src: libgap_la-objpcgel.o
+Only in src: libgap_la-objscoll.lo
+Only in src: libgap_la-objscoll.o
+Only in src: libgap_la-opers.lo
+Only in src: libgap_la-opers.o
+Only in src: libgap_la-permutat.lo
+Only in src: libgap_la-permutat.o
+Only in src: libgap_la-plist.lo
+Only in src: libgap_la-plist.o
+Only in src: libgap_la-pperm.lo
+Only in src: libgap_la-pperm.o
+Only in src: libgap_la-precord.lo
+Only in src: libgap_la-precord.o
+Only in src: libgap_la-range.lo
+Only in src: libgap_la-range.o
+Only in src: libgap_la-rational.lo
+Only in src: libgap_la-rational.o
+Only in src: libgap_la-read.lo
+Only in src: libgap_la-read.o
+Only in src: libgap_la-records.lo
+Only in src: libgap_la-records.o
+Only in src: libgap_la-saveload.lo
+Only in src: libgap_la-saveload.o
+Only in src: libgap_la-scanner.lo
+Only in src: libgap_la-scanner.o
+Only in src: libgap_la-sctable.lo
+Only in src: libgap_la-sctable.o
+Only in src: libgap_la-set.lo
+Only in src: libgap_la-set.o
+Only in src: libgap_la-stats.lo
+Only in src: libgap_la-stats.o
+Only in src: libgap_la-streams.lo
+Only in src: libgap_la-streams.o
+Only in src: libgap_la-string.lo
+Only in src: libgap_la-string.o
+Only in src: libgap_la-sysfiles.lo
+Only in src: libgap_la-sysfiles.o
+Only in src: libgap_la-system.lo
+Only in src: libgap_la-system.o
+Only in src: libgap_la-tietze.lo
+Only in src: libgap_la-tietze.o
+Only in src: libgap_la-trans.lo
+Only in src: libgap_la-trans.o
+Only in src: libgap_la-vars.lo
+Only in src: libgap_la-vars.o
+Only in src: libgap_la-vec8bit.lo
+Only in src: libgap_la-vec8bit.o
+Only in src: libgap_la-vecffe.lo
+Only in src: libgap_la-vecffe.o
+Only in src: libgap_la-vecgf2.lo
+Only in src: libgap_la-vecgf2.o
+Only in src: libgap_la-vector.lo
+Only in src: libgap_la-vector.o
+Only in src: libgap_la-weakptr.lo
+Only in src: libgap_la-weakptr.o
+Only in src: .libs
+Only in src: Makefile
+Only in src: Makefile.am
+Only in src: Makefile.in
+diff -urd upstream-gap-4.7.5/src/scanner.c src/scanner.c
+--- upstream-gap-4.7.5/src/scanner.c	2014-05-24 21:12:44.000000000 +0100
++++ src/scanner.c	2014-06-04 15:43:58.439707624 +0100
+@@ -59,6 +59,8 @@
+ #include        "opers.h"               /* DoFilter...                     */
+ #include        "read.h"                /* Call0ArgsInNewReader            */
+ 
++#include        "libgap_internal.h"     /* GAP shared library              */
++
+ #include <assert.h>
+ #include <limits.h>
+ 
+@@ -2670,152 +2672,12 @@
+          KOutputStream stream,
+          Char                ch )
+ {
+-  Int                 i, hint, spos;
+-  Char                str [MAXLENOUTPUTLINE];
+-
+-
+-
+-  /* '\01', increment indentation level                                  */
+-  if ( ch == '\01' ) {
+-
+-    if (!stream->format)
+-      return;
+-
+-    /* add hint to break line  */
+-    addLineBreakHint(stream, stream->pos, 16*stream->indent, 1);
+-  }
+-
+-  /* '\02', decrement indentation level                                  */
+-  else if ( ch == '\02' ) {
+-
+-    if (!stream -> format)
+-      return;
+-
+-    /* if this is a better place to split the line remember it         */
+-    addLineBreakHint(stream, stream->pos, 16*stream->indent, -1);
+-  }
+-
+-  /* '\03', print line                                                   */
+-  else if ( ch == '\03' ) {
+-
+-    /* print the line                                                  */
+-    if (stream->pos != 0)
+-      {
+-        stream->line[ stream->pos ] = '\0';
+-        PutLineTo(stream, stream->pos );
+-
+-        /* start the next line                                         */
+-        stream->pos      = 0;
+-      }
+-    /* reset line break hints                                          */
+-    stream->hints[0] = -1;
+-
+-  }
+-
+-  /* <newline> or <return>, print line, indent next                      */
+-  else if ( ch == '\n' || ch == '\r' ) {
+-
+-    /* put the character on the line and terminate it                  */
+-    stream->line[ stream->pos++ ] = ch;
+-    stream->line[ stream->pos   ] = '\0';
+-
+-    /* print the line                                                  */
+-    PutLineTo( stream, stream->pos );
+-
+-    /* and dump it from the buffer */
+-    stream->pos = 0;
+-    if (stream -> format)
+-      {
+-        /* indent for next line                                         */
+-        for ( i = 0;  i < stream->indent; i++ )
+-          stream->line[ stream->pos++ ] = ' ';
+-      }
+-    /* reset line break hints                                       */
+-    stream->hints[0] = -1;
+-
+-  }
+-
+-  /* normal character, room on the current line                          */
+-  else if ( stream->pos < SyNrCols-2-NoSplitLine ) {
+-
+-    /* put the character on this line                                  */
+-    stream->line[ stream->pos++ ] = ch;
+-
+-  }
+-
++  if (ch <= 3)  // GAP control characters
++    return;
++  if (stream->file == 1)
++    libgap_append_stdout(ch);
+   else
+-    {
+-      /* position to split                                              */
+-      if ( (hint = nrLineBreak(stream)) != -1 )
+-        spos = stream->hints[3*hint];
+-      else
+-        spos = 0;
+-
+-      /* if we are going to split at the end of the line, and we are
+-         formatting discard blanks */
+-      if ( stream->format && spos == stream->pos && ch == ' ' ) {
+-        ;
+-      }
+-
+-      /* full line, acceptable split position                              */
+-      else if ( stream->format && spos != 0 ) {
+-
+-        /* add character to the line, terminate it                         */
+-        stream->line[ stream->pos++ ] = ch;
+-        stream->line[ stream->pos++ ] = '\0';
+-
+-        /* copy the rest after the best split position to a safe place     */
+-        for ( i = spos; i < stream->pos; i++ )
+-          str[ i-spos ] = stream->line[ i ];
+-        str[ i-spos] = '\0';
+-
+-        /* print line up to the best split position                        */
+-        stream->line[ spos++ ] = '\n';
+-        stream->line[ spos   ] = '\0';
+-        PutLineTo( stream, spos );
+-        spos--;
+-
+-        /* indent for the rest                                             */
+-        stream->pos = 0;
+-        for ( i = 0; i < stream->hints[3*hint+2]; i++ )
+-          stream->line[ stream->pos++ ] = ' ';
+-        spos -= stream->hints[3*hint+2];
+-
+-        /* copy the rest onto the next line                                */
+-        for ( i = 0; str[ i ] != '\0'; i++ )
+-          stream->line[ stream->pos++ ] = str[ i ];
+-        /* recover line break hints for copied rest                      */
+-        for ( i = hint+1; stream->hints[3*i] != -1; i++ )
+-        {
+-          stream->hints[3*(i-hint-1)] = stream->hints[3*i]-spos;
+-          stream->hints[3*(i-hint-1)+1] = stream->hints[3*i+1];
+-          stream->hints[3*(i-hint-1)+2] = stream->hints[3*i+2];
+-        }
+-        stream->hints[3*(i-hint-1)] = -1;
+-      }
+-
+-      /* full line, no split position                                       */
+-      else {
+-
+-        if (stream->format)
+-          {
+-            /* append a '\',*/
+-            stream->line[ stream->pos++ ] = '\\';
+-            stream->line[ stream->pos++ ] = '\n';
+-          }
+-        /* and print the line                                */
+-        stream->line[ stream->pos   ] = '\0';
+-        PutLineTo( stream, stream->pos );
+-
+-        /* add the character to the next line                              */
+-        stream->pos = 0;
+-        stream->line[ stream->pos++ ] = ch;
+-
+-        if (stream->format)
+-          stream->hints[0] = -1;
+-      }
+-
+-    }
++    libgap_append_stderr(ch);
+ }
+ 
+ /****************************************************************************
+Only in src: stamp-h1
+diff -urd upstream-gap-4.7.5/src/sysfiles.c src/sysfiles.c
+--- upstream-gap-4.7.5/src/sysfiles.c	2014-05-24 21:12:44.000000000 +0100
++++ src/sysfiles.c	2014-06-04 15:43:58.440707610 +0100
+@@ -38,6 +38,8 @@
+ #include        "records.h"             /* generic records                 */
+ #include        "bool.h"                /* Global True and False           */
+ 
++#include        "libgap_internal.h"     /* GAP shared library              */
++
+ #include        <assert.h>
+ #include        <fcntl.h>
+ 
+@@ -1115,16 +1117,20 @@
+ 
+ void syAnswerCont ( int signr )
+ {
++#ifdef LIBGAP_SIGNALS
+     syStartraw( syFid );
+     signal( SIGCONT, SIG_DFL );
+     kill( getpid(), SIGCONT );
++#endif
+ }
+ 
+ void syAnswerTstp ( int signr )
+ {
++#ifdef LIBGAP_SIGNALS
+     syStopraw( syFid );
+     signal( SIGCONT, syAnswerCont );
+     kill( getpid(), SIGTSTP );
++#endif
+ }
+ 
+ #endif
+@@ -1197,12 +1203,13 @@
+ 
+ #endif
+ 
+-
++#ifdef LIBGAP_SIGNALS
+ #ifdef SIGTSTP
+     /* install signal handler for stop                                     */
+     syFid = fid;
+     signal( SIGTSTP, syAnswerTstp );
+ #endif
++#endif
+ 
+     /* indicate success                                                    */
+     return 1;
+@@ -1225,10 +1232,12 @@
+     if ( SyWindow )
+         return;
+ 
++#ifdef LIBGAP_SIGNALS
+ #ifdef SIGTSTP
+     /* remove signal handler for stop                                      */
+     signal( SIGTSTP, SIG_DFL );
+ #endif
++#endif
+ 
+ #if HAVE_TERMIOS_H
+ 
+@@ -1321,11 +1330,13 @@
+ 
+ void SyInstallAnswerIntr ( void )
+ {
++#ifdef LIBGAP_SIGNALS
+     if ( signal( SIGINT, SIG_IGN ) != SIG_IGN )
+     {
+         signal( SIGINT, syAnswerIntr );
+         siginterrupt( SIGINT, 0 );
+     }
++#endif
+ }
+ 
+ 
+@@ -1390,7 +1401,9 @@
+             if (CO <= 0)
+                 CO = win.ws_col;
+         }
++#ifdef LIBGAP_SIGNALS
+         (void) signal(SIGWINCH, syWindowChangeIntr);
++#endif
+     }
+ #endif /* TIOCGWINSZ */
+ 
+@@ -2995,7 +3008,13 @@
+     UInt                length,
+     Int                 fid)
+ {
+-  return syFgets( line, length, fid, 1);
++  if(fid!=0 && fid!=2) {
++    // not stdin/stderr; probably file IO. Do the standard thing.
++    // printf("SyFgets fid=%i\n", fid);
++    return syFgets( line, length, fid, 1);
++  }
++  return libgap_get_input(line, length);
++  // return syFgets( line, length, fid, 1);
+ }
+ 
+ 
+@@ -3119,7 +3138,7 @@
+ # endif
+ #endif
+ 
+-extern char ** environ;
++#include "libgap_internal.h"
+ 
+ void NullSignalHandler(int scratch) {}
+ 
+@@ -3234,6 +3253,7 @@
+        `After that, we call the old signal handler, in case any other children have died in the
+        meantime. This resets the handler */
+ 
++#ifdef LIBGAP_SIGNALS
+     func2 = signal( SIGCHLD, SIG_DFL );
+ 
+     /* This may return SIG_DFL (0x0) or SIG_IGN (0x1) if the previous handler
+@@ -3242,6 +3262,7 @@
+      * is to do nothing */
+     if(func2 == SIG_ERR || func2 == SIG_DFL || func2 == SIG_IGN)
+       func2 = &NullSignalHandler;
++#endif
+ 
+     /* clone the process                                                   */
+     pid = vfork();
+@@ -3253,8 +3274,9 @@
+     if ( pid != 0 ) {
+ 
+         /* ignore a CTRL-C                                                 */
++#ifdef LIBGAP_SIGNALS
+         func = signal( SIGINT, SIG_IGN );
+-
++#endif
+         /* wait for some action                                            */
+ #if HAVE_WAITPID
+         wait_pid = waitpid( pid, &status, 0 );
+@@ -3262,18 +3284,24 @@
+         wait_pid = wait4( pid, &status, 0, &usage );
+ #endif
+         if ( wait_pid == -1 ) {
++#ifdef LIBGAP_SIGNALS
+             signal( SIGINT, func );
+             (*func2)(SIGCHLD);
++#endif
+             return -1;
+         }
+ 
+         if ( WIFSIGNALED(status) ) {
++#ifdef LIBGAP_SIGNALS
+             signal( SIGINT, func );
+             (*func2)(SIGCHLD);
++#endif
+             return -1;
+         }
++#ifdef LIBGAP_SIGNALS
+         signal( SIGINT, func );
+         (*func2)(SIGCHLD);
++#endif
+         return WEXITSTATUS(status);
+     }
+ 

File src/gmpints.c

 *F  NEW_INTNEG( <gmp> )
 **
 **
-*/
+**
 static inline Obj NEW_INTNEG( Obj gmp )
 {
   Obj new;
 
   return new;
 }
-
+*/
 
 /****************************************************************************
 **

File src/intfuncs.c

   Int maxlen=INT_INTOBJ(opM);
   if ((n>maxlen)&&(maxlen!=-1)) {n=maxlen;}; 
   
-#ifdef SYS_IS_64_BIT
-  UInt8 hashout[2];
-  MurmurHash3_x64_128 ( (const void *)((UChar *)ADDR_OBJ(opL)+offs), 
-			(int) n,
-			(UInt4)INT_INTOBJ(opR), (void *) hashout);
-  return INTOBJ_INT(hashout[0] % (1UL << 60));
-#else
-  UInt4 hashout;
-  MurmurHash3_x86_32 ( (const void *)((UChar *)ADDR_OBJ(opL)+offs), 
-			(int) n,
-			(UInt4)INT_INTOBJ(opR), (void *) &hashout);
-  return INTOBJ_INT(hashout % (1UL << 28));
-#endif
+  return INTOBJ_INT(HASHKEY_BAG_NC( opL, (UInt4)INT_INTOBJ(opR), offs, (int) n));
+}
 
+Int HASHKEY_BAG_NC (Obj obj, UInt4 factor, Int skip, int maxread){
+  #ifdef SYS_IS_64_BIT
+    UInt8 hashout[2];
+    MurmurHash3_x64_128 ( (const void *)((UChar *)ADDR_OBJ(obj)+skip), 
+                           maxread, (UInt4)factor, (void *) hashout);
+    return hashout[0] % (1UL << 60);
+  #else
+    UInt4 hashout;
+    MurmurHash3_x86_32 ( (const void *)((UChar *)ADDR_OBJ(obj)+skip), 
+                          maxread, (UInt4)factor, (void *) &hashout);
+    return hashout % (1UL << 28);
+  #endif
 }
 
 Obj FuncJenkinsHash(Obj self, Obj op, Obj size)

File src/intfuncs.h

 extern void MurmurHash3_x64_128 ( const void * key, const int len,
                            const UInt4 seed, void * out );
 
+extern Int HASHKEY_BAG_NC(Obj obj, UInt4 factor, Int skip, int maxread);
 
 /****************************************************************************
 **
 **
 ** A partial perm is of the form: 
 **
-** [codegree, entries of image list, domain, image set]
+** [image set, domain, codegree, entries of image list]
 **
 ** An element of the internal rep of a partial perm in T_PPERM2 must be at
 ** most 65535 and be of UInt2. The <codegree> is just the degree of the inverse
 #define MAX(a,b)          (a<b?b:a)
 #define MIN(a,b)          (a<b?a:b)
 
+#define IMG_PPERM(f)      (*(Obj*)(ADDR_OBJ(f)))
+#define DOM_PPERM(f)      (*((Obj*)(ADDR_OBJ(f))+1))
+
 #define NEW_PPERM2(deg)   NewBag(T_PPERM2, (deg+1)*sizeof(UInt2)+2*sizeof(Obj))
-#define CODEG_PPERM2(f)   (*((UInt2*)(ADDR_OBJ(f))))
-#define ADDR_PPERM2(f)    ((UInt2*)(ADDR_OBJ(f))+1)
-#define IMG_PPERM2(f)     (*(Obj*)(ADDR_PPERM2(f)+DEG_PPERM2(f)))
-#define DOM_PPERM2(f)     (*((Obj*)(ADDR_PPERM2(f)+DEG_PPERM2(f))+1))
-#define DEG_PPERM2(f)     ((UInt)(SIZE_OBJ(f)-sizeof(UInt2)-2*sizeof(Obj))/sizeof(UInt2))
-#define RANK_PPERM2(f)    (IMG_PPERM2(f)==NULL?INIT_PPERM2(f):LEN_PLIST(IMG_PPERM2(f)))
+#define CODEG_PPERM2(f)   (*(UInt2*)((Obj*)(ADDR_OBJ(f))+2))
+#define ADDR_PPERM2(f)    ((UInt2*)((Obj*)(ADDR_OBJ(f))+2)+1)
+#define DEG_PPERM2(f)  ((UInt)(SIZE_OBJ(f)-sizeof(UInt2)-2*sizeof(Obj))/sizeof(UInt2))
+#define RANK_PPERM2(f) (IMG_PPERM(f)==NULL?INIT_PPERM2(f):LEN_PLIST(IMG_PPERM(f)))
 
 #define NEW_PPERM4(deg)   NewBag(T_PPERM4, (deg+1)*sizeof(UInt4)+2*sizeof(Obj))
-#define CODEG_PPERM4(f)   (*((UInt4*)(ADDR_OBJ(f))))
-#define ADDR_PPERM4(f)    ((UInt4*)(ADDR_OBJ(f))+1)
-#define IMG_PPERM4(f)     (*((Obj*)(ADDR_PPERM4(f)+DEG_PPERM4(f))))
-#define DOM_PPERM4(f)     (*((Obj*)(ADDR_PPERM4(f)+DEG_PPERM4(f))+1))
+#define CODEG_PPERM4(f)   (*(UInt4*)((Obj*)(ADDR_OBJ(f))+2))
+#define ADDR_PPERM4(f)    ((UInt4*)((Obj*)(ADDR_OBJ(f))+2)+1)
 #define DEG_PPERM4(f)     ((UInt)(SIZE_OBJ(f)-sizeof(UInt4)-2*sizeof(Obj))/sizeof(UInt4))
-#define RANK_PPERM4(f)    (IMG_PPERM4(f)==NULL?INIT_PPERM4(f):LEN_PLIST(IMG_PPERM4(f)))
+#define RANK_PPERM4(f) (IMG_PPERM(f)==NULL?INIT_PPERM4(f):LEN_PLIST(IMG_PPERM(f)))
 
 #define IMAGEPP(i, ptf, deg) (i<=deg?ptf[i-1]:0)
 #define IS_PPERM(f)   (TNUM_OBJ(f)==T_PPERM2||TNUM_OBJ(f)==T_PPERM4)
 #define RANK_PPERM(f) (TNUM_OBJ(f)==T_PPERM2?RANK_PPERM2(f):RANK_PPERM4(f))
 #define DEG_PPERM(f)  (TNUM_OBJ(f)==T_PPERM2?DEG_PPERM2(f):DEG_PPERM4(f))
 #define CODEG_PPERM(f)(TNUM_OBJ(f)==T_PPERM2?CODEG_PPERM2(f):CODEG_PPERM4(f))
-#define IMG_PPERM(f)  (TNUM_OBJ(f)==T_PPERM2?IMG_PPERM2(f):IMG_PPERM4(f))
-#define DOM_PPERM(f)  (TNUM_OBJ(f)==T_PPERM2?DOM_PPERM2(f):DOM_PPERM4(f))
 
 Obj   EmptyPartialPerm;
 
   if(deg==0){
     dom=NEW_PLIST(T_PLIST_EMPTY, 0);
     SET_LEN_PLIST(dom, 0);
-    DOM_PPERM2(f)=dom;
-    IMG_PPERM2(f)=dom;
+    DOM_PPERM(f)=dom;
+    IMG_PPERM(f)=dom;
     CHANGED_BAG(f);
     return deg;
   }
   SHRINK_PLIST(dom, (Int) rank);
   SET_LEN_PLIST(dom, (Int) rank);
   
-  DOM_PPERM2(f)=dom;
-  IMG_PPERM2(f)=img;
+  DOM_PPERM(f)=dom;
+  IMG_PPERM(f)=img;
   CHANGED_BAG(f);
   return rank;
 }
   if(deg==0){
     dom=NEW_PLIST(T_PLIST_EMPTY, 0);
     SET_LEN_PLIST(dom, 0);
-    DOM_PPERM2(f)=dom;
-    IMG_PPERM2(f)=dom;
+    DOM_PPERM(f)=dom;
+    IMG_PPERM(f)=dom;
     CHANGED_BAG(f);
     return deg;
   }
   SHRINK_PLIST(dom, (Int) rank);
   SET_LEN_PLIST(dom, (Int) rank);
   
-  DOM_PPERM4(f)=dom;
-  IMG_PPERM4(f)=img;
+  DOM_PPERM(f)=dom;
+  IMG_PPERM(f)=img;
   CHANGED_BAG(f);
   return rank;
 }
 ** GAP functions for partial perms
 *******************************************************************************/
 
+
 Obj FuncEmptyPartialPerm( Obj self ){
   return EmptyPartialPerm;
 }
     for(i=1;i<=rank;i++){ 
       ptf2[INT_INTOBJ(ELM_PLIST(dom, i))-1]=INT_INTOBJ(ELM_PLIST(img, i));
     }
-    DOM_PPERM2(f)=dom;
-    IMG_PPERM2(f)=img;
+    DOM_PPERM(f)=dom;
+    IMG_PPERM(f)=img;
     CODEG_PPERM2(f)=codeg;
   } else {
     f=NEW_PPERM4(deg);
       if(j>codeg) codeg=j;
       ptf4[INT_INTOBJ(ELM_PLIST(dom, i))-1]=j;
     }
-    DOM_PPERM4(f)=dom;
-    IMG_PPERM4(f)=img;
+    DOM_PPERM(f)=dom;
+    IMG_PPERM(f)=img;
     CODEG_PPERM4(f)=codeg;
   }
   CHANGED_BAG(f);
 
 /* the degree of pperm is the maximum point where it is defined */
 Obj FuncDegreeOfPartialPerm(Obj self, Obj f){
-  if(!IS_PPERM(f)){
-    ErrorQuit("usage: the argument should be a partial perm,", 0L, 0L);
-  }
   if(TNUM_OBJ(f)==T_PPERM2){ 
     return INTOBJ_INT(DEG_PPERM2(f));
-  } else {
+  } else if(TNUM_OBJ(f)==T_PPERM4){
     return INTOBJ_INT(DEG_PPERM4(f));
   }
+  ErrorQuit("usage: the argument should be a partial perm,", 0L, 0L);
+  return Fail;
 }
 
 /* the codegree of pperm is the maximum point in its image */
 Obj FuncCoDegreeOfPartialPerm(Obj self, Obj f){
-  if(!IS_PPERM(f)){
-    ErrorQuit("usage: the argument should be a partial perm,", 0L, 0L);
-  }
   if(TNUM_OBJ(f)==T_PPERM2){ 
     return INTOBJ_INT(CODEG_PPERM2(f));
-  } else {
+  } else if(TNUM_OBJ(f)==T_PPERM4){
     return INTOBJ_INT(CODEG_PPERM4(f));
   }
+  ErrorQuit("usage: the argument should be a partial perm,", 0L, 0L);
+  return Fail;
 }
 
 /* the rank is the number of points where it is defined */
 Obj FuncRankOfPartialPerm (Obj self, Obj f){ 
-  if(!IS_PPERM(f)){
-    ErrorQuit("usage: the argument should be a partial perm,", 0L, 0L);
-  }
   if(TNUM_OBJ(f)==T_PPERM2){
     return INTOBJ_INT(RANK_PPERM2(f));
-  } else {
+  } else if(TNUM_OBJ(f)==T_PPERM4){
     return INTOBJ_INT(RANK_PPERM4(f));
   }
+  ErrorQuit("usage: the argument should be a partial perm,", 0L, 0L);
+  return Fail;
 }
 
 /* domain of a partial perm */
 Obj FuncDOMAIN_PPERM(Obj self, Obj f){ 
-  if(TNUM_OBJ(f)==T_PPERM2){
-    if(DOM_PPERM2(f)==NULL) INIT_PPERM2(f);
-    return DOM_PPERM2(f);
-  } else {
-    if(DOM_PPERM4(f)==NULL) INIT_PPERM4(f);
-    return DOM_PPERM4(f);
+  if(DOM_PPERM(f)==NULL){
+    if(TNUM_OBJ(f)==T_PPERM2){
+      INIT_PPERM2(f);
+    } else {
+      INIT_PPERM4(f);
+    }
   }
+  return DOM_PPERM(f);
 } 
 
 /* image list of pperm */
   UInt      i, rank;
   Obj       out, dom;
   if(TNUM_OBJ(f)==T_PPERM2){
-    if(IMG_PPERM2(f)==NULL){
+    if(IMG_PPERM(f)==NULL){
       INIT_PPERM2(f);
-      return IMG_PPERM2(f);
-    } else if(!IS_SSORT_LIST(IMG_PPERM2(f))){
-      return IMG_PPERM2(f);
+      return IMG_PPERM(f);
+    } else if(!IS_SSORT_LIST(IMG_PPERM(f))){
+      return IMG_PPERM(f);
     }
     rank=RANK_PPERM2(f);
     if(rank==0){
     out=NEW_PLIST(T_PLIST_CYC_NSORT+IMMUTABLE, rank);
     SET_LEN_PLIST(out, rank);
     ptf2=ADDR_PPERM2(f);
-    dom=DOM_PPERM2(f);
+    dom=DOM_PPERM(f);
     for(i=1;i<=rank;i++){ 
       SET_ELM_PLIST(out,i,INTOBJ_INT(ptf2[INT_INTOBJ(ELM_PLIST(dom, i))-1]));
     }
   } else {
-    if(IMG_PPERM4(f)==NULL){
+    if(IMG_PPERM(f)==NULL){
       INIT_PPERM4(f);
-      return IMG_PPERM4(f);
-    } else if(!IS_SSORT_LIST(IMG_PPERM4(f))){
-      return IMG_PPERM4(f);
+      return IMG_PPERM(f);
+    } else if(!IS_SSORT_LIST(IMG_PPERM(f))){
+      return IMG_PPERM(f);
     }
     rank=RANK_PPERM4(f);
     if(rank==0){
     out=NEW_PLIST(T_PLIST_CYC_NSORT+IMMUTABLE, rank);
     SET_LEN_PLIST(out, rank);
     ptf4=ADDR_PPERM4(f);
-    dom=DOM_PPERM4(f);
+    dom=DOM_PPERM(f);
     for(i=1;i<=rank;i++){ 
       SET_ELM_PLIST(out,i,INTOBJ_INT(ptf4[INT_INTOBJ(ELM_PLIST(dom, i))-1]));
     }
 /* image set of partial perm */
 Obj FuncIMAGE_SET_PPERM (Obj self, Obj f){ 
   if(TNUM_OBJ(f)==T_PPERM2){
-    if(IMG_PPERM2(f)==NULL){
+    if(IMG_PPERM(f)==NULL){
       INIT_PPERM2(f);
-      return SORT_PLIST_CYC(IMG_PPERM2(f));
-    } else if(!IS_SSORT_LIST(IMG_PPERM2(f))){
-      return SORT_PLIST_CYC(IMG_PPERM2(f));
+      return SORT_PLIST_CYC(IMG_PPERM(f));
+    } else if(!IS_SSORT_LIST(IMG_PPERM(f))){
+      return SORT_PLIST_CYC(IMG_PPERM(f));
     }
-    return IMG_PPERM2(f);  
+    return IMG_PPERM(f);  
   } else if (TNUM_OBJ(f)==T_PPERM4){
-   if(IMG_PPERM4(f)==NULL){
+   if(IMG_PPERM(f)==NULL){
       INIT_PPERM4(f);
-      return SORT_PLIST_CYC(IMG_PPERM4(f));
-    } else if(!IS_SSORT_LIST(IMG_PPERM4(f))){
-      return SORT_PLIST_CYC(IMG_PPERM4(f));
+      return SORT_PLIST_CYC(IMG_PPERM(f));
+    } else if(!IS_SSORT_LIST(IMG_PPERM(f))){
+      return SORT_PLIST_CYC(IMG_PPERM(f));
     }
-    return IMG_PPERM4(f);
+    return IMG_PPERM(f);
   } else {
     ErrorQuit("usage: the argument must be a partial perm,", 0L, 0L);
   }
   if(TNUM_OBJ(f)==T_PPERM2){
     deg=DEG_PPERM2(f);
     ptf2=ADDR_PPERM2(f);
-    dom=DOM_PPERM2(f);
+    dom=DOM_PPERM(f);
     
     //find chains
     for(i=1;i<=rank;i++){
   } else {
     deg=DEG_PPERM4(f);
     ptf4=ADDR_PPERM4(f);
-    dom=DOM_PPERM4(f);
+    dom=DOM_PPERM(f);
 
     //find chains
     for(i=1;i<=rank;i++){
   ptseen=(UInt4*)(ADDR_OBJ(TmpPPerm));
 
   if(TNUM_OBJ(f)==T_PPERM2){  
-    dom=DOM_PPERM2(f);
+    dom=DOM_PPERM(f);
     ptf2=ADDR_PPERM2(f);
     
     //find chains
       }
     }
   } else {
-    dom=DOM_PPERM4(f);
+    dom=DOM_PPERM(f);
     ptf4=ADDR_PPERM4(f);      
 
     //find chains
   if(TNUM_OBJ(f)==T_PPERM2){
     deg=DEG_PPERM2(f);
     ptf2=ADDR_PPERM2(f);
-    dom=DOM_PPERM2(f);
+    dom=DOM_PPERM(f);
 
     //find chains
     for(i=1;i<=rank;i++){
   } else {
     deg=DEG_PPERM4(f);
     ptf4=ADDR_PPERM4(f);
-    dom=DOM_PPERM4(f);
+    dom=DOM_PPERM(f);
 
     //find chains
     for(i=1;i<=rank;i++){
   
   if(TNUM_OBJ(f)==T_PPERM2){  
     deg=DEG_PPERM2(f);
-    dom=DOM_PPERM2(f);
+    dom=DOM_PPERM(f);
     
     //find chains
     for(i=1;i<=rank;i++){
     }
   } else {
     deg=DEG_PPERM4(f);
-    dom=DOM_PPERM4(f);
+    dom=DOM_PPERM(f);
 
     //find chains
     for(i=1;i<=rank;i++){
   len=0;
   if(TNUM_OBJ(f)==T_PPERM2){
     deg=DEG_PPERM2(f);
-    if(DOM_PPERM2(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       out=NEW_PLIST(T_PLIST_CYC_SSORT, deg);
       ptf2=ADDR_PPERM2(f);
       for(i=0;i<deg;i++){
         }
       }
     } else {
-      dom=DOM_PPERM2(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM2(f);
       out=NEW_PLIST(T_PLIST_CYC_SSORT, rank);
       ptf2=ADDR_PPERM2(f);
     }
   } else {
     deg=DEG_PPERM4(f);
-    if(DOM_PPERM4(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       out=NEW_PLIST(T_PLIST_CYC_SSORT, deg);
       ptf4=ADDR_PPERM4(f);
       for(i=0;i<deg;i++){
         }
       }
     } else {
-      dom=DOM_PPERM4(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM4(f); 
       out=NEW_PLIST(T_PLIST_CYC_SSORT, rank);
       ptf4=ADDR_PPERM4(f);
   if(TNUM_OBJ(f)==T_PPERM2){
     deg=DEG_PPERM2(f);
     ptf2=ADDR_PPERM2(f);
-    if(DOM_PPERM2(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=0;i<deg;i++) if(ptf2[i]==i+1) nr++;
     } else {
-      dom=DOM_PPERM2(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM2(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   } else {
     deg=DEG_PPERM4(f);
     ptf4=ADDR_PPERM4(f);
-    if(DOM_PPERM4(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=0;i<deg;i++) if(ptf4[i]==i+1) nr++;
     } else {
-      dom=DOM_PPERM4(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM4(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   len=0;
   if(TNUM_OBJ(f)==T_PPERM2){
     deg=DEG_PPERM2(f);
-    if(DOM_PPERM2(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       out=NEW_PLIST(T_PLIST_CYC_SSORT, deg);
       ptf2=ADDR_PPERM2(f);
       for(i=0;i<deg;i++){
         }
       }
     } else {
-      dom=DOM_PPERM2(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM2(f);
       out=NEW_PLIST(T_PLIST_CYC_SSORT, rank);
       ptf2=ADDR_PPERM2(f);
     }
   } else {
     deg=DEG_PPERM4(f);
-    if(DOM_PPERM4(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       out=NEW_PLIST(T_PLIST_CYC_SSORT, deg);
       ptf4=ADDR_PPERM4(f);
       for(i=0;i<deg;i++){
         }
       }
     } else {
-      dom=DOM_PPERM4(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM4(f);
       out=NEW_PLIST(T_PLIST_CYC_SSORT, rank);
       ptf4=ADDR_PPERM4(f);
   if(TNUM_OBJ(f)==T_PPERM2){
     deg=DEG_PPERM2(f);
     ptf2=ADDR_PPERM2(f);
-    if(DOM_PPERM2(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=0;i<deg;i++) if(ptf2[i]!=0&&ptf2[i]!=i+1) nr++;
     } else {
-      dom=DOM_PPERM2(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM2(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   } else {
     deg=DEG_PPERM4(f);
     ptf4=ADDR_PPERM4(f);
-    if(DOM_PPERM4(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=0;i<deg;i++) if(ptf4[i]!=0&&ptf4[i]!=i+1) nr++;
     } else {
-      dom=DOM_PPERM4(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM4(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   if(TNUM_OBJ(f)==T_PPERM2){
     deg=DEG_PPERM2(f);
     ptf2=ADDR_PPERM2(f);
-    if(DOM_PPERM2(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=deg;i>0;i--){
         if(ptf2[i-1]!=0&&ptf2[i-1]!=i) return INTOBJ_INT(i);
       }
     } else {
-      dom=DOM_PPERM2(f);
+      dom=DOM_PPERM(f);
       for(i=RANK_PPERM2(f);i>=1;i--){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
         if(ptf2[j]!=j+1) return INTOBJ_INT(j+1);
   } else {
     deg=DEG_PPERM4(f);
     ptf4=ADDR_PPERM4(f);
-    if(DOM_PPERM4(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=deg;i>0;i--){
         if(ptf4[i-1]!=0&&ptf4[i-1]!=i) return INTOBJ_INT(i);
       }
     } else {
-      dom=DOM_PPERM4(f);
+      dom=DOM_PPERM(f);
       for(i=RANK_PPERM4(f);i>=1;i--){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
         if(ptf4[j]!=j+1) return INTOBJ_INT(j+1);
   if(TNUM_OBJ(f)==T_PPERM2){
     deg=DEG_PPERM2(f);
     ptf2=ADDR_PPERM2(f);
-    if(DOM_PPERM2(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=0;i<deg;i++){
         if(ptf2[i]!=0&&ptf2[i]!=i+1) return INTOBJ_INT(i+1);
       }
     } else {
-      dom=DOM_PPERM2(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM2(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   } else {
     deg=DEG_PPERM4(f);
     ptf4=ADDR_PPERM4(f);
-    if(DOM_PPERM4(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=0;i<deg;i++){
         if(ptf4[i]!=0&&ptf4[i]!=i+1) return INTOBJ_INT(i+1);
       }
     } else {
-      dom=DOM_PPERM4(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM4(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
 
   if(TNUM_OBJ(f)!=T_PPERM4||CODEG_PPERM4(f)>65535) return f;
 
-  ptf=((UInt4*)(ADDR_OBJ(f)));
+  ptf=ADDR_PPERM4(f)-1;
   deg=DEG_PPERM4(f);
   for(i=0;i<deg+1;i++) ((UInt2*)ptf)[i]=(UInt2)ptf[i]; 
-  
-  if((*((Obj*)(ptf+deg+1)+1))!=NULL){
-    (*((Obj*)((UInt2*)ptf+deg+1)  ))=(*((Obj*)(ptf+deg+1)  ));
-    (*((Obj*)((UInt2*)ptf+deg+1)+1))=(*((Obj*)(ptf+deg+1)+1)); //dom
-  } else {
-    (*((Obj*)((UInt2*)ptf+deg+1)  ))=NULL;
-    (*((Obj*)((UInt2*)ptf+deg+1)+1))=NULL;
-  }
 
   RetypeBag(f, T_PPERM2);
   ResizeBag(f, (deg+1)*sizeof(UInt2)+2*sizeof(Obj));
   return (Obj)0;
 }
 
+Obj FuncHASH_FUNC_FOR_PPERM(Obj self, Obj f, Obj data){
+  UInt codeg;
+
+  if(TNUM_OBJ(f)==T_PPERM4){
+    codeg=CODEG_PPERM4(f);
+    if(codeg<65536){
+      FuncTRIM_PPERM(self, f);
+    } else {
+      return INTOBJ_INT((HASHKEY_BAG_NC(f, (UInt4) 255, 
+              2*sizeof(Obj)+sizeof(UInt4), (int) 4*DEG_PPERM4(f))
+              % (INT_INTOBJ(data)))+1); 
+    }
+  }
+  return INTOBJ_INT((HASHKEY_BAG_NC(f, (UInt4) 255, 
+              2*sizeof(Obj)+sizeof(UInt2), (int) 2*DEG_PPERM2(f))
+              % (INT_INTOBJ(data)))+1); 
+}
+
 // test if a partial perm is an idempotent
 Obj FuncIS_IDEM_PPERM(Obj self, Obj f){
   UInt2*  ptf2;
   
   if(TNUM_OBJ(f)==T_PPERM2){
     ptf2=ADDR_PPERM2(f);
-    if(DOM_PPERM2(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       deg=DEG_PPERM2(f);
       for(i=0;i<deg;i++){
         if(ptf2[i]!=0&&ptf2[i]!=i+1) return False;
       }
     } else {
-      dom=DOM_PPERM2(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM2(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
     }
   } else {
     ptf4=ADDR_PPERM4(f);
-    if(DOM_PPERM4(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       deg=DEG_PPERM4(f);
       for(i=0;i<deg;i++){
         if(ptf4[i]!=0&&ptf4[i]!=i+1) return False;
       }
     } else {
-      dom=DOM_PPERM4(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM4(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
 
   if(TNUM_OBJ(f)==T_PPERM2){
     rank=RANK_PPERM2(f);
-    dom=DOM_PPERM2(f);
+    dom=DOM_PPERM(f);
     deg=DEG_PPERM2(f);
   } else {
     rank=RANK_PPERM4(f);
-    dom=DOM_PPERM4(f);
+    dom=DOM_PPERM(f);
     deg=DEG_PPERM4(f);
   }
 
       ptg2[j]=j+1;
     }
     CODEG_PPERM2(g)=deg;
-    DOM_PPERM2(g)=dom;
-    IMG_PPERM2(g)=dom;
+    DOM_PPERM(g)=dom;
+    IMG_PPERM(g)=dom;
   } else {
     g=NEW_PPERM4(deg);
     ptg4=ADDR_PPERM4(g);
       ptg4[j]=j+1;
     }
     CODEG_PPERM4(g)=deg;
-    DOM_PPERM4(g)=dom;
-    IMG_PPERM4(g)=dom;
+    DOM_PPERM(g)=dom;
+    IMG_PPERM(g)=dom;
   }
   CHANGED_BAG(g);
   return g;
   if(TNUM_OBJ(f)==T_PPERM2){
     codeg=CODEG_PPERM2(f);
     rank=RANK_PPERM2(f);
-    img=IMG_PPERM2(f);
+    img=IMG_PPERM(f);
   }else{
     codeg=CODEG_PPERM4(f);
     rank=RANK_PPERM4(f);
-    img=IMG_PPERM4(f);
+    img=IMG_PPERM(f);
   }
 
   if(codeg<65536){ 
       ptg2[j]=j+1;
     }
     if(IS_SSORT_LIST(img)){
-      DOM_PPERM2(g)=img;
-      IMG_PPERM2(g)=img;
+      DOM_PPERM(g)=img;
+      IMG_PPERM(g)=img;
     }
     CODEG_PPERM2(g)=codeg;
   } else {
       ptg4[j]=j+1;
     }
     if(IS_SSORT_LIST(img)){
-      DOM_PPERM4(g)=img;
-      IMG_PPERM4(g)=img;
+      DOM_PPERM(g)=img;
+      IMG_PPERM(g)=img;
     }
     CODEG_PPERM4(g)=codeg;
   }
     if(TNUM_OBJ(g)==T_PPERM2){
       deg=DEG_PPERM2(g);
       ptg2=ADDR_PPERM2(g);
-      if(DOM_PPERM2(f)==NULL){
+      if(DOM_PPERM(f)==NULL){
         for(i=0;i<def;i++){
           if(ptf2[i]!=0&&ptf2[i]!=IMAGEPP(i+1, ptg2, deg)) return False;
         }
       } else {
-        dom=DOM_PPERM2(f);
+        dom=DOM_PPERM(f);
         rank=RANK_PPERM2(f);
         for(i=1;i<=rank;i++){
           j=INT_INTOBJ(ELM_PLIST(dom, i));
     } else if(TNUM_OBJ(g)==T_PPERM4){
       deg=DEG_PPERM4(g);
       ptg4=ADDR_PPERM4(g);
-      if(DOM_PPERM2(f)==NULL){
+      if(DOM_PPERM(f)==NULL){
         for(i=0;i<def;i++){
           if(ptf2[i]!=0&&ptf2[i]!=IMAGEPP(i+1, ptg4, deg)) return False;
         }
       } else {
-        dom=DOM_PPERM2(f);
+        dom=DOM_PPERM(f);
         rank=RANK_PPERM2(f);
         for(i=1;i<=rank;i++){
           j=INT_INTOBJ(ELM_PLIST(dom, i));
     if(TNUM_OBJ(g)==T_PPERM2){
       deg=DEG_PPERM2(g);
       ptg2=ADDR_PPERM2(g);
-      if(DOM_PPERM4(f)==NULL){
+      if(DOM_PPERM(f)==NULL){
         for(i=0;i<def;i++){
           if(ptf4[i]!=0&&ptf4[i]!=IMAGEPP(i+1, ptg2, deg)) return False;
         }
       } else {
-        dom=DOM_PPERM4(f);
+        dom=DOM_PPERM(f);
         rank=RANK_PPERM4(f);
         for(i=1;i<=rank;i++){
           j=INT_INTOBJ(ELM_PLIST(dom, i));
     } else if(TNUM_OBJ(g)==T_PPERM4){
       deg=DEG_PPERM4(g);
       ptg4=ADDR_PPERM4(g);
-      if(DOM_PPERM4(f)==NULL){
+      if(DOM_PPERM(f)==NULL){
         for(i=0;i<def;i++){
           if(ptf4[i]!=0&&ptf4[i]!=IMAGEPP(i+1, ptg4, deg)) return False;
         }
       } else {
-        dom=DOM_PPERM4(f);
+        dom=DOM_PPERM(f);
         rank=RANK_PPERM4(f);
         for(i=1;i<=rank;i++){
           j=INT_INTOBJ(ELM_PLIST(dom, i));
     ptg4=ADDR_PPERM4(g);
     ptseen=(UInt4*)(ADDR_OBJ(TmpPPerm));
     
-    if(DOM_PPERM4(f)!=NULL){
-      dom=DOM_PPERM4(f);
+    if(DOM_PPERM(f)!=NULL){
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM4(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
       }
     }
  
-    if(DOM_PPERM4(g)!=NULL){
-      dom=DOM_PPERM4(g);
+    if(DOM_PPERM(g)!=NULL){
+      dom=DOM_PPERM(g);
       rank=RANK_PPERM4(g);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
       }
     }
 
-    if(DOM_PPERM4(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=0;i<degf;i++){
         if(ptf4[i]!=0){
           if(ptjoin4[i]==0){
       }
     }
     
-    if(DOM_PPERM4(g)==NULL){
+    if(DOM_PPERM(g)==NULL){
       for(i=0;i<degg;i++){
         if(ptg4[i]!=0){
           if(ptjoin4[i]==0){
     ptjoin4=ADDR_PPERM4(join);
     ptf4=ADDR_PPERM4(f);
     ptg2=ADDR_PPERM2(g);
-    ptseen=( UInt4*)(ADDR_OBJ(TmpPPerm));
+    ptseen=(UInt4*)(ADDR_OBJ(TmpPPerm));
 
-    if(DOM_PPERM4(f)!=NULL){
-      dom=DOM_PPERM4(f);
+    if(DOM_PPERM(f)!=NULL){
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM4(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
       }
     }
  
-    if(DOM_PPERM2(g)!=NULL){
-      dom=DOM_PPERM2(g);
+    if(DOM_PPERM(g)!=NULL){
+      dom=DOM_PPERM(g);
       rank=RANK_PPERM2(g);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
       }
     }
 
-    if(DOM_PPERM4(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=0;i<degf;i++){
         if(ptf4[i]!=0){
           if(ptjoin4[i]==0){
       }
     }
     
-    if(DOM_PPERM2(g)==NULL){
+    if(DOM_PPERM(g)==NULL){
       for(i=0;i<degg;i++){
         if(ptg2[i]!=0){
           if(ptjoin4[i]==0){
     ptjoin2=ADDR_PPERM2(join);
     ptf2=ADDR_PPERM2(f);
     ptg2=ADDR_PPERM2(g);
-    ptseen=( UInt4*)(ADDR_OBJ(TmpPPerm));
+    ptseen=(UInt4*)(ADDR_OBJ(TmpPPerm));
 
-    if(DOM_PPERM2(f)!=NULL){
-      dom=DOM_PPERM2(f);
+    if(DOM_PPERM(f)!=NULL){
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM2(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
       }
     }
  
-    if(DOM_PPERM2(g)!=NULL){
-      dom=DOM_PPERM2(g);
+    if(DOM_PPERM(g)!=NULL){
+      dom=DOM_PPERM(g);
       rank=RANK_PPERM2(g);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
       }
     }
 
-    if(DOM_PPERM2(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=0;i<degf;i++){
         if(ptf2[i]!=0){
           if(ptjoin2[i]==0){
       }
     }
     
-    if(DOM_PPERM2(g)==NULL){
+    if(DOM_PPERM(g)==NULL){
       for(i=0;i<degg;i++){
         if(ptg2[i]!=0){
           if(ptjoin2[i]==0){
   Obj     p, dom;
 
   if(TNUM_OBJ(f)==T_PPERM2){
-    if(!EQ(FuncIMAGE_SET_PPERM(self, f), DOM_PPERM2(f))){
+    if(!EQ(FuncIMAGE_SET_PPERM(self, f), DOM_PPERM(f))){
       return Fail;
     }
     deg=DEG_PPERM2(f);
     p=NEW_PERM2(deg);
-    dom=DOM_PPERM2(f);
+    dom=DOM_PPERM(f);
     ptp2=ADDR_PERM2(p);
     ptf2=ADDR_PPERM2(f);
     for(i=0;i<deg;i++) ptp2[i]=i;
       ptp2[j]=ptf2[j]-1;
     }
   } else {
-   if(!EQ(FuncIMAGE_SET_PPERM(self, f), DOM_PPERM4(f))){
+   if(!EQ(FuncIMAGE_SET_PPERM(self, f), DOM_PPERM(f))){
      return Fail;
     }
     deg=DEG_PPERM4(f);
     p=NEW_PERM4(deg);
-    dom=DOM_PPERM4(f);
+    dom=DOM_PPERM(f);
     ptp4=ADDR_PERM4(p);
     ptf4=ADDR_PPERM4(f);
     for(i=0;i<deg;i++) ptp4[i]=i;
     ptp2=ADDR_PERM2(perm);
     for(i=0;i<deg;i++) ptp2[i]=i;
     rank=RANK_PPERM2(f);
-    dom=DOM_PPERM2(f);
+    dom=DOM_PPERM(f);
     //renew pointers since RANK_PPERM can trigger garbage collection
     ptp2=ADDR_PERM2(perm);
     ptf2=ADDR_PPERM2(f);
     ptp4=ADDR_PERM4(perm);
     for(i=0;i<deg;i++) ptp4[i]=i;
     rank=RANK_PPERM4(f);
-    dom=DOM_PPERM4(f);
+    dom=DOM_PPERM(f);
     //renew pointers since RANK_PPERM can trigger garbage collection
     ptp4=ADDR_PERM4(perm);
     ptf4=ADDR_PPERM4(f);
   if(TNUM_OBJ(f)==T_PPERM2){
     if(DEG_PPERM2(f)==0) return True;
     rankf=RANK_PPERM2(f);
-    domf=DOM_PPERM2(f);
+    domf=DOM_PPERM(f);
   } else {
     if(DEG_PPERM4(f)==0) return True;
     rankf=RANK_PPERM4(f);
-    domf=DOM_PPERM4(f);
+    domf=DOM_PPERM(f);
   }
 
   if(TNUM_OBJ(g)==T_PPERM2){
     if(DEG_PPERM2(g)==0) return False;
     rankg=RANK_PPERM2(g);
-    domg=DOM_PPERM2(g);
+    domg=DOM_PPERM(g);
   } else {
     if(DEG_PPERM4(g)==0) return False;
     rankg=RANK_PPERM4(g);
-    domg=DOM_PPERM2(f);
+    domg=DOM_PPERM(f);
   }
   
   if(rankf!=rankg) return (rankf<rankg?True:False);
 
 Obj FuncHAS_DOM_PPERM( Obj self, Obj f ){
   if(TNUM_OBJ(f)==T_PPERM2){
-    return (DOM_PPERM2(f)==NULL?False:True);
+    return (DOM_PPERM(f)==NULL?False:True);
   } else if (TNUM_OBJ(f)==T_PPERM4){
-    return (DOM_PPERM4(f)==NULL?False:True);
+    return (DOM_PPERM(f)==NULL?False:True);
   }
   return Fail;
 }
 
 Obj FuncHAS_IMG_PPERM( Obj self, Obj f ){
   if(TNUM_OBJ(f)==T_PPERM2){
-    return (IMG_PPERM2(f)==NULL?False:True);
+    return (IMG_PPERM(f)==NULL?False:True);
   } else if (TNUM_OBJ(f)==T_PPERM4){
-    return (IMG_PPERM4(f)==NULL?False:True);
+    return (IMG_PPERM(f)==NULL?False:True);
   }
   return Fail;
 }
   if(TNUM_OBJ(f)==T_PPERM2){//this could be shortened
     deg=MAX(DEG_PPERM2(f),CODEG_PPERM2(f));
     rank=RANK_PPERM2(f);
-    dom=DOM_PPERM2(f);
-    img=IMG_PPERM2(f);
+    dom=DOM_PPERM(f);
+    img=IMG_PPERM(f);
   }else{
     deg=MAX(DEG_PPERM4(f),CODEG_PPERM4(f));
     rank=RANK_PPERM4(f);
-    dom=DOM_PPERM4(f);
-    img=IMG_PPERM4(f);
+    dom=DOM_PPERM(f);
+    img=IMG_PPERM(f);
   }
 
   if(deg<65536){ 
   for(i=0;i<n;i++) ptseen[i]=0; 
   
   rank=RANK_PPERM2(f);//finds dom and img too
-  dom=DOM_PPERM2(f);
-  img=IMG_PPERM2(f);
+  dom=DOM_PPERM(f);
+  img=IMG_PPERM(f);
 
   ptf2=ADDR_PPERM2(f);
   ptseen=(UInt4*)(ADDR_OBJ(TmpPPerm));
   for(i=0;i<n;i++) ptseen[i]=0; 
   
   rank=RANK_PPERM4(f);//finds dom and img too
-  dom=DOM_PPERM4(f);
-  img=IMG_PPERM4(f);
+  dom=DOM_PPERM(f);
+  img=IMG_PPERM(f);
 
   ptseen=(UInt4*)(ADDR_OBJ(TmpPPerm));
   ptf4=ADDR_PPERM4(f);
 
   if(deg!=DEG_PPERM2(g)||CODEG_PPERM2(f)!=CODEG_PPERM2(g)) return 0L;
      
-  if(DOM_PPERM2(f)==NULL||DOM_PPERM2(g)==NULL){ 
+  if(DOM_PPERM(f)==NULL||DOM_PPERM(g)==NULL){ 
     for(i=0;i<deg;i++) if(*ptf++!=*ptg++) return 0L;
     return 1L;
   }
 
   if(RANK_PPERM2(f)!=RANK_PPERM2(g)) return 0L;
-  dom=DOM_PPERM2(f);
+  dom=DOM_PPERM(f);
   rank=RANK_PPERM2(f);
   
   for(i=1;i<=rank;i++){
 
   if(deg!=DEG_PPERM4(g)||CODEG_PPERM2(f)!=CODEG_PPERM4(g)) return 0L;
      
-  if(DOM_PPERM2(f)==NULL||DOM_PPERM4(g)==NULL){ 
+  if(DOM_PPERM(f)==NULL||DOM_PPERM(g)==NULL){ 
     for(i=0;i<deg;i++) if(*(ptf++)!=*(ptg++)) return 0L;
     return 1L;
   }
 
   if(RANK_PPERM2(f)!=RANK_PPERM4(g)) return 0L;
-  dom=DOM_PPERM2(f);
+  dom=DOM_PPERM(f);
   rank=RANK_PPERM2(f);
   
   for(i=1;i<=rank;i++){
 
   if(deg!=DEG_PPERM2(g)||CODEG_PPERM4(f)!=CODEG_PPERM2(g)) return 0L;
      
-  if(DOM_PPERM4(f)==NULL||DOM_PPERM2(g)==NULL){ 
+  if(DOM_PPERM(f)==NULL||DOM_PPERM(g)==NULL){ 
     for(i=0;i<deg;i++) if(*(ptf++)!=*(ptg++)) return 0L;
     return 1L;
   }
 
   if(RANK_PPERM4(f)!=RANK_PPERM2(g)) return 0L;
-  dom=DOM_PPERM4(f);
+  dom=DOM_PPERM(f);
   rank=RANK_PPERM4(f);
   
   for(i=1;i<=rank;i++){
 
   if(deg!=DEG_PPERM4(g)||CODEG_PPERM4(f)!=CODEG_PPERM4(g)) return 0L;
      
-  if(DOM_PPERM4(f)==NULL||DOM_PPERM4(g)==NULL){ 
+  if(DOM_PPERM(f)==NULL||DOM_PPERM(g)==NULL){ 
     for(i=0;i<deg;i++) if(*(ptf++)!=*(ptg++)) return 0L;
     return 1L;
   }
 
   if(RANK_PPERM4(f)!=RANK_PPERM4(g)) return 0L;
-  dom=DOM_PPERM4(f);
+  dom=DOM_PPERM(f);
   rank=RANK_PPERM4(f);
   
   for(i=1;i<=rank;i++){
   codeg=0;
  
   // compose in rank operations
-  if(DOM_PPERM2(f)!=NULL){
-    dom=DOM_PPERM2(f); 
+  if(DOM_PPERM(f)!=NULL){
+    dom=DOM_PPERM(f); 
     rank=RANK_PPERM2(f);
     for(i=1;i<=rank;i++){
       j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   codeg=0;
  
   // compose in rank operations
-  if(DOM_PPERM4(f)!=NULL){
-    dom=DOM_PPERM4(f); 
+  if(DOM_PPERM(f)!=NULL){
+    dom=DOM_PPERM(f); 
     rank=RANK_PPERM4(f);
     for(i=1;i<=rank;i++){
       j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   codeg=0;
  
   // compose in rank operations
-  if(DOM_PPERM4(f)!=NULL){
-    dom=DOM_PPERM4(f); 
+  if(DOM_PPERM(f)!=NULL){
+    dom=DOM_PPERM(f); 
     rank=RANK_PPERM4(f);
     for(i=1;i<=rank;i++){
       j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   codeg=0;
  
   // compose in rank operations
-  if(DOM_PPERM2(f)!=NULL){
-    dom=DOM_PPERM2(f); 
+  if(DOM_PPERM(f)!=NULL){
+    dom=DOM_PPERM(f); 
     rank=RANK_PPERM2(f);
     for(i=1;i<=rank;i++){
       j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
     ptfp2=ADDR_PPERM2(fp);
     if(codeg<=dep){
       codeg=0;
-      if(DOM_PPERM2(f)==NULL){
+      if(DOM_PPERM(f)==NULL){
         //Pr("Case 2\n", 0L, 0L);
         for(i=0;i<deg;i++){ 
           if(ptf[i]!=0){
         }
       } else {
         //Pr("Case 1\n", 0L, 0L);
-        dom=DOM_PPERM2(f);
+        dom=DOM_PPERM(f);
         rank=RANK_PPERM2(f);
         for(i=1;i<=rank;i++){
           j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
         }
       }
     } else {
-      if(DOM_PPERM2(f)==NULL){
+      if(DOM_PPERM(f)==NULL){
        //Pr("Case 4\n", 0L, 0L);
         for(i=0;i<deg;i++){
           if(ptf[i]!=0){
         }
       }else{
         //Pr("Case 3\n", 0L, 0L);
-        dom=DOM_PPERM2(f);
+        dom=DOM_PPERM(f);
         rank=RANK_PPERM2(f);
         for(i=1;i<=rank;i++){
           j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   } else {
     ptfp4=ADDR_PPERM4(fp);
     codeg=0;
-    if(DOM_PPERM2(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       //Pr("Case 6\n", 0L, 0L);
       for(i=0;i<deg;i++){
         if(ptf[i]!=0){
       }
     } else {
       //Pr("Case 5\n", 0L, 0L);
-      dom=DOM_PPERM2(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM2(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   
   if(codeg<=dep){
     codeg=0;
-    if(DOM_PPERM4(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       //Pr("case 1\n", 0L, 0L);
       for(i=0;i<deg;i++){ 
         if(ptf[i]!=0){
       }
     } else {
       //Pr("case 2\n", 0L, 0L);
-      dom=DOM_PPERM4(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM4(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
       }
     }
   } else {
-    if(DOM_PPERM4(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       //Pr("case 3\n", 0L, 0L);
       for(i=0;i<deg;i++){
         if(ptf[i]!=0){
       }
     }else{
       //Pr("case 4\n", 0L, 0L);
-      dom=DOM_PPERM4(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM4(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   ptfp=ADDR_PPERM4(fp);
   codeg=0;
   
-  if(DOM_PPERM2(f)==NULL){
+  if(DOM_PPERM(f)==NULL){
     deg=DEG_PPERM2(f);
     for(i=0;i<deg;i++){
       if(ptf[i]!=0){
       }
     }
   } else {
-    dom=DOM_PPERM2(f);
+    dom=DOM_PPERM(f);
     rank=RANK_PPERM2(f);
     for(i=1;i<=rank;i++){
       j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   ptp=ADDR_PERM2(p);
   ptfp=ADDR_PPERM4(fp);
   
-  if(DOM_PPERM4(f)==NULL){
+  if(DOM_PPERM(f)==NULL){
     //Pr("case 1\n", 0L, 0L);
     for(i=0;i<deg;i++){
       if(ptf[i]!=0){
     }
   }else{
     //Pr("case 2\n", 0L, 0L);
-    dom=DOM_PPERM4(f);
+    dom=DOM_PPERM(f);
     rank=RANK_PPERM4(f);
     for(i=1;i<=rank;i++){
       j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
     inv=NEW_PPERM2(codeg);
     ptf=ADDR_PPERM2(f);
     ptinv2=ADDR_PPERM2(inv);
-    if(DOM_PPERM2(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=0;i<deg;i++) if(ptf[i]!=0) ptinv2[ptf[i]-1]=i+1;
     } else {
-      dom=DOM_PPERM2(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM2(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
     inv=NEW_PPERM4(codeg);
     ptf=ADDR_PPERM2(f);
     ptinv4=ADDR_PPERM4(inv);
-    if(DOM_PPERM2(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=0;i<deg;i++) if(ptf[i]!=0) ptinv4[ptf[i]-1]=i+1;
     } else {
-      dom=DOM_PPERM2(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM2(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
     inv=NEW_PPERM2(codeg);
     ptf=ADDR_PPERM4(f);
     ptinv2=ADDR_PPERM2(inv);
-    if(DOM_PPERM2(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=0;i<deg;i++) if(ptf[i]!=0) ptinv2[ptf[i]-1]=i+1;
     } else {
-      dom=DOM_PPERM4(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM4(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
     inv=NEW_PPERM4(codeg);
     ptf=ADDR_PPERM4(f);
     ptinv4=ADDR_PPERM4(inv);
-    if(DOM_PPERM4(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       for(i=0;i<deg;i++) if(ptf[i]!=0) ptinv4[ptf[i]-1]=i+1;
     } else {
-      dom=DOM_PPERM4(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM4(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   dep=DEG_PERM2(p); 
   rank=RANK_PPERM2(f);
   ptp=ADDR_PERM2(p);
-  dom=DOM_PPERM2(f); 
+  dom=DOM_PPERM(f); 
   
   //find deg of conjugate
   if(deg>dep){
   dep=DEG_PERM4(p); 
   rank=RANK_PPERM2(f);
   ptp=ADDR_PERM4(p);
-  dom=DOM_PPERM2(f); 
+  dom=DOM_PPERM(f); 
   //find deg of conjugate
   if(deg>dep){
     degconj=deg;
   dep=DEG_PERM2(p); 
   rank=RANK_PPERM4(f);
   ptp=ADDR_PERM2(p);
-  dom=DOM_PPERM4(f); 
+  dom=DOM_PPERM(f); 
   
   //find deg of conjugate
   if(deg>dep){
   dep=DEG_PERM4(p); 
   rank=RANK_PPERM4(f);
   ptp=ADDR_PERM4(p);
-  dom=DOM_PPERM4(f); 
+  dom=DOM_PPERM(f); 
   
   //find deg of conjugate
   if(deg>dep){
  
   ptf=ADDR_PPERM2(f);
   ptg=ADDR_PPERM2(g);
-  dom=DOM_PPERM2(f);
+  dom=DOM_PPERM(f);
   codeg=CODEG_PPERM2(g); 
   dec=0;
   codec=0;
  
   ptf=ADDR_PPERM2(f);
   ptg=ADDR_PPERM4(g);
-  dom=DOM_PPERM2(f);
+  dom=DOM_PPERM(f);
   codeg=CODEG_PPERM4(g); 
   dec=0;
   codec=0;
  
   ptf=ADDR_PPERM4(f);
   ptg=ADDR_PPERM2(g);
-  dom=DOM_PPERM4(f);
+  dom=DOM_PPERM(f);
   codeg=CODEG_PPERM2(g); 
   dec=0;
   codec=0;
  
   ptf=ADDR_PPERM4(f);
   ptg=ADDR_PPERM4(g);
-  dom=DOM_PPERM4(f);
+  dom=DOM_PPERM(f);
   codeg=CODEG_PPERM4(g); 
   dec=0;
   codec=0;
     ptquo2=ADDR_PPERM2(quo);
     if(codeg<=lmp){
       codeg=0;
-      if(DOM_PPERM2(f)==NULL){
+      if(DOM_PPERM(f)==NULL){
         //Pr("Case 2\n", 0L, 0L);
         for(i=0;i<deg;i++){ 
           if(ptf[i]!=0){
         }
       } else {
         //Pr("Case 1\n", 0L, 0L);
-        dom=DOM_PPERM2(f);
+        dom=DOM_PPERM(f);
         rank=RANK_PPERM2(f);
         for(i=1;i<=rank;i++){
           j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
         }
       }
     } else {
-      if(DOM_PPERM2(f)==NULL){
+      if(DOM_PPERM(f)==NULL){
        //Pr("Case 4\n", 0L, 0L);
         for(i=0;i<deg;i++){
           if(ptf[i]!=0){
         }
       }else{
         //Pr("Case 3\n", 0L, 0L);
-        dom=DOM_PPERM2(f);
+        dom=DOM_PPERM(f);
         rank=RANK_PPERM2(f);
         for(i=1;i<=rank;i++){
           j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
     pttmp=((UInt4*)ADDR_OBJ(TmpPPerm));
     ptquo4=ADDR_PPERM4(quo);
     codeg=0;
-    if(DOM_PPERM2(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       //Pr("Case 6\n", 0L, 0L);
       for(i=0;i<deg;i++){
         if(ptf[i]!=0){
       }
     } else {
       //Pr("Case 5\n", 0L, 0L);
-      dom=DOM_PPERM2(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM2(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
   //multiply the partial perm with the inverse
   if(codeg<=lmp){
     codeg=0;
-    if(DOM_PPERM4(f)==NULL){
+    if(DOM_PPERM(f)==NULL){
       //Pr("case 1\n", 0L, 0L);
       for(i=0;i<deg;i++){ 
         if(ptf[i]!=0){
       }
     } else {
       //Pr("case 2\n", 0L, 0L);
-      dom=DOM_PPERM4(f);
+      dom=DOM_PPERM(f);
       rank=RANK_PPERM4(f);
       for(i=1;i<=rank;i++){
         j=INT_INTOBJ(ELM_PLIST(dom, i))-1;
       }
     }