MODULE EncStdMap_iso8859_10;

	(* This file was generated automatically *)

	(* Source: http://www.unicode.org/Public/MAPPINGS/ISO8859/8859-10.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,0ADH,0B0H,0B7H,0C1H..0C6H,0C9H,0CBH,0CDH..0D0H,0D3H..0D6H,0D8H,0DAH..0DFH,0E1H..0E6H,0E9H,0EBH,0EDH..0F0H,0F3H..0F6H,0F8H,0FAH..0FEH: y := 00H + x
			| 0122H: y := 0A3H
			| 014CH,0173H: y := -7AH + x
			| 012BH: y := 0B4H
			| 0129H,0145H: y := -74H + x
			| 0169H: y := 0F7H
			| 0112H,0123H: y := -70H + x
			| 0110H,012EH: y := -67H + x
			| 0104H: y := 0A1H
			| 0113H: y := 0B2H
			| 014DH: y := 0F2H
			| 0111H: y := 0B9H
			| 0146H: y := 0F1H
			| 0105H: y := 0B1H
			| 017DH: y := 0ACH
			| 0118H: y := 0CAH
			| 0116H: y := 0CCH
			| 012FH: y := 0E7H
			| 010CH: y := 0C8H
			| 017EH: y := 0BCH
			| 0100H: y := 0C0H
			| 016AH: y := 0AEH
			| 0166H: y := 0ABH
			| 0138H: y := 0FFH
			| 0160H: y := 0AAH
			| 0119H: y := 0EAH
			| 016BH: y := 0BEH
			| 0167H: y := 0BBH
			| 0117H: y := 0ECH
			| 0161H: y := 0BAH
			| 010DH: y := 0E8H
			| 0101H: y := 0E0H
			| 014AH: y := 0AFH
			| 0172H: y := 0D9H
			| 013BH: y := 0A8H
			| 0168H: y := 0D7H
			| 0136H: y := 0A6H
			| 2015H: y := 0BDH
			| 014BH: y := 0BFH
			| 012AH: y := 0A4H
			| 013CH: y := 0B8H
			| 0128H: y := 0A5H
			| 0137H: y := 0B6H
			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,0ADH,0B0H,0B7H,0C1H..0C6H,0C9H,0CBH,0CDH..0D0H,0D3H..0D6H,0D8H,0DAH..0DFH,0E1H..0E6H,0E9H,0EBH,0EDH..0F0H,0F3H..0F6H,0F8H,0FAH..0FEH: y := 00H + x
			| 0B6H: y := 0137H
			| 0A5H: y := 0128H
			| 0B8H: y := 013CH
			| 0A4H: y := 012AH
			| 0D7H: y := 0168H
			| 0BFH: y := 014BH
			| 0A6H: y := 0136H
			| 0BDH: y := 2015H
			| 0A8H: y := 013BH
			| 0D9H: y := 0172H
			| 0AFH: y := 014AH
			| 0E0H: y := 0101H
			| 0E8H: y := 010DH
			| 0BAH: y := 0161H
			| 0ECH: y := 0117H
			| 0BBH: y := 0167H
			| 0BEH: y := 016BH
			| 0EAH: y := 0119H
			| 0AAH: y := 0160H
			| 0FFH: y := 0138H
			| 0ABH: y := 0166H
			| 0AEH: y := 016AH
			| 0C0H: y := 0100H
			| 0BCH: y := 017EH
			| 0C8H: y := 010CH
			| 0E7H: y := 012FH
			| 0CCH: y := 0116H
			| 0CAH: y := 0118H
			| 0ACH: y := 017DH
			| 0B1H: y := 0105H
			| 0F1H: y := 0146H
			| 0B9H: y := 0111H
			| 0F2H: y := 014DH
			| 0B2H: y := 0113H
			| 0A1H: y := 0104H
			| 0A9H,0C7H: y := 67H + x
			| 0A2H,0B3H: y := 70H + x
			| 0F7H: y := 0169H
			| 0B5H,0D1H: y := 74H + x
			| 0B4H: y := 012BH
			| 0D2H,0F9H: y := 7AH + x
			| 0A3H: y := 0122H
			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_10.