aboutsummaryrefslogtreecommitdiff
path: root/readme.rst
blob: 3a7ed17fe8ca3ec65d160641df7432d82f36b154 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
.. -*- mode: rst -*-
.. -*-  coding: utf-8 -*-

.. default-role:: code

.. contents::
  :depth: 3

Licht is a console spreadsheet. This application allow you to view, edit, and
save spreadsheet in Open document format.

=======
Licence
=======

Licht is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.

licht is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
licht. If not, see <http://www.gnu.org/licenses/>.

===========
Compilation
===========

licht requires ocaml 4.06, ncurses and gmp. The easest way to compile it is to
use opam :

.. code-block:: console

  # sudo aptitude install opam libncures-dev libiconv-dev libgmp-dev
  $ opam pin add licht http://git.chimrod.com/cgit.cgi/licht.git

=====
Usage
=====

Run licht with `licht` or `licht file.ods` in order to load a file.

Modes
=====

Licht is a modal application. When you start the spreadsheet, you are in
`Normal mode`_, which allow you to navigate in the sheet, and switch to others
modes.

Normal mode
-----------

Allow edition and sheet modification

======= ===========================
Key     Action
======= ===========================
**v**   switch to `selection mode`_
**:**   Insert commands_
**e**   edit a cell content (`edition mode`_)
**=**   insert a formula (`edition mode`_)
**y**   yank a cell
**p**   paste a cell
**DEL** delete a cell
**u**   undo the last action
======= ===========================

Commands
--------

You can insert commands with the key `:` in `Normal mode`_

=================== ======================================
Command             Action
=================== ======================================
**:enew**           Start a new spreadsheet
**:w** *filename*   Save the file with the given name
**:q**              Quit the spreadsheet. (No confirmation will be asked if the
                    spreadsheet has been modified)
=================== ======================================

Selection mode
--------------

In this mode, you can select and apply action to many cells. You can use arrow
keys to extend the selection in any direction.

========= =========================
Key       Action
========= =========================
**ESC**   go back to `normal mode`_
**y**     yank the selection
**DEL**   delete the selection
========= =========================

Edition mode
------------

Use the arrows to insert a reference to an other cell.

Data types
==========

String
------

Any value wich does not match the following types is considered as a string.

You can enter a string in formula by enclosing it with a `"` (`="this a \"quote"`).

Numeric
-------

Any numeric value can be written directly : `123`, `-.43`.

Date
----

Date are represented with this format `YYYY/MM/DD`. Any operation that can
apply to Numeric can also by applied to Date.

Boolean
-------

This type cannot be created directly. You can instead use the function `true()`
and `false()` or comparaison operator.

References
----------

You can reference cells in the formulas

Reference to a single cell
~~~~~~~~~~~~~~~~~~~~~~~~~~

You can reference a cell by naming it (`A1`, `B22`).

The value for a reference to a single cell is the value of the pointed cell.
(In case of cycle between differents cell the result is unspecified but it is
garanted to not loop.)

Range
~~~~~

Yan can reference a range by naming the two bounds (`C6:A1`).

Undefined
~~~~~~~~~

If a reference point to an an empty cell, the content will be interpreted as
Undefined. Any formula impliyng `Undefined` will return Error

Functions
=========

You can enter a formula by starting the value with `=`. The evaluation always
expands the reference to other cells.

Licht is provided with built-in functions :

Generic comparaison
-------------------

Thoses function can be applied to any value, and return a Boolean.

=============== ===============================
Function        Value
=============== ===============================
*x* `=` *y*     True if *x* equals *y*
*x* `>` *y*     True if *x* > *y*
*x* `>=` *y*    True if *x* >= *y*
*x* `<` *y*     True if *x* < *y*
*x* `<=` *y*    True if *x* <= *y*
*x* `<>` *y*    True if *x* does not equals *y*
=============== ===============================

Boolean
-------

================= ===============================
Function          Value
================= ===============================
`true()`          True
`false()`         False
`not(Bool)`       True  if the parameter is False,
                  False if the parameter is True
`and(Bool; Bool)` Logical and
`or(Bool; Bool)`  Logical or
`xor(Bool; Bool)` Logical exclusive or
================= ===============================

Condition
~~~~~~~~~

========================= ===========================================
Function                  Value
========================= ===========================================
`if(Bool`; *x* ; *y* `)`  Return *x* if `Bool` is True, otherwise *y*
========================= ===========================================

Numeric
-------

=================== =====================================
Function            Value
=================== =====================================
*x* `+` *y*         Addition
*x* `-` *y*         Difference
*x* `*` *y*         Multiplication
*x* `/` *y*         Division
*x* `^` *y*         Compute *x* ^ *y*
`gcd(` *x*; *y* `)` Greatest common divisor
`lcm(` *x*; *y* `)` Lowest common multiple
`rand()`            A random number between 0 and 1
`sqrt(Numeric)`     Square root
`exp(Numeric)`      Exponential
`ln(Numeric)`       Natural logarithm
`abs(Numeric)`      Absolute value
=================== =====================================

Rounding
~~~~~~~~

The table show the differents results for the rounding functions

===================== === === ==== ====
Function              1.2 1.8 -1.2 -1.8
===================== === === ==== ====
`int(Numeric)`        1   1   -2   -2
`rounddown(Numeric)`  1   1   -1   -1
`round(Numeric)`      1   2   -1   -2
===================== === === ==== ====

Operations on lists
~~~~~~~~~~~~~~~~~~~

=================== =====================================
Function            Value
=================== =====================================
`sum(Numeric List)` Compute the sum of the list.
`min(Numeric List)` Get the minimum value
`max(Numeric List)` Get the maximum value
=================== =====================================

Trigonometry
~~~~~~~~~~~~

All the trigonometry functions works in radian.

===================== =====================================
Function              Value
===================== =====================================
`pi()`                Get the value for :math:`\pi`
`cos(Numeric)`        Get the cosine for the value
`sin(Numeric)`        Get the sine for the value
`tan(Numeric)`        Get the tangent for the value
`acos(Numeric)`       Arc cosine
`asin(Numeric)`       Arc sine
`atan(Numeric)`       Arc tangent
`cosh(Numeric)`       Hyperbolic cosine
`sinh(Numeric)`       Hyperbolic sine
`tanh(Numeric)`       Hyperbolic tangent
`atan2(` *x*; *y* `)` Arc tangent of *x* / *y*
===================== =====================================

Text
----

================================= ======================================================
Function                          Value
================================= ======================================================
`trim(Text)`                      Remove all space on left and right
`upper(Text)`                     Convert the string to uppercase
`lower(Text)`                     Convert the string to lowercase
`unicode(Text)`                   Returns the numeric code for the first Unicode character
`unichar(Numeric)`                Converts a code number into a Unicode character or letter
`substitute(Text, Text, Text)`    Substitutes new text for old text in a string
`len(Text)`                       Return the length of a string
`left(Text, Numeric)`             Return the first n characters
`right(Text, Numeric)`            Return the last n characters
================================= ======================================================