From 718fbebfbbfc31b60e7fa7f0a40d0a19c279bd34 Mon Sep 17 00:00:00 2001
From: Etienne Brateau <etienne.brateau@ensiie.fr>
Date: Sat, 2 Mar 2019 00:04:40 +0100
Subject: [PATCH] newkbd: remove all dead code and code that do nothing

---
 include/graphics/newkbd.h |  37 ----------
 include/logglobals.h      |   6 --
 src/ana/inter.c           |   2 +-
 src/display.c             |   2 +-
 src/graphics/newkbd.c     | 143 --------------------------------------
 src/keyboard.c            |  22 +-----
 src/label.c               |   4 +-
 src/log.c                 | 117 ++++++++++++++-----------------
 src/logcom.c              |   4 +-
 src/loged.c               |  10 +--
 src/logsim.c              |   2 +-
 src/logsimed.c            |  20 +++---
 src/logstuff.c            |   7 --
 src/window.c              |   6 +-
 14 files changed, 78 insertions(+), 304 deletions(-)

diff --git a/include/graphics/newkbd.h b/include/graphics/newkbd.h
index 77064a8..42cf1dd 100644
--- a/include/graphics/newkbd.h
+++ b/include/graphics/newkbd.h
@@ -1,49 +1,12 @@
 #ifndef NEWKBD_H
 #define NEWKBD_H
 
-
 #include <utils/sysglobals.h>
 #include <utils/sysdevs.h>
 #include <utils/misc.h>
 
-#define nk_keylow       (-2)
-#define nk_keyhigh      125
-#define nk_keyshift     1
-#define nk_keyctrl      2
-#define nk_keyext1      4
-#define nk_keymodlow    0
-#define nk_keymodhigh   (nk_keyshift + nk_keyctrl)
-#define nk_kknone       0
-#define nk_kknormal     1
-#define nk_kkesc        2
-#define nk_kkprog       3
-#define nk_kkcmd        4
-#define nk_kkproc       5
-#define nk_ktcurrent    0
-#define nk_ktstandard   1
-#define nk_ktcaged      2
-#define nk_ktsupplied   (-1)
-
-typedef struct nk_keyinforec {
-    uchar k, c;
-} nk_keyinforec;
-
-typedef nk_keyinforec nk_keyinfovector[nk_keymodhigh - nk_keymodlow + 1];
-
-typedef nk_keyinfovector nk_keymatrix[nk_keyhigh - nk_keylow + 1];
-
-typedef uchar nk_keycapsvector[(nk_keyhigh - nk_keylow + 8) / 8];
-
-int nk_capslock;
-
-#define nk_keybufsize m_pollkbd
 void nk_keybufclear ();
-#define nk_getkey m_inkey
 void nk_ungetkey (uchar c);
-#define nk_testkey(x)        m_testkey()
-#define nk_gotoxy(x,y)      nc_gotoXY(x,y)
-#define nk_getxy(x,y)       nc_getXY(x,y)
-int nk_setcapslock (int newcaps);
 
 #endif /*NEWKBD_H*/
 
diff --git a/include/logglobals.h b/include/logglobals.h
index f37887c..3ae7ddf 100644
--- a/include/logglobals.h
+++ b/include/logglobals.h
@@ -43,12 +43,6 @@ extern short txacross, txdown, across, down, baseline, line1, line2,
                          kindgroupbase, kindgroupleft, kindgroupright, kindgroupstart,
                          kindgroupsize, histdown;
 
-extern int entrycapslock;   /* Capslock status on entry */
-extern int oldcapslock;   /* Previous capslock status */
-
-extern int signalcaps;   /* Capslock flag for signal-name entry */
-extern int labelcaps;   /* Capslock flag for label entry */
-
 extern char (*index_)[9];   /* Index into gate library */
 extern short *indexoffset;   /* Offset of each gate */
 extern uchar *indexfile;   /* File number of each gate */
