aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2024-02-29 01:50:44 +0100
committerPaul Oliver <contact@pauloliver.dev>2024-02-29 01:50:44 +0100
commitae15d7ba087f81d713280785840122dea81ea844 (patch)
treeda9a41fe2b9037ba50fbee234b085fe6d34296d2
parent76a75c92be37aae5fb227030bb375a0a3e505637 (diff)
Fixes for running on Linux.
-rw-r--r--Makefile9
-rw-r--r--README.md9
-rw-r--r--tsalis/src/printer.c22
3 files changed, 24 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 230df19..6b4b6e1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
CC := gcc
LIB := bin/libsalis.so
+ULIB := /usr/lib/libsalis.so
SOURCES := $(wildcard src/*.c)
OBJECTS := $(patsubst src/%.c,build/%.o,$(SOURCES))
@@ -13,8 +14,9 @@ LFLAGS := -shared
# uncomment for release
OFLAGS := -O3 -DNDEBUG
-CFLAGS := -Iinclude -c $(OFLAGS) -MMD -Wall -Wextra -std=c89 -pedantic-errors \
- -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition
+CFLAGS := -Iinclude -c $(OFLAGS) -MMD -Wall -Wextra -std=c89 -fPIC \
+ -pedantic-errors -Wmissing-prototypes -Wstrict-prototypes \
+ -Wold-style-definition
all: $(OBJECTS)
$(CC) $(LFLAGS) -o $(LIB) $(OBJECTS)
@@ -29,3 +31,6 @@ clean:
-rm build/*
-rm $(LIB)
$(MAKE) clean -C tsalis
+
+install:
+ cp $(LIB) $(ULIB)
diff --git a/README.md b/README.md
index 85429a6..35630a8 100644
--- a/README.md
+++ b/README.md
@@ -115,6 +115,9 @@ are set to r0x.
## Building instructions
You'll need nothing but a C compiler (C89). A sample makefile (Makefile)
is provided for GNU Make. Just run `make` inside this directory and the salis
-library should compile as well as the tsalis executable. Feel free to edit
-the makefile as needed. Code should compile easily on all platforms and on all
-C89 compliant compilers. If you run into any difficulties, please let me know!
+library should compile as well as the tsalis executable. You may want to run
+`sudo make install` as well, in order to install the salis library.
+
+Feel free to edit the makefile as needed. Code should compile easily on all
+platforms and on all C89 compliant compilers. If you run into any difficulties,
+please let me know!
diff --git a/tsalis/src/printer.c b/tsalis/src/printer.c
index 92cbcd9..212d3de 100644
--- a/tsalis/src/printer.c
+++ b/tsalis/src/printer.c
@@ -392,7 +392,7 @@ printHeader(int line, const char *string)
{
attron(COLOR_PAIR(PAIR_HEADER));
printWidget(line, string);
- standend();
+ attron(COLOR_PAIR(PAIR_NORMAL));
}
#define PHEADER(label) printHeader((*line)++, label)
@@ -438,7 +438,7 @@ printField(int y, int x, const char *field, sbool lalign)
static void
printSingleProcessGenome(int line, sword pidx)
{
- char sidx[11];
+ char sidx[13];
SProc proc = sp_getProc(pidx);
sword gidx = g_processGeneScroll;
int xpos = 14;
@@ -491,7 +491,7 @@ printSingleProcessGenome(int line, sword pidx)
xpos++;
}
- standend();
+ attron(COLOR_PAIR(PAIR_NORMAL));
}
static void
@@ -501,7 +501,7 @@ printProcessGenes(int *line)
attron(COLOR_PAIR(PAIR_HEADER));
printField(*line, 1, "pidx", STRUE);
- standend();
+ attron(COLOR_PAIR(PAIR_NORMAL));
INCREMENT_LINE;
while ((*line < LINES) && (pidx < sp_getCap())) {
@@ -510,7 +510,7 @@ printProcessGenes(int *line)
pidx++;
}
- standend();
+ attron(COLOR_PAIR(PAIR_NORMAL));
}
static void
@@ -539,7 +539,7 @@ printSingleProcessData(int line, sword pidx)
xpos += 13;
}
- standend();
+ attron(COLOR_PAIR(PAIR_NORMAL));
}
static void
@@ -559,7 +559,7 @@ printProcessData(int *line)
xpos += 13;
}
- standend();
+ attron(COLOR_PAIR(PAIR_NORMAL));
INCREMENT_LINE;
while ((*line < LINES) && (pidx < sp_getCap())) {
@@ -568,7 +568,7 @@ printProcessData(int *line)
pidx++;
}
- standend();
+ attron(COLOR_PAIR(PAIR_NORMAL));
}
static void
@@ -681,7 +681,7 @@ printWorld(void)
mvaddch(y, xpos, symbol);
}
- standend();
+ attron(COLOR_PAIR(PAIR_NORMAL));
}
}
}
@@ -707,7 +707,7 @@ printWorldPage(int *line)
PWIDGET(g_procElems[eidx], data[eidx]);
}
- standend();
+ attron(COLOR_PAIR(PAIR_NORMAL));
printWorld();
}
@@ -723,7 +723,7 @@ tsp_printData(void)
} else {
attron(COLOR_PAIR(PAIR_HEADER));
printWidget((*line)++, "%.20s...", g_simName);
- standend();
+ attron(COLOR_PAIR(PAIR_NORMAL));
}
PSIDGET("state", g_running ? "running" : "paused");