Metropoli BBS
VIEWER: aplgrps.c MODE: TEXT (ASCII)
/*Copyright (C) 1992, 1995 by Thomas Glen Smith.  All Rights Reserved.*/
/* aplgrps APL2 V1.0.0 *************************************************
* Called from aplwksp to do )FNS, )GRPS, and )VARS.                    *
***********************************************************************/
#define INCLUDES APLCB+APLTOKEN+STRING+TREE
#include "includes.h"
void aplgrps(rite,cp,cpend,code)
Aplcb rite; /* aplcb for command text */
char *cp; /* Pointer to char immediately after right parenthesis */
char *cpend; /* Pointer to end of command text */
int code; /* 1=groups, 2=variables, 3=functions, 4=all */
{
	Aplgrpsb; Execpop; Execpars;
	extern int aplerr;
	extern Treelist treehdr; /* variable tree stack */
	Apltoken tok;
	Treelist workhdr;
	char *ch,con[] = {'\001','\0'}; /* lowest character value */

	if (treehdr == NULL) return; /* nothing to report */
	if (NULL != (tok = execpars(cp,cpend-cp))) {
		ch = tok->token_ptr.token_string;
		if (tok->token_code != OPERAND_TOKEN ||
			tok->token_queue.token_next_ptr != NULL ||
			1 != strlen(ch)) aplerr = 58; /* syntax error */
	}
	else
		ch = con;
	if (aplerr == 0)
		for (workhdr = (Treelist) treehdr; workhdr != NULL;
			workhdr = workhdr->treenext)
			aplgrpsb(ch,code,workhdr->avlhdr);
	execpop(&tok);
}
[ RETURN TO DIRECTORY ]