- Aug
- 2,828
- 147
If it would not be a nightmare to modify the TCC source code,
I would like to suggest adding the ability to define the default lower bound for arrays and commands/functions,
to either 0 or 1,
for example,
in the @LINES function;
For arrays;
...and all of the other TCC functions and such that have the base 0.
The FileUtils plugin has the LINES command,
which returns;
In this case,
I prefer 49 to be the number that I use for the lines in the file,
not 48.
While most modern programming languages default to zero-based indexing,
having the ability to change the Option Base would allow TCC users to shift this starting point.
Maybe create a new command called OptionBase,
that would accept either 0 or 1 to determine whether elements begin at either 0 or 1.
FileUtils Plugin: FileUtils Plugin
Joe
I would like to suggest adding the ability to define the default lower bound for arrays and commands/functions,
to either 0 or 1,
for example,
in the @LINES function;
The first line in the file is numbered 0,
so (for example) @LINES will return 0 for a file containing one line.
To get the actual number of lines,
use %@INC[%@LINES[filename]].
For arrays;
You can define up to 4-dimensional arrays. For example, to define a 5-row by 10-column array:
setarray array1[5,10]
The array elements are addressed in base 0,
so to reference this array you would use 0-4 for the rows and 0-9 for the columns.
...and all of the other TCC functions and such that have the base 0.
The FileUtils plugin has the LINES command,
which returns;
Code:
R:\>lines zoom150.btm
File “R:\zoom150.btm” :
Total lines: 49 Blank : 4 Not blank: 45
Comments : 9
R:\>echo %@lines[zoom150.btm]
48
In this case,
I prefer 49 to be the number that I use for the lines in the file,
not 48.
While most modern programming languages default to zero-based indexing,
having the ability to change the Option Base would allow TCC users to shift this starting point.
Maybe create a new command called OptionBase,
that would accept either 0 or 1 to determine whether elements begin at either 0 or 1.
FileUtils Plugin: FileUtils Plugin
Joe