JTask - a simple client/server Mac application
By Mike Powell
May 14, 2009
This is a simple example of a Mac application acting as a client to a J server. The functionality provided is elementary; a browser window to monitor objects in the various locales of the running J task; an input field for sending expressions to the J task; and a log of the session inputs and results.
The client side is written in Objective C drawing on objects from the Cocoa Framework. The server is the J engine, accessed through the functions provided in the J dynamic library (libj.dylib). The application is standalone and does not require J to be installed on your system.
Although the application is rudimentary, the source code demonstrates how to do the following from within Objective C:
- link to the functions in the J dynamic library;
- start a J task;
convert a J object given in 3!:1 format into C data;
- find the path to a script located within the application bundle;
use release and retain to manage memory; and
- use Cocoa objects, such as a table, text field, pop-up and text storage.
The source code is provided along with a commentary.
Download 20090514 JTask.zip
Unzip this file. This should produce a folder named JTask.
Within the folder should be 3 files (Commentary.pdf, JTask(ppc).app and JTask(i386).app) and one folder source.
- Move the JTask folder to a location of your choice.
To run the application, double click the appropriate .app file.
To read through the source code with the commentary, open the commentary.pdf file and refer to the code in the source folder.