Google
 

Trailing-Edge - PDP-10 Archives - bb-l014q-bm_tops20_v6_1_atpch17 - autopatch/cmplex.c17
There are 10 other files named cmplex.c17 in the archive. Click here to see a list.
 REP 24/1	;17C1
	GLOBAL BIND CMPLEV = #11^24 + 0^18 + #4560;	! Version Date:	22-Dec-86
 WIT
	GLOBAL BIND CMPLEV = #11^24 + 0^18 + #4570;	! Version Date:	20-Jul-87
 INS 279/1	;17C2
	***** End V11 Development *****

	4563	MEM	11-Feb-87
		Add edit 4555 as 4563.

	4570	DCE	20-Jul-87
		Fix edit 4563 to handle formal character arrays properly.  Avoid
		bogus Substring bound out of range errors when not deserved.

	***** End Revision History *****

 REP 51/25	;17C3
	%4507%	LOCAL LCONST:UCONST;	

 WIT
	%4563%	LOCAL BASE CHLEN;	! Maximum length of substring
	%4563%	LOCAL LMIN1,		! Lower bound - 1
		      LCONST,		! Lower bound [- 1]     (based on ISINCR)
		      UCONST;		! Upper bound or length (based on OPERSP)
	%4563%	LOCAL BASE DIMPTR;	!Ptr to dimension table
	%4563%	LOCAL DIMSUBENTRY DIMENTRY;!Dimenstion entry in dimension table
	%4563%	LOCAL BASE UB:LB:ELEN;	!Upper and lower bounds of a dimension and
	%4563%				!Length of one element in the array
 INS 89/25	;17C4
	%4563%	IF .ANODE[OPRCLS] EQL ARRAYREF
	%4563%	THEN
	%4563%	BEGIN
	%4563%		CHLEN = .ANODE[ARG1PTR];! Array name
	%4563%		CHLEN = .CHLEN[IDCHLEN];! Length of array element
	%4563%	END
	%4570%	ELSE IF .ANODE[OPR1] EQL ARRAYFL OR .ANODE[OPR1] EQL FMLARRFL
	%4563%	THEN
	%4563%	BEGIN
	%4563%		DIMPTR = .ANODE[IDDIM];		! Ptr to dimension table
	%4563%		DIMENTRY = DIMPTR[FIRSTDIM] + 	! Ptr to last dimension
	%4563%                        DIMSUBSIZE * (.DIMPTR[DIMNUM] - 1);
	%4563%
	%4563%		UB = .DIMENTRY[DIMUB];		! Upper bound of last dimension
	%4563%		LB = .DIMENTRY[DIMLB];		! Lower bound of last dimension
	%4563%		ELEN = .DIMENTRY[DIMFACTOR];	! Length of one array element  
	%4563%		IF .UB[OPR1] NEQ CONSTFL	! Ensure that they're constants
	%4563%		OR .LB[OPR1] NEQ CONSTFL
	%4563%		THEN RETURN .EXPR;		! If not they return
	%4563%
	%4563%	 	CHLEN = (.UB[CONST2] - .LB[CONST2] + 1) 
	%4563%			     * .ELEN[CONST2]; !Length of entire array
	%4563%	END
	%4563%	ELSE 	CHLEN = .ANODE[IDCHLEN]; ! Length of scalar

 INS 94/25	;17C5

	%4563%		IF ISINCR(EXPR)			! We don't have lower_bound -1 
	%4563%		THEN LMIN1 = .LCONST - 1	! so make it lower_bound - 1
	%4563%		ELSE LMIN1 = .LCONST;

	%4563%		IF .LMIN1 LSS 0		! Lower bound-1 must be >= 0
	%4563%		OR			! 		and < CHLEN
	%4563%		(.CHLEN NEQ LENSTAR AND .LMIN1 GEQ .CHLEN)
	%4563%		THEN FATLERR(.ISN,E165<0,0>);	! Give bounds error
 INS 103/25	;17C6
	%4563%		IF .EXPR[OPERSP] EQL SUBSTRUP	!UNODE = upper bound
	%4563%		THEN
	%4563%		BEGIN
	%4563%			IF .UCONST LSS 1	! Upper bound must be >= 1
	%4563%			OR			! 	      and <= CHLEN
	%4563%			(.CHLEN NEQ LENSTAR AND .UCONST GTR .CHLEN)
	%4563%			THEN FATLERR(.ISN,E165<0,0>);	! Give bounds error


	%4563%			! Give a bounds error if the lower bound minus
	%4563%			! one  is  >=  the  upper  bound  (i.e.,   the
	%4563%			! user-specified lower  bound is  > the  upper
	%4563%			! bound).
	%4563%
	%4563%			IF .LNODE[OPR1] EQL CONSTFL
	%4563%			THEN IF .LMIN1 GEQ .UCONST
	%4563%			THEN FATLERR(.ISN,E165<0,0>)	! Give bounds error
	%4563%		END
	%4563%		ELSE	! UNODE = length
	%4563%			IF .UCONST LSS 1		! Length < 1
	%4563%			THEN FATLERR(.ISN,E165<0,0>);	! Give bounds error

 INS 107/25	;17C7
	%4563%			IF .EXPR[OPERSP] EQL SUBSTRLEN
	%4563%					! Upper bound = length + lower_bound-1
	%4563%			THEN IF .CHLEN NEQ LENSTAR
	%4563%			THEN IF (.UCONST + .LMIN1) GTR .CHLEN
	%4563%			THEN FATLERR(.ISN,E165<0,0>);	!Upper bound too big

 REP 141/25	;17C8
		END;	! Upper bound is constant
 WIT
		END	! Upper bound is constant
	%4563%	ELSE IF .UNODE[OPR1] EQL ADDOPF
	%4563%	THEN IF .UNODE[A1VALFLG]
	%4563%	THEN IF .UNODE[A2VALFLG]
	%4563%	THEN IF .LNODE[OPR1] EQL ADDOPF OR .LNODE[OPR1] EQL VARFL
	%4563%	THEN
	%4563%	BEGIN
	%4563%	! Check for the following cases
	%4563%	!
	%4563%	!             SUBSTR                SUBSTR
	%4563%	!             /   \                 /    \
	%4563%	!            +    V2               +      +
	%4563%	!          /   \                 /  \    /  \
	%4563%	!         c1   -V1              c1 -V1  c2  V2
	%4563%	!
	%4563%	!    where c1 <= 1            where c1 <= -c2
	%4563%   !
	%4563%	! where V1,V2 are variables and c1,c2 are constants 
	%4563%
	%4563%	LOCAL 	BASE C1:C2:V1:V2;
	%4563%
	%4563%	C1 = .UNODE[ARG1PTR];
	%4563%	V1 = .UNODE[ARG2PTR];
	%4563%
	%4563%	IF .C1[OPR1] NEQ CONSTFL
	%4563%	OR .V1[OPR1] NEQ VARFL
	%4563%	OR NOT .UNODE[A2NEGFLG]
	%4563%	THEN RETURN .EXPR		!Can't have either of above
	%4563%
	%4563%   ELSE IF .LNODE[OPR1] EQL VARFL
	%4563% 	AND .LNODE EQL .V1	
	%4563%	AND .C1[CONST2] LEQ 1		! situation in the left tree above
	%4563%	THEN FATLERR(.ISN,E165<0,0>)	! Give bounds error
	%4563%	ELSE
	%4563%	BEGIN
	%4563%		C2 = .LNODE[ARG1PTR];
	%4563%		V2 = .LNODE[ARG2PTR];
	%4563%
	%4563%		IF .C2[OPR1] EQL CONSTFL
	%4563%		THEN IF .V2[OPR1] EQL VARFL
	%4563%		THEN IF .C1[CONST2] LEQ - .C2[CONST2] !Situation in right tree above
	%4563%		THEN FATLERR(.ISN,E165<0,0>)	! Give bounds error
	%4563%	END;	! not variable
	%4563%	END;	! Upper bound is not constant
 SUM 66821