Hi guys,
would it be possible to integrate textual substitutions ?
For example something like :
#define switch_1_closed as testbit(portc,4)=0
This would make the program easier to read and write
So the program would read
if switch_1_closed then ...
instead of testbit(portc,4)=1
Offcourse this can be done by using a function, but this is lesser code
and therefor faster
Even trickier:
When bit 4 in the example above is a variable or constant i:
#define switch_1_closed as testbit(portc,{bitno})=0
var bitno : byte;
...
bitno:=4;
then
if testbit(portc,bitno)=1
could be replaced by
if switch_1_closed
This is very handy when using arrays etc.
Textual substitions
Re: Textual substitions
What you are asking for is a simple macro support. In mikroC, you have preprocessor at your disposal for this kind of text replacement. In mikroBasic, you can use symbol for this task.Frank Kloprogge wrote:would it be possible to integrate textual substitutions ?
At present, we have no plans of including symbols in mikroPascal, but it could be done eventually.
-
Add support for symbols in mikroPascal
It would be very helpful to allow symbols particularly for port addresses. With the 40 pin PICs, and several projects underway at a time, keeping track of which port and pin is the "green led" on each project can be time consuming. It would also be useful when deciphering longer listings developed several months earlier. Even when a program is well documented, it takes a while to locate the line that describes porte pin 2. The "textual substitution" (simple macro support) that Frank proposed should be even more powerful.