From e7a0da57f2f18d548959b93b9f2c550b3c485bad Mon Sep 17 00:00:00 2001 From: Etienne Brateau <etienne.brateau@ensiie.fr> Date: Fri, 25 Jan 2019 00:21:26 +0100 Subject: [PATCH] reindent logsimasm --- src/logsimasm.c | 60 +++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/src/logsimasm.c b/src/logsimasm.c index d2c8ad2..1b9f1e2 100644 --- a/src/logsimasm.c +++ b/src/logsimasm.c @@ -18,7 +18,8 @@ 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. */ + the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ /* C equivalent code for the assembly-language portions of logsim. @@ -31,8 +32,8 @@ #include "logsima.h" #include "node.h" +#include "logstuff.h" -static int trace_16 = 0; #define trace_16 (logsima_action.lact->quiet ? -1 : 0) #define TRACE_ENBL 0 @@ -44,14 +45,9 @@ static int trace_16 = 0; -extern int findprocedure (char *name, void (**start)()); - - static int callcache_next; static void (*callcache[255-32])(log_16_action *); /* first 32 are unused */ - - static void nullproc_16(log_16_action *act) { /* do nothing */ @@ -98,7 +94,7 @@ void copynodes(log_nrec *n, int *stable) if ((nip->truev = newv = nip->v0) == log_none) newv = nip->defv; if (TRACE_COPY) - nc_printf("Setting node %x to %d\n", (unsigned int)nip, newv); + nc_printf("Setting node %p to %d\n", nip, newv); if (newv != (nip->v00 = nip->v)) { nip->v = newv; @@ -359,7 +355,7 @@ static log_16_value g_expr() case 0xb0: /* high pin */ nip = g_pins[*g_proc++]->info; - if (TRACE_VAL) nc_printf(" Value of %x is %d\n", (unsigned int)nip, (int)nip->v - 1); + if (TRACE_VAL) nc_printf(" Value of %p is %d\n", nip, (int)nip->v - 1); return nip->v; case 0xb1: /* STRONG */ @@ -369,7 +365,7 @@ static log_16_value g_expr() case16(0xc0): /* pin */ case16(0xd0): nip = g_pins[ch & 0x1f]->info; - if (TRACE_VAL) nc_printf(" Value of %x is %d\n", (unsigned int)nip, (int)nip->v - 1); + if (TRACE_VAL) nc_printf(" Value of %p is %d\n", nip, (int)nip->v - 1); return nip->v; case16(0xe0): /* var */ @@ -571,7 +567,7 @@ out_node: { case log_zero: nip = np->info; - if (TRACE_VAL) nc_printf(" Output 0 to %x (was %d)\n", (unsigned int)nip, nip->v0); + if (TRACE_VAL) nc_printf(" Output 0 to %p (was %d)\n", nip, nip->v0); if (nip->v0 == log_one) record_conflict(np); else @@ -580,7 +576,7 @@ out_node: case log_one: nip = np->info; - if (TRACE_VAL) nc_printf(" Output 1 to %x (was %d)\n", (unsigned int)nip, nip->v0); + if (TRACE_VAL) nc_printf(" Output 1 to %p (was %d)\n", nip, nip->v0); if (nip->v0 == log_zero) record_conflict(np); else @@ -600,7 +596,7 @@ oc_out_node: if (g_expr() == log_zero) { nip = np->info; - if (TRACE_VAL) nc_printf(" Output 0 to %x (was %d)\n", (unsigned int)nip, nip->v0); + if (TRACE_VAL) nc_printf(" Output 0 to %p (was %d)\n", nip, nip->v0); if (nip->v0 == log_one) record_conflict(np); else @@ -609,33 +605,33 @@ oc_out_node: } break; - case16(0x60): /* var = x */ - if (g_expr() != log_zero) - { - if (TRACE_VAL) nc_printf(" Store 1 in %c\n", 'A' + (ch % 0x0f)); - g_vars |= REGMASK(ch & 0x0f); - } - else - { - if (TRACE_VAL) nc_printf(" Store 0 in %c\n", 'A' + (ch % 0x0f)); - g_vars &= ~REGMASK(ch & 0x0f); - } + case16(0x60): /* var = x */ + if (g_expr() != log_zero) + { + if (TRACE_VAL) nc_printf(" Store 1 in %c\n", 'A' + (ch % 0x0f)); + g_vars |= REGMASK(ch & 0x0f); + } + else + { + if (TRACE_VAL) nc_printf(" Store 0 in %c\n", 'A' + (ch % 0x0f)); + g_vars &= ~REGMASK(ch & 0x0f); + } break; - case16(0x70): /* var = NOT var */ - g_vars ^= REGMASK(ch & 0x0f); + case16(0x70): /* var = NOT var */ + g_vars ^= REGMASK(ch & 0x0f); if (TRACE_VAL) nc_printf(" Store %d in %c\n", - ((g_vars & REGMASK(ch & 0x0f)) != 0), - 'A' + (ch % 0x0f)); + ((g_vars & REGMASK(ch & 0x0f)) != 0), + 'A' + (ch % 0x0f)); break; - case16(0x80): /* var = ZERO */ - if (TRACE_VAL) nc_printf(" Store 0 in %c\n", 'A' + (ch % 0x0f)); + case16(0x80): /* var = ZERO */ + if (TRACE_VAL) nc_printf(" Store 0 in %c\n", 'A' + (ch % 0x0f)); g_vars &= ~REGMASK(ch & 0x0f); break; - case16(0x90): /* var = ONE */ - if (TRACE_VAL) nc_printf(" Store 1 in %c\n", 'A' + (ch % 0x0f)); + case16(0x90): /* var = ONE */ + if (TRACE_VAL) nc_printf(" Store 1 in %c\n", 'A' + (ch % 0x0f)); g_vars |= REGMASK(ch & 0x0f); break; -- GitLab