Ejemplo n.º 1
0
void vsetBOB(int rtparam, int reg)
{
   char            msge[128];

    if (!newacq)
    {
	text_error("Warning: vsetuserap available only on Inova systems.\n");
	text_error("         vsetuserap ignored.\n");
	return;
    }
    switch (reg)
    {
	case 0:
		SetAPAttr(BOBreg0, SET_RTPARAM, (c68int)(rtparam), NULL);
		break;
	case 1:
		SetAPAttr(BOBreg1, SET_RTPARAM, (c68int)(rtparam), NULL);
		break;
	case 2:
		SetAPAttr(BOBreg2, SET_RTPARAM, (c68int)(rtparam), NULL);
		break;
	case 3:
		SetAPAttr(BOBreg3, SET_RTPARAM, (c68int)(rtparam), NULL);
		break;
	default:
		sprintf(msge,"vsetuserap: Invalid register = %d.\n",reg);
		text_error(msge);
        	psg_abort(1);
    }

}
Ejemplo n.º 2
0
Archivo: cps.c Proyecto: timburrow/ovj3
/*-----------------------------------------------------------------
|	putstr()/2
|	Sets a vnmr parmeter to a given string.
+------------------------------------------------------------------*/
void putstr(char *paramname, char *paramstring)
{
   int stat,expnum;
   char	message[STDVAR];
   char addr[MAXSTR];

   expnum = getExpNum();
   stat = -1;
   if (getparm("vnmraddr","string",GLOBAL,addr,MAXSTR))
   {
	sprintf(addr,"putval: cannot get Vnmr address for %s.\n",paramname);
        text_error(addr);
   }
   else
   {
   	sprintf(message,"sysputval(%d,'%s','%s')\n",
					expnum,paramname,paramstring);
   	stat = deliverMessageSuid(addr,message);
	if (stat < 0)
	{
	   sprintf(addr,"putval: Error in parameter: %s.\n",paramname);
           text_error(addr);
	}
   }

}
Ejemplo n.º 3
0
void vreadBOB(int rtparam, int reg)
{
    int addrreg;
    char msge[128];

    if (!newacq)
    {
	text_error("Warning: readuserap available only on Inova systems.\n");
	text_error("         readuserap ignored.\n");
	return;
    }
    addrreg = (BOB_APADDR << 8) | (BOB_REG);
    switch (reg)
    {
	case 0:
		vapread(rtparam,addrreg,BOB_READ_SYNC_DELAY);
		break;
	case 1:
		vapread(rtparam,addrreg+1,BOB_READ_SYNC_DELAY);
		break;
	case 2:
		vapread(rtparam,addrreg+2,BOB_READ_SYNC_DELAY);
		break;
	case 3:
		vapread(rtparam,addrreg+3,BOB_READ_SYNC_DELAY);
		break;
	default:
		sprintf(msge,"readuserap: Invalid register = %d.\n",reg);
		text_error(msge);
        	psg_abort(1);
    }

}
Ejemplo n.º 4
0
void vapread(int rtparam, int addrreg, double apsyncdelay)
{
    int ticks,secs;
    short *ptr;

    if (!newacq)
    {
	text_error("Warning: vapread available only on Inova systems.\n");
	text_error("         vapread ignored.\n");
	return;
    }
    
    timerwords(apsyncdelay,&ticks,&secs);

    putcode((c68int)IAPREAD);
    putcode((c68int)addrreg);
    putcode((c68int)rtparam);
    ptr = (short *) &secs;
    putcode((codeint) *ptr);	/* timerword one */
    ptr++;
    putcode((codeint) *ptr);	/* timerword one */
    ptr = (short *) &ticks;
    putcode((codeint) *ptr);	/* timerword one */
    ptr++;
    putcode((codeint) *ptr);	/* timerword one */
	
}
Ejemplo n.º 5
0
/*-----------------------------------------------------------------
|	vnmrmsg()/1
|	Sends normal message to vnmr.
+------------------------------------------------------------------*/
void vnmrmsg(const char *paramstring)
{
    int stat;
    char	message[MAXSTR];
    char addr[MAXSTR];

    stat = -1;
    if (getparm("vnmraddr","string",GLOBAL,addr,MAXSTR))
    {
        text_error("vnmrmsg: cannot get Vnmr address.\n");
    }
    else if (strcmp(addr,"Autoproc"))
    {
        int i = 0;
        sprintf(message,"write('line3',`%s`,'noReformat')\n",paramstring);
        while ( (i<MAXSTR) && (message[i] != '\0') )
        {
            if (((message[i] < ' ') || (message[i] > '~') ) &&
                    (message[i] != '\n') )
            {
                message[i] = ' ';
            }
            i++;
        }
        stat = deliverMessageSuid(addr,message);
        if (stat < 0)
        {
            text_error("vnmrmsg: Error sending msg:%s.\n",paramstring);
        }
    }
}
Ejemplo n.º 6
0
/*--------------------------------------------------------------*/
void signal_acqi_updt_cmplt()
{
    if (!newacq)
    {
	text_error("Warning: signal_acqi_updt_cmplt available only on Inova systems.\n");
	text_error("         signal_acqi_updt_cmplt ignored.\n");
	return;
    }
    putcode((c68int)IACQIUPDTCMPLT);
}
Ejemplo n.º 7
0
/*--------------------------------------------------------------*/
void start_acqi_updt(double delaytime)
{
    if (!newacq)
    {
      text_error("Warning: start_acqi_updt available only on Inova systems.\n");
      text_error("         start_acqi_updt ignored.\n");
      return;
    }
    delay(delaytime);
    putcode((c68int)ISTARTACQIUPDT);
}
Ejemplo n.º 8
0
int getparm(char *varname, char *vartype, int tree,
            void *varaddr, int size)
{
    int ret;
    char mess[MAXSTR];

    if ( (strcmp(vartype,"REAL") == 0) || (strcmp(vartype,"real") == 0) )
    {
        if ((ret = P_getreal(tree,varname,(double *)varaddr,1)) < 0)
        {
           if (dowarn)
           {
             sprintf(mess,"Cannot get parameter: %s\n",varname);
             text_error(mess);
	     if (bgflag)
	         P_err(ret,varname,": ");
           }
           else
           {
              dowarn = 1;
           }
	   return(1);
        }
    }
    else 
    {
	if ( (strcmp(vartype,"STRING") == 0) || 
	     (strcmp(vartype,"string") == 0) )
        {
            if ((ret = P_getstring(tree,varname,(char *)varaddr,1,size)) < 0)
            {
              if (dowarn)
              {
                sprintf(mess,"Cannot get parameter: %s\n",varname);
                text_error(mess);
		if (bgflag)
	     	    P_err(ret,varname,": ");
              }
              else
              {
                 dowarn=1;
              }
              return(1);
            }
	}
	else
	{   sprintf(mess,"Variable '%s' is neither a 'real' or 'string'.\n",
			vartype);
            text_error(mess);
	    return(1);
	}
      }
    return(0);
}
Ejemplo n.º 9
0
/* Show the window */
int
text_create(TW *tw, const char *app_name, int show_cmd)
{
    HMENU sysmenu;
    HINSTANCE hInstance = GetModuleHandle(NULL);

    tw->Title = app_name;
    tw->nCmdShow = show_cmd;
    tw->quitnow = FALSE;

    /* make sure we have some sensible defaults */
    if (tw->KeyBufSize < 256)
	tw->KeyBufSize = 256;

    tw->CursorPos.x = tw->CursorPos.y = 0;
    tw->bFocus = FALSE;
    tw->bGetCh = FALSE;
    tw->CaretHeight = 0;


    /* allocate buffers */
    tw->KeyBufIn = tw->KeyBufOut = tw->KeyBuf = malloc(tw->KeyBufSize);
    if (tw->KeyBuf == NULL) {
	text_error("Out of memory");
	return 1;
    }
    tw->ScreenBuffer = malloc(tw->ScreenSize.x * tw->ScreenSize.y);
    if (tw->ScreenBuffer == NULL) {
	text_error("Out of memory");
	return 1;
    }
    memset(tw->ScreenBuffer, ' ', tw->ScreenSize.x * tw->ScreenSize.y);

    tw->hwnd = CreateWindow(TextWinClassName, tw->Title,
		  WS_OVERLAPPEDWINDOW | WS_VSCROLL | WS_HSCROLL,
		  tw->x, tw->y, tw->cx, tw->cy,
		  NULL, NULL, hInstance, tw);

    if (tw->hwnd == NULL) {
	MessageBox((HWND)NULL,"Couldn't open text window",(LPSTR)NULL, MB_ICONHAND | MB_SYSTEMMODAL);
	return 1;
    }

    ShowWindow(tw->hwnd, tw->nCmdShow);
    sysmenu = GetSystemMenu(tw->hwnd,0);	/* get the sysmenu */
    AppendMenu(sysmenu, MF_SEPARATOR, 0, NULL);
    AppendMenu(sysmenu, MF_STRING, M_COPY_CLIP, "Copy to Clip&board");
    AppendMenu(sysmenu, MF_STRING, M_PASTE_CLIP, "&Paste");

    return 0;
}
Ejemplo n.º 10
0
void vapset(int rtparam, int addrreg)
{
    if (!newacq)
    {
	text_error("Warning: apset available only on Inova systems.\n");
	text_error("         apset ignored.\n");
	return;
    }
    SetAPAttr(APall,
	SET_APADR,		((addrreg >> 8) & 0x0f),
	SET_APREG,		(addrreg & 0x0ff),
	SET_RTPARAM, 		(c68int)(rtparam),
	NULL);
}
Ejemplo n.º 11
0
void apsetbyte(int value, int addrreg)
{
    if (!newacq)
    {
	text_error("Warning: apsetbyte available only on Inova systems.\n");
	text_error("         apsetbyte ignored.\n");
	return;
    }
    SetAPAttr(APbyte,
	SET_APADR,		((addrreg >> 8) & 0x0f),
	SET_APREG,		(addrreg & 0x0ff),
	SET_MASK, 		(c68int)(value & 0xff),
	SET_VALUE,
	NULL);
}
Ejemplo n.º 12
0
/*-------------------------------------------------------
| insert(name,size)   Load hash table with the parameter
|			 names & indices
+-------------------------------------------------------*/
static void
insert(const char *word, int index)		/* enter a word in the hash table */
{
   int             key;

   key = hash(word);	/* calculate hash key */
   if (debug > 2)
      fprintf(stderr,"hash: word=%s key=%d\n", word, key);
   /* Check if hash table slot is free  */
   while (htable[key].word)	/* look for next free slot */
   {
      total_cols++;
      if (debug > 1)
	 fprintf(stderr,"hash:collision with %s and %s, total: %d\n",
		word, htable[key].word, total_cols);
      ++key;	/* increment key */
      key %= max_hash;	/* increment key */
   }
   htable[key].index = index;
   htable[key].word = word;
   if (debug > 1)
      fprintf(stderr,"hash: adding word %s  id %d \n", word, index);
   if (++hash_entries > max_hash)
   {
      text_error("hash: ERROR Number of identifiers exceeds hash table\n");
      psg_abort(17);
   }
}
Ejemplo n.º 13
0
lk_hold()
{
    static int errorsent = 0;
    if (ap_interface!=4)
    {
        if (!errorsent)
        {
            text_error("lk_hold is not valid with this hardware configuration\n");
            text_error("lk_hold is ignored\n");
            errorsent = 1;
        }
        return;
    }
    putcode(SMPL_HOLD);
    putcode(HOLD);
}
Ejemplo n.º 14
0
/*-------------------------------------------------------------------
|
|	starthardloop()/1 
|	index is to v1-v14, number of times to cycle through loop
|	This start a hardware loop.
|	hwlooping flag is set.
|	curfifocount is saved so that the # of fifo words in the
|	 hardwarre loop can be calcualted later in 'endhardloop'.
|	pointer to the starthardloop Acode is save so that the
|	 values can update later by 'endhardloop'
|	 1. setICM is inserted in nop, if this loop acquires data
|	     and no previous hardware loop did.
|	 2. # of fifo words in hardware loop is set.
|	 3. enable interrupt is nulled if only one hardware loop
|	    exists.
|	
|				Author Greg Brissey  7/10/86
+------------------------------------------------------------------*/
void starthardloop(codeint rtindex)
{
    setSSHAdisable();
    if(bgflag)
	fprintf(stderr,"starthardloop(): v# index: %d \n",rtindex);
    if (hwlooping)	/* No nesting of hardware loops */
    {
	text_error("Missing endhardloop after previous starthardloop\n");
	psg_abort(0);
    }
    hwlooping = TRUE;	/* mark the start of a hardware loop */
    starthwfifocnt = curfifocount; /* must know # words in fifo */
    fifostarttime = totaltime; /* must know time of loop */
    hwloopelements = 0;  /* reset pulse elements in hardware loop to zero */
    putcode(0);		/* nop that might be change to a setSTM acode */
    hwloop_ptr = (codeint) (Codeptr - Aacode); /* save location for use */
    putcode(HWLOOP);	/* hardwareloop Acode */
    putcode(0);		/* will be then number of fifo words in loop */
    putcode(2);		/* default to enable looping interrupt in acq.  */
			/* for multiple hardware loops */
    putcode(rtindex);   /* real time variable containing # of cycles of loop */

    /* Update time for loop */
    hwloopcnt4time = get_acqvar(rtindex); /* get count for this loop	*/
}
Ejemplo n.º 15
0
/*---------------------------------------------------------------------
|       open_acqpar(path)/1
|
|       Position the disk read/write heads to the proper block offset
|       for the acqpar file (lc,auto structure parameters.
+-------------------------------------------------------------------*/
void open_acqpar(char *filename)
{
   int len;
   if (bgflag)
     fprintf(stderr,"Opening Acqpar file: '%s' \n",filename);
   acqfd = open(filename,O_EXCL | O_RDONLY ,0666);
   if (acqfd < 0)
   { text_error("Cannot open acqpar file: '%s', RA not possible.\n",filename);
       psg_abort(1);
   }
   len = read(acqfd,&acqfileheader,sizeof(struct datafilehead));
   if (len < 1)
   { text_error("Cannot read acqpar file: '%s'\n",filename);
       psg_abort(1);
   }

}
Ejemplo n.º 16
0
void closeFiles()
{
    const char  *mess = "ABORT(): could not delete %s\n";
    char  tmpPath[MAXPATHL];

    /* delete file filexpath and filepath from acqqueue directory */
    if (strcmp(filepath,"") != 0)
    {
        if ( (unlink(filepath) == -1) && (errno != ENOENT) )
        {
            text_error(mess,filepath);
        }
    }
    if (strcmp(filexpath,"") != 0)
    {
        if ( (unlink(filexpath) == -1) && (errno != ENOENT) )
        {
            text_error(mess,filexpath);
        }
    }
    if (strcmp(fileRFpattern,"") != 0)
    {
        if ( (unlink(fileRFpattern) == -1) && (errno != ENOENT) )
        {
            text_error(mess,fileRFpattern);
        }
    }
    if (strcmp(filegrad,"") != 0)
    {
        if ( (unlink(filegrad) == -1) && (errno != ENOENT) )
        {
            text_error(mess,filegrad);
        }
    }
    if (strcmp(filexpan,"") != 0)
    {
        if ( (unlink(filexpan) == -1) && (errno != ENOENT) )
        {
            text_error(mess,filexpan);
        }
    }
    if (strcmp(filexpath,"") != 0)
    {
        strcpy(tmpPath,filexpath);
        strcat(tmpPath,".RTpars");
        if ( (unlink(tmpPath) == -1) && (errno != ENOENT) )
        {
            text_error(mess,tmpPath);
        }
    }
    if (strcmp(filexpath,"") != 0)
    {
        strcpy(tmpPath,filexpath);
        strcat(tmpPath,".Tables");
        if ( (unlink(tmpPath) == -1) && (errno != ENOENT) )
        {
            text_error(mess,tmpPath);
        }
    }
}
Ejemplo n.º 17
0
check_parameters()
{
/*
 *  do some error checking on string variables 
 */
   if (p1pat[0] == '\0') { 
     text_error("p1pat file spec error\n"); 
     exit(2); 
   }
   if (pwpat[0] == '\0') { 
     text_error("pwpat file spec error\n"); 
     exit(2); 
   }
   if ((ni2 > 1) && (!strcmp(bptype,"slice"))){
     text_error("can't do slice selection in 3D experiment\n");
     exit(2);
   }
}
Ejemplo n.º 18
0
double nucleus_gamma(int device)
{
    double nucgamma = 0.0;

    if (B0 <= 0.0) {
        text_error("nucleus_gamma: B0 (field) value <= zero\n");
        psg_abort(1);
    }

    if (device == DODEV)
        nucgamma=MHZ_HZ*dfrq/B0;
    else if (device == TODEV)
        nucgamma=MHZ_HZ*sfrq/B0; 
    else {
        text_error("nucleus_gamma: Bad transmitter device\n");
        psg_abort(1);
    }

    return(nucgamma);
}
Ejemplo n.º 19
0
/*-------------------------------------------------------------------
|
|	notinhwloop() 
|	set the invalid hardware loop flag 
|				Author Greg Brissey  7/10/86
+------------------------------------------------------------------*/
void notinhwloop(char *name)
{
   char mess[80];
   if (bgflag)
       fprintf(stderr,"notinhwloop('%s'):\n",name);
   if (hwlooping)
   {
       sprintf(mess," '%s' is not valid in a Hardware Loop \n",name);
       text_error(mess);
       psg_abort(0);		/* abort process */
   }
}
Ejemplo n.º 20
0
/*------------------------------------------------------------------------------
|
|	maxminlimit(tree,name)
|
|	This function returns the max & min limit of the real variable based
|				Author: Greg Brissey  8-18-95
+----------------------------------------------------------------------------*/
int par_maxminstep(int tree, const char *name, double *maxv, double *minv, double *stepv)
{
   int             ret,pindex;
   vInfo           varinfo;	/* variable information structure */
   char            mess[MAXSTR];

   if ( (ret = P_getVarInfo(tree, name, &varinfo)) )
   {
      sprintf(mess, "Cannot find the variable: %s", name);
      text_error(mess);
      if (bgflag)
	 P_err(ret, name, ": ");
      return (-1);
   }
   if (varinfo.basicType != ST_REAL)
   {
      sprintf(mess, "The variable '%s' is not a type 'REAL'", name);
      text_error(mess);
   }
   if (varinfo.prot & P_MMS)
   {
      pindex = (int) (varinfo.minVal+0.1);
      if (P_getreal( SYSTEMGLOBAL, "parmin", minv, pindex ))
         *minv = -1.0e+30;
      pindex = (int) (varinfo.maxVal+0.1);
      if (P_getreal( SYSTEMGLOBAL, "parmax", maxv, pindex ))
         *maxv = 1.0e+30;
      pindex = (int) (varinfo.step+0.1);
      if (P_getreal( SYSTEMGLOBAL, "parstep", stepv, pindex ))
            *stepv = 0.0;
   }
   else
   {
       *maxv = varinfo.maxVal;
       *minv = varinfo.minVal;
       *stepv = varinfo.step;
   }
   return (0);
}
Ejemplo n.º 21
0
/*-----------------------------------------------------------------
|	release_console()/1
|	Sends release console command to Vnmr
+------------------------------------------------------------------*/
void release_console()
{
    int stat;
    char	message[STDVAR];
    char addr[MAXSTR];

    stat = -1;
    if (getparm("vnmraddr","string",GLOBAL,addr,MAXSTR))
    {
        text_error("vnmremsg: cannot get Vnmr address.\n");
    }
    else if (strcmp(addr,"Autoproc"))
    {
        sprintf(message,"releaseConsole\n");
        stat = deliverMessageSuid(addr,message);
        if (stat < 0)
        {
            text_error("vnmremsg: Error sending release console msg.\n");
        }
    }

}
Ejemplo n.º 22
0
/*------------------------------------------------------------------------------
|
|	parmult(tree,name)
|
|	This function returns the multiplier of a real parameter
+----------------------------------------------------------------------------*/
double parmult(int tree, const char *name)
{
   int             ret;
   vInfo           varinfo;	/* variable information structure */

   if ( (ret = P_getVarInfo(tree, name, &varinfo)) )
   {
      text_error("parmult(): cannot find variable %s", name);
      if (bgflag)
	 P_err(ret, name, ": ");
      return (-1.0);
   }
   return( (varinfo.subtype == ST_PULSE) ? 1e-6 : 1.0);
}
Ejemplo n.º 23
0
noslice_timing()
{
/* calculate dx: */
   dx = (te/2.0) - 0.5*(p1+pw) - rof1 - rof2;
   if (dx < 1.0e-6) { 
       text_error("cannot fit tpe trise p1 pw into te... ABORT");
       exit(2);
   }
/* calculate dy: */
   dy = (te/2.0) - at/2.0 - pw/2.0 - rof2;
   if (dy < 1.0e-6) { 
       dy = 1.0e-6;
   }
   tix = tr - pi/2.0 - rof2 - trise;
}
Ejemplo n.º 24
0
/*------------------------------------------------------------------------------
|
|	whattype(tree,name)
|
|	This function returns the address of a real value of a variable based on
+----------------------------------------------------------------------------*/
int whattype(int tree, const char *name)
{
   int             ret;
   vInfo           varinfo;	/* variable information structure */
   char            mess[MAXSTR];

   if ( (ret = P_getVarInfo(tree, name, &varinfo)) )
   {
      sprintf(mess, "Cannot find the variable: %s", name);
      text_error(mess);
      if (bgflag)
	 P_err(ret, name, ": ");
      return (-1);
   }
   return (varinfo.basicType);
}
Ejemplo n.º 25
0
void write_shr_info(double exp_time)
{
    int Infofd;	/* file discriptor Code disk file */
    int bytes;

    /* --- write parameter out to acqqueue file --- */

    if (usertime < 0.0)
       ExpInfo.ExpDur = exp_time;
    else
       ExpInfo.ExpDur = usertime;

    /*
       BKJ: CAUTION: need to check ExpInfo.NumTables
       ExpInfo.NumTables = num_tables;
    */

    if ( ! AcodeManager_getAcodeStageWriteFlag(0) ) strcpy(ExpInfo.InitCodefile,"\0");
    if ( ! AcodeManager_getAcodeStageWriteFlag(1) ) strcpy(ExpInfo.PreCodefile,"\0");
    if ( ! AcodeManager_getAcodeStageWriteFlag(2) ) strcpy(ExpInfo.PSCodefile,"\0");
    if ( ! AcodeManager_getAcodeStageWriteFlag(3) ) strcpy(ExpInfo.PostCodefile,"\0");
    if ( ! AcodeManager_getAcodeStageWriteFlag(4) ) strcpy(ExpInfo.WaveFormFile,"\0");

    if (ExpInfo.InteractiveFlag)
    {
       char tmppath[256];
       sprintf(tmppath,"%s.new",infopath);
       unlink(tmppath);
       Infofd = open(tmppath,O_EXCL | O_WRONLY | O_CREAT,0666);
    }
    else
    {
       /* fprintf(stdout,"infopath: '%s'\n", infopath); */
       Infofd = open(infopath,O_EXCL | O_WRONLY | O_CREAT,0666);
    }
    if (Infofd < 0)
    {	text_error("Exp info file already exists. PSG Aborted..\n");
	psg_abort(1);
    }
    /* fprintf(stdout," [[[[[[[[[-->>writing  RcvrMapStr: '%s'\n",ExpInfo.RvcrMapping); */
    bytes = write(Infofd, (const void *) &ExpInfo, sizeof( SHR_EXP_STRUCT ) );
    /* fprintf(stdout,"sizeof( SHR_EXP_STRUCT ) = %d\n",sizeof( SHR_EXP_STRUCT )); */
    fsync(Infofd);
    if (bgflag)
      fprintf(stdout,"Bytes written to info file: %d (bytes).\n",bytes);
    close(Infofd);
}
Ejemplo n.º 26
0
static void compare_dutycycle_limits()
{
    Sdac *pd;
    int  panic;

    if (option_check("danger") ) return;
    pd = sdac_values;
    panic = 0;
    if (coilLimits.xduty < pd[DUTYLIMIT].values[X1_AXIS])  panic=1;
    if (coilLimits.zduty < pd[DUTYLIMIT].values[Y1_AXIS])  panic=1;
    if (coilLimits.zduty < pd[DUTYLIMIT].values[Z1_AXIS])  panic=1;
    if (panic)
    {
        text_error("Dutycycle limits exceed gradient coil specifications");
        psg_abort(3);
    }
}
Ejemplo n.º 27
0
int create_angle_list(char *nm, double* angle_set, int num_sets)
{
   if (gradtype[0] != gradtype[1])
       abort_message("error in gradient or pfg configuration parameter gradtype. abort!\n");
   if (gradtype[0] != gradtype[2])
       abort_message("error in gradient or pfg configuration parameter gradtype. abort!\n");

   int listId = -1;
   GradientBase  *gC = P2TheConsole->getConfiguredGradient();
   listId = gC->create_angle_list(nm, angle_set, num_sets);

   if (listId > 0)
     return listId;
   else
     text_error("error in creating rotation list on %s . abort!\n", gC->getName());
   return(listId);
}
Ejemplo n.º 28
0
void psg_abort(int error)
{
    closeFiles();
    if (dpsTimer)
    {
        close_error(1);   /* 1 arg means failure/abort */
        exit(1);
    }
    text_error("P.S.G. Aborted.");
    if (newacq)
    {
        if (!acqiflag && !dps_flag)
            release_console();
    }
    close_error(1);     /* 1 arg means failure/abort */
    exit(error);
}
Ejemplo n.º 29
0
/* fill in the Sdac sdac_value structure with sdac numbers */
static int
get_all_sdac_from_file(char *filename)
{
    int i, j;
    int rtn = TRUE;
    FILE *fd = NULL;
    Sdac *pd;
    struct stat statbuf;

    if (strstr(filename, "/.None")) {
        rtn = FALSE;
    } else if (stat(filename, &statbuf) == -1
               || ! (statbuf.st_mode & S_IFREG)
               || ! (fd = fopen(filename, "r") ))
    {
        text_error("Cannot find \"%s\". Check the sysgcoil parameter", filename);
        psg_abort(1);
    }


    if (!rtn){
        /* If no file, just turn off gain for safety */
        for (j=0, pd=sdac_values; j<3; j++){
            pd[TOTALSCALE].values[j] = 0;
        }
    }else
    {
        for (i=0, pd=sdac_values; i<N_SDAC_VALS; pd++, i++){
            for (j=0; j<4; j++){
                if (i == SLEWLIMIT) {
                    pd->values[j] = pd->max_val;
                }else{
                    pd->values[j] = 0;
                }
            }
            get_one_sdac_setting_from_file(fd, pd->label, pd->values);
        }
        fclose(fd);
    }

    return rtn;
}
Ejemplo n.º 30
0
/*-------------------------------------------------------
| init_hash(size)   Malloc space for hash table and
|		    initialize hash table to null
+-------------------------------------------------------*/
void init_hash(int size)	/* Initialize hash table to null */
{
   int             i;

   max_hash = size * 10;
   if (debug > 0)
      fprintf(stderr, "Max Hash Table Size : %d \n", max_hash);
   htable = (hash_table *) malloc(max_hash * (sizeof(hash_table)));
   if (htable == 0L)
   {
      text_error("insuffient memory for variable pointer allocation!!");
      psg_abort(0);
   }
   for (i = 0; i < max_hash; i++)
   {
      htable[i].word = NULL;
      htable[i].index = -1;
   }
   hash_entries = 0;
}