12-30-2021, 07:24 AM
Program: STORE
Checksum: # F2D8h
Size: 283 bytes
Purpose: Store a CSV file to a list after removing the line feed characters. The CSV file is a string.
Problem: The DO loop terminates when no more line feed characters are present in a substring. At this point position would be equal to zero. As expected, the last substring is not removed. I tried an IFTE structure to deal with this, however the program does not execute the false statement. The false statement was supposed to remove the last substring starting after the last line feed character.
On the Emu48: Edit → Load Object... → C:\File → All Files(*.*)
→ Choose file to open → Store the object in FILE → Execute STORE
FILE
"248,1529945.480,521921.773■
249,1530002.951,521922.245■
251,1530058.926,521921.687■
252,1530114.903,521923.001■
254,1530221.977,521924.059"
PNTS
{ }
STORE
<< FILE DUP SIZE 10
CHR 1 1 { } → file
size char start
position points
<<
DO file start
size SUB DUP char
POS DUP ROT 1 ROT
SUB points SWAP +
'points' STO DUP
'start' STO+
'position' STO
UNTIL position
0 ==
END points
'PNTS' STO
>>
>>
@ file - a CSV file stored in FILE
@ size - the SIZE of the CSV file
@ char - the line feed character, character 10
@ start - the start of the next substring after position
@ position - the position of a line feed character in file
@ points - a list of substrings
Any help with this program would be greatly appreciated!
Checksum: # F2D8h
Size: 283 bytes
Purpose: Store a CSV file to a list after removing the line feed characters. The CSV file is a string.
Problem: The DO loop terminates when no more line feed characters are present in a substring. At this point position would be equal to zero. As expected, the last substring is not removed. I tried an IFTE structure to deal with this, however the program does not execute the false statement. The false statement was supposed to remove the last substring starting after the last line feed character.
On the Emu48: Edit → Load Object... → C:\File → All Files(*.*)
→ Choose file to open → Store the object in FILE → Execute STORE
FILE
"248,1529945.480,521921.773■
249,1530002.951,521922.245■
251,1530058.926,521921.687■
252,1530114.903,521923.001■
254,1530221.977,521924.059"
PNTS
{ }
STORE
<< FILE DUP SIZE 10
CHR 1 1 { } → file
size char start
position points
<<
DO file start
size SUB DUP char
POS DUP ROT 1 ROT
SUB points SWAP +
'points' STO DUP
'start' STO+
'position' STO
UNTIL position
0 ==
END points
'PNTS' STO
>>
>>
@ file - a CSV file stored in FILE
@ size - the SIZE of the CSV file
@ char - the line feed character, character 10
@ start - the start of the next substring after position
@ position - the position of a line feed character in file
@ points - a list of substrings
Any help with this program would be greatly appreciated!