[HECnet] REXEC-type feature over DECNET?

Jean-Yves Bernier bernier at pescadoo.net
Mon Feb 22 07:20:51 PST 2010


At 9:29 AM -0500 2/22/10, Steve Davidson wrote:

The task object mechanism works great!
I have used this with FORTRAN when I supported it for DEC.


For the fun:

This VAX program draws sliders on a VT100, then send the position of the
sliders in real time to a remote task named 'ihma' on node named 'syter'
running on a PDP-11 under RSX. I suppose it makes no difference if 'syter'
is a VAX node. I don't run VMS so I can't compile it, but it may be fun to
play with.


#include stdio

	/***************************/
	/* COMMUNICATION AVEC SYTER*/
	/***************************/

FILE *syter;

static char ihma[] = "syter\"user pass\"::\"task=ihma\"";
static char Command[255], Reponse[255];

EnvoyerAvecAR (msg) char* msg;
	{
	strcpy (Command, msg);
	write (fileno(syter), &Command, strlen(Command));
	read   (fileno(syter), &Reponse, sizeof(Reponse));
	}

EnvoyerSansAR (msg) char* msg;
	{
	strcpy (Command, msg);
	write (fileno(syter), &Command, strlen(Command));
	}


	/************************************/
	/* ENTRES-SORTIES TERMINAL PAR QIOS */
	/************************************/


#define IO$_WRITEVBLK 	0x30
#define IO$_READVBLK 	0x31
#define IO$M_NOECHO 	0x0040

typedef unsigned short int channel;
channel Assign (device) char *device;
	{
	channel chan;
	int devDescr[2];
	devDescr[1] = device;
	devDescr[0] = strlen(device);
	SYS$ASSIGN (&devDescr, &chan, 0,0);
	return (chan);
	}

QioRead (chan, bufa, bufl) channel chan; char *bufa; int bufl;
	{
	unsigned int iostatus[2];
    	SYS$QIOW (0, chan, (long) (IO$_READVBLK|IO$M_NOECHO),
			&iostatus,0, 0, bufa, bufl, 0,0,0,0);
	}

QioWrite (chan, bufa, bufl) channel chan; char *bufa; int bufl;
	{
	unsigned int iostatus[2];
	SYS$QIOW (0, chan, (long) IO$_WRITEVBLK,
			&iostatus,0, 0, bufa, bufl, 0,0,0,0);
	}

char NextChar (chan) channel chan;
	{ char ch; QioRead (chan, &ch, 1); return (ch); }


	/***************************/
	/* SEQUENCES D'ESCAPE ANSI */
	/***************************/


#define FROM	'0'	/* code pour effacement depuis le curseur */
#define UPTO	'1'	/* code pour effacement jusqu'au curseur */
#define ALL	'2'	/* code pour effacement entite complete */

#define NORMAL	'0'	/* attribut video rendement normal */
#define BOLD	'1'	/* attribut video surintensite */
#define UNDER	'4'	/* attribut video soulignement */
#define BLINK	'5'	/* attribut video clignotement */
#define REVER	'7'	/* attribut video inversion */

#define NEWLIN	'0'	/* mode new line */
#define KEYPAD	'1'	/* mode application */
#define COL132	'3'	/* mode 132 colonnes */
#define SMOOTH	'4'	/* mode montee lente */
#define WHITEB	'5'	/* mode fond blanc */
#define RELATI	'6'	/* mode adressage relatif */
#define WRAPAR	'7'	/* mode pliage de ligne */
#define REPEAT	'8'	/* mode repetition auto */
#define INTERL	'9'	/* mode balayage entrelace */

#define ON	'h'	/* selection modes ci-dessus */
#define OFF	'l'	/* deselection modes ci-dessus */

#define UK	'A'	/* jeu de caracteres United Kingdom */
#define US	'B'	/* jeu de caracteres United States */
#define SG	'0'	/* jeu de caracteres Semi Graphics */
#define A1	'1'	/* jeu de caracteres Alternate 1 */
#define A2	'2'	/* jeu de caracteres Alternate 2 */


#define vtposit(lin, col)	printf ("\33[%u;%uf", lin, col)
#define vtwindo(li1, li2)	printf ("\33[%u;%ur", li1, li2)
#define vtattri(attribut) 	printf ("\33[%cm", attribut)
#define vtsmode(car, sel)	printf ("\33[?%c%c", car, sel)
#define vtcursr(sel)		printf ("\33[?25%c", sel)
#define vtclscr(mode)		printf ("\33[%cJ", mode)
#define vtcline(mode)		printf ("\33[%cK", mode)
#define vtcarac(cset)		printf ("\33(%c", cset)

#define GetTime(tim)		SYS$GETTIM (tim)
#define putstr(str)		printf ("%s",str)

#define max(x,y)		(x>y ? x : y)
#define min(x,y)		(x>y ? y : x)

#define NON 0
#define OUI 1


#define VALMIN       0
#define VALMAX 1000

typedef struct {
	char name [16];
	short lmin, cmin;		/* ligne et colonne minimum */
	short lmax, cmax;		/* ligne et colonne maximum */
	short lcur, ccur;		/* ligne et colonne curseur */
	int value;
	} potard;



static int PALLOC = 0;
static potard PLIST [16];


