diff --git a/include/logcom.h b/include/logcom.h
index fa86416268716146d389a74129fb8d6d4143057c..c92bb24fd982c5513e2009d77855c2bb91340598 100644
--- a/include/logcom.h
+++ b/include/logcom.h
@@ -8,16 +8,16 @@
 #include <graphics/newci.h>
 #include <utils/sysdevs.h>
 
-extern void Log_0_proc (log_action_t *act);
-extern void Log_1_proc (log_action_t *act);
+void Log_0_proc (log_action_t *act);
+void Log_1_proc (log_action_t *act);
 /*obsolete*/
-extern void Log_2_proc (log_action_t *act);
-extern void Log_7_proc (log_action_t *act);
+void Log_2_proc (log_action_t *act);
+void Log_7_proc (log_action_t *act);
 
-extern void Log_17_proc (log_action_t *act);
+void Log_17_proc (log_action_t *act);
 
 
-extern void Log_7_time (log_action_t *act);
+void Log_7_time (log_action_t *act);
 
 
 #endif /*LOGCOM_H*/
diff --git a/src/logcom.c b/src/logcom.c
index e0af9bb4b0825447df8aded650c66f3c7bdf11a2..84c8d3c4486d5a7e45201b489e6464192039e9ff 100644
--- a/src/logcom.c
+++ b/src/logcom.c
@@ -1,7 +1,3 @@
-/* Output from p2c, the Pascal-to-C translator */
-/* From input file "logcom.text" */
-
-
 /* "LOG", the circuit editing and simulation system,
    "DigLOG", the digital simulator for LOG.
    Copyright (C) 1985, 1990 David Gillespie.
@@ -11,25 +7,25 @@
    Copyright (C) 1985, 1990 John Lazzaro.
    Author's address: lazzaro@csvax.caltech.edu; 256-80 Caltech.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation (any version).
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation (any version).
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
+   You should have received a copy of the GNU General Public License
+   along with this program; see the file COPYING.  If not, write to
+   the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
 
 /*
 
-      LOG 4.0   Built-in tools module
+   LOG 4.0   Built-in tools module
 
-      David Gillespie  7/15/85
+   David Gillespie  7/15/85
 
 */
 
@@ -59,22 +55,22 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 typedef struct _REC_timeinfoarr {
-  short y, y0;
+	short y, y0;
 } _REC_timeinfoarr;
 
 typedef _REC_timeinfoarr timeinfoarr[timeattrs];
 
 typedef struct timeattrrec {
-  char *disp, *disp0;
-  short dtype;
-  union {
-    struct {
-      long i, i0;
-    } U1;
-    struct {
-      double r, r0;
-    } U2;
-  } UU;
+	char *disp, *disp0;
+	short dtype;
+	union {
+		struct {
+			long i, i0;
+		} U1;
+		struct {
+			double r, r0;
+		} U2;
+	} UU;
 } timeattrrec;
 
 typedef timeattrrec timeattrarr[timeattrs];
@@ -98,109 +94,127 @@ static int unfoundshown;
 
 
 
-void Log_0_proc(act)
-log_action_t *act;
+void Log_0_proc(log_action_t *act)
 {
-  switch (act->action) {
+	switch (act->action)
+	{
 
-  case act_init:
-    act->acttool->simulator = true;
-    act->acttool->ready = true;
-    act->acttool->nostatus = true;
-    break;
+		case act_init:
+			act->acttool->simulator = true;
+			act->acttool->ready = true;
+			act->acttool->nostatus = true;
+			break;
 
-  default:
-    break;
-  }
+		default:
+			break;
+	}
 }
 
-static void edit_1(proc, proclen, sl, mode)
-uchar *proc;
-long *proclen;
-strlist_t **sl;
-long mode;
+static void edit_1(uchar *proc, long *proclen, strlist_t **sl, long mode)
 {
-  long i;
-  strlist_t *l1;
-  char buf[9];
-  char ch;
-  char STR1[22];
-  char STR2[256];
-  char STR3[256];
-  char *TEMP;
-  long FORLIM;
-
-  *buf = '\0';
-  i = 1;
-  while (i <= 8 && proc[i - 1] != '\0') {
-    if (proc[i - 1] < ' ') {
-      *buf = '\0';
-      i = 20;
-    } else {
-      sprintf(buf + strlen(buf), "%c", proc[i - 1]);
-      i++;
-    }
-  }
-  if ((unsigned long)mode < 32 && ((1L << mode) & 0x6) != 0) {
-    if (mode == 1 && *buf == '\0')
-      strcpy(buf, "(none)");
-    sprintf(STR1, "Signal name: %s", buf);
-    l1 = strlist_insert(sl, STR1);
-    return;
-  }
-  if (mode == 0) {
-    nc_printf("\f");
-    nc_printf("Common-node gate\n\n");
-    nc_printf("Current signal name: ");
-    if (*buf == '\0')
-      nc_printf("(no name)");
-    else
-      nc_puts(buf);
-    nc_printf("\n\nChange this? ");
-    ch = toupper(nk_getkey());
-    if (ch == 'Y') {
-      nc_printf("\nNew name: ");
-      nc_fgets(buf, 9, stdin);
-      TEMP = (char *) strchr(buf, '\n');
-      if (TEMP != NULL)
-	*TEMP = 0;
-    }
-  } else if (mode == 3) {
-    if (*sl != NULL && !strncmp((*sl)->s, "Signal name: ", 13L)) {
-      strsub(buf, (*sl)->s, 14, 8);
-      ch = 'Y';
-    } else
-      ch = 'N';
-  } else
-    ch = 'N';
-  if (ch != 'Y')
-    return;
-  strcpy(STR3, strltrim(strrtrim(strcpy(STR2, buf))));
-  strcpy(buf, STR3);
-  FORLIM = strlen(buf);
-  for (i = 0; i < FORLIM; i++)
-    proc[i] = buf[i];
-  proc[strlen(buf)] = '\0';
+	long i;
+	strlist_t *l1;
+	char buf[9];
+	char ch;
+	char STR1[22];
+	char STR2[256];
+	char STR3[256];
+	char *TEMP;
+	long FORLIM;
+
+	*buf = '\0';
+	i = 1;
+	while (i <= 8 && proc[i - 1] != '\0')
+	{
+		if (proc[i - 1] < ' ')
+		{
+			*buf = '\0';
+			i = 20;
+		}
+		else
+		{
+			sprintf(buf + strlen(buf), "%c", proc[i - 1]);
+			i++;
+		}
+	}
+
+	if ((unsigned long)mode < 32 && ((1L << mode) & 0x6) != 0)
+	{
+		if (mode == 1 && *buf == '\0')
+			strcpy(buf, "(none)");
+		sprintf(STR1, "Signal name: %s", buf);
+		l1 = strlist_insert(sl, STR1);
+		return;
+	}
+
+	if (mode == 0)
+	{
+		nc_printf("\f");
+		nc_printf("Common-node gate\n\n");
+		nc_printf("Current signal name: ");
+		if (*buf == '\0')
+			nc_printf("(no name)");
+		else
+			nc_puts(buf);
+		nc_printf("\n\nChange this? ");
+		ch = toupper(nk_getkey());
+		if (ch == 'Y')
+		{
+			nc_printf("\nNew name: ");
+			nc_fgets(buf, 9, stdin);
+			TEMP = (char *) strchr(buf, '\n');
+			if (TEMP != NULL)
+				*TEMP = 0;
+		}
+	}
+	else if (mode == 3)
+	{
+		if (*sl != NULL && !strncmp((*sl)->s, "Signal name: ", 13L))
+		{
+			strsub(buf, (*sl)->s, 14, 8);
+			ch = 'Y';
+		}
+		else
+		{
+			ch = 'N';
+		}
+	}
+	else
+	{
+		ch = 'N';
+	}
+
+	if (ch != 'Y')
+		return;
+	
+	strcpy(STR3, strltrim(strrtrim(strcpy(STR2, buf))));
+	strcpy(buf, STR3);
+	FORLIM = strlen(buf);
+	
+	for (i = 0; i < FORLIM; i++)
+		proc[i] = buf[i];
+	
+	proc[strlen(buf)] = '\0';
 }
 
