From 2f3562beb4bfe459b14188bad1fe340ba4363cac Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Tue, 18 Oct 2016 20:04:41 -0400 Subject: Nearly working code after adding support for directories to file sorting and textile processing. --- tsort.bas | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'tsort.bas') diff --git a/tsort.bas b/tsort.bas index 56d4567..78fe14f 100644 --- a/tsort.bas +++ b/tsort.bas @@ -1,23 +1,18 @@ -10 DIM FL$(2) -20 LC = 2 -30 FL$[1] = "test\20161006.txt" -40 FL$[2] = "test\20161005.txt" -50 GOSUB 16000 -60 FOR I = 1 TO LC -70 PRINT SFL$[I]; " - "; TIT$[I] -80 NEXT I -90 END 16000 REM =================================== 16001 REM File sort and title gen 16002 REM 16003 REM INPUT - FL$ list of files 16004 REM LC file count -16005 REM OUTPUT - SFL$ sorted list of files -16006 REM TIT$ titles of files -16007 REM =================================== -16010 DIM SFL$(LC), TIT$(LC) +16005 REM DIREC$ directory with files +16006 REM OUTPUT - SFL$ sorted list of files +16007 REM TIT$ titles of files +16008 REM =================================== +16010 IF C16000 = 1 THEN ERASE SFL$:ERASE TIT$ +16012 C16000 = 1 +16015 DIM SFL$(LC), TIT$(LC) 16020 FOR I = 1 TO LC -16030 OPEN FL$(I) FOR INPUT AS #10 +16025 IF INSTR(FL$,":") = 0 AND LEN(DIREC$) > 0 THEN FULLFILE$ = DIREC$+"\"+FL$(I) ELSE FULLFILE$ = FL$(I) +16030 OPEN FULLFILE$ FOR INPUT AS #10 16040 TIT$(I) = "****" 16050 WHILE(NOT EOF(10)) 16060 LINE INPUT#10, LTXT$ @@ -34,7 +29,9 @@ 16170 ILOWDOT=0:WHILE(MID$(SFL$(ILOW),ILOWDOT+1,1) <> "."):ILOWDOT = ILOWDOT+1:WEND 16180 IHIDOT=0:WHILE(MID$(SFL$(IHI),IHIDOT+1,1) <> "."):IHIDOT = IHIDOT+1:WEND +16184 IF INSTR(SFL$(ILOW), "\") = 0 THEN ILOWSL=1:GOTO 16189 16185 ILOWSL=ILOWDOT:WHILE(ILOWSL>1 AND MID$(SFL$(ILOW),ILOWSL-1,1) <> "\"):ILOWSL=ILOWSL-1:WEND +16189 IF INSTR(SFL$(IHI), "\") = 0 THEN IHISL = 1:GOTO 16195 16190 IHISL=IHIDOT:WHILE(IHISL>1 AND MID$(SFL$(IHI),IHISL-1,1) <> "\"):IHISL=IHISL-1:WEND 16195 VLOW = VAL(MID$(SFL$(ILOW), ILOWSL, ILOWDOT-ILOWSL+1)) -- cgit v1.2.3