MODULE EncStdMap_iso8859_13;

	(* This file was generated automatically *)

	(* Source: http://www.unicode.org/Public/MAPPINGS/ISO8859/8859-13.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,0A2H..0A4H,0A6H,0A7H,0A9H,0ABH..0AEH,0B0H..0B3H,0B5H..0B7H,0B9H,0BBH..0BEH,0C4H,0C5H,0C9H,0D3H,0D5H..0D7H,0DCH,0DFH,0E4H,0E5H,0E9H,0F3H,0F5H..0F7H,0FCH: y := 00H + x
			| 015AH,017EH: y := -80H + x
			| 201DH: y := 0A1H
			| 0173H: y := 0F8H
			| 017CH: y := 0FDH
			| 014CH: y := 0D4H
			| 0145H: y := 0D2H
			| 0143H: y := 0D1H
			| 0161H: y := 0F0H
			| 016BH: y := 0FBH
			| 201CH: y := 0B4H
			| 012EH: y := 0C1H
			| 013BH: y := 0CFH
			| 0136H: y := 0CDH
			| 0141H: y := 0D9H
			| 015BH: y := 0FAH
			| 012AH: y := 0CEH
			| 014DH: y := 0F4H
			| 0122H: y := 0CCH
			| 201EH: y := 0A5H
			| 0146H: y := 0F2H
			| 0144H: y := 0F1H
			| 0118H: y := 0C6H
			| 012FH: y := 0E1H
			| 013CH: y := 0EFH
			| 0112H,0116H: y := -4BH + x
			| 0137H: y := 0EDH
			| 0142H: y := 0F9H
			| 0104H,010CH: y := -44H + x
			| 0106H: y := 0C3H
			| 0F8H: y := 0B8H
			| 0100H: y := 0C2H
			| 012BH: y := 0EEH
			| 017DH: y := 0DEH
			| 0123H: y := 0ECH
			| 0119H: y := 0E6H
			| 0D8H: y := 0A8H
			| 0179H: y := 0CAH
			| 0113H,0117H: y := -2CH + x
			| 0E6H: y := 0BFH
			| 0105H,010DH: y := -25H + x
			| 0107H: y := 0E3H
			| 0101H: y := 0E2H
			| 017BH: y := 0DDH
			| 0157H: y := 0BAH
			| 2019H: y := 0FFH
			| 0172H: y := 0D8H
			| 0C6H: y := 0AFH
			| 0160H,017AH: y := -90H + x
			| 016AH: y := 0DBH
			| 0156H: y := 0AAH
			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,0A2H..0A4H,0A6H,0A7H,0A9H,0ABH..0AEH,0B0H..0B3H,0B5H..0B7H,0B9H,0BBH..0BEH,0C4H,0C5H,0C9H,0D3H,0D5H..0D7H,0DCH,0DFH,0E4H,0E5H,0E9H,0F3H,0F5H..0F7H,0FCH: y := 00H + x
			| 0DAH,0FEH: y := 80H + x
			| 0E7H,0EBH: y := 2CH + x
			| 0FFH: y := 2019H
			| 0DBH: y := 016AH
			| 0D0H,0EAH: y := 90H + x
			| 0AFH: y := 0C6H
			| 0D8H: y := 0172H
			| 0BAH: y := 0157H
			| 0DDH: y := 017BH
			| 0DEH: y := 017DH
			| 0E3H: y := 0107H
			| 0E0H,0E8H: y := 25H + x
			| 0BFH: y := 0E6H
			| 0AAH: y := 0156H
			| 0CAH: y := 0179H
			| 0A8H: y := 0D8H
			| 0E6H: y := 0119H
			| 0ECH: y := 0123H
			| 0E2H: y := 0101H
			| 0EEH: y := 012BH
			| 0C2H: y := 0100H
			| 0B8H: y := 0F8H
			| 0C3H: y := 0106H
			| 0C0H,0C8H: y := 44H + x
			| 0F0H: y := 0161H
			| 0F9H: y := 0142H
			| 0EDH: y := 0137H
			| 0C7H,0CBH: y := 4BH + x
			| 0EFH: y := 013CH
			| 0E1H: y := 012FH
			| 0C6H: y := 0118H
			| 0F1H: y := 0144H
			| 0F2H: y := 0146H
			| 0CCH: y := 0122H
			| 0F4H: y := 014DH
			| 0CEH: y := 012AH
			| 0FAH: y := 015BH
			| 0B4H: y := 201CH
			| 0CDH: y := 0136H
			| 0CFH: y := 013BH
			| 0C1H: y := 012EH
			| 0FBH: y := 016BH
			| 0D9H: y := 0141H
			| 0D1H: y := 0143H
			| 0D2H: y := 0145H
			| 0D4H: y := 014CH
			| 0A5H: y := 201EH
			| 0F8H: y := 0173H
			| 0A1H: y := 201DH
			| 0FDH: y := 017CH
			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_13.