[Next] [Up]

Advanced Features

Many of the features of EXALT already discussed are advanced and complex compared to those of other programming languages. This section describes extensions to EXALT which are optional, and which allow EXALT to supply to the programmer routines to perform major portions of some common applications.

Word Processing

A "word processing" program is distinguished from an ordinary text editor by allowing visual editing: it is possible to type in the middle of a listing of one's file on a screen, and have the corresponding changes take place in the file itself.

Much of the work done by such a program is handled by a call to _VIS, having the form

       CALL _VIS(text:infilter,top-line-var,
                   cur-line-var,cur-tcol-var,
                   left:left-sequence,right:right-sequence,
                   top:top-sequence,bottom:bottom-sequence,
                   top-exit-sequence,bottom-exit-sequence;
                   char:sequence,char:sequence,
                   char:sequence,...char:sequence)

which does the following:

display, starting at the line whose number is in top-line-var, the text contained in the one-dimensional STRING array text, placing the cursor at the line in the array (not on the screen) given by the current value of cur-line-var, and at the character in the text of that line given by cur-tcol-var (the screen column left + cur-tcol-var),

leaving left columns blank on the left of the screen, performing left-sequence before printing each line to fill these columns; right columns on the right, with right-sequence after; top lines blank at the top, performing top-sequence before filling the screen the first time; bottom lines on the bottom, with bottom-sequence after,

automatically handling cursor movement, text entry, character deletion, and insert mode,

performing top-exit-sequence and bottom-exit-sequence whenever it is attempted to move the cursor off the text area of the screen,

and performing the following sequences whenever the character indicated in the preceding char is entered without leaving the program, but, upon return from the sequences, accomodating any changes in the values of top-line-var, cur-line-var, or cur-tcol-var.

Any sequence can CALL _VEXIT to cause exit from _VIS; this will also take place whenever a control character not performing either a basic function or one trapped by the char:sequence pairs is entered.

Where some control functions are implemented by two-character escape codes on a terminal, but the ESCAPE key is used for another purpose (switching to command mode, for example), the infilter argument can be used; declared RNAME, called, effectively, in the form

       CALL infilter(in-char,out-string)

it translates every character for _VIS into zero or more characters. The niladic function _CGTIM gives the time in 1/60ths of a second since the character preceding the current character was recieved.

Algebraic Manipulation

The EXALT function _EXEV, which allows a string to be interpreted as an expression, and evaluated, has been seen. Also, functions may have TEXT type arguments which copy arguments also evaluated or passed in EXPRESSION form.

Given the text of an expression, it is possible to perform algebraic manipulations upon it.

Among the advanced optional features of EXALT are routines to perform some such manipulations.

     _SBI('3*X+_COS(X)','X=_LOG(Y)')

is

      '3*_LOG(Y)+_COS(_LOG(Y))'

(substitute) but

     _SBI('3*X+R*X','X=_COS(T)')

may be

     '(3+R)*_COS(T)'

as all these functions may provide some simplifications. Some more difficult simplifications, however, must be explicitly requested:

     _SIP('_ARCOS(_COS(X))')

is 'X'; (simplify ignoring principal values) and

     _SEP('_ARCOS(_COS(X))')

is

     '_PI-_ABS(_MOD(X,2*_PI)-_PI)'

(simplify with explicit principal values) and

     _SCP('_LN(_EXP(X))')

is

     '_IMOD(X+!_PI,2*_PI)-!_PI'

(simplify with explicit complex principal values); also,

     _SCP('_ARCOSH(_COSH(X))')

is

     '!_PI+_IABS(_IMOD(X,2*_PI)-_PI)*'

note the use of the complex conjugate instead of subtraction.

     _PDER('_SIN(5*X)','X')

is '5*_COS(5*X)'

(partial derivative).

     _USUB('X*8','V=2*X')

is

'V*4'

_SBI with '2*X=V' as its second argument is not possible, as such a string could not be interpreted properly as an assignment (remember, = is also a relational operator).

     _IIG('1/X','X')

is

'_LN(X)'

(indefinite integral); note that not all EXALT functions will have integrals expressible in terms of other EXALT functions; the function _RO will not be used to create series expansions when all else fails, instead an error will be reported.


[Next] [Up]