~dheinemann/Replicalc

34fba5f2fcea9f5f9f0a8597ea04663baf4dda84 — David Heinemann 7 months ago ca9b5e9
Add Windows support (using PDCurses)
5 files changed, 80 insertions(+), 23 deletions(-)

M .gitignore
M README.md
M dos/makefile
M src/cursesui.c
A win32/makefile
M .gitignore => .gitignore +11 -4
@@ 1,10 1,17 @@
todo.txt
build/
dosh/
.vscode/
dos/*
!dos/makefile
dosh/*
linux/*
!linux/makefile
win32/*
!win32/makefile

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

M README.md => README.md +12 -6
@@ 1,6 1,6 @@
# Replicalc

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



@@ 33,7 33,7 @@ Additional operators are forthcoming.

## Compiling

Before proceeding, initialize all submodules if you haven't already done so:
Before proceeding, initialize all Git submodules if you haven't already done so:

```
git submodule init


@@ 43,16 43,22 @@ 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. Navigate to the `linux` directory.
2. Run `make`.

### MS-DOS
### Windows 95, 98, ME, 2000, XP, 7, 8, 10

1. Install the [Open Watcom compiler](http://openwatcom.org).
1. Install the [Open Watcom compiler for Windows](http://openwatcom.org).
2. Navigate to the `win32` directory.
2. Run `wmake`.

### MS-DOS, Windows 1, 2, 3

1. Install the [Open Watcom compiler for DOS](http://openwatcom.org).
2. Navigate to the `dos` directory.
2. Run `wmake`.

## License

Replicalc is published under the GNU General Public License, version 2. See the
LICENSE file for more information.
\ No newline at end of file
LICENSE file for more information.

M dos/makefile => dos/makefile +14 -12
@@ 1,34 1,36 @@
PDCURSES = ..\pdcurses\dos
CC = wcc
CCL = wcl
CFLAGS = -bt=dos -mm
LDFLAGS = ..\pdcurses\dos\pdcurses.lib

LDFLAGS = $(PDCURSES)\pdcurses.lib

rcalc: cursesui.o
	wcl ..\src\main.c -fe=rcalc.exe $(CFLAGS) *.o $(LDFLAGS) -i="..\pdcurses"
	$(CCL) ..\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"
	$(CC) ..\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)
	$(CC) ..\src\calc.c -fo=calc.o $(CFLAGS)

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

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

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

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

.NOCHECK
pdcurses:
	cd ..\pdcurses\dos
	cd $(PDCURSES)
	wmake -f makefile.wcc MODEL=m
	cd ..\..\dos



@@ 36,5 38,5 @@ clean:
	rm *.o
	rm *.exe
	rm *.err
	rm ..\pdcurses\dos\*.obj
	rm ..\pdcurses\dos\*.lib
	rm $(PDCURSES)\*.obj
	rm $(PDCURSES)\*.lib

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

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

A win32/makefile => win32/makefile +42 -0
@@ 0,0 1,42 @@
PDCURSES = ..\pdcurses\wincon
CC = wcc386
CCL = wcl386
CFLAGS = -bt=nt -mf
LDFLAGS = $(PDCURSES)\pdcurses.lib

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

run: rcalc
	rcalc.exe

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

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

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

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

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

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

.NOCHECK
pdcurses:
	cd $(PDCURSES)
	wmake -f makefile.wcc
	cd ..\..\win32

clean:
	rm *.o
	rm *.exe
	rm *.err
	rm $(PDCURSES)\*.obj
	rm $(PDCURSES)\*.lib