Metropoli BBS
VIEWER: compute.c MODE: TEXT (ASCII)
/* Copyright (C) 1994 by Thomas Glen Smith.  All Rights Reserved. */
/** compute APL2 V1.0.0 ************************************************
* Called from execmond to perform the APL execute function.            *
***********************************************************************/
#define INCLUDES APLCB+APLMEM+TREE+APLFUNCI
#include "includes.h"
Aplcb compute(rite)
Aplcb rite; /* character variable to be computed */
{
	Errinit; Errstop; Executf; Pop; Treeroot;
	extern Treelist treehdr;
	Treelist root;
     Aplcb out=NULL;
     int i;

	if (errinit() == 0) {
		root = treeroot(NULL);
		if (root == NULL) return(NULL); /* out of memory? */
		out = executf(rite);
		rite = NULL; /* executf will have freed */
          i = treehdr->lastfun;
		root = pop(&treehdr); /* pop treehdr stack */
          treehdr->lastfun = i; /* propagate */
		free(root); /* free root */
     }
	return(errstop(0,NULL,rite,out));
}
[ RETURN TO DIRECTORY ]