MODULE EncStdMap_iso8859_3;

	(* This file was generated automatically *)

	(* Source: http://www.unicode.org/Public/MAPPINGS/ISO8859/8859-3.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,0A4H,0A7H,0A8H,0ADH,0B0H,0B2H..0B5H,0B7H,0B8H,0BDH,0C0H..0C2H,0C4H,0C7H..0CFH,0D1H..0D4H,0D6H,0D7H,0D9H..0DCH,0DFH..0E2H,0E4H,0E7H..0EFH,0F1H..0F4H,0F6H,0F7H,0F9H..0FCH: y := 00H + x
			| 0124H,015CH: y := -7EH + x
			| 0135H: y := 0BCH
			| 0131H: y := 0B9H
			| 0127H: y := 0B1H
			| 011EH: y := 0ABH
			| 016DH: y := 0FDH
			| 0125H: y := 0B6H
			| 011FH: y := 0BBH
			| 015DH: y := 0FEH
			| 015FH: y := 0BAH
			| 02D9H: y := 0FFH
			| 017BH: y := 0AFH
			| 0120H: y := 0D5H
			| 010AH: y := 0C5H
			| 011CH: y := 0D8H
			| 0108H: y := 0C6H
			| 017CH: y := 0BFH
			| 02D8H: y := 0A2H
			| 015EH: y := 0AAH
			| 0121H: y := 0F5H
			| 010BH: y := 0E5H
			| 011DH: y := 0F8H
			| 0109H: y := 0E6H
			| 016CH: y := 0DDH
			| 0134H: y := 0ACH
			| 0130H: y := 0A9H
			| 0126H: y := 0A1H
			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,0A4H,0A7H,0A8H,0ADH,0B0H,0B2H..0B5H,0B7H,0B8H,0BDH,0C0H..0C2H,0C4H,0C7H..0CFH,0D1H..0D4H,0D6H,0D7H,0D9H..0DCH,0DFH..0E2H,0E4H,0E7H..0EFH,0F1H..0F4H,0F6H,0F7H,0F9H..0FCH: y := 00H + x
			| 0A1H: y := 0126H
			| 0A9H: y := 0130H
			| 0ACH: y := 0134H
			| 0DDH: y := 016CH
			| 0E6H: y := 0109H
			| 0BAH: y := 015FH
			| 0E5H: y := 010BH
			| 0F5H: y := 0121H
			| 0AAH: y := 015EH
			| 0A2H: y := 02D8H
			| 0FEH: y := 015DH
			| 0BFH: y := 017CH
			| 0C6H: y := 0108H
			| 0D8H: y := 011CH
			| 0C5H: y := 010AH
			| 0D5H: y := 0120H
			| 0AFH: y := 017BH
			| 0FFH: y := 02D9H
			| 0F8H: y := 011DH
			| 0BBH: y := 011FH
			| 0B6H: y := 0125H
			| 0FDH: y := 016DH
			| 0ABH: y := 011EH
			| 0B1H: y := 0127H
			| 0B9H: y := 0131H
			| 0BCH: y := 0135H
			| 0A6H,0DEH: y := 7EH + 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_3.