Browse Source

Fix LSET & RSET so they fill the field

Write test program "lrset.bas" to verify the operation of LSET & RSET
tags/v3.20f
Jon Foster 2 years ago
parent
commit
1db6c116e5
2 changed files with 28 additions and 0 deletions
  1. +26
    -0
      BAS-EXAMPLES/lrset.bas
  2. +2
    -0
      bwb_var.c

+ 26
- 0
BAS-EXAMPLES/lrset.bas View File

@@ -0,0 +1,26 @@
10 ' Test LSET & RSET - contributed by ChipMaster
20 OPEN "R", #1, "test.dat", 24
30 FIELD #1, 24 AS F1$
40 FOR X=1 TO 3
50 READ S$, M$
60 LSET F1$=S$
70 IF F1$<>M$ THEN PRINT "ERROR @ LSET '"; S$; "'" : GOTO 900
80 NEXT

100 FOR X=1 TO 3
110 READ S$, M$
120 RSET F1$=S$
130 IF F1$<>M$ THEN PRINT "ERROR @ LSET '"; S$; "'" : GOTO 900
140 NEXT
150 PRINT "pass"

900 CLOSE #1
910 END
1000 '*** TEST DATA ***
1010 DATA "THE RABBIT WENT LEFT", "THE RABBIT WENT LEFT "
1020 DATA "DOG", "DOG "
1030 DATA "", " "
1040 DATA "THE RABBIT WENT LEFT", " THE RABBIT WENT LEFT"
1050 DATA "DOG", " DOG"
1060 DATA "", " "

+ 2
- 0
bwb_var.c View File

@@ -5046,6 +5046,7 @@ dio_lrset (LineType * l, int rset)
PRINT "[";A$;"]" ' [123_789]
*/
startpos = variant.Length - T->Length;
for(n=0; n<startpos; n++) variant.Buffer[n]=' ';
}
/* write characters to new position */
for (n = startpos, i = 0;
@@ -5053,6 +5054,7 @@ dio_lrset (LineType * l, int rset)
{
variant.Buffer[n] = T->Buffer[i];
}
if(rset == FALSE) while(n<variant.Length) variant.Buffer[n++]=' ';
if (var_set (v, &variant) == FALSE)
{
WARN_VARIABLE_NOT_DECLARED;


Loading…
Cancel
Save