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

View File

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

View File

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

12
drive.c
View File

@ -253,6 +253,7 @@
pMotor pMot = NULL;
float fPos;
int iRet;
char pBueffel[132];
/*
treat motors separatetly in order to correct for zero points
@ -282,10 +283,21 @@
if(pDes)
{
pInt = pDes->GetInterface(pDum,DRIVEID);
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);
}
}
}
}
return -999.99;
}
/*--------------------------------------------------------------------------*/

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 setAccess 2
# Counter counter
counter SetPreset 1000.000000
counter SetMode Timer
counter SetPreset 1.000000
counter SetMode Preset
# Motor som
som SoftZero 0.000000
som SoftLowerLim 0.000000

View File

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