Courseware Development System Communication Protocol (1/31/92)

by: Joseph Wang (joe@astro.as.utexas.edu)

General Setup

The Courseware Development System does not perform mathematical calculations
within the program itself.  Instead it starts up a ``backend'' engine 
which performs all mathematical calcualtions.  CDS communicates with its
backend using the ``expect'' pty package developed by ......

This document defines the protocol that the Courseware Development
System uses to communcate with its backend.  It is intended for developers
of compatibility packages for CDS and not for normal users.

From CDS to the backend.

#!<command> will kill the current backend and then create a connection
to a process started by <command>.  It will then block until output is
received from the process.  All output to the model which is received
while the backend is blocked wil be placed into a buffer, and will be 
sent to the backend when output from the backend is received. 

All strings sent to the model are sent to the backend, after making the
follwing string substitutions.

$CDS_CONFIG_DIR is replaced with the absolute path name of the configuration
directory

$CDS_THIS_PAGE is replaced with the name of the current page

${figure:resource} or ${figure:resource,options} is replaced with current
value of the resource of a given figure.

From the backend to CDS

The output from the backend consists of output to be displayed in the 
evaluator, as well as embedded commands for CDS.  An embedded command is
of the form

!c!<one character buffer tag><two character opcode><arguments>

An example of a valid command is

!c!!cg page1 figure1

which shows figure1 on page1 immediately.

The buffer tag is one of the following

+ Add this line to the command buffer
- Add this line to the command buffer, execute the command buffer, 
  and then clear the command buffer
! Execute this line immediate, do not change the command buffer


The opcodes are as follows
aa - Exit Cds
ab - Show Normal Cursor
ac - Show Wait Cursor
ad - System 

ba - Cut Figure
bb - Copy Figure
bc - Paste Figure
bd - Toggle Editing

ca - Call action
cb - Call callback
cc - Create figure
cd - Hide figure
ce - Place figure
cf - Set resource
cg - Show figure

da - Add menu function
db - add menu item
dc - add menu pane
dd - remove menu function

ea <error message> - handle model error
eb <trace level number> - handle model trace level

fa <navigator-command> - goto page
fb <file-name> - open file
fc - change title

ga - plotter plot

The arguments for each command are white space separated.  White space can
be included in the argument by placing it within quotes.