diff --git a/src/ana/inter.c b/src/ana/inter.c
index e5c7851..9ad454b 100644
--- a/src/ana/inter.c
+++ b/src/ana/inter.c
@@ -96,7 +96,7 @@ static void log_edit_32(log_action_t *act)
   printf("\f");
   do {
     printf("Default[%s]? (y,n) ", Newname);
-    Ch = nk_getkey();
+    Ch = m_inkey();
   } while (Ch != 'Y' && Ch != 'y' && Ch != 'N' && Ch != 'n');
   if (Ch == 'Y' || Ch == 'y') {
     strcpy(STR1, strltrim(Newname));
diff --git a/src/display.c b/src/display.c
index b83ea0b..81255da 100644
--- a/src/display.c
+++ b/src/display.c
@@ -51,7 +51,7 @@ void scroll()
 	refrwindow1();
 	xoff0 = 0;
 	yoff0 = 0;
-	TEMP = nk_testkey(0);
+	TEMP = m_testkey();
 	if ((uchar)TEMP < 32 && ((1L << TEMP) & 0x90000500L) != 0)
 		ch = inkey2();
 	restorecursor();
diff --git a/src/graphics/newkbd.c b/src/graphics/newkbd.c
index 94b50ca..0b25997 100644
--- a/src/graphics/newkbd.c
+++ b/src/graphics/newkbd.c
@@ -1,152 +1,9 @@
-#define NEWKBD_G
-
 #include <utils/p2c.h>
-
-#ifndef NEWCRT_H
 #include <graphics/newcrt.h>
-#endif
-
-#ifndef NEWKBD_H
 #include <graphics/newkbd.h>
-#endif
-
-#ifndef MYLIB_H
 #include <graphics/mylib.h>
-#endif
-
 #include <X11/Xlib.h>
 
-static char *KeyNames[] = {
-  "0",
-  "1",
-  "2",
-  "3",
-  "4",
-  "5",
-  "6",
-  "7",
-  "BackSpace",
-  "Tab",
-  "Linefeed",
-  "Clear",
-  "12",
-  "Return",
-  "13",
-  "14",
-  "15",
-  "16",
-  "17",
-  "18",
-  "Pause",
-  "20",
-  "21",
-  "22",
-  "23",
-  "24",
-  "25",
-  "26",
-  "Escape",
-  "28",
-  "29",
-  "30",
-  "31",
-  "space",
-  "exclam",
-  "quotedbl",
-  "numbersign",
-  "dollar",
-  "percent",
-  "ampersand",
-  "quoteright",
-  "parenleft",
-  "parenright",
-  "asterisk",
-  "plus",
-  "comma",
-  "minus",
-  "period",
-  "slash",
-  "0",
-  "1",
-  "2",
-  "3",
-  "4",
-  "5",
-  "6",
-  "7",
-  "8",
-  "9",
-  "colon",
-  "semicolon",
-  "less",
-  "equal",
-  "greater",
-  "question",
-  "at",
-  "A",
-  "B",
-  "C",
-  "D",
-  "E",
-  "F",
-  "G",
-  "H",
-  "I",
-  "J",
-  "K",
-  "L",
-  "M",
-  "N",
-  "O",
-  "P",
-  "Q",
-  "R",
-  "S",
-  "T",
-  "U",
-  "V",
-  "W",
-  "X",
-  "Y",
-  "Z",
-  "bracketleft",
-  "backslash",
-  "bracketright",
-  "asciicircum",
-  "underscore",
-  "quoteleft",
-  "a",
-  "b",
-  "c",
-  "d",
-  "e",
-  "f",
-  "g",
-  "h",
-  "i",
-  "j",
-  "k",
-  "l",
-  "m",
-  "n",
-  "o",
-  "p",
-  "q",
-  "r",
-  "s",
-  "t",
-  "u",
-  "v",
-  "w",
-  "x",
-  "y",
-  "z",
-  "braceleft",
-  "bar",
-  "braceright",
-  "asciitilde",
-};
-
 void nk_ungetkey(uchar c)
 {
   XEvent event;
diff --git a/src/keyboard.c b/src/keyboard.c
index b83d9ad..b9288be 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10,7 +10,7 @@
 /// Return TRUE if a key has been pressed (via keyboard or menu boxes).
 int pollkbd2()
 {
-	return (nk_keybufsize() != 0 || pushedbackkey != '\0');
+	return (m_pollkbd() != 0 || pushedbackkey != '\0');
 }
 
 /// Return the most recently pressed key.
@@ -19,7 +19,7 @@ char testkey2()
 	if (pushedbackkey != '\0')
 		return pushedbackkey;
 	else if (pollkbd2())
-		return (nk_testkey(0));
+		return (m_testkey());
 	else
 		return ' ';
 }
@@ -40,19 +40,9 @@ char inkey2()
 	}
 	else
 	{
-		realkey = nk_getkey();
+		realkey = m_inkey();
 	}
 	ch = realkey;
-	if ((ch & 255) >= 168 && (ch & 255) <= 239 && nk_capslock)
-	{
-		if ((ch & 255) <= 193)
-		{
-			ch += 46;
-		} else if ((ch & 255) >= 214)
-		{
-			ch -= 46;
-		}
-	}
 	gg.fastspeed = gg.fastmin;
 	return ch;
 }
@@ -70,12 +60,6 @@ char inkey4()
 	char ch;
 
 	ch = inkey2();
-	if (!nk_capslock)
-		return ch;
-	if (isupper(ch))
-		ch += 32;
-	else if (islower(ch))
-		ch -= 32;
 	return ch;
 }
 
