aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2024-11-19 10:34:13 -0700
committerJohn Denker <jsd@av8n.com>2024-11-21 08:46:50 -0700
commitf4a7e0073b03ee7972e108bc795c757842fcd73e (patch)
tree97c3ef66e3af7bf3a998b13b8ad7c00e19ccb47f
parente8f3a3f992c484596f4c341f870a272047907053 (diff)
replace arithmetic gotos; now compiles without warnings
-rw-r--r--htdp.f49
1 files changed, 32 insertions, 17 deletions
diff --git a/htdp.f b/htdp.f
index 1ed5b2c..7c4724b 100644
--- a/htdp.f
+++ b/htdp.f
@@ -334,8 +334,9 @@ C
C FIND STARTING POINT WHERE X(I).NE.X0
IP=0
10 IP=IP+1
- IF(X(IP)-X0) 15,12,16
- 12 IF(IP.LE.N) GO TO 10
+ IF (X(IP) .lt. X0) goto 15
+ if (X(IP) .gt. X0) goto 16
+ IF(IP.LE.N) GO TO 10
WRITE(LUOUT,6001)
6001 FORMAT('0 POLYGON INPUT ERROR - ALL POINTS ON LINE X = X0')
STOP
@@ -352,30 +353,44 @@ C
DO 100 II=IP1,IPN
I=II
IF(I.GT.N) I=I-N
- IF(IL) 30,50,40
- 30 IF(X(I)-X0) 90,32,34
- 32 IS=-1
+ if (IL .eq. 0) goto 50
+ if (IL .gt. 0) goto 40
+ IF (X(I) .lt. X0) goto 90
+ if (X(I) .gt. X0) goto 34
+ IS=-1
GO TO 60
34 IL=1
GO TO 80
- 40 IF(X(I)-X0) 42,44,90
- 42 IL=-1
+ 40 IF(X(I) .eq. X0) goto 44
+ if(X(I) .gt. X0) goto 90
+ IL=-1
GO TO 80
44 IS=1
GO TO 60
- 50 IF(X(I)-X0) 52,55,54
- 52 IL=-1
- IF(IS) 90,140,80
+ 50 IF(X(I) .eq. X0) goto 55
+ if(X(I) .gt. X0) goto 54
+ IL=-1
+ IF (IS .lt. 0) goto 90
+ if (IS .eq. 0) goto 140
+ goto 80
54 IL=1
- IF(IS) 80,140,90
- 55 IF(Y(I)-Y0) 57,120,58
- 57 IF(YL-Y0) 90,120,120
- 58 IF(YL-Y0) 120,120,90
+ IF(IS .lt. 0) goto 80
+ if(IS .eq. 0) goto 140
+ goto 90
+ 55 IF(Y(I) .eq. Y0) goto 120
+ if(Y(I) .gt. Y0) goto 58
+ IF(YL .ge. Y0) goto 120
+ goto 90
+ 58 IF(YL .le. Y0) goto 120
+ goto 90
C
60 IL=0
- IF(Y(I)-Y0) 90,120,90
- 80 IF(YL-Y0+(Y(I)-YL)*(X0-XL)/(X(I)-XL)) 90,120,85
- 85 NPC=NPC+1
+ IF (Y(I) .eq. Y0) goto 120
+ goto 90
+ 80 tmp = YL-Y0+(Y(I)-YL)*(X0-XL)/(X(I)-XL)
+ IF (tmp .lt. 0) goto 90
+ if (tmp .eq. 0) goto 120
+ NPC=NPC+1
90 XL=X(I)
YL=Y(I)
100 CONTINUE