potard *CreatePot (lmin, lmax, cmin, cmax, label)
	short lmin, lmax, cmin, cmax; char *label;
	{
	potard *w;
	w = &PLIST [PALLOC++];
	w->value = VALMIN;
	w->lmin = lmin;	  w->cmin = cmin;
	w->lmax = lmax;	  w->cmax = cmax;
	w->lcur = lmax-1; w->ccur = (cmax+cmin)/2;
	strcpy (w->name, label);
	DrawPot (w); return (w);
	}

DrawLabl (w, hiLite) potard *w; int hiLite;
	{
	if (hiLite) vtattri (REVER);
	vtposit (w->lmax+1, w->cmin); putstr (w->name);
	if (hiLite) vtattri (NORMAL);
	}

DrawValu (w) potard *w;
	{
	vtposit (w->lmin-1, w->cmin); printf (" %+06u ", w->value);
	}

DrawCurs (w, drawIt) potard *w; int drawIt;
	{
	vtposit (w->lcur, w->ccur);
	if (drawIt) putchar ('`'); else putchar (' ');
	}

DrawPot (w) potard *w;
	{
	int i; char *deb, *fin, buff[132];

	deb = fin = &buff; 		/* LIGNES HORIZONTALES */
	for (i=0; i<=w->cmax-w->cmin; ++i) *fin++ = 'q'; *fin = 0;

	*deb='l'; *(fin-1)='k'; vtposit (w->lmin,w->cmin); putstr (&buff);
	*deb='m'; *(fin-1)='j';	vtposit (w->lmax,w->cmin); putstr (&buff);

	deb = fin = &buff;		/* LIGNES VERTICALES */
	for (i=0; i<=w->cmax-w->cmin; ++i) *fin++ = ' '; *fin = 0;

	*deb = 't'; *(deb+1) = 'q'; *(fin-1) = 'x';
	for (i = w->lmin+1; i < w->lmax; ++i)
            		{ vtposit (i, w->cmin); putstr (&buff); }

	DrawCurs (w, OUI);
	DrawLabl (w, NON);
	DrawValu (w);
	}


Slide (pot, incr) int pot; int incr;
	{
	potard *w;
	int newpos;
	char msg[255];
	w = &PLIST[pot];
	w->value += incr;
	if (w->value < VALMIN) w->value = VALMIN;
	if (w->value > VALMAX) w->value = VALMAX;
	newpos = w->lmax-1 - (w->lmax-w->lmin-2) * (w->value-VALMIN)
					/ (VALMAX-VALMIN);
	if (newpos != w->lcur)
		{ DrawCurs (w,NON); w->lcur = newpos; DrawCurs (w,OUI); }
	DrawValu (w);

	sprintf (&msg, "ER %u %u.", pot+1, w->value);
	EnvoyerSansAR (msg);
	}



#define ESC '\033'

DragPots ()
	{
	channel term;
	int doIt=OUI; char kbd;
	int select=0, delta=1, delai;
	unsigned int avant[4], apres[4];

	DrawLabl (&PLIST[select], OUI);
	term = Assign ("TT");

	do   {
		GetTime (&avant); do ; while (NextChar(term) != ESC);
		GetTime (&apres); delai = (apres[0]-avant[0])/100000;
		if (delai <   1) { if (delta < 100) ++delta; } else
		if (delai < 10) { if (delta >   10) ++delta; } else
				delta =     1;

		NextChar(term); switch (NextChar(term))
			{
		/* ^ */	case 'A':       {	Slide (select,   delta); break; }
		/* V */	case 'B':       {	Slide (select, -delta); break; }

		/* < */	case 'D':       {	DrawLabl (&PLIST[select], NON);
					select = (select+7)%8;
					DrawLabl (&PLIST[select], OUI);
					break; }

		/* > */	case 'C':       {	DrawLabl (&PLIST[select], NON);
				          	select = (select+1)%8;
					DrawLabl (&PLIST[select], OUI);
					break; }

			default: doIt = NON;
			}
  	        } 	while (doIt);
	}



main ()
	{
	syter = fopen (&ihma, "w");
	printf ("Connexion    Syter, status = %u\n", ferror (syter));
	getchar ();

	EnvoyerAvecAR ("RI SYG$LIBRARY:S8");
	EnvoyerAvecAR ("EX");

	vtcarac (SG);
	vtclscr (ALL);
	vtcursr (OFF);

	CreatePot (02, 23, 02, 09, " V.LECT ");
	CreatePot (02, 23, 12, 19, " TRANSP ");
	CreatePot (02, 23, 22, 29, " FR.PRE ");
	CreatePot (02, 23, 32, 39, " BAND.P ");
	CreatePot (02, 23, 42, 49, " GAIN.P ");
	CreatePot (02, 23, 52, 59, " FR.INF ");
	CreatePot (02, 23, 62, 69, " FR.SUP ");
	CreatePot (02, 23, 72, 79, " VOLUME ");

	DragPots ();

	vtclscr (ALL);
	vtcursr (ON);
	vtcarac (US);

	EnvoyerAvecAR ("AR");
	EnvoyerAvecAR ("FI");
	fclose (syter);
	}



-- 
Jean-Yves Bernier



More information about the Hecnet-list mailing list