4 Writing t-files

Contents of this section

Tela source files (t-files, filenames ending with ``.t'') consist of Tela statements separated by semicolons. A function definition is just one type of statement in Tela, thus you can define as many functions in one t-file as you wish. This feature sets Tela apart from Matlab, where each M-file always defines only one function. Functions become defined in the code generation phase. For this reason the order in which the functions appear in the t-file is unessential, and a function call may textually precede its definition. Whether this is good programming style is up to you. Usually there is no point in putting function definitions inside other functions; if you do it, the result is the same as if it were a toplevel definition.

Examples of t-files can be found in /usr/local/lib/tela/t, or whereever you have installed Tela. It is a bit difficult to give a simple meaningful example which defines multiple functions. A comprehensive example is provided by the file ``madala.t'', for example. It also uses the package mechanism to make it a clean entity that does not unnecessarily conflict with other packages' name spaces.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter