From: Svjatoslav Agejenko Date: Tue, 15 Oct 2024 20:03:55 +0000 (+0300) Subject: Refactoring code for better readability X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=5b4d9641f51436395c088ae54b3c9e7666045a2f;p=qbasicapps.git Refactoring code for better readability --- diff --git a/Database/ddbase6.bas b/Database/ddbase6.bas index d02c987..763497b 100755 --- a/Database/ddbase6.bas +++ b/Database/ddbase6.bas @@ -26,7 +26,7 @@ DECLARE SUB conn (a$) DECLARE SUB ch () DECLARE SUB chkey (a$) DECLARE SUB getkey (a$) -DECLARE SUB conm (a$, c) +DECLARE SUB conm (d$, c) DECLARE SUB start () DIM SHARED con$(1 TO 50) @@ -90,11 +90,13 @@ ly = ly + lyp IF ly < 20 THEN lyp = 1 IF ly > 180 THEN lyp = -1 IF lx < 30 THEN -lxp = 1 -IF ly < y1 - 35 OR ly > y1 + 35 THEN SOUND 1000, 1 + lxp = 1 + IF ly < y1 - 35 OR ly > y1 + 35 THEN SOUND 1000, 1 +END IF +IF lx > 290 THEN + lxp = -1 + GOSUB 18 END IF -IF lx > 290 THEN lxp = -1: GOSUB 18 - IF yp1 > 0 THEN y1 = y1 + 1: yp1 = yp1 - 1 IF yp1 < 0 THEN y1 = y1 - 1: yp1 = yp1 + 1 @@ -103,13 +105,13 @@ IF yp2 < 0 THEN y2 = y2 - 1: yp2 = yp2 + 1 SOUND 0, .1 GOTO 16 + 18 tlx = lx tly = ly tlyp = lyp tlxp = lxp - 19 lx = lx + lxp ly = ly + lyp @@ -117,9 +119,9 @@ IF ly < 20 THEN lyp = 1 IF ly > 180 THEN lyp = -1 IF lx < 30 THEN lxp = 1 IF lx > 290 THEN -yp2 = ly - y2 + yp2 = ly - y2 ELSE -GOTO 19 + GOTO 19 END IF SWAP lx, tlx @@ -138,8 +140,8 @@ SUB box (x1, y1, x2, y2) b$ = "" c$ = "" FOR a = x1 TO x2 -b$ = b$ + " " -c$ = c$ + "-" + b$ = b$ + " " + c$ = c$ + "-" NEXT a b$ = "|" + b$ + "|" @@ -151,11 +153,10 @@ PRINT c$ LOCATE y2, x1 PRINT c$ FOR a = y1 + 1 TO y2 - 1 -LOCATE a, y1 -PRINT b$ + LOCATE a, y1 + PRINT b$ NEXT a - END SUB SUB ch @@ -167,13 +168,12 @@ END SUB SUB chkey (a$) a$ = INKEY$ IF a$ <> "" THEN -IF a$ = CHR$(0) + "M" THEN a$ = "pa" -IF a$ = CHR$(0) + "K" THEN a$ = "va" -IF a$ = CHR$(0) + "H" THEN a$ = "ul" -IF a$ = CHR$(0) + "P" THEN a$ = "al" - - + IF a$ = CHR$(0) + "M" THEN a$ = "pa" + IF a$ = CHR$(0) + "K" THEN a$ = "va" + IF a$ = CHR$(0) + "H" THEN a$ = "ul" + IF a$ = CHR$(0) + "P" THEN a$ = "al" END IF + END SUB SUB cmd (a$) @@ -185,34 +185,34 @@ IF mitus = 0 THEN GOTO 5 SELECT CASE sona$(1) CASE "help" -title "help" -conm "help - for help", 7 -conm "quit - quit program", 7 -conm "b - boss screen", 7 -conm "memstat- show info about memory blocks", 7 -conm "memput - put data to specified memoy block", 7 -conm "memlist - show memory blocks, starting from ", 7 -conm "runf - run script file", 7 -conm "lnstat - show info about memory lines", 7 -conm "lnput ... put data in starting from ", 7 -conm "lnlist - show contenc of memory lines", 7 -conm "fstat - show info about memory files", 7 -conm "fput ... put data in memory file", 7 -conm "fload - load data file into memory file", 7 -conm "cls - clear screen", 7 -conm "stclear - clear stack", 7 -conm "chklin - determine used line numbers to STDOUT", 7 -conm "stacksize - determine stack size to STDOUT", 7 -conm "filtand ... filters out lines to STDOUT", 7 -conm "filtor ... filters out lines to STDOUT", 7 -conm "disp ... display formatted selected cells to STDOUT", 7 -conm "sort - sort elements by value, lower first", 7 -conm "swap - swap stack elements (backwards)", 7 -conm "ssort - sort stack in alphabetical order", 7 -conm "memget - allocates memory block, and puts there -", 7 -conm "liststack - show stack values to STDOUT", 7 -conm "ask - asks question, and stores result", 7 -conm "flnget - get unused line in file", 7 + title "help" + conm "help - for help", 7 + conm "quit - quit program", 7 + conm "b - boss screen", 7 + conm "memstat- show info about memory blocks", 7 + conm "memput - put data to specified memory block", 7 + conm "memlist - show memory blocks, starting from ", 7 + conm "runf - run script file", 7 + conm "lnstat - show info about memory lines", 7 + conm "lnput ... put data in starting from ", 7 + conm "lnlist - show contenc of memory lines", 7 + conm "fstat - show info about memory files", 7 + conm "fput ... put data in memory file", 7 + conm "fload - load data file into memory file", 7 + conm "cls - clear screen", 7 + conm "stclear - clear stack", 7 + conm "chklin - determine used line numbers to STDOUT", 7 + conm "stacksize - determine stack size to STDOUT", 7 + conm "filtand ... filters out lines to STDOUT", 7 + conm "filtor ... filters out lines to STDOUT", 7 + conm "disp ... display formatted selected cells to STDOUT", 7 + conm "sort - sort elements by value, lower first", 7 + conm "swap - swap stack elements (backwards)", 7 + conm "ssort - sort stack in alphabetical order", 7 + conm "memget - allocates memory block, and puts there -", 7 + conm "liststack - show stack values to STDOUT", 7 + conm "ask - asks question, and stores result", 7 + conm "flnget - get unused line in file", 7 GOTO 5 CASE "quit" @@ -223,8 +223,8 @@ title "memory blocks summary" c = 0 lng = 0 FOR b = 1 TO 5000 -IF bufu(b) > 0 THEN c = c + 1 -lng = lng + LEN(buf$(b)) + IF bufu(b) > 0 THEN c = c + 1 + lng = lng + LEN(buf$(b)) NEXT b d$ = "memory blocks used:" + STR$(c) + " total 5000" conm d$, 7 @@ -236,11 +236,11 @@ CASE "memput" b = VAL(sona$(2)) strip sona$(3), c$ IF c$ = "" THEN -bufu(b) = 0 -buf$(b) = "" + bufu(b) = 0 + buf$(b) = "" ELSE -bufu(b) = 1 -buf$(b) = sona$(3) + bufu(b) = 1 + buf$(b) = sona$(3) END IF GOTO 5 @@ -251,13 +251,13 @@ IF b = 0 THEN b = 1 IF c = 0 THEN c = 1 FOR d = b TO 5000 -IF c = 0 THEN GOTO 5 -IF bufu(d) > 0 THEN -e$ = cnum(d) + ":" + SPACE$(5 - LEN(cnum(d))) -e$ = e$ + buf$(d) -conm e$, 7 -c = c - 1 -END IF + IF c = 0 THEN GOTO 5 + IF bufu(d) > 0 THEN + e$ = cnum(d) + ":" + SPACE$(5 - LEN(cnum(d))) + e$ = e$ + buf$(d) + conm e$, 7 + c = c - 1 + END IF NEXT d GOTO 5 @@ -270,7 +270,7 @@ title "memory lines summary" c = 0 d = 0 FOR b = 1 TO 1000 -IF buflu(b) > 0 THEN c = c + 1: d = d + buflu(b) + IF buflu(b) > 0 THEN c = c + 1: d = d + buflu(b) NEXT b d$ = "memory lines used:" + STR$(c) + " total 1000" conm d$, 7 @@ -284,7 +284,7 @@ c = VAL(sona$(3)) e = mitus IF e < 4 THEN e = 4 FOR d = 4 TO e -puts b, c + d - 4, sona$(d) + puts b, c + d - 4, sona$(d) NEXT d GOTO 5 @@ -293,38 +293,38 @@ b = VAL(sona$(2)) c = VAL(sona$(3)) FOR d = b TO 1000 -IF c = 0 THEN GOTO 5 -IF buflu(d) > 0 THEN -e$ = cnum(d) + ":" -e$ = e$ + SPACE$(5 - LEN(e$)) -e$ = e$ + cnum(buflu(d)) -e$ = e$ + SPACE$(8 - LEN(e$)) - -FOR g = 1 TO 10 -gets d, g, f$ -e$ = e$ + " >" + f$ -NEXT g -conm e$, 7 -c = c - 1 -END IF + IF c = 0 THEN GOTO 5 + IF buflu(d) > 0 THEN + e$ = cnum(d) + ":" + e$ = e$ + SPACE$(5 - LEN(e$)) + e$ = e$ + cnum(buflu(d)) + e$ = e$ + SPACE$(8 - LEN(e$)) + + FOR g = 1 TO 10 + gets d, g, f$ + e$ = e$ + " >" + f$ + NEXT g + conm e$, 7 + c = c - 1 + END IF NEXT d GOTO 5 CASE "fstat" title "Memory files summary" FOR b = 1 TO 30 - e = 0 - FOR c = 1 TO 1000 - IF buff(b, c) > -1 THEN - IF e = 0 THEN - d$ = "File number:" + STR$(b) - conm d$, 7 - e = e + 1 - END IF - d$ = "on line:" + STR$(c) + " allocated memory line: " + STR$(buff(b, c)) - conm d$, 7 - END IF - NEXT c + e = 0 + FOR c = 1 TO 1000 + IF buff(b, c) > -1 THEN + IF e = 0 THEN + d$ = "File number:" + STR$(b) + conm d$, 7 + e = e + 1 + END IF + d$ = "on line:" + STR$(c) + " allocated memory line: " + STR$(buff(b, c)) + conm d$, 7 + END IF + NEXT c NEXT b GOTO 5 @@ -335,13 +335,13 @@ d = VAL(sona$(4)) f = mitus IF f < 5 THEN f = 5 FOR e = 5 TO f -putfs b, c, d + e - 5, sona$(e) + putfs b, c, d + e - 5, sona$(e) NEXT e GOTO 5 CASE "cls" FOR b = 1 TO 50 -conm " ", 7 + conm " ", 7 NEXT b GOTO 5 @@ -370,7 +370,7 @@ IF c = 0 THEN c = 1 IF d = 0 THEN d = 1000 FOR e = c TO d -IF buff(b, e) > 0 THEN std cnum(buff(b, e)) + IF buff(b, e) > 0 THEN std cnum(buff(b, e)) NEXT e GOTO 5 @@ -388,14 +388,14 @@ GOTO 5 CASE "filtor" b = VAL(sona$(2)) FOR e = 1 TO stackl(b) -FOR c = 3 TO mitus STEP 2 -gets stack(e, b), VAL(sona$(c)), f$ -cmp f$, sona$(c + 1), d -IF d = 1 THEN -std cnum(stack(e, b)) -GOTO 20 -END IF -NEXT c + FOR c = 3 TO mitus STEP 2 + gets stack(e, b), VAL(sona$(c)), f$ + cmp f$, sona$(c + 1), d + IF d = 1 THEN + std cnum(stack(e, b)) + GOTO 20 + END IF + NEXT c 20 NEXT e GOTO 5 @@ -406,30 +406,30 @@ DIM tmp1(1 TO 100) DIM tmp2(1 TO 100) FOR d = 1 TO 100 -tmp2(d) = 0 + tmp2(d) = 0 NEXT d d = 0 FOR e = 3 TO mitus -d = d + 1 -tmp1(d) = VAL(sona$(e)) + d = d + 1 + tmp1(d) = VAL(sona$(e)) NEXT e FOR c = 1 TO stackl(b) -FOR e = 1 TO d -gets stack(c, b), tmp1(e), f$ -IF tmp2(e) < LEN(f$) THEN tmp2(e) = LEN(f$) -NEXT e + FOR e = 1 TO d + gets stack(c, b), tmp1(e), f$ + IF tmp2(e) < LEN(f$) THEN tmp2(e) = LEN(f$) + NEXT e NEXT c FOR c = 1 TO stackl(b) -g$ = "" -FOR e = 1 TO d -gets stack(c, b), tmp1(e), f$ -f$ = f$ + SPACE$(tmp2(e) - LEN(f$)) -g$ = g$ + f$ + " # " -NEXT e -conm g$, 10 + g$ = "" + FOR e = 1 TO d + gets stack(c, b), tmp1(e), f$ + f$ = f$ + SPACE$(tmp2(e) - LEN(f$)) + g$ = g$ + f$ + " # " + NEXT e + conm g$, 10 NEXT c ERASE tmp2 @@ -439,12 +439,12 @@ GOTO 5 CASE "filtand" b = VAL(sona$(2)) FOR e = 1 TO stackl(b) -FOR c = 3 TO mitus STEP 2 -gets stack(e, b), VAL(sona$(c)), f$ -cmp f$, sona$(c + 1), d -IF d = 0 THEN GOTO 21 -NEXT c -std cnum(stack(e, b)) + FOR c = 3 TO mitus STEP 2 + gets stack(e, b), VAL(sona$(c)), f$ + cmp f$, sona$(c + 1), d + IF d = 0 THEN GOTO 21 + NEXT c + std cnum(stack(e, b)) 21 NEXT e GOTO 5 @@ -459,7 +459,7 @@ CASE "swap" b = VAL(sona$(2)) c = stackl(b) FOR d = 1 TO c / 2 -SWAP stack(d, b), stack(c - d + 1, b) + SWAP stack(d, b), stack(c - d + 1, b) NEXT d GOTO 5 @@ -489,7 +489,7 @@ IF b = 0 THEN b = 1 IF c = 0 THEN c = 1 IF d = 0 THEN d = stackl(b) FOR e = c TO d -std cnum(stack(e, b)) + std cnum(stack(e, b)) NEXT e GOTO 5 @@ -512,25 +512,23 @@ CASE "flnget" b = VAL(sona$(2)) c = VAL(sona$(3)) FOR d = 1 TO 1000 -IF buff(b, d) = -1 THEN -stack(c, 10) = d -IF stackl(10) < c THEN stackl(10) = c -GOTO 24 -END IF + IF buff(b, d) = -1 THEN + stack(c, 10) = d + IF stackl(10) < c THEN stackl(10) = c + GOTO 24 + END IF NEXT d 24 GOTO 5 END SELECT - - conm "Invalid command", 12 5 END SUB -SUB cmp (a$, b$, r) -IF a$ = b$ THEN r = 1 ELSE r = 0 +SUB cmp (a$, b$, r%) +IF a$ = b$ THEN r% = 1 ELSE r% = 0 END SUB FUNCTION cnum$ (a) @@ -545,45 +543,42 @@ b$ = LEFT$(b$, 80) IF a$ = "va" THEN conx = conx - 1 IF a$ = "pa" THEN conx = conx + 1 IF a$ = "ul" THEN -b$ = hist$(histk) -histk = histk - 1 -IF histk < 1 THEN histk = 20 + b$ = hist$(histk) + histk = histk - 1 + IF histk < 1 THEN histk = 20 END IF IF a$ = "al" THEN -b$ = hist$(histk) -histk = histk + 1 -IF histk > 20 THEN histk = 1 + b$ = hist$(histk) + histk = histk + 1 + IF histk > 20 THEN histk = 1 END IF - - IF LEN(a$) = 1 THEN -IF a$ = CHR$(13) THEN -strip b$, c$ -histp = histp + 1 -IF histp > 20 THEN histp = 1 -histk = histp -hist$(histp) = c$ -cmd c$ -b$ = "" -conx = 1 -GOTO 4 -END IF + IF a$ = CHR$(13) THEN + strip b$, c$ + histp = histp + 1 + IF histp > 20 THEN histp = 1 + histk = histp + hist$(histp) = c$ + cmd c$ + b$ = "" + conx = 1 + GOTO 4 + END IF -IF a$ = CHR$(8) THEN -IF conx > 1 THEN -b$ = LEFT$(b$, conx - 2) + RIGHT$(b$, 81 - conx) -conx = conx - 1 -END IF -GOTO 4 -END IF + IF a$ = CHR$(8) THEN + IF conx > 1 THEN + b$ = LEFT$(b$, conx - 2) + RIGHT$(b$, 81 - conx) + conx = conx - 1 + END IF + GOTO 4 + END IF -b$ = LEFT$(b$, conx - 1) + a$ + RIGHT$(b$, 81 - conx) -conx = conx + 1 + b$ = LEFT$(b$, conx - 1) + a$ + RIGHT$(b$, 81 - conx) + conx = conx + 1 END IF 4 - IF conx < 1 THEN conx = 1 IF conx > 80 THEN conx = 80 @@ -604,26 +599,25 @@ a$ = d$ 14 IF LEN(a$) > 78 THEN -b$ = LEFT$(a$, 78) -conm b$, c -a$ = " >> " + RIGHT$(a$, LEN(a$) - 78) -GOTO 14 + b$ = LEFT$(a$, 78) + conm b$, c + a$ = " >> " + RIGHT$(a$, LEN(a$) - 78) + GOTO 14 END IF - b$ = a$ + SPACE$(80 - LEN(a$)) con$(50) = b$ conc(50) = c FOR a = 1 TO 49 -con$(a) = con$(a + 1) -conc(a) = conc(a + 1) + con$(a) = con$(a + 1) + conc(a) = conc(a + 1) NEXT a FOR a = 1 TO 49 -LOCATE a, 1 -COLOR conc(a), 0 -PRINT con$(a) + LOCATE a, 1 + COLOR conc(a), 0 + PRINT con$(a) NEXT a END SUB @@ -640,8 +634,8 @@ IF EOF(h) <> 0 THEN GOTO 13 LINE INPUT #h, e$ IF LEFT$(e$, 3) = "// " THEN -conm e$, 10 -GOTO 12 + conm e$, 10 + GOTO 12 END IF IF e$ = SPACE$(LEN(e$)) THEN GOTO 12 @@ -650,15 +644,15 @@ l = l + 1 h$ = "" i = d FOR f = 1 TO LEN(e$) -g$ = RIGHT$(LEFT$(e$, f), 1) -IF g$ = "|" THEN - putfs b, j, i, h$ - h$ = "" - g$ = "" - i = i + 1 -END IF -IF g$ = CHR$(9) THEN g$ = "" -h$ = h$ + g$ + g$ = RIGHT$(LEFT$(e$, f), 1) + IF g$ = "|" THEN + putfs b, j, i, h$ + h$ = "" + g$ = "" + i = i + 1 + END IF + IF g$ = CHR$(9) THEN g$ = "" + h$ = h$ + g$ NEXT f j = j + 1 @@ -666,7 +660,6 @@ GOTO 12 13 CLOSE #h - opf(h) = 0 k$ = "file: " + a$ + " loaded." + STR$(l) + " lines in file" @@ -675,7 +668,11 @@ END SUB SUB getfil (a) FOR b = 1 TO 30 -IF opf(b) = 0 THEN opf(b) = 1: a = b: GOTO 7 + IF opf(b) = 0 THEN + opf(b) = 1 + a = b + GOTO 7 + END IF NEXT b 7 END SUB @@ -685,10 +682,11 @@ SUB gets (l, s, a$) b = bufl(l, s) IF b = -1 THEN -a$ = "" + a$ = "" ELSE -a$ = buf$(b) + a$ = buf$(b) END IF + END SUB SUB mkson (a$) @@ -697,17 +695,17 @@ mitus = 0 d = 1 FOR b = 1 TO LEN(a$) -c$ = RIGHT$(LEFT$(a$, b), 1) -IF c$ = " " THEN -d = 1 -ELSE -IF d = 1 THEN -mitus = mitus + 1 -sona$(mitus) = "" -d = 0 -END IF -sona$(mitus) = sona$(mitus) + c$ -END IF + c$ = RIGHT$(LEFT$(a$, b), 1) + IF c$ = " " THEN + d = 1 + ELSE + IF d = 1 THEN + mitus = mitus + 1 + sona$(mitus) = "" + d = 0 + END IF + sona$(mitus) = sona$(mitus) + c$ + END IF NEXT b 'conm "sonad_______", 10 @@ -716,21 +714,22 @@ NEXT b 'NEXT b FOR a = 1 TO mitus -IF LEFT$(sona$(a), 2) = "|>" THEN -IF sona$(a + 1) = "c" THEN stdl = 1 -IF sona$(a + 1) = "s" THEN stdl = 10 + VAL(sona$(a + 2)) -mitus = a - 1 -GOTO 15 -END IF -IF LEFT$(sona$(a), 2) = "|@" THEN -sona$(a) = cnum(stack(VAL(RIGHT$(sona$(a), LEN(sona$(a)) - 2)), 10)) -END IF + IF LEFT$(sona$(a), 2) = "|>" THEN + IF sona$(a + 1) = "c" THEN stdl = 1 + IF sona$(a + 1) = "s" THEN stdl = 10 + VAL(sona$(a + 2)) + mitus = a - 1 + GOTO 15 + END IF + IF LEFT$(sona$(a), 2) = "|@" THEN + sona$(a) = cnum(stack(VAL(RIGHT$(sona$(a), LEN(sona$(a)) - 2)), 10)) + END IF NEXT a 15 FOR a = mitus + 1 TO 20 -sona$(a) = "" + sona$(a) = "" NEXT a + END SUB SUB putfs (f, l, s, c$) @@ -740,14 +739,21 @@ SUB putfs (f, l, s, c$) la = buff(f, l) IF la = -1 THEN -FOR a = 1 TO 1000 -IF buflu(a) = 0 THEN la = a: GOTO 10 -NEXT a + FOR a = 1 TO 1000 + IF buflu(a) = 0 THEN + la = a + GOTO 10 + END IF + NEXT a 10 END IF puts la, s, c$ -IF buflu(la) = 0 THEN buff(f, l) = -1 ELSE buff(f, l) = la +IF buflu(la) = 0 THEN + buff(f, l) = -1 +ELSE + buff(f, l) = la +END IF END SUB SUB puts (l, s, a$) @@ -758,29 +764,30 @@ IF a$ = "||" THEN GOTO 11 b = bufl(l, s) IF b = -1 THEN -'DIM SHARED buf$(1 TO 10000) -'DIM SHARED bufu(1 TO 10000) -FOR c = 1 TO 10000 -IF bufu(c) = 0 THEN GOTO 6 -NEXT c + FOR c = 1 TO 10000 + IF bufu(c) = 0 THEN + GOTO 6 + END IF + NEXT c 6 -b = c -bufu(b) = 1 -buflu(l) = buflu(l) + 1 + b = c + bufu(b) = 1 + buflu(l) = buflu(l) + 1 END IF strip a$, c$ IF c$ = "" THEN -bufu(b) = 0 -buf$(b) = "" -bufl(l, s) = -1 -buflu(l) = buflu(l) - 1 + bufu(b) = 0 + buf$(b) = "" + bufl(l, s) = -1 + buflu(l) = buflu(l) - 1 ELSE -buf$(b) = c$ -bufl(l, s) = b + buf$(b) = c$ + bufl(l, s) = b END IF 11 + END SUB SUB runf (a$) @@ -796,6 +803,7 @@ GOTO 9 CLOSE #h opf(h) = 0 + END SUB SUB sort (s, w) @@ -805,26 +813,28 @@ DIM tmp2(1 TO 10000) b = stackl(s) FOR a = 1 TO b -gets stack(a, s), w, c$ -tmp1(a) = VAL(c$) -tmp2(a) = a + gets stack(a, s), w, c$ + tmp1(a) = VAL(c$) + tmp2(a) = a NEXT a d = 1 FOR a = 1 TO b -e = 32000 - -FOR c = d TO b -IF tmp1(c) < e THEN e = tmp1(c): f = c -NEXT c - -SWAP tmp1(a), tmp1(f) -SWAP tmp2(a), tmp2(f) -d = d + 1 + e = 32000 + + FOR c = d TO b + IF tmp1(c) < e THEN + e = tmp1(c) + f = c + END IF + NEXT c + SWAP tmp1(a), tmp1(f) + SWAP tmp2(a), tmp2(f) + d = d + 1 NEXT a FOR a = 1 TO b -stack(a, s) = tmp2(a) + stack(a, s) = tmp2(a) NEXT a END SUB @@ -835,9 +845,9 @@ DIM tbtp(1 TO 2000) DIM tbt$(1 TO 2000) FOR a = 1 TO stackl(s) -gets stack(a, s), m, b$ -tbt$(a) = b$ -tbtp(a) = a + gets stack(a, s), m, b$ + tbt$(a) = b$ + tbtp(a) = a NEXT a b = stackl(s) @@ -864,17 +874,18 @@ IF ASC(LEFT$(tbt$(c), 1)) < f THEN f = ASC(LEFT$(tbt$(c), 1)): e = c: d$ = tbt$( 22 NEXT c -tbti(a) = tbtp(e) -tbt$(e) = tbt$(b) -tbtp(e) = tbtp(b) -b = b - 1 + tbti(a) = tbtp(e) + tbt$(e) = tbt$(b) + tbtp(e) = tbtp(b) + b = b - 1 NEXT a FOR a = 1 TO stackl(s) -stack(a, s) = tbti(a) + stack(a, s) = tbti(a) NEXT a conm "done", 7 + END SUB SUB start @@ -890,31 +901,30 @@ conm "DDBASE, (Dos Data BASE) 0.0", 7 conm "Copyright Svjatoslav Agejenko. All Rights Reserved.", 7 conm "starting...", 7 FOR a = 1 TO 5000 -bufu(a) = 0 -buf$(a) = "" + bufu(a) = 0 + buf$(a) = "" NEXT a FOR a = 1 TO 30 -FOR b = 1 TO 1000 -bufl(b, a) = -1 -buff(a, b) = -1 -NEXT b -opf(a) = 0 + FOR b = 1 TO 1000 + bufl(b, a) = -1 + buff(a, b) = -1 + NEXT b + opf(a) = 0 NEXT a FOR a = 1 TO 1000 -buflu(a) = 0 + buflu(a) = 0 NEXT a FOR a = 1 TO 10 -stackl(a) = 0 + stackl(a) = 0 NEXT a - a$ = "runf auto.scr" FOR b = 1 TO LEN(a$) -c$ = RIGHT$(LEFT$(a$, b), 1) -conkey c$ + c$ = RIGHT$(LEFT$(a$, b), 1) + conkey c$ NEXT b conkey CHR$(13) @@ -925,32 +935,35 @@ SUB std (a$) SELECT CASE stdl CASE 1 -conm a$, 10 + conm a$, 10 CASE 11 TO 20 -b = stdl - 10 -stackl(b) = stackl(b) + 1 -stack(stackl(b), b) = VAL(a$) + b = stdl - 10 + stackl(b) = stackl(b) + 1 + stack(stackl(b), b) = VAL(a$) -c$ = a$ + " > " + cnum(stackl(b)) + " ! " + cnum(b) + c$ = a$ + " > " + cnum(stackl(b)) + " ! " + cnum(b) END SELECT - - - END SUB SUB strip (a$, b$) b$ = a$ 2 -IF LEFT$(b$, 1) = " " THEN b$ = RIGHT$(b$, LEN(b$) - 1): GOTO 2 +IF LEFT$(b$, 1) = " " THEN + b$ = RIGHT$(b$, LEN(b$) - 1) + GOTO 2 +END IF 3 -IF RIGHT$(b$, 1) = " " THEN b$ = LEFT$(b$, LEN(b$) - 1): GOTO 3 +IF RIGHT$(b$, 1) = " " THEN + b$ = LEFT$(b$, LEN(b$) - 1) + GOTO 3 +END IF + END SUB SUB title (a$) conm " ", 10 conm "================> " + a$ + " <===============", 7 - - END SUB +