~dheinemann/Replicalc

9d6010a24b9cd9ced1578c871f26a95615058e25 — David Heinemann 7 months ago b19a53c
Add DOS support (using PDCurses)
7 files changed, 78 insertions(+), 14 deletions(-)

M .gitignore
M .gitmodules
A PDCurses
M README.md
A dos/makefile
M src/chartype.c
M src/cursesui.c
M .gitignore => .gitignore +8 -1
@@ 1,3 1,10 @@
todo.txt
build/
.vscode/
\ No newline at end of file
dosh/
.vscode/

# Open Watcom build files and junk
*.ERR
*.EXE
*.O
*.OBJ
\ No newline at end of file

M .gitmodules => .gitmodules +5 -0
@@ 1,3 1,8 @@
[submodule "Unity"]
	path = Unity
	url = https://github.com/ThrowTheSwitch/Unity.git
	ignore = dirty
[submodule "PDCurses"]
	path = PDCurses
	url = https://github.com/wmcbrine/PDCurses.git
	ignore = dirty

A PDCurses => PDCurses +1 -0
@@ 0,0 1,1 @@
Subproject commit 793556fff386a9c7003e59618af1e062fd36c46a

M README.md => README.md +19 -12
@@ 1,7 1,8 @@
# Replicalc

Replicalc is a simple keyboard-driven calculator. Expressions are evaluated
inside a REPL, similar to the classic TI-83 calculator.
Replicalc is a simple keyboard-driven calculator for Linux and MS-DOS.
Expressions are evaluated inside a REPL, similar to the classic TI-83
calculator.

**"Screenshot":**



@@ 16,13 17,6 @@ under certain conditions. See the LICENSE file for details.
>
```

Replicalc currently uses an ncurses-based interface. Additional interfaces for
other platforms are planned:

* conio.h for DOS/Windows
* Win16 for Windows
* GTK for Linux

## Status

This is a hobby project to learn the C programming language. The code is bad


@@ 39,11 33,24 @@ Additional operators are forthcoming.

## Compiling

First, install the ncurses development library:
Before proceeding, initialize all submodules if you haven't already done so:

```
git submodule init
git submodule update
```

### Linux

1. Install the ncurses development library. For example (Fedora): `sudo dnf install ncurses-devel`
2. Navigate to the repository root.
2. Run `make`.

* **Fedora:** `sudo dnf install ncurses-devel`
### MS-DOS

Next, run `make` in the repository root.
1. Install the [Open Watcom compiler](http://openwatcom.org).
2. Navigate to the `dos` directory.
2. Run `wmake`.

## License


A dos/makefile => dos/makefile +40 -0
@@ 0,0 1,40 @@
CFLAGS = -bt=dos -ml
LDFLAGS = ..\pdcurses\dos\pdcurses.lib


rcalc: cursesui.o
	wcl ..\src\main.c -fe=rcalc.exe $(CFLAGS) *.o $(LDFLAGS) -i="..\pdcurses"

run: rcalc
	rcalc.exe

cursesui.o: calc.o chartype.o strfun.o pdcurses
	wcc ..\src\cursesui.c -fo=cursesui.o $(CFLAGS) -i="..\pdcurses"

calc.o: chartype.o dstack.o strstack.o
	wcc ..\src\calc.c -fo=calc.o $(CFLAGS)

chartype.o:
	wcc ..\src\chartype.c -fo=chartype.o $(CFLAGS)

strfun.o:
	wcc ..\src\strfun.c -fo=strfun.o $(CFLAGS)

dstack.o:
	wcc ..\src\dstack.c -fo=dstack.o $(CFLAGS)

strstack.o:
	wcc ..\src\strstack.c -fo=strstack.o $(CFLAGS)

.NOCHECK
pdcurses:
	cd ..\pdcurses\dos
	wmake -f makefile.wcc
	cd ..\..\dos

clean:
	rm *.o
	rm *.exe
	rm *.err
	rm ..\pdcurses\dos\*.obj
	rm ..\pdcurses\dos\*.lib

M src/chartype.c => src/chartype.c +1 -1
@@ 32,4 32,4 @@ int is_symbol(char c) {
        || c == '-'
        || c == '('
        || c == ')';
}
\ No newline at end of file
}

M src/cursesui.c => src/cursesui.c +4 -0
@@ 13,7 13,11 @@
 * GNU General Public License for more details.
 */

#if defined(__DOS__)
#include <curses.h>
#else
#include <ncurses.h>
#endif

#include "calc.h"
#include "chartype.h"