MODULE EncStdMap_cp1256;

	(* This file was generated automatically *)

	(* Source: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1256.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: y := x
			| 0A0H: y := 0A0H
			| 0A2H..0A9H: y := x
			| 0ABH..0B9H: y := x
			| 0BBH..0BEH: y := x
			| 0D7H: y := 0D7H
			| 0E0H: y := 0E0H
			| 0E2H: y := 0E2H
			| 0E7H..0EBH: y := x
			| 0EEH..0EFH: y := x
			| 0F4H: y := 0F4H
			| 0F7H: y := 0F7H
			| 0F9H: y := 0F9H
			| 0FBH..0FCH: y := x
			| 0152H: y := 8CH
			| 0153H: y := 9CH
			| 0192H: y := 83H
			| 02C6H: y := 88H
			| 060CH: y := 0A1H
			| 061BH: y := 0BAH
			| 061FH: y := 0BFH
			| 0621H..0636H: y := x - 0560H
			| 0637H..063AH: y := x - 055FH
			| 0640H..0643H: y := x - 0564H
			| 0644H: y := 0E1H
			| 0645H..0648H: y := x - 0562H
			| 0649H..064AH: y := x - 055DH
			| 064BH..064EH: y := x - 055BH
			| 064FH..0650H: y := x - 055AH
			| 0651H: y := 0F8H
			| 0652H: y := 0FAH
			| 0679H: y := 8AH
			| 067EH: y := 81H
			| 0686H: y := 8DH
			| 0688H: y := 8FH
			| 0691H: y := 9AH
			| 0698H: y := 8EH
			| 06A9H: y := 98H
			| 06AFH: y := 90H
			| 06BAH: y := 9FH
			| 06BEH: y := 0AAH
			| 06C1H: y := 0C0H
			| 06D2H: y := 0FFH
			| 200CH..200DH: y := x - 1F6FH
			| 200EH..200FH: y := x - 1F11H
			| 2013H..2014H: y := x - 1F7DH
			| 2018H..2019H: y := x - 1F87H
			| 201AH: y := 82H
			| 201CH..201DH: y := x - 1F89H
			| 201EH: y := 84H
			| 2020H..2021H: y := x - 1F9AH
			| 2022H: y := 95H
			| 2026H: y := 85H
			| 2030H: y := 89H
			| 2039H: y := 8BH
			| 203AH: y := 9BH
			| 20ACH: y := 80H
			| 2122H: y := 99H
			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: y := x
			| 80H: y := 20ACH
			| 81H: y := 067EH
			| 82H: y := 201AH
			| 83H: y := 0192H
			| 84H: y := 201EH
			| 85H: y := 2026H
			| 86H..87H: y := x + 1F9AH
			| 88H: y := 02C6H
			| 89H: y := 2030H
			| 8AH: y := 0679H
			| 8BH: y := 2039H
			| 8CH: y := 0152H
			| 8DH: y := 0686H
			| 8EH: y := 0698H
			| 8FH: y := 0688H
			| 90H: y := 06AFH
			| 91H..92H: y := x + 1F87H
			| 93H..94H: y := x + 1F89H
			| 95H: y := 2022H
			| 96H..97H: y := x + 1F7DH
			| 98H: y := 06A9H
			| 99H: y := 2122H
			| 9AH: y := 0691H
			| 9BH: y := 203AH
			| 9CH: y := 0153H
			| 9DH..9EH: y := x + 1F6FH
			| 9FH: y := 06BAH
			| 0A0H: y := 0A0H
			| 0A1H: y := 060CH
			| 0A2H..0A9H: y := x
			| 0AAH: y := 06BEH
			| 0ABH..0B9H: y := x
			| 0BAH: y := 061BH
			| 0BBH..0BEH: y := x
			| 0BFH: y := 061FH
			| 0C0H: y := 06C1H
			| 0C1H..0D6H: y := x + 0560H
			| 0D7H: y := 0D7H
			| 0D8H..0DBH: y := x + 055FH
			| 0DCH..0DFH: y := x + 0564H
			| 0E0H: y := 0E0H
			| 0E1H: y := 0644H
			| 0E2H: y := 0E2H
			| 0E3H..0E6H: y := x + 0562H
			| 0E7H..0EBH: y := x
			| 0ECH..0EDH: y := x + 055DH
			| 0EEH..0EFH: y := x
			| 0F0H..0F3H: y := x + 055BH
			| 0F4H: y := 0F4H
			| 0F5H..0F6H: y := x + 055AH
			| 0F7H: y := 0F7H
			| 0F8H: y := 0651H
			| 0F9H: y := 0F9H
			| 0FAH: y := 0652H
			| 0FBH..0FCH: y := x
			| 0FDH..0FEH: y := x + 1F11H
			| 0FFH: y := 06D2H
			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_cp1256.