MODULE EncStdMap_iso8859_7;

	(* This file was generated automatically *)

	(* Source: http://www.unicode.org/Public/MAPPINGS/ISO8859/8859-7.TXT *)

	IMPORT Codecs := EncCodecs;

	TYPE
		Encoder = POINTER TO RECORD (Codecs.Encoder) END;
		Decoder = POINTER TO RECORD (Codecs.Decoder) END;

	(* Encoder *)

	PROCEDURE (e: Encoder) Encode (IN f: ARRAY OF CHAR; VAR fR, fLen: INTEGER; VAR t: ARRAY OF SHORTCHAR; VAR tW: INTEGER);
		VAR x, y: INTEGER;
	BEGIN
		WHILE fLen > 0 DO
			x := ORD(f[fR]);
			CASE x OF
			| 00H..0A0H,0A3H,0A6H..0A9H,0ABH..0ADH,0B0H..0B3H,0B7H,0BBH,0BDH: y := 00H + x
			| 2018H,2019H: y := -1F77H + x
			| 037AH,0384H..0386H,0388H..038AH,038CH,038EH..03A1H,03A3H..03CEH: y := -02D0H + x
			| 20AFH: y := 0A5H
			| 20ACH: y := 0A4H
			| 2015H: y := 0AFH
			ELSE
				RETURN
			END;
			t[tW] := SHORT(CHR(y)); INC(tW);
			INC(fR); DEC(fLen)
		END
	END Encode;

	PROCEDURE NewEncoder* (): Codecs.Encoder;
		VAR e: Encoder;
	BEGIN
		NEW(e); RETURN e
	END NewEncoder;

	(* Decoder *)

	PROCEDURE (d: Decoder) Decode (IN f: ARRAY OF SHORTCHAR; VAR fR, fLen: INTEGER; VAR t: ARRAY OF CHAR; VAR tW: INTEGER; OUT state: BOOLEAN);
		VAR x, y: INTEGER;
	BEGIN
		WHILE fLen > 0 DO
			x := ORD(f[fR]);
			CASE x OF
			| 00H..0A0H,0A3H,0A6H..0A9H,0ABH..0ADH,0B0H..0B3H,0B7H,0BBH,0BDH: y := 00H + x
			| 0AFH: y := 2015H
			| 0A4H: y := 20ACH
			| 0A5H: y := 20AFH
			| 0AAH,0B4H..0B6H,0B8H..0BAH,0BCH,0BEH..0D1H,0D3H..0FEH: y := 02D0H + x
			| 0A1H,0A2H: y := 1F77H + x
			ELSE
				RETURN
			END;
			t[tW] := CHR(y); INC(tW);
			INC(fR); DEC(fLen)
		END;
		state := FALSE
	END Decode;

	PROCEDURE (d: Decoder) Reset, EMPTY;

	PROCEDURE NewDecoder* (): Codecs.Decoder;
		VAR d: Decoder;
	BEGIN
		NEW(d); RETURN d
	END NewDecoder;

END EncStdMap_iso8859_7.