Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions check/fixes.frm
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,63 @@ assert stdout =~ exact_pattern(<<'EOF')
F
EOF
*--#] Issue129_2 :
*--#[ Issue138_1 :
CFunction f,a,b,c,d;
Symbol x,y;
Local F = (1+f((a+b)^2,(a+b)*(c*d)))^20;
.sort
Identify f(x?,y?) = f(gcd_(x,y));
ToPolynomial;
.sort
FromPolynomial;
Identify f(a+b) = -1;
Print;
.end
assert succeeded?
assert result("F") =~ expr("0")
*--#] Issue138_1 :
*--#[ Issue138_2 :
CFunction f,g;
Symbol x,y;
Local F = (1+f((g(x)+g(y))^2))^20;
FactArg f;
ToPolynomial;
.sort
FromPolynomial;
Identify f(g(x)+g(y),g(x)+g(y)) = -1;
Print;
.end
assert succeeded?
assert result("F") =~ expr("0")
*--#] Issue138_2 :
*--#[ Issue138_3 :
CFunction f,g;
Symbol x,y;
Local F = (1+f((g(x)+g(y))^2))^20;
FactArg f;
ArgToExtraSymbol g;
.sort
FromPolynomial;
Identify f(g(x)+g(y),g(x)+g(y)) = -1;
Print;
.end
assert succeeded?
assert result("F") =~ expr("0")
*--#] Issue138_3 :
*--#[ Issue138_4 :
CFunction f,g,h;
Symbol x,y;
Local F = (1+f((g(x)+g(y)+h(x)+h(y))^2))^20;
ArgToExtraSymbol g;
FactArg f;
.sort
FromPolynomial;
Identify f(g(x)+g(y)+h(x)+h(y),g(x)+g(y)+h(x)+h(y)) = -1;
Print;
.end
assert succeeded?
assert result("F") =~ expr("0")
*--#] Issue138_4 :
*--#[ Issue139 :
* Corrupted characters in printing f(-2147483648)
CF f;
Expand Down
8 changes: 4 additions & 4 deletions sources/argument.c
Original file line number Diff line number Diff line change
Expand Up @@ -2076,7 +2076,7 @@ int ArgFactorize(PHEAD WORD *argin, WORD *argout)
#ifdef NEWORDER
WORD *tt;
#endif
WORD startebuf = cbuf[AT.ebufnum].numrhs,oldword;
WORD startebuf = cbuf[AT.ebufnum].numrhs, extrasymbolbase = -1, oldword;
WORD oldsorttype = AR.SortType, numargs;
int error = 0, action = 0, i, ii, number, sign = 1;

