Skip to content

Commit

Permalink
Merge pull request #107 from mike632t/unstable
Browse files Browse the repository at this point in the history
Merged changes for build 0154
  • Loading branch information
mike632t authored May 6, 2024
2 parents b054bc3 + 7d816ed commit 8f506c9
Show file tree
Hide file tree
Showing 43 changed files with 575 additions and 416 deletions.
431 changes: 268 additions & 163 deletions README.md

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@
# environment if neither 'prefix' or 'DESTDIR' are set
# by the user - MT
# 09 Apr 24 - Optimized install script - MT
# 24 Apr 24 - Fix parallel make with .NOTPARALLEL accross models
# in top makefile to prevent concurrent compiles of
# same common files. Make is still parallelizing
# submakes calls which do the real work. - macmpi
# 29 Apr 24 - Improve parallel make performance - macmpi
#

PROGRAM = x11-calc
Expand All @@ -110,7 +115,7 @@ IMG = img

# Files to be backed up (and the current date).

_files = `ls makefile makefile.*.[0-9] $(SRC)/makefile $(SRC)/makefile.common $(SRC)/makefile.linux $(SRC)/makefile.bsd $(SRC)/makefile.osf1 $(SRC)/makefile.*.[0-9] 2>/dev/null || true`
_files = `ls makefile makefile.*.[0-9] $(SRC)/makefile $(SRC)/makefile.all $(SRC)/makefile.linux $(SRC)/makefile.bsd $(SRC)/makefile.osf1 $(SRC)/makefile.*.[0-9] 2>/dev/null || true`
_source = `ls $(SRC)/*.c $(SRC)/*.c.[0-9] $(SRC)/*.h $(SRC)/*.h.[0-9] $(SRC)/*.in $(SRC)/*.in.[0-9] 2>/dev/null || true`
_data = `ls $(ROM)/$(PROGRAM)*.rom $(ROM)/$(PROGRAM)*.rom.[0-9] $(PRG)/$(PROGRAM)*.dat $(PRG)/$(PROGRAM)*.dat.[0-9] 2>/dev/null || true`
_images = `ls $(SRC)/*.ico $(SRC)/*.ico.[0-9] $(SRC)/*.png $(SRC)/*.png.[0-9] $(SRC)/*.svg $(SRC)/*.svg.[0-9] $(IMG)/*.png $(IMG)/*.png.[0-9] 2>/dev/null || true`
Expand Down Expand Up @@ -153,12 +158,15 @@ spice: $(_spice) $(PROGRAM)

voyager: $(_voyager) $(PROGRAM)

# Base pre-model compile target:
.DEFAULT:
# Base per-model compile target:
$(MODELS): common
@_model="`echo "$@" | sed 's/hp//'`"; \
cd $(SRC); \
$(MAKE) -s MODEL=$$_model all

common:
@cd $(SRC); $(MAKE) -s common

$(PROGRAM): $(BIN)/$(PROGRAM)

$(BIN)/$(PROGRAM): $(SRC)/$(PROGRAM).in
Expand All @@ -184,7 +192,6 @@ install:
# Note that Tru64 requires both DESTDIR and prefix to be explicitly defined
# when invoking make.
#

@_unset() { if [ -z "$(DESTDIR)$(prefix)" ]; then return 0; else return 1; fi;}; \
_desktop="`echo "$(DESKTOP)" | tr '[:lower:]' '[:upper:]' `"; \
if [ -z "$$_desktop" ]; then \
Expand Down
11 changes: 6 additions & 5 deletions src/gcc-exists.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 06 Jul 20 0.1 - Initial version - MT
* 0.2 - Added exists() - MT
* 06 Jul 20 - Initial version - MT
* - Added exists() - MT
* 22 Apr 24 - Tidied up function prototypes - MT
*
*/

int i_isfile(char *_name);
int i_isfile(const char *_name);

int i_isdir(char *_name);
int i_isdir(const char *_name);

int i_exists(char *_name);
int i_exists(const char *_name);
7 changes: 4 additions & 3 deletions src/gcc-wait.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
* need to include stdio.h - MT
* 27 Feb 24 - Fixed busy loop 'bug' on newer compilers that do not
* set 'linux' when compiling on Linux - MT
* 22 Apr 22 - Moved compiler feature macro definitions to generic
* busy loop - MT
*
*/

Expand All @@ -41,9 +43,6 @@
#define DATE "07 Feb 24"
#define AUTHOR "MT"

#define _DEFAULT_SOURCE
#define _BSD_SOURCE

