MODULE EncStdMap_kz1048;

	(* This file was generated automatically *)

	(* Source: http://www.unicode.org/Public/MAPPINGS/VENDORS/MISC/KZ1048.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..7FH,0A0H,0A4H,0A6H,0A7H,0A9H,0ABH..0AEH,0B0H,0B1H,0B5H..0B7H,0BBH: y := 00H + x
			| 0409H: y := 8AH
			| 040AH: y := 8CH
			| 2013H,2014H: y := -1F7DH + x
			| 04AEH: y := 0AFH
			| 049BH: y := 9DH
			| 04AFH: y := 0BFH
			| 0492H: y := 0AAH
			| 04A2H,04A3H: y := -03E5H + x
			| 0410H..044FH: y := -0350H + x
			| 2116H: y := 0B9H
			| 0401H: y := 0A8H
			| 0406H: y := 0B2H
			| 0453H: y := 83H
			| 2022H: y := 95H
			| 2122H: y := 99H
			| 04E8H: y := 0A5H
			| 0452H: y := 90H
			| 045FH: y := 9FH
			| 0459H: y := 9AH
			| 045AH: y := 9CH
			| 04D8H,04E9H: y := -0435H + x
			| 2039H: y := 8BH
			| 04BAH: y := 8EH
			| 2030H: y := 89H
			| 20ACH: y := 88H
			| 0456H: y := 0B3H
			| 2026H: y := 85H
			| 203AH: y := 9BH
			| 04BBH,04D9H: y := -041DH + x
			| 201EH,2020H,2021H: y := -1F9AH + x
			| 0451H: y := 0B8H
			| 201AH: y := 82H
			| 040FH: y := 8FH
			| 0493H: y := 0BAH
			| 04B0H,04B1H: y := -040FH + x
			| 049AH: y := 8DH
			| 201CH,201DH: y := -1F89H + x
			| 2018H,2019H: y := -1F87H + x
			| 0402H,0403H: y := -0382H + x
			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..7FH,0A0H,0A4H,0A6H,0A7H,0A9H,0ABH..0AEH,0B0H,0B1H,0B5H..0B7H,0BBH: y := 00H + x
			| 8FH: y := 040FH
			| 80H,81H: y := 0382H + x
			| 91H,92H: y := 1F87H + x
			| 93H,94H: y := 1F89H + x
			| 8DH: y := 049AH
			| 0A1H,0A2H: y := 040FH + x
			| 0BAH: y := 0493H
			| 82H: y := 201AH
			| 0B8H: y := 0451H
			| 84H,86H,87H: y := 1F9AH + x
			| 9EH,0BCH: y := 041DH + x
			| 9BH: y := 203AH
			| 85H: y := 2026H
			| 0B3H: y := 0456H
			| 88H: y := 20ACH
			| 89H: y := 2030H
			| 8EH: y := 04BAH
			| 8BH: y := 2039H
			| 0A3H,0B4H: y := 0435H + x
			| 99H: y := 2122H
			| 9CH: y := 045AH
			| 9AH: y := 0459H
			| 9FH: y := 045FH
			| 90H: y := 0452H
			| 0A5H: y := 04E8H
			| 95H: y := 2022H
			| 83H: y := 0453H
			| 0B2H: y := 0406H
			| 0A8H: y := 0401H
			| 0B9H: y := 2116H
			| 0C0H..0FFH: y := 0350H + x
			| 0BDH,0BEH: y := 03E5H + x
			| 0AAH: y := 0492H
			| 0BFH: y := 04AFH
			| 9DH: y := 049BH
			| 0AFH: y := 04AEH
			| 96H,97H: y := 1F7DH + x
			| 8CH: y := 040AH
			| 8AH: y := 0409H
			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_kz1048.