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
3 changes: 2 additions & 1 deletion alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ void *tmp;
tmp = calloc(n, s);
if (tmp==NULL)
{
fprintf(stderr, "Failure to allocate %d objects of %d bytes ", n, s);
fprintf(stderr, "Failure to allocate %lu objects of %lu bytes ",
(unsigned long) n, (unsigned long) s);
fprintf(stderr, "on line %d of %s\n", l, f);
fprintf(stderr, "Emergency stop.\n");
exit(1);
Expand Down
1 change: 1 addition & 0 deletions gambit.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include <stdio.h>
#include <stdlib.h>

#include "rat.h"
#include "treedef.h"
Expand Down
1 change: 1 addition & 0 deletions interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include <stdio.h>
#include <stdlib.h>

#include "rat.h"
#include "treedef.h" /* PLAYERS */
Expand Down
4 changes: 3 additions & 1 deletion leaves.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
#include "leaves.h"

/* test if input properly processed by generating what should be an echo */
#ifdef UNUSED
static void testreadequil (int docuseed)
{
printf("BEQ>%4d<1>", docuseed);
outbehavstrat(1, realplan[1], 0);
printf(" <2>");
outbehavstrat(2, realplan[2], 1);
}
#endif /* UNUSED */

void leavesfrominput (void)
{
Expand Down Expand Up @@ -104,7 +106,7 @@ void outleavesreached (int docuseed)
if ( reachprob.num ) /* nonzero probability of reaching leaf */
{
rattoa(reachprob, s);
printf(" %d~%s", o - outcomes, s) ;
printf(" %ld~%s", o - outcomes, s) ;
}
}
printf("\n") ;
Expand Down
10 changes: 5 additions & 5 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ int stopwatch(Bool bprint)
void infotree()
{
int pl;
printf("\nGame tree has %d nodes, ", lastnode - root);
printf("of which %d are terminal nodes.\n", lastoutcome - outcomes);
printf("\nGame tree has %ld nodes, ", lastnode - root);
printf("of which %ld are terminal nodes.\n", lastoutcome - outcomes);
for (pl = 0; pl < PLAYERS; pl++)
{
printf(" Player %d has ", pl);
printf("%3d information sets, ", firstiset[pl+1] - firstiset[pl]);
printf("%3d moves in total\n", firstmove[pl+1] - firstmove[pl] - 1);
printf("%3ld information sets, ", firstiset[pl+1] - firstiset[pl]);
printf("%3ld moves in total\n", firstmove[pl+1] - firstmove[pl] - 1);
}
}

Expand Down Expand Up @@ -324,7 +324,7 @@ int main(int argc, char *argv[])
int multipriors = 0; /* parameter for -M option */
int seed = 0; /* payoff seed for bintree (-s option) */
int newpayoffs = 0; /* number of payoffs to be replaced (-p)*/
int *newp1, *newp2; /* arrays for entering new payoffs */
int *newp1 = 0, *newp2 = 0; /* arrays for entering new payoffs */

/* whichform currently not used (later for RSF) */
int whichform = 0; /* 0: SF, 1: NF, 2: RSF */
Expand Down
20 changes: 10 additions & 10 deletions mp.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ void prat(char name[],mp Nt,mp Dt) /*print the long precision rational Nt/Dt *
long i;
printf("%s",name);
if (sign(Nt)==NEG) printf("-");
printf("%u",Nt[length(Nt)-1]);
printf("%ld",Nt[length(Nt)-1]);
for (i=length(Nt)-2;i>=1;i--) printf(FORMAT,Nt[i]);
if( !(Dt[0]==2 && Dt[1]==1)) /* rational */
{ printf("/");
if (sign(Dt)==NEG) printf("-");
printf("%u",Dt[length(Dt)-1]);
printf("%ld",Dt[length(Dt)-1]);
for (i=length(Dt)-2;i>=1;i--) printf(FORMAT,Dt[i]);
}
printf(" ");
Expand All @@ -146,7 +146,7 @@ void pmp(char name[],mp a) /*print the long precision integer a*/
long i;
printf("%s",name);
if (sign(a)==NEG) printf("-");
printf("%u",a[length(a)-1]);
printf("%ld",a[length(a)-1]);
for (i=length(a)-2;i>=1;i--) printf(FORMAT,a[i]);
}

