# zPocketScript

©2004, by Craig Graham.

zPocketScript is a scripting/interpreted programming environment for the Sharp Zaurus. The language itself is ECMAScript/JavaScipt and supports all the features of JavaScript1.4, including exceptions, regular expressions, functors, and much more.

## The Script Debugger

The zPocketScript debugger is a full GUI debugger for the scripting language, providing for easy development of your code. Features include stack trace, breakpoint's, single step, with() stack, variable tree's, expression watching, etc.

Remote debugging is also possible - you can debug scripts which are running on another machine. For example, if your desktop PC or server is using zps to automate some operations, you can use zPocketScript to remotely debug scripts that are actually running on the server.

The zPocketScript debugger automaticly starts a local instance of zps in local debug server mode when you run it.

## zps - The Standalone Interpreter

zPS scripts can be run directly from the commandline using the standalone interpreter. usage:
`zps [-server] [-rserver] [-v] [-h] [<script1> <script2> ... <scriptN>] [-f <fn>]`

- -server Run as local debug server (local debugger can connect)
- -rserver Run as remote debug server (remote debugger can connect)\n");
- -f <fn> Invoke function 'fn' in a script you've already loaded\n"); eg.
  `zps myScript.js -f myFunction`
- -v Display list of builtin objects
- -h Display this help

where scriptN is the name of the script(s) you wish to run.

### Server Mode

zps can be run in remote server mode, which allows remote debugging of scripts on other machines. To run it in this mode:

`zps -rserver`

It'll then listen for remote debug connections, which can request it to load scripts and perform various debug operations on them - you can use zPocketScript to connect to a remote machine running zps in server mode and debug the scripts with your Zaurus but with the script itself executing on the remote machine.

## Class Reference

### zPocketScript Core Objects

These are Objects from JavaScript/ECMAScript. For detailled descriptions on their use, get a JavaScript reference. They're pretty much fully supported as per the JavaScript specifications...

- Object
- String
- Array
- global
- Boolean
- Event
- Function
- Math
- Number
- RegExp
- Date
- Console

### zPocketScript Plugin Extensions

These extensions to the basic Object set are optional (check the Plugins list in zPocketScript to see which one's you have installed). They provide useful interfaces to the PDA's system software. For example - you might have a set of plugin Objects to allow for QT development, or to let you use ZSurface from a script, or to do file operations.

- File
- Host
- Socket

Click here for a pretty picture of the object hierachy.

## About The Author

I've written a couple of things for the Zaurus in the past - I guess the best known is the IRK driver for IRDA keyboards. I also wrote a few others though - NetActive, SubApplet (the original version before Steve Essery took over development), the Zaurus port of the Castaway AtariST emulator, and the QMode2 graphics IR signal analyser.

Back in the real world, I write embedded systems software for a company in Ealing. I used to work in the Space Industry, but the money was rubbish...

I live in Brighton (UK), with my wife, son and small but noisy dog.