Classic Computer Magazine Archive PROGRAM LISTING: 84-08/RENAMER.LST


27500 CLR :DIM ZMOVE$(54):RESTORE 27501:FOR ZCT=1 TO 54:READ ZLG:ZMOVE$(ZCT,ZCT)=CHR$(ZLG):NEXT ZCT
27501 DATA 104,104,133,204,104,133,203,104,133,206,104,133,205,104,133,208,104,133,207,166,208,240,16,160,0
27502 DATA 177,203,145,205,136,208,249,230,204,230,206,202,208,242,164,207,136,192,255,240,7,177,203,145,205
27503 DATA 24,144,244,96
27504 DIM ZOLDV$(20),ZNEWV$(20),ZTEMP$(20),ZCHAR$(1)
27505 GRAPHICS 0:? :? "      BASIC VARIABLE RENAMER":? "       by W. W. Hough  1/84":? :? :OPEN #1,4,0,"K:"
27506 ? "Do you want to change the name of a":? :? "    1.  Scalar (number)":? "    2.  Array":? "    3.  String"
27507 ? :? "Answer 1, 2, or 3 ";
27508 GET #1,ZANS:ZANS=ZANS-48:IF ZANS<1 OR ZANS>3 THEN 27507
27509 ? :? :? "Change ";:ON ZANS GOSUB 27510,27511,27512:? " variable.":GOTO 27513
27510 ? "NUMERIC";:RETURN 
27511 ? "ARRAY";:RETURN 
27512 ? "STRING";:RETURN 
27513 CLOSE #1:? :? "What's the old name ";:INPUT ZOLDV$:? :? "What's the new name ";:INPUT ZNEWV$
27514 ZTEMP$=ZNEWV$:GOSUB 27531:ZNEWV$=ZTEMP$:ZTEMP$=ZOLDV$:GOSUB 27531:ZOLDV$=ZTEMP$:GRAPHICS 0:POSITION 2,4
27515 ON ZANS GOSUB 27516,27518,27519:GOTO 27520
27516 ? ZNEWV$;"=1":GOSUB 27534:POKE ADR(ZNEWV$)+LEN(ZNEWV$)-1,PEEK(ADR(ZNEWV$)+LEN(ZNEWV$)-1)+128
27517 POKE ADR(ZOLDV$)+LEN(ZOLDV$)-1,PEEK(ADR(ZOLDV$)+LEN(ZOLDV$)-1)+128:RETURN 
27518 ? "DIM ";ZNEWV$;"(1)":GOSUB 27534:ZNEWV$(LEN(ZNEWV$)+1)="�":ZOLDV$(LEN(ZOLDV$)+1)="�":RETURN 
27519 ? "DIM ";ZNEWV$;"$(1)":GOSUB 27534:ZNEWV$(LEN(ZNEWV$)+1)="�":ZOLDV$(LEN(ZOLDV$)+1)="�":RETURN 
27520 IF ZNEWV$=ZOLDV$ THEN 27544
27521 ZVNTP=PEEK(130)+256*PEEK(131):ZVNTLG=PEEK(132)+256*PEEK(133)-ZVNTP
27522 DIM ZVNT1$(ZVNTLG),ZVNT2$(ZVNTLG):ZVNT1$="A":ZVNT1$(ZVNTLG)="A":ZVNT1$(2)=ZVNT1$
27523 ZLG=USR(ADR(ZMOVE$),ZVNTP,ADR(ZVNT1$),ZVNTLG):ZVNT2$=ZVNT1$:ZLG=1
27524 FOR ZCT=1 TO ZVNTLG-LEN(ZNEWV$):IF ZVNT1$(ZCT,ZCT+LEN(ZNEWV$)-1)=ZNEWV$ THEN 27536
27525 NEXT ZCT:GOTO 27527
27526 POP :ZLG=0
27527 FOR ZCT=1 TO ZVNTLG-LEN(ZOLDV$)+1:IF ZVNT1$(ZCT,ZCT+LEN(ZOLDV$)-1)=ZOLDV$ THEN 27540
27528 NEXT ZCT
27529 ? :? "There's no variable by that name in":? "the Variable Name Table."
27530 ? :? "Do you want to change another":? "variable ?";:GOTO 27545
27531 ZLG=LEN(ZTEMP$):ZCHAR$=ZTEMP$(ZLG,ZLG):IF ZCHAR$<"0" OR ZCHAR$>"Z" THEN ZTEMP$=ZTEMP$(1,ZLG-1):GOTO 27531
27532 IF ZCHAR$>"9" AND ZCHAR$<"A" THEN 27529
27533 RETURN 
27534 ? :? :? "CONT":POSITION 2,0:POKE 842,13:STOP 
27535 POKE 842,12:RETURN 
27536 IF ZCT>1 AND ASC(ZVNT1$(ZCT-1,ZCT-1))<128 THEN 27525
27537 ? :? "The new variable name already exists.":? "Is this change intentional?";
27538 OPEN #1,4,0,"K:":GET #1,ZANS:CLOSE #1:IF ZANS=89 THEN ? :? :? "OK, Don't forget to LIST file":GOTO 27526
27539 POP :GOTO 27500
27540 IF ZCT>1 THEN IF ASC(ZVNT1$(ZCT-1,ZCT-1))<128 THEN 27528
27541 TRAP 27542:ZVNT2$(ZCT+LEN(ZNEWV$),ZVNTLG-LEN(ZOLDV$))=ZVNT1$(ZCT+LEN(ZOLDV$),ZVNTLG-LEN(ZNEWV$))
27542 TRAP 27548:ZVNT2$(ZCT,ZCT+LEN(ZNEWV$)-1)=ZNEWV$:IF ZLG THEN ZVNT2$(ZVNTLG-LEN(ZOLDV$)+1,ZVNTLG)=ZOLDV$
27543 TRAP 40000:ZLG=USR(ADR(ZMOVE$),ADR(ZVNT2$),ZVNTP,ZVNTLG)
27544 ? :? "All done with that variable!  Do you":? "want to change another ?";
27545 OPEN #1,4,0,"K:":GET #1,ZANS:IF ZANS=89 THEN CLOSE #1:POP :GOTO 27500
27546 ? :? :? "Do you want to delete the renamer ?";:GET #1,ZANS:CLOSE #1:IF ZANS=89 THEN 27549
27547 ZPROTECTION=1:CLR :END 
27548 ? :? "Sorry, no room to repeat variable of":? "the length of your new variable name.":GOTO 27530
27549 ZCT=27500:ZNEWV$="CONT":GRAPHICS 0
27550 POSITION 2,4:FOR ZLG=ZCT TO ZCT+13:? ZLG:NEXT ZLG:? ZNEWV$:ZCT=ZCT+14:POSITION 2,0:POKE 842,13:STOP 
27551 POKE 842,12:GRAPHICS 0:IF ZCT<27539 THEN 27550
27552 ZNEWV$="POKE 842,12:GR.0":GOTO 27550

Back to previous page