Clac Manual

Eero Tamminen

Version 1.10 10. November 1994

1 Name

Cli — a command line interface for Clac().

2 Synopsis

clac [– options] [@filename | expression]

3 Description

Clac is a C-function for expression evaluation. Cli acts as an user interface for it. Cli has three modes of operation:

• An expression is parsed from arguments.

• Without a filename or expression Cli enters interactive mode. Expressions are evaluated as they are entered.

• Expressions are read from a file. If file named ‘cli.ini’ exists in the current directory, it’s executed before anything else is done. You can exit from interactive mode by giving Cli an empty line.

4 Options

Command line options recognized by Cli. -d: Output result in decimals. Default. -b: Output result in binary decimals. -o: Output result in octal decimals. -h: Output result in hex decimals. -r: Trigonometric arguments in radians. Default. -g: Trigonometric arguments in degrees. -c: Complex numbers are output as real and imaginary components ’a+bi’.

Default. -v: Complex numbers are output as vectors ’(x, y)’. -p: Complex numbers are output in polar co-ordinates ’(magnitude, di-

rection)’. Trigonometric mode defines whether the direction is in degrees or radians.

5 Characters and Operators

Possible characters and operators in Cli:

• All the operators and functions that Clac supports.

• Assignment operator ‘=’. Eg. ‘test = 3.5’.

• Mode change operator ‘:’. Look under ’OPTIONS’ for available modes. Eg. use ‘:b’ to switch on binary output.

• Variable ‘E’, containing a transcendal number e (= lim_{n→∞}(1 + \frac{1}{n})^{n}).

• Variable ‘PI’, containing a transcendal number π (the ratio of the circumference of a circle to its diameter).

• ‘?’ gives a brief overview of the operators and functions that Cli & Clac currently support.

You can change the values of all variables including E and Pi (if you’re one of those people that insist on π being 3).

6 Limitations

255 character limit for expressions (do you need more?).

7 Examples

⋄ From a command line:

clac '$FF.8 - (("ET * 12) + 5) / 3.7 + (-1)'

⋄ Interactively:

clac -g
Expression: foo = sin(90) + 1
2.0
Expression: foo + 2
4.0
Expression: a = 1 + 2i
1.0 + 2.0i
Expression: b = 2 + 1i
2.0 + 1.0i
Expression: a / b
0.8 + 0.6i

Remember to quote needed characters if running Clac from command line.

8 Hints

• Use variables.

• Your shell’s history buffer could be used to replace Cli’s missing history function.

9 Thanks to

• Jarkko Kniivilä, who advised me on C syntax.

• Gernot Saltzer for bugreports and suggestions.

• Jürgen Lock, who patiently answered to my mail.

• Helpful people on #atari (irc), whom I have chatted with: Dirch, Gryf, Infy, Aviva…

10 Copyright

Eero Tamminen / puujalka (irc), t150315@cc.tut.fi. Freeware.

11 Check also

Sketches of Spain (Miles Davis).