diff --git a/src/label.c b/src/label.c
index 2269a34..3a284c2 100644
--- a/src/label.c
+++ b/src/label.c
@@ -449,14 +449,13 @@ void editlabel(log_lrec *l)
 	short i, x1, y1;
 	long j;
 	uchar ch;
-	int savecaps, redraw, touching;
+	int redraw, touching;
 	char name[log_lablen + 1];
 	char STR1[256];
 
 	m_graphics_on();
 	clearalpha();
 	remcursor();
-	savecaps = nk_setcapslock(labelcaps);
 	touching = (l != NULL && l == gg.nearlabel);
 	if (l == NULL)
 		addlabel(&l, "");
@@ -615,7 +614,6 @@ void editlabel(log_lrec *l)
 		stamp(&gg.labelstamp);
 		chpageplace(gg.pages[gg.curpage - 1], l->x, l->y, l->x + l->w, l->y + 2);
 	}
-	labelcaps = nk_setcapslock(savecaps);
 	gg.t.depressed = false;
 	refreshsoon();
 }
diff --git a/src/log.c b/src/log.c
index 877384b..13a48c3 100644
--- a/src/log.c
+++ b/src/log.c
@@ -108,12 +108,6 @@ short kindgroupstart;
 short kindgroupsize;
 short histdown;
 
-int entrycapslock;   ///< Capslock status on entry
-int oldcapslock;   ///< Previous capslock status
-
-int signalcaps;   ///< Capslock flag for signal-name entry
-int labelcaps;   ///< Capslock flag for label entry
-
 char (*index_)[9];   ///< Index into gate library
 short *indexoffset;   ///< Offset of each gate
 uchar *indexfile;   ///< File number of each gate
@@ -294,13 +288,13 @@ void report(int num, char *s)
 		return;
 	}
 	clearshowalpha();
-	nk_gotoxy(0, txdown - 1);
+	nc_gotoXY(0, txdown - 1);
 	nc_printf("\215--> Internal error %d in %s\210\n", num, s);
 	if (gg.traceflag)
 		fprintf(tracefile, "--> Internal error %d in %s\n", num, s);
 	m_alpha_on();
 	nc_printf("    Press any key to continue.");
-	ch = nk_getkey();
+	ch = m_inkey();
 	if (ch == 'N' || ch == 'n')
 		reportnowait = true;
 	nc_putchar('\n');
@@ -1826,7 +1820,7 @@ static void readlnpass(char *s, short mode)
 	if (mode != 3)   /*mode 0: normal*/
 		*s = '\0';
 	/*mode 2: exit on knob up/dn*/
-	nk_getxy(&x, &y);   /*mode 3: 2 + keep default*/
+	nc_getXY(&x, &y);   /*mode 3: 2 + keep default*/
 	oxleft = 1;
 	xleft = 1;
 	i = 1;
@@ -1838,13 +1832,13 @@ static void readlnpass(char *s, short mode)
 		if (redraw || xleft != oxleft)
 		{
 			hidecursor();
-			nk_gotoxy((int)x, (int)y);
+			nc_gotoXY((int)x, (int)y);
 			nc_printf("%s\t", strsub(STR1, s, xleft, (int)(txacross - x)));
 			hidecursor();
 			oxleft = xleft;
 			redraw = false;
 		}
