예제 #1
0
파일: builtin_vo.c 프로젝트: joequant/iraf
/* CL_VOCINIT --  Initialize the VO Client interface.
 */
void
cl_vocinit (void)
{
    register struct pfile *pfp;
    struct  operand o;
    int     n, status;

    if (VOClient_initialized == 0) {

	c_xwhen (X_IPC, voc_onipc, &old_onipc);

        pfp = newtask->t_pfp;
        if ((n = nargs (pfp)) > 1) {
            cl_error (E_UERR, e_posargs, "vocinit");
	    return;

        } else if (n < 1) {
            status = voc_initVOClient (envget("vo_runid"));

	} else {
            pushbparams (pfp->pf_pp);
            popop();                    /* discard fake name.           */
            opcast (OT_STRING);
            o = popop();                /* get ltask                    */

            status = voc_initVOClient (o.o_val.v_s);
        }

	if (status) {
            cl_error (E_UERR, "Can't init VOClient", "vocinit");
	} else
	    VOClient_initialized = 1;
    }
}
예제 #2
0
파일: builtin_vo.c 프로젝트: joequant/iraf
/* CL_VOCSTOP --  Stop the VO Client interface.
 */
void
cl_vocstop (void)
{
    register struct pfile *pfp;
    struct  operand o;
    int     n, status;

    if (VOClient_initialized == 1) {
	c_xwhen (X_IPC, old_onipc, &old_onipc);

        pfp = newtask->t_pfp;
        if ((n = nargs (pfp)) > 1) {
            cl_error (E_UERR, e_posargs, "vocstop");
	    return;

        } else if (n < 1) {
            voc_closeVOClient (1);

	} else {
            pushbparams (pfp->pf_pp);
            popop();                    /* discard fake name.           */
            opcast (OT_INT);
            o = popop();                /* get ltask                    */
            voc_closeVOClient (o.o_val.v_i);
	}
	VOClient_initialized = 0;
    }
}
예제 #3
0
파일: zztest.c 프로젝트: olebole/iraf
int 
tscan_ (void)
{
	char	buf[SZ_LINE];
	char	str[SZ_LINE];
	char	cval;
	int	ival, nscan, n1, n2;
	int	onint(), oldint;
	double	dval;

	c_xwhen (X_INT, onint, &oldint);

	printf (">> \n");
	fflush (stdout);

	while (fgets (buf, SZ_LINE, stdin) != NULL) {
	    nscan = sscanf (buf,
		"%n%c %*s %d %lg %s%n", &n1, &cval, &ival, &dval, str, &n2);
	    printf ("nscan=%d: %d '%c' %d %g '%s' %d\n",
		nscan, n1, cval, ival, dval, str, n2);
	    printf (">> \n");
	    fflush (stdout);
	}

	eprintf ("all done\n");
}
예제 #4
0
파일: main.c 프로젝트: olebole/iraf
/* STARTUP -- CL startup code.  Called by onentry() at process startup.
 *   Allocate space for the dictionary, post exception handlers, initialize
 *   error recovery.
 *
 * NOTE: in the current implementation a fixed size buffer is allocated for
 *   the dictionary due to the difficulty of passing the dictionary to the
 *   bkg CL if a dynamically allocated dictionary is used.  The problem is
 *   that the dictionary is full of pointers to absolute addresses, and
 *   we cannot control where the memory allocator in the bkg CL will allocate
 *   a buffer.  A simple binary copy of the dictionary to different region
 *   of memory in the bkg CL will leave the pointers pointing into limbo.
 *
 */
static void
startup (void)
{
	void	onipc();

	/* Set up pointers to dictionary buffer.
	 */
	dictionary = cl_dictbuf;
	topd = 0;
	maxd = DICTSIZE;

	if (cldebug)
	    printf ("dictionary starts at %d (0%o)\n", dictionary, dictionary);

	/* Post exception handlers for interrupt and write to IPC with no
	 * reader.  The remaining exceptions use the standard handler.
	 */
	c_xwhen (X_IPC, onipc, &old_onipc);
	intr_reset();

	/* The following is a temporary solution to an initialization problem
	 * with pseudofile i/o.
	 */
	PRPSINIT();
}
예제 #5
0
파일: main.c 프로젝트: olebole/iraf
/* INTR_RESET -- Post the interrupt handler and clear the interrupt vector
 * save stack.
 */
void
intr_reset (void)
{
	PFI	junk;

	c_xwhen (X_INT, onint, &junk);
	intr_sp = 0;
}
예제 #6
0
파일: main.c 프로젝트: olebole/iraf
/* INTR_ENABLE -- Reenable interrupts, reposting the interrupt vector saved
 * in a prior call to INTR_DISABLE.
 */
void
intr_enable (void)
{
	PFI	junk;

	if (--intr_sp < 0)
	    cl_error (E_IERR, "interrupt save stack underflow");
	c_xwhen (X_INT, intr_save[intr_sp], &junk);
}
예제 #7
0
파일: main.c 프로젝트: olebole/iraf
/* INTR_DISABLE -- Disable interrupts, e.g., to protect a critical section
 * of code.
 */
void
intr_disable (void)
{
	PFI	junk;

	if (intr_sp >= LEN_INTRSTK)
	    cl_error (E_IERR, "interrupt save stack overflow");
	c_xwhen (X_INT, X_IGNORE, &junk);
	intr_save[intr_sp++] = (XINT) junk;
}