Skip to content
Browse files

fix some warnings in teyjus

Ignore-this: 5ce06b03ea2be96e08a09e35b9a764d2

darcs-hash:20120803123001-ae14a-d3632feceb4d12c8791daa354dcce7a2f308dfe2.gz
  • Loading branch information...
1 parent 93fec77 commit f81b351a342da1af39a9989518a68744950e42e9 Krasimir Angelov committed Aug 3, 2012
View
6 src/runtime/c/teyjus/simulator/hnorm.c
@@ -73,7 +73,7 @@ static Boolean HN_isEmptyEnv() { return ((ol == 0) && (nl == 0)); }
static DF_EnvPtr HN_addNDummyEnv(int n)
{
int i;
- DF_EnvPtr last = envlist, current;
+ DF_EnvPtr last = envlist, current = NULL;
AM_heapError(AM_hreg + n * DF_ENV_DUMMY_SIZE);
for (i = 0; i < n; i++){
@@ -95,7 +95,7 @@ static DF_EnvPtr HN_addNPair(DF_TermPtr argvec, int myol, int mynl,
DF_EnvPtr myenv, int n)
{
int i;
- DF_EnvPtr last = envlist, current;
+ DF_EnvPtr last = envlist, current = NULL;
MemPtr myEnvlist = AM_hreg;
MemPtr newhtop = AM_hreg + n * DF_ENV_PAIR_SIZE;
@@ -122,7 +122,7 @@ static DF_EnvPtr HN_addNPair(DF_TermPtr argvec, int myol, int mynl,
static DF_EnvPtr HN_addNPairEmpEnv(DF_TermPtr argvec, int n)
{
int i;
- DF_EnvPtr last = envlist, current;
+ DF_EnvPtr last = envlist, current = NULL;
AM_heapError(AM_hreg + n * DF_ENV_PAIR_SIZE);
for (i = 1; i <= n; i++) {
current = (DF_EnvPtr)AM_hreg;
View
5 src/runtime/c/teyjus/simulator/hnormlocal.c
@@ -152,7 +152,7 @@ void HNL_updateToRef(DF_TermPtr tmPtr, DF_TermPtr target)
*/
static DF_TermPtr HNL_renumberAsEnv(DF_TermPtr skPtr, int nl)
{
- DF_TermPtr rtPtr; //term pointer to be returned
+ DF_TermPtr rtPtr = NULL; //term pointer to be returned
restart_renumberAsEnv:
switch (DF_termTag(skPtr)){
case DF_TM_TAG_VAR:
@@ -178,7 +178,6 @@ static DF_TermPtr HNL_renumberAsEnv(DF_TermPtr skPtr, int nl)
{
if (nl == 0) rtPtr = skPtr;
else {
- DF_TermPtr myskPtr = DF_termDeref(DF_suspTermSkel(skPtr));
int myol = DF_suspOL(skPtr), mynl = DF_suspNL(skPtr);
DF_EnvPtr myenv = DF_suspEnv(skPtr);
int newnl = mynl+nl;
@@ -353,7 +352,7 @@ static void HNL_BVSuspAsArg(DF_TermPtr bv, int ol, int nl, DF_EnvPtr env,
pushed on the current heap top if necessary. */
DF_TermPtr HNL_suspAsEnv(DF_TermPtr skPtr, int ol, int nl, DF_EnvPtr env)
{
- DF_TermPtr rtPtr; // term pointer to be returned
+ DF_TermPtr rtPtr = NULL; // term pointer to be returned
restart_suspAsEnv:
switch(DF_termTag(skPtr)){ //[|c, ol, nl, envlist|] -> c
case DF_TM_TAG_VAR:
View
6 src/runtime/c/teyjus/simulator/hopu.c
@@ -672,7 +672,7 @@ static DF_TermPtr HOPU_mkPrunedTerm(DF_TermPtr hPtr, DF_TermPtr args, int nargs)
/* Find the (partial) structure of the substitution for a flex head of a */
/* LLambda term corresponding to an internal flex term which is known to be */
/* LLambda. The internal free variable is bound to a proper substitution as */
-/* side-effect.
+/* side-effect. */
/* The arguments of this procedure are: */
/* args1 : reference to the argument vector of the outside flex term */
/* nargs1: number of arguments of the outside flex term */
@@ -1512,7 +1512,7 @@ void HOPU_patternUnifyPDL()
DF_TermPtr tPtr1, tPtr2, //pointers to terms to be unified
hPtr, //pointer to head of hnf
args; //arg vec of hnf
- Flag rig, cons; //rigid flag and cons flags
+ Flag rig; //rigid flag and cons flags
int nabs, nargs; //binder length and # of arguments of hnf
while (AM_nemptyPDL()){
//retrieve the pair of terms on the current top of PDL
@@ -1601,7 +1601,7 @@ void HOPU_patternUnify()
void HOPU_patternUnifyPair(DF_TermPtr tPtr1, DF_TermPtr tPtr2)
{
DF_TermPtr h1Ptr, h2Ptr, args1, args2;
- Flag rig1, rig2, cons1, cons2;
+ Flag rig1, rig2;
int nabs1, nabs2, nargs1, nargs2;
MemPtr oldPdlBot = AM_pdlBot;
View
12 src/runtime/c/teyjus/simulator/printterm.c
@@ -87,6 +87,8 @@ static Boolean PRINT_parenNeeded(OP_FixityType opfx, int opprec,
}
break;
}
+ default:
+ break;
}
} else if (context == OP_RIGHT_TERM) {
switch (fx) {
@@ -101,6 +103,8 @@ static Boolean PRINT_parenNeeded(OP_FixityType opfx, int opprec,
if (opprec < prec) pparen = TRUE; break;
}
}
+ default:
+ break;
}
}
return pparen;
@@ -132,9 +136,6 @@ static void PRINT_writeNilSymbol(WordPtr outStream)
static void PRINT_writeInfixLam(WordPtr outStream)
{ STREAM_printf(outStream, "\\ "); }
-static void PRINT_writeLam(WordPtr outStream, int numabs)
-{ STREAM_printf(outStream, "lam(%d, ", numabs); }
-
static void PRINT_writeSpace(WordPtr outStream, int i)
{ while (i--) STREAM_printf(outStream, " "); }
@@ -402,7 +403,6 @@ static void PRINT_writeCons(WordPtr outStream, DF_TermPtr tmPtr,
OP_FixityType fx, int prec, OP_TermContext tc)
{
DF_TermPtr args = DF_consArgs(tmPtr);
- DF_TermPtr arg;
OP_FixityType consfix = (OP_FixityType)AM_cstFixity(PERV_CONS_INDEX);
int consprec = AM_cstPrecedence(PERV_CONS_INDEX);
Boolean pparen = PRINT_parenNeeded(consfix, consprec, tc, fx,prec);
@@ -600,8 +600,8 @@ static void PRINT_writeApp(WordPtr outStream, DF_TermPtr tmPtr,
int arity = DF_appArity(tmPtr);
Boolean pparen = PRINT_parenNeeded(OP_APP_FIXITY, OP_APP_PREC, tc, infx,
inprec);
- OP_FixityType fix;
- int prec;
+ OP_FixityType fix = 0;
+ int prec = 0;
HN_hnorm(tmPtr);
PRINT_getHeadInfo(AM_head, &fix, &prec);
View
2 src/runtime/c/teyjus/simulator/siminstr.c
@@ -1746,7 +1746,7 @@ void SINSTR_switch_on_bvar() //switch_on_bvar n,tab -- I1_BVT_X
{
INSACC_I1BVTX(n, table);
for (m = 0; m != n; m++)
- if (numAbs = MEM_branchTabIndexVal(table, m)) break;
+ if ((numAbs = MEM_branchTabIndexVal(table, m))) break;
if (m < n) AM_preg = MEM_branchTabCodePtr(table, m);
else EM_THROW(EM_FAIL);
}
View
2 src/runtime/c/teyjus/simulator/trail.c
@@ -38,7 +38,7 @@ static MemPtr TR_trailItemAddr(TR_TrailItem *trPtr) { return (trPtr -> addr);}
void TR_trailTerm(DF_TermPtr addr) //trailing a term of atomic size
{
if (((MemPtr)addr <= AM_hbreg) ||
- (AM_hreg < (MemPtr)addr) && ((MemPtr)addr < AM_breg)) {
+ ((AM_hreg < (MemPtr)addr) && ((MemPtr)addr < AM_breg))) {
AM_trailError(TR_TRAIL_TERM_SIZE);
DF_copyAtomic(addr, AM_trreg);
((TR_TrailItem*)(AM_trreg+DF_TM_ATOMIC_SIZE))->tag = TR_TAG_TERM;
View
6 src/runtime/c/teyjus/system/error.h
@@ -114,11 +114,11 @@ EM_TRY
}
EM_CATCH
{
- un_foo(); /* clean up *
+ un_foo(); // clean up
if (EM_CurrentExnType == EM_FOOBAR)
- printf("foobar!"); /* stop the error here *
+ printf("foobar!"); // stop the error here
else
- EM_RETHROW(); /* let a later handler handle it *
+ EM_RETHROW(); // let a later handler handle it
}
*/

0 comments on commit f81b351

Please sign in to comment.
Something went wrong with that request. Please try again.