File:  [Research Unix] / researchv10no / libj / menu.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

#include "jerq.h"
#include "commands.h"
#include "io.h"

#define MAXMENU 20
Menu *menutab[MAXMENU];

static char **table;

static char *tablegen(i)
{
	return table[i];
}

int findMenu(m) Menu *m;
{	int i, j;
	char *s, *(*generator)();

	for (i=0; i<MAXMENU && menutab[i]!=m & menutab[i]!=(Menu *)NULL; i++) ;
	if (i==MAXMENU) i=nrand(MAXMENU);
	if (menutab[i]!=m) {
		menutab[i] = m;
		sendCommand(CCMENU);
		sendInt(i);
		generator = (table=m->item) ? tablegen : m->generator;
		for(j=0; s=(*generator)(j); ++j) ;
		sendInt(j);
		for(j=0; s=(*generator)(j); ++j) sendToChar(s);
	}
	return(i);
}


int menuhit(m, b) Menu *m; int b;
{	int i;
	i = findMenu(m);
	sendCommand(CCMENUHIT);
	sendInt(i);
	sendInt(b);
	flush();
	clearMouseQ();
	return recInt();
}


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.