Skip to content

Commit

Permalink
Snapshot.
Browse files Browse the repository at this point in the history
git-svn-id: svn://helios.math.rwth-aachen.de/home2/thuban/svnuser/orb/trunk/orb@223 84b55aed-c907-0410-b598-ae02b0970699
  • Loading branch information
neunhoef committed Mar 18, 2009
1 parent cdd69f7 commit eb77436
Show file tree
Hide file tree
Showing 7 changed files with 291 additions and 61 deletions.
27 changes: 0 additions & 27 deletions Makefile

This file was deleted.

80 changes: 80 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#
# makefile for the orb package Max Neunhoeffer
#
## Copyright (C) 2009 Max Neunhoeffer
## This file is free software, see license information at the end.
#
CC=cc

COMPILEOPTIONS="-O3 -fomit-frame-pointer"
#COMPILEOPTIONS="-O3 -g -fomit-frame-pointer"
#COMPILEOPTIONS="-O0 -g -Wall"
# Some experiments:
#COMPILEOPTIONS="-march=i686 -mcpu=pentium4 -O3 -fomit-frame-pointer"
#COMPILEOPTIONS="-march=i686 -mcpu=pentium4 -O3 -fomit-frame-pointer -falign-loops=5 -finline-limit=6000"

GAPINCL=-I$(GAPPATH)/src -I$(GAPPATH)/bin/@GAPARCH@

.PHONY: bindir clean doc test

default: bindir bin/@GAPARCH@/orb.so

# this target creates a bin-directory
bindir:
if test ! -d bin; then mkdir bin; fi
if test ! -d bin/@GAPARCH@; then mkdir bin/@GAPARCH@; fi

bin/@GAPARCH@/orb.so: src/orb.c
cp $(GAPPATH)/bin/@GAPARCH@/config.h bin/@GAPARCH@
$(GAPPATH)/bin/@GAPARCH@/gac -p ${COMPILEOPTIONS} -d -o bin/@GAPARCH@/orb.so src/orb.c

# make a statically linked GAP including the orb module
static:
(cd $(GAPPATH)/bin/@GAPARCH@; \
./gac -o gap-static -p "-DORBSTATIC" -p ${COMPILEOPTIONS} -P "-static" \
../../pkg/orb/src/orb.c)

doc: doc/manual.six

doc/manual.six: doc/basic.xml doc/hash.xml doc/orb.xml doc/search.xml \
doc/bysuborbit.xml doc/install.xml doc/quotfinder.xml \
doc/examples.xml doc/intro.xml doc/random.xml VERSION
($(GAPPATH)/bin/gap.sh makedoc.g)

clean:
(cd doc ; ./clean)
rm -rf bin/@GAPARCH@ Makefile

archive: doc
(cd .. ; tar czvf orb-`cat orb/VERSION`.tar.gz --exclude ".svn" --exclude bin --exclude test orb)

WEBPOS=/scratch/neunhoef/mywebpage.pub/Computer/Software/Gap/orb

towww: archive
echo '<?xml version="1.0" encoding="ISO-8859-1"?>' >${WEBPOS}.version
echo '<mixer>' >>${WEBPOS}.version
cat VERSION >>${WEBPOS}.version
echo '</mixer>' >>${WEBPOS}.version
cp PackageInfo.g ${WEBPOS}
cp README ${WEBPOS}/README.orb
cp doc/manual.pdf ${WEBPOS}/orb.pdf
cp ../orb-`cat VERSION`.tar.gz ${WEBPOS}
@echo
@echo Now please adjust the archive link in
@echo " " ${WEBPOS}.mixer !

##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; version 2 of the License.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##

