9.6. Execution Model

In this section we present in a chronological way the main tasks that occur when a sketch is compiled and executed:

Table 9-1. Execution model

Compilation Environment The user writes the sketch and clicks on the Build and Run button
Parsing The size primitive is located in the sketch code and once the sketch size is known it is transferred to the Kernel and the Canvas module setting the user control and the form dimensions according to the sketch size. Also the html used for exporting the sketch to web is modified for setting the sketch size.
Some modifications are made to the sketch code before compiling it:
  • In those pair primitives that have the same name but with different behavior (one as variable and one as function), one of them is changed because as this is permitted in syntaxes like Java it is not permitted in others like C#. Examples of this are framerate, keyPressed and mousePressed.

  • User functions related with keyboard and mouse events like keyReleased or mouseDragged are prefixed with syntax specific keywords. For example, in case of C#, void is replaced by public override void.

Source sketch code is embedded in the Running module
The main classes are substituted with the sketch name so that when the user exports the sketch to .NET user control it is personalized. This is done in the Running and Canvas modules which correspond to the .NET user control and the executable.
Kernel, AbstractRunning, Running, Canvas and Common modules are compiled generating the resulting sketch
Execution Canvas The sketch is executed
AbstractRunning The setup sketch method is processed
We enter the main loop doing the following tasks:
  • Process the draw sketch method where all the painting is done though the Kernel module

  • Handle frame rate and sleep the process the corresponding time

  • Save mouse position for handling pmouseX and pmouseY primitives


===============================================================================
Generated by the free version of GemDoc. Purchase now at www.gemdoc.net/purchase
DocBook Made Easy - A single source, Windows based, multiple format solution for your document needs.