Expand All @@ -157,7 +157,7 @@ int mptoa(mp x, char s[])
int i, pos=0;
if (sign(x)==NEG)
pos = sprintf(s, "-");
pos += sprintf(&s[pos], "%u", x[length(x)-1] );
pos += sprintf(&s[pos], "%ld", x[length(x)-1] );
for (i=length(x)-2; i>=1; i--)
pos += sprintf(&s[pos], FORMAT, x[i]);
return pos;
Expand Down Expand Up @@ -197,7 +197,7 @@ void gcd(mp u, mp v)
bigu:
if(zero(v))
return;
if ((i=length(u))<maxsplen || i==maxsplen && u[maxsplen-1]<maxspval)
if ((i=length(u))<maxsplen || (i==maxsplen && u[maxsplen-1]<maxspval))
goto quickfinish;
divint(u,v,r);
normalize(u);
Expand All @@ -208,7 +208,7 @@ void gcd(mp u, mp v)
copy(u,v);
return;
}
if ((i=length(v))<maxsplen || i==maxsplen && v[maxsplen-1]<maxspval)
if ((i=length(v))<maxsplen || (i==maxsplen && v[maxsplen-1]<maxspval))
goto quickfinish;
divint (v,u,r);
normalize(v);
Expand Down Expand Up @@ -576,7 +576,7 @@ void divint(mp a, mp b, mp c )

void digits_overflow()
{
printf("Overflow at digits=%d\n",DIG2DEC(digits));
printf("Overflow at digits=%ld\n",DIG2DEC(digits));
exit(1);
}

Expand All @@ -588,7 +588,7 @@ void digits_overflow()
/***************************************************************/


linrat(Na,Da,ka,Nb,Db,kb,Nc,Dc)
void linrat(Na,Da,ka,Nb,Db,kb,Nc,Dc)
/* computes Nc/Dc = ka*Na/Da +kb* Nb/Db
and reduces answer by gcd(Nc,Dc) */
mp Na,Da,Nb,Db,Nc,Dc;
Expand All @@ -603,7 +603,7 @@ reduce(Nc,Dc);
}


divrat(Na,Da,Nb,Db,Nc,Dc)
void divrat(Na,Da,Nb,Db,Nc,Dc)
/* computes Nc/Dc = (Na/Da) / ( Nb/Db )
and reduces answer by gcd(Nc,Dc) */
mp Na,Da,Nb,Db,Nc,Dc;
Expand All @@ -614,7 +614,7 @@ reduce(Nc,Dc);
}


mulrat(Na,Da,Nb,Db,Nc,Dc)
void mulrat(Na,Da,Nb,Db,Nc,Dc)
/* computes Nc/Dc = Na/Da * Nb/Db
and reduces answer by gcd(Nc,Dc) */
mp Na,Da,Nb,Db,Nc,Dc;
Expand Down
2 changes: 1 addition & 1 deletion mp.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/***********************************************/
#ifndef B64
/*32 bit machines */
#define FORMAT "%4.4u"
#define FORMAT "%4.4ld"
#define MAXD 2147483647L
#define BASE 10000L
#define BASE_DIG 4
Expand Down
2 changes: 1 addition & 1 deletion rsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void genredsf(int pl)
int i, j; /* row, column counters */
int cdim; /* dimension of c-matrix, = no. redundant vars */
int drow; /* last filled row of d-matrix for irredundant vars */
Iset h, lasthinc;
Iset h = 0, lasthinc = 0;
Move seq;
/* inverse of matrix of dependent variables, local */
int ** depvarinv;
Expand Down
12 changes: 6 additions & 6 deletions treedef.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ Bool genseqin(void)
/* tree is not topologically sorted */
{
isnotok = 1;
printf("tree not topologically sorted: father %d ",
printf("tree not topologically sorted: father %ld ",
u->father - nodes);
printf("is larger than node %d itself.\n", u - nodes);
printf("is larger than node %ld itself.\n", u - nodes);
}

/* update sequence triple, new only for move leading to u */
Expand All @@ -113,10 +113,10 @@ Bool genseqin(void)
{
isnotok = 1;
/* need output routines for isets, moves, later */
printf("imperfect recall in info set no. %d ", h-isets);
printf("imperfect recall in info set no. %ld ", h-isets);
printf("named %s\n", h->name);
printf("different sequences no. %d,", seq-moves);
printf(" %d\n", h->seqin-moves);
printf("different sequences no. %ld,", seq-moves);
printf(" %ld\n", h->seqin-moves);
}
} /* end of "u decision node" */
} /* end of "for all nodes u" */
Expand Down Expand Up @@ -184,7 +184,7 @@ int movetoa (Move c, int pl, char *s)
return sprintf(s, "*");
if (c == firstmove[pl])
return sprintf(s, "()");
return sprintf(s, "%s%d", c->atiset->name, c - c->atiset->move0);
return sprintf(s, "%s%ld", c->atiset->name, c - c->atiset->move0);
} /* end of int movetoa (c, pl, *s) */

int seqtoa (Move seq, int pl, char *s)
Expand Down
2 changes: 1 addition & 1 deletion treegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void createbintree (int levels, int seed)
}
/* consistency check */
if (currout != lastoutcome)
printf("wrong number %d of outcomes!!!\n", currout-outcomes );
printf("wrong number %ld of outcomes!!!\n", currout-outcomes );
} /* end of createbintree(levels, seed) */


Expand Down