!STUVUE.bas- Student VUE !Author James A. Jarboe IV ! Educational Filmstrips ! 1401 19th Street ! Huntsville, TX 77340 ! 409-295-5767 ! GR/AM ! Copyright 1986 ! for use for AMUS members at no cost ! inspired by a Teacher in NM that has dumb students bright enough to ! yank the bright boy's program into his own program ! ! a program that allows the user to vue a sequential file without ! being able to yank another students programs in ! ! limitations ! 1. 120 lines of text only ( could be increased if you want to) ! 2. No TAB key to tab over (IE TAB key don't work) ! 3. No Centering of Text ! 4. Cursor down or Cursor up always puts cursor at first column ! 5. No Search ! 6. No Move ! 7. No Copy ! 8. Not much of anything but text editing ! 9. only 79 columns of text !10. ^Z does delete a line but does not squash lines together this is ! done when the program finishes out (ie. it don't output blank lines) ! advantages ! 1. Will compil program on G ! 2. Will finish program on F ! 3. Will Quit program on Q ! 4. Will give nasty message on Y ! 5. most control chars work like VUE ! All proper respect and homage is now given to VUE, it's ! authors, publishers, dealers, and users ! ! The program starts here: MAP1 LINES(120),S,79 ! 120 lines of text MAP1 ST'LINES(120),S,79 ! storage for a ^B move MAP1 CRT ! all the fancy stuff for STUVUE.SBR MAP2 ROW,S,2 ! row we are on MAP2 FIL1,S,1," " ! filler MAP2 COL,S,2 ! column ( always 1) MAP2 FIL2,S,1," " ! MAP2 TYPE,S,1,"*" ! string data as per STUVUE.SBR MAP2 FIL3,S,1," " ! MAP2 MINS,S,2,"00" ! minimum length MAP2 FIL4,S,1," " ! MAP2 MAXS,S,2,"79" ! Maximum length MAP2 FIL5,S,1," " MAP2 FLAG,S,2,"AT" ! Auto field and trap ^C MAP2 FIL6,S,1," " ! MAP1 PLINE,S,79 ! DATA string MAP1 KEY,B,2 ! key to what ^ char was hit MAP1 EXT,S,4,".BAS" ! BASIC file extension MAP1 MAXO,F,6,120 ! number of lines of text VUE: ! INPUT "",FILE$ ! get infor from STUVUE.DO DOT=INSTR(1,FILE$,".") ! look for dot on extension IF DOT>0 THEN GOTO GOTEXT ! we got dot FILE$=FILE$+EXT ! no dot then give ext GOTEXT: LOOKUP FILE$,ANSWER ! look see if file is there IF ANSWER<0 THEN GOTO MISMAT ! random file is a nono IF ANSWER=0 THEN CALL MAKEIT ! no sequential file ..make it OPENIT: R=1 ! row =1 OPEN #1,FILE$,INPUT ! open the file as input FOR I=1 TO MAXO ! 1 to number of lines PLINE="" ! nothing INPUT LINE #1,PLINE ! get the line IF EOF(1)=1 THEN LST'LINE=I :I = MAXO:GOTO NOMO ! end of file IF INSTR(1,PLINE,CHR$(9)) THEN CALL CLEAN ! clear TABS LINES(I)=PLINE ! data to memory storage NOMO: NEXT I ! do it again CLOSE #1 ! close the file BEGIN: ? TAB(-1,0); ! clear screen ROW="01" ! row=1 COL="01" ! column = 1 SCR=0 ! first screen (1st 24 lines) FOR I=1 TO 24 ? TAB(I,1);LINES(I); ! print em NEXT I TOP: IF R<1 THEN CALL OLD'SCR ! previous screen IF R>24 THEN CALL NEW'SCR ! next screen ROW=R USING "#Z" ! make right row a string PLINE=LINES(R+SCR) ! give STUVUE.sbr the string XCALL STUVUE,""+CRT+" ",PLINE,KEY IF KEY=1 THEN GOTO ESCAPE ! escape key hit LINES(R+SCR)=PLINE ! data back to memory IF R+SCR>LST'LINE THEN LST'LINE=R+SCR ! number of last line IF KEY=2 THEN R=R-1 ! up arrow IF KEY=3 THEN R=R+1 ! down arrow IF KEY=0 THEN R=R+1 ! carriage return IF KEY=6 THEN R=1:CALL OLD'SCR ! previous page IF KEY=5 THEN R=1:CALL NEW'SCR ! next page IF KEY=7 THEN CALL NEWLIN ! control B IF KEY=8 THEN CALL END'OF ! control E IF KEY=9 THEN GOTO BEGIN ! control ^^ or home key GOTO TOP ! lets do it again ESCAPE: ! escape key module ? TAB(-1,0); ? TAB(1,1);"StudentVUE 1.0A Status: NoYank" ? TAB(3,1);"Editing "FILE$ ? TAB(5,1);">" ROW="05" COL="02" PLINE="" XCALL STUVUE,""+CRT+" ",PLINE,KEY IF UCS(PLINE)[1,1]="F" THEN GOTO FINISH IF UCS(PLINE)[1,1]="Q" THEN GOTO QUIT IF UCS(PLINE)[1,1]="G" THEN GOTO FINISH IF KEY=1 THEN GOTO BEGIN IF PLINE[1,1]="Y" THEN CALL NO'YANK GOTO ESCAPE FINISH: KILL FILE$ ! erase the file OPEN #1,FILE$,OUTPUT ! make a new one same name FOR I=1 TO MAXO ! IF LINES(I)="" THEN GOTO NXI ! dont print nothing to the file ? "."; ! make user think we doing something ? #1,LINES(I) ! print data to file NXI: NEXT I ! do it again CLOSE #1 ! close it IF UCS(PLINE[1,1])="F" GOTO QUIT! is this a finish or a Go OPEN #1,"STUVUE.CMD",OUTPUT ! Its a Go !! ? #1,":R" ! command file revive ? #1,":<" ! ? #1,">" ! ? #1,"COMPIL "FILE$ ! compil it ? #1,":S" ! Silence Shhhh! ? #1,"ERASE STUVUE.CMD" ! erase the command file ? #1,":R" ! back to AMOS CLOSE #1 ! close the command file CHAIN "STUVUE.CMD" ! do it QUIT: ? ! print a line END ! ththththat's all FOLKS ! NEW'SCR: R=1:SCR=SCR+24 ! Screen gets add 24 lines IF SCR>MAXO-24 THEN SCR=SCR-24 ! no more than Maximum lines ? TAB(-1,0); ! clear FOR I=1 TO 24 ! ? TAB(I,1);LINES(I+SCR); ! print new lines NEXT I ! RETURN ! go back to where we wus OLD'SCR: ? TAB(-1,0); ! clear R=1:SCR=SCR-24 ! previous 24 lines IF SCR<0 THEN SCR=0 ! make sure no less thatn 1st 24 FOR I=1 TO 24 ? TAB(I,1);LINES(I+SCR); ! print em NEXT I ! RETURN ! go back..go back MAKEIT: ? FILE$;" does not exist. Do you wish to create it? "; INPUT "",YN ! well ! IF UCS(YN)="N" THEN GOTO QUIT ! ok then quit PLINE="***" ! make file look like MODEM OPEN #1,FILE$,OUTPUT ! open it ! FOR I=1 TO MAXO ! 1 to maximum lines ? #1,PLINE ! print stars ! NEXT I ! CLOSE #1 ! close me RETURN ! to whence we came MISMAT: ? FILE$;" is a random file" ! dummy END CLEAN: TB=INSTR(1,PLINE,CHR$(9)) ! oh boy a tab IF TB=0 RETURN ! oh better .. no tab IF TB=1 AND LEN(PLINE)<2 THEN PLINE=" ":RETURN IF TB=1 THEN PLINE=" "+PLINE[TB+1,LEN(PLINE)]:GOTO CLEAN PLINE=PLINE[1,TB-1]+" "+PLINE[TB+1,LEN(PLINE)] GOTO CLEAN ! look for another RETURN ! get back jack NO'YANK: ON ERROR GOTO BACK ! in case the little devil tries ? ! a control C ? " AMOS Rule #1" ? " Thou Shalt not Yank Another's Program" ? " And Claim it As Your Own Work " FOR I=1 TO 1000 FOR A=1 TO 50 NEXT A ? CHR$(7); ! yell it baby NEXT I RETURN BACK: RESUME BA ! BA: RETURN NEWLIN: FOR NL=R+SCR TO MAXO-1 ! fancy switch for ^B ST'LINES(NL)=LINES(NL) ! storage gets current NEXT NL LINES(R+SCR)="" ! ^B line is blank FOR NL=R+SCR TO MAXO-1 LINES(NL+1)=ST'LINES(NL) ! line ahead gets storage behind NEXT NL ? TAB(R,1);SPACE$(79); ! print the newline FOR NL=R TO 24 LONG=LEN(LINES(NL+SCR+1))-LEN(LINES(NL+SCR)) IF LONG<0 THEN LONG=1 ? TAB(NL,1);LINES(NL+SCR);SPACE$(LONG); NEXT NL RETURN END'OF: SCR=0 ! screen = 1st one FOR I=1 TO 5 ! add 24 to 24 until greater IF LST'LINE>SCR+24 THEN SCR=SCR+24 ! than last line of file NEXT I ! ? TAB(-1,0); ! clear screen FOR R=1 TO 24 ! print last screen ? TAB(R,1);LINES(R+SCR); NEXT R R=LST'LINE-SCR ! cursor at last line RETURN