-		nk_gotoxy((int)(x + i - xleft), (int)y);
+		nc_gotoXY((int)(x + i - xleft), (int)y);
 		nc_cursor_on();
 		if (!pollkbd2())
 		{
@@ -1896,7 +1890,7 @@ static void readlnpass(char *s, short mode)
 	if (!strcmp(STR1, EXEC))
 	{
 		*s = '\0';
-		nk_gotoxy((int)x, (int)y);
+		nc_gotoXY((int)x, (int)y);
 		nc_putchar('\t');
 	}
 	if (gg.t.dn)
@@ -5207,7 +5201,7 @@ static void gatedefinitioncommand()
 			{
 				beginbottom();
 				m_alpha_on();
-				nk_gotoxy(0, txdown - 1);
+				nc_gotoXY(0, txdown - 1);
 				nc_printf("Select a gate to view its simulator definition.");
 				do
 				{
@@ -5349,7 +5343,7 @@ static void listlibrary()
 			if (indexgroup[nn - 1] == curlistgroup)
 			{
 				V.karr[i][j - 1] = nn;
-				nk_gotoxy(i * 10 + 2, j + 1);
+				nc_gotoXY(i * 10 + 2, j + 1);
 				if (P_getbits_UB(loadedgates, nn - 1, 0, 3))
 					nc_putchar(chryellow);
 				nc_printf("%s%c", index_[nn - 1], chrgreen);
@@ -5362,7 +5356,7 @@ static void listlibrary()
 			}
 			nn++;
 		} while (i <= V.maxi && nn <= idxsize);
-		nk_gotoxy(0, txdown);
+		nc_gotoXY(0, txdown);
 		nc_printf("+ for next group, - for last group, space bar to quit.");
 		do
 		{
@@ -5375,11 +5369,11 @@ static void listlibrary()
 					lsp = findlibrstr(index_[k - 1]);
 					if (lsp != NULL)
 					{
-						nk_gotoxy(0, txdown - 1);
+						nc_gotoXY(0, txdown - 1);
 						nc_printf("%.*s", txacross, lsp->str);
 					}
 				}
-				nk_gotoxy(i * 10 + 2, j + 1);
+				nc_gotoXY(i * 10 + 2, j + 1);
 				if (k < huge_)
 				{
 					if (P_getbits_UB(loadedgates, k - 1, 0, 3))
@@ -5397,24 +5391,24 @@ static void listlibrary()
 						break;
 
 					case -2:
-						nk_gotoxy(49, txdown);
+						nc_gotoXY(49, txdown);
 						nc_printf("%cquit%c.", chrinverse, chrplain);
 						break;
 
 					case -3:
-						nk_gotoxy(0, txdown);
+						nc_gotoXY(0, txdown);
 						nc_printf("%c+%c", chrinverse, chrplain);
 						break;
 
 					case -4:
-						nk_gotoxy(18, txdown);
+						nc_gotoXY(18, txdown);
 						nc_printf("%c-%c", chrinverse, chrplain);
 						break;
 				}
 			}
 
 			if (gg.t.near_ && gg.t.inalpha)
-				nk_gotoxy(gg.t.ax, gg.t.ay);
+				nc_gotoXY(gg.t.ax, gg.t.ay);
 			else
 				noblink();
 
@@ -5431,10 +5425,10 @@ static void listlibrary()
 				{
 					if (lsp != NULL)
 					{
-						nk_gotoxy(0, txdown - 1);
+						nc_gotoXY(0, txdown - 1);
 						nc_putchar('\t');
 					}
-					nk_gotoxy(i * 10 + 2, j + 1);
+					nc_gotoXY(i * 10 + 2, j + 1);
 					if (P_getbits_UB(loadedgates, k - 1, 0, 3))
 						nc_putchar(chryellow);
 					nc_printf("%s%c", index_[k - 1], chrgreen);
@@ -5450,17 +5444,17 @@ static void listlibrary()
 						break;
 
 					case -2:
-						nk_gotoxy(49, txdown);
+						nc_gotoXY(49, txdown);
 						nc_printf("quit.");
 						break;
 
 					case -3:
-						nk_gotoxy(0, txdown);
+						nc_gotoXY(0, txdown);
 						nc_putchar('+');
 						break;
 
 					case -4:
-						nk_gotoxy(18, txdown);
+						nc_gotoXY(18, txdown);
 						nc_putchar('-');
 						break;
 				}
@@ -5481,7 +5475,7 @@ static void listlibrary()
 				if (readlibrary(index_[k - 1]) != 0)
 				{
 					remcursor();
-					nk_gotoxy(i * 10 + 2, j + 1);
+					nc_gotoXY(i * 10 + 2, j + 1);
 					nc_printf("%c%s%c", chryellow, index_[k - 1], chrgreen);
 				}
 			}
@@ -5786,7 +5780,7 @@ static void drawlabelline(long i, struct LOC_editattrs *LINK)
 static void eraselabelline(long i, struct LOC_editattrs *LINK)
 {
 	remcursor();
-	nk_gotoxy(0, (int)i);
+	nc_gotoXY(0, (int)i);
 	nc_putchar('\t');
 }
 
@@ -5812,7 +5806,7 @@ static void drawvalue(short i, int highlight, struct LOC_editattrs *LINK)
 	if (WITH->y < LINK->ybase || WITH->y > LINK->ybase + txdown)
 		return;
 	remcursor();
-	nk_gotoxy(WITH->x, WITH->y - LINK->ybase);
+	nc_gotoXY(WITH->x, WITH->y - LINK->ybase);
 	if (highlight)
 		nc_putchar(129);
 	/* Note: WRITE statement contains color/attribute characters [203] */
@@ -6386,7 +6380,7 @@ end;  */
 
 			if (!understood)
 			{
-				nk_gotoxy(V.kattr[V.p - 1].x, V.kattr[V.p - 1].y - V.ybase);
+				nc_gotoXY(V.kattr[V.p - 1].x, V.kattr[V.p - 1].y - V.ybase);
 				nc_putchar('\t');
 
 				if (ch == '\015')
@@ -7177,10 +7171,9 @@ static void adjustsignal(log_grec *g)
 {
 	char n[256];
 	uchar ch;
-	int savecaps, rightface;
+	int rightface;
 	char STR1[256], STR2[256];
 
-	savecaps = nk_setcapslock(signalcaps);
 	rightface = (g->kind->flag.U3.nright != (g->rot == 0));
 	gsignallabel(g->x, g->y, g, gg.color.backgr);
 	*n = '\0';
@@ -7256,7 +7249,6 @@ static void adjustsignal(log_grec *g)
 				(int)(g->y * gg.scale - gg.yoff - 3), strrtrim(strcpy(STR1, n)));
 	}
 	settofrom(&g, n);