Expand Down Expand Up @@ -2254,7 +2254,7 @@ int ArgFactorize(PHEAD WORD *argin, WORD *argout)
argextra = AT.WorkPointer;
NewSort(BHEAD0);
while ( t < tstop ) {
if ( LocalConvertToPoly(BHEAD t,argextra,startebuf,0) < 0 ) {
if ( LocalConvertToPoly(BHEAD t,argextra,startebuf,0,&extrasymbolbase) < 0 ) {
error = -1;
getout:
AR.SortType = oldsorttype;
Expand Down Expand Up @@ -2309,8 +2309,8 @@ int ArgFactorize(PHEAD WORD *argin, WORD *argout)
argextra = AT.WorkPointer;
NewSort(BHEAD0);
while ( t < tstop ) {
if ( ConvertFromPoly(BHEAD t,argextra,numxsymbol,CC->numrhs-startebuf+numxsymbol
,startebuf-numxsymbol,1) <= 0 ) {
if ( ConvertFromPoly(BHEAD t,argextra,extrasymbolbase,CC->numrhs-startebuf+extrasymbolbase
,startebuf-extrasymbolbase,1) <= 0 ) {
TermFree(argcopy2,"argcopy2");
LowerSortLevel();
error = -3;
Expand Down
19 changes: 2 additions & 17 deletions sources/compcomm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2223,11 +2223,6 @@ int CoSplitLastArg(UBYTE *s) { return(DoArgument(s,TYPESPLITLASTARG)); }
*/

int CoFactArg(UBYTE *s) {
if ( ( AC.topolynomialflag & TOPOLYNOMIALFLAG ) != 0 ) {
MesPrint("&ToPolynomial statement and FactArg statement are not allowed in the same module");
return(1);
}
AC.topolynomialflag |= FACTARGFLAG;
return(DoArgument(s,TYPEFACTARG));
}

Expand Down Expand Up @@ -5953,9 +5948,8 @@ int CoDropSymbols(UBYTE *s)

Converts the current term as much as possible to symbols.
Keeps a list of all objects converted to symbols in AM.sbufnum.
Note that this cannot be executed in parallel because we have only
a single compiler buffer for this. Hence we switch on the noparallel
module option.
There is only a single compiler buffer for this. In TFORM we protect access
to it with AM.sbuflock; in ParFORM the statement is executed on the master.

Option(s):
OnlyFunctions [,name1][,name2][,...,namem];
Expand All @@ -5965,10 +5959,6 @@ int CoToPolynomial(UBYTE *inp)
{
int error = 0;
while ( *inp == ' ' || *inp == ',' || *inp == '\t' ) inp++;
if ( ( AC.topolynomialflag & ~TOPOLYNOMIALFLAG ) != 0 ) {
MesPrint("&ToPolynomial statement and FactArg statement are not allowed in the same module");
return(1);
}
if ( AO.OptimizeResult.code != NULL ) {
MesPrint("&Using ToPolynomial statement when there are still optimization results active.");
MesPrint("&Please use #ClearOptimize instruction first.");
Expand Down Expand Up @@ -6067,11 +6057,6 @@ int CoArgToExtraSymbol(UBYTE *s)
CBUF *C = cbuf + AC.cbufnum;
WORD *lhs;

/* TODO: resolve interference with rational arithmetic. (#138) */
if ( ( AC.topolynomialflag & ~TOPOLYNOMIALFLAG ) != 0 ) {
MesPrint("&ArgToExtraSymbol statement and FactArg statement are not allowed in the same module");
return(1);
}
if ( AO.OptimizeResult.code != NULL ) {
MesPrint("&Using ArgToExtraSymbol statement when there are still optimization results active.");
MesPrint("&Please use #ClearOptimize instruction first.");
Expand Down
2 changes: 2 additions & 0 deletions sources/comtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,8 @@ balance:;
Returns -1 if the element is not in the tree.
The advantage of this routine over InsTree is that this routine
can be run in parallel.
Note that this function is not actually thread-safe, due to the update
of "usage".
*/

int FindTree(int bufnum, WORD *subexpr)
Expand Down
8 changes: 4 additions & 4 deletions sources/declare.h
Original file line number Diff line number Diff line change
Expand Up @@ -1576,10 +1576,10 @@ extern int RunHtoZArg(PHEAD WORD *fun, WORD *args);
extern int NormPolyTerm(PHEAD WORD *);
extern WORD ComparePoly(WORD *, WORD *, WORD);
extern int ConvertToPoly(PHEAD WORD *, WORD *,WORD *,WORD);
extern int LocalConvertToPoly(PHEAD WORD *, WORD *, WORD,WORD);
extern int LocalConvertToPoly(PHEAD WORD *, WORD *, WORD,WORD,WORD *);
extern int ConvertFromPoly(PHEAD WORD *, WORD *, WORD, WORD, WORD, WORD);
extern int FindSubterm(WORD *);
extern int FindLocalSubterm(PHEAD WORD *, WORD);
extern int FindLocalSubterm(PHEAD WORD *, WORD, WORD);
extern void PrintSubtermList(int,int);
extern void PrintExtraSymbol(int,WORD *,int);
extern int FindSubexpression(WORD *);
Expand All @@ -1606,8 +1606,8 @@ extern WORD *PolyDiv(PHEAD WORD *,WORD *,char *);
extern void GCDclean(PHEAD WORD *, WORD *);
extern WORD *TakeSymbolContent(PHEAD WORD *,WORD *);
extern int GCDterms(PHEAD WORD *,WORD *,WORD *);
extern WORD *PutExtraSymbols(PHEAD WORD *,WORD,int *);
extern WORD *TakeExtraSymbols(PHEAD WORD *,WORD);
extern WORD *PutExtraSymbols(PHEAD WORD *,WORD,int *,WORD *);
extern WORD *TakeExtraSymbols(PHEAD WORD *,WORD,WORD);
extern WORD *MultiplyWithTerm(PHEAD WORD *, WORD *,WORD);
extern WORD *TakeContent(PHEAD WORD *, WORD *);
extern int MergeSymbolLists(PHEAD WORD *, WORD *, int);
Expand Down
8 changes: 4 additions & 4 deletions sources/dollar.c
Original file line number Diff line number Diff line change
Expand Up @@ -2949,7 +2949,7 @@ int DollarFactorize(PHEAD WORD numdollar)
#endif
int i, j, jj, action = 0, sign = 1;
LONG insize, ii;
WORD startebuf = cbuf[AT.ebufnum].numrhs;
WORD startebuf = cbuf[AT.ebufnum].numrhs, extrasymbolbase = -1;
WORD nfactors, factorsincontent, extrafactor = 0;
WORD oldsorttype = AR.SortType;

Expand Down Expand Up @@ -3144,7 +3144,7 @@ int DollarFactorize(PHEAD WORD numdollar)
NewSort(BHEAD0);
NewSort(BHEAD0);
while ( *t ) {
if ( LocalConvertToPoly(BHEAD t,termextra,startebuf,0) < 0 ) {
if ( LocalConvertToPoly(BHEAD t,termextra,startebuf,0,&extrasymbolbase) < 0 ) {
getout:
AR.SortType = oldsorttype;
M_free(buf1,"DollarFactorize-2");
Expand Down Expand Up @@ -3274,8 +3274,8 @@ int DollarFactorize(PHEAD WORD numdollar)
NewSort(BHEAD0);
NewSort(BHEAD0);
while ( *term ) {
if ( ConvertFromPoly(BHEAD term,argextra,numxsymbol,CC->numrhs-startebuf+numxsymbol
,startebuf-numxsymbol,1) <= 0 ) {
if ( ConvertFromPoly(BHEAD term,argextra,extrasymbolbase,CC->numrhs-startebuf+extrasymbolbase
,startebuf-extrasymbolbase,1) <= 0 ) {
LowerSortLevel();
getout2: AR.SortType = oldsorttype;
M_free(d->factors,"factors in dollar");
Expand Down
1 change: 0 additions & 1 deletion sources/ftypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,6 @@ typedef int (*TFUN1)(UBYTE *,int);
#define NOLYNDON 2

#define TOPOLYNOMIALFLAG 1
#define FACTARGFLAG 2

#define OLDFACTARG 1
#define NEWFACTARG 0
Expand Down
Loading
Loading