hi,
i am converting a gizzilion lines of fortran to java and i have come to ask you experienced ppl of how to deal with GOTO STATEMENTS and lables in the translation. u c, java's labeling capabilities are very weak so i am wondering if there is a better solution than setting flags.
here is an example of what i am asking...
0 IF (KK1(K+1) .GT. 9) GO TO 35
IF (KK1(K+2) .GT. 9) GO TO 40
IF (KK1(K+3) .GT. 9) GO TO 45
WRITE (*,*) ' Invalid item number, do you want to try ',
1 'again? (Y/N)'
READ (*,'(A)') ANS
IF (ANS .EQ. 'Y') GO TO 1
STOP
35 N2 = N2 + 1
KK2(N2) = KK1(K)
K = K + 1
GO TO 150
40 N2 = N2 + 1
KK2(N2) = KK1(K) * 10 + KK1(K+1)
K = K + 2
GO TO 150
45 N2 = N2 + 1
i am converting a gizzilion lines of fortran to java and i have come to ask you experienced ppl of how to deal with GOTO STATEMENTS and lables in the translation. u c, java's labeling capabilities are very weak so i am wondering if there is a better solution than setting flags.
here is an example of what i am asking...
0 IF (KK1(K+1) .GT. 9) GO TO 35
IF (KK1(K+2) .GT. 9) GO TO 40
IF (KK1(K+3) .GT. 9) GO TO 45
WRITE (*,*) ' Invalid item number, do you want to try ',
1 'again? (Y/N)'
READ (*,'(A)') ANS
IF (ANS .EQ. 'Y') GO TO 1
STOP
35 N2 = N2 + 1
KK2(N2) = KK1(K)
K = K + 1
GO TO 150
40 N2 = N2 + 1
KK2(N2) = KK1(K) * 10 + KK1(K+1)
K = K + 2
GO TO 150
45 N2 = N2 + 1