'TAILOR PROGRAM -- COMPANION TO THE TUTOR PROGRAM OF THE 'TALKING SPELLER TUTOR -- written by James W. Kummer 'COPYRIGHT 1987 DIM WORDS$(4,90),COUNT(4,90) ON MOUSE GOSUB HITMOUSE ' ----- DEFINE ENTRY POINT FOR MOUSE INTERRUPTS MOUSE OFF PRINT "TALKING SPELLER TUTOR - TAILOR PROGRAM - SHAREWARE" PRINT "COPYRIGHT 1987 - NOT FOR RESALE - MAY BE GIVEN FREELY" PRINT "PLEASE PAY FOR USE OF TUTOR, TAILOR & FILES - SEND $5 TO:" PRINT "JAMES W. KUMMER " PRINT "784 S. HOYT STREET, LAKEWOOD CO 80226" PRINT Q$="DO YOU WANT TO EDIT AN EGZISTING FILE" SAY TRANSLATE$(Q$) Q$="DO YOU WANT TO EDIT AN EXISTING FILE" PRINT Q$;" (1) Q$="OR CREATE A NEW ONE?" SAY TRANSLATE$(Q$) PRINT Q$;" (2)" INPUT NEW2 Q$="SPECIFY YOUR FILE NAME BY PATH (e.g. GERMAN1 - IF YOU BOOT WITH THIS DISK)" PRINT Q$ Q$="SPECIHFY YOUR FILE NAME BY PATH" SAY TRANSLATE$(Q$) ON ERROR GOTO GOOF STARTER: PRINT "File Name? " INPUT AME$ NWORD=0 IF NEW2=2 THEN DUNINPT ' ----- IF NEW FILE - DON'T INPUT OPEN "I",#1,AME$ ILOOP: IF EOF(1) THEN CEOF INPUT #1,A$ LA=LEN(A$) IF LA=0 THEN CEOF Q$=SPACE$(LA) IF A$=Q$ THEN CEOF NWORD=NWORD+1 FOR I=1 TO 4 : WORDS$(I,NWORD)="" : NEXT I LEQ=INSTR(A$,"=") ' ------------------- LOCATION OF EQUAL-SIGN LSEM=INSTR(A$,";") ' ------------------ LOCATION OF SEMICOLON IF LEQ=0 THEN SIDE1 IF LSEM>LEQ THEN LSEM=0 LSEM2=INSTR(LEQ,A$,";") ' ----------- LOCATION OF 2nd SEMICOLON IF LSEM2=0 THEN YEQ L2=LA-LSEM2 WORDS$(4,NWORD)=MID$(A$,LSEM2+1,L2) ' ---- EXTRACT 4th FIELD YEQ: IF LSEM2=0 THEN LSEM2=LA+1 L2=LSEM2-LEQ-1 WORDS$(3,NWORD)=MID$(A$,LEQ+1,L2) ' ---- EXTRACT 3rd FIELD SIDE1: IF LSEM=0 THEN PART1 IF LEQ=0 THEN LEQ=LA+1 L2=LEQ-LSEM-1 WORDS$(2,NWORD)=MID$(A$,LSEM+1,L2) ' ---- EXTRACT 2nd FIELD PART1: IF LEQ=0 THEN LEQ=LA+1 IF LSEM=0 THEN LSEM=LEQ L2=LSEM-1 WORDS$(1,NWORD)=MID$(A$,1,L2) ' ---- EXTRACT 1st FIELD FOR J=1 TO 4 IF WORDS$(J,NWORD)<>"" THEN WORDS$(J,NWORD)=UCASE$(WORDS$(J,NWORD)) COUNT(J,NWORD)=LEN(WORDS$(J,NWORD)) NEXT J GOTO ILOOP CEOF: CLOSE #1 DUNINPT: ON ERROR GOTO 0 KWORD=NWORD : IF KWORD=0 THEN KWORD=90 LINE (0,0)-(625,380),0,BF '-- DRAW UPPER-LEFT MOUSE BOX -- LINE (5,5)-(280,65),3,BF LOCATE 5,9 PRINT "ACCEPT GROUP" LOCATE 6,9 PRINT "& EDIT NEXT" '-- DRAW UPPER-RIGHT MOUSE BOX -- LINE (320,5)-(600,65),3,BF LOCATE 5,55 PRINT "QUIT EDIT &" LOCATE 6,55 PRINT "SAVE FILE" '-- DRAW LARGE BOX -- LINE (5,85)-(625,180),2,BF LOCATE 12,8 PRINT " PHRASE GROUP # " L2=12 QSP$=SPACE$(69) FOR I=1 TO 4 L2=L2+2 LOCATE L2,2 '-- FIELDS ON LINES 14,16,18,20 -- PRINT QSP$ NEXT I '-- DRAW "SAY" MOUSE BOXES -- LINE (580,103)-(635,128),3,BF LOCATE 15,74 PRINT "SAY" LINE (580,135)-(635,160),3,BF LOCATE 19,74 PRINT "SAY" MOUSE ON '-- CYCLE THRU EACH PHRASE GROUPS FOR EDITS -- FOR I=1 TO KWORD COLOR 1,0 LOCATE 12,24 PRINT I L2=12 FOR LA=1 TO 4 '-- DISPLAY PHRASE GROUP -- L2=L2+2 LOCATE L2,2 PRINT QSP$ LOCATE L2,3 PRINT WORDS$(LA,I) NEXT LA TYPE1: KLINE=14 : KCHAR=1 : LA=1 : KOL=3 : COLOR 1,0 TYPE2: LOCATE KLINE,KOL IF COUNT(LA,I)>0 THEN ICHAR$=MID$(WORDS$(LA,I),KCHAR,1) :ELSE ICHAR$=" " IF COUNT(LA,I)=KCHAR THEN ICHAR$=ICHAR$+" " : COLOR 1,0 IF ICHAR$="" THEN PRINT " " :ELSE PRINT ICHAR$ FLASH=0 TYPER: TCHAR$=INKEY$ '-- FLASH-CURSOR LOGIC -- FLASH=FLASH+1 IF FLASH=40 THEN ' ------- 20/60 OF THE TIME, THE CURSOR CHAR IS RED LOCATE KLINE,KOL COLOR 3,0 IF ICHAR$=" " OR ICHAR$="" THEN PRINT CHR$(140) :ELSE PRINT ICHAR$ ELSEIF FLASH=60 THEN ' ------- restore color of cursor char LOCATE KLINE,KOL : COLOR 1,0 IF ICHAR$="" THEN PRINT " " :ELSE PRINT ICHAR$ FLASH=0 END IF IF TCHAR$="" THEN TYPER COLOR 1,0 LOCATE KLINE,KOL : PRINT ICHAR$ '-- RESTORE CHAR AT CURSOR -- TC=ASC(TCHAR$) IF TC=13 OR TC=29 OR TC=9 THEN ' -------- tab, down-arrow or IF KCHAR>COUNT(LA,I) THEN LOCATE KLINE,KOL : PRINT " " END IF KLINE=KLINE+2 : KCHAR=1 : LA=LA+1 : KOL=3 IF LA<5 THEN TYPE2 :ELSE TYPE1 ELSEIF TC=28 THEN ' --------------------------- input is up-arrow IF KCHAR>COUNT(LA,I) THEN LOCATE KLINE,KOL : PRINT " " END IF KLINE=KLINE-2 : KCHAR=1 : LA=LA-1 : KOL=3 IF LA<1 THEN LA=4 : KLINE=KLINE+8 END IF GOTO TYPE2 ELSEIF TC=30 THEN ' ------------------------------- input is right-arrow IF KCHAR>=COUNT(LA,I)+1 THEN BEEP : GOTO TYPER ELSE KCHAR=KCHAR+1 : KOL=KOL+1 : GOTO TYPE2 END IF ELSEIF TC=31 THEN ' -------------------- input is left-arrow IF KCHAR=1 THEN BEEP : GOTO TYPER ELSE KCHAR=KCHAR-1 : KOL=KOL-1 : GOTO TYPE2 END IF ELSEIF TC=8 THEN ' --------------- back-space - delete to left IF KCHAR=1 THEN BEEP : GOTO TYPER ELSE KCHAR=KCHAR-1 : KOL=KOL-1 GOSUB REMOVE GOTO TYPE2 END IF ELSEIF TC=127 THEN ' --------- delete char - remove current character GOSUB REMOVE GOTO TYPE2 ELSEIF TC>31 AND TC<127 THEN ' ------- input is a valid character IF KCHAR=COUNT(LA,I)+1 THEN WORDS$(LA,I)=WORDS$(LA,I)+TCHAR$ ' -- append new char at end of line LOCATE KLINE,KOL : PRINT TCHAR$ ELSE TL$=LEFT$(WORDS$(LA,I),KCHAR-1) ' --- insert new char in middle TR$=RIGHT$(WORDS$(LA,I),COUNT(LA,I)-KCHAR+1) A$=TCHAR$+TR$ LOCATE KLINE,KOL : PRINT A$ WORDS$(LA,I)=TL$+A$ END IF KCHAR=KCHAR+1 : KOL=KOL+1 COUNT(LA,I)=LEN(WORDS$(LA,I)) : GOTO TYPE2 ELSEIF TC=130 THEN ' -------------------------- input is F2 IF WORDS$(4,I)="" THEN SAY TRANSLATE$(WORDS$(3,I)) ELSE SAY TRANSLATE$(WORDS$(4,I)) END IF GOTO TYPER ELSEIF TC=129 THEN ' -------------------------- input is F1 IF WORDS$(2,I)="" THEN SAY TRANSLATE$(WORDS$(1,I)) ELSE SAY TRANSLATE$(WORDS$(2,I)) END IF GOTO TYPER ELSEIF TC=134 THEN ' -------------------------- input is F6 IF WORDS$(2,I)="" THEN WORDS$(2,I)=WORDS$(1,I) LA=2 : KLINE=16 : KOL=3 : KCHAR=1 LOCATE KLINE,KOL : PRINT WORDS$(LA,I) COUNT(LA,I)=COUNT(1,I) GOTO TYPE2 ELSE BEEP : GOTO TYPER END IF ELSEIF TC=135 THEN ' -------------------------- input is F7 IF WORDS$(4,I)="" THEN WORDS$(4,I)=WORDS$(3,I) LA=4 : KLINE=20 : KOL=3 : KCHAR=1 LOCATE KLINE,KOL : PRINT WORDS$(LA,I) COUNT(LA,I)=COUNT(3,I) GOTO TYPE2 ELSE BEEP : GOTO TYPER END IF ELSEIF TC=197 THEN ' -------------------------- input is -Q GOTO KENDA ELSEIF TC=175 THEN ' -------------------------- input is -N GOTO LOOPIT ELSE BEEP : GOTO TYPER END IF GOTO TYPER ' ------------ end of type-in loop LOOPIT: NEXT I KENDA: MOUSE OFF PRINT CHR$(12) : COLOR 1,0 Q$="STORE AS FILE "+AME$ ' ------ ask if output file is same is input name SAY TRANSLATE$(Q$) PRINT Q$+" (Y/N)?" INPUT Q$ IF UCASE$(Q$)="Y" THEN GOTO FILEOPEN Q$="SPECIFY THE NEW FILE NAME BY PATH (e.g., DF1:GERMAN/LESSON1)" PRINT Q$ Q$="SPECIHFY THE NEW FILE NAME BY PATH" SAY TRANSLATE$(Q$) PRINT "File Name? " INPUT AME$ FILEOPEN: OPEN "O",#1,AME$ FOR I=1 TO KWORD '----------------- figure out format to store this record ------------- IF WORDS$(3,I)="" THEN IF WORDS$(2,I)="" THEN PRINT #1,WORDS$(1,I) ELSE PRINT #1,WORDS$(1,I);";";WORDS$(2,I) END IF ELSE IF WORDS$(4,I)="" THEN IF WORDS$(2,I)="" THEN PRINT #1,WORDS$(1,I);"=";WORDS$(3,I) ELSE PRINT #1,WORDS$(1,I);";";WORDS$(2,I);"=";WORDS$(3,I) END IF ELSE IF WORDS$(2,I)="" THEN PRINT #1,WORDS$(1,I);"=";WORDS$(3,I);";";WORDS$(4,I) ELSE PRINT #1,WORDS$(1,I);";";WORDS$(2,I);"=";WORDS$(3,I);";";WORDS$(4,I) END IF END IF END IF NEXT I CLOSE #1 END HITMOUSE: IF MOUSE(0)=0 THEN RETURN IF MOUSE(0)>0 THEN RETURN IF MOUSE(2)>75 THEN IF MOUSE(1)<570 THEN RETURN ELSE IF MOUSE(2)>133 THEN ' ------- upper SAY was moused IF WORDS$(4,I)="" THEN SAY TRANSLATE$(WORDS$(3,I)) ELSE SAY TRANSLATE$(WORDS$(4,I)) END IF ELSE ' ------------------------ lower SAY was moused IF WORDS$(2,I)="" THEN SAY TRANSLATE$(WORDS$(1,I)) ELSE SAY TRANSLATE$(WORDS$(2,I)) END IF END IF END IF ELSE IF MOUSE(1)>300 THEN RETURN KENDA ' ------------- upper-right box moused ELSE RETURN LOOPIT ' ------------- upper-left box moused END IF END IF RETURN REMOVE: IF KCHAR>COUNT(LA,I) THEN ' ------ blank right-most character LOCATE KLINE,KOL : PRINT " " ELSE TL$=LEFT$(WORDS$(LA,I),KCHAR-1) ' -------- delete character from middle TR$=RIGHT$(WORDS$(LA,I),COUNT(LA,I)-KCHAR) WORDS$(LA,I)=TL$+TR$ LOCATE KLINE,KOL : PRINT TR$+" " END IF COUNT(LA,I)=LEN(WORDS$(LA,I)) RETURN GOOF: PRINT "YOU HAVE SPECIFIED A NON-EXISTENT FILE NAME - TRY AGAIN" GOTO STARTER