16 changes: 16 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
# configure script for the orb package, Max Neunhoeffer
# usage: ./configure gappath
# this script creates a `Makefile' from `Makefile.in'
if [ x"$1" = "x" ]; then GAPPATH=../..; echo "Using ../.. as default GAP path";
else GAPPATH=$1; fi
rm -f Makefile sedfile
echo "#!/bin/sh" > Makefile
cat $GAPPATH/sysinfo.gap >> Makefile
echo "echo s/@GAPARCH@/\$GAParch/g >sedfile" >> Makefile
chmod +x Makefile
./Makefile
rm -f Makefile
echo GAPPATH=$GAPPATH >Makefile
sed -f sedfile Makefile.in >>Makefile
rm -f sedfile
8 changes: 8 additions & 0 deletions gap/avltree.gd
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,20 @@ DeclareGlobalFunction( "AVLTreeBalFactor_GAP" );
AVLTreeBalFactor := fail; # placeholder for later assignment
DeclareGlobalFunction( "AVLTreeSetBalFactor_GAP" );
AVLTreeSetBalFactor := fail; # placeholder for later assignment
DeclareGlobalFunction( "AVLTreeValue_GAP" );
AVLTreeValue := fail; # placeholder for later assignment
DeclareGlobalFunction( "AVLTreeSetValue_GAP" );
AVLTreeSetValue := fail; # placeholder for later assignment
DeclareGlobalFunction( "AVLTreeFind_GAP" );
AVLTreeFind := fail; # placeholder for later assignment
DeclareGlobalFunction( "AVLTreeLookup_GAP" );
AVLTreeLookup := fail; # placeholder for later assignment
DeclareGlobalFunction( "AVLTreeIndex_GAP" );
AVLTreeIndex := fail; # placeholder for later assignment
DeclareGlobalFunction( "AVLTreeRebalance_GAP" );
AVLTreeRebalance := fail; # placeholder for later assignment
DeclareGlobalFunction( "AVLTreeIndexLookup_GAP" );
AVLTreeIndexLookup := fail; # placeholder for later assignment
DeclareGlobalFunction( "AVLTreeAdd_GAP" );
AVLTreeAdd := fail; # placeholder for later assignment
DeclareGlobalFunction( "AVLTreeIndexAdd_GAP" );
Expand Down
109 changes: 95 additions & 14 deletions gap/avltree.gi
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
# ![4] alloc: highest allocated index, always = 3 mod 4
# ![5] three-way comparison function
# ![6] top: reference to top node
# ![7] unused
# ![7] value: plain list holding the values stored under the keys
# can be fail, in which case all stored values are "true"
# will be bound when first value other than true is set
#
# From index 8 on for every position = 0 mod 4:
# ![4n] obj: an object
Expand Down Expand Up @@ -60,8 +62,8 @@ else
AVLTreeCmp := AVLTreeCmp_GAP;
fi;

