80 REM IMPORTANT VARIABLES-DW$(N)-ARRAY OF DICTIONARY WORDS, DF$(N)-ARRAY OF DICTIONARY DEFINITIONS, NT$(N)-ARRAY OF DICTIONARY NOTES, NW-NUMBER OF WORDS IN DICTIONARY
90 CLEAR : DIM DW$(1000),DF$(1000),NT$(1000)
100 DIM X$(1),SL(6):X$(0) = " ":X$(1) = "-->": GOSUB 2670:SX = 4: REM MENU VARIABLES
110 D$ = CHR$(4)
120 REM MENU
130 HOME : INVERSE : HTAB 10: PRINT "*** THE TRANSLATOR ***": NORMAL : VTAB 8: HTAB 14: PRINT "BY KEN PENNER": VTAB 15: PRINT "** COPYRIGHT 1986 BY MICROSPARC,INC **"
140 VTAB 23: HTAB 8: PRINT "PRESS <RETURN> TO CONTINUE";: GET Z$: PRINT
180 GOSUB 2740: IF Z = 20 THEN PRINT CHR$(7): GOTO 180
190 IF NW = 0 AND SL < >1 AND SL < >7 AND SL < >9 THEN HOME : VTAB 12: PRINT "NO DATA ON FILE...ADD SOME FIRST": GOSUB 2660: GOTO 170
200 ON SL GOSUB 280,420,730,870,1220,1410,1930,2170,2520
210 B$ = "": ON A$ = "Y" AND SL = 8 GOTO 90: GOTO 170
220 GOTO 130
230 IF DW$ = "" THEN 260
240 VTAB 1: HTAB 1: PRINT "LANGUAGES: "DW$"/"DF$;
250 VTAB 2: HTAB 1: PRINT "WORDS IN DICTIONARY: "NW;
260 RETURN
270 REM ENTER NEW WORDS
280 HOME : VTAB 1: HTAB 1: INVERSE : PRINT "WORD ENTRY MODE": NORMAL : PRINT
290 POKE 34,1
300 XX = 0: GOSUB 2090: IF XX = 27 THEN RETURN
310 NW = NW +1: IF NW >800 THEN HOME : VTAB 12: PRINT "YOU HAVE REACHED THE 800-WORD MAXIMUM.": PRINT : PRINT "SAVE CURRENT CONTENTS.": GOSUB 2660: RETURN
1260 IF A$ = "1" THEN BEGIN$ = " A ":FINISH$ = " ZZZZ"
1270 IF A$ = "2" THEN GOSUB 1360
1280 VTAB 10: HTAB 1: CALL -958: HTAB 1: INPUT "(S)CAN OR (C)ONTROL MODE: ";CTRL$: IF CTRL$ < >"S" AND CTRL$ < >"C" THEN 1280
1290 VTAB 13: HTAB 1: CALL -958: HTAB 1: INPUT "OUTPUT TO (P)RINTER OR (S)CREEN? ";SP$: IF SP$ < >"P" AND SP$ < >"S" GOTO 1290
1300 HOME : FOR N = 1 TO NW: IF SP$ = "P" THEN PRINT D$"PR#1": IF N = 1 THEN PRINT DW$"/"DF$" DICTIONARY PRINTOUT": PRINT
1310 FD = 0: IF (BEGIN$ = <DW$(N)) AND (FINISH$ > = DW$(N)) THEN FD = 1: PRINT DW$(N)"-->"DF$(N);: IF NT$(N) < >"" AND NT$(N) < >" " AND NT$(N) < >" " THEN PRINT "("NT$(N)")";: REM 0,1,2 SPACES IN QUOTES
1320 IF FD AND CTRL$ = "C" AND N < >NW THEN PRINT D$: PRINT D$"PR#0": PRINT "<ESC> TO QUIT, <RETURN> TO CONTINUE": GOSUB 2620: IF XX = 27 THEN RETURN
1450 VTAB 20: PRINT "YOUR PHRASE WILL BE TRANSLATED WORD BY": PRINT "WORD WHEN SPACES SEPARATE THE WORDS ": PRINT "BUT WILL BE TRANSLATED BY PHRASE IF": PRINT "ASTERISKS (*) SEPARATE THE WORDS."
1480 REM CHECK FOR SPACES/SPLIT UP INTO WORDS/CHECK FOR ASTERISKS AND SPLIT INTO PHRASES
1490 L = LEN(T$): FOR N = 1 TO L
1500 ONERR GOTO 1560
1510 IF MID$ (T$,N,1) = " " THEN C5 = C5 +1:T$(C5) = MID$ (T$,C6,N -C6):C6 = N +1
1520 A = ASC( MID$ (T$,N,1)): IF A >90 OR A <65 AND A < >42 AND A < >32 THEN VTAB 17: HTAB 1: INPUT "UPPER-CASE CHARACTERS ONLY PLEASE: ";A$: GOTO 1410
1530 A = LEN(T$(C5)): IF A >1 THEN FOR N1 = 1 TO A: IF MID$ (T$(C5),N1,1) = "*" THEN T$(C5) = LEFT$(T$(C5),N1 -1) +" " + RIGHT$(T$(C5),A -N1)
1540 IF A >1 THEN NEXT N1
1550 NEXT N
1560 IF C5 >10 THEN PRINT : INPUT "TOO MANY WORDS: ";A$: GOTO 1410
1570 FOR N = 1 TO C5:T$(N) = " " +T$(N) +" ": NEXT N
1580 POKE 216,0: ONERR GOTO 2450
1590 ON VAL(A$) GOSUB 1620,1710
1600 GOTO 1410
1610 REM TRANSLATING FROM DICTIONARY WORD LANGUAGE INTO DEFINITION LANGUAGE
1620 HOME : PRINT : INVERSE : PRINT "TRANSLATING": NORMAL : PRINT : GOSUB 1900
1630 FOR N = 1 TO C5:TRANS = 0: PRINT T$(N);
1640 FOR N1 = 1 TO NW: HTAB 20: PRINT "-->"N1;
1650 IF T$(N) = DW$(N1) THEN HTAB 20: PRINT "-->"DF$(N1)" ":TRANS = 1
1660 NEXT N1: IF TRANS = 0 THEN HTAB 20: PRINT "--> WORD UNKNOWN": PRINT
1670 IF TRANS < >0 THEN HTAB 20: PRINT " ": REM 10 SPACES
2070 PRINT D$"OPEN"B$: PRINT D$"WRITE"B$: PRINT DW$: PRINT DF$: PRINT NW: FOR N = 1 TO NW: PRINT DW$(N): PRINT DF$(N): PRINT NT$(N): NEXT : PRINT D$"CLOSE": PRINT : INPUT "DICTIONARY FILE SAVED TO DISK: ";A$: RETURN
2080 REM CHECK TO SEE TYPE OF DICTIONARY
2090 IF DF$ < >"" AND DW$ < >"" THEN RETURN
2100 HOME : VTAB 8: HTAB 1: PRINT "<RETURN> TO BEGIN NEW DICTIONARY,": PRINT "<ESC> FOR MAIN MENU": GOSUB 2620: IF XX = 27 THEN RETURN
2110 PRINT : VTAB 11: HTAB 1: INPUT "LANGUAGE OF DEFINITIONS IS: ";DF$: IF DF$ = "" GOTO 2100
2120 VTAB 14: HTAB 1: INPUT "LANGUAGE OF DICTIONARY WORDS IS: ";DW$: IF DW$ = "" THEN 2120
2130 GOSUB 2800: REM ADJUST MENU ENTRIES
2140 HOME : PRINT : PRINT : RETURN
2150 REM PAD WITH SPACES
2160 REM CLEAR MEMORY
2170 HOME : VTAB 12: PRINT : INPUT "ARE YOU SURE? (Y/N): ";A$
2180 RETURN
2190 REM INPUT LINE EDITOR
2200 L = 2
2210 E = 1
2220 VTAB T +2: HTAB L: POKE -16388,0: GET Z1$:X = PEEK( -16384): VTAB T +2
2230 IF X <32 THEN ON X GOTO 2220,2200,2220,2350,2220,2410,2220,2360,2400,2220,2220,2220,2300,2440,2220,2220,2430,2220,2220,2220,2380,2220,2220,2220,2220,2420: GOTO 2220
2240 IF E = 1 THEN M$ = LEFT$(M$,L -1) +Z1$ + MID$ (M$,L +1): HTAB L: PRINT Z1$;:L = L +1: GOTO 2220
2250 IF E = 2 THEN M$ = LEFT$(M$,L -1) +Z1$ + MID$ (M$,L): HTAB L: PRINT MID$ (M$,L);:L = L +1: GOTO 2220
2260 F = W:W = X: IF F < >X AND F THEN E = 1: GOTO 2240
2270 FOR J3 = L +1 TO LEN(M$): IF Z1$ < > MID$ (M$,J3,1) THEN NEXT : GOTO 2220
2470 IF X = 6 OR X = 5 THEN PRINT "FILE NOT FOUND";:X = 257
2480 IF X = 8 OR X = 9 OR X = 10 THEN PRINT "I/O ERROR";:X = 257
2490 IF X = 254 OR X = 255 OR X = 53 OR X = 176 THEN PRINT "BAD INPUT ERROR";:X = 257
2500 IF X < >257 THEN PRINT "ERROR NUMBER " PEEK(222)" IN LINE " PEEK(218) + PEEK(219) *256: PRINT "SEE YOUR APPLESOFT MANUAL FOR HELP";
2510 GOSUB 2660: GOTO 170
2520 HOME : VTAB 12: INPUT "ARE YOU SURE? (Y/N): ";A$: IF A$ < >"Y" THEN RETURN
2530 IF NW = 0 THEN 2560
2540 PRINT : IF NW < >0 THEN PRINT : PRINT "SAVE DICTIONARY FILE TO DISK BEFORE": INPUT "QUITTING? (Y/N): ";A$: IF A$ < >"Y" THEN 2560
2550 A = 2: GOSUB 1990
2560 HOME : PRINT : PRINT "THAT'S ALL..(TO RESTART TYPE GOTO 110)"
2570 END
2580 FM = ( PEEK(111) +256 * PEEK(112)) -( PEEK(109) +256 * PEEK(110)): IF FM <200 THEN ON ( PEEK(48896) = 76) +1 GOSUB 2600,2610: IF FM <100 THEN HOME : VTAB 12: PRINT "RUNNING LOW ON MEMORY": PRINT : PRINT "SAVE CURRENT DICTIONARY CONTENTS": GOSUB 2660
2860 DATA 6,9,MAIN MENU,ENTER A NEW WORD/PHRASE,CHANGE A WORD/PHRASE,ALPHABETIZE DICTIONARY,SEARCH FOR A WORD/PHRASE,DISPLAY/PRINT DICTIONARY,TRANSLATE A WORD/SENTENCE,DISK OPERATIONS,CLEAR DICTIONARY FROM MEMORY,QUIT THE TRANSLATOR
2870 DATA 2,CHANGE A WORD/PHRASE,CHANGE WORD,CHANGE MEANING
2880 DATA 3,SEARCH FOR A WORD/PHRASE,SEARCH FOR DICTIONARY WORD,SEARCH FOR DEFINITION WORD,SEARCH FOR DEFINITION NOTE
2890 DATA 2,DISPLAY/PRINT DICTIONARY,ENTIRE DICTIONARY,DICTIONARY PORTION
2900 DATA 2,TRANSLATE A WORD/SENTENCE,DICTIONARY TO DEFINITION,DEFINITION TO DICTIONARY
2910 DATA 3,DISK OPERATIONS,LOAD DICTIONARY FILE,SAVE DICTIONARY FILE,CATALOG