|
Documentation
|
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...
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 $...
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...
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...
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 ...
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 ...
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...
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).
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...
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
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
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. |
|
Copyright © 2000 - 2003 David Hakim