Skip to content

Commit 6210e9e

Browse files
magvjodavies
authored andcommitted
Return int, not WORD, for error codes and the like
Also, drop declarations of some non-existing functions, and change a few (but not all) of the functions that always succeed to void.
1 parent 83399b1 commit 6210e9e

30 files changed

Lines changed: 385 additions & 404 deletions

sources/argument.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,15 @@
5353
need to insert a different value (C->lhs[level][2]).
5454
*/
5555

56-
WORD execarg(PHEAD WORD *term, WORD level)
56+
int execarg(PHEAD WORD *term, WORD level)
5757
{
5858
GETBIDENTITY
5959
WORD *t, *r, *m, *v;
6060
WORD *start, *stop, *rstop, *r1, *r2 = 0, *r3 = 0, *r4, *r5, *r6, *r7, *r8, *r9;
6161
WORD *mm, *mstop, *rnext, *rr, *factor, type, ngcd, nq;
6262
CBUF *C = cbuf+AM.rbufnum, *CC = cbuf+AT.ebufnum;
63-
WORD i, j, k, oldnumlhs = AR.Cnumlhs, count, action = 0, olddefer = AR.DeferFlag;
63+
WORD i, j, k, oldnumlhs = AR.Cnumlhs, count, olddefer = AR.DeferFlag;
64+
int action = 0;
6465
WORD oldnumrhs = CC->numrhs, size, pow, jj;
6566
LONG oldcpointer = CC->Pointer - CC->Buffer, oldppointer = AT.pWorkPointer, lp;
6667
WORD *oldwork = AT.WorkPointer, *oldwork2, scale, renorm;
@@ -1766,7 +1767,7 @@ oneterm:;
17661767
#[ execterm :
17671768
*/
17681769

1769-
WORD execterm(PHEAD WORD *term, WORD level)
1770+
int execterm(PHEAD WORD *term, WORD level)
17701771
{
17711772
GETBIDENTITY
17721773
CBUF *C = cbuf+AM.rbufnum;
@@ -2534,7 +2535,7 @@ WORD FindArg(PHEAD WORD *a)
25342535
* If par == 1 it inserts in the cache defined with the FactorCache statement
25352536
*/
25362537

2537-
WORD InsertArg(PHEAD WORD *argin, WORD *argout,int par)
2538+
int InsertArg(PHEAD WORD *argin, WORD *argout,int par)
25382539
{
25392540
CBUF *C;
25402541
WORD *a, i, bufnum;

sources/compiler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2244,7 +2244,7 @@ int CodeFactors(SBYTE *tokens)
22442244

22452245
WORD GenerateFactors(WORD n,WORD inc)
22462246
{
2247-
WORD subexp;
2247+
int subexp;
22482248
int i, error = 0;
22492249
SBYTE *s;
22502250
SBYTE *tokenbuffer = (SBYTE *)Malloc1(8*n*sizeof(SBYTE),"GenerateFactors");

sources/declare.h

Lines changed: 162 additions & 196 deletions
Large diffs are not rendered by default.

sources/diagrams.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,12 @@ int DoCanonicalize(PHEAD WORD *term, WORD *params)
347347

348348
#ifdef OLDTOPO
349349

350-
WORD GenTopologies(PHEAD WORD *term,WORD level)
350+
int GenTopologies(PHEAD WORD *term,WORD level)
351351
{
352352
WORD *t1, *tt1, *tstop, *t, *tt;
353353
WORD *oldworkpointer = AT.WorkPointer;
354354
WORD option1 = 0, option2 = 0, setoption = -1;
355-
WORD retval;
355+
int retval;
356356
/*
357357
358358
We have to go through the testing procedure again, because there could

sources/diawrap.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ Bool ProcessTopology(EGraph *eg, void *ti)
729729
// #] ProcessTopology :
730730
// #[ GenDiagrams :
731731

732-
WORD GenDiagrams(PHEAD WORD *term, WORD level)
732+
int GenDiagrams(PHEAD WORD *term, WORD level)
733733
{
734734
Model *model;
735735
MODEL *m;
@@ -959,7 +959,7 @@ int processVertex(TOPOTYPE *TopoInf, int pointsremaining, int level)
959959

960960
#define TOPO_MAXVERT 10
961961

962-
WORD GenTopologies(PHEAD WORD *term, WORD level)
962+
int GenTopologies(PHEAD WORD *term, WORD level)
963963
{
964964
Options *opt = new Options;
965965
int nlegs, nloops, i, identical;

sources/execute.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
par == 0 after .sort
4545
*/
4646

47-
WORD CleanExpr(WORD par)
47+
int CleanExpr(WORD par)
4848
{
4949
GETIDENTITY
5050
WORD j, n, i;
@@ -208,10 +208,11 @@ WORD CleanExpr(WORD par)
208208
209209
*/
210210

211-
WORD PopVariables(void)
211+
int PopVariables(void)
212212
{
213213
GETIDENTITY
214-
WORD i, j, retval;
214+
WORD i, j;
215+
int retval;
215216
UBYTE *s;
216217

217218
retval = CleanExpr(1);
@@ -612,10 +613,10 @@ restart:;
612613
#[ DoExecute :
613614
*/
614615

615-
WORD DoExecute(WORD par, WORD skip)
616+
int DoExecute(WORD par, WORD skip)
616617
{
617618
GETIDENTITY
618-
WORD RetCode = 0;
619+
int RetCode = 0;
619620
int i, oldmultithreaded = AS.MultiThreaded;
620621
#ifdef PARALLELCODE
621622
int j;
@@ -1108,7 +1109,7 @@ if ( AC.SwitchInArray > 0 ) {
11081109
15-oct-1991
11091110
*/
11101111

1111-
WORD PutBracket(PHEAD WORD *termin)
1112+
int PutBracket(PHEAD WORD *termin)
11121113
{
11131114
GETBIDENTITY
11141115
WORD *t, *t1, *b, i, j, *lastfun;

sources/findpat.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
to any of these sets.
5959
*/
6060

61-
WORD FindOnly(PHEAD WORD *term, WORD *pattern)
61+
int FindOnly(PHEAD WORD *term, WORD *pattern)
6262
{
6363
GETBIDENTITY
6464
WORD *t, *m;
@@ -416,7 +416,7 @@ EndLoop:;
416416
417417
*/
418418

419-
WORD FindOnce(PHEAD WORD *term, WORD *pattern)
419+
int FindOnce(PHEAD WORD *term, WORD *pattern)
420420
{
421421
GETBIDENTITY
422422
WORD *t, *m;
@@ -1067,7 +1067,7 @@ WORD FindMulti(PHEAD WORD *term, WORD *pattern)
10671067
10681068
*/
10691069

1070-
WORD FindRest(PHEAD WORD *term, WORD *pattern)
1070+
int FindRest(PHEAD WORD *term, WORD *pattern)
10711071
{
10721072
GETBIDENTITY
10731073
WORD *t, *m, *tt, wild, regular;

sources/float.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,7 @@ int ToRat(PHEAD WORD *term, WORD level)
14361436
#[ AddWithFloat :
14371437
*/
14381438

1439-
WORD AddWithFloat(PHEAD WORD **ps1, WORD **ps2)
1439+
int AddWithFloat(PHEAD WORD **ps1, WORD **ps2)
14401440
{
14411441
GETBIDENTITY
14421442
SORTING *S = AT.SS;
@@ -1557,11 +1557,12 @@ WORD AddWithFloat(PHEAD WORD **ps1, WORD **ps2)
15571557
does this as well.
15581558
*/
15591559

1560-
WORD MergeWithFloat(PHEAD WORD **interm1, WORD **interm2)
1560+
int MergeWithFloat(PHEAD WORD **interm1, WORD **interm2)
15611561
{
15621562
GETBIDENTITY
15631563
WORD *coef1, *coef2, size1, size2, *fun1, *fun2, *fun3, *tt;
1564-
WORD sign3,j,jj, *t1, *t2, i, *term1 = *interm1, *term2 = *interm2, retval = 0;
1564+
WORD sign3,j,jj, *t1, *t2, i, *term1 = *interm1, *term2 = *interm2;
1565+
int retval = 0;
15651566
coef1 = term1+*term1; size1 = coef1[-1]; coef1 -= ABS(size1);
15661567
coef2 = term2+*term2; size2 = coef2[-1]; coef2 -= ABS(size2);
15671568
if ( AT.SortFloatMode == 3 ) {

sources/function.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
function
4949
*/
5050

51-
WORD MakeDirty(WORD *term, WORD *x, WORD par)
51+
int MakeDirty(WORD *term, WORD *x, WORD par)
5252
{
5353
WORD *next, *n;
5454
if ( !par ) {
@@ -370,7 +370,7 @@ WORD Symmetrize(PHEAD WORD *func, WORD *Lijst, WORD ngroups, WORD gsize,
370370
1 if they are OK.
371371
*/
372372

373-
WORD CompGroup(PHEAD WORD type, WORD **args, WORD *a1, WORD *a2, WORD num)
373+
int CompGroup(PHEAD WORD type, WORD **args, WORD *a1, WORD *a2, WORD num)
374374
{
375375
GETBIDENTITY
376376
WORD *t1, *t2, i1, i2, n, k;
@@ -515,7 +515,7 @@ int FullSymmetrize(PHEAD WORD *fun, int type)
515515
>0 -> must have right number of arguments
516516
*/
517517

518-
WORD SymGen(PHEAD WORD *term, WORD *params, WORD num, WORD level)
518+
int SymGen(PHEAD WORD *term, WORD *params, WORD num, WORD level)
519519
{
520520
GETBIDENTITY
521521
WORD *t, *r, *m;
@@ -630,7 +630,7 @@ NextGroup:;
630630
631631
*/
632632

633-
WORD SymFind(PHEAD WORD *term, WORD *params)
633+
int SymFind(PHEAD WORD *term, WORD *params)
634634
{
635635
GETBIDENTITY
636636
WORD *t, *r, *m;
@@ -823,7 +823,7 @@ int ChainOut(PHEAD WORD *term, WORD funnum)
823823
?a,?b give a match that later turns out to be useless.
824824
*/
825825

826-
WORD MatchFunction(PHEAD WORD *pattern, WORD *interm, WORD *wilds)
826+
int MatchFunction(PHEAD WORD *pattern, WORD *interm, WORD *wilds)
827827
{
828828
GETBIDENTITY
829829
WORD *m, *t, *r, i;
@@ -1613,7 +1613,7 @@ endoloop:;
16131613
function. This will take care of whatever happens in MatchE etc.
16141614
*/
16151615

1616-
WORD ScanFunctions(PHEAD WORD *inpat, WORD *inter, WORD par)
1616+
int ScanFunctions(PHEAD WORD *inpat, WORD *inter, WORD par)
16171617
{
16181618
GETBIDENTITY
16191619
WORD i, *m, *t, *r, sym, psym;

sources/if.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ int FindVar(WORD *v, WORD *term)
277277
Note that the whole setup asks for recursions.
278278
*/
279279

280-
WORD DoIfStatement(PHEAD WORD *ifcode, WORD *term)
280+
int DoIfStatement(PHEAD WORD *ifcode, WORD *term)
281281
{
282282
GETBIDENTITY
283283
WORD *ifstop, *ifp;

0 commit comments

Comments
 (0)