InstallGlobalFunction( AVLTree_GAP, function(cmpfunc)
# Parameters: cmpfunc
InstallGlobalFunction( AVLTree_GAP, function(arg)
# Parameters: cmpfunc (optional), default value is AVLTreeCmp
# Initializes balanced binary tree object, optionally with comparison
# function. Returns empty tree object.
# A comparison function takes 2 arguments and returns respectively -1, 0
Expand All @@ -71,7 +73,19 @@ InstallGlobalFunction( AVLTree_GAP, function(cmpfunc)
# only defined by the tree and not by an ordering of the elements. Such
# trees are managed by the special functions below. Specify "false"
# as the cmpfunc.
local t;
local t,cmpfunc;
if Length(arg) = 0 then
cmpfunc := AVLTreeCmp;
elif Length(arg) = 1 then
cmpfunc := arg[1];
if not(IsFunction(cmpfunc)) then
Error("Argument must be a three-way comparison function");
return fail;
fi;
else
Error("Usage: AVLTree( [three-way comparison function] )");
return fail;
fi;
t := [11,8,0,11,cmpfunc,0,fail,0,0,0,0];
Objectify(AVLTreeType,t);
return t;
Expand Down Expand Up @@ -122,6 +136,10 @@ fi;
InstallGlobalFunction( AVLTreeFreeNode_GAP, function(t,n)
t![n] := t![2];
t![2] := n;
n := n/4;
if IsBound(t![7]) and IsBound(t![7][n]) then
Unbind(t![7][n]);
fi;
end);
if IsBound(AVLTreeFreeNode_C) then
AVLTreeFreeNode := AVLTreeFreeNode_C;
Expand Down Expand Up @@ -239,6 +257,33 @@ else
AVLTreeSetBalFactor := AVLTreeSetBalFactor_GAP;
fi;

InstallGlobalFunction( AVLTreeValue_GAP, function(t,n)
if not(IsBound(t![7])) then
return true;
elif not(IsBound(t![7][n/4])) then
return true;
else
return t![7][n/4];
fi;
end);
if IsBound(AVLTreeValue_C) then
AVLTreeValue := AVLTreeValue_C;
else
AVLTreeValue := AVLTreeValue_GAP;
fi;

InstallGlobalFunction( AVLTreeSetValue_GAP, function(t,n,v)
n := n/4;
if not(IsBound(t![7])) then
t![7] := EmptyPlist(n);
fi;
t![n] := v;
end);
if IsBound(AVLTreeSetValue_C) then
AVLTreeSetValue := AVLTreeSetValue_C;
else
AVLTreeSetValue := AVLTreeSetValue_GAP;
fi;

InstallMethod( Display, "for an avltree object",
[IsAVLTree],
Expand Down Expand Up @@ -287,6 +332,20 @@ else
AVLTreeFind := AVLTreeFind_GAP;
fi;

InstallGlobalFunction( AVLTreeLookup_GAP, function(t,d)
local p;
p := AVLTreeFind(t,d);
if p = fail then
return fail;
else
return AVLTreeValue(t,p);
fi;
end);
if IsBound(AVLTreeLookup_C) then
AVLTreeLookup := AVLTreeLookup_C;
else
AVLTreeLookup := AVLTreeLookup_GAP;
fi;

InstallGlobalFunction( AVLTreeIndex_GAP, function(tree,index)
# Parameters: tree, index
Expand Down Expand Up @@ -324,7 +383,20 @@ else
AVLTreeIndex := AVLTreeIndex_GAP;
fi;


InstallGlobalFunction( AVLTreeIndexLookup, function(tree,i)
local p;
p := AVLTreeIndex(tree,i);
if p = fail then
return fail;
else
return AVLTreeValue(tree,p);
fi;
end);
if IsBound(AVLTreeIndexLookup_C) then
AVLTreeIndexLookup := AVLTreeIndexLookup_C;
else
AVLTreeIndexLookup := AVLTreeIndexLookup_GAP;
fi;

InstallGlobalFunction( AVLTreeRebalance_GAP, function(tree,q)
# the tree starting at q has balanced subtrees but is out of balance:
Expand Down Expand Up @@ -445,10 +517,11 @@ fi;



InstallGlobalFunction( AVLTreeAdd_GAP, function(tree,data)
# Parameters: tree, data
InstallGlobalFunction( AVLTreeAdd_GAP, function(tree,data,value)
# Parameters: tree, data, value
# tree is a AVLTree
# data is a data structure defined by the user
# value is the value stored under the key data, if true, nothing is stored
# Tries to add the data as a node in tree. It is an error, if there is
# already a node which is "equal" to data with respect to the comparison
# function. Returns true if everything went well or fail, if an equal
Expand All @@ -466,6 +539,9 @@ InstallGlobalFunction( AVLTreeAdd_GAP, function(tree,data)
AVLTreeSetBalFactor(tree,new,0);
AVLTreeSetRank(tree,new,1);
AVLTreeSetData(tree,new,data);
if value <> true then
AVLTreeSetValue(tree,new,value);
fi;
tree![3] := 1;
tree![6] := new;
return true;
Expand Down Expand Up @@ -525,6 +601,9 @@ InstallGlobalFunction( AVLTreeAdd_GAP, function(tree,data)
AVLTreeSetBalFactor(tree,p,0);
AVLTreeSetRank(tree,p,1);
AVLTreeSetData(tree,p,data);
if value <> true then
AVLTreeSetValue(tree,p,value);
fi;
# insert into tree:
if c < 0 then # left
AVLTreeSetLeft(tree,l,p);
Expand Down Expand Up @@ -571,11 +650,11 @@ else
fi;



InstallGlobalFunction( AVLTreeIndexAdd_GAP, function(tree,data,index)
# Parameters: index, data, tree
InstallGlobalFunction( AVLTreeIndexAdd_GAP, function(tree,data,value,index)
# Parameters: index, data, value, tree
# tree is a AVLTree
# data is a data structure defined by the user
# value is the value to be stored under key data, nothing is stored if true
# index is the index, where data should be inserted in tree 1 ist at
# first position, NumberOfNodes+1 after the last.
# Tries to add the data as a node in tree. Returns true if everything
Expand All @@ -596,6 +675,9 @@ InstallGlobalFunction( AVLTreeIndexAdd_GAP, function(tree,data,index)
AVLTreeSetBalFactor(tree,tree![6],0);
AVLTreeSetRank(tree,tree![6],1);
AVLTreeSetData(tree,tree![6],data);
if value <> true then
AVLTreeSetValue(tree,tree![6],value);
fi;
tree![3] := 1;
return true;
fi;
Expand Down Expand Up @@ -652,6 +734,9 @@ InstallGlobalFunction( AVLTreeIndexAdd_GAP, function(tree,data,index)
AVLTreeSetBalFactor(tree,p,0);
AVLTreeSetRank(tree,p,1);
AVLTreeSetData(tree,p,data);
if value <> true then
AVLTreeSetValue(tree,p,value);
fi;
# insert into tree:
if c < 0 then # left
AVLTreeSetLeft(tree,l,p);
Expand Down Expand Up @@ -697,8 +782,6 @@ else
AVLTreeIndexAdd := AVLTreeIndexAdd_GAP;
fi;



InstallGlobalFunction( AVLTreeDelete_GAP, function(tree,data)
# Parameters: tree, data
# tree is a AVLTree
Expand Down Expand Up @@ -873,8 +956,6 @@ else
AVLTreeDelete := AVLTreeDelete_GAP;
fi;



InstallGlobalFunction( AVLTreeIndexDelete_GAP, function(tree,index)
# Parameters: tree, index
# index is the index of the element to be deleted, must be between 1 and
Expand Down
Loading

0 comments on commit eb77436

Please sign in to comment.