-	signalcaps = nk_setcapslock(savecaps);
 }
 
 
@@ -8530,7 +8522,7 @@ static void historycommand()
 	uchar ch;
 	char name[256];
 	log_tool *tool;
-	int flag, rmflag, keyflag, savecaps;
+	int flag, rmflag, keyflag;
 	short scrollpos, scrollmin;
 	double newhistfirsttime;
 	int gridflag;
@@ -8541,7 +8533,6 @@ static void historycommand()
 	char STR3[256];
 	char TEMP7;
 
-	savecaps = nk_setcapslock(signalcaps);
 	remcursor();
 	clipoff();
 	V.vmenu1 = histdown + 5;
@@ -9027,7 +9018,6 @@ static void historycommand()
 			}
 		}
 	} while (strcmp((sprintf(STR2, "%c", ch), STR2), EXEC));
-	signalcaps = nk_setcapslock(savecaps);
 }
 
 #undef quit1pos
@@ -9169,9 +9159,9 @@ static void loadcommand()
 	else if (*gg.funcarg == '\0')
 	{
 		clearshowalpha();
-		nk_gotoxy(5, txdown - 1);
+		nc_gotoXY(5, txdown - 1);
 		nc_printf("Press ENTER alone to abort command.\n");
-		nk_gotoxy(2, txdown - 2);
+		nc_gotoXY(2, txdown - 2);
 		nc_printf("Name of file to load: ");
 		*filename = '\0';
 		ch = '\015';
@@ -9187,14 +9177,14 @@ static void loadcommand()
 				}
 				else
 				{
-					nk_gotoxy(x * 15 + 2, y + 2);
+					nc_gotoXY(x * 15 + 2, y + 2);
 					nc_printf("%c%s%c", chrinverse, dirs[x][y], chrplain);
 				}
 
 				if (gg.t.near_ && gg.t.inalpha)
-					nk_gotoxy(gg.t.ax, gg.t.ay);
+					nc_gotoXY(gg.t.ax, gg.t.ay);
 				else
-					nk_gotoxy((int)(strlen(filename) + 24), txdown - 2);
+					nc_gotoXY((int)(strlen(filename) + 24), txdown - 2);
 
 				nc_cursor_on();
 				do
@@ -9214,7 +9204,7 @@ if gg.t.y < 46 then y1 := 0; */
 				remcursor();
 				if (x != -1)
 				{
-					nk_gotoxy(x * 15 + 2, y + 2);
+					nc_gotoXY(x * 15 + 2, y + 2);
 					nc_puts(dirs[x][y]);
 				}
 			} while (!(pollkbd2() || gg.t.dn));
@@ -9222,7 +9212,7 @@ if gg.t.y < 46 then y1 := 0; */
 			if (gg.t.dn && x != -1)
 			{
 				strcpy(filename, dirs[x][y]);
-				nk_gotoxy(24, txdown - 2);
+				nc_gotoXY(24, txdown - 2);
 				nc_printf("%s\t", filename);
 			}
 
@@ -9233,13 +9223,13 @@ if gg.t.y < 46 then y1 := 0; */
 
 			if (ch == '\007' && *filename != '\0')
 			{
-				nk_gotoxy((int)(strlen(filename) + 23), txdown - 2);
+				nc_gotoXY((int)(strlen(filename) + 23), txdown - 2);
 				nc_putchar(' ');
 				filename[strlen(filename) - 1] = '\0';
 			}
 			else if (ch >= ' ' && ch <= '~' && strlen(filename) < 255)
 			{
-				nk_gotoxy((int)(strlen(filename) + 24), txdown - 2);
+				nc_gotoXY((int)(strlen(filename) + 24), txdown - 2);
 				nc_putchar(ch);
 				strcat(filename, " ");
 				filename[strlen(filename) - 1] = ch;
@@ -9410,7 +9400,7 @@ static void describe(long i, struct LOC_toolcommand *LINK)
 	if (LINK->ta[i] == NULL)
 		return;
 	remcursor();
-	nk_gotoxy(4, (int)i);
+	nc_gotoXY(4, (int)i);
 	if (LINK->ta[i]->ready)
 		nc_putchar(chryellow);
 	nc_printf("%16s   ", LINK->ta[i]->name);
@@ -9492,7 +9482,7 @@ static void toolcommand()
 					}
 
 					if (gg.t.near_ && gg.t.inalpha)
-						nk_gotoxy(gg.t.ax, gg.t.ay);
+						nc_gotoXY(gg.t.ax, gg.t.ay);
 					else
 						noblink();
 
