PROCEDURE faltstuhl;

VAR

	x: REAL;
	n: REAL;
	PageWidth: REAL;
	PageHight: REAL;
	PageFoldY: REAL;
	a: REAL;
	b: REAL;
	c: REAL;
	d: REAL;
	e: REAL;
	f: REAL;

BEGIN

	penPat(2);
	penFore(65535,0,0);

	PageWidth:=210;
	PageHight:=297;
	PageFoldY:=PageHight/2;

	moveto(-PageWidth/2,0);
	lineto(PageWidth/2,0);

	moveto(-PageWidth/2,-PageHight/2);
	lineto(PageWidth/2,-PageHight/2);
	lineto(PageWidth/2,PageHight/2);
	lineto(-PageWidth/2,PageHight/2);
	lineto(-PageWidth/2,-PageHight/2);
	
	x:=px;
	n:=pn;
	a:=pa;
	b:=pb;
	c:=pc;
	d:=pd;
	e:=pe;
	f:=pf;

	IF (b<(c+e)) THEN BEGIN
	IF (a<(d+f)) THEN BEGIN

	{schnittlinien}

	penPat(2);
	penFore(0,0,65535);

	moveto(-x-n/2,-b);
	lineto(-x-n/2,-b+a);
	moveto(-n/2,-c-e);
	lineto(-n/2,d+f);

	moveto(n/2,-c-e);
	lineto(n/2,d+f);
	moveto(n/2+x,-b);
	lineto(n/2+x,-b+a);

	moveto(-x-n/2,a);
	lineto(-x-n/2-a,a);
	lineto(-x-n/2-a,-b+a);
	lineto(-x-n/2,-b+a);

	moveto(x+n/2,a);
	lineto(x+n/2+a,a);
	lineto(x+n/2+a,-b+a);
	lineto(x+n/2,-b+a);

	{faltlinien}

	penFore(0,65535,0);
	penPat(3);

	moveto(-x-n/2,-b);
	lineto(-n/2,-b);
	moveto(-x-n/2,-b+a);
	lineto(-n/2,-b+a);
	
	moveto(-x-n/2,a);
	lineto(-n/2,a);
	moveto(-n/2,-c-e);
	lineto(n/2,-c-e);
	
	moveto(-n/2,-c-e+f);
	lineto(n/2,-c-e+f);
	moveto(-n/2,-c+f);
	lineto(n/2,-c+f);
	
	moveto(-n/2,d+f-c);
	lineto(n/2,d+f-c);
	moveto(-n/2,d+f);
	lineto(n/2,d+f);

	moveto(n/2,-b);
	lineto(n/2+x,-b);
	moveto(n/2,-b+a);
	lineto(n/2+x,-b+a);

	moveto(n/2,a);
	lineto(n/2+x,a);

	moveto(-x-n/2,-b+a);
	lineto(-x-n/2,a);
	moveto(x+n/2,-b+a);
	lineto(x+n/2,a);

	END;
	END;
END;

RUN(faltstuhl);