Google
 

Trailing-Edge - PDP-10 Archives - BB-H506D-SM_1983 - cobol/source/flgdf.mac
There are 9 other files named flgdf.mac in the archive. Click here to see a list.
UNIVERSAL	FLGDF FOR LIBOL.
SUBTTL	EBCDIC/ASCII/SIXBIT CONVERSION FLAGS.



;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, 1981 BY DIGITAL EQUIPMENT CORPORATION


;REVISION HISTORY:

;V10 *****

;	6-JUL-75	/ACK	CREATION.

;*****

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

	SEARCH	CHREQV		;DEFINE THE CHARACTER SET EQUIVALENCES.

	SEARCH	NUMEQV		;DEFINE THE NUMERIC EQUIVALENCES.

	SALL
COMMENT	\

	THIS MODULE CONTAINS MACROS WHICH WILL DEFINE FLAGS WHICH WILL
BE USED IN VARIOUS CONVERSION TABLES.

\


	DEFINE	DDEFLT (NUM)<
		DEFINE	DEFLT <
			.XCREF
			%%T2==0
			REPEAT	NUM+1,<
				%DFLT1	\%%T2
				%%T2==%%T2+1>
			.CREF>>
	SUBTTL	ALPHABETIC CHARACTER FLAGS.

COMMENT	\

SYMBOL FORMAT:

	<LETTER>AL<NUMBER>

WHERE:
	LETTER	IDENTIFIES THE CHARACCTER SET.
	NUMBER	IDENTIFIES THE PARTICULAR CHARACTER.

	THE VALUE OF THE SYMBOL IS 1 IF THE CHARACTER IS ALPHABETIC
AND IS ZERO IF IT IS NOT.

\

	DEFINE	SET (L)<
		.XCREF
		%%T1==0
		IFIDN	<L> <S>,<%%T1==77>
		IFIDN	<L> <A>,<%%T1==177>
		IFIDN	<L> <E>,<%%T1==377>
		IFE	%%T1,<
			PRINTX	?BAD CALL TO MACRO "SET".
			PASS2
			END>
		DDEFLT	\%%T1
		DEFINE	%DFLT1 (N)<IFNDEF	L'AL'N,<L'AL'N==0>>
		DEFINE	%ALPH1 (N)<L'AL'N==1>
		.CREF>

	DEFINE	ALPHA (C1, C2)<
		.XCREF
		%%T1==C2
		IFB	<C2>,<%%T1==C1>
		%%T2==C1
		REPEAT	%%T1-C1+1,<
			%ALPH1	\%%T2
			%%T2==%%T2+1>
		.CREF>
;ASCII:

	SET	A
	ALPHA	" "
	ALPHA	"A","Z"
	ALPHA	"a","z"
	DEFLT

;SIXBIT:

	SET	S
	ALPHA	' '
	ALPHA	'A','Z'
	DEFLT

;EBCDIC:

	SET	E
	ALPHA	100		;<SPACE>
	ALPHA	201,211		;LOWER CASE A-I.
	ALPHA	221,231		;LOWER CASE J-R.
	ALPHA	242,251		;LOWER CASE S-Z.
	ALPHA	301,311		;UPPER CASE A-I.
	ALPHA	321,331		;UPPER CASE J-4.
	ALPHA	342,351		;UPPER CASE S-Z.
	DEFLT
	SUBTTL	END OF LINE CHARACTER FLAGS.

COMMENT	\

SYMBOL FORMAT:

	<LETTER>EL<NUMBER>

WHERE:
	LETTER	IDENTIFIES THE CHARACTER SET.
	NUMBER	IDENTIFIES THE PARTICULAR CHARACTER.

	THE VALUE OF THE SYMBOL IS 1 IF THE CHARACTER IS AN END OF LINE
CHARACTER AND 0 IF IT IS NOT.

\

	DEFINE	SET (L)<
		.XCREF
		%%T1==0
		IFIDN	<L> <A>,<%%T1==177>
		IFIDN	<L> <E>,<%%T1==377>
		IFE	%%T1,<
			PRINTX	?BAD CALL TO MACRO "SET".
			PASS2
			END>
		DDEFLT	\%%T1
		DEFINE	%DFLT1 (N)<IFNDEF	L'EL'N,<L'EL'N==0>>
		DEFINE	%EOL1 (N)<L'EL'N==1>
		.CREF>

	DEFINE	EOL (C1, C2)<
		.XCREF
		IFB	<C2>,<%EOL1	\C1>
		IFNB	<C2>,<
			%%T1==C1
			REPEAT	C2-C1+1,<
				%EOL1	\%%T1
				%%T1==%%T1+1>>
		.CREF>
