Google
 

Trailing-Edge - PDP-10 Archives - BB-Z759A-SM - cobol-source/eastbl.mac
There are 9 other files named eastbl.mac in the archive. Click here to see a list.
; UPD ID= 1441 on 11/15/83 at 3:34 PM by HOFFMAN                        
TITLE	EASTBL FOR LIBOL.
SUBTTL	EBCDIC/ASCII/SIXBIT CONVERSION TABLES	/ACK

	SEARCH COPYRT
	SALL

;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.

COPYRIGHT (C) 1975, 1983, 1984 BY DIGITAL EQUIPMENT CORPORATION

	HISEG
	.COPYRIGHT		;Put standard copyright statement in REL file

;REVISION HISTORY:

;V10 *****

;	27-AUG-76	[454] ADD ZERO CHAR COMPARES
;	15-MAY-75	/DBT	BIS
;	2-JAN-75	/ACK	CREATION.

;	6-JUL-75	/ACK	REMOVE THE BIS TABLES AND MACROS WHICH
;				 DEFINE THE FLAGS.  THIS IS SO THAT FOR
;				 /R COMPILATIONS, ONLY THE TABLES THAT
;				 ARE NEEDED WILL BE LOADED.
;*****

	SEARCH	LBLPRM		;DEFINE ASSEMBLY PARAMETERS.
	%%LBLP==:%%LBLP
	DEBUG==:DEBUG

	SEARCH	CHREQV		;DEFINE THE CHARACTER SET EQUIVALENCES.

	SEARCH	NUMEQV		;DEFINE THE NUMERIC EQUIVALENCES.

	SEARCH	FLGDF		;DEFINE THE FLAGS.
	LDGCH.==:LDGCH.
	SPCCH.==:SPCCH.
	IBNCH.==:IBNCH.
	VALCH.==:VALCH.

	SALL

	ENTRY	EASTB.		;TO FORCE LOADING WHEN LIBOL.SHR IS BUILT.
EASTB.:
COMMENT	\

	THIS MODULE CONTAINS THE TABLES WHICH ARE USED IN CONVERTING
FROM ONE CHARACTER SET TO ANOTHER, CONVERTING A DISPLAY FIELD TO
NUMERIC, TESTING TO SEE IF A FIELD IS ALPHABETIC, NUMERIC, ETC.
	FOR EASE OF MATAINANCE AND MODIFICATION THE TABLES ARE GENERATED
USING MACROS AND UNIVERSAL FILES IN WHICH THE CHARACTER SET EQUIVALENCES
ARE DEFINED.

\

	SUBTTL	MACROS USED TO GENERATE THE TABLES.

	DEFINE	TBLGEN <
		IFE	DEBUG,<XLIST>	;;DON'T LIST THE TABLE UNLESS
					;; WE ARE DEBUGGING IT.
		.XCREF
		T1==0
		REPEAT	600,<
			%TBLGN	\T1
			T1==T1+1>
		.CREF
		LIST>

	DEFINE	%TBLGN (CNT)<
		IFE	CNT,<AT000>
		IFE	CNT-100,<AT100>
		IFE	CNT-200,<AT200>
		IFE	CNT-240,<AT240>
		IFE	CNT-300,<AT300>
		IFE	CNT-400,<AT400>
		IFE	CNT-440,<AT440>
		GEN	\CNT>

	DEFINE	TABLE (NAME, FIRST, LAST)<
NAME':		BLOCK	0
		RADIX	^D10
		NAME'S==LAST-FIRST+1
		NAME'P==LAST
		RADIX	^D8>

	DEFINE	FLAG (NAME, POS)<
		RADIX	^D10
		NAME==POS
		RADIX	^D8>
	DEFINE	AT000 <
		TABLE	ENUM,0,9	;;EBCDIC TO NUMERIC.
		TABLE	ESG,2,2		;;EBCDIC IMBEDDED "-" FLAG.
		TABLE	ESD,1,9		;;EBCDIC IMBEDDED "-" FLAG AND DIGIT.
		TABLE	EDG,1,9		;;EBCDIC DIGITS.
		TABLE	EA,10,17	;;EBCDIC TO ASCII.
		TABLE	ETOK,18,21	;;EBCDIC TOKENS.