-void Log_1_proc(act)
-log_action_t *act;
+void Log_1_proc(log_action_t *act)
 {
-  switch (act->action) {
+	switch (act->action)
+	{
 
-  case act_init:
-    act->acttool->simulator = true;
-    act->acttool->ready = true;
-    act->acttool->nostatus = true;
-    break;
+		case act_init:
+			act->acttool->simulator = true;
+			act->acttool->ready = true;
+			act->acttool->nostatus = true;
+			break;
 
-  case act_edit:
-    edit_1(act->actproc, &act->actx, &act->actstrlist, act->acty);
-    break;
+		case act_edit:
+			edit_1(act->actproc, &act->actx, &act->actstrlist, act->acty);
+			break;
 
-  default:
-    break;
-  }
+		default:
+			break;
+	}
 }
 
 
@@ -209,621 +223,669 @@ log_action_t *act;
 
 /* variables for Log_7_time: */
 struct LOC_Log_7_time {
-  log_action_t *act;
-  short x, y;
+	log_action_t *act;
+	short x, y;
 } ;
 
-void displaystate(state, LINK)
-log_simstatekinds state;
-struct LOC_Log_7_time *LINK;
+void displaystate(log_simstatekinds state, struct LOC_Log_7_time *LINK)
 {
-  switch (state) {
+	switch (state)
+	{
 
-  case simst_off:
-    m_color((long)log_black);
-    break;
+		case simst_off:
+			m_color((long)log_black);
+			break;
 
-  case simst_notready:
-    m_color((long)log_red);
-    break;
+		case simst_notready:
+			m_color((long)log_red);
+			break;
 
-  case simst_notactive:
-    m_color((long)log_orange);
-    break;
+		case simst_notactive:
+			m_color((long)log_orange);
+			break;
 
-  case simst_running:
-    m_color((long)log_yellow);
-    break;
+		case simst_running:
+			m_color((long)log_yellow);
+			break;
 
-  default:
-    m_color((long)LINK->act->color.backgr);
-    break;
-  }
-  m_fillrect(LINK->x - 3L, LINK->y - 3L, LINK->x + 3L, LINK->y + 3L);
+		default:
+			m_color((long)LINK->act->color.backgr);
+			break;
+	}
+	m_fillrect(LINK->x - 3L, LINK->y - 3L, LINK->x + 3L, LINK->y + 3L);
 }
 
-int attrsame(i, LINK)
-long i;
-struct LOC_Log_7_time *LINK;
+int attrsame(long i, struct LOC_Log_7_time *LINK)
 {
-  int Result;
+	int Result;
 
-  switch (timeattr[i - 1].dtype) {
+	switch (timeattr[i - 1].dtype)
+	{
 
-  case 1:
-     Result = (timeattr[i - 1].UU.U2.r == timeattr[i - 1].UU.U2.r0);
-    break;
+		case 1:
+			Result = (timeattr[i - 1].UU.U2.r == timeattr[i - 1].UU.U2.r0);
+			break;
 
-  case 2:
-    Result = (timeattr[i - 1].UU.U1.i == timeattr[i - 1].UU.U1.i0);
-    break;
-  }
-  return Result;
+		case 2:
+			Result = (timeattr[i - 1].UU.U1.i == timeattr[i - 1].UU.U1.i0);
+			break;
+	}
+	return Result;
 }
 
-void touchwatch(g, LINK)
-log_grec *g;
-struct LOC_Log_7_time *LINK;
+void touchwatch(log_grec *g, struct LOC_Log_7_time *LINK)
 {
-  if (watchflag) {
-    watchflag = false;
-    return;
-  }
-  watchflag = true;
-  watchtime = sysclock();
-  if (g == NULL || g->attr[attr_watch - 1].UU.b)
-    return;
-  g->attr[attr_watch - 1].UU.b = true;
-  timechanged = true;
-  g->vars = (na_long)(((long)g->vars) | 1);
+	if (watchflag)
+	{
+		watchflag = false;
+		return;
+	}
+
+	watchflag = true;
+	watchtime = sysclock();
+
+	if (g == NULL || g->attr[attr_watch - 1].UU.b)
+		return;
+	g->attr[attr_watch - 1].UU.b = true;
+	timechanged = true;
+	g->vars = (na_long)(((long)g->vars) | 1);
 }
 