#if defined(linux) || defined(__linux__) || defined(__NetBSD__)
#include <unistd.h>
#include <sys/types.h>
Expand Down Expand Up @@ -74,6 +73,8 @@ float f_seconds;
f_seconds = l_delay / 1000.0;
return (lib$wait(&f_seconds)); /* Use VMS LIB$WAIT */
#else
/** #define _DEFAULT_SOURCE /* Possibly required for busy loop more testing needed */
/** #define _BSD_SOURCE /* Possibly required for busy loop more testing needed */
struct timeb o_start, o_end;
ftime(&o_start);
ftime(&o_end);
Expand Down
17 changes: 8 additions & 9 deletions src/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@
# 29 Mar 24 - Use linux/bsd/osf1 makefiles -macmpi
#

MODEL = 21
MODEL = 21

all:
@_flavor="`uname -s | tr '[:upper:]' '[:lower:]'`"; \
echo "$$_flavor" | grep -qwE "netbsd|darwin" && _flavor=bsd; \
$(MAKE) -f "makefile.$$_flavor" MODEL=$(MODEL) $@

clean:
@_flavor="`uname -s | tr '[:upper:]' '[:lower:]'`"; \
echo "$$_flavor" | grep -qwE "netbsd|darwin" && _flavor=bsd; \
$(MAKE) -f "makefile.$$_flavor" MODEL=$(MODEL) $@
@_os="`uname -s | tr '[:upper:]' '[:lower:]'`"; \
echo "$$_os" | grep -qwE "freebsd|netbsd|darwin" && _os=bsd; \
$(MAKE) -s -f "makefile.$$_os" MODEL=$(MODEL) $@

.DEFAULT:
@_os="`uname -s | tr '[:upper:]' '[:lower:]'`"; \
echo "$$_os" | grep -qwE "freebsd|netbsd|darwin" && _os=bsd; \
$(MAKE) -s -f "makefile.$$_os" MODEL=$(MODEL) $@
28 changes: 16 additions & 12 deletions src/makefile.common → src/makefile.all
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# makefile.generic - RPN (Reverse Polish) calculator simulator.
# makefile.all_flavors - RPN (Reverse Polish) calculator simulator.
#
# Copyright(C) 2024 - macmpi, MT
#
Expand Down Expand Up @@ -28,28 +28,30 @@
# 28 Mar 24 - Streamlined macros for use on osf1 - macmpi
# 09 Apr 24 - Finally renamed x11-calc-segment to the more correct
# x11-calc-digit - MT
# 29 Apr 24 - renamed makefile.all_flavors - macmpi
# - renamed makefile.all - MT
#

MODEL = 21
PROGRAM = x11-calc-$(MODEL)
MODEL = 21
PROGRAM = x11-calc-$(MODEL)
BIN = ../bin

# SHARED sources are model-dependant via HP$(MODEL) #define statements
SHARED = x11-calc.c x11-calc-cpu.c x11-calc-display.c x11-calc-digit.c x11-calc-messages.c x11-calc-button.c
COMMON = x11-calc-switch.c x11-calc-label.c x11-calc-colour.c x11-calc-font.c x11-keyboard.c gcc-wait.c gcc-exists.c
SHARED = x11-calc.c x11-calc-cpu.c x11-calc-display.c x11-calc-digit.c x11-calc-messages.c x11-calc-button.c
COMMON = x11-calc-switch.c x11-calc-label.c x11-calc-colour.c x11-calc-font.c x11-keyboard.c gcc-wait.c gcc-exists.c

CC = cc
DEBUG =

LDLIBS_ADD = -lX11 -lm

CFLAGS_ADD = -fcommon -Wall -pedantic -std=gnu99 \
-Wno-comment -Wno-deprecated-declarations -Wno-builtin-macro-redefined \
-D$(LANG) $(DEBUG)
-Wno-comment -Wno-deprecated-declarations -Wno-builtin-macro-redefined \
-D$(LANG) $(DEBUG)

all: $(BIN)/$(PROGRAM)

