Skip to content

Commit

Permalink
Merge branch 'stable-4.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
markuspf committed Aug 19, 2016
2 parents 62b7a7c + a256ddd commit da0416e
Show file tree
Hide file tree
Showing 11 changed files with 147 additions and 70 deletions.
20 changes: 20 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# set clone depth
clone_depth: 5 # clone entire repository history if not defined

environment:
matrix:
- CYG_ARCH: x86
CYG_ROOT: C:/cygwin
- CYG_ARCH: x86_64
CYG_ROOT: C:/cygwin64

install:
- '%CYG_ROOT%\setup-%CYG_ARCH%.exe -qnNdO -R %CYG_ROOT% -s http://cygwin.mirror.constant.com -l %CYG_ROOT%/var/cache/setup -P autoconf -P automake -P bison -P libgmp-devel -P gcc-core -P gcc-g++ -P mingw-runtime -P mingw-binutils -P mingw-gcc-core -P mingw-gcc-g++ -P mingw-pthreads -P mingw-w32api -P libtool -P make -P python -P gettext-devel -P gettext -P intltool -P libiconv -P pkg-config -P git -P wget -P curl'

# scripts that run after cloning repository
build_script:
- '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER && sed -i -e \"s/wget/wget -nv/g\" Makefile.in"'
- '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER ; ./configure --with-gmp=system && make cygwin && make bootstrap-pkg-full"'

test_script:
- '%CYG_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER ; make testinstall"'
2 changes: 1 addition & 1 deletion grp/simple.gi
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ local g;
fi;
g:=CallFuncList(ValueGlobal("AtlasGroup"),params);
if not IsGroup(g) then
Error("The AtlasGroup package could not load a group with parameters ",params);
Error("The AtlasRep package could not load a group with parameters ",params);
fi;
SetName(g,params[1]);
if not '.' in params[1] then
Expand Down
2 changes: 1 addition & 1 deletion lib/algfld.gi
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ local f,p,nam,e,fam,colf;
fi;

# AH: Noch VR-Eigenschaften!
SetDimension( e, DegreeOverPrimeField( e ) );
SetDimension( e, DegreeOfUnivariateLaurentPolynomial( p ) );