-void checkcolors(LINK)
-struct LOC_Log_7_time *LINK;
+void checkcolors(struct LOC_Log_7_time *LINK)
 {
-  (*LINK->act->hook.getcolor)("TIME", &timecolor, log_dyellow);
+	(*LINK->act->hook.getcolor)("TIME", &timecolor, log_dyellow);
 }
 
-void Log_7_time(act_)
-log_action_t *act_;
+void Log_7_time(log_action_t *act_)
 {
-  struct LOC_Log_7_time V;
-  short i, i1, i2, i3;
-  int refr, draw;
-  log_action_t *WITH;
-  char STR1[256];
-  char STR2[256], STR3[256];
-
-  V.act = act_;
-  WITH = V.act;
-  switch (WITH->action) {
-
-  case act_newkind:
-    oldoldsimstate = simst_null;
-    perftime = 0;
-    for (i = 0; i <= 2; i++) {
-      timeattr[i].dtype = 1;
-      timeattr[i].UU.U2.r = 0;
-      timeattr[i].UU.U2.r0 = 0;
-    }
-    for (i = 3; i <= 5; i++) {
-      timeattr[i].dtype = 2;
-      timeattr[i].UU.U1.i = 0.0;
-      timeattr[i].UU.U1.i0 = 0.0;
-    }
-    for (i = 0; i < timeattrs; i++) {
-      timeattr[i].disp = (char *)Malloc(81);
-      *timeattr[i].disp = '\0';
-      timeattr[i].disp0 = (char *)Malloc(81);
-      *timeattr[i].disp0 = '\0';
-    }
-    watchflag = false;
-    timeexists = false;
-    timechanged = true;
-    timeinit = true;
-    checkcolors(&V);
-    break;
-
-  case act_color:
-    checkcolors(&V);
-    break;
-
-  case act_pass:
-    if (WITH->actgate == NULL) {
-      if (timeexists || timeinit) {
-	for (i = 0; i < timeattrs; i++) {
-	  switch (timeattr[i].dtype) {
-
-	  case 1:
-	    timeattr[i].UU.U2.r0 = timeattr[i].UU.U2.r;
-	    break;
-
-	  case 2:
-	    timeattr[i].UU.U1.i0 = timeattr[i].UU.U1.i;
-	    break;
-	  }
-	  strcpy(timeattr[i].disp0, timeattr[i].disp);
-	}
-	timeattr[attr_time - 1].UU.U2.r = WITH->time;
-	timeattr[attr_tstep - 1].UU.U2.r = WITH->prevtimestep;
-	if (WITH->oldsimstate == simst_running) {
-	  perftime = sysclock();
-	  timeattr[attr_perf - 1].UU.U2.r = (perftime - oldperftime) / 100.0;
-	  oldperftime = perftime;
-	}
-	timeattr[attr_fast - 1].UU.U1.i = WITH->fastspeed;
-	timeattr[attr_clock - 1].UU.U1.i = sysclock() / 100;
-	if (watchflag)
-	  timeattr[attr_watch - 1].UU.U1.i = sysclock() - watchtime;
-	refr = (WITH->refrflag || timechanged);
-	draw = (refr || WITH->oldsimstate != oldoldsimstate);
-	for (i = 0; i < timeattrs; i++) {
-	  if (!attrsame((long)(i + 1), &V) || timeinit) {
-	    switch (i + 1) {
-
-	    case attr_time:
-	    case attr_tstep:
-	    case attr_perf:
-	      (*V.act->hook.realunit2)(timeattr[i].UU.U2.r, 4, "s",
-				       timeattr[i].disp);
-	      break;
-
-	    case attr_fast:
-	      sprintf(STR1, "%ld", timeattr[i].UU.U1.i);
-	      strcpy(timeattr[i].disp, STR1);
-	      break;
-
-	    case attr_clock:
-	      i1 = timeattr[i].UU.U1.i / 3600;
-	      V.x = timeattr[i].UU.U1.i % 3600;
-/* p2c: logcom.text, line 328:
- * Note: Using % for possibly-negative arguments [317] */
-	      i2 = V.x / 60;
-	      i3 = V.x % 60;
-	      sprintf(STR3, "%02d:%02d:%02d", i1, i2, i3);
-/* p2c: logcom.text, line 330:
- * Note: Using % for possibly-negative arguments [317] */
-	      strcpy(timeattr[i].disp, STR3);
-	      break;
-
-	    case attr_watch:
-	      i1 = timeattr[i].UU.U1.i / 6000;
-	      V.x = timeattr[i].UU.U1.i % 6000;
-/* p2c: logcom.text, line 338:
- * Note: Using % for possibly-negative arguments [317] */
-	      i2 = V.x / 100;
-	      i3 = V.x % 100;
-	      sprintf(STR2, "%02d:%02d.%02d", i1, i2, i3);
-/* p2c: logcom.text, line 340:
- * Note: Using % for possibly-negative arguments [317] */
-	      strcpy(timeattr[i].disp, STR2);
-	      break;
-
-	    }
-	    draw = true;
-	  }
-	}
-	drawtime = draw;
-	refrtime = refr;
-	old3simstate = oldoldsimstate;
-	oldoldsimstate = WITH->oldsimstate;
-	timechanged = false;
-	timeinit = false;
-      } else
-	drawtime = false;
-    } else if (WITH->actflag && drawtime) {
-      timeinfo = (_REC_timeinfoarr *)WITH->actgate->info;
-      for (i = 0; i < timeattrs; i++)
-	timeinfo[i].y0 = timeinfo[i].y;
-      if (((long)WITH->actgate->vars) & 1) {
-	V.y = ystart;
-	for (i = 0; i < timeattrs; i++) {
-	  if (WITH->actgate->attr[i].UU.b) {
-	    timeinfo[i].y = V.y;
-	    V.y += yincr;
-	  } else
-	    timeinfo[i].y = -1;
+	struct LOC_Log_7_time V;
+	short i, i1, i2, i3;
+	int refr, draw;
+	log_action_t *WITH;
+	char STR1[256];
+	char STR2[256], STR3[256];
+
+	V.act = act_;
+	WITH = V.act;
+	switch (WITH->action)
+	{
+
+		case act_newkind:
+			oldoldsimstate = simst_null;
+			perftime = 0;
+			for (i = 0; i <= 2; i++)
+			{
+				timeattr[i].dtype = 1;
+				timeattr[i].UU.U2.r = 0;
+				timeattr[i].UU.U2.r0 = 0;
+			}
+
+			for (i = 3; i <= 5; i++)
+			{
+				timeattr[i].dtype = 2;
+				timeattr[i].UU.U1.i = 0.0;
+				timeattr[i].UU.U1.i0 = 0.0;
+			}
+
+			for (i = 0; i < timeattrs; i++) {
+				timeattr[i].disp = (char *)Malloc(81);
+				*timeattr[i].disp = '\0';
+				timeattr[i].disp0 = (char *)Malloc(81);
+				*timeattr[i].disp0 = '\0';
+			}
+
+			watchflag = false;
+			timeexists = false;
+			timechanged = true;
+			timeinit = true;
+			checkcolors(&V);
+			break;
+
+		case act_color:
+			checkcolors(&V);
+			break;
+
+		case act_pass:
+			if (WITH->actgate == NULL)
+			{
+				if (timeexists || timeinit)
+				{
+					for (i = 0; i < timeattrs; i++)
+					{
+						switch (timeattr[i].dtype)
+						{
+
+							case 1:
+								timeattr[i].UU.U2.r0 = timeattr[i].UU.U2.r;
+								break;
+
+							case 2:
+								timeattr[i].UU.U1.i0 = timeattr[i].UU.U1.i;
+								break;
+						}
+						strcpy(timeattr[i].disp0, timeattr[i].disp);
+					}
+					timeattr[attr_time - 1].UU.U2.r = WITH->time;
+					timeattr[attr_tstep - 1].UU.U2.r = WITH->prevtimestep;
+					if (WITH->oldsimstate == simst_running)
+					{
+						perftime = sysclock();
+						timeattr[attr_perf - 1].UU.U2.r = (perftime - oldperftime) / 100.0;
+						oldperftime = perftime;
+					}
+					timeattr[attr_fast - 1].UU.U1.i = WITH->fastspeed;
+					timeattr[attr_clock - 1].UU.U1.i = sysclock() / 100;
+
+					if (watchflag)
+						timeattr[attr_watch - 1].UU.U1.i = sysclock() - watchtime;
+					refr = (WITH->refrflag || timechanged);
+					draw = (refr || WITH->oldsimstate != oldoldsimstate);
+					for (i = 0; i < timeattrs; i++)
+					{
+						if (!attrsame((long)(i + 1), &V) || timeinit)
+						{
+							switch (i + 1)
+							{
+
+								case attr_time:
+								case attr_tstep:
+								case attr_perf:
+									(*V.act->hook.realunit2)(timeattr[i].UU.U2.r, 4, "s",
+											timeattr[i].disp);
+									break;
+
+								case attr_fast:
+									sprintf(STR1, "%ld", timeattr[i].UU.U1.i);
+									strcpy(timeattr[i].disp, STR1);
+									break;
+
+								case attr_clock:
+									i1 = timeattr[i].UU.U1.i / 3600;
+									V.x = timeattr[i].UU.U1.i % 3600;
+									i2 = V.x / 60;
+									i3 = V.x % 60;
+									sprintf(STR3, "%02d:%02d:%02d", i1, i2, i3);
+									strcpy(timeattr[i].disp, STR3);
+									break;
+
+								case attr_watch:
+									i1 = timeattr[i].UU.U1.i / 6000;
+									V.x = timeattr[i].UU.U1.i % 6000;
+									i2 = V.x / 100;
+									i3 = V.x % 100;
+									sprintf(STR2, "%02d:%02d.%02d", i1, i2, i3);
+									strcpy(timeattr[i].disp, STR2);
+									break;
+
+							}
+							draw = true;
+						}
+					}
+					drawtime = draw;
+					refrtime = refr;
+					old3simstate = oldoldsimstate;
+					oldoldsimstate = WITH->oldsimstate;
+					timechanged = false;
+					timeinit = false;
+				}
+				else
+				{
+					drawtime = false;
+				}
+			}
+			else if (WITH->actflag && drawtime)
+			{
+				timeinfo = (_REC_timeinfoarr *)WITH->actgate->info;
+				for (i = 0; i < timeattrs; i++)
+					timeinfo[i].y0 = timeinfo[i].y;
+				if (((long)WITH->actgate->vars) & 1)
+				{
+					V.y = ystart;
+					for (i = 0; i < timeattrs; i++)
+					{
+						if (WITH->actgate->attr[i].UU.b)
+						{
+							timeinfo[i].y = V.y;
+							V.y += yincr;
+						}
+						else
+						{
+							timeinfo[i].y = -1;
+						}
+					}
+					WITH->actgate->vars = (na_long)(V.y * 2);
+				}
+				V.x = 0;
+				V.y = 0;
+				(*V.act->hook.xform)(WITH->actgate, &V.x, &V.y);
+				(*V.act->hook.hidecursorrect)(V.x - 50L, V.y - 3L, V.x + 50L,
+						V.y + (long)WITH->actgate->vars / 2L);
+				m_color((long)WITH->color.backgr);
+				for (i = 0; i < timeattrs; i++)
+				{
+					if ((refrtime || strcmp(timeattr[i].disp0, timeattr[i].disp)) &&
+							timeinfo[i].y0 > 0)
+						m_centerstr((long)V.x, (long)(V.y + timeinfo[i].y0), NULL,
+								timeattr[i].disp0);
+				}
+				m_color((long)timecolor);
+				for (i = 0; i < timeattrs; i++)
+				{
+					if ((refrtime || strcmp(timeattr[i].disp0, timeattr[i].disp)) &&
+							timeinfo[i].y > 0)
+						m_centerstr((long)V.x, (long)(V.y + timeinfo[i].y), NULL,
+								timeattr[i].disp);
+				}
+
+				if (old3simstate != oldoldsimstate || refr)
+					displaystate(oldoldsimstate, &V);
+				(*V.act->hook.unhidecursor)();
+			}
+			break;
+
+		case act_erasegate:
+			timeinfo = (_REC_timeinfoarr *)WITH->actgate->info;
+			V.x = 0;
+			V.y = 0;
+			(*WITH->hook.xform)(WITH->actgate, &V.x, &V.y);
+			m_color((long)WITH->color.backgr);
+			for (i = 0; i < timeattrs; i++)
+			{
+				if (timeinfo[i].y > 0)
+					m_centerstr((long)V.x, (long)(V.y + timeinfo[i].y), NULL,
+							timeattr[i].disp);
+			}
+			displaystate(simst_null, &V);
+			break;
+
+		case act_newgate:
+		case act_copygate:
+			timeinfo = (_REC_timeinfoarr *)Malloc(sizeof(timeinfoarr));
+			WITH->actgate->info = (void *)timeinfo;
+			for (i = 0; i < timeattrs; i++)
+				timeinfo[i].y = -1;
+			timeexists = true;
+			timechanged = true;
+			WITH->actgate->vars = (na_long)(((long)WITH->actgate->vars) | 1);
+			break;
+
+		case act_readgate:  /*vars was read in since newgate*/
+			WITH->actgate->vars = (na_long)(((long)WITH->actgate->vars) | 1);
+			break;
+
+		case act_disposegate:
+			timeinfo = (_REC_timeinfoarr *)WITH->actgate->info;
+			Free(timeinfo);
+			break;
+
+		case act_configchgate:
+			timechanged = true;
+			WITH->actgate->vars = (na_long)(((long)WITH->actgate->vars) | 1);
+			break;
+
+		case act_touchgate:
+			if (WITH->actx == 2 && WITH->acty == 2)
+			{
+				touchwatch(WITH->actgate, &V);
+				WITH->actflag = true;
+			}
+			break;
+
+		case act_func:
+			if (!strcmp(WITH->func, "STOPWATCH"))
+			{
+				touchwatch(NULL, &V);
+				(*WITH->hook.clearfunc)();
+			}
+			break;
+
+		default:
+			break;
 	}
-	WITH->actgate->vars = (na_long)(V.y * 2);
-      }
-      V.x = 0;
-      V.y = 0;
-      (*V.act->hook.xform)(WITH->actgate, &V.x, &V.y);
-      (*V.act->hook.hidecursorrect)(V.x - 50L, V.y - 3L, V.x + 50L,
-				    V.y + (long)WITH->actgate->vars / 2L);
-      m_color((long)WITH->color.backgr);
-      for (i = 0; i < timeattrs; i++) {
-	if ((refrtime || strcmp(timeattr[i].disp0, timeattr[i].disp)) &&
-	    timeinfo[i].y0 > 0)
-	  m_centerstr((long)V.x, (long)(V.y + timeinfo[i].y0), NULL,
-		      timeattr[i].disp0);
-      }
-      m_color((long)timecolor);
-      for (i = 0; i < timeattrs; i++) {
-	if ((refrtime || strcmp(timeattr[i].disp0, timeattr[i].disp)) &&
-	    timeinfo[i].y > 0)
-	  m_centerstr((long)V.x, (long)(V.y + timeinfo[i].y), NULL,
-		      timeattr[i].disp);
-      }
-      if (old3simstate != oldoldsimstate || refr)
-	displaystate(oldoldsimstate, &V);
-      (*V.act->hook.unhidecursor)();
-    }
-    break;
-
-  case act_erasegate:
-    timeinfo = (_REC_timeinfoarr *)WITH->actgate->info;
-    V.x = 0;
-    V.y = 0;
-    (*WITH->hook.xform)(WITH->actgate, &V.x, &V.y);
-    m_color((long)WITH->color.backgr);
-    for (i = 0; i < timeattrs; i++) {
-      if (timeinfo[i].y > 0)
-	m_centerstr((long)V.x, (long)(V.y + timeinfo[i].y), NULL,
-		    timeattr[i].disp);
-    }
-    displaystate(simst_null, &V);
-    break;
-
-  case act_newgate:
-  case act_copygate:
-    timeinfo = (_REC_timeinfoarr *)Malloc(sizeof(timeinfoarr));
-    WITH->actgate->info = (void *)timeinfo;
-    for (i = 0; i < timeattrs; i++)
-      timeinfo[i].y = -1;
-    timeexists = true;
-    timechanged = true;
-    WITH->actgate->vars = (na_long)(((long)WITH->actgate->vars) | 1);
-    break;
-
-  case act_readgate:  /*vars was read in since newgate*/
-    WITH->actgate->vars = (na_long)(((long)WITH->actgate->vars) | 1);
-    break;
-
-  case act_disposegate:
-    timeinfo = (_REC_timeinfoarr *)WITH->actgate->info;
-    Free(timeinfo);
-    break;
-
-  case act_configchgate:
-    timechanged = true;
-    WITH->actgate->vars = (na_long)(((long)WITH->actgate->vars) | 1);
-    break;
-
-  case act_touchgate:
-    if (WITH->actx == 2 && WITH->acty == 2) {
-      touchwatch(WITH->actgate, &V);
-      WITH->actflag = true;
-    }
-    break;
-
-  case act_func:
-    if (!strcmp(WITH->func, "STOPWATCH")) {
-      touchwatch(NULL, &V);
-      (*WITH->hook.clearfunc)();
-    }
-    break;
-
-  default:
-    break;
-  }
 }
 
 #undef ystart
 #undef yincr
 
 
-
-void Log_2_proc(act)
-log_action_t *act;
+void Log_2_proc(log_action_t *act)
 {
-  log_grec *g;
-
-  if (act->action == act_init) {
-    act->acttool->simulator = true;
-    act->acttool->ready = true;
-    act->acttool->nostatus = true;
-    return;
-  }
-  if (act->action != act_pass) {
-    Log_7_time(act);
-    return;
-  }
-  act->actgate = NULL;
-  Log_7_time(act);
-  if (act->showpage <= 0)
-    return;
-  g = act->pages[act->showpage - 1]->gbase;
-  while (g != NULL) {
-    if (g->kind->simtype == act->acttool) {
-      act->actgate = g;
-      act->actflag = true;
-      Log_7_time(act);
-    }
-    g = g->next;
-  }
-}
+	log_grec *g;
+
+	if (act->action == act_init)
+	{
+		act->acttool->simulator = true;
+		act->acttool->ready = true;
+		act->acttool->nostatus = true;
+		return;
+	}
 
+	if (act->action != act_pass)
+	{
+		Log_7_time(act);
+		return;
+	}
 
+	act->actgate = NULL;
+	Log_7_time(act);
+	if (act->showpage <= 0)
+		return;
 
+	g = act->pages[act->showpage - 1]->gbase;
+	while (g != NULL) {
+		if (g->kind->simtype == act->acttool)
+		{
+			act->actgate = g;
+			act->actflag = true;
+			Log_7_time(act);
+		}
+		g = g->next;
+	}
+}
 
 
-static char *proc_name_7(Result, proc)
-char *Result;
-uchar *proc;
+static char *proc_name_7(char *Result, uchar *proc)
 {
-  long i;
-  char buf[256];
-
-  *buf = '\0';
-  i = 2;
-  while (i <= 100 && proc[i - 1] != '\0') {
-    if (proc[i - 1] <= ' ' || proc[i - 1] > '\177') {
-      *buf = '\0';
-      i = 200;
-    } else {
-      sprintf(buf + strlen(buf), "%c", proc[i - 1]);
-      i++;
-    }
-  }
-  return (strupper(Result, buf));
+	long i;
+	char buf[256];
+
+	*buf = '\0';
+	i = 2;
+	while (i <= 100 && proc[i - 1] != '\0')
+	{
+		if (proc[i - 1] <= ' ' || proc[i - 1] > '\177')
+		{
+			*buf = '\0';
+			i = 200;
+		}
+		else
+		{
+			sprintf(buf + strlen(buf), "%c", proc[i - 1]);
+			i++;
+		}
+	}
+	return (strupper(Result, buf));
 }
 
 