TYPCD.::	BLOCK	0
		FLAG	SALP,33		;;SIXBIT ALPHABETIC FLAGS.
		FLAG	AALP,34		;;ASCII ALPHABETIC FLAGS.
		FLAG	EALP,35		;;EBCDIC ALPHABETIC FLAGS.

		DEFINE	GEN (N)<
			BYTE	(10)EN%'N(1)EEL'N(7)EA%'N(4)ETK'N
				(^D11)0(1)SAL'N,AAL'N,EAL'N>>

	DEFINE	AT100 <
		TABLE	SA,27,33	;;SIXBIT TO ASCII.

		DEFINE	GEN (N) <
			%T1==N-100
			%GEN1	\N,\%T1>

		DEFINE	%GEN1 (N1, N2)<
			BYTE	(10)EN%'N1(1)EEL'N1(7)EA%'N1(4)ETK'N1(5)0
				(7)SA%'N2(1)AAL'N1,EAL'N1>>
	DEFINE	AT200 <
		TABLE	ATOK,22,25	;;ASCII TOKENS.
		TABLE	ES,27,33	;;EBCDIC TO SIXBIT.

		DEFINE	GEN (N)<
			%T1==N-200
			%GEN1	\N,\%T1>

		DEFINE	%GEN1 (N1, N2)<
			BYTE	(10)EN%'N1(1)EEL'N1(7)EA%'N1(4)ETK'N1,ATK'N2
				(1)0,EEL'N1(6)ES%'N2(1)0,EAL'N1>>
	DEFINE	AT240 <
		TABLE	STOK,22,25	;;SIXBIT TOKENS.>

	DEFINE	AT300 <
		DEFINE	%GEN1 (N1, N2)<
			BYTE	(10)EN%'N1(1)EEL'N1(7)EA%'N1(4)ETK'N1,ATK'N2
				(1)0(7)ES%'N2(1)0,EAL'N1>>
	DEFINE	AT400 <
		TABLE	ANUM,0,9	;;ASCII TO NUMERIC.
		TABLE	ASG,2,2		;;ASCII IMBEDDED "-" FLAG.
		TABLE	ASD,1,9		;;ASCII IMBEDDED "-" FLAG AND DIGIT.
		TABLE	ADG,1,9		;;ASCII DIGITS.
		TABLE	AE,10,19	;;ASCII TO EBCDIC.
		TABLE	AS,20,26	;;ASCII TO SIXBIT.

		DEFINE	GEN (N)<
			%T1==N-200
			%T2==N-400
			%GEN1	\%T1,\%T2>

		DEFINE	%GEN1 (N1, N2)<
			BYTE	(10)AN%'N2(1)AEL'N2(9)AE%'N2(1)AEL'N2(6)AS%'N2
				(1)EEL'N1(6)ES%'N1>>

	DEFINE	AT440 <
		TABLE	SNUM,0,9	;;SIXBIT TO NUMERIC.
		TABLE	SSG,2,2		;;SIXBIT IMBEDDED "-" FLAG.
		TABLE	SSD,1,9		;;SIXBIT IMBEDDED "-" FLAG AND DIGIT.
		TABLE	SDG,1,9		;;SIXBIT DIGITS.
		TABLE	SE,11,19	;;SIXBIT TO EBCDIC.>
	SUBTTL	THE TABLE

	TBLGEN
	SUBTTL	THINGS USED TO GET AT THE TABLE

;TABLE OF POINTERS INTO THE CHARACTER CONVERSION TABLES.

TBLCP.::	BLOCK	0
PTR67.::	POINT	SAS,SA(CH),SAP
PTR69.::	POINT	SES,SE(CH),SEP
PTR79.::	POINT	AES-1,AE(CH),AEP
PTR76.::	POINT	ASS-1,AS(CH),ASP
PTR96.::	POINT	ESS-1,ES(CH),ESP
PTR97.::	POINT	EAS-1,EA(CH),EAP

;THE FOLLOWING POINTERS ARE FOR CBLIO.

PTR.67::	POINT	SAS,SA(TAC5),SAP
PTR.69::	POINT	SES,SE(TAC5),SEP
PTR.79::	POINT	AES-1,AE(TAC5),AEP
PTR.76::	POINT	ASS-1,AS(TAC5),ASP
PTR.96::	POINT	ESS-1,ES(TAC5),ESP
PTR.97::	POINT	EAS-1,EA(TAC5),EAP

;POINTERS FOR STRING/UNSTRING.

SU.S67::	POINT	SAS,SA(S2),SAP
SU.S69::	POINT	SES,SE(S2),SEP
SU.S76::	POINT	ASS-1,AS(S2),ASP
SU.S79::	POINT	AES-1,AE(S2),AEP
SU.S96::	POINT	ESS-1,ES(S2),ESP
SU.S97::	POINT	EAS-1,EA(S2),EAP

SU.D67::	POINT	SAS,SA(S3),SAP
SU.D69::	POINT	SES,SE(S3),SEP
SU.D79::	POINT	AES,AE(S3),AEP

; POINTERS FOR ISAM.MAC

PTR%67::	POINT	SAS,SA(15),SAP
PTR%69::	POINT	SES,SE(15),SEP
PTR%79::	POINT	AES-1,AE(15),AEP
PTR%76::	POINT	ASS-1,AS(15),ASP
PTR%96::	POINT	ESS-1,ES(15),ESP
PTR%97::	POINT	EAS-1,EA(15),EAP

;POINTERS FOR INSPECT AND STRING/UNSTRING
;THESE POINTERS ARE NOW USED BY THE COMPILER AS WELL FOR
; CONVERTING ONE CHARACTER FIELDS INTO OTHER ALPHABETS