@@ -9506,7 +9496,7 @@ static void toolcommand()
 						describe(j, &V);
 				}
 				while (!(gg.t.dn || pollkbd2()));
-				nk_gotoxy(0, txdown);
+				nc_gotoXY(0, txdown);
 
 				if (pollkbd2())
 					ch = toupper(inkey2());
@@ -9612,7 +9602,7 @@ static void status_log()
 		nc_printf("   Quiet mode %s", onoff(STR2, gg.quiet));
 		nc_printf("         Verbose mode %s", onoff(STR2, gg.verbose));
 		nc_printf("       Trace mode %s\n", onoff(STR2, gg.traceflag));
-		nk_gotoxy(0, txdown - 3);
+		nc_gotoXY(0, txdown - 3);
 		nc_printf("Use the arrow keys to view status pages.  Press the space bar to quit.\n");
 		status_oldtime = -1.0;
 		status_oldtstep = -1.0;
@@ -9621,7 +9611,7 @@ static void status_log()
 
 	if (labs(timers_sysclock() - gg.actx) > 50)
 	{
-		nk_gotoxy(25, 4);
+		nc_gotoXY(25, 4);
 		systime(&time);
 		nc_printf("%2d:%02d:%02ld", time.hour, time.minute, time.centisecond / 100L);
 		gg.actx = timers_sysclock();
@@ -9629,21 +9619,21 @@ static void status_log()
 
 	if (gg.time != status_oldtime)
 	{
-		nk_gotoxy(23, 7);
+		nc_gotoXY(23, 7);
 		nc_printf("%s\t", realunit(STR3, gg.time, 4, "sec", false));
 		status_oldtime = gg.time;
 	}
 
 	if (gg.prevtimestep != status_oldtstep)
 	{
-		nk_gotoxy(23, 8);
+		nc_gotoXY(23, 8);
 		nc_printf("%s\t", realunit(STR3, gg.prevtimestep, 4, "sec", false));
 		status_oldtstep = gg.prevtimestep;
 	}
 
 	if (gg.simstate == gg.oldsimstate && gg.simstatetool == gg.oldsimstatetool)
 		return;
-	nk_gotoxy(23, 9);
+	nc_gotoXY(23, 9);
 
 	switch (gg.simstate)
 	{
@@ -9855,7 +9845,7 @@ static void status_macro(int v)
 		{
 			if (mp != NULL)
 			{
-				nk_gotoxy((int)i, (int)j);
+				nc_gotoXY((int)i, (int)j);
 				ch = mp->key;
 				if (ch == '\007')
 					nc_printf("bs ");
@@ -9887,7 +9877,7 @@ static void status_macro(int v)
 
 	for (k=0; mp != NULL; k++, mp = mp->next)
 		;
-	nk_gotoxy((int)2, (int)txdown);
+	nc_gotoXY((int)2, (int)txdown);
 	nc_printf("[%d of %d]",((n+1)/(n_displayed/2))+1,(n_macros/n_displayed)+1);
 
 }
@@ -9968,7 +9958,7 @@ static void statusdisplay(char *name_)
 		savey = 0;
 		refrflag = false;
 		gg.actflag = true;
-		nk_gotoxy(0, 4);
+		nc_gotoXY(0, 4);
 		do
 		{
 			gg.actx = savex;
@@ -10046,7 +10036,7 @@ static void statusdisplay(char *name_)
 					break;
 			}
 			gg.actflag = false;
-			nk_gotoxy(9, 2);
+			nc_gotoXY(9, 2);
 		} while (!(refrflag || exitflag));
 	} while (!exitflag);
 	if (m_autoraise)
@@ -10967,10 +10957,10 @@ void dofunction()
 			}
 			m_alpha_on();
 			m_graphics_off();
-			nk_gotoxy(31, 10);
+			nc_gotoXY(31, 10);
 			nc_printf("%c%cExit from program? %c", chryellow, chrplain, chrgreen);
 			do
-				TEMP = nk_getkey();
+				TEMP = m_inkey();
 			while ((TEMP == 250)||(TEMP == 251));
 			if (TEMP == 'y' || TEMP == 'Y')
 			{
@@ -11677,8 +11667,6 @@ static void initialize()
 	gg.showpage = 1;
 	realcurpage = 1;
 	setvlsimode(vlsi);
-	labelcaps = true;
-	signalcaps = true;
 	XRebindKeysym(m_display, XStringToKeysym("BackSpace"), NULL, 0, (unsigned char * )"\007", 1);
 	gg.refrflag = true;
 	gg.markers = false;
@@ -11842,7 +11830,6 @@ int main(int argc, char * argv[])
 	tracefile = NULL;
 	dumpfile = NULL;
 	gg.initdone = false;
-	entrycapslock = nk_capslock;
 	gg.traceopen = false;
 	gg.dumpopen = false;
 	excpline = -1;
@@ -12113,7 +12100,6 @@ int main(int argc, char * argv[])
 			libf1[i - 1]->f = NULL;
 		}
 	}
