/*Copyright (C) 1992, 1995 by Thomas Glen Smith. All Rights Reserved.*/
/* aplgrp APL2 V1.0.0 **************************************************
* Called from aplwksp to do )GRP. *
***********************************************************************/
#define INCLUDES APLCB+APLTOKEN+TREE
#include "includes.h"
void aplgrp(rite,cp,cpend)
Aplcb rite; /* aplcb for command text */
char *cp; /* Pointer to char immediately after right parenthesis */
char *cpend; /* Pointer to end of command text */
{
Execmsg; Execpars; Execpop; Quadout; Treenode;
extern int aplerr;
Apltoken tok;
Avlnode p;
Aplcb cb;
int cplen;
cplen = cpend - cp;
if (NULL == (tok = execpars(cp,cplen)) ||
tok->token_code != OPERAND_TOKEN ||
tok->token_queue.token_next_ptr != NULL)
aplerr = 58; /* syntax error */
else if (NULL == (p = treenode(tok->token_ptr.token_string)) ||
NULL == (cb = p->avlleaf) || !(cb->aplflags & APLGROUP))
aplerr = 119; /* undefined group name */
else cb = quadout(cb); /* print group */
execpop(&tok);
}