IPT67C::	POINT	SAS,SA(12),SAP
IPT671::	POINT	SAS,SA(1),SAP
IPT69C::	POINT	SES,SE(12),SEP
IPT691::	POINT	SES,SE(1),SEP
IPT79C::	POINT	AES-1,AE(12),AEP
IPT761::	POINT	ASS-1,AS(1),ASP
IPT791::	POINT	AES-1,AE(1),AEP
IPT961::	POINT	ESS-1,ES(1),ESP
IPT971::	POINT	EAS-1,EA(1),EAP


RPC.79::	POINT AES-1,AE(7),AEP

;NOTE:  THE FIRST BIT OF THE CONVERTED CHARACTERS IN THE ASCII AND EBCDIC
; TABLES IS THE END OF LINE FLAG, WHICH ISN'T PICKED UP BY THESE POINTERS.
;POINTERS TO THE TOKEN TABLES.

PTRTK.::	POINT	STOKS,STOK(CH),STOKP
		POINT	ATOKS,ATOK(CH),ATOKP
		POINT	ETOKS,ETOK(CH),ETOKP

;TABLE OF POINTERS INTO THE NUMERIC CONVERSION TABLES:

PTRNM.::	POINT	SNUMS,SNUM(CH),SNUMP
		POINT	ANUMS,ANUM(CH),ANUMP
		POINT	ENUMS,ENUM(CH),ENUMP


;POINTERS TO THE TOKEN TABLES.

ENTRY	BPTOK.
BPTOK.::	POINT	STOKS,STOK(BISCH),STOKP
		POINT	ATOKS,ATOK(BISCH),ATOKP
		BLOCK	1			;INDEXED BY BYTE SIZE
		POINT	ETOKS,ETOK(BISCH),ETOKP

;TABLE OF POINTERS INTO THE NUMERIC CONVERSION TABLES:

ENTRY	BPTNM.
BPTNM.::	POINT	SNUMS,SNUM(BISCH),SNUMP
		POINT	ANUMS,ANUM(BISCH),ANUMP
		BLOCK	1			;INDEXED BY BYTE SIZE
		POINT	ENUMS,ENUM(BISCH),ENUMP
;MACRO TO DEFINE TWO HALF WORDS OF A BYTE POINTER SO WE CAN REFERENCE
;THEM AS EXTERNALS AND GENERATE THE BYTE POINTER WHERE WE USE IT AND
;INDEX IT WITH DIFFERENT AC'S.

	DEFINE	BRKPTR	(FLD,NAM)<
		S'FLD'L.==:<POINT	S'NAM'S,0,S'NAM'P>B53
		S'FLD'R.==:S'NAM
		A'FLD'L.==:<POINT	A'NAM'S,0,A'NAM'P>B53
		A'FLD'R.==:A'NAM
		E'FLD'L.==:<POINT	E'NAM'S,0,E'NAM'P>B53
		E'FLD'R.==:E'NAM
>	;END OF DEFINE BRKPTR.


	BRKPTR	SGN,SG;		;IMBEDDED SIGN FLAGS.
	BRKPTR	SDG,SD;		;IMBEDDED SIGN FLAGS AND DIGITS.
	BRKPTR	DGT,DG;		;DIGITS.
;MAKE SURE THAT THE FLAGS PICKED UP WITH THE NUMBERS BY THE NUMERIC
; CONVERSION ROUTINES ARE VALID FOR ALL CHARACTER SETS.

	T1==0
	IFN	SNUMS-ANUMS,<T1==1>
	IFN	SNUMS-ENUMS,<T1==1>
	IFN	T1,<
		PRINTX	?THE NUMERIC CONVERSION TABLES MUST ALL BE THE
		PRINTX	?	SAME WIDTH.
		PASS2
		END>

;THE FOLLOWING MASK IS USED TO CHANGE THE SIZE OF THE POINTER FROM
; PTRNM. BY DOING A TLC WITH IT WE CAN DECREMENT THE SIZE OF THE BYTE
; PICKED UP BY ONE BIT, THEN BY DOING ANOTHER TLC WE CAN RESTORE THE
; SIZE FIELD TO ITS ORIGIONAL CONTENTS.

	NOLCH.==:(<<SNUMS!<SNUMS-1>>&<-<SNUMS&<SNUMS-1>>-1>>B11)

;TABLE OF MASKS FOR THE ALPHABETIC FLAGS.

ALFMS.::	EXP	1B<SALP>
		EXP	1B<AALP>
		EXP	1B<EALP>

;WHAT BLANKS LOOK LIKE IN THE VARIOUS CHARACTER SETS:

	SIXSP.==:0
	ASCSP.==:40
	EBCSP.==:100
	SIXZR.==:20		; [454] SIXBIT CHAR ZERO
	ASCZR.==:60		; [454] ASCII CHAR ZERO
	EBCZR.==:360		; [454] EBCDIC CHAR ZERO


	END	;EASTBL.MAC