/*
 ----------------------------------------------------------------
 |    Perlin Production Corporation, February-April 1993 (c).	|##
 |   WINDOW PACKAGE Source Code for SuperSoft C 1.2.3 compiler.	|##
 |    V e r s i o n  3.1 , part 16. LAST CHANGES: 08.05.1993.	|##
 ----------------------------------------------------------------##
  #################################################################

			LIST OF FUNCTIONS:
	w_info
*/

#include "stdio.h"
#include "conio.h"
#include "wios.h"
#include "stddef.h"

w_info(text,n,wn)
char *text[],n;
WINDOW *wn;
{
	int i,current;
	char symbol;
	
	if ( n < wn->t_hgt )
	{
		mv_csr(0,0,wn);
		for (i=0 ; i < n ; i++)
		{
			w_string(text[i],wn);
		}
		return;
	}
	current=0;
	FOREVER
	{
		mv_csr(0,0,wn);
		for (i=0; i < wn->t_hgt ; i++)
		{
			w_string(text[current+i],wn);
		}
		do
		{
			symbol=toupper(ki());
			switch (symbol)
			{
				case UP		: {current--;break;}
				case DOWN	: {current++;break;}
				case RIGHT	: {current+=wn->t_hgt;break;}
				case LEFT	: {current-=wn->t_hgt;break;}
				case STR	: {current=n-wn->t_hgt;break;}
				case HOME	: {current=0;break;}
				case ESC	: {wrt_esc(NORM_VID);return;}
				default		: symbol=NULL;
			}
		}
		while ( symbol==NULL );
		if (current+wn->t_hgt > n) current=n-wn->t_hgt;
		if (current < 0) current=0;
	}
}