;ASCII:

	SET	A
	EOL	12		;<LF>
	EOL	13		;<VT>
	EOL	14		;<FF>
	EOL	15		;<CR>
	EOL	20,24		;CARRAGE CONTROL CHARS.
	EOL	32		;<EOF> (FOR TTY'S)
	DEFLT

;EBCDIC:

	SET	E
	EOL	45		;<LF>
	EOL	25		;<NL>
	DEFLT
	SUBTTL	TOKENS - USED TO DETERMINE IF A STRING IS NUMERIC.

COMMENT	\

SYMBOL FORMAT:

	<LETTER>TK<NUMBER>
WHERE:
	LETTER	IDENTIFIES THE CHARACTER SET.
	NUMBER	IDENTIFIES THE PARTICULAR CHARACTER.

	THE VALUE OF THE SYMBOL IS THE TOKEN INTO WHICH THE CHARACTER
IS CONVERTED.  THESE ARE:

	0	NULL
	1	TAB
	2	BLANK
	3	DIGIT
	4	OVERPUNCHED DIGIT
	5	GRAPHIC SIGN
	6	OTHER

\
	DEFINE	SET (L)<
		.XCREF
		%%T1==0
		IFIDN	<L> <S>,<%%T1==77>
		IFIDN	<L> <A>,<%%T1==177>
		IFIDN	<L> <E>,<%%T1==377>
		IFE	%%T1,<
			PRINTX	?BAD CALL TO MACRO "SET".
			PASS2
			END>
		DDEFLT	\%%T1
		DEFINE	%DFLT1 (N)<IFNDEF	L'TK'N,<L'TK'N==6>>
		DEFINE	%TOKE1 (N, V)<L'TK'N==V>
		.CREF>

	DEFINE	TOKEN (C, CV, V)<
		.XCREF
		IFB	<V>,<%TOKE1	\C,\CV>
		IFNB	<V>,<
			%%T1==C
			REPEAT	CV-C+1,<
				%TOKE1	\%%T1,\V
				%%T1==%%T1+1>>
		.CREF>
;ASCII:

	SET	A
	TOKEN	0,0		;<NULL>
	TOKEN	"	",1	;<TAB>
	TOKEN	" ",2		;<BLANK>
	TOKEN	"0","9",3	;DIGITS
	TOKEN	<"]">,4		;VARIOUS FORMS OF "-0".
	TOKEN	"!",4
	TOKEN	":",4
	TOKEN	<"}">,4
	TOKEN	<"[">,4		;VARIOUS FORMS OF "+0".
	TOKEN	"?",4
	TOKEN	<"{">,4
	TOKEN	"A","R",4	;OTHER OVERPUNCHED DIGITS.
	TOKEN	"a","r",4
	TOKEN	"+",5		;GRAPHIC SIGNS.
	TOKEN	"-",5
	DEFLT			;DEFAULT EVERYTHING ELSE TO 6.

;SIXBIT:

;CONVERT THE SIXBIT CHAR TO ASCII AND USE THE ASCII TOKENS, TO KEEP
; THINGS CONSISTANT.

	DEFINE	A0 (N)<A1	\N,\SA%'N>
	DEFINE	A1 (N1, N2)<STK'N1==ATK'N2>

	.XCREF
	%%T1==0
	REPEAT	100,<
		A0	\%%T1
		%%T1==%%T1+1>
	.CREF

;EBCDIC:

	SET	E
	TOKEN	0,0		;<NULL>
	TOKEN	5,1		;<TAB>
	TOKEN	100,2		;<BLANK>
	TOKEN	360,371,3	;DIGITS.
	TOKEN	240,251,4	;VARIOUS OVERPUNCHED DIGITS.
	TOKEN	260,271,4
	TOKEN	300,311,4
	TOKEN	320,331,4
	TOKEN	340,351,4
	TOKEN	116,5		;GRAPHIC SIGNS.
	TOKEN	140,5
	DEFLT			;DEFAULT EVERYTHING ELSE TO 6.
;FLAGS PICKED UP WITH THE NUMBERS BY THE NUMERIC CONVERSION ROUTINES.

	LDGCH.==1000
	SPCCH.==400
	IBNCH.==200

	VALCH.==17	;VALUE MASK.
SUBTTL BIS TABLES
IFE	BIS,<	END	>


;SYMBOL BUILDING MACROS

SYM%==0

DEFINE	BTBMAC(SRC,DST)		;DEFINE BUILD MACROS
<

DEFINE	ALPSYM(CH)   <SRC''DST'%'CH&777>	;ALPHA CONVERSION SYMBOL

DEFINE	NUMSYM(CH)   <SRC'N%'CH>	;NUMERIC CONVERSION SYMBOL

	;VALUE MACROS
	DEFINE	LEADNG   <LDGCH.&NUMSYM	(\%CHAR)>	;LEADING CHAR
	DEFINE	SPECAL   <SPCCH.&NUMSYM	(\%CHAR)>		;SPECIAL
	DEFINE	NEGOVP   <IBNCH.&NUMSYM	(\%CHAR)>		;NEGATIVE OVERPUNCH
	DEFINE	NUMVAL   <VALCH.&NUMSYM	(\%CHAR)>		;VALUE

DEFINE	TOKEN%(CH)   <SRC'TK'CH>

	;VALUES
	TK.NUL==0		;NUL
	TK.TAB==1		;TAB
	TK.BLK==2		;BLANK
	TK.DIG==3		;DIGIT
	TK.OVP==4		;OVERPUNCH DIGIT
	TK.SGN==5		;GRAPHIC SIGN
	TK.OTH==6		;OTHER

DEFINE	ALPHAB(CH)   <SRC'AL'CH>		;1 IF ALPHABETIC

DEFINE	IFTRUE   <IFN >			;TRUE IS NON-ZERO
DEFINE	IFALSE   <IFE >			;FALSE IS ZERO

DEFINE	GPHSGN   <VAL==0
		  IFE TOKEN%(\%CHAR)-TK.SGN,<VAL==1>	;GRAPHIC SIGN?
		  >
DEFINE	BKTAB   ; BLANK OR TAB
	< VAL==0
	   IFE TOKEN%(\%CHAR)-TK.BLK,<VAL==1>
	  IFE TOKEN%(\%CHAR)-TK.TAB,<VAL==1>
	>

DEFINE	NULL	;NULL CHARACTER
	< VAL==0
	  IFE	TOKEN%(\%CHAR)-TK.NUL,<VAL==1>
	>

DEFINE	NUMERIC  	;IS IT NUMERIC??
	<VAL==0
	   IFE TOKEN% (\%CHAR)-TK.DIG,<VAL==1>
	   IFE TOKEN% (\%CHAR)-TK.OVP,<VAL==1>
	>

DEFINE	ZERO  	;IS IT A FORM OF ZERO??
;	<^-<NUMVAL>>
	<VAL==0
	 IFE	NUMVAL,<VAL==1>>
;;	NOTE THAT THIS IS MORE THAN THOSE CHARACTERS DESIGNATED
;;	AS HAVING A ZERO VALUE.  IT WILL ALSO PICK UP THOSE THAT JUST
;;	HAPPEN TO GET ZERO AS VALUE.  HOWEVER THIS IS GOOD ENOUGH FOR
;;	OUR PURPOSES

; TRANSITION TABLE ACTION SETUPS

DEFINE	MSET   <SYM%==SYM%!T.MSET>	;SET M FLAG
DEFINE	MCLR   <SYM%==SYM%!T.MCLR>	;CLEAR M FLAG
DEFINE	ABORT   <SYM%==SYM%!T.ABRT>	;ABORT
DEFINE	SIGSET   <SYM%==SYM%!T.SBIT>	;SET SIGNIFICANCE
DEFINE	ABTSIG   <SYM%==SYM%!T.ABIS>	;ABORT IF SIGNIFICANCE

; SIZE OF TABLES
DEFINE	TBLSIZ   <
	IFIDN	<SRC><A>,<VAL==200/2>
	IFIDN	<SRC><S>,<VAL==100/2>
	IFIDN	<SRC><E>,<VAL==400/2>
	>


>	;END OF BTBMAC MACRO


	END	;FLGDF.MAC