SetOne(e,One(fam));
SetZero(e,Zero(fam));
Expand Down
7 changes: 5 additions & 2 deletions lib/groebner.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ end);
InstallMethod( NaturalHomomorphismByIdeal,"polynomial rings",IsIdenticalObj,
[ IsPolynomialRing,IsRing],
function(R,I)
local ord,b,ind,num,c,corners,i,j,a,bound,mon,n,monb,dim,sc,k,l,char,hom;
local ord,b,ind,num,c,corners,i,j,a,rem,bound,mon,n,monb,dim,sc,k,l,char,hom;
if not IsIdeal(R,I) then
Error("I is not an ideal!");
fi;
Expand Down Expand Up @@ -1300,10 +1300,12 @@ function(R,I)
a[i]:=a[i]+1;
fi;
od;

if i>0 then
if ForAny(corners,x->ForAll([1..n],j->x[j]<=a[j])) then
# set last coordinate to become 0 again
a[n]:=bound[n];
i:=n;
else
Add(mon,ShallowCopy(a));
i:=Length(a);
Expand All @@ -1320,7 +1322,8 @@ function(R,I)
sc:=EmptySCTable(dim,0);
for i in [1..dim] do
for j in [1..dim] do
a:=PolynomialReducedRemainder(mon[i]*mon[j],b,ord);
rem:=PolynomialReducedRemainder(mon[i]*mon[j],b,ord);
a:=rem;
if not IsZero(a) then
a:=Coefficients(monb,a);
if char>0 then
Expand Down
2 changes: 1 addition & 1 deletion src/bool.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ static Int InitKernel (
StructInitInfo * module )
{
/* install the marking functions for boolean values */
InfoBags[ T_BOOL ].name = "boolean";
InfoBags[ T_BOOL ].name = "boolean or fail";
InitMarkFuncBags( T_BOOL, MarkNoSubBags );

/* init filters and functions */
Expand Down
68 changes: 3 additions & 65 deletions src/streams.c
Original file line number Diff line number Diff line change
Expand Up @@ -1967,83 +1967,21 @@ Obj FuncWRITE_STRING_FILE_NC (
return True;
}


Obj FuncREAD_STRING_FILE (
Obj self,
Obj fid )
{
Char buf[32769];
Int ret, len, l;
UInt lstr;
Obj str;
char *ptr;

/* check the argument */
while ( ! IS_INTOBJ(fid) ) {
fid = ErrorReturnObj(
"<fid> must be an integer (not a %s)",
(Int)TNAM_OBJ(fid), 0L,
"you can replace <fid> via 'return <fid>;'" );
}

#if ! SYS_IS_CYGWIN32
/* fstat seems completely broken under CYGWIN */
#if HAVE_STAT
/* first try to get the whole file as one chunk, this avoids garbage
collections because of the GROW_STRING calls below */
{
struct stat fstatbuf;
if ( syBuf[INT_INTOBJ(fid)].pipe == 0 &&
fstat( syBuf[INT_INTOBJ(fid)].fp, &fstatbuf) == 0 ) {
if((off_t)(Int)fstatbuf.st_size != fstatbuf.st_size) {
ErrorMayQuit(
"The file is too big to fit the current workspace",
(Int)0, (Int)0);
}
len = (Int) fstatbuf.st_size;
str = NEW_STRING( len );
CHARS_STRING(str)[len] = '\0';
SET_LEN_STRING(str, len);
ptr = CSTR_STRING(str);
while (len > 0) {
l = (len > 1048576) ? 1048576 : len;
ret = read( syBuf[INT_INTOBJ(fid)].fp, ptr, l);
if (ret == -1) {
SySetErrorNo();
return Fail;
}
len -= ret;
ptr += ret;
}
return str;
}
}
#endif
#endif
/* read <fid> until we see eof (in 32kB pieces) */
str = NEW_STRING(0);
len = 0;
while (1) {
if ( (ret = read( syBuf[INT_INTOBJ(fid)].fp , buf, 32768)) <= 0 ) {
SySetErrorNo();
return Fail;
}
len += ret;
GROW_STRING( str, len );
lstr = GET_LEN_STRING(str);
memcpy( CHARS_STRING(str)+lstr, buf, ret );
*(CHARS_STRING(str)+lstr+ret) = '\0';
SET_LEN_STRING(str, lstr+ret);
if ( syBuf[INT_INTOBJ(fid)].pipe == 1 ) {
ErrorMayQuit("<fid> is a pipe, not a file", 0L, 0L);
}

/* fix the length of <str> */
len = GET_LEN_STRING(str);
ResizeBag( str, SIZEBAG_STRINGLEN(len) );

/* and return */

syBuf[INT_INTOBJ(fid)].ateof = 1;
return len == 0 ? Fail : str;
return SyReadStringFile(INT_INTOBJ(fid));
}

/****************************************************************************
Expand Down
75 changes: 75 additions & 0 deletions src/sysfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -3708,7 +3708,82 @@ Char * SyTmpdir ( const Char * hint )
#endif
#endif

#if !defined(SYS_IS_CYGWIN32) && defined(HAVE_STAT)
/* fstat seems completely broken under CYGWIN */
/* first try to get the whole file as one chunk, this avoids garbage
collections because of the GROW_STRING calls below */
Obj SyReadStringFile(Int fid)
{
Int ret, len;
Obj str;
Int l;
char *ptr;
struct stat fstatbuf;

if( fstat( syBuf[fid].fp, &fstatbuf) == 0 ) {
if((off_t)(Int)fstatbuf.st_size != fstatbuf.st_size) {
ErrorMayQuit(
"The file is too big to fit the current workspace",
(Int)0, (Int)0);
}
len = (Int) fstatbuf.st_size;
str = NEW_STRING( len );
CHARS_STRING(str)[len] = '\0';
SET_LEN_STRING(str, len);
ptr = CSTR_STRING(str);
while (len > 0) {
l = (len > 1048576) ? 1048576 : len;
ret = read( syBuf[fid].fp, ptr, l);
if (ret == -1) {
SySetErrorNo();
return Fail;
}
len -= ret;
ptr += ret;
}
syBuf[fid].ateof = 1;
return str;
} else {
SySetErrorNo();
return Fail;
}
}

#else

Obj SyReadStringFile(Int fid)
{
Char buf[32769];
Int ret, len;
UInt lstr;
Obj str;

/* read <fid> until we see eof (in 32kB pieces) */
str = NEW_STRING(0);
len = 0;
do {
ret = read( syBuf[fid].fp , buf, 32768);
if (ret < 0) {
SySetErrorNo();
return Fail;
}
len += ret;
GROW_STRING( str, len );
lstr = GET_LEN_STRING(str);
memcpy( CHARS_STRING(str)+lstr, buf, ret );
*(CHARS_STRING(str)+lstr+ret) = '\0';
SET_LEN_STRING(str, lstr+ret);
} while(ret > 0);

/* fix the length of <str> */
len = GET_LEN_STRING(str);
ResizeBag( str, SIZEBAG_STRINGLEN(len) );

syBuf[fid].ateof = 1;
return str;
}

#endif

/****************************************************************************
**
Expand Down
9 changes: 9 additions & 0 deletions src/sysfiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,15 @@ extern void syWinPut (
const Char * cmd,
const Char * str );

/***************************************************************************
**
*F SyReadFileString( <fid> )
** - read file given by <fid> file into a string
*/

extern Obj SyReadStringFile (
Int fid );



/****************************************************************************
Expand Down
2 changes: 2 additions & 0 deletions tst/testinstall/boolean.tst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ gap> ViewString(true); ViewString(false); ViewString(fail);
"true"
"false"
"fail"
gap> TNUM_OBJ(fail)[2];
"boolean or fail"
gap> STOP_TEST( "boolean.tst", 250000);

#############################################################################
Expand Down
9 changes: 9 additions & 0 deletions tst/testinstall/read.tst
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,13 @@ gap> SeekPositionStream(x, 3);
true
gap> ReadAll(x);
"lo\ngoodbye\ni like pies\n"
gap> StringFile(Filename( DirectoriesLibrary("tst"), "example.txt" ));
"hello\ngoodbye\ni like pies\n"
gap> dir := DirectoryTemporary();;
gap> FileString( Filename(dir, "tmp1"), "Hello, world!");
13
gap> StringFile( Filename(dir, "tmp2"));
fail
gap> StringFile( Filename(dir, "tmp1"));
"Hello, world!"
gap> STOP_TEST( "read.tst", 220000);
21 changes: 21 additions & 0 deletions tst/teststandard/bugfix.tst
Original file line number Diff line number Diff line change
Expand Up @@ -3114,6 +3114,27 @@ gap> Intersection([]);
gap> IsFilter(IsObject);
true

#2016/8/1 (#869)
gap> x:=X(GF(4));;e:=AlgebraicExtension(GF(4),x^3+x+1);;
gap> Length(Elements(e));
64
gap> Length(Set(Elements(e)));
64

#2016/8/4 (AH, Reported by D. Savchuk)
gap> r1:=PolynomialRing(GF(2),3);
GF(2)[x_1,x_2,x_3]
gap> x_1:=r1.1;;x_2:=r1.2;;x_3:=r1.3;;
gap> I:=Ideal(r1,[x_1^2-x_2,x_2^2-x_1,x_1*x_2-x_3]);;
gap> Size(r1/I);
16
gap> r1:=PolynomialRing(GF(2),4);;
gap> x_1:=r1.1;;x_2:=r1.2;;x_3:=r1.3;;x_4:=r1.4;;
gap> rels:=[x_1^2+x_2,x_1*x_2+x_3,x_1*x_3+x_4, x_1*x_4+x_1,x_2^2+x_4,
> x_2*x_3+x_1,x_2*x_4+x_2,x_3^2+x_2,x_3*x_4+x_3,x_4^2+x_4];;
gap> Size(r1/Ideal(r1,rels));
32

#############################################################################
gap> STOP_TEST( "bugfix.tst", 831990000);

Expand Down

0 comments on commit da0416e

Please sign in to comment.