Introduction

LME for Pocket PC is LME, the programming language of Sysquake, compiled in a simple application for Windows Mobile ARM-based handheld devices. It has been tested on a Dell Axim X30 device, but should also run on other Axim and HP iPaq devices.

LME for Pocket PC is a technology preview. Its user interface is basic, and there is support only for static graphics, not for interactive graphics. It is based on LME, a Matlab-compatible programming language aimed at numerical computing used in Sysquake and other products of Calerga since 1997. You should install it only if you want to bring Matlab compatibility in your pocket. There is no expiration date. We do not guarantee that LME for Pocket PC will be a supported product in the long term, but we intend to continue providing solutions for Pocket PC based on LME in the future.

LME for Pocket PC is neither Sysquake nor LyME. It has neither the interactive graphics of Sysquake nor its SQ file support which makes developing user interfaces so easy. It has not the simple yet efficient user interface of LyME, with its integrated text editor. It is more a first step in the direction of a full Sysquake on Pocket PC: it supports files input/output and extensions, like Sysquake. Its graphical capabilities are borrowed from Sysquake Remote, i.e. it is fully compatible with Sysquake without the interactivity. Some of the most powerful extensions have been ported: audio input/output, web services with XML-RPC and SOAP, and TCP/IP sockets. And you can develop yours in C. It even supports multithreading. But as a technology preview on the way to something more finished, it has not received its own product name.

LME Installation

LME for Pocket PC is provided as a .cab file. One way to install it is to download it to your Pocket PC device, to locate it in the File Explorer and to open it. LME and all its support files are installed in \Program Files\Calerga, with a shortcut to the application in the Programs folder.

At startup, LME loads extensions in the subdirectory LMEExt, executes the contents of lmestartup.txt if it exists, and restores the history of past commands from the file lmehistory.txt. All these directories and files must be located in the same directory as LME.exe. All of them are optional (lmehistory.txt is created when LME exits if it does not exist).

LME comes with libraries (files ending with the double suffix .lml.txt) which add useful functions in different domains, such as statistics, physical constants, signal processing or control. LME will find them only if they are in one of the directories enumerated in the Options. When you run LME for the first time, you should check in menu Tools>Options that the Paths of Libraries include \Program Files\Calerga\Lib .

User interface

When launched, LME presents a basic user interface with the following elements:

Command input
The text field at the top of the screen lets you write commands with the LME syntax, such as 1+2 or v=1:5;fft(v).
Button Execute
Tapping the Execute button makes LME interpret the contents of the input field. You can interrupt computation by pressing the Scroll Down hardware button.
History
To retrieve a previous command and display it in the command input, tap the button with the < sign. To go forward in the list of commands, tap the > button. You can edit the command before executing it.
Output
The largest text field displays the result of commands. You cannot write directly to it. You can toggle between text output and graphics with the View menu, or by pressing the Select hardware button when the command field is empty.
Menu
Menus at the bottom of the screen let you change between text and graphics, see the tree of code fragments (see below), change options, and open the user manual in the default HTML browser (usually Internet Explorer).

If the operating system supports it, you can rotate the screen; the layout will be optimized for the new orientation.

Code fragments

To discover the power of LME, you can execute small demonstrations, called code fragments. Code fragments are displayed as a tree with the menu Tools>Code fragments. To execute a fragment, double-tap its name. The command itself and the result are displayed. If the result is graphical, you can switch to text mode with the menu View>Text (or simply by pressing the Select hardware button when the command field is empty) to see the command.

All fragments are stored in the XML file lmecodefragments.xml. To see or edit its contents, you can use a text editor or open it in a browser which supports CSS2 style sheets.

First steps

Here are some commands you can try.

1+2*3

Simple expressions follow the standard syntax found in many computing languages; if they are not followed by a semicolon, the result is displayed.

To permit you to chain computations easily, LME stores the anonymous result of expressions into the variable ans, which you can reuse in the next expression:

ans + sin(pi/3)

