shithub: spread

ref: b16375893ad58a69c9797fb76c97631de0513eb0
dir: /README/

View raw version
Spreadsheet Editor

This program builds around hoc(1).


# Spreadsheet files

They are divided into two blocks, separated by a line containing three `%`:

1. hoc script. Loaded verbatim to hoc. Use this to add functionality.
2. cells and cell contents.

A sample file could look like this:

	func t(a) {
		print a
	}
	%%%
	A1=3
	A2;hello
	A3=5
	A4=A1()+A3()

The general syntax of cells should be quite obvious, but it's worth noting
that cells divided by an `=` sign will end up being calculation functions,
while cells divided by a `;` sign are string literals. Both will end up
being hoc functions.

# Usage

	spread [-di] file

- `file` will be loaded as a spreadsheet
- `-d` enables extra debug output
- `-i` opens spread in CLI mode (see below)

# Modes

## GUI mode

**TODO**

A few notes:

- Cell syntax will be the same as in the files
- Function/math cells will start with `=` for editing (output
  is function result)
- String cells will have no prefix; input and output are the same

## CLI mode

For now, this opens a direct channel to hoc. All commands entered will
be forwarded to the hoc process unchanged.

Example session for previous example program:

	A4()
	→ 8
	A1()
	→ 3
	A1()*A3()
	→ 15
	A1()+2*A3()
	→ 13

# Open questions

## Hoc limitations

- Range support. Since hoc doesn't support something like `eval`,
  it is impossible to support ranges (`A3()..A5()`) out of the box.
  If we need ranges we need to find a good solution or at least a
  solid workaround, like building a list dynamically.

## Bugs

Sure, there are many. Known issues are:

- Cyclic dependencies are not allowed, but also not really checked for!