Format fixes in 2000/jarijyrki/README.md

I've now looked at the entire README.md file and fixed formatting.

I also renamed the sheet1.info file to finance.sheet as it seems a more
appropriate name for usability.
This commit is contained in:
Cody Boone Ferguson committed 2023-04-20 08:38:26 -07:00
1 parent feedb3cf50
commit 62aea3c81c
3 files changed
+301 -223

No files matched your search

+1 -1
View File
@@ -115,7 +115,7 @@ ENTRY= jarijyrki
PROG= ${ENTRY} PROG= ${ENTRY}
# #
OBJ= ${PROG}.o OBJ= ${PROG}.o
DATA= sheet1.info DATA= finance.sheet
TARGET= ${PROG} TARGET= ${PROG}
# #
ALT_OBJ= ALT_OBJ=
+300 -222
View File
@@ -10,7 +10,7 @@ Jyrki Holopainen
Forsellesintie 1-3A10 Forsellesintie 1-3A10
02700 Kauniainen 02700 Kauniainen
Finland Finland
<https://web.archive.org/web/20061205082106/http://personal.eunet.fi/pp/halo/> <https://web.archive.org/web/20061205082106/http://personal.eunet.fi/pp/halo/>
## To build: ## To build:
@@ -36,353 +36,431 @@ You will need a system capable of displaying the results of X Window programs.
## Try: ## Try:
```sh ```sh
./jarijyrki < sheet1.info > myedits.info ./jarijyrki < finance.sheet > myedits.info
``` ```
Then click on cell `C3` and type in the following:
```
C5 C6 C7 @
```
Click on cell `D4` and type in the following:
```
C5 C6 C7 !
```
Hit `ESC`.
Now try running:
```
./jarijyrki < myedits.info
```
And observe that it matches what you had in the previous run!
NOTE: changing the dimension parameters (see the authors' comments) renders
existing spreadsheet files unusable.
## Judges' remarks: ## Judges' remarks:
This entry is one of those that makes you wonder why some commercial This entry is one of those that makes you wonder why some commercial software
software needs tens to hundreds of megabytes to install! This entry needs tens to hundreds of <strike>megabytes</strike>gigabytes to install! This
does not simply do the basics, it includes graphing features. All this entry does not simply do the basics, it includes graphing features. All this
program needs now is a flight simulator! program needs now is a flight simulator!
## Author's remarks: ## Author's remarks:
1. OVERVIEW ### 1. OVERVIEW
This program is an X-Windows based spreadsheet program. This program is an X-Windows based spreadsheet program. The main functions it
The main functions it supports are: supports are:
* Text cells * Text cells
* Numeric cells * Numeric cells
* Arithmetic operations: + - * / * Arithmetic operations: `+` `-` `*` `/`
* Pie charts * Pie charts
* Histograms * Histograms
* Cell editing * Cell editing
* Formula line * Formula line
* Dynamic recalculation * Dynamic recalculation
* Error detection * Error detection
* Recursion detection * Recursion detection
* Movement within the spreadsheet with cursor keys * Movement within the spreadsheet with arrow keys
* Movement within the spreadsheet with mouse * Movement within the spreadsheet with mouse
* Scrolling * Scrolling
* Loading and saving spreadsheets * Loading and saving spreadsheets
* Visual style configuration * Visual style configuration
2. USAGE INSTRUCTIONS ### 2. USAGE INSTRUCTIONS
2.1. Quick Guide #### 2.1. Quick Guide
Starting: ./jarijyrki < sheet1.info > myedits.info ##### Starting
Stopping: Esc
Movement: Click mouse or cursor keys
Editing: Currently selected cell is always in edit state.
Press any key to add a character at the end of the
formula; press BackSpace to delete the last one.
Formulas: 123.45
A1 A2 +
B1 B2 -
C1 C2 *
D1 D2 /
Pie charts: A1 A2 A3 ... An @
Histograms: A1 A2 A3 ... An !
2.2. Starting and Loading Spreadsheets ```sh
./jarijyrki < finance.sheet > myedits.info
```
##### Stopping
Use the ESC key.
##### Movement
Click the mouse or use the arrow keys.
##### Editing
The currently selected cell is always in the edit state. Press any key to add a
character at the end of the formula; press backspace to delete the last one.
##### Formulas
```
123.45
A1 A2 +
B1 B2 -
C1 C2 *
D1 D2 /
```
##### Pie charts
```
A1 A2 A3 ...
```
Finish the formula with `@` to create the pie chart.
##### Histograms
```
A1 A2 A3 ...
```
Finish the formula with `!` to create the histogram.
#### 2.2. Starting and Loading Spreadsheets
To start the spreadsheet program with an existing To start the spreadsheet program with an existing
spreadsheet, use the following command line: spreadsheet, use the following command line:
./jarijyrki < sheet1.info ```sh
./jarijyrki < finance.sheet
```
The file sheet1.info has been provided as an example. The file [finance.sheet](finance.sheet) has been provided as an example. This
This file contains a set of financial numbers and two file contains a set of financial numbers and two graphical entities - a pie
graphical entities - a pie chart and a histogram - based chart and a histogram - based on them. We recommend starting the use of the
on them. We recommend starting the use of the program program from this file, as a way to study and learn the formula language
from this file, as a way to study and learn the formula supported by the program.
language supported by the program.
To start the program with an empty sheet, use To start the program with an empty sheet, use
```sh
./jarijyrki < /dev/null ./jarijyrki < /dev/null
```
[Alternatively, /dev/zero could be used but that may not exist Alternatively, `/dev/zero` could be used but that may not exist on all systems.
on all systems.]
2.3. Exiting and Saving Spreadsheets #### 2.3. Exiting and Saving Spreadsheets
Normally the user obviously wants to edit the spreadsheet. Normally the user obviously wants to edit the spreadsheet. After the
After the spreadsheet program finishes, it outputs the spreadsheet program finishes, it outputs the edited spreadsheet to the standard
edited spreadsheet to the standard output. Hence, when output. Hence, when the spreadsheet window has come up, you've made your
the spreadsheet window has come up, you've made your changes, changes, and you press the ESC key the program finishes. To save the results in
and you press the Esc key the program finishes. To save a file, the following typical command line would be used:
the results in a file, the following typical command line
would be used:
./jarijyrki < sheet1.info > myedits.info ```sh
./jarijyrki < finance.sheet > myedits.info
```
2.4. Visual Overview #### 2.4. Visual Overview
On top of the window the Formula Area shows the formula (or text) On top of the window the Formula Area shows the formula (or text) of the
of the currently selected cell. The program starts with A1 as currently selected cell. The program starts with `A1` as being the current cell.
being the current cell. Below the Formula Area is the Column Below the Formula Area is the Column Letters Area: A, B, and so on.
Letters Area: A, B, and so on. Correspondingly, on the left Correspondingly, on the left side of the window is the Row Numbers Area: 1, 2,
side of the window is the Row Numbers Area: 1, 2, and so on. and so on. The rest of the window is dedicated to the actual spreadsheet cells.
The rest of the window is dedicated to the actual spreadsheet
cells.
The example spreadsheet, sheet1.info, provided with this The example spreadsheet, [finance.sheet](finance.sheet), provided with this
program contains two sets of numbers in the visible area program contains two sets of numbers in the visible area of the spreadsheet. The
of the spreadsheet. The top set of numbers forms the top set of numbers forms the product-by-product turnover breakdown of an
product-by-product turnover breakdown of an imaginary imaginary company. Below it is the yearly development of the company profits. On
company. Below it is the yearly development of the the top right corner is a pie chart showing the turnover breakdown in graphical
company profits. On the top right corner is a pie chart form, and on the bottom right corner is a histogram showing the yearly
showing the turnover breakdown in graphical form, and development. If you scroll the window you can see additional data from the
on the bottom right corner is a histogram showing the spreadsheet.
yearly development. If you scroll the window you can
see additional data from the spreadsheet.
2.5. Movement and Scrolling #### 2.5. Movement and Scrolling
Use cursor keys to move left, right, up, and down among the cells. Use arrow keys to move left, right, up, and down among the cells. You may also
[Note that it is not possible to move around the formula; the click the mouse on a cell to cause it to be activated as the current one.
formula can only be edited from its end by adding or removing
characters.] You may also click the mouse on a cell to cause it
to be activated as the current one.
Going beyond the borders of the window results in scrolling Note that it is not possible to move around the formula; the formula can only be
the current view. It is not possible to go up from first row edited from its end by adding or removing characters.
or left from the first column; but it is possible to wrap back
to start from the last row and last column.
2.6. Formula Going beyond the borders of the window results in scrolling the current view. It
is not possible to go up from first row or left from the first column; but it is
possible to wrap back to start from the last row and last column.
The spreadsheet formulas operate on a stack. Operands of an #### 2.6. Formulas
operation (e.g. plus) are first pushed to the stack and then
the operation is performed. If a formula on a cell produces The spreadsheet formulas operate on a stack. Operands of an operation (e.g.
*exactly* one result then that is shown in the cell. Otherwise, plus) are first pushed to the stack and then the operation is performed. If a
the formula is interpreted as a string and shown as it is. formula on a cell produces *exactly* one result then that is shown in the cell.
Otherwise, the formula is interpreted as a string and shown as it is.
An example of a simple formula, simply specifying a number An example of a simple formula, simply specifying a number
is is
123.50 ```
123.50
```
Another simple formula refers to a cell: Another simple formula refers to a cell:
A1 ```
A1
```
This particular example formula referred to the first cell of This particular example formula referred to the first cell of the first row in
the first row in the spreadsheet. Arithmetic operations require the spreadsheet. Arithmetic operations require both arguments:
both arguments:
A1 A2 + ```
B1 B2 * A1 A2 +
C1 C2 - B1 B2 *
D1 D2 / C1 C2 -
D1 D2 /
```
More complex formulae can be constructed by combining these More complex formulae can be constructed by combining these simple ones:
simple ones:
A1 A2 + 2 * ```
A1 A2 + 2 *
```
This example calculated the sum of the cells A1 and A2, and then This example calculates the sum of the cells `A1` and `A2`, and then multiplies
multiplied the result by two. the result by two.
The currently selected cell is always in a state where it can The currently selected cell is always in a state where it can be edited. Press
be edited. Press any key to add a character at the end of the any key to add a character at the end of the formula; press backspace to delete
formula; press BackSpace to delete the last one. Any resulting the last character. Any resulting recalculations are immediately visible. (Note
recalculations are immediately visible. [Note how much nicer how much nicer this feature is as you get used to it, compared to the behaviour
this feature is as you get used to it, compared to the behaviour of certain commercial spreadsheet programs.)
of certain commercial spreadsheet programs.]
2.7. Graphical Formulas #### 2.7. Graphical Formulas
The program supports two types of graphical representations of the The program supports two types of graphical representations of the data in the
data in the cells: pie charts and histograms. The pie chart can cells: pie charts and histograms. The pie chart can consist of any number of
consist of any number of slices, and is constructed by putting slices, and is constructed by putting the pie amounts in stack and using the `@`
the pie amounts in stack and using the @ operator. The program operator. The program automatically computes the relative size of the slices.
automatically computes the relative size of the slices.
A1 A2 A3 A4 @ ```
A1 A2 A3 A4 @
```
This example would draw a pie slice of four cells, A1 to A4. This example would draw a pie chart of four cells, `A1` to `A4`.
The pie formula is shown above the pie for reference. The pie formula is shown above the pie for reference.
The histograms are drawn in a similar manner, by using the ! The histograms are drawn in a similar manner, by using the `!` operator:
operator:
A1 A2 A3 A3 ! ```
A1 A2 A3 A3 !
```
2.8. Errors in Formulas #### 2.8. Errors in Formulas
The program detects recursive reference attempts, references The program detects recursive reference attempts, references cells not
cells not containing a numerical value, attempts to define containing a numerical value, attempts to define formulas with zero, two, or
formulas with zero, two, or more results remaining in the stack, more results remaining on the stack, and syntax errors of formulas. Note that
and syntax errors of formulas. Note that typically as the user typically as the user types in a formula, it toggles between valid and invalid
types in a formula, it toggles between valid and invalid forms forms dynamically as all single character changes are immediately taken in
dynamically as all single character changes are immediately account. This is not dangerous, just complete the formula and view the results.
taken in account. This is not dangerous, just complete the
formula and view the results.
Errors are signalled by showing the formula on a cell instead Errors are signalled by showing the formula on a cell instead of the numerical
of the numerical value supposedly returned by it. value supposedly returned by it.
Division by zero results in an IEEE Inf number. Division by zero results in an IEEE Inf number.
2.9. Compilation Parameters and Configuration #### 2.9. Compilation Parameters and Configuration
This section explains the meaning and rationale for the This section explains the meaning and rationale for the
compile time parameters: compile time parameters:
---
```
-DC=XK_Up -DC=XK_Up
-DL=XK_Down -DL=XK_Down
-DO=XK_Left -DO=XK_Left
-DV=XK_Right -DV=XK_Right
-DR=XK_Escape -DR=XK_Escape
-D_=XK_BackSpace -D_=XK_BackSpace
```
These definitions can be used to change the user interface These definitions can be used to change the user interface of the program with
of the program with respect to special keys. The four first respect to special keys. The four first ones define the movement operations and
ones define the movement operations and the latter two ones the latter two ones define the program termination and character deletion keys.
define the program termination and character deletion keys. Typical modifications to these parameters include changing character deletion to
Typical modifications to these parameters include changing the key the user is most familiar with, which could also be `XK_Delete`.
character deletion to the key the user is most familiar with, `XK_Escape` might be better in some cases as one of the function keys. Likewise
which could also be XK_Delete. XK_Escape might be better for the arrow keys.
in some cases as one of the function keys. Likewise for the
cursor keys.
---
```
-DU=40 -DU=40
```
This parameter defines the maximum dimensions of the stored This parameter defines the maximum dimensions of the stored and handled
and handled spreadsheet (but see section 4.4 for a warning spreadsheet (but see section 4.4 for a warning about changing this without
about changing this without thinking about the consequences!). thinking about the consequences!).
---
```
-DT=98 -DT=98
```
This parameter defines the maximum length of a formula in one This parameter defines the maximum length of a formula in one cell. Note the
cell. Note the warning in 4.4. warning in section 4.4.
---
```
-Dz="(T+1)*U*U" -Dz="(T+1)*U*U"
```
Defines the number of bytes in a spreadsheet file. The number is Defines the number of bytes in a spreadsheet file. The number is automatically
automatically adjusted when the spreadsheet size parameters are adjusted when the spreadsheet size parameters are changed. Note the warning in
changed. Note the warning in 4.4. section 4.4.
---
```
-DQ=80 -DQ=80
-DS=20 -DS=20
```
These two parameters define the visual dimensions of a cell. These two parameters define the visual dimensions of a cell. Changing these may
Changing these may be necessary on your system if the default be necessary on your system if the default font sizes differ from those in the
font sizes differ from those in the systems we've tested the systems we've tested the program with. `S` also defines the size of the left
program with. S also defines the size of the left (x1) and top (`x1`) and top margins (`x2`).
margins (x2).
---
```
-DN=10 -DN=10
```
This is the x-indentation of text inside a cell. Changing This is the x-indentation of text inside a cell. Changing this may be necessary
this may be necessary to suit other font sizes and to suit other font sizes and different X environments.
different X environments.
---
```
-DB=5 -DB=5
```
This is the y-indentation of text inside a cell. Changing This is the y-indentation of text inside a cell. Changing this may be necessary
this may be necessary to suit other font sizes and to suit other font sizes and different X environments.
different X environments.
---
```
-DG=23 -DG=23
```
This parameter is the number of cell rows visible at one This parameter is the number of cell rows visible at one time.
---
```
-Dp=7
```
This parameter is one smaller than the number of cells columns visible at one
time. time.
---
-Dp=7
This parameter is one smaller than the number of cells columns
visible at one time.
```
-DM="((p+1)*Q)+S" -DM="((p+1)*Q)+S"
-DH="(G*S)+S+S" -DH="(G*S)+S+S"
```
These parameters are the window x and y sizes of the spreadsheet These parameters are the window x and y sizes of the spreadsheet program window.
program window. With these definitions, they are automatically With these definitions, they are automatically reflecting the
reflecting the at-one-time-visible cell row/column amounts. at-one-time-visible cell row/column amounts. Hence, we recommend changing the
Hence, we recommend changing the G and p parameters if you want `G` and `p` parameters if you want to change the window size in normal cases.
to change the window size in normal cases. Experimentation with Experimentation with `M` and `H` can be used to get other types of effect such
M and H can be used to get other types of effect such as adding as adding a margin also at the bottom of the window.
a margin also at the bottom of the window.
3. IMPLEMENTATION ---
It's better to just read the code. But note the use of ### 3. IMPLEMENTATION
stack in the implementation of @ and ! operators, and note
the use of *#i in one of the macros [can you see why?].
Extreme compression has been the key in writing this
program. With compression have come the use of ASCII code
numbers instead of character constants and so on. [This
particular obfuscation is not really a desirable one as
it is not completely portable. But it certainly was a
necessary one.]
What does or does not "i(=)" do and why? It's better to just read the code. But note the use of stack in the
implementation of `@` and `!` operators, and note the use of `*#i` in one of the
macros (can you see why?). Extreme compression has been the key in writing this
program. With compression have come the use of ASCII code numbers instead of
character constants and so on. (This particular obfuscation is not really a
desirable one as it is not completely portable. But it certainly was a necessary
one.)
4. WARNINGS AND CAVEATS What does `i(=)` do or does it do anything? Why?
4.1. X11 Paths in Compilation ### 4. WARNINGS AND CAVEATS
The given build file may have to be edited to insert correct #### 4.1. X11 Paths in Compilation
library and include file path names.
4.2. Font Sizes The given Makefile may have to be edited to insert correct library and include
file path names.
We've tested the program with limited amount of X servers. #### 4.2. Font Sizes
It is possible that other systems use default font sizes or
other parameters that cause the visual looks to be different
or perhaps even unusable; if this happens, changing compile-time
parameters explained in section 2.8 may help.
4.3. Screen Sizes We've tested the program with limited amount of X servers. It is possible that
other systems use default font sizes or other parameters that cause the visual
looks to be different or perhaps even unusable; if this happens, changing
compile-time parameters explained in section 2.8 might help.
The size of the window as it comes up - a parameter as defined #### 4.3. Screen Sizes
in compile-time - has been set suitable for a small laptop screen.
Larger screens may benefit from setting these parameters higher.
Smaller screens require changing the parameters so that all of the
window becomes visible.
4.4. Spreadsheet Dimension Changes The size of the window as it comes up - a parameter as defined in compile-time -
has been set suitable for a small laptop screen. Larger screens may benefit
from setting these parameters higher. Smaller screens require changing the
parameters so that all of the window becomes visible.
The size of the read, manipulated, and stored spreadsheets is #### 4.4. Spreadsheet Dimension Changes
defined by a compile time parameter. However, changing this
parameter is not entirely trivial. The following constraints
apply:
(a) Horizontal (alphabet) dimension handling will always be The size of the read, manipulated, and stored spreadsheets is defined by a
A to Z regardless of the actual allocated memory area. compile time parameter. However, changing this parameter is not entirely
trivial. The following constraints apply:
(b) Any change in the dimension parameter renders existing - Horizontal (alphabet) dimension handling will always be A to Z regardless of
spreadsheet files unsuitable. the actual allocated memory area.
4.5. ASCII Reliance - Any change in the dimension parameter renders existing spreadsheet files
unusable.
The software relies on running on ASCII-based code system. #### 4.5. ASCII Reliance
Why? Because "32" is shorter than "' '".
4.6. Command Line Single Character Defines The software relies on running on ASCII-based code system. Why? Because `32` is
shorter than `' '`.
The use of single character (e.g. G or p) for a -D option #### 4.6. Command Line Single Character Defines
may break certain systems, if those characters are used
in the included X header files in certain kinds of places. The use of single character (e.g. `G` or `p`) for a -D option might break
If this happens, you may move the offending character to certain systems, if those characters are used in the included X header files in
a new name by exchanging it on the command line and in certain kinds of places. If this happens, you may move the offending character
the program with another character. Note that there are to a new name by exchanging it on the command line and in the program with
*no* free characters in the program currently. another character. Note that there are *no* free characters in the program
currently.
## Copyright and CC BY-SA 4.0 License: ## Copyright and CC BY-SA 4.0 License:
File renamed without changes.