From 8c03bba02a8fbb57a6374863b5522787046cb2ea Mon Sep 17 00:00:00 2001 From: ccremers Date: Fri, 31 Mar 2006 12:24:32 +0000 Subject: [PATCH] - Fixed a bug in output overwrite for de-class code. --- src/arachne.c | 32 +++++++++++++++++++++++++++++++- src/dotout.c | 19 +++++++++++++++++-- src/termlist.c | 6 ++++-- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/src/arachne.c b/src/arachne.c index 2fcdacd..3727df9 100644 --- a/src/arachne.c +++ b/src/arachne.c @@ -1732,6 +1732,36 @@ createNewTermGeneric (Termlist tl, Term t) return termlistPrepend (tl, newterm); } +//! Construct a list of already used constants +Termlist +findUsedConstants (const System sys) +{ + int run; + Termlist tl; + Termlist tlconst; + + tl = NULL; + tlconst = NULL; + for (run = 0; run < sys->maxruns; run++) + { + tl = termlistAddBasics (tl, sys->runs[run].rho); + tl = termlistAddBasics (tl, sys->runs[run].sigma); + } + while (tl != NULL) + { + Term t; + + t = tl->term; + if (!realTermVariable (t)) + { + tlconst = termlistAddNew (tlconst, t); + } + tl = tl->next; + } + termlistDelete (tl); + return tlconst; +} + //! Create a new term with incremented run rumber, starting at sys->maxruns. /** * This is a rather intricate function that tries to generate new terms of a @@ -1812,7 +1842,7 @@ makeTraceConcrete (const System sys) int run; changedvars = NULL; - tlnew = NULL; + tlnew = findUsedConstants (sys); run = 0; while (run < sys->maxruns) diff --git a/src/dotout.c b/src/dotout.c index ec56b2c..39c7851 100644 --- a/src/dotout.c +++ b/src/dotout.c @@ -63,15 +63,30 @@ void printVisualRun (int rid) { int run; + int displayi; + int displayr; int display; - display = 1; + displayi = 0; + displayr = 0; for (run = 0; run < rid; run++) { if (sys->runs[run].protocol != INTRUDER) { - display++; + displayr++; } + else + { + displayi++; + } + } + if (sys->runs[rid].protocol == INTRUDER) + { + display = sys->maxruns + displayi + 1; + } + else + { + display = displayr + 1; } eprintf ("#%i", display); } diff --git a/src/termlist.c b/src/termlist.c index 7812a20..fa88383 100644 --- a/src/termlist.c +++ b/src/termlist.c @@ -520,11 +520,13 @@ termlistAddRealVariables (Termlist tl, Term t) Termlist termlistAddBasic (Termlist tl, Term t) { + t = deVar (t); + if (t == NULL) return tl; - if (!isTermLeaf (t)) + if (!realTermLeaf (t)) { - if (isTermEncrypt (t)) + if (realTermEncrypt (t)) return termlistAddBasic (termlistAddBasic (tl, TermOp (t)), TermKey (t)); else