- Fixed irregularly occuring core dump bug.

This commit is contained in:
cvs
2000-07-26 08:00:29 +00:00
parent 5f5aface14
commit 0a3e457c96
7 changed files with 77 additions and 49 deletions

View File

@ -75,22 +75,6 @@
return NULL; return NULL;
} }
pInter->argv = NULL;
pInter->argv = (char **)malloc(MAXPAR*sizeof(char *));
if(pInter->argv == NULL)
{
free(pInter);
return NULL;
}
for(i = 0; i < MAXPAR; i++)
{
pInter->argv[i] = (char *)malloc(MAXLEN*sizeof(char));
if(pInter->argv[i] == NULL)
{
free(pInter);
return NULL;
}
}
pInter->iDeleting = 0; pInter->iDeleting = 0;
return pInter; return pInter;
} }
@ -210,11 +194,13 @@ extern char *SkipSpace(char *pPtr);
{ {
int iCount = 0; int iCount = 0;
int iRet; int iRet;
int i; int i, argc;
char pBueffel[1024]; char pBueffel[1024];
CommandList *pCommand = NULL; CommandList *pCommand = NULL;
char pBrk[] = {" \r\n\0"}; char pBrk[] = {" \r\n\0"};
char *pPtr; char *pPtr;
char **argv = NULL;
assert(self); assert(self);
assert(pCon); assert(pCon);
@ -240,36 +226,27 @@ extern char *SkipSpace(char *pPtr);
} }
/* convert to argc, argv */ /* convert to argc, argv */
pPtr = SkipSpace(pText); argc = 0;
if(pPtr) Text2Arg(pText,&argc,&argv);
{
pPtr = stptok(pPtr,self->argv[0],255,pBrk);
}
while(pPtr != NULL)
{
iCount++;
pPtr = SkipSpace(pPtr);
if(!pPtr)
{
break;
}
pPtr = stptok(pPtr,self->argv[iCount],255,pBrk);
}
self->argv[iCount][0] = '\0';
/* the first one must be the target object. If not given an empty /* the first one must be the target object. If not given an empty
command string was given which will be silently ignored */ command string was given which will be silently ignored */
if(iCount < 1) if(argc < 1)
{ {
return 1; return 1;
} }
if(argv[0] == NULL)
{
SCWrite(pCon,"ERROR: failed to parse command",eError);
return -1;
}
/* find it */ /* find it */
pCommand = FindCommand(self,self->argv[0]); pCommand = FindCommand(self,argv[0]);
if(!pCommand) if(!pCommand)
{ {
sprintf(pBueffel,"ERROR: Object -> %s <- NOT found", sprintf(pBueffel,"ERROR: Object -> %s <- NOT found",
self->argv[0]); argv[0]);
SCWrite(pCon,pBueffel,eError); SCWrite(pCon,pBueffel,eError);
return -1; return -1;
@ -280,8 +257,19 @@ extern char *SkipSpace(char *pPtr);
self->eOut = eStatus; self->eOut = eStatus;
Tcl_ResetResult((Tcl_Interp *)self->pTcl); Tcl_ResetResult((Tcl_Interp *)self->pTcl);
MacroPush(pCon); MacroPush(pCon);
iRet = pCommand->OFunc(pCon, self, pCommand->pData, iCount, self->argv); iRet = pCommand->OFunc(pCon, self, pCommand->pData, argc, argv);
MacroPop(); MacroPop();
/* delete argv */
for(i = 0; i < argc; i++)
{
if(argv[i] != NULL)
{
free(argv[i]);
}
}
free(argv);
return iRet; return iRet;
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
@ -393,11 +381,6 @@ extern char *SkipSpace(char *pPtr);
Tcl_DeleteInterp(pTcl); Tcl_DeleteInterp(pTcl);
} }
for(i = 0; i < MAXPAR; i++)
{
free(self->argv[i]);
}
free(self->argv);
free(self); free(self);
} }

View File

@ -34,7 +34,6 @@ typedef struct __SINTER
CommandList *pCList; CommandList *pCList;
OutCode eOut; OutCode eOut;
void *pTcl; void *pTcl;
char **argv;
int iDeleting; int iDeleting;
}SicsInterp; }SicsInterp;

View File

@ -1,3 +1,3 @@
5829 7281
NEVER, EVER modify or delete this file NEVER, EVER modify or delete this file
You'll risk eternal damnation and a reincarnation as a cockroach!|n You'll risk eternal damnation and a reincarnation as a cockroach!|n

14
drive.c
View File

@ -253,6 +253,7 @@
pMotor pMot = NULL; pMotor pMot = NULL;
float fPos; float fPos;
int iRet; int iRet;
char pBueffel[132];
/* /*
treat motors separatetly in order to correct for zero points treat motors separatetly in order to correct for zero points
@ -282,7 +283,18 @@
if(pDes) if(pDes)
{ {
pInt = pDes->GetInterface(pDum,DRIVEID); pInt = pDes->GetInterface(pDum,DRIVEID);
return pInt->GetValue(pDum,pCon); if(!pInt)
{
sprintf(pBueffel,
"ERROR: internal error in findPosition for %s",
name);
SCWrite(pCon,pBueffel,eError);
return -999.99;
}
else
{
return pInt->GetValue(pDum,pCon);
}
} }
} }
} }

34
matrix/Makefile Normal file
View File

@ -0,0 +1,34 @@
#---------------------------------------------------------------------------
# Makefile for the Matrix library
#
# Mark Koennecke, November 1996
#--------------------------------------------------------------------------
OBJ= matadd.o matcreat.o matdet.o matdump.o matdurbn.o materr.o \
matinv.o matmul.o matsolve.o matsub.o matsubx.o mattoepz.o \
mattran.o
#---------- for Redhat linux
#CC= gcc
#CFLAGS= -I/usr/local/include -I. -I../ -DLINUX -g -c
#------------ for DigitalUnix
CC=cc
CFLAGS= -I/data/koenneck/include -I. -I../ -std1 -g -c
#------------ for DigitalUnix with Fortify
#CFLAGS= -I/data/koenneck/include -DFORTIFY -I. -I../ -std1 -g -c
#------------ for CYGNUS toolchain on Win32
#CC=gcc
#CFLAGS= -I. -I../ -DCYGNUS -g -c
.c.o:
$(CC) $(CFLAGS) $*.c
matrix: $(OBJ)
- rm libmatrix.a
ar cr libmatrix.a $(OBJ)
ranlib libmatrix.a
clean:
rm *.o
rm *.a

View File

@ -129,8 +129,8 @@ phone setAccess 2
adress UNKNOWN adress UNKNOWN
adress setAccess 2 adress setAccess 2
# Counter counter # Counter counter
counter SetPreset 1000.000000 counter SetPreset 1.000000
counter SetMode Timer counter SetMode Preset
# Motor som # Motor som
som SoftZero 0.000000 som SoftZero 0.000000
som SoftLowerLim 0.000000 som SoftLowerLim 0.000000

View File

@ -1,7 +1,7 @@
scan clear scan clear
scan np 10 scan np 10
scan var A4 20. 2. scan var A4 20. 2.
scan preset 0.5 scan preset 10
for {set i 0 } { $i < 2000 } { incr i} { for {set i 0 } { $i < 2000 } { incr i} {
scan run scan run
} }