Next: Emulation examples, Previous: Programs for patterns and macros, Up: Top [Contents][Index]
m0| • The execution loop: | ||
| • The execution of a macro: |
In most cases the exact internal execution of the m0 program is not relevant.
However, in case of complicated macro systems or emulations it is necessary to
know how the detection and execution of the several stages are internally performed.
The source code is the ultimate guide, but in this part an overview is given for a quick understanding.
Next: The execution of a macro, Up: Internal functioning of m0 [Contents][Index]
The main execution loop that is performed is the loop of the bitap and possible macro execution at every input character. The bitap algorithm works per byte. There are thus no word boundaries that determine the execution loop.
The steps of the main execution loop consist of:
It can be seen that at a position multiple macros for execution can be detected. Therefore in Priority the execution priority of macros is explained. It can also be seen that a macro for execution can be detected while at the same time also programs of the pattern are executed. The priority setting in the pattern part determines if a program is then executed or not.
Previous: The execution loop, Up: Internal functioning of m0 [Contents][Index]
A macro will normally change the output by removal and insertion. What is removed and what is inserted is completely determined by the macro in its definition and settings.
In The complete working of macros already an overview of this proces is given. In this part only the steps involved when a macro is executed are explained. When a macro is executed the steps are:
mcall).
mcall:
mcall.
mcall
This overview might seem a bit confusing because of its recursive nature of calling macros, but it will just execute:
mcall to a normal macro.
mcall to an mcall to a normal macro.
mcall to an mcall to an mcall to a normal macro.
The function calls are explained in Builtin functions and the programming and instructions are explained in Programs for patterns and macros.
Previous: The execution loop, Up: Internal functioning of m0 [Contents][Index]