home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 1B
/
DATAFILE_PDCD1B.iso
/
_pocketbk
/
pocketbook
/
003
/
tube20_zip
/
TUBE.OPL
< prev
next >
Wrap
Text File
|
1993-12-05
|
5KB
|
282 lines
APP Tube
ICON "\OPD\TUBE.PIC"
TYPE 0
ENDA
PROC Tube:
GLOBAL A001$(50),A002$(50),Dl,Di1
GLOBAL Di2,Di3,Di4,Di5,Al
GLOBAL Ai1,Ai2,Ai3,Ai4,Ai5
GLOBAL Dstn$(22),Astn$(22),Stn$(22),Route%,Route2
GLOBAL Line1$(30),Line2$(30)
GLOBAL Pos%,Da,M
LOCAL dmyz1$(2),lclz1$(50),lclz2%(6)
GIPRINT "TubeFinder v2.0"
lclz1$=PARSE$("",CMD$(1),lclz2%(1))
A002$=LEFT$(lclz1$,lclz2%(5)-1)
A001$=A002$+"\TUBE.DAT"
TRAP OPEN "M:\OPD\TUBE.DBF",A,d$,a$
IF ERR<>0
Dstn$=""
Astn$=""
ELSE
Dstn$=A.d$
Astn$=A.a$
CLOSE
ENDIF
Stn$=Dstn$
DO
dINIT "Departure Station"
dEDIT Stn$,"Search Clue:"
IF DIALOG=0
STOP
ENDIF
UNTIL Tfstn%:=1
Pos%=POS
Dstn$=UpLow$:(A.STN$)
Dl=A.L1
Di1=A.I1
Di2=A.I2
Di3=A.I3
Di4=A.I4
Di5=A.I5
CLOSE
Stn$=Astn$
DO
dINIT "Arrival Station"
dEDIT Stn$,"Search Clue:"
IF DIALOG=0
STOP
ENDIF
UNTIL Tfstn%:=1
Astn$=UpLow$:(A.STN$)
Al=A.L1
Ai1=A.I1
Ai2=A.I2
Ai3=A.I3
Ai4=A.I4
Ai5=A.I5
CLOSE
BUSY "Searching"
LOCK ON
dINIT LEFT$(Dstn$+" to "+Astn$,39)
T1route:
IF Route2=0
dTEXT "","Take the",2
dTEXT "",Line2$+" line.",2
ELSE
T2route:
IF Route2=1
dTEXT "","Take the",2
dTEXT "",Line1$+" line,",2
dTEXT "","change at "+Stn$,2
dTEXT "","and take the",2
dTEXT "",Line2$+" line.",2
ELSE
dTEXT "","Your chosen journey is too complex",2
dTEXT "","to calculate on a Psion Series 3!",2
dTEXT "","Try re-running TubeFinder with a better",2
dTEXT "","known starting point or destination",2
dTEXT "","and then planning a route from there!",2
ENDIF
ENDIF
BUSY OFF
LOCK OFF
DIALOG
ENDP
PROC T1route:
Da=1
Route2=0
IF Dl=Al OR Dl=Ai1 OR Dl=Ai2 OR Dl=Ai3 OR Dl=Ai4 OR Dl=Ai5
Route%=Dl
Tline:
ELSEIF Di1=Al OR Di1=Ai1 OR Di1=Ai2 OR Di1=Ai3 OR Di1=Ai4 OR Di1=Ai5
Route%=Di1
Tline:
ELSEIF Di2=Al OR Di2=Ai1 OR Di2=Ai2 OR Di2=Ai3 OR Di2=Ai4 OR Di2=Ai5
Route%=Di2
Tline:
ELSEIF Di3=Al OR Di3=Ai1 OR Di3=Ai2 OR Di3=Ai3 OR Di3=Ai4 OR Di3=Ai5
Route%=Di3
Tline:
ELSEIF Di4=Al OR Di4=Ai1 OR Di4=Ai2 OR Di4=Ai3 OR Di4=Ai4 OR Di4=Ai5
Route%=Di4
Tline:
ELSEIF Di5=Al OR Di5=Ai1 OR Di5=Ai2 OR Di5=Ai3 OR Di5=Ai4 OR Di5=Ai5
Route%=Di5
Tline:
ENDIF
ENDP
PROC T2rint:
M=0
IF Dl=A.L1 OR Dl=A.I1 OR Dl=A.I2 OR Dl=A.I3 OR Dl=A.I4 OR Dl=A.I5 AND (Al=A.L1 OR Al=A.I1 OR Al=A.I2 OR Al=A.I3 OR Al=A.I4 OR Al=A.I5)
Route%=Dl
Da=1
Tline:
Line1$=Line2$
Stn$=A.STN$
Route%=Al
Da=0
Tline:
M=1
RETURN
GOTO L232::
ENDIF
L232::
ENDP
PROC T2route:
LOCAL lclz1
OPEN A001$,A,STN$,L1,I1,I2,I3,I4,I5
POSITION Pos%
lclz1=0
DO
T2rint:
IF M=1
CLOSE
RETURN
ENDIF
lclz1=lclz1+1
POSITION Pos%+lclz1
T2rint:
IF M=1
CLOSE
RETURN
ENDIF
POSITION Pos%-lclz1
T2rint:
IF M=1
CLOSE
RETURN
ENDIF
UNTIL EOF OR Pos%-lclz1=1
IF EOF
POSITION Pos%
DO
T2rint:
IF M=1
CLOSE
RETURN
ENDIF
BACK
Pos%=Pos%-1
UNTIL Pos%=1
ELSE
POSITION Pos%
DO
T2rint:
IF M=1
CLOSE
RETURN
ENDIF
NEXT
UNTIL EOF
ENDIF
Route2=2
CLOSE
ENDP
PROC UpLow$:(in$)
LOCAL p%,t%,u%,c$(1),out$(30)
p%=1
t%=LEN(in$)
u%=1
out$=""
WHILE p%<=t%
c$=MID$(in$,p%,1)
IF u%=1
out$=out$+UPPER$(c$)
u%=0
ELSE
out$=out$+LOWER$(c$)
ENDIF
IF c$=" "
u%=1
ENDIF
p%=p%+1
ENDWH
RETURN(out$)
ENDP
PROC Tfstn%:
LOCAL lclz2%,rec%,p%,all$(255)
OPEN A001$,A,STN$,L1,I1,I2,I3,I4,I5
FIRST
lclz2%=FIND("*"+UPPER$(Stn$)+"*")
IF lclz2%=0
dINIT
dTEXT "","No matches found",2
CLOSE
DIALOG
RETURN(0)
ENDIF
all$=UpLow$:(A.STN$)
dINIT "Select a Station"
DO
NEXT
lclz2%=FIND("*"+UPPER$(Stn$)+"*")
IF lclz2%=0
BREAK
ENDIF
IF (LEN(all$)+LEN(A.STN$)+1)>255
dTEXT "","Not all matches shown",$102
BREAK
ENDIF
all$=all$+","+UpLow$:(A.STN$)
UNTIL 0
dCHOICE rec%,"Station",all$
IF DIALOG=0
CLOSE
RETURN(0)
ENDIF
p%=1
WHILE rec%>1
WHILE MID$(all$,p%,1)<>","
p%=p%+1
ENDWH
p%=p%+1
rec%=rec%-1
ENDWH
all$=right$(all$,LEN(all$)+1-p%)
p%=LOC(all$,",")
IF p%>0
all$=LEFT$(all$,p%-1)
ENDIF
FIRST
FIND(UPPER$(all$))
RETURN(1)
ENDP
PROC Tline:
IF Route%=1
Line2$="Bakerloo (Brown)"
ELSEIF Route%=2
Line2$="Central (Red)"
ELSEIF Route%=3
Line2$="Circle (Yellow)"
ELSEIF Route%=4
Line2$="District (Green)"
ELSEIF Route%=5
Line2$="East London (Orange)"
ELSEIF Route%=6
Line2$="Jubilee (Gray)"
ELSEIF Route%=7
Line2$="Metropolitan (Burgundy)"
ELSEIF Route%=8
Line2$="Northern (Black)"
ELSEIF Route%=9
Line2$="Piccadilly (Blue)"
ELSEIF Route%=10
Line2$="Victoria (Sky Blue)"
ELSEIF Route%=11
Line2$="Docklands Light Railway"
ELSE
Route2=1
ENDIF
RETURN
ENDP