MODULE EncStdMap_iso8859_16;

	(* This file was generated automatically *)

	(* Source: http://www.unicode.org/Public/MAPPINGS/ISO8859/8859-16.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,0A7H,0A9H,0ABH,0ADH,0B0H,0B1H,0B6H,0B7H,0BBH,0C0H..0C2H,0C4H,0C6H..0CFH,0D2H..0D4H,0D6H,0D9H..0DCH,0DFH..0E2H,0E4H,0E6H..0EFH,0F2H..0F4H,0F6H,0F9H..0FCH,0FFH: y := 00H + x
			| 0150H: y := 0D5H
			| 0171H: y := 0F8H
			| 0143H: y := 0D1H
			| 0218H: y := 0AAH
			| 201DH: y := 0B5H
			| 015BH: y := 0F7H
			| 0104H,0105H: y := -63H + x
			| 0219H: y := 0BAH
			| 0151H: y := 0F5H
			| 010CH: y := 0B2H
			| 201EH: y := 0A5H
			| 010DH: y := 0B9H
			| 0144H: y := 0F1H
			| 0179H: y := 0ACH
			| 017AH,017BH: y := -0CCH + x
			| 017DH: y := 0B4H
			| 017EH: y := 0B8H
			| 0106H: y := 0C5H
			| 0110H: y := 0D0H
			| 0102H: y := 0C3H
			| 017CH: y := 0BFH
			| 021AH: y := 0DEH
			| 0118H: y := 0DDH
			| 0160H,0178H: y := -0BAH + x
			| 0161H: y := 0A8H
			| 0107H: y := 0E5H
			| 0111H: y := 0F0H
			| 0103H: y := 0E3H
			| 0141H: y := 0A3H
			| 021BH: y := 0FEH
			| 0119H: y := 0FDH
			| 0170H: y := 0D8H
			| 0152H,0153H: y := -96H + x
			| 0142H: y := 0B3H
			| 20ACH: y := 0A4H
			| 015AH: y := 0D7H
			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,0A7H,0A9H,0ABH,0ADH,0B0H,0B1H,0B6H,0B7H,0BBH,0C0H..0C2H,0C4H,0C6H..0CFH,0D2H..0D4H,0D6H,0D9H..0DCH,0DFH..0E2H,0E4H,0E6H..0EFH,0F2H..0F4H,0F6H,0F9H..0FCH,0FFH: y := 00H + x
			| 0D7H: y := 015AH
			| 0A4H: y := 20ACH
			| 0B3H: y := 0142H
			| 0BCH,0BDH: y := 96H + x
			| 0D8H: y := 0170H
			| 0FDH: y := 0119H
			| 0FEH: y := 021BH
			| 0A3H: y := 0141H
			| 0E3H: y := 0103H
			| 0F0H: y := 0111H
			| 0E5H: y := 0107H
			| 0A8H: y := 0161H
			| 0A6H,0BEH: y := 0BAH + x
			| 0DDH: y := 0118H
			| 0DEH: y := 021AH
			| 0BFH: y := 017CH
			| 0C3H: y := 0102H
			| 0D0H: y := 0110H
			| 0C5H: y := 0106H
			| 0B8H: y := 017EH
			| 0B4H: y := 017DH
			| 0AEH,0AFH: y := 0CCH + x
			| 0ACH: y := 0179H
			| 0F1H: y := 0144H
			| 0B9H: y := 010DH
			| 0F8H: y := 0171H
			| 0B2H: y := 010CH
			| 0F5H: y := 0151H
			| 0BAH: y := 0219H
			| 0A1H,0A2H: y := 63H + x
			| 0F7H: y := 015BH
			| 0B5H: y := 201DH
			| 0AAH: y := 0218H
			| 0D1H: y := 0143H
			| 0A5H: y := 201EH
			| 0D5H: y := 0150H
			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_16.