-
-
-static void edit_7(proc, proclen, sl, mode)
-uchar *proc;
-long *proclen;
-strlist_t **sl;
-long mode;
+static void edit_7(uchar *proc, long *proclen, strlist_t **sl, long mode)
 {
-  long i;
-  strlist_t *l1;
-  char buf[101];
-  char ch;
-  char STR1[118];
-  char STR2[256];
-  char STR3[256];
-  char *TEMP;
-  long FORLIM;
-
-  if (proc[0] != '\001') {
-    proc[0] = '\001';
-    proc[1] = '\0';
-  }
-  proc_name_7(buf, proc);
-  if ((unsigned long)mode < 32 && ((1L << mode) & 0x6) != 0) {
-    if (mode == 1 && *buf == '\0')
-      strcpy(buf, "(none)");
-    sprintf(STR1, "Procedure name: %s", buf);
-    l1 = strlist_insert(sl, STR1);
-    return;
-  }
-  if (mode == 0) {
-    nc_printf("\f");
-    nc_printf("Procedural gate\n\n");
-    nc_printf("Current procedure name: ");
-    if (*buf == '\0')
-      nc_printf("(no name)");
-    else
-      nc_puts(buf);
-    nc_printf("\n\nChange this? ");
-    ch = toupper(nk_getkey());
-    if (ch == 'Y') {
-      nc_printf("\nNew name: ");
-      nc_fgets(buf, 101, stdin);
-      TEMP = (char *) strchr(buf, '\n');
-      if (TEMP != NULL)
-	*TEMP = 0;
-    }
-  } else if (mode == 3) {
-    if (*sl != NULL && !strncmp((*sl)->s, "Procedure name: ", 16L)) {
-      strsub(buf, (*sl)->s, 17, 99);
-      ch = 'Y';
-    } else
-      ch = 'N';
-  } else
-    ch = 'N';
-  if (ch != 'Y')
-    return;
-  strcpy(STR3, strltrim(strrtrim(strcpy(STR2, buf))));
-  strcpy(buf, STR3);
-  proc[0] = '\001';
-  FORLIM = strlen(buf);
-  for (i = 1; i <= FORLIM; i++)
-    proc[i] = buf[i - 1];
-  proc[strlen(buf) + 1] = '\0';
-}
+	long i;
+	strlist_t *l1;
+	char buf[101];
+	char ch;
+	char STR1[118];
+	char STR2[256];
+	char STR3[256];
+	char *TEMP;
+	long FORLIM;
+
+	if (proc[0] != '\001')
+	{
+		proc[0] = '\001';
+		proc[1] = '\0';
+	}
+	
+	proc_name_7(buf, proc);
+	if ((unsigned long)mode < 32 && ((1L << mode) & 0x6) != 0)
+	{
+		if (mode == 1 && *buf == '\0')
+			strcpy(buf, "(none)");
+		sprintf(STR1, "Procedure name: %s", buf);
+		l1 = strlist_insert(sl, STR1);
+		return;
+	}
+	if (mode == 0)
+	{
+		nc_printf("\f");
+		nc_printf("Procedural gate\n\n");
+		nc_printf("Current procedure name: ");
+		if (*buf == '\0')
+			nc_printf("(no name)");
+		else
+			nc_puts(buf);
+		nc_printf("\n\nChange this? ");
+		ch = toupper(nk_getkey());
+		if (ch == 'Y') {
+			nc_printf("\nNew name: ");
+			nc_fgets(buf, 101, stdin);
+			TEMP = (char *) strchr(buf, '\n');
+			if (TEMP != NULL)
+				*TEMP = 0;
+		}
+	}
+	else if (mode == 3)
+	{
+		if (*sl != NULL && !strncmp((*sl)->s, "Procedure name: ", 16L))
+		{
+			strsub(buf, (*sl)->s, 17, 99);
+			ch = 'Y';
+		}
+		else
+		{
+			ch = 'N';
+		}
+	}
+	else
+	{
+		ch = 'N';
+	}
 