-	nk_setcapslock(entrycapslock);
 	if (temp2 == 0)
 	{
 		showalpha();
@@ -12177,7 +12163,7 @@ int main(int argc, char * argv[])
 			nc_printf("Want debugging printout? ");
 			do
 			{
-				tempch = nk_getkey();
+				tempch = m_inkey();
 			} while (tempch != 'n' && tempch != 'N' && tempch != 'y' &&
 					tempch != 'Y');
 			nc_printf("%c\n", tempch);
@@ -12203,7 +12189,7 @@ int main(int argc, char * argv[])
 			nc_printf("Try to save page %ld? ", temp1);
 			do
 			{
-				tempch = nk_getkey();
+				tempch = m_inkey();
 			} while (tempch != 'n' && tempch != 'N' && tempch != 'y' &&
 					tempch != 'Y');
 			nc_printf("%c\n", tempch);
@@ -12220,7 +12206,6 @@ int main(int argc, char * argv[])
 	RECOVER(try44);
 	ENDTRY(try44);
 	closedumpfiles();
-	nk_setcapslock(entrycapslock);
 	showalpha();
 	cleanlog();
 	if (dumpfile != NULL)
diff --git a/src/logcom.c b/src/logcom.c
index 3aff601..ff0ee81 100644
--- a/src/logcom.c
+++ b/src/logcom.c
@@ -159,7 +159,7 @@ static void edit_1(uchar *proc, long *proclen, strlist_t **sl, long mode)
 		else
 			nc_puts(buf);
 		nc_printf("\n\nChange this? ");
-		ch = toupper(nk_getkey());
+		ch = toupper(m_inkey());
 		if (ch == 'Y')
 		{
 			nc_printf("\nNew name: ");
@@ -647,7 +647,7 @@ static void edit_7(uchar *proc, long *proclen, strlist_t **sl, long mode)
 		else
 			nc_puts(buf);
 		nc_printf("\n\nChange this? ");
-		ch = toupper(nk_getkey());
+		ch = toupper(m_inkey());
 		if (ch == 'Y') {
 			nc_printf("\nNew name: ");
 			nc_fgets(buf, 101, stdin);
diff --git a/src/loged.c b/src/loged.c
index 0280b9e..4b145c2 100644
--- a/src/loged.c
+++ b/src/loged.c
@@ -790,7 +790,7 @@ char *s;
   char ch;
 
   do {
-    ch = toupper(nk_getkey());
+    ch = toupper(m_inkey());
   } while (strposc(s, ch, 1L) == 0);
   nc_printf("%c\n", ch);
   return ch;
@@ -1724,7 +1724,7 @@ char *s_, *gname_;
 	  if (verify) {
 	    nc_printf("Load %s? ", name);
 	    do {
-	      ch = nk_getkey();
+	      ch = m_inkey();
 	    } while (ch != ' ' && ch != 'R' && ch != 'r' && ch != 'N' &&
 		     ch != 'n' && ch != 'Y' && ch != 'y');
 	    if (ch == ' ')
@@ -1999,7 +1999,7 @@ char *s_, *gname_;
 	  if (verify) {
 	    nc_printf("Load %s? ", name);
 	    do {
-	      ch = nk_getkey();
+	      ch = m_inkey();
 	    } while (ch != ' ' && ch != 'R' && ch != 'r' && ch != 'N' &&
 		     ch != 'n' && ch != 'Y' && ch != 'y');
 	    if (ch == ' ')
@@ -4462,7 +4462,7 @@ static void libcmd()
 	if (i > scrwidth - 10 && k != NULL) {
 	  nc_gotoXY(0, (int)(scrheight - 2));
 	  nc_printf("Press SPACE to continue, any letter to quit.  ");
-	  ch = nk_getkey();
+	  ch = m_inkey();
 	  i = 2;
 	}
       }
@@ -4471,7 +4471,7 @@ static void libcmd()
   }
   nc_gotoXY(0, (int)(scrheight - 2));
   nc_printf("Press SPACE to continue, any letter to quit.  ");
-  ch = nk_getkey();
+  ch = m_inkey();
   menuflag = true;
 }
 
diff --git a/src/logsim.c b/src/logsim.c
index 82d54b1..23dc97a 100644
--- a/src/logsim.c
+++ b/src/logsim.c
@@ -1270,7 +1270,7 @@ static void status_16(int *flag)
 	log_action_t *WITH;
 
 	WITH = logsima_action.lact;
-	nk_gotoxy(0, 4);
+	nc_gotoXY(0, 4);
 	(*WITH->hook.realunit)(nexttimebid, 4, "s", s);
 	nc_printf("Next time bid: %s\t\n", s);
 	nc_printf("Pass ready:    %5s\n", passready ? "TRUE" : "FALSE");
diff --git a/src/logsimed.c b/src/logsimed.c
index 6889853..f1a6738 100644
--- a/src/logsimed.c
+++ b/src/logsimed.c
@@ -1558,13 +1558,13 @@ static void showdef(struct LOC_edit_16 *LINK)
 				LINK->x = LINK->indent;
 			LINK->y = i;
 		}
-		nk_gotoxy(0, (int)i);
+		nc_gotoXY(0, (int)i);
 		if (LINK->indent != 0)
 			nc_printf("%*c", (int)LINK->indent, ' ');
 		dasminst(LINK);
 		if (i == 0)
 		{
-			nk_gotoxy(nc_curWindow->width - 10, 0);
+			nc_gotoXY(nc_curWindow->width - 10, 0);
 			nc_puts(LINK->name);
 		}
 	}
