#include"DEL_PRN.H"

enum PRNERR	prn_linefeed(signed int height)
{
	enum PRNERR	temp;

	height -= Prn_minheight_;

	switch(Prn_mode)
	{
	case PRNMODE_ESCP:
		if	(height>=256 || height<0)
			return PRNERR_BADDATA;
		else
		{
			static	char	code[] = {0x1b,'J',0,'\r'};

			code[2] = (unsigned char)height;

			temp = prn_putcode(4,code);
			if	(temp)
				return temp;
		}
		break;

	case PRNMODE_PCPR:
		height = height*2/3;
	case PRNMODE_MSX:
		if	(height>99 || height<0)
			return PRNERR_BADDATA;
		else
		{
			static	char	code[] = {0x1b,'T','0','0','\r','\n'};

			code[2] = height/10 + '0';
			code[3] = height%10 + '0';

			temp = prn_putcode(6,code);
			if	(temp)
				return temp;
		}
		break;
	default:
		return PRNERR_BADDATA;
	}

	Prn_carridge = 0;

	while	(Prn_funcnum_ > 0)
		Prn_functable_[--Prn_funcnum_]();

	Prn_islinestart_ = 1;
	return PRNERR_OK;
}