+	if (ch != 'Y')
+		return;
 
+	strcpy(STR3, strltrim(strrtrim(strcpy(STR2, buf))));
+	strcpy(buf, STR3);
+	proc[0] = '\001';
+	FORLIM = strlen(buf);
 
+	for (i = 1; i <= FORLIM; i++)
+		proc[i] = buf[i - 1];
 
-static void nullproc(act)
-log_action_t *act;
-{
-  if (act->action == act_pass && act->actgate != NULL)
-    unfoundkind = act->actgate->kind;
+	proc[strlen(buf) + 1] = '\0';
 }
 
+static void nullproc(log_action_t *act)
+{
+	if (act->action == act_pass && act->actgate != NULL)
+		unfoundkind = act->actgate->kind;
+}
 
-void Log_7_proc(act)
-log_action_t *act;
+void Log_7_proc(log_action_t *act)
 {
-  long i;
-  char buf[256];
-  log_grec *g;
-  void (*myproc) (log_action_t *act);
-  log_krec *unfound;
-  log_action_t *WITH;
-  char STR1[42];
-  long FORLIM;
-
-  WITH = act;
-  switch (WITH->action) {
-
-  case act_init:
-    WITH->acttool->simulator = true;
-    WITH->acttool->ready = true;
-    WITH->acttool->nostatus = true;
-    procs_7 = (void(**) (log_action_t *act))Malloc(sizeof(procarray));
-    procs_7[0] = nullproc;
-    procs_7[1] = nullproc;
-    numprocs_7 = 1;
-    unfoundkind = NULL;
-    unfoundshown = false;
-    break;
-
-  case act_edit:
-    edit_7(WITH->actproc, &WITH->actx, &WITH->actstrlist, WITH->acty);
-    break;
-
-  case act_newkind:
-    if (WITH->actkind->proc[0] != '\0') {
-      proc_name_7(buf, WITH->actkind->proc);
-      if (*buf == '\0' || !findprocedure(buf, (void(**) ())(&myproc)))
-	myproc = nullproc;
-      i = 1;
-      while (i <= numprocs_7 && myproc != procs_7[i])
-	i++;
-      if (i == 256)
-	i = 1;
-      WITH->actkind->proc[0] = (char)i;
-      if (i > numprocs_7) {
-	procs_7[i] = myproc;
-	numprocs_7 = i;
-	WITH->actflag = true;
-      } else
-	WITH->actflag = false;
-      WITH->actx = i;
-      (*procs_7[i])(act);
-    }
-    break;
-
-  case act_disposekind:
-    (*procs_7[WITH->actkind->proc[0]])(act);
-    if (WITH->actkind == unfoundkind)
-      unfoundkind = NULL;
-    break;
-
-  case act_clearmsg:
-    FORLIM = numprocs_7;
-    for (i = 2; i <= FORLIM; i++)
-      (*procs_7[i])(act);
-    unfoundshown = false;
-    break;
-
-  case act_cnf:
-  case act_immed:
-  case act_func:
-  case act_color:
-  case act_clear:
-  case act_tstep:
-  case act_general:
-    FORLIM = numprocs_7;
-    for (i = 2; i <= FORLIM; i++)
-      (*procs_7[i])(act);
-    break;
-
-  case act_pass:
-    WITH->actgate = NULL;
-    FORLIM = numprocs_7;
-    for (i = 2; i <= FORLIM; i++)
-      (*procs_7[i])(act);
-    unfound = unfoundkind;
-    unfoundkind = NULL;
-    FORLIM = WITH->numpages;
-    for (i = 1; i <= FORLIM; i++) {
-      g = WITH->pages[i - 1]->gbase;
-      while (g != NULL) {
-	if (g->kind->simtype == WITH->acttool) {
-	  WITH->actgate = g;
-	  WITH->action = act_pass;
-	  WITH->actflag = (i == WITH->showpage);
-	  (*procs_7[g->kind->proc[0]])(act);
+	long i;
+	char buf[256];
+	log_grec *g;
+	void (*myproc) (log_action_t *act);
+	log_krec *unfound;
+	log_action_t *WITH;
+	char STR1[42];
+	long FORLIM;
+
+	WITH = act;
+	switch (WITH->action)
+	{
+
+		case act_init:
+			WITH->acttool->simulator = true;
+			WITH->acttool->ready = true;
+			WITH->acttool->nostatus = true;
+			procs_7 = (void(**) (log_action_t *act))Malloc(sizeof(procarray));
+			procs_7[0] = nullproc;
+			procs_7[1] = nullproc;
+			numprocs_7 = 1;
+			unfoundkind = NULL;
+			unfoundshown = false;
+			break;
+
+		case act_edit:
+			edit_7(WITH->actproc, &WITH->actx, &WITH->actstrlist, WITH->acty);
+			break;
+
+		case act_newkind:
+			if (WITH->actkind->proc[0] != '\0')
+			{
+				proc_name_7(buf, WITH->actkind->proc);
+				if (*buf == '\0' || !findprocedure(buf, (void(**) ())(&myproc)))
+					myproc = nullproc;
+				i = 1;
+				while (i <= numprocs_7 && myproc != procs_7[i])
+					i++;
+				if (i == 256)
+					i = 1;
+				WITH->actkind->proc[0] = (char)i;
+				if (i > numprocs_7)
+				{
+					procs_7[i] = myproc;
+					numprocs_7 = i;
+					WITH->actflag = true;
+				}
+				else
+				{
+					WITH->actflag = false;
+				}
+				WITH->actx = i;
+				(*procs_7[i])(act);
+			}
+			break;
+
+		case act_disposekind:
+			(*procs_7[WITH->actkind->proc[0]])(act);
+			if (WITH->actkind == unfoundkind)
+				unfoundkind = NULL;
+			break;
+
+		case act_clearmsg:
+			FORLIM = numprocs_7;
+			for (i = 2; i <= FORLIM; i++)
+				(*procs_7[i])(act);
+			unfoundshown = false;
+			break;
+
+		case act_cnf:
+		case act_immed:
+		case act_func:
+		case act_color:
+		case act_clear:
+		case act_tstep:
+		case act_general:
+			FORLIM = numprocs_7;
+			for (i = 2; i <= FORLIM; i++)
+				(*procs_7[i])(act);
+			break;
+
+		case act_pass:
+			WITH->actgate = NULL;
+			FORLIM = numprocs_7;
+			for (i = 2; i <= FORLIM; i++)
+				(*procs_7[i])(act);
+			unfound = unfoundkind;
+			unfoundkind = NULL;
+			FORLIM = WITH->numpages;
+			for (i = 1; i <= FORLIM; i++)
+			{
+				g = WITH->pages[i - 1]->gbase;
+				while (g != NULL)
+				{
+					if (g->kind->simtype == WITH->acttool)
+					{
+						WITH->actgate = g;
+						WITH->action = act_pass;
+						WITH->actflag = (i == WITH->showpage);
+						(*procs_7[g->kind->proc[0]])(act);
+					}
+					g = g->next;
+				}
+			}
+			if (unfoundkind != NULL)
+			{
+				if (unfoundkind != unfound || !unfoundshown)
+				{
+					sprintf(STR1, "Unable to find program for gate %s", unfoundkind->name);
+					(*WITH->hook.message)(STR1);
+					unfoundshown = true;
+				}
+			}
+			else
+			{
+				unfoundkind = unfound;
+			}
+			break;
+
+		case act_erasegate:
+		case act_touchgate:
+		case act_newgate:
+		case act_disposegate:
+		case act_copygate:
+		case act_writegate:
+		case act_readgate:
+		case act_connectgate:
+		case act_disconnectgate:
+		case act_configgate:
+		case act_configchgate:
+		case act_configrelgate:
+			(*procs_7[WITH->actgate->kind->proc[0]])(act);
+			break;
+
+		case act_genkind:
+			if (WITH->actkind != NULL)
+			{
+				(*procs_7[WITH->actkind->proc[0]])(act);
+			}
+			else
+			{
+				FORLIM = numprocs_7;
+				for (i = 2; i <= FORLIM; i++)
+					(*procs_7[i])(act);
+			}
+			break;
+
+		case act_gengate:
+			if (WITH->actgate != NULL)
+			{
+				(*procs_7[WITH->actgate->kind->proc[0]])(act);
+			}
+			else
+			{
+				FORLIM = numprocs_7;
+				for (i = 2; i <= FORLIM; i++)
+					(*procs_7[i])(act);
+				FORLIM = WITH->numpages;
+				for (i = 0; i < FORLIM; i++) {
+					g = WITH->pages[i]->gbase;
+					while (g != NULL) {
+						if (g->kind->simtype == WITH->acttool)
+						{
+							WITH->actgate = g;
+							WITH->action = act_gengate;
+							(*procs_7[g->kind->proc[0]])(act);
+						}
+						g = g->next;
+					}
+				}
+			}
+			break;
+
+		default:
+			break;
 	}
-	g = g->next;
-      }
-    }
-    if (unfoundkind != NULL) {
-      if (unfoundkind != unfound || !unfoundshown) {
-	sprintf(STR1, "Unable to find program for gate %s", unfoundkind->name);
-	(*WITH->hook.message)(STR1);
-	unfoundshown = true;
-      }
-    } else
-      unfoundkind = unfound;
-    break;
-
-  case act_erasegate:
-  case act_touchgate:
-  case act_newgate:
-  case act_disposegate:
-  case act_copygate:
-  case act_writegate:
-  case act_readgate:
-  case act_connectgate:
-  case act_disconnectgate:
-  case act_configgate:
-  case act_configchgate:
-  case act_configrelgate:
-    (*procs_7[WITH->actgate->kind->proc[0]])(act);
-    break;
-
-  case act_genkind:
-    if (WITH->actkind != NULL)
-      (*procs_7[WITH->actkind->proc[0]])(act);
-    else {
-      FORLIM = numprocs_7;
-      for (i = 2; i <= FORLIM; i++)
-	(*procs_7[i])(act);
-    }
-    break;
-
-  case act_gengate:
-    if (WITH->actgate != NULL)
-      (*procs_7[WITH->actgate->kind->proc[0]])(act);
-    else {
-      FORLIM = numprocs_7;
-      for (i = 2; i <= FORLIM; i++)
-	(*procs_7[i])(act);
-      FORLIM = WITH->numpages;
-      for (i = 0; i < FORLIM; i++) {
-	g = WITH->pages[i]->gbase;
-	while (g != NULL) {
-	  if (g->kind->simtype == WITH->acttool) {
-	    WITH->actgate = g;
-	    WITH->action = act_gengate;
-	    (*procs_7[g->kind->proc[0]])(act);
-	  }
-	  g = g->next;
-	}
-      }
-    }
-    break;
-
-  default:
-    break;
-  }
 }
 
 
-void Log_17_proc(act)
-log_action_t *act;
+void Log_17_proc(log_action_t *act)
 {
-  switch (act->action) {
-
-  case act_init:
-    act->acttool->simulator = true;
-    act->acttool->ready = true;
-    act->acttool->nostatus = true;
-    break;
-    /* debugging simtype -- does nothing */
-
-  default:
-    break;
-  }
+	switch (act->action)
+	{
+
+		case act_init:
+			act->acttool->simulator = true;
+			act->acttool->ready = true;
+			act->acttool->nostatus = true;
+			break;
+			/* debugging simtype -- does nothing */
+
+		default:
+			break;
+	}
 }
 
-
-