@@ -1671,7 +1671,7 @@ void edit_16(uchar **proc_, long *proclen_, char *name_)
 		else
 			nc_gotoXY((int)V.x, (int)V.y);
 
-		V.ch = nk_getkey();
+		V.ch = m_inkey();
 		if (V.ch == '?')
 		{
 			pc0 = 1;
@@ -1710,7 +1710,7 @@ void edit_16(uchar **proc_, long *proclen_, char *name_)
 				nc_printf("00\n");
 
 			nc_printf("Press any key to continue...");
-			V.ch = nk_getkey();
+			V.ch = m_inkey();
 			V.ch = '\0';
 			showdef(&V);              /* was 152 */
 		}
@@ -1784,7 +1784,7 @@ void edit_16(uchar **proc_, long *proclen_, char *name_)
 				V.x = 0;
 			if (V.y >= V.height)
 			{
-				nk_gotoxy(0, (int)V.height);
+				nc_gotoXY(0, (int)V.height);
 				nc_putchar('\n');
 				if ((*V.proc)[V.pctop - 1] < 32 &&
 						((1L << (*V.proc)[V.pctop - 1]) & 0x7ff8) != 0)
@@ -1797,9 +1797,9 @@ void edit_16(uchar **proc_, long *proclen_, char *name_)
 				V.y = V.height - 1;
 
 				if ((*V.proc)[V.pc - 1] < 32 && ((1L << (*V.proc)[V.pc - 1]) & 0x7ff8) != 0)
-					nk_gotoxy((int)(V.x + 3), (int)V.height);
+					nc_gotoXY((int)(V.x + 3), (int)V.height);
 				else
-					nk_gotoxy((int)V.x, (int)V.height);
+					nc_gotoXY((int)V.x, (int)V.height);
 
 				pc0 = V.pc;
 				V.pc += length_16(*V.proc, V.pc);
@@ -1839,12 +1839,12 @@ void edit_16(uchar **proc_, long *proclen_, char *name_)
 				}
 				else
 				{
-					nk_gotoxy(nc_curWindow->width - 10, 0);
+					nc_gotoXY(nc_curWindow->width - 10, 0);
 					nc_printf("%8c", ' ');
-					nk_gotoxy(0, 0);
+					nc_gotoXY(0, 0);
 					nc_putchar('\037');
 					V.y = 1;
-					nk_gotoxy((int)V.indtop, 0);
+					nc_gotoXY((int)V.indtop, 0);
 					if ((*V.proc)[V.pctop - 1] == '\002')
 						nc_printf("   ");
 					V.pc = V.pctop;
diff --git a/src/logstuff.c b/src/logstuff.c
index bceeb05..e333cd9 100644
--- a/src/logstuff.c
+++ b/src/logstuff.c
@@ -169,13 +169,6 @@ void m_putcpicture()
 {
 }
 
-
-int nk_setcapslock(int newval)
-{
-  return false;
-}
-
-
 void nc_cursXY(int x, int y)
 {
 }
diff --git a/src/window.c b/src/window.c
index 4934f84..6be723d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -160,7 +160,7 @@ void clearalpha()
 		noblink();
 		m_alpha_off();
 	}
-	nk_gotoxy(0, 0);
+	nc_gotoXY(0, 0);
 }
 
 
@@ -691,7 +691,7 @@ void clearshowalpha()
 	if (onescreen)
 		clearwindow();
 	nc_printf("\f");
-	nk_gotoxy(0, 0);
+	nc_gotoXY(0, 0);
 	noblink();
 	showalpha();
 }
@@ -2083,7 +2083,7 @@ void beginbottom()
 	{
 		clearalpha();
 	}
-	nk_gotoxy(0, txdown - 1);
+	nc_gotoXY(0, txdown - 1);
 }
 
 
-- 
GitLab