
/*  This provides the outermost framework of LOGO, calling the parser to
 *	begin with, and then thereafter whenever an interrupt or error occurs.
 *	Copyright (C) 1979, The Children's Museum, Boston, Mass.
 *	Written by Douglas B. Klunder.
 */

#if 0

	Edit History:

		07/87 - Scott Evernden
				USENET:	seismo!harvard!m2c!applix!scott
				CIS:	73116,3451
				BIX:	s_evernden
				PLINK:	SCOTT E
				Found on Usenet; ported to Amiga.

#endif


#include "logo.h"

#ifdef AMIGA
extern long FindTask();
#endif

char editfile[30];
extern char *getbpt;
#ifndef NOTURTLE
extern int turtdes;
extern struct display *mydpy;
#endif
#ifdef SETCURSOR
#ifndef AMIGA
#include <sgtty.h>
struct sgttyb tty;
#endif
#endif

main(argc,argv)
int argc;
char *argv[];
{
	int i[2];
	char tbuff[BUFSIZ];

	setbuf(stdout,tbuff);
#ifdef AMIGA
	amiga_start(argc, argv);
#endif
	time(i);
	SRAND(i[1]+i[0]);
#ifndef AMIGA
	sprintf(editfile,"/tmp/logo%u",(short)getpid());
#else
	sprintf(editfile,"ram:logo%lx",FindTask((char *)NULL));
#endif
#ifdef SETCURSOR
#ifndef AMIGA
	gtty(1,&tty);
#endif
#endif
	if (argc>1)
		getbpt = argv[1];
	else
		printf("\nWelcome to Children's Museum/LSRHS LOGO\n?");
	fflush(stdout);
	while (enter()==1) {
		yyprompt(1);
	}
	cboff();

#ifdef SETCURSOR
#ifdef AMIGA
	set_con();
#else
	stty(1,&tty);
#endif
#endif

#ifndef NOTURTLE
#ifdef FLOOR
	if (turtdes>0)
		printf("Please\007 unplug the turtle\007 and put it\007 away.\n");
#endif
	if (turtdes<0) {
		printf(mydpy->finish);
		(*mydpy->outfn)();
	}
#endif
	unlink(editfile);

#ifdef AMIGA
	amiga_end();
#endif
}

