Classic Computer Magazine Archive PROGRAM LISTING: 89-08/VRENAME.LST


0 GOTO 31500
31500 REM VARIABLE RENAMING UTILITY
31501 REM BY DOUG WHITE
31502 REM (C)1989 ANTIC PUBLISHING INC
31504 ? "}":POSITION 2,2
31505 ? "    VARIABLE RENAMING UTILITY"
31506 ? "          BY DOUG WHITE"
31507 ? 
31508 CLR 
31510 DIM VARNAME$(2000),NAME$(128)
31512 DIM YN$(1)
31514 VNT=PEEK(130)+256*PEEK(131)
31516 N=1:FLAG=0
31518 REM ... GET NEXT VARIABLE NAME
31520 BYTE=PEEK(VNT)
31522 NAME$(N,N)=CHR$(BYTE)
31524 REM .. 0 INDICATES END OF TABLE
31526 IF BYTE=0 THEN 31602
31528 REM ... CHECK FOR INVERSE CHAR.
31530 IF BYTE<128 THEN VNT=VNT+1:N=N+1:GOTO 31520
31532 NAME$(N,N)=CHR$(BYTE-128)
31534 IF NAME$="VARNAME$" THEN 31602
31536 ? :? NAME$:? 
31538 ? "DO YOU WANT TO CHANGE THIS VARIABLE NAME (Y/N) ";
31540 INPUT YN$
31542 IF YN$="Y" THEN 31558
31544 REM ... PUT OLD NAME IN VNAME$
31546 NLEN=LEN(NAME$):VLEN=LEN(VARNAME$)
31548 NAME$(N,N)=CHR$(BYTE)
31550 VARNAME$(VLEN+1,VLEN+1+NLEN)=NAME$
31552 VNT=VNT+1:N=1:NAME$=" "
31554 GOTO 31520
31556 REM 
31558 FLAG=1:REM .. DENOTES A CHANGE
31560 NAME$=" "
31562 ? :? "  INPUT NEW VARIABLE NAME":? 
31564 ? "N THE LAST CHARACTER OF A STRING NAME"
31566 ? "O MUST BE '$'"
31568 ? "T THE LAST CHARACTER OF AN ARRAY NAME"
31570 ? "E MUST BE '('":? 
31572 INPUT NAME$
31574 NLEN=LEN(NAME$)
31576 IF BYTE=164 AND NAME$(NLEN,NLEN)<>"$" THEN 31558
31578 IF BYTE=168 AND NAME$(NLEN,NLEN)<>"(" THEN 31558
31580 ? :? NAME$:? 
31582 ? "IS THIS CORRECT (Y/N) ";
31584 INPUT YN$
31586 IF YN$="N" THEN 31558
31588 REM ... PUT NEW NAME IN VNAME$
31590 NLEN=LEN(NAME$):VLEN=LEN(VARNAME$)
31592 NAME$(NLEN,NLEN)=CHR$(ASC(NAME$(NLEN,NLEN))+128)
31594 VARNAME$(VLEN+1,VLEN+1+NLEN)=NAME$
31596 VNT=VNT+1:N=1:NAME$=" "
31598 GOTO 31520:REM ..GET NEXT NAME
31600 REM 
31602 IF FLAG=0 THEN ? "NO CHANGES MADE":END 
31604 REM 
31606 REM ... STORE OLD POINTERS
31608 VNT=PEEK(130)
31610 VNT1=PEEK(131)
31612 VNT2=PEEK(132)
31614 VNT3=PEEK(133)
31616 TRAP 31698
31618 VLEN=LEN(VARNAME$)
31620 VARNAME$(VLEN+1,VLEN+1)=CHR$(0)
31622 REM ... MAKE VNTP & VNTD
31624 REM ... POINT TO VNAME$
31626 VNADR=ADR(VARNAME$)
31628 HIBYTE=INT(VNADR/256)
31630 LOWBYTE=VNADR-256*HIBYTE
31632 REM ... POKE HIBYTE & LOWBYTE
31634 REM ... INTO VNTP
31636 POKE 130,LOWBYTE:POKE 131,HIBYTE
31638 VNEND=VNADR+LEN(VARNAME$)
31640 HIBYTE=INT(VNEND/256)
31642 LOWBYTE=VNEND-256*HIBYTE
31644 REM ... POKE HIBYTE & LOWBYTE
31646 REM ... INTO VNTD
31648 POKE 132,LOWBYTE:POKE 133,HIBYTE
31650 REM 
31652 ? "}":POSITION 2,2
31654 ? "INPUT THE NAME OF THE DISK FILE"
31656 ? "THAT YOU WANT TO USE FOR THE MODIFIED"
31658 ? "PROGRAM.  '.LST' WILL BE ADDED FOR YOU"
31660 ? "    EXAMPLE:  D:FILENAME":? 
31662 NAME$=""
31664 INPUT NAME$
31666 IF LEN(NAME$)=0 THEN 31652
31668 IF NAME$(2,2)=":" AND LEN(NAME$)<11 THEN 31678
31670 IF NAME$(3,3)=":" AND LEN(NAME$)<12 THEN 31678
31672 ? :? "THE NAME YOU CHOSE IS TOO LONG"
31674 ? "PLEASE INPUT A SHORTER NAME"
31676 GOTO 31660
31678 NAME$(LEN(NAME$)+1)=".LST"
31680 LIST NAME$,1,31499
31682 GRAPHICS 0:POSITION 2,4
31684 ? "ENTER ";CHR$(34);NAME$;CHR$(34)
31686 POSITION 2,1
31688 ? "�����Ӡ�����Π"
31690 NEW 
31692 END 
31694 REM ... ERROR TRAP ROUTINE
31696 REM ... RESTORE OLD POINTERS
31698 ? :? "���Ġ���Ӡ�������Ġ"
31700 POKE 130,VNT
31702 POKE 131,VNT1
31704 POKE 132,VNT2
31706 POKE 133,VNT3
31708 END 

Back to previous page