$(BIN)/$(PROGRAM): $(SHARED:.c=.o_HP$(MODEL)) $(COMMON:.c=.o_cm) x11-calc-$(MODEL).o
$(BIN)/$(PROGRAM): common $(SHARED:.c=.o_HP$(MODEL)) x11-calc-$(MODEL).o
@mkdir -p $(BIN)
@rm -f $(BIN)/$(PROGRAM)
@[ -n "$${VERBOSE+x}" ] && echo && \
Expand All @@ -58,7 +60,9 @@ $(BIN)/$(PROGRAM): $(SHARED:.c=.o_HP$(MODEL)) $(COMMON:.c=.o_cm) x11-calc-$(MODE
@$(CC) $(SHARED:.c=.o_HP$(MODEL)) $(COMMON:.c=.o_cm) x11-calc-$(MODEL).o $(LDFLAGS) $(LDLIBS) $(LDLIBS_ADD) -o $@
@ls $@ | sed "s:$(BIN)/::g"

.SUFFIXES: .o_HP$(MODEL) .o_cm .o
common: $(COMMON:.c=.o_cm)

.SUFFIXES: .o_cm .o_HP$(MODEL) .o

.c.o_HP$(MODEL):
@[ -n "$${VERBOSE+x}" ] && echo && echo "$(CC) $(CFLAGS) $(CFLAGS_ADD) -DHP$(MODEL) -c $< -o $@" || true
Expand All @@ -68,10 +72,10 @@ $(BIN)/$(PROGRAM): $(SHARED:.c=.o_HP$(MODEL)) $(COMMON:.c=.o_cm) x11-calc-$(MODE
@[ -n "$${VERBOSE+x}" ] && echo && echo "$(CC) $(CFLAGS) $(CFLAGS_ADD) -DHP$(MODEL) -c $< -o $@" || true
@$(CC) $(CFLAGS) $(CFLAGS_ADD) -DHP$(MODEL) -c $< -o $@

# COMMON files are NOT supposed to be instanciated per MODEL (will fix soon)
# COMMON files are NOT supposed to be instanciated per MODEL
.c.o_cm:
@[ -n "$${VERBOSE+x}" ] && echo && echo "$(CC) $(CFLAGS) $(CFLAGS_ADD) -DHP$(MODEL) -c $< -o $@" || true
@$(CC) $(CFLAGS) $(CFLAGS_ADD) -DHP$(MODEL) -c $< -o $@
@[ -n "$${VERBOSE+x}" ] && echo && echo "$(CC) $(CFLAGS) $(CFLAGS_ADD) -c $< -o $@" || true
@$(CC) $(CFLAGS) $(CFLAGS_ADD) -c $< -o $@

clean:
@rm -f $(SHARED:.c=.o_HP$(MODEL)) $(COMMON:.c=.o_cm) x11-calc-$(MODEL).o
13 changes: 11 additions & 2 deletions src/makefile.bsd
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# https://www.gnu.org/software/make/manual/html_node/Prerequisite-Types.html
#
# 28 Mar 24 - Initial version - macmpi
# 06 May 24 - Fixed include path for Darwin - MT
#

CFLAGS ?=
Expand All @@ -34,6 +35,14 @@ LDLIBS ?=
OS != uname -s

# Operating system specific settings
.if ${OS} == "FreeBSD"
LANG = LANG_en
LDLIBS += -lcompat
CFLAGS += -Wno-variadic-macros
CFLAGS += -I/usr/local/include/
LDFLAGS += -L/usr/local/lib/
.endif

.if ${OS} == "NetBSD"
LANG = LANG_en
LDLIBS += -lcompat
Expand All @@ -44,8 +53,8 @@ LDFLAGS += -L/usr/X11R7/lib/ -R /usr/X11R7/lib

.if ${OS} == "Darwin" # MacOS
LANG = LANG_en
CFLAGS += -I/opt/X11/include/X11/
CFLAGS += -I/opt/X11/include/
LDFLAGS += -L/opt/X11/lib/
.endif

include makefile.common
include makefile.all
9 changes: 4 additions & 5 deletions src/makefile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,16 @@ LDFLAGS ?=
LDLIBS ?=

LANG = LANG_$(shell (echo $$LANG | cut -f 1 -d '_'))

COMMIT != git log -1 HEAD --format=%h 2> /dev/null

ifneq ($(COMMIT),)
CFLAGS += -DCOMMIT_ID='"[Commit Id : $(COMMIT)]"'
CFLAGS += -DCOMMIT_ID='"[Commit Id : $(COMMIT)]"'
endif
ifneq ($(SCALE_WIDTH),)
CFLAGS += -DSCALE_WIDTH=$(SCALE_WIDTH)
CFLAGS += -DSCALE_WIDTH=$(SCALE_WIDTH)
endif
ifneq ($(SCALE_HEIGHT),)
CFLAGS += -DSCALE_HEIGHT=$(SCALE_HEIGHT)
CFLAGS += -DSCALE_HEIGHT=$(SCALE_HEIGHT)
endif

include makefile.common
include makefile.all
2 changes: 1 addition & 1 deletion src/makefile.osf1
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ CFLAGS =
LDFLAGS =
LDLIBS =

include makefile.common
include makefile.all
3 changes: 1 addition & 2 deletions src/x11-calc-10c.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* 12 Mar 22 - Added the label state property - MT
* 22 May 22 - Fixed shortcut key for SST - MT
* 18 Mar 24 - Embedded firmware - MT
* 22 Apr 24 - Removed duplicate definition - MT
*
* TO DO : -
*/
Expand Down Expand Up @@ -55,8 +56,6 @@

oregister o_mem[MEMORY_SIZE];

int i_rom[ROM_SIZE];

void v_init_labels(olabel *h_label[]) {
int i_height = h_small_font->ascent + h_small_font->descent;
h_label[0] = h_label_create(001, "CLEAR" , h_alternate_font, KBD_LEFT + 2 * (KEY_WIDTH + KEY_GAP),
Expand Down
3 changes: 2 additions & 1 deletion src/x11-calc-10c.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* 02 Mar 22 - Modified memory size (still too big) - MT
* 04 Mar 22 - Enabled continuous memory - MT
* 09 Mar 22 - Fixed width and height (when scaled) - MT
* 22 Apr 24 - Define display colour separately - MT
*
*/

Expand All @@ -34,7 +35,7 @@
#define DIGITS 11
#define INDECATORS 8

#define DIGIT_COLOUR DIM_GREY
#define DIGIT_COLOUR GREY
#define DIGIT_BACKGROUND MID_GREY
#define DISPLAY_BACKGROUND MID_GREY
#define BEZEL_COLOUR LIGHT_GREY
Expand Down
19 changes: 10 additions & 9 deletions src/x11-calc-11c.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
* 30 Jan 22 - Initial version (derived from x11-calc-10.c) - MT
* 12 Mar 22 - Added the label state property - MT
* 18 Mar 24 - Embedded firmware - MT
* 22 Apr 24 - Removed duplicate definition - MT
* 2 May 24 - Added shortcut keys 'A-E' - MT
*
* TO DO : -
*/

#define NAME "x11-calc-11c"
#define BUILD "0003"
#define DATE "18 Mar 24"
#define BUILD "0005"
#define DATE "02 May 24"
#define AUTHOR "MT"

#include <stdarg.h> /* strlen(), etc. */
Expand All @@ -51,8 +53,6 @@

oregister o_mem[MEMORY_SIZE];

int i_rom[ROM_SIZE];

void v_init_labels(olabel *h_label[]) {
int i_height = h_small_font->ascent + h_small_font->descent;
h_label[0] = h_label_create(001, "CLEAR" , h_alternate_font, KBD_LEFT + KEY_WIDTH + KEY_GAP,
Expand All @@ -67,15 +67,15 @@ void v_init_buttons(obutton *h_button[]) {
i_top = KBD_TOP + KEY_HEIGHT;
i_left = KBD_LEFT;
i_count = 0;
h_button[i_count++] = h_button_create(00023, 000, "/\xaf", "A", "", "x\xb2", h_normal_font, h_small_font, h_alternate_font, i_left, i_top, KEY_WIDTH, KEY_HEIGHT, False, False, BLACK, YELLOW, MID_BLUE, BLACK);
h_button[i_count++] = h_button_create(00023, 'A', "/\xaf", "A", "", "x\xb2", h_normal_font, h_small_font, h_alternate_font, i_left, i_top, KEY_WIDTH, KEY_HEIGHT, False, False, BLACK, YELLOW, MID_BLUE, BLACK);
i_left += (KEY_WIDTH + KEY_GAP);
h_button[i_count++] = h_button_create(00063, 000, "eX", "B", "", "ln", h_normal_font, h_small_font, h_alternate_font, i_left, i_top, KEY_WIDTH, KEY_HEIGHT, False, False, BLACK, YELLOW, MID_BLUE, BLACK);
h_button[i_count++] = h_button_create(00063, 'B', "eX", "B", "", "ln", h_normal_font, h_small_font, h_alternate_font, i_left, i_top, KEY_WIDTH, KEY_HEIGHT, False, False, BLACK, YELLOW, MID_BLUE, BLACK);
i_left += (KEY_WIDTH + KEY_GAP);
h_button[i_count++] = h_button_create(00163, 000, "10x", "C", "", "log", h_normal_font, h_small_font, h_alternate_font, i_left, i_top, KEY_WIDTH, KEY_HEIGHT, False, False, BLACK, YELLOW, MID_BLUE, BLACK);
h_button[i_count++] = h_button_create(00163, 'C', "10x", "C", "", "log", h_normal_font, h_small_font, h_alternate_font, i_left, i_top, KEY_WIDTH, KEY_HEIGHT, False, False, BLACK, YELLOW, MID_BLUE, BLACK);
i_left += (KEY_WIDTH + KEY_GAP);
h_button[i_count++] = h_button_create(00303, 000, "yX", "D", "", "%", h_normal_font, h_small_font, h_alternate_font, i_left, i_top, KEY_WIDTH, KEY_HEIGHT, False, False, BLACK, YELLOW, MID_BLUE, BLACK);
h_button[i_count++] = h_button_create(00303, 'D', "yX", "D", "", "%", h_normal_font, h_small_font, h_alternate_font, i_left, i_top, KEY_WIDTH, KEY_HEIGHT, False, False, BLACK, YELLOW, MID_BLUE, BLACK);
i_left += (KEY_WIDTH + KEY_GAP);
h_button[i_count++] = h_button_create(00203, 000, "1/x", "E", "", "d%", h_normal_font, h_small_font, h_alternate_font, i_left, i_top, KEY_WIDTH, KEY_HEIGHT, False, False, BLACK, YELLOW, MID_BLUE, BLACK);
h_button[i_count++] = h_button_create(00203, 'E', "1/x", "E", "", "d%", h_normal_font, h_small_font, h_alternate_font, i_left, i_top, KEY_WIDTH, KEY_HEIGHT, False, False, BLACK, YELLOW, MID_BLUE, BLACK);
i_left += (KEY_WIDTH + KEY_GAP);
h_button[i_count++] = h_button_create(00202, 'c', "CHS", "\x1c", "", "ABS", h_normal_font, h_small_font, h_alternate_font, i_left, i_top, KEY_WIDTH, KEY_HEIGHT, False, False, BLACK, YELLOW, MID_BLUE, BLACK);
i_left += (KEY_WIDTH + KEY_GAP);
Expand Down Expand Up @@ -927,3 +927,4 @@ int i_rom[ROM_SIZE] = {
0x010c, 0x01e8, 0x01e6, 0x01e6, 0x03c8, 0x03cc, 0x0023, 0x0266,
0x03e3, 0x03e0, 0x039d, 0x000c, 0x03cd, 0x004e, 0x0000, 0x0000
};

3 changes: 2 additions & 1 deletion src/x11-calc-11c.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*
* 30 Jan 22 - Initial version (derived from x11-calc-10.c) - MT
* 09 Mar 22 - Fixed width and height (when scaled) - MT
* 22 Apr 24 - Define display colour separately - MT
*
*/

Expand All @@ -31,7 +32,7 @@
#define DIGITS 11
#define INDECATORS 8

#define DIGIT_COLOUR DIM_GREY
#define DIGIT_COLOUR GREY
#define DIGIT_BACKGROUND MID_GREY
#define DISPLAY_BACKGROUND MID_GREY
#define BEZEL_COLOUR LIGHT_GREY
Expand Down
3 changes: 1 addition & 2 deletions src/x11-calc-12c.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* 07 Mar 22 - Fixed shortcut for SST - MT
* 12 Mar 22 - Added the label state property - MT
* 18 Mar 24 - Embedded firmware - MT
* 22 Apr 24 - Removed duplicate definition - MT
*
*/

Expand Down Expand Up @@ -52,8 +53,6 @@

oregister o_mem[MEMORY_SIZE];

int i_rom[ROM_SIZE];

void v_init_labels(olabel *h_label[]) {
int i_height = h_small_font->ascent + h_small_font->descent;
h_label[2] = h_label_create(001, "BOND" , h_alternate_font, KBD_LEFT,
Expand Down
3 changes: 2 additions & 1 deletion src/x11-calc-12c.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* 31 Jan 22 - Initial version (derived from x11-calc-10.c) - MT
* 09 Mar 22 - Fixed width and height (when scaled) - MT
* 21 Mar 24 - Fixed display position - MT
* 22 Apr 24 - Define display colour separately - MT
*
*/

Expand All @@ -32,7 +33,7 @@
#define DIGITS 11
#define INDECATORS 8

#define DIGIT_COLOUR DIM_GREY
#define DIGIT_COLOUR GREY
#define DIGIT_BACKGROUND MID_GREY
#define DISPLAY_BACKGROUND MID_GREY
#define BEZEL_COLOUR GOLD
Expand Down
Loading

0 comments on commit 8f506c9

Please sign in to comment.