To keep multiple results, you can assign them to other variables:

x = 5

Operators and functions also support complex numbers and matrices. This will compute the complex eigenvalues of a 2-by-2 matrix:

eig([1,2;-1,1])

In addition to numerical results, LME can display graphics. fplot plots a function, inline in the example below, over some range:

fun = inline('(x+0.3)^2+7*exp(-3*x^2)');
fplot(fun, [-2,3]);

To clear the figure, use clf. You can switch manually between graphics and text output with the View menu.

LME also supports audio input and output (provided the hardware it runs on does!) We begin by recording one second of audio samples in an array. Say something after you tap the Execute button. The semicolon is important here; we do not want to see 88100 samples scrolling on the screen. If you forget it, interrupt the execution by pressing the selection button of your handheld.

snd = audiorecord(1);

The samples are stored as an array of two columns, one for the left channel, one for the right. They can be played back:

audioplay(snd)

There are probably simpler ways to record audio on a Pocket PC device. But with LME, you can manipulate the samples easily. For instance, you can play them backward by flipping the array upside-down:

audioplay(flipud(snd))

To learn more about LME, you can follow the LME tutorial.

User preferences

You can customize the way LME is working in the dialog displayed with the menu Tools>Options. Here is a description of the options:

Memory
Amount of memory reserved for LME variables, programs, and data used for executing code.
Evaluate assert
In LME programs, the assert function can help in reporting errors during development. If this option is off, the evaluation of assert is skipped, which can provide slightly improved performance. Usually, you should switch it on during development, and off when using functions whose you trust the quality.
Load extensions
Extensions are files which provide additional functions to LME. Unlike functions written in the LME programming language, extensions are compiled to native machine code, so they are very fast and they have access to all the features of the operating system. LME is provided with several extensions; you can also develop your own.
Extensions are stored in the directory LMEExt, itself located at the same place as LME.exe. To disable all extensions, you can switch off the Load extensions option.
Hide messages
Extensions usually display a short status message when they are loaded, at LME startup. When Hide messages is switched on, no message is displayed.
Path of libraries
Libraries contain additional functions written in the LME programming language (see below). The Path of libraries option specifies where LME looks for library files. Directories are separated with semicolons. For example, if you store your own libraries in \My Documents\LMELib, you could add this directory to the default path: \Program Files\Calerga\Lib;\My Documents\LMELib
The path of libraries can also be set with the LME function path.
Startup commands
Startup commands are LME commands executed every time the application is launched. For instance, if you often use functions from libraries (such as stdlib for function which extend the built-in functions of LME or stat for advanced functions related to statistics), you can add use statements as startup commands to make them always available: use stdlib, stat
Startup commands can also be used to define variables. They are executed after the file lmestartup.txt, if it exists (see above).
Format
Format specified in the Options dialog are an alternative to the LME function format. It defines how numbers are displayed.
Line width
The default line width can be set to 1 or 2 pixels. In graphics commands, an uppercase color letter in the style argument increases the width to 2 or 3 pixels, respectively.
Font
The default font used in figures can be set. The font used by text can be changed with fontset; currently the option Font can be 'serif', 'sansserif' or 'monospace', and Size, Italic and Underline are ignored.

Libraries

LME for Pocket PC does not implement its own text editor. Functions are stored in library files. To make their editing easier, library files end with .lml.txt (double suffix). Tapping their icon in File Explorer should open them with the standard application used for editing text files, typically Pocket Word; the .txt suffix is hidden. When you create a new library, make sure you add a .lml.txt suffix and save it as text only. When you transfer libraries from a desktop application, for instance Sysquake, you should also add this suffix if you want to edit it on the Pocket PC device (LME also finds library files with a simple .lml suffix, but you cannot edit them as easily).

LME finds libraries in the directory Lib in the same directory as LME.exe. If you want to store libraries in other places, you should add directories with the Options dialog or the command path (see above).


Copyright 2005-2008, Calerga.
All rights reserved.