Next: , Previous: , Up: Top   [Contents][Index]

8 Internal functioning of m0

8.1 Introduction

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: , Up: Internal functioning of m0   [Contents][Index]

8.2 The execution loop

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: , Up: Internal functioning of m0   [Contents][Index]

8.3 The execution of a macro

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:

This overview might seem a bit confusing because of its recursive nature of calling macros, but it will just execute:

The function calls are explained in Builtin functions and the programming and instructions are explained in Programs for patterns and macros.


Previous: , Up: Internal functioning of m0   [Contents][Index]