Classes and Blocks

Blocks

Computer languages need a method of grouping parts of code for various purposes. For example, when an IF condition evaluates to TRUE, then several lines of code need to be executed. And if the IF condition is false, execution must continue after these “several lines of code”.

ChaosPro’s language uses curly brackets { and } to group several lines of code in order to form a block of statements. Examples:

  	if (cabs(z)<5)  	{  		for (i=0;i<5;i++)  		{  			d=d+cabs(zold(iter-i));  		}  	}  

Classes

Formula classes are stored inside simple ASCII files. Normally you will create those files and formulas inside ChaosPro, thus you will not need to know much about the exact structure.

But perhaps you like your favorite text editor so much that you want to create/modify formulas with it rather than using ChaosPro.

A formula file can contain only a single type of formula classes, either transformation classes or formula classes or coloring classes or library classes. You must not mix different types inside one formula file.

Besides formula classes a formula file can contain comments (for whatever purpose). These comments are stored inside blocks as follows:

  comment  {  This is just some comment. The purpose of this comment is unknown...  Version 1.98a - 32 Dec 1999  }  

You may place as many comments inside formula files as you like. They will be displayed when you select the formula file itself inside ChaosPro.

Formula Classes

Each class regardless its type starts with an identifier, which is the internal name of the class. The class name displayed to the user is defined inside the class. The internal name is used to uniquely identify the class. Following the class a symmetry specification may be between brackets. The contents of the class follows the symmetry description.

Example 1
  Example 2  
  Example 3  
  my-formula  {  int i;  ...    }  
  f4_sirps (XAXIS)		  {  ...  }  
  f4sirps ( YAXIS )  {          void init(void)          {          ...          }  }  

The formula class then contains variables, parameters and functions describing the actions to perform. The functions which must be provided by a formula writer depend on the formula type. The different types are as follows and are explained in more detail in the corresponding chapters:

Classes and Blocks