Google
 

Trailing-Edge - PDP-10 Archives - BB-H506D-SM_1983 - cobol/source/spac.mac
There are 9 other files named spac.mac in the archive. Click here to see a list.
TITLE	SPAC FOR LIBOL
SUBTTL	CHECK STRING FOR SPACES	/ACK



;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1974, 1981 BY DIGITAL EQUIPMENT CORPORATION

;REVISION HISTROY:

;V10	*****

;	13-DEC-74	/ACK	CREATION.

;	5/10/75		/DBT	BIS CODE
;*****

	SEARCH	LBLPRM		;DEFINE PARAMETERS.
	%%LBLP==:%%LBLP
	EBCMP.==:EBCMP.
	BIS==:BIS

	EXTERN	EASTB.		;FORCE EASTBL TO BE LOADED.

	HISEG

COMMENT	\

	THIS ROUTINE CHECKS A STRING TO SEE IF IT CONTAINS ONLY SPACES.

CALL:
	MOVEI	16,PARAMETER ADDRESS
	PUSHJ	17,SPAC.6/SPAC.7/SPAC.9

PARAMETER:
	BITS	0-5	BYTE POINTER RESIDUE FOR INPUT FIELD.
	BIT	6	IGNORED (1 IF A SIGN IS PRESENT.)
	BITS	7-17	SIZE OF THE INPUT FIELD.
	BITS	18-35	ADDRESS OF THE FIRST CHARACTER OF THE INPUT FIELD.

RETURNS:
	CALL+1	IF THE STRING LENGTH IS ZERO OR CONTAINS A CHARACTER
		 OTHER THAN A SPACE.
	CALL+2	IF THE STRING CONTAINS ALL SPACES.

REGISTERS USED:
	CH,SPACE,JAC, IPTR, CNT, SW

\
	ENTRY	SPAC.6		;IF THE STRING IS SIXBIT.
	ENTRY	SPAC.7		;IF THE STRING IS ASCII.
IFN EBCMP.,<
	ENTRY	SPAC.9		;IF THE STRING IS EBCDIC.
>
	EXTERN	SIXSP.		;WHAT A SIXBIT SPACE LOOKS LIKE.
	EXTERN	ASCSP.		;WHAT AN ASCII SPACE LOOKS LIKE.
IFN EBCMP.,<
	EXTERN	EBCSP.		;WHAT AN EBCDIC SPACE LOOKS LIKE.
>

IFE	BIS,<

;LOCAL AC DEFINITIONS:

	SPACE==TAC4

	EXTERN	RET.2		;RETURNS TO CALL+2.
	EXTERN	SET1.		;SETS UP THE PARAMETERS.

SPAC.6:	JSP	CH,	SPAC		;ENTER HERE IF THE INPUT IS SIXBIT,
SPAC.7:	JSP	CH,	SPAC		; HERE IF IT IS ASCII OR
IFN EBCMP.,<
SPAC.9:	JSP	CH,	SPAC		; HERE IF IT IS EBCDIC.
>

SPAC:	SUBI	CH,	SPAC.6-5	;FIND OUT WHAT THE INPUT LOOKS LIKE.
	MOVE	SPACE,	SPACES-6(CH)	;SELECT THE APPROPRATE SPACE.
	JSP	JAC,	SET1.		;GO SET UP THE PARAMETERS.
					;NOTE:  IF THE STRING LENGTH IS ZERO
					; WE RETURN TO CALL+1, NOT HERE.

SPAC1:	ILDB	CH,	IPTR		;GET A CHAR.
	CAIE	CH,	(SPACE)		;IS IT A SPACE?
	POPJ	PP,			;NO, RETURN TO CALL+1.
	SOJG	CNT,	SPAC1		;LOOP IF THERE ARE MORE CHARS.
	JRST		RET.2		;RETURN TO CALL+2 - ALL SPACES.
>	;END OF NON-BIS


SPACES:	EXP		SIXSP.
	EXP		ASCSP.
IFN EBCMP.,<
IFN BIS,<
	BLOCK	1
>
	EXP		EBCSP.
>
IFN	BIS,<

	EXTERN	BSET1.		;SETS UP THE PARAMETERS.
SPAC.6:	JSP	BISCH,	SPAC		;ENTER HERE IF THE INPUT IS SIXBIT,
SPAC.7:	JSP	BISCH,	SPAC		; HERE IF IT IS ASCII OR
IFN EBCMP.,<
	BLOCK	1
SPAC.9:	JSP	BISCH,	SPAC		; HERE IF IT IS EBCDIC.
>

SPAC:	SUBI	BISCH,	SPAC.6-5	;FIND OUT WHAT THE INPUT LOOKS LIKE.
	MOVE	BIST0+E0.FLT,	SPACES-6(BISCH)	;SELECT THE APPROPRATE SPACE.
						;FOR FILL CHARACTER
	JSP	JAC,	BSET1.		;GO SET UP THE PARAMETERS.
					;NOTE:  IF THE STRING LENGTH IS ZERO
					; WE RETURN TO CALL+1, NOT HERE.

	SETZB	DSTPT,DSTCNT		;NO DESTINATION - COMPARE AGAINST
					; THE FILL CHARACTER
	MOVE	BIST0+E0.INS,[CMPSN]	;COMPARE NOT EQUAL
	EXTEND	B.FLAG,BIST0
	AOS	(PP)			;EQUAL TO SPACES
	POPJ	PP,			;NOT SPACES

>	;END OF BIS
	END