Cheaper, Faster, Better!
   
 
Documentation

1. The Moto Preprocessor

Even without making use of moto's programmatic constructs, the moto preprocessor can do away with much of the repetition involved in hand coding pages of HTML. It provides functionality for text file inclusion and macro substitution...

2. The Moto Language

Moto is an embedded language. That means that any text file, HTML page, or XML document is by default a legal moto file. The contents of such a file would pass through the moto interpreter and print out unmodified. Moto actually does something when, in the process of parsing a file, it runs into a moto construct. These are special directives that begin with the character $...

3. Embedded Block Syntax

Moto supports an additional, more compact syntax for embedding large 'blocks' of code into a page without worrying about whitespace treatment. This syntax may be used in addition to the single construct syntax described in the previous section...

4. Regular Expressions In Moto

Regular expression support is built into the moto language. Regular expressions in moto are specified by a forward slash '/', followed by the regular expression definition, followed by a forward slash. An example regular expression would be /([a-zA-Z]+)@(([a-zA-Z]+[.])*[a-zA-Z]+)/ which would match for simple email addresses...

5. Higher Order Programming In Moto

In Moto, functions and methods have types and may be assigned to variables of the same types. These 'functional' variables may themselves be treated as functions. Thus functions and methods may be passed as arguments to other functions or methods. Functions may even be returned from other functions or methods. New functions can even be constructed at runtime by 'applying' some or all of the arguments of existing functions ...

6. Overloaded Operators In Moto

As in C++, operators in moto can be overloaded giving moto programmers concise semantics for expressing common operations on objects. When an operator for a class is overloaded moto programmers can write code using operators that expands behind the scenes to function and method calls. For example the moto code A[0]=B+C may be used as short hand for A.setAt(0,union(B,C)) depending on the types of the variables A,B, and C ...

7. Interacting With Apache

Both the moto module, and any moto application compiled with mmc, run as dynamically loaded modules within the web server. They may be configured by modifying the httpd.conf file, access HTTP requests and responses , and parse HTTP headers and form submissions for cookies and file upload, via included APIs...

8. Basic State Management

State management in moto allows for persistence of information in the Context, Sessions and States. The Context stores objects that are global, may be set, updated and retrieved from any page, and never expire unless explicitly removed from the Context and deleted. The Session stores objects that are needed only for one user's Session and expire when that user's Session expires. The State stores variables passed in the URL or submitted via HTML form submissions (HTTP Post operations).

9. Advanced State Management

There are a number of important things to consider when evaluating what sort of state management to implement in your application. Will the application need to be distributed, or require bookmarkable URLs. Will there be many multipage operations, or interview processes? Can you require your users to have cookies turned on. Moto will eventually support three primary state management systems...

10. Interacting With Databases

Like most web programming languages, the moto language was designed with database interaction in mind. Extensions are included with moto in order to facilitate interaction with Postgres and MySQL databases. To connect to one of these databases you must use the appropriate codex.db library

11. Writing New Extensions for Moto

The moto language, like most web programming languages, was designed primarily for webmasters with some technical ability to intersperse programmatic constructs within web pages to create web applications. Moto was built with performance in mind because the history of web programming languages such as Coldfusion, ASP, and PHP, shows that they are used more often than not as the entire platform for rapid web application development. Nonetheless, the preferred way of using moto is for the user interface and form handling aspects of your web applications alone. Business logic, where possible, should be implemented in a classical programming language such as C...

A. Language Reference

Construct Description
$* ... *$ Comment out a block of code
$declare( ) Declare a variable
$( ) Displays the value of an expression
$do( ) Executes an expression without displaying a result
$while( )
$endwhile
Loops over a block of code until a condition is met
$for( )
$endfor
Loop over a block of code a specified number of times
$break Breaks out of a loop
$continue Returns to the first command in a loop
$if( )
$elseif( )
$else
$endif
Conditionally executes a block of code
$switch( )
$case( )
$endswitch
Executes one of many possible blocks of code depending on the value of a variable
$use( ) Makes an extension library's classes, functions, and methods available for use
$define( )
$enddef
Defines a new function in moto
$class( )
$endclass
Defines a new class in moto
$return( )
$return
Returns an expression from a function or method
$throw Throws an exception
$try
$catch( )
$finally
$endtry
Executes code that may throw exceptions and adds code blocks to handle possible exceptions

B. Extension Reference

Extension Description
moto Defines the interface for String and Regex objects as well as object wrappers for the fundamental types (Boolean, Character, Double, Float, Integer, and Long). This extension is loaded automatically
cstdlib Makes functions from the C standard libraries available to moto programmers
codex.util Provides interfaces to the codex library of utility classes.
codex.http Provides objects for session and state management as well as communication with the Apache Web Server
codex.db.mysql Provides objects for interacting with a MySQL database.
codex.db.pgsql Provides objects for interacting with a Postgres database.
codex.io Provides objects for interacting with a Posix filesystem.

C. Tools Reference

Tool Description
moto Command line preprocessor, verifier, interpreter, and C code generator for moto files.
mmc Compiles a single moto page, or a subtree of moto pages into an Apache dynamically loadable module
mxc Compiles a folder full of C function mappings (.i files) into a moto extention.