MODULE EncStdMap_cp864;

	(* This file was generated automatically *)

	(* Source: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/PC/CP864.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..24H,26H..7FH,0A0H,0A3H,0A4H: y := 00H + x
			| 250CH: y := 8DH
			| 0FEE3H: y := 0E5H
			| 2502H: y := 86H
			| 2500H: y := 85H
			| 0FEDDH: y := 0FBH
			| 0D7H: y := 0DEH
			| 0FEB5H,0FEDBH,0FEECH: y := -0FDF8H + x
			| 0FEA5H,0FEE9H: y := -0FDF6H + x
			| 2534H: y := 8BH
			| 0FEF1H: y := 0FDH
			| 0FEA1H,0FEE5H: y := -0FDF3H + x
			| 0FECBH,0FED3H,0FEE1H: y := -0FDF2H + x
			| 0FE9DH: y := 0ADH
			| 0FE97H: y := 0CAH
			| 0FE99H: y := 0ABH
			| 0FEC5H: y := 0D8H
			| 0FE95H: y := 0AAH
			| 0FEC1H,0FEC9H: y := -0FDEAH + x
			| 0FEBFH: y := 0D6H
			| 0FEF2H,0FEF5H,0FEF6H: y := -0FDFCH + x
			| 0FE8EH,0FE8FH,0FEBBH: y := -0FDE6H + x
			| 0FEB7H: y := 0D4H
			| 0A2H: y := 0C0H
			| 0FEB9H,0FEDFH,0FEF0H: y := -0FDFBH + x
			| 060CH,061BH,061FH,0640H,0651H: y := -0560H + x
			| 0FE84H,0FECDH: y := -0FDDFH + x
			| 0FEF7H,0FEF8H,0FEFBH,0FEFCH: y := -0FE5EH + x
			| 0FEAFH,0FED5H,0FED9H: y := -0FDDDH + x
			| 0FEADH: y := 0D1H
			| 0FEABH: y := 0D0H
			| 0FEA9H: y := 0CFH
			| 0FEA7H,0FED0H: y := -0FDD9H + x
			| 0FEA3H: y := 0CDH
			| 0FEF3H: y := 0EAH
			| 0FE9FH: y := 0CCH
			| 0FEBDH: y := 0EBH
			| 252CH: y := 89H
			| 0ACH: y := 0DCH
			| 0FE7DH: y := 0F0H
			| 0A6H: y := 0DBH
			| 0FE93H: y := 0C9H
			| 0FE91H: y := 0C8H
			| 0FECEH: y := 0EDH
			| 0FE8DH: y := 0C7H
			| 066AH: y := 25H
			| 0FEEFH: y := 0E9H
			| 0FE85H: y := 0C4H
			| 0FE83H: y := 0C3H
			| 0FE80H,0FE81H: y := -0FDBFH + x
			| 0FE82H,0FEB3H,0FECCH: y := -0FDE0H + x
			| 0B7H: y := 81H
			| 253CH: y := 87H
			| 03C6H: y := 92H
			| 2248H: y := 96H
			| 0B0H: y := 80H
			| 0FEEBH: y := 0E7H
			| 0FE9BH: y := 0CBH
			| 0BDH: y := 94H
			| 0BCH: y := 95H
			| 0BBH: y := 98H
			| 03B2H: y := 90H
			| 0FEB1H,0FECFH,0FED7H: y := -0FDF5H + x
			| 0660H..0669H: y := -05B0H + x
			| 0B1H: y := 93H
			| 0FE8BH: y := 0C6H
			| 2524H: y := 88H
			| 0F7H: y := 0DDH
			| 2219H,221AH: y := -2197H + x
			| 25A0H: y := 0FEH
			| 0ABH: y := 97H
			| 251CH: y := 8AH
			| 0FED1H: y := 0BAH
			| 2592H: y := 84H
			| 221EH: y := 91H
			| 0ADH: y := 0A1H
			| 2518H: y := 8FH
			| 2514H: y := 8EH
			| 0FECAH,0FEEDH: y := -0FE05H + x
			| 2510H: y := 8CH
			| 0FEE7H: y := 0E6H
			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..24H,26H..7FH,0A0H,0A3H,0A4H: y := 00H + x
			| 0E6H: y := 0FEE7H
			| 0FEH: y := 25A0H
			| 8CH: y := 2510H
			| 0C5H,0E8H: y := 0FE05H + x
			| 8EH: y := 2514H
			| 0C4H: y := 0FE85H
			| 8FH: y := 2518H
			| 0BAH: y := 0FED1H
			| 0A1H: y := 0ADH
			| 91H: y := 221EH
			| 84H: y := 2592H
			| 0D4H: y := 0FEB7H
			| 8AH: y := 251CH
			| 97H: y := 0ABH
			| 82H,83H: y := 2197H + x
			| 0E7H: y := 0FEEBH
			| 0DDH: y := 0F7H
			| 88H: y := 2524H
			| 93H: y := 0B1H
			| 0C6H: y := 0FE8BH
			| 0B0H..0B9H: y := 05B0H + x
			| 90H: y := 03B2H
			| 89H: y := 252CH
			| 0E9H: y := 0FEEFH
			| 95H: y := 0BCH
			| 94H: y := 0BDH
			| 0CCH: y := 0FE9FH
			| 80H: y := 0B0H
			| 96H: y := 2248H
			| 92H: y := 03C6H
			| 87H: y := 253CH
			| 81H: y := 0B7H
			| 0EAH: y := 0FEF3H
			| 0C1H,0C2H: y := 0FDBFH + x
			| 0C3H: y := 0FE83H
			| 0ACH,0BBH,0BFH,0E0H,0F1H: y := 0560H + x
			| 25H: y := 066AH
			| 0C7H: y := 0FE8DH
			| 0EDH: y := 0FECEH
			| 0C8H: y := 0FE91H
			| 0C9H: y := 0FE93H
			| 0DBH: y := 0A6H
			| 0CAH: y := 0FE97H
			| 0F0H: y := 0FE7DH
			| 0CBH: y := 0FE9BH
			| 0EBH: y := 0FEBDH
			| 98H: y := 0BBH
			| 0CDH: y := 0FEA3H
			| 0CEH,0F7H: y := 0FDD9H + x
			| 0CFH: y := 0FEA9H
			| 0D0H: y := 0FEABH
			| 0D1H: y := 0FEADH
			| 0D2H,0F8H,0FCH: y := 0FDDDH + x
			| 99H,9AH,9DH,9EH: y := 0FE5EH + x
			| 0A5H,0EEH: y := 0FDDFH + x
			| 0A2H,0D3H,0ECH: y := 0FDE0H + x
			| 0DCH: y := 0ACH
			| 0C0H: y := 0A2H
			| 0BEH,0E4H,0F5H: y := 0FDFBH + x
			| 0A8H,0A9H,0D5H: y := 0FDE6H + x
			| 0D6H: y := 0FEBFH
			| 0D7H,0DFH: y := 0FDEAH + x
			| 0AAH: y := 0FE95H
			| 0D8H: y := 0FEC5H
			| 0ABH: y := 0FE99H
			| 0ADH: y := 0FE9DH
			| 0FBH: y := 0FEDDH
			| 0D9H,0E1H,0EFH: y := 0FDF2H + x
			| 0AEH,0F2H: y := 0FDF3H + x
			| 0FDH: y := 0FEF1H
			| 0BCH,0DAH,0E2H: y := 0FDF5H + x
			| 0AFH,0F3H: y := 0FDF6H + x
			| 8BH: y := 2534H
			| 0BDH,0E3H,0F4H: y := 0FDF8H + x
			| 0DEH: y := 0D7H
			| 85H: y := 2500H
			| 86H: y := 2502H
			| 0F6H,0F9H,0FAH: y := 0FDFCH + x
			| 0E5H: y := 0FEE3H
			| 8DH: y := 250CH
			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_cp864.