diff --git a/Makefile b/Makefile
index 1b3cf6b23a6a49ef40c8274d5e7296bd17601c3a..6aa5be7c9e1fdbe476a29638df6eb7a225e4d783 100644
--- a/Makefile
+++ b/Makefile
@@ -4,10 +4,9 @@ MAKE="make"
 
 build:
 	$(MAKE) -C psys/src
-	$(MAKE) -C log/src
+	$(MAKE) -C log
 
 
 clean:
 	$(MAKE) -C psys/src clean
-	$(MAKE) -C log/src clean
-
+	$(MAKE) -C log clean
diff --git a/log/.gitignore b/log/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..7e153416f296a6e1657af85211a66b67af055822
--- /dev/null
+++ b/log/.gitignore
@@ -0,0 +1,2 @@
+target/
+munch.temp
diff --git a/log/src/COPYING b/log/COPYING
similarity index 100%
rename from log/src/COPYING
rename to log/COPYING
diff --git a/log/src/LNOTES b/log/LNOTES
similarity index 100%
rename from log/src/LNOTES
rename to log/LNOTES
diff --git a/log/Makefile b/log/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..075cfe13468b1077a0679ae0d0263a3e16bad0b9
--- /dev/null
+++ b/log/Makefile
@@ -0,0 +1,158 @@
+
+#  "LOG", the circuit editing and simulation system, 5.66
+#  "DigLOG", the digital simulator for LOG.
+#  Copyright (C) 1985, 1990 David Gillespie.
+#  Author's address: daveg@synaptics.edu
+
+#  "AnaLOG", the analog simulator for LOG, 5.66
+#  Copyright (C) 1985, 1990 John Lazzaro.
+#  Author's address: lazzaro@cs.berkeley.edu;
+
+# 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.
+
+CD = cd
+
+LOGINC = include
+TARGET_DIR = target
+SRC_DIR = src
+TOOLS_DIR = tools
+
+LOGLIBDIR = lib
+LIBDIR = `$(CD) ../lib; pwd`
+
+LOCINC = ../psys/include
+
+XINCLUDEDIR = .
+
+BINDIR = ../bin
+LIBP2C = ../psys/src/libp2c.a
+
+LIBX11 = -lX11
+
+OTHERLIBS= -lm
+
+CHIPMUNKCC = gcc -O3
+
+CC = $(CHIPMUNKCC)
+
+CHIPMUNKFLAGS = $(ARCH_OPT)
+
+CFLAGS =  $(CHIPMUNKFLAGS) -I$(LOGINC) -I$(LOCINC) -I$(XINCLUDEDIR) -DLOGLIB=\"$(LOGLIBDIR)\" -DF_OK=0
+
+VPATH = src
+
+DIGOBJ = $(TARGET_DIR)/logsim.o $(TARGET_DIR)/logdig.o $(TARGET_DIR)/logsimasm.o $(TARGET_DIR)/logsimed.o $(TARGET_DIR)/diggates.o \
+         $(TARGET_DIR)/loghier.o $(TARGET_DIR)/logsimh.o $(TARGET_DIR)/swap.o
+ANAOBJ = $(TARGET_DIR)/ana/globals.o $(TARGET_DIR)/ana/nsolver.o $(TARGET_DIR)/ana/main.o $(TARGET_DIR)/ana/inter.o \
+         $(TARGET_DIR)/ana/numbers.o $(TARGET_DIR)/ana/mmeter.o $(TARGET_DIR)/ana/iscope.o $(TARGET_DIR)/ana/devtechp.o\
+	 $(TARGET_DIR)/ana/vdiff.o $(TARGET_DIR)/ana/vswitch.o $(TARGET_DIR)/ana/stairs.o $(TARGET_DIR)/ana/runspec.o \
+	 $(TARGET_DIR)/ana/idiff.o $(TARGET_DIR)/ana/iswitch1.o $(TARGET_DIR)/ana/iswitch2.o $(TARGET_DIR)/ana/devtechn.o \
+	 $(TARGET_DIR)/ana/resfloat.o $(TARGET_DIR)/ana/capfloat.o $(TARGET_DIR)/ana/nfet4.o $(TARGET_DIR)/ana/pfet4.o \
+	 $(TARGET_DIR)/ana/nfet5.o $(TARGET_DIR)/ana/pfet5.o $(TARGET_DIR)/ana/pfet6.o $(TARGET_DIR)/ana/pspc1.o $(TARGET_DIR)/ana/nspc1.o\
+	 $(TARGET_DIR)/ana/nfet7t.o $(TARGET_DIR)/ana/nfet7f.o $(TARGET_DIR)/ana/pfet7t.o $(TARGET_DIR)/ana/pfet7f.o $(TARGET_DIR)/ana/thermal.o\
+	 $(TARGET_DIR)/ana/tc.o $(TARGET_DIR)/ana/moscap.o $(TARGET_DIR)/ana/ganglion.o $(TARGET_DIR)/ana/hres.o $(TARGET_DIR)/ana/physical.o\
+	 $(TARGET_DIR)/ana/npn1.o $(TARGET_DIR)/ana/pnp1.o $(TARGET_DIR)/ana/npn2.o $(TARGET_DIR)/ana/pnp2.o $(TARGET_DIR)/ana/diode1.o\
+	 $(TARGET_DIR)/ana/pwl.o $(TARGET_DIR)/ana/rtd.o
+
+SIMOBJ = $(TARGET_DIR)/logcom.o $(DIGOBJ) $(ANAOBJ)
+TOOLOBJ = $(SIMOBJ) $(TARGET_DIR)/logspc.o $(TARGET_DIR)/logntk.o
+
+$(TARGET_DIR)/%.o: $(SRC_DIR)/%.c
+	@mkdir -p $(@D)
+	$(CC) -c $(CFLAGS) $(LIBP2C) $(LIBX11) $(OTHERLIBS) $< -o $@
+
+
+install: all
+	cp $(TARGET_DIR)/log $(BINDIR)/diglog
+	-rm -f $(BINDIR)/analog
+	-(cd $(BINDIR); ln -s diglog analog)
+	cp $(TARGET_DIR)/loged $(BINDIR)/loged
+	cp $(TOOLS_DIR)/fixfet7 $(BINDIR)/fixfet7
+
+clean:
+	rm -rf $(TARGET_DIR)/*
+
+all: main
+
+main: $(TARGET_DIR)/log $(TARGET_DIR)/loged
+
+
+LOGOBJ = $(TARGET_DIR)/log.o $(TOOLOBJ) $(TARGET_DIR)/logstuff.o $(TARGET_DIR)/logdef.o
+
+
+$(TARGET_DIR)/log: $(LOGOBJ) $(TARGET_DIR)/tooldir.o $(LIBP2C)
+	$(CC) $(CFLAGS) $(TARGET_DIR)/tooldir.o $(LOGOBJ) $(LIBP2C) $(LIBX11)  \
+	$(OTHERLIBS) -o $(TARGET_DIR)/log
+
+
+LOGEDOBJ = $(TARGET_DIR)/loged.o $(TARGET_DIR)/simdir.o $(SIMOBJ) $(TARGET_DIR)/logstuff.o
+
+$(TARGET_DIR)/loged: $(LOGEDOBJ) $(TARGET_DIR)/simdir.o $(LIBP2C)
+	$(CC) $(CFLAGS) $(LOGEDOBJ) $(LIBP2C) $(LIBX11) $(OTHERLIBS) -o $(TARGET_DIR)/loged
+
+$(TARGET_DIR)/tooldir.o: $(SRC_DIR)/tooldir.c
+
+$(SRC_DIR)/tooldir.c: $(TOOLOBJ)
+	chmod +x $(TOOLS_DIR)/munch
+	$(TOOLS_DIR)/munch 'Log_[a-zA-Z0-9_]*' $(TOOLOBJ) > $(SRC_DIR)/tooldir.c
+
+
+
+$(TARGET_DIR)/simdir.o: $(SRC_DIR)/simdir.c
+
+$(SRC_DIR)/simdir.c: $(SIMOBJ)
+	chmod +x $(TOOLS_DIR)/munch
+	$(TOOLS_DIR)/munch 'Log_[0-9]*_proc' $(SIMOBJ) > $(SRC_DIR)/simdir.c
+
+
+## The following part of the Makefile is for making a tar file of the
+## original parts of the log distribution. Most users have no need for it.
+
+
+VERSION = 5.66
+
+dist: distrib
+distrib:
+	-rm -rf dist
+	mkdir dist
+	mkdir dist/src
+	mkdir dist/src/ana
+	cp log.cnf log.gate COPYING LNOTES dist/src
+	cp munch* $(TOOLS_DIR)/fixfet7 dist/src
+	cp munch.default  dist/src/munch
+	cp simdir.os2 tooldir.os2 dist/src
+	sed -e "s;5.66;$(VERSION);" Makefile > dist/src/Makefile
+	sed -e "s;5.66;$(VERSION);" ana/Makefile > dist/src/ana/Makefile
+	sed -e "s;5.66;$(VERSION);" Makefile.os2 > dist/src/Makefile.os2
+	sed -e "s;5.66;$(VERSION);" ana/Makefile.os2 > dist/src/ana/Makefile.os2
+	sed -e "s;5.66;$(VERSION);" dist.INSTALL > dist/README
+	cp *.c *.h dist/src
+	sed -e "s;5.66;$(VERSION);"  logdef.h > dist/src/logdef.h
+	cp ana/*.c ana/*.h dist/src/ana
+	cp -r $(LOGLIBDIR) dist/lib
+	echo >dist/lib/stupid~
+	-rm -f dist/lib/*~ dist/lib/*.ogte
+	sed -e "s;5.66;$(VERSION);" ../lib/log.doc > dist/lib/log.doc
+
+
+tardist:
+	-rm -rf logdist
+	mkdir logdist
+	mv dist logdist/log
+	tar cvf log.tar -C logdist log
+	mv logdist/log dist
+	-rm -f log.tar.gz
+	gzip log.tar
+
+create: dist tardist
diff --git a/log/src/ana/capfloat.h b/log/include/ana/capfloat.h
similarity index 100%
rename from log/src/ana/capfloat.h
rename to log/include/ana/capfloat.h
diff --git a/log/src/ana/devtechn.h b/log/include/ana/devtechn.h
similarity index 100%
rename from log/src/ana/devtechn.h
rename to log/include/ana/devtechn.h
diff --git a/log/src/ana/devtechp.h b/log/include/ana/devtechp.h
similarity index 100%
rename from log/src/ana/devtechp.h
rename to log/include/ana/devtechp.h
diff --git a/log/src/ana/diode1.h b/log/include/ana/diode1.h
similarity index 100%
rename from log/src/ana/diode1.h
rename to log/include/ana/diode1.h
diff --git a/log/src/ana/ganglion.h b/log/include/ana/ganglion.h
similarity index 100%
rename from log/src/ana/ganglion.h
rename to log/include/ana/ganglion.h
diff --git a/log/src/ana/globals.h b/log/include/ana/globals.h
similarity index 100%
rename from log/src/ana/globals.h
rename to log/include/ana/globals.h
diff --git a/log/src/ana/hres.h b/log/include/ana/hres.h
similarity index 100%
rename from log/src/ana/hres.h
rename to log/include/ana/hres.h
diff --git a/log/src/ana/idiff.h b/log/include/ana/idiff.h
similarity index 100%
rename from log/src/ana/idiff.h
rename to log/include/ana/idiff.h
diff --git a/log/src/ana/inter.h b/log/include/ana/inter.h
similarity index 100%
rename from log/src/ana/inter.h
rename to log/include/ana/inter.h
diff --git a/log/src/ana/iscope.h b/log/include/ana/iscope.h
similarity index 100%
rename from log/src/ana/iscope.h
rename to log/include/ana/iscope.h
diff --git a/log/src/ana/iswitch1.h b/log/include/ana/iswitch1.h
similarity index 100%
rename from log/src/ana/iswitch1.h
rename to log/include/ana/iswitch1.h
diff --git a/log/src/ana/iswitch2.h b/log/include/ana/iswitch2.h
similarity index 100%
rename from log/src/ana/iswitch2.h
rename to log/include/ana/iswitch2.h
diff --git a/log/src/ana/main.h b/log/include/ana/main.h
similarity index 100%
rename from log/src/ana/main.h
rename to log/include/ana/main.h
diff --git a/log/src/ana/mmeter.h b/log/include/ana/mmeter.h
similarity index 100%
rename from log/src/ana/mmeter.h
rename to log/include/ana/mmeter.h
diff --git a/log/src/ana/moscap.h b/log/include/ana/moscap.h
similarity index 100%
rename from log/src/ana/moscap.h
rename to log/include/ana/moscap.h
diff --git a/log/src/ana/nfet4.h b/log/include/ana/nfet4.h
similarity index 100%
rename from log/src/ana/nfet4.h
rename to log/include/ana/nfet4.h
diff --git a/log/src/ana/nfet5.h b/log/include/ana/nfet5.h
similarity index 100%
rename from log/src/ana/nfet5.h
rename to log/include/ana/nfet5.h
diff --git a/log/src/ana/nfet7f.h b/log/include/ana/nfet7f.h
similarity index 100%
rename from log/src/ana/nfet7f.h
rename to log/include/ana/nfet7f.h
diff --git a/log/src/ana/nfet7t.h b/log/include/ana/nfet7t.h
similarity index 100%
rename from log/src/ana/nfet7t.h
rename to log/include/ana/nfet7t.h
diff --git a/log/src/ana/npn1.h b/log/include/ana/npn1.h
similarity index 100%
rename from log/src/ana/npn1.h
rename to log/include/ana/npn1.h
diff --git a/log/src/ana/npn2.h b/log/include/ana/npn2.h
similarity index 100%
rename from log/src/ana/npn2.h
rename to log/include/ana/npn2.h
diff --git a/log/src/ana/nsolver.h b/log/include/ana/nsolver.h
similarity index 100%
rename from log/src/ana/nsolver.h
rename to log/include/ana/nsolver.h
diff --git a/log/src/ana/nspc1.h b/log/include/ana/nspc1.h
similarity index 100%
rename from log/src/ana/nspc1.h
rename to log/include/ana/nspc1.h
diff --git a/log/src/ana/numbers.h b/log/include/ana/numbers.h
similarity index 100%
rename from log/src/ana/numbers.h
rename to log/include/ana/numbers.h
diff --git a/log/src/ana/pfet4.h b/log/include/ana/pfet4.h
similarity index 100%
rename from log/src/ana/pfet4.h
rename to log/include/ana/pfet4.h
diff --git a/log/src/ana/pfet5.h b/log/include/ana/pfet5.h
similarity index 100%
rename from log/src/ana/pfet5.h
rename to log/include/ana/pfet5.h
diff --git a/log/src/ana/pfet6.h b/log/include/ana/pfet6.h
similarity index 100%
rename from log/src/ana/pfet6.h
rename to log/include/ana/pfet6.h
diff --git a/log/src/ana/pfet7f.h b/log/include/ana/pfet7f.h
similarity index 100%
rename from log/src/ana/pfet7f.h
rename to log/include/ana/pfet7f.h
diff --git a/log/src/ana/pfet7t.h b/log/include/ana/pfet7t.h
similarity index 100%
rename from log/src/ana/pfet7t.h
rename to log/include/ana/pfet7t.h
diff --git a/log/src/ana/physical.h b/log/include/ana/physical.h
similarity index 100%
rename from log/src/ana/physical.h
rename to log/include/ana/physical.h
diff --git a/log/src/ana/pnp1.h b/log/include/ana/pnp1.h
similarity index 100%
rename from log/src/ana/pnp1.h
rename to log/include/ana/pnp1.h
diff --git a/log/src/ana/pnp2.h b/log/include/ana/pnp2.h
similarity index 100%
rename from log/src/ana/pnp2.h
rename to log/include/ana/pnp2.h
diff --git a/log/src/ana/pspc1.h b/log/include/ana/pspc1.h
similarity index 100%
rename from log/src/ana/pspc1.h
rename to log/include/ana/pspc1.h
diff --git a/log/src/ana/pwl.h b/log/include/ana/pwl.h
similarity index 100%
rename from log/src/ana/pwl.h
rename to log/include/ana/pwl.h
diff --git a/log/src/ana/resfloat.h b/log/include/ana/resfloat.h
similarity index 100%
rename from log/src/ana/resfloat.h
rename to log/include/ana/resfloat.h
diff --git a/log/src/ana/rtd.h b/log/include/ana/rtd.h
similarity index 100%
rename from log/src/ana/rtd.h
rename to log/include/ana/rtd.h
diff --git a/log/src/ana/runspec.h b/log/include/ana/runspec.h
similarity index 100%
rename from log/src/ana/runspec.h
rename to log/include/ana/runspec.h
diff --git a/log/src/ana/stairs.h b/log/include/ana/stairs.h
similarity index 100%
rename from log/src/ana/stairs.h
rename to log/include/ana/stairs.h
diff --git a/log/src/ana/tc.h b/log/include/ana/tc.h
similarity index 100%
rename from log/src/ana/tc.h
rename to log/include/ana/tc.h
diff --git a/log/src/ana/thermal.h b/log/include/ana/thermal.h
similarity index 100%
rename from log/src/ana/thermal.h
rename to log/include/ana/thermal.h
diff --git a/log/src/ana/vdiff.h b/log/include/ana/vdiff.h
similarity index 100%
rename from log/src/ana/vdiff.h
rename to log/include/ana/vdiff.h
diff --git a/log/src/ana/vswitch.h b/log/include/ana/vswitch.h
similarity index 100%
rename from log/src/ana/vswitch.h
rename to log/include/ana/vswitch.h
diff --git a/log/src/help.h b/log/include/help.h
similarity index 100%
rename from log/src/help.h
rename to log/include/help.h
diff --git a/log/src/ana/log_action.h b/log/include/log_action.h
similarity index 100%
rename from log/src/ana/log_action.h
rename to log/include/log_action.h
diff --git a/log/src/logcom.h b/log/include/logcom.h
similarity index 100%
rename from log/src/logcom.h
rename to log/include/logcom.h
diff --git a/log/src/logcurs_arr.h b/log/include/logcurs_arr.h
similarity index 100%
rename from log/src/logcurs_arr.h
rename to log/include/logcurs_arr.h
diff --git a/log/src/logcurs_box.h b/log/include/logcurs_box.h
similarity index 100%
rename from log/src/logcurs_box.h
rename to log/include/logcurs_box.h
diff --git a/log/src/logcurs_cpy.h b/log/include/logcurs_cpy.h
similarity index 100%
rename from log/src/logcurs_cpy.h
rename to log/include/logcurs_cpy.h
diff --git a/log/src/logcurs_del.h b/log/include/logcurs_del.h
similarity index 100%
rename from log/src/logcurs_del.h
rename to log/include/logcurs_del.h
diff --git a/log/src/logcurs_prb.h b/log/include/logcurs_prb.h
similarity index 100%
rename from log/src/logcurs_prb.h
rename to log/include/logcurs_prb.h
diff --git a/log/src/logdef.h b/log/include/logdef.h
similarity index 100%
rename from log/src/logdef.h
rename to log/include/logdef.h
diff --git a/log/src/logdig.h b/log/include/logdig.h
similarity index 100%
rename from log/src/logdig.h
rename to log/include/logdig.h
diff --git a/log/src/logfont.h b/log/include/logfont.h
similarity index 100%
rename from log/src/logfont.h
rename to log/include/logfont.h
diff --git a/log/src/loghier.h b/log/include/loghier.h
similarity index 100%
rename from log/src/loghier.h
rename to log/include/loghier.h
diff --git a/log/src/logntk.h b/log/include/logntk.h
similarity index 100%
rename from log/src/logntk.h
rename to log/include/logntk.h
diff --git a/log/src/logsim.h b/log/include/logsim.h
similarity index 100%
rename from log/src/logsim.h
rename to log/include/logsim.h
diff --git a/log/src/logsima.h b/log/include/logsima.h
similarity index 100%
rename from log/src/logsima.h
rename to log/include/logsima.h
diff --git a/log/src/logsimed.h b/log/include/logsimed.h
similarity index 100%
rename from log/src/logsimed.h
rename to log/include/logsimed.h
diff --git a/log/src/logsimh.h b/log/include/logsimh.h
similarity index 100%
rename from log/src/logsimh.h
rename to log/include/logsimh.h
diff --git a/log/src/logspc.h b/log/include/logspc.h
similarity index 100%
rename from log/src/logspc.h
rename to log/include/logspc.h
diff --git a/log/src/logstuff.h b/log/include/logstuff.h
similarity index 100%
rename from log/src/logstuff.h
rename to log/include/logstuff.h
diff --git a/log/src/mygates.h b/log/include/mygates.h
similarity index 100%
rename from log/src/mygates.h
rename to log/include/mygates.h
diff --git a/log/src/swap.h b/log/include/swap.h
similarity index 100%
rename from log/src/swap.h
rename to log/include/swap.h
diff --git a/log/src/Makefile b/log/src/Makefile
deleted file mode 100644
index f41dac18f0596fc6993f8d0a0f89fd80733950ca..0000000000000000000000000000000000000000
--- a/log/src/Makefile
+++ /dev/null
@@ -1,317 +0,0 @@
-
-#  "LOG", the circuit editing and simulation system, 5.66
-#  "DigLOG", the digital simulator for LOG.
-#  Copyright (C) 1985, 1990 David Gillespie.
-#  Author's address: daveg@synaptics.edu
-
-#  "AnaLOG", the analog simulator for LOG, 5.66
-#  Copyright (C) 1985, 1990 John Lazzaro.
-#  Author's address: lazzaro@cs.berkeley.edu; 
-
-# 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.
-
-
-## comment blocks in this Makefile point to possible changes that need
-## to be made for different systems. Its a good idea to look over each
-## block and make necessary changes before doing a "make install"
-
-## The most common mistake in compilation is forgetting to install the
-## correct munch script, refer to the Web page or README for details on
-## munch alterations (needed for HPUX, Solaris, RS6000, and AU/X).
-
-##
-## (0) 64-bit Linux issues
-## -----------------------
-##
-## The Chipmunk tools must be built as 32-bit applications.
-## Under 64-bit Linux systems, it may be necessary to install
-## special packages to build 32-bit applications. A common
-## symptom of this problem will be the error message:
-##
-## cannot find /usr/include/gnu/stubs-32.h
-##
-## This can be fixed by installing glibc-devel.i686.
-##
-
-##
-## (1) The "cd" problem
-## ---------------------
-##
-## If you have aliased "cd" to some other command in your .cshrc,
-## change the following definition to:
-##
-## CD = chdir
-##
-## or specify the complete command path.
-
-CD = cd
-
-LOGLIBDIR = `$(CD) ../../log/lib; pwd`
-LIBDIR = `$(CD) ../../lib; pwd`
-
-LOCINC = ../../psys/include
-
-##
-## If X isn't in the include path, change XINCLUDEDIR:
-##
-## For modern Linux distributions, try:
-##
-## XINCLUDEDIR = /usr/include/X11
-##
-## or maybe
-##
-## XINCLUDEDIR = /usr/X11/include
-##
-## For OS X, this usually works:
-## 
-## XINCLUDEDIR = /usr/X11R6/include
-##
-## For most versions of UNIX, one of the above directories
-## will be the correct one to use on the line below:
-
-XINCLUDEDIR = .
-
-BINDIR = ../../bin
-LIBP2C = ../../psys/src/libp2c.a
-
-## 
-## If X isn't in the library path, change LIBX11 to reflect this:
-##
-## LIBX11 = -L/usr/X11R6/lib -lX11 
-##
-## or maybe
-##
-## LIBX11 = -L/usr/X11/lib -lX11
-##
-## depending on your installation. Use the first one for OS X.
-##
-## Modern Linux distributions may not include 32-bit libX11, 
-## in which case a manual install will be required. It may
-## also be necessary to force the linker to use the 32-bit
-## version, by using:
-##
-## LIBX11= /usr/lib/libX11.so.6
-##
-## or perhaps
-##
-## LIBX11= -lX11 --library=/usr/lib/libX11.so.6
-##
-## or perhaps
-##
-## LIBX11= -lX11 -s
-##
-
-LIBX11 = -lX11
-
-##
-## (2) Library additions
-## ---------------------
-##
-## on some systems, -ldl must be added to OTHERLIBS
-##
-## on Sun Solaris 2.X, -lsocket -lnsl must be added to OTHERLIBS
-
-OTHERLIBS= -lm 
-
-
-##
-##  (3) Choosing your compiler
-##  ---------------------------
-##
-## For most Unix architectures, a stable gcc 2.X will work well.
-##
-## For IBM RS/6000, xlc is recommended.
-##
-## Note than for HP series 700/800, the default cc won't work; the
-## extra-cost ANSI cc is needed. Gcc works well on HP series 700/800.
-##
-## For AmigaOS, ADE (Amiga Development Enviroment) with gcc is recommended.
-##
-  
-CHIPMUNKCC = gcc -O3
-
-CC = $(CHIPMUNKCC) 
-
-##
-## (4) Adding appropriate flags
-## -----------------------------
-##
-## Add these flags to the CHIPMUNKFLAGS below:
-##
-## Linux/86                     -m32 
-## Apple OS X                   -m32 
-## FreeBSD                      -m32 
-##
-
-CHIPMUNKFLAGS = $(ARCH_OPT)
-
-CFLAGS =  $(CHIPMUNKFLAGS) -I$(LOCINC) -I$(XINCLUDEDIR) -DLOGLIB=\"$(LOGLIBDIR)\" -DF_OK=0
-
-DIGOBJ = logsim.o logdig.o logsimasm.o logsimed.o diggates.o \
-         loghier.o logsimh.o swap.o
-ANAOBJ = ana/globals.o ana/nsolver.o ana/main.o ana/inter.o \
-         ana/numbers.o ana/mmeter.o ana/iscope.o ana/devtechp.o\
-	 ana/vdiff.o ana/vswitch.o ana/stairs.o ana/runspec.o \
-	 ana/idiff.o ana/iswitch1.o ana/iswitch2.o ana/devtechn.o \
-	 ana/resfloat.o ana/capfloat.o ana/nfet4.o ana/pfet4.o \
-	 ana/nfet5.o ana/pfet5.o ana/pfet6.o ana/pspc1.o ana/nspc1.o\
-	 ana/nfet7t.o ana/nfet7f.o ana/pfet7t.o ana/pfet7f.o ana/thermal.o\
-	 ana/tc.o ana/moscap.o ana/ganglion.o ana/hres.o ana/physical.o\
-	 ana/npn1.o ana/pnp1.o ana/npn2.o ana/pnp2.o ana/diode1.o\
-	 ana/pwl.o ana/rtd.o
-
-SIMOBJ = logcom.o $(DIGOBJ) $(ANAOBJ)
-TOOLOBJ = $(SIMOBJ) logspc.o logntk.o
-
-##
-## (5) Linking issues
-## ------------------
-##
-##  The line:
-##
-##  -(cd $(BINDIR); ln -s diglog analog)
-##
-##  creates a symbolic link for analog. Symbolic links save lots
-##  of disk space, but may cause compatibility issues on some 
-##  older operating systems -- if problems arise, use a hard link.
-##
-
-install: all
-	cp log $(BINDIR)/diglog
-	-rm -f $(BINDIR)/analog
-	-(cd $(BINDIR); ln -s diglog analog)
-	cp loged $(BINDIR)/loged
-	cp fixfet7 $(BINDIR)/fixfet7
-
-clean:
-	-rm -f *.o ana/*.o ana/logdef.h log loged
-
-all:  makeana main
-
-main: log loged
-
-makeana:
-	($(CD) ana; make $(MFLAGS) grab all)
-
-
-LOGOBJ = log.o $(TOOLOBJ) logstuff.o logdef.o
-
-
-log: $(LOGOBJ) tooldir.o $(LIBP2C) makeana
-	$(CC) $(CFLAGS) tooldir.o $(LOGOBJ) $(LIBP2C) $(LIBX11)  \
-	$(OTHERLIBS) -o log
-
-## The following permits you to link properly with AmigaOS and 
-## X shared libraries used in ADE
- 
-##log: $(LOGOBJ) tooldir.o $(LIBP2C) makeana
-##	prelink $(LIBX11)
-##	$(CC) -Tshared.x -Wa,-s $(CFLAGS) tooldir.o $(LOGOBJ) $(LIBP2C) $(LIBX11)  \
-##	$(OTHERLIBS) -o log
-##	postlink log
-##	rm shared.x xlibs.c xlibs.o
-
- 
-# The following, if it works on your system, will enable the "linklog"
-# script to work.
-
-#log: log.a tooldir.o $(LIBP2C)
-#	$(CC) $(CFLAGS) tooldir.o log.a $(LIBP2C) -lX11 -lm -o log
-#
-#log.a: $(LOGOBJ)
-#	ar r log.a $(LOGOBJ)
-
-
-
-LOGEDOBJ = loged.o simdir.o $(SIMOBJ) logstuff.o
-
-loged: $(LOGEDOBJ) simdir.o $(LIBP2C)
-	$(CC) $(CFLAGS) $(LOGEDOBJ) $(LIBP2C) $(LIBX11) $(OTHERLIBS) -o loged
-
- 
- 
-# The following permits you to link properly with AmigaOS and 
-# X shared libraries used in ADE
- 
-##loged: $(LOGEDOBJ) simdir.o $(LIBP2C)
-##	prelink $(LIBX11)
-##	$(CC) -Tshared.x -Wa,-s $(CFLAGS) $(LOGEDOBJ) $(LIBP2C) $(LIBX11) $(OTHERLIBS) -o loged
-##	postlink loged
-##	rm shared.x xlibs.c xlibs.o
-
-
-#loged: loged.a simdir.o $(LIBP2C)
-#	$(CC) $(CFLAGS) loged.a $(LIBP2C) -lX11 -lm -o loged
-#
-#loged.a: $(LOGEDOBJ)
-#	ar r loged.a $(LOGEDOBJ)
-
-
-
-tooldir.o: tooldir.c
-
-tooldir.c: $(TOOLOBJ)
-	chmod +x munch
-	./munch 'Log_[a-zA-Z0-9_]*' $(TOOLOBJ) > tooldir.c
-
-
-
-simdir.o: simdir.c
-
-simdir.c: $(SIMOBJ)
-	chmod +x munch
-	./munch 'Log_[0-9]*_proc' $(SIMOBJ) > simdir.c
-
- 
-## The following part of the Makefile is for making a tar file of the
-## original parts of the log distribution. Most users have no need for it.
-
-
-VERSION = 5.66
-
-dist: distrib
-distrib:
-	-rm -rf dist
-	mkdir dist
-	mkdir dist/src
-	mkdir dist/src/ana
-	cp log.cnf log.gate COPYING LNOTES dist/src
-	cp munch* fixfet7 dist/src
-	cp munch.default  dist/src/munch
-	cp simdir.os2 tooldir.os2 dist/src
-	sed -e "s;5.66;$(VERSION);" Makefile > dist/src/Makefile
-	sed -e "s;5.66;$(VERSION);" ana/Makefile > dist/src/ana/Makefile
-	sed -e "s;5.66;$(VERSION);" Makefile.os2 > dist/src/Makefile.os2
-	sed -e "s;5.66;$(VERSION);" ana/Makefile.os2 > dist/src/ana/Makefile.os2
-	sed -e "s;5.66;$(VERSION);" dist.INSTALL > dist/README
-	cp *.c *.h dist/src
-	sed -e "s;5.66;$(VERSION);"  logdef.h > dist/src/logdef.h
-	cp ana/*.c ana/*.h dist/src/ana
-	cp -r $(LOGLIBDIR) dist/lib
-	echo >dist/lib/stupid~
-	-rm -f dist/lib/*~ dist/lib/*.ogte
-	sed -e "s;5.66;$(VERSION);" ../lib/log.doc > dist/lib/log.doc
-
-
-tardist:
-	-rm -rf logdist
-	mkdir logdist
-	mv dist logdist/log
-	tar cvf log.tar -C logdist log
-	mv logdist/log dist
-	-rm -f log.tar.gz
-	gzip log.tar
-
-create: dist tardist 
-
diff --git a/log/src/ana/Makefile b/log/src/ana/Makefile
deleted file mode 100644
index 8ee2026252274102771976923c9e27bffb0e8dfc..0000000000000000000000000000000000000000
--- a/log/src/ana/Makefile
+++ /dev/null
@@ -1,112 +0,0 @@
-
-#  "LOG", the circuit editing and simulation system, 5.66
-#  "DigLOG", the digital simulator for LOG.
-#  Copyright (C) 1985, 1990, 1993 David Gillespie.
-#  Author's address: daveg@synaptics
-
-#  "AnaLOG", the analog simulator for LOG, 5.66 .
-#  Copyright (C) 1985, 1990, 1993 John Lazzaro.
-#  Author's address: lazzaro@cs.berkeley.edu;
-
-# 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.
-
-
-
-
-LOCINC = ../../../psys/include
-
-
-##
-## If X isn't in the include path, change XINCLUDEDIR:
-##
-## For modern Linux distributions, try:
-##
-## XINCLUDEDIR = /usr/include/X11
-##
-## or maybe
-##
-## XINCLUDEDIR = /usr/X11/include
-##
-## For OS X, this usually works:
-## 
-## XINCLUDEDIR = /usr/X11R6/include
-##
-## For most versions of UNIX, one of the above directories
-## will be the correct one to use on the line below:
-
-XINCLUDEDIR = .
-
-##
-##  (1) Choosing your compiler
-##  ---------------------------
-##
-## For most Unix architectures, a stable gcc 2.X will work well.
-##
-## For IBM RS/6000, xlc is recommended.
-##
-## Note than for HP series 700/800, the default cc won't work; the
-## extra-cost ANSI cc is needed. Gcc works well on HP series 700/800.
-##
-## For AmigaOS, ADE (Amiga Development Enviroment) with gcc is recommended.
-##
-##
-  
-
-CHIPMUNKCC = gcc -O3
-
-
-CC = $(CHIPMUNKCC) 
-
-##
-## (4) Adding appropriate flags
-## -----------------------------
-##
-## Add these flags to the CHIPMUNKFLAGS below:
-##
-## Linux/86                     -m32
-## Apple OS X                   -m32
-## FreeBSD                      -m32
-##
-
-CHIPMUNKFLAGS = $(ARCH_OPT)
-
-OPTIONS = -Wall -Wextra
-
-CFLAGS =  $(CHIPMUNKFLAGS) $(OPTIONS) -I$(LOCINC) -I$(XINCLUDEDIR)
-
-
-ANAOBJ = globals.o nsolver.o main.o inter.o $(GATESOBJ)
-GATESOBJ = numbers.o mmeter.o iscope.o \
-	   vdiff.o vswitch.o idiff.o iswitch1.o iswitch2.o stairs.o \
-	   resfloat.o capfloat.o nfet4.o pfet4.o \
-	   nfet5.o pfet5.o pfet6.o pspc1.o nspc1.o devtechp.o\
-	   nfet7t.o nfet7f.o pfet7t.o pfet7f.o thermal.o physical.o\
-	   tc.o moscap.o ganglion.o hres.o runspec.o\
-	   npn1.o pnp1.o pnp2.o npn2.o diode1.o pwl.o rtd.o devtechn.o 
-
-# Note:  The above list is also present in ../Makefile.
-
-all: grab $(ANAOBJ)
-
-grab: logdef.h log_action.h
-
-logdef.h: ../logdef.h
-	cp ../logdef.h .
-
-log_action.h : ../log_action.h
-	cp ../log_action.h .
-
-clean:
-	rm -rf *.o
-
diff --git a/log/src/ana/capfloat.c b/log/src/ana/capfloat.c
index 52fba7c43607b813b9aeffd928b3149d682bd733..ba57f51d39857bd5ecd2a3ca1d8006eada7edc1c 100644
--- a/log/src/ana/capfloat.c
+++ b/log/src/ana/capfloat.c
@@ -24,7 +24,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 /* From input file "gates.text" */
 
 #include <p2c/p2c.h>
-#include "capfloat.h"
+#include "ana/capfloat.h"
 
 #define N_Cap           1
 #define Cstart          2
diff --git a/log/src/ana/devtechn.c b/log/src/ana/devtechn.c
index 969b6f70138acea61505029544b173d2e9c73523..94d27b4cd1c1908a4f2b04839a4f08f7ade0d0a7 100644
--- a/log/src/ana/devtechn.c
+++ b/log/src/ana/devtechn.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "devtechn.h"
+#include "ana/devtechn.h"
 
 #define N_process      1
 #define N_lambda       2
diff --git a/log/src/ana/devtechp.c b/log/src/ana/devtechp.c
index e130b2a950b315f4ea4bbe6276dda801b4c3f801..884a748714f4bfa9a66fb5ca1ec3adeb10094517 100644
--- a/log/src/ana/devtechp.c
+++ b/log/src/ana/devtechp.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "devtechp.h"
+#include "ana/devtechp.h"
 
 #define N_process      1
 #define N_lambda       2
@@ -477,25 +477,25 @@ Analog_32_action *act;
 
 
 #undef N_process
-#undef N_Tox          
-#undef N_Cox          
-#undef N_mu0          
-#undef N_mu           
-
-#undef N_Na           
-#undef N_del_NaS      
-#undef N_psi          
-
-#undef N_lambda       
-#undef N_Early_s      
-#undef N_L_0          
-#undef N_deltaW       
-#undef N_deltaL       
-
-#undef N_aCactive     
-#undef N_linCgs       
-#undef N_aCgw         
-#undef N_aCwell       
+#undef N_Tox
+#undef N_Cox
+#undef N_mu0
+#undef N_mu
+
+#undef N_Na
+#undef N_del_NaS
+#undef N_psi
+
+#undef N_lambda
+#undef N_Early_s
+#undef N_L_0
+#undef N_deltaW
+#undef N_deltaL
+
+#undef N_aCactive
+#undef N_linCgs
+#undef N_aCgw
+#undef N_aCwell
 
 
 
diff --git a/log/src/ana/diode1.c b/log/src/ana/diode1.c
index 50654c403d89e6c81cd9bc720121f947ede3d7a8..e256ecc0e2540d1de1975eb8851f73f4c83e5a11 100644
--- a/log/src/ana/diode1.c
+++ b/log/src/ana/diode1.c
@@ -24,7 +24,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 /* From input file "scott.text" */
 
 #include <p2c/p2c.h>
-#include "diode1.h"
+#include "ana/diode1.h"
 
 
 #define N_Is            1
diff --git a/log/src/ana/ganglion.c b/log/src/ana/ganglion.c
index baa364fa2bf5766d06206a57c1bc3f73dc173284..ff751dca7d3faad12d16c2843601a3013a115696 100644
--- a/log/src/ana/ganglion.c
+++ b/log/src/ana/ganglion.c
@@ -28,7 +28,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
   write procedures*/
 
 #include <p2c/p2c.h>
-#include "ganglion.h"
+#include "ana/ganglion.h"
 
 
 #define N_CapVinGnd     1
diff --git a/log/src/ana/globals.c b/log/src/ana/globals.c
index c1bd74422e094942fac0f096409a2643281bc082..de9a1c7f59a4f804029e592452d469aab1a2b7ed 100644
--- a/log/src/ana/globals.c
+++ b/log/src/ana/globals.c
@@ -34,7 +34,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #define GLOBALS_G
-#include "globals.h"
+#include "ana/globals.h"
 
 #ifndef NEWCRT_H
 #include <p2c/newcrt.h>
@@ -1124,14 +1124,14 @@ void AnaParamUpdate()
   AnaPhysical.Ut = (AnaPhysical.k*AnaPhysical.T)/AnaPhysical.q;
 
   if (AnaPhysical.T < 150)
-    AnaGenFab.Eg = (1.1700 + 1.059e-5*AnaPhysical.T - 
+    AnaGenFab.Eg = (1.1700 + 1.059e-5*AnaPhysical.T -
 	  	      6.05e-7*AnaPhysical.T*AnaPhysical.T)*AnaPhysical.q;
   else
-    AnaGenFab.Eg = (1.1785 - 9.025e-5*AnaPhysical.T - 
+    AnaGenFab.Eg = (1.1785 - 9.025e-5*AnaPhysical.T -
 	  	      3.05e-7*AnaPhysical.T*AnaPhysical.T)*AnaPhysical.q;
   AnaGenFab.ni = 1.640e15*pow(AnaPhysical.T,1.706)*
                  exp(-AnaGenFab.Eg/(2*AnaPhysical.k*AnaPhysical.T));
-    
+
   AnaNFab.Cox = AnaPhysical.e_ox/AnaNFab.Tox;
   AnaPFab.Cox = AnaPhysical.e_ox/AnaPFab.Tox;
 
diff --git a/log/src/ana/hres.c b/log/src/ana/hres.c
index 83a59151b8bf5c2ec1a74580004dd04126b06c45..766795a01de5e5259a9c3521d5d2c95c8e5fe8c9 100644
--- a/log/src/ana/hres.c
+++ b/log/src/ana/hres.c
@@ -28,7 +28,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
   write procedures*/
 
 #include <p2c/p2c.h>
-#include "hres.h"
+#include "ana/hres.h"
 
 
 #define N_Voffset       1
@@ -1152,7 +1152,7 @@ Analog_32_action *act;
       HresVar->TauVhigh * (DeltaVin - VPinHigh + VMemHigh) +
       HresVar->TauVlow * (DeltaVin - VPinLow + VMemLow) +
       HresVar->TauVdiff * (DeltaVin - VPinOut + VMemOut) + act->Iin;
-/* p2c: stdlib.text, line 3079: 
+/* p2c: stdlib.text, line 3079:
  * Note: Line breaker spent 3.0 seconds, 5000 tries on line 1182 [251] */
     AnaCapIin(act);   /*Add nodal capacitance*/
     break;
diff --git a/log/src/ana/idiff.c b/log/src/ana/idiff.c
index adb1191793b7e8fa951c8fad61d5a6b1420a0a50..9b5a169a698ef4b2110dd549d374a283c42ef993 100644
--- a/log/src/ana/idiff.c
+++ b/log/src/ana/idiff.c
@@ -32,7 +32,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #define IDIFF_G
-#include "idiff.h"
+#include "ana/idiff.h"
 
 
 /*For Attributes*/
@@ -226,7 +226,7 @@ Analog_32_action *act;
   	else
     	Ftime = IDiffVar->Time + AnaDt;
 
-	switch (WITH->attr[N_Type - 1].UU.nv) 
+	switch (WITH->attr[N_Type - 1].UU.nv)
 	{
   		case 0:
     		Fout = WITH->attr[N_Dc - 1].UU.r;
@@ -245,7 +245,7 @@ Analog_32_action *act;
 	       				sin(6.2831853 * (WITH->attr[N_sFreq - 1].UU.r *
 						(Ftime - WITH->attr[N_sDelay - 1].UU.r) +
 						WITH->attr[N_sPhase - 1].UU.r / 360));
-			
+
 			break;
 
 		default:
@@ -258,8 +258,8 @@ Analog_32_action *act;
     	MinI2 = Fout * Blend;
     	dI2dV2 = Etemp * Blend * Blend;
     	dI2dV2 *= 7080 * Fout;
-  	} 
-	else 
+  	}
+	else
 	{
     	if (Th > 0)
       		MinI2 = 0.0;
@@ -313,7 +313,7 @@ Analog_32_action *act;
   	VPin1 = Pin1Ptr->now;
   	Pin2Ptr = (AnaExt_rec *)WITH->pin[1]->info;
   	Vpin2 = Pin2Ptr->now;
-  	switch (act->pin) 
+  	switch (act->pin)
 	{
   		case 1:
     		WITH = act->inst;
@@ -322,7 +322,7 @@ Analog_32_action *act;
 			else
       			Ftime = IDiffVar->Time + AnaDtlast;
 
-			switch (WITH->attr[N_Type - 1].UU.nv) 
+			switch (WITH->attr[N_Type - 1].UU.nv)
 			{
     			case 0:
       				Fout = WITH->attr[N_Dc - 1].UU.r;
@@ -349,7 +349,7 @@ Analog_32_action *act;
 			Th = Vpin2 - VPin1 + WITH->attr[N_Crowbar - 1].UU.r;
     		if (fabs(Th) < 0.1)
       			act->Iin = Fout / (1 + AnaExpo(7080 * Th)) + act->Iin;
-    		else 
+    		else
 			{
       			if (Th < 0)
 					act->Iin = Fout + act->Iin;
@@ -364,7 +364,7 @@ Analog_32_action *act;
 			else
 				Ftime = IDiffVar->Time + AnaDtlast;
 
-			switch (WITH->attr[N_Type - 1].UU.nv) 
+			switch (WITH->attr[N_Type - 1].UU.nv)
 			{
     			case 0:
       				Fout = WITH->attr[N_Dc - 1].UU.r;
diff --git a/log/src/ana/inter.c b/log/src/ana/inter.c
index 3e4ca84de57c6eab86f66e5ae1db852a83204188..420003c8e561e50d685f15715a081de12c5a646d 100644
--- a/log/src/ana/inter.c
+++ b/log/src/ana/inter.c
@@ -30,7 +30,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #define INTER_G
-#include "inter.h"
+#include "ana/inter.h"
 
 
 
@@ -588,7 +588,7 @@ static void log_history_32(log_action_t *Globals, int Voltage)
 
 static void log_histval_32(log_action_t *Globals, int Voltage)
 {
-	switch (Globals->actgattr[AnaH_Method - 1].UU.nv) 
+	switch (Globals->actgattr[AnaH_Method - 1].UU.nv)
 	{
   		case AnaLinear:
     	Globals->actval = (Globals->actval - Globals->actgattr[AnaH_LinOffset - 1].UU.r) /
@@ -599,7 +599,7 @@ static void log_histval_32(log_action_t *Globals, int Voltage)
     		if (fabs(Globals->actval) < Globals->actgattr[AnaH_Vzero - 1].UU.r)
       			Globals->actval = -Globals->actgattr[AnaH_LogOffset - 1].UU.r;
     		else
-      			Globals->actval = AnaInvLn10 * log(fabs(Globals->actval) / 
+      			Globals->actval = AnaInvLn10 * log(fabs(Globals->actval) /
 						Globals->actgattr[AnaH_Vzero - 1].UU.r) -
 						Globals->actgattr[AnaH_LogOffset - 1].UU.r;
     		break;
@@ -632,10 +632,10 @@ static void log_histstr_32(log_action_t *Globals, int Voltage)
   	else
     	strcpy(Unit, "A");
 
-  	switch (WITH->actgattr[AnaH_Method - 1].UU.nv) 
+  	switch (WITH->actgattr[AnaH_Method - 1].UU.nv)
 	{
   		case AnaLinear:
-    		switch (WITH->acty) 
+    		switch (WITH->acty)
 			{
     			case Delta:
     			case Slope:
@@ -657,7 +657,7 @@ static void log_histstr_32(log_action_t *Globals, int Voltage)
     		break;
 
   		case AnaLog:
-    		switch (WITH->acty) 
+    		switch (WITH->acty)
 			{
     			case Delta:
       				Temp = AnaExpo(AnaLn10 * WITH->actval);
diff --git a/log/src/ana/iscope.c b/log/src/ana/iscope.c
index f8549b2056cc7da92ab885a0a7ae1959fedf46f7..49757e7049c34c41d964a0306c8308f0c1a43810 100644
--- a/log/src/ana/iscope.c
+++ b/log/src/ana/iscope.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "iscope.h"
+#include "ana/iscope.h"
 
 
 #define N_Present       1
diff --git a/log/src/ana/iswitch1.c b/log/src/ana/iswitch1.c
index 931de29f8b806416881fa246dc87b775ee9c8bc3..2e8051acaa062a4b84a00fde0022d2423dc34f4d 100644
--- a/log/src/ana/iswitch1.c
+++ b/log/src/ana/iswitch1.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "iswitch1.h"
+#include "ana/iswitch1.h"
 
 
 /*For Attributes*/
@@ -220,7 +220,7 @@ Analog_32_action *act;
   	Pin1Ptr = (AnaExt_rec *)WITH->pin[0]->info;
   	Pin1 = Pin1Ptr->nodenum;
   	VPin1 = Pin1Ptr->last;   /*Use with statement to get to internal variables*/
-  	switch (WITH->attr[N_Type - 1].UU.nv) 
+  	switch (WITH->attr[N_Type - 1].UU.nv)
 	{
   		case Bistable:
     		Fout = Bistablemaker(act->inst, Iswitch1Var->Time, Iswitch1Var->State,
@@ -231,7 +231,7 @@ Analog_32_action *act;
     		Fout = Monostablemaker(act->inst, Iswitch1Var->Time, Iswitch1Var->State,
 					true, Iswitch1Var->OldIideal);
     		break;
-		
+
 		default:
 			Fout = 0;
 	}
@@ -283,11 +283,11 @@ Analog_32_action *act;
   	Iswitch1Var = (Iswitch1Const *)A_Gate->InstVar;
   	Pin1Ptr = (AnaExt_rec *)WITH->pin[0]->info;
   	VPin1 = Pin1Ptr->now;
-  	switch (act->pin) 
+  	switch (act->pin)
 	{
   		case 1:
     		WITH = act->inst;
-    		switch (WITH->attr[N_Type - 1].UU.nv) 
+    		switch (WITH->attr[N_Type - 1].UU.nv)
 			{
     			case Bistable:
       				Fout = Bistablemaker(act->inst, Iswitch1Var->Time, Iswitch1Var->State,
@@ -811,7 +811,7 @@ Analog_32_action *act;
 
   WITH = AnaLogglobals;
   WITH1 = act->inst;
-  if ((WITH->actx != -2 && WITH->actx != -3) && 
+  if ((WITH->actx != -2 && WITH->actx != -3) &&
       (WITH->actx != -4 || WITH->acty != 0))
     return;
   A_Gate = (Anainstlist *)act->inst->info;
diff --git a/log/src/ana/iswitch2.c b/log/src/ana/iswitch2.c
index 3863af88f7d092f04364dd0ce6a31742caaa6e73..da5c1d9a4f67201d185ca53e413ea56307393ca3 100644
--- a/log/src/ana/iswitch2.c
+++ b/log/src/ana/iswitch2.c
@@ -28,7 +28,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 #include <p2c/p2c.h>
 
 #define ISWITCH2_G
-#include "iswitch2.h"
+#include "ana/iswitch2.h"
 
 
 /*For Attributes*/
@@ -221,7 +221,7 @@ Analog_32_action *act;
   	Pin1Ptr = (AnaExt_rec *)WITH->pin[0]->info;
   	Pin1 = Pin1Ptr->nodenum;
   	VPin1 = Pin1Ptr->last;   /*Use with statement to get to internal variables*/
-  	switch (WITH->attr[N_Type - 1].UU.nv) 
+  	switch (WITH->attr[N_Type - 1].UU.nv)
 	{
   		case Bistable:
     		Fout = Bistablemaker(act->inst, Iswitch2Var->Time, Iswitch2Var->State,
@@ -284,11 +284,11 @@ Analog_32_action *act;
   	Iswitch2Var = (Iswitch2Const *)A_Gate->InstVar;
   	Pin1Ptr = (AnaExt_rec *)WITH->pin[0]->info;
   	VPin1 = Pin1Ptr->now;
-  	switch (act->pin) 
+  	switch (act->pin)
 	{
   		case 1:
     		WITH = act->inst;
-    		switch (WITH->attr[N_Type - 1].UU.nv) 
+    		switch (WITH->attr[N_Type - 1].UU.nv)
 			{
     			case Bistable:
       				Fout = Bistablemaker(act->inst, Iswitch2Var->Time, Iswitch2Var->State,
@@ -299,14 +299,14 @@ Analog_32_action *act;
       				Fout = Monostablemaker(act->inst, Iswitch2Var->Time, Iswitch2Var->State,
 			     			false, Iswitch2Var->OldIideal);
       			break;
-				
+
 				default:
 					Fout = 0;
     		}
     		Th = WITH->attr[N_Crowbar - 1].UU.r - VPin1;
     		if (fabs(Th) < 0.1)
       			act->Iin = Fout / (1 + AnaExpo(7080 * Th)) + act->Iin;
-    		else 
+    		else
 			{
       			if (Th < 0)
 					act->Iin = Fout + act->Iin;
@@ -811,7 +811,7 @@ Analog_32_action *act;
 
   WITH = AnaLogglobals;
   WITH1 = act->inst;
-  if ((WITH->actx != -2 && WITH->actx != -3) && 
+  if ((WITH->actx != -2 && WITH->actx != -3) &&
       (WITH->actx != -4 || WITH->acty != 0))
     return;
   A_Gate = (Anainstlist *)act->inst->info;
diff --git a/log/src/ana/main.c b/log/src/ana/main.c
index ca7ff5ee1efd747c1d49fedc9ff3b36d2d2e5868..8ccc9bca073f12192c73bb824ff6d380442a16bc 100644
--- a/log/src/ana/main.c
+++ b/log/src/ana/main.c
@@ -28,8 +28,8 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "nsolver.h"
-#include "main.h"
+#include "ana/nsolver.h"
+#include "ana/main.h"
 
 
 #define newci_findprocedure  findprocedure
@@ -257,23 +257,23 @@ void Analog_InitTechnology()
   AnaMaxNFab.mu0  =  1200;
   AnaMinNFab.mu0  =  300;
 
-  AnaNFab.deltaW  =    -0.11e-6; 
+  AnaNFab.deltaW  =    -0.11e-6;
   AnaMaxNFab.deltaW  =  1.0 ;
   AnaMinNFab.deltaW  = -1.0 ;
 
-  AnaNFab.deltaL  =  0.55e-6; 
+  AnaNFab.deltaL  =  0.55e-6;
   AnaMaxNFab.deltaL  = 1.0 ;
   AnaMinNFab.deltaL  = -1.0 ;
 
-  AnaNFab.del_NaS  =       0; 
+  AnaNFab.del_NaS  =       0;
   AnaMaxNFab.del_NaS  =  100;
   AnaMinNFab.del_NaS =  -100;
 
-  AnaNFab.Early_s  =  0.06; 
+  AnaNFab.Early_s  =  0.06;
   AnaMaxNFab.Early_s  =  1;
   AnaMinNFab.Early_s =  0.001;
 
-  AnaNFab.L_0  =  0.04e-6; 
+  AnaNFab.L_0  =  0.04e-6;
   AnaMaxNFab.L_0  =  1e-6;
   AnaMinNFab.L_0 =  -1e-6;
 
@@ -281,11 +281,11 @@ void Analog_InitTechnology()
   AnaMaxNFab.Qss  = 10 ;
   AnaMinNFab.Qss  = -10 ;
 
-  AnaNFab.del_Na0  =       1; 
+  AnaNFab.del_Na0  =       1;
   AnaMaxNFab.del_Na0 =   100;
   AnaMinNFab.del_Na0 =  -100;
 
-  AnaNFab.del_mu  =       1; 
+  AnaNFab.del_mu  =       1;
   AnaMaxNFab.del_mu =   100;
   AnaMinNFab.del_mu =  -100;
 
@@ -332,23 +332,23 @@ void Analog_InitTechnology()
   AnaMaxPFab.mu0  =  1200;
   AnaMinPFab.mu0  =  300;
 
-  AnaPFab.deltaW  =    -0.11e-6; 
+  AnaPFab.deltaW  =    -0.11e-6;
   AnaMaxPFab.deltaW  =  1.0 ;
   AnaMinPFab.deltaW  = -1.0 ;
 
-  AnaPFab.deltaL  =  0.76e-6; 
+  AnaPFab.deltaL  =  0.76e-6;
   AnaMaxPFab.deltaL  = 1.0 ;
   AnaMinPFab.deltaL  = -1.0 ;
 
-  AnaPFab.del_NaS  =       0; 
+  AnaPFab.del_NaS  =       0;
   AnaMaxPFab.del_NaS  =  100;
   AnaMinPFab.del_NaS =  -100;
 
-  AnaPFab.Early_s  =  0.06; 
+  AnaPFab.Early_s  =  0.06;
   AnaMaxPFab.Early_s  =  1;
   AnaMinPFab.Early_s =  0.001;
 
-  AnaPFab.L_0  =  0.04e-6; 
+  AnaPFab.L_0  =  0.04e-6;
   AnaMaxPFab.L_0  =  1e-6;
   AnaMinPFab.L_0 =  -1e-6;
 
@@ -356,11 +356,11 @@ void Analog_InitTechnology()
   AnaMaxPFab.Qss  = 10 ;
   AnaMinPFab.Qss  = -10 ;
 
-  AnaPFab.del_Na0  =       1; 
+  AnaPFab.del_Na0  =       1;
   AnaMaxPFab.del_Na0 =   100;
   AnaMinPFab.del_Na0 =  -100;
 
-  AnaPFab.del_mu  =       1; 
+  AnaPFab.del_mu  =       1;
   AnaMaxPFab.del_mu =   100;
   AnaMinPFab.del_mu =  -100;
 
@@ -470,7 +470,7 @@ void Analog_InitVar()
   AnaLevelmap.Level_e = 48;
   AnaLevelmap.Level_sum = 50;
 
-  
+
   AnaChanged = false;
   AnaChangedP = false;
   AnaReady = false;
@@ -797,7 +797,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "T")) {
 	TRY(try1);
 	  AnaPhysical.T = strtod(Arg, &STR1);
-	  if (AnaPhysical.T <=  AnaMinPhysical.T || 
+	  if (AnaPhysical.T <=  AnaMinPhysical.T ||
               AnaPhysical.T >   AnaMaxPhysical.T )
 	    AnaPhysical.T = 300;
 	RECOVER(try1);
@@ -808,7 +808,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "K")) {
 	TRY(try1);
 	  AnaPhysical.k = strtod(Arg, &STR1);
-	  if (AnaPhysical.k <=  AnaMinPhysical.k || 
+	  if (AnaPhysical.k <=  AnaMinPhysical.k ||
               AnaPhysical.k >   AnaMaxPhysical.k )
 	    AnaPhysical.k = 1.380658e-23;
 	RECOVER(try1);
@@ -819,7 +819,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "Q")) {
 	TRY(try1);
 	  AnaPhysical.q = strtod(Arg, &STR1);
-	  if (AnaPhysical.q <=  AnaMinPhysical.q || 
+	  if (AnaPhysical.q <=  AnaMinPhysical.q ||
               AnaPhysical.q >   AnaMaxPhysical.q )
 	    AnaPhysical.q = 1.60217733e-19;
 	RECOVER(try1);
@@ -830,7 +830,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "E_V")) {
 	TRY(try1);
 	  AnaPhysical.e_v = strtod(Arg, &STR1);
-	  if (AnaPhysical.e_v <=  AnaMinPhysical.e_v || 
+	  if (AnaPhysical.e_v <=  AnaMinPhysical.e_v ||
               AnaPhysical.e_v >   AnaMaxPhysical.e_v )
 	    AnaPhysical.e_v = 8.854187817e-12;
 	RECOVER(try1);
@@ -841,7 +841,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "E_S")) {
 	TRY(try1);
 	  AnaPhysical.e_s = strtod(Arg, &STR1);
-	  if (AnaPhysical.e_s <=  AnaMinPhysical.e_s || 
+	  if (AnaPhysical.e_s <=  AnaMinPhysical.e_s ||
               AnaPhysical.e_s >   AnaMaxPhysical.e_s )
 	    AnaPhysical.e_s = 11.7*AnaPhysical.e_v;
 	RECOVER(try1);
@@ -852,7 +852,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "E_OX")) {
 	TRY(try1);
 	  AnaPhysical.e_ox = strtod(Arg, &STR1);
-	  if (AnaPhysical.e_ox <=  AnaMinPhysical.e_ox || 
+	  if (AnaPhysical.e_ox <=  AnaMinPhysical.e_ox ||
               AnaPhysical.e_ox >   AnaMaxPhysical.e_ox )
 	    AnaPhysical.e_ox = 3.9*AnaPhysical.e_v;
 	RECOVER(try1);
@@ -863,7 +863,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "PHI_MS")) {
 	TRY(try1);
 	  AnaGenFab.phi_ms = strtod(Arg, &STR1);
-	  if (AnaGenFab.phi_ms <=  AnaMinGenFab.phi_ms || 
+	  if (AnaGenFab.phi_ms <=  AnaMinGenFab.phi_ms ||
               AnaGenFab.phi_ms >   AnaMaxGenFab.phi_ms )
 	    AnaGenFab.phi_ms = -0.3;
 	RECOVER(try1);
@@ -890,7 +890,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "LAMBDA")) {
 	TRY(try1);
 	  AnaGenFab.lambda = strtod(Arg, &STR1);
-	  if (AnaGenFab.lambda <=  AnaMinGenFab.lambda || 
+	  if (AnaGenFab.lambda <=  AnaMinGenFab.lambda ||
               AnaGenFab.lambda >   AnaMaxGenFab.lambda )
 	    AnaGenFab.lambda = 1e-6;
 	RECOVER(try1);
@@ -901,7 +901,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "TOX")) {
 	TRY(try1);
 	  AnaNFab.Tox = strtod(Arg, &STR1);
-	  if (AnaNFab.Tox <=  AnaMinNFab.Tox || 
+	  if (AnaNFab.Tox <=  AnaMinNFab.Tox ||
               AnaNFab.Tox >   AnaMaxNFab.Tox )
 	    AnaNFab.Tox = 216e-10;
 	RECOVER(try1);
@@ -912,7 +912,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "PSI")) {
 	TRY(try1);
 	  AnaNFab.psi = strtod(Arg, &STR1);
-	  if (AnaNFab.psi <=  AnaMinNFab.psi || 
+	  if (AnaNFab.psi <=  AnaMinNFab.psi ||
               AnaNFab.psi >   AnaMaxNFab.psi )
 	    AnaNFab.psi = 0.6;
 	RECOVER(try1);
@@ -923,7 +923,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "NA")) {
 	TRY(try1);
 	  AnaNFab.Na = strtod(Arg, &STR1);
-	  if (AnaNFab.Na <=  AnaMinNFab.Na || 
+	  if (AnaNFab.Na <=  AnaMinNFab.Na ||
               AnaNFab.Na >   AnaMaxNFab.Na )
 	    AnaNFab.Na = 3.11e16;
 	RECOVER(try1);
@@ -934,7 +934,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "MU0")) {
 	TRY(try1);
 	  AnaNFab.mu0 = strtod(Arg, &STR1);
-	  if (AnaNFab.mu0 <=  AnaMinNFab.mu0 || 
+	  if (AnaNFab.mu0 <=  AnaMinNFab.mu0 ||
               AnaNFab.mu0 >   AnaMaxNFab.mu0 )
 	    AnaNFab.mu0 = 686.6;
 	RECOVER(try1);
@@ -945,7 +945,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "DELTAW")) {
 	TRY(try1);
 	  AnaNFab.deltaW = strtod(Arg, &STR1);
-	  if (AnaNFab.deltaW <=  AnaMinNFab.deltaW || 
+	  if (AnaNFab.deltaW <=  AnaMinNFab.deltaW ||
               AnaNFab.deltaW >   AnaMaxNFab.deltaW )
 	    AnaNFab.deltaW = -0.11e-6;
 	RECOVER(try1);
@@ -956,7 +956,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "DELTAL")) {
 	TRY(try1);
 	  AnaNFab.deltaL = strtod(Arg, &STR1);
-	  if (AnaNFab.deltaL <=  AnaMinNFab.deltaL || 
+	  if (AnaNFab.deltaL <=  AnaMinNFab.deltaL ||
               AnaNFab.deltaL >   AnaMaxNFab.deltaL )
 	    AnaNFab.deltaL = 0.55e-6;
 	RECOVER(try1);
@@ -967,7 +967,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "DEL_NAS")) {
 	TRY(try1);
 	  AnaNFab.del_NaS = strtod(Arg, &STR1);
-	  if (AnaNFab.del_NaS <=  AnaMinNFab.del_NaS || 
+	  if (AnaNFab.del_NaS <=  AnaMinNFab.del_NaS ||
               AnaNFab.del_NaS >   AnaMaxNFab.del_NaS )
 	    AnaNFab.del_NaS = 0;
 	RECOVER(try1);
@@ -978,7 +978,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "EARLY_S")) {
 	TRY(try1);
 	  AnaNFab.Early_s = strtod(Arg, &STR1);
-	  if (AnaNFab.Early_s <=  AnaMinNFab.Early_s || 
+	  if (AnaNFab.Early_s <=  AnaMinNFab.Early_s ||
               AnaNFab.Early_s >   AnaMaxNFab.Early_s )
 	    AnaNFab.Early_s = 0.06;
 	RECOVER(try1);
@@ -989,18 +989,18 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "L_0")) {
 	TRY(try1);
 	  AnaNFab.L_0 = strtod(Arg, &STR1);
-	  if (AnaNFab.L_0 <=  AnaMinNFab.L_0 || 
+	  if (AnaNFab.L_0 <=  AnaMinNFab.L_0 ||
               AnaNFab.L_0 >   AnaMaxNFab.L_0 )
 	    AnaNFab.L_0 = 0.04e-6;
 	RECOVER(try1);
 	  AnaNFab.L_0 = 0.04e-6;
 	ENDTRY(try1);
       }
-      
+
       if (!strcmp(Keyword, "ACACTIVE")) {
 	TRY(try1);
 	  AnaNFab.aCactive = strtod(Arg, &STR1);
-	  if (AnaNFab.aCactive <=  AnaMinNFab.aCactive || 
+	  if (AnaNFab.aCactive <=  AnaMinNFab.aCactive ||
               AnaNFab.aCactive >   AnaMaxNFab.aCactive )
 	    AnaNFab.aCactive = 280e-18;
 	RECOVER(try1);
@@ -1011,7 +1011,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "ACWELL")) {
 	TRY(try1);
 	  AnaNFab.aCwell = strtod(Arg, &STR1);
-	  if (AnaNFab.aCwell <=  AnaMinNFab.aCwell || 
+	  if (AnaNFab.aCwell <=  AnaMinNFab.aCwell ||
               AnaNFab.aCwell >   AnaMaxNFab.aCwell )
 	    AnaNFab.aCwell = 30e-18;
 	RECOVER(try1);
@@ -1022,7 +1022,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "LINCGS")) {
 	TRY(try1);
 	  AnaNFab.linCgs = strtod(Arg, &STR1);
-	  if (AnaNFab.linCgs <=  AnaMinNFab.linCgs || 
+	  if (AnaNFab.linCgs <=  AnaMinNFab.linCgs ||
               AnaNFab.linCgs >   AnaMaxNFab.linCgs )
 	    AnaNFab.linCgs = 3e-16;
 	RECOVER(try1);
@@ -1033,7 +1033,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "ACGW")) {
 	TRY(try1);
 	  AnaNFab.aCgw = strtod(Arg, &STR1);
-	  if (AnaNFab.aCgw <=  AnaMinNFab.aCgw || 
+	  if (AnaNFab.aCgw <=  AnaMinNFab.aCgw ||
               AnaNFab.aCgw >   AnaMaxNFab.aCgw )
 	    AnaNFab.aCgw = 10e-18;
 	RECOVER(try1);
@@ -1062,7 +1062,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "LAMBDA")) {
 	TRY(try1);
 	  AnaGenFab.lambda = strtod(Arg, &STR1);
-	  if (AnaGenFab.lambda <=  AnaMinGenFab.lambda || 
+	  if (AnaGenFab.lambda <=  AnaMinGenFab.lambda ||
               AnaGenFab.lambda >   AnaMaxGenFab.lambda )
 	    AnaGenFab.lambda = 1e-6;
 	RECOVER(try1);
@@ -1073,7 +1073,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "TOX")) {
 	TRY(try1);
 	  AnaPFab.Tox = strtod(Arg, &STR1);
-	  if (AnaPFab.Tox <=  AnaMinPFab.Tox || 
+	  if (AnaPFab.Tox <=  AnaMinPFab.Tox ||
               AnaPFab.Tox >   AnaMaxPFab.Tox )
 	    AnaPFab.Tox = 216e-10;
 	RECOVER(try1);
@@ -1084,7 +1084,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "PSI")) {
 	TRY(try1);
 	  AnaPFab.psi = strtod(Arg, &STR1);
-	  if (AnaPFab.psi <=  AnaMinPFab.psi || 
+	  if (AnaPFab.psi <=  AnaMinPFab.psi ||
               AnaPFab.psi >   AnaMaxPFab.psi )
 	    AnaPFab.psi = 0.6;
 	RECOVER(try1);
@@ -1096,7 +1096,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "NA")) {
 	TRY(try1);
 	  AnaPFab.Na = strtod(Arg, &STR1);
-	  if (AnaPFab.Na <=  AnaMinPFab.Na || 
+	  if (AnaPFab.Na <=  AnaMinPFab.Na ||
               AnaPFab.Na >   AnaMaxPFab.Na )
 	    AnaPFab.Na = 2.69e16;
 	RECOVER(try1);
@@ -1107,7 +1107,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "MU0")) {
 	TRY(try1);
 	  AnaPFab.mu0 = strtod(Arg, &STR1);
-	  if (AnaPFab.mu0 <=  AnaMinPFab.mu0 || 
+	  if (AnaPFab.mu0 <=  AnaMinPFab.mu0 ||
               AnaPFab.mu0 >   AnaMaxPFab.mu0 )
 	    AnaPFab.mu0 = 205;
 	RECOVER(try1);
@@ -1118,7 +1118,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "DELTAW")) {
 	TRY(try1);
 	  AnaPFab.deltaW = strtod(Arg, &STR1);
-	  if (AnaPFab.deltaW <=  AnaMinPFab.deltaW || 
+	  if (AnaPFab.deltaW <=  AnaMinPFab.deltaW ||
               AnaPFab.deltaW >   AnaMaxPFab.deltaW )
 	    AnaPFab.deltaW = -0.11e-6;
 	RECOVER(try1);
@@ -1129,7 +1129,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "DELTAL")) {
 	TRY(try1);
 	  AnaPFab.deltaL = strtod(Arg, &STR1);
-	  if (AnaPFab.deltaL <=  AnaMinPFab.deltaL || 
+	  if (AnaPFab.deltaL <=  AnaMinPFab.deltaL ||
               AnaPFab.deltaL >   AnaMaxPFab.deltaL )
 	    AnaPFab.deltaL = 0.76e-6;
 	RECOVER(try1);
@@ -1140,7 +1140,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "DEL_NAS")) {
 	TRY(try1);
 	  AnaPFab.del_NaS = strtod(Arg, &STR1);
-	  if (AnaPFab.del_NaS <=  AnaMinPFab.del_NaS || 
+	  if (AnaPFab.del_NaS <=  AnaMinPFab.del_NaS ||
               AnaPFab.del_NaS >   AnaMaxPFab.del_NaS )
 	    AnaPFab.del_NaS = 0;
 	RECOVER(try1);
@@ -1151,7 +1151,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "EARLY_S")) {
 	TRY(try1);
 	  AnaPFab.Early_s = strtod(Arg, &STR1);
-	  if (AnaPFab.Early_s <=  AnaMinPFab.Early_s || 
+	  if (AnaPFab.Early_s <=  AnaMinPFab.Early_s ||
               AnaPFab.Early_s >   AnaMaxPFab.Early_s )
 	    AnaPFab.Early_s = 0.06;
 	RECOVER(try1);
@@ -1162,7 +1162,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "L_0")) {
 	TRY(try1);
 	  AnaPFab.L_0 = strtod(Arg, &STR1);
-	  if (AnaPFab.L_0 <=  AnaMinPFab.L_0 || 
+	  if (AnaPFab.L_0 <=  AnaMinPFab.L_0 ||
               AnaPFab.L_0 >   AnaMaxPFab.L_0 )
 	    AnaPFab.L_0 = 0.04e-6;
 	RECOVER(try1);
@@ -1173,7 +1173,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "ACACTIVE")) {
 	TRY(try1);
 	  AnaPFab.aCactive = strtod(Arg, &STR1);
-	  if (AnaPFab.aCactive <=  AnaMinPFab.aCactive || 
+	  if (AnaPFab.aCactive <=  AnaMinPFab.aCactive ||
               AnaPFab.aCactive >   AnaMaxPFab.aCactive )
 	    AnaPFab.aCactive = 280e-18;
 	RECOVER(try1);
@@ -1184,7 +1184,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "ACWELL")) {
 	TRY(try1);
 	  AnaPFab.aCwell = strtod(Arg, &STR1);
-	  if (AnaPFab.aCwell <=  AnaMinPFab.aCwell || 
+	  if (AnaPFab.aCwell <=  AnaMinPFab.aCwell ||
               AnaPFab.aCwell >   AnaMaxPFab.aCwell )
 	    AnaPFab.aCwell = 30e-18;
 	RECOVER(try1);
@@ -1195,7 +1195,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "LINCGS")) {
 	TRY(try1);
 	  AnaPFab.linCgs = strtod(Arg, &STR1);
-	  if (AnaPFab.linCgs <=  AnaMinPFab.linCgs || 
+	  if (AnaPFab.linCgs <=  AnaMinPFab.linCgs ||
               AnaPFab.linCgs >   AnaMaxPFab.linCgs )
 	    AnaPFab.linCgs = 3e-16;
 	RECOVER(try1);
@@ -1206,7 +1206,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "ACGW")) {
 	TRY(try1);
 	  AnaPFab.aCgw = strtod(Arg, &STR1);
-	  if (AnaPFab.aCgw <=  AnaMinPFab.aCgw || 
+	  if (AnaPFab.aCgw <=  AnaMinPFab.aCgw ||
               AnaPFab.aCgw >   AnaMaxPFab.aCgw )
 	    AnaPFab.aCgw = 280e-18;
 	RECOVER(try1);
@@ -1234,7 +1234,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "QSS")) {
 	TRY(try1);
 	  AnaNFab.Qss = strtod(Arg, &STR1);
-	  if (AnaNFab.Qss <=  AnaMinNFab.Qss || 
+	  if (AnaNFab.Qss <=  AnaMinNFab.Qss ||
               AnaNFab.Qss >   AnaMaxNFab.Qss )
 	    AnaNFab.Qss = 0.00061;
 	RECOVER(try1);
@@ -1245,7 +1245,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "DEL_NA0")) {
 	TRY(try1);
 	  AnaNFab.del_Na0 = strtod(Arg, &STR1);
-	  if (AnaNFab.del_Na0 <=  AnaMinNFab.del_Na0 || 
+	  if (AnaNFab.del_Na0 <=  AnaMinNFab.del_Na0 ||
               AnaNFab.del_Na0 >   AnaMaxNFab.del_Na0 )
 	    AnaNFab.del_Na0 = 1;
 	RECOVER(try1);
@@ -1256,7 +1256,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "DEL_MU")) {
 	TRY(try1);
 	  AnaNFab.del_mu = strtod(Arg, &STR1);
-	  if (AnaNFab.del_mu <=  AnaMinNFab.del_mu || 
+	  if (AnaNFab.del_mu <=  AnaMinNFab.del_mu ||
               AnaNFab.del_mu >   AnaMaxNFab.del_mu )
 	    AnaNFab.del_mu = 1;
 	RECOVER(try1);
@@ -1284,7 +1284,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "QSS")) {
 	TRY(try1);
 	  AnaPFab.Qss = strtod(Arg, &STR1);
-	  if (AnaPFab.Qss <=  AnaMinPFab.Qss || 
+	  if (AnaPFab.Qss <=  AnaMinPFab.Qss ||
               AnaPFab.Qss >   AnaMaxPFab.Qss )
 	    AnaPFab.Qss = 0.000126;
 	RECOVER(try1);
@@ -1295,7 +1295,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "DEL_NA0")) {
 	TRY(try1);
 	  AnaPFab.del_Na0 = strtod(Arg, &STR1);
-	  if (AnaPFab.del_Na0 <=  AnaMinPFab.del_Na0 || 
+	  if (AnaPFab.del_Na0 <=  AnaMinPFab.del_Na0 ||
               AnaPFab.del_Na0 >   AnaMaxPFab.del_Na0 )
 	    AnaPFab.del_Na0 = 0.835;
 	RECOVER(try1);
@@ -1306,7 +1306,7 @@ void Analog_TechnologyCnf()
       if (!strcmp(Keyword, "DEL_MU")) {
 	TRY(try1);
 	  AnaPFab.del_mu = strtod(Arg, &STR1);
-	  if (AnaPFab.del_mu <=  AnaMinPFab.del_mu || 
+	  if (AnaPFab.del_mu <=  AnaMinPFab.del_mu ||
               AnaPFab.del_mu >   AnaMaxPFab.del_mu )
 	    AnaPFab.del_mu = 1;
 	RECOVER(try1);
diff --git a/log/src/ana/mmeter.c b/log/src/ana/mmeter.c
index 35550c5cd049e9dc530a50ac4eeafdfb704bc31e..21378124ee67e84869c3adc3379fad57e2da6803 100644
--- a/log/src/ana/mmeter.c
+++ b/log/src/ana/mmeter.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "mmeter.h"
+#include "ana/mmeter.h"
 
 #define N_Present       1
 #define N_Format        2
diff --git a/log/src/ana/moscap.c b/log/src/ana/moscap.c
index e7f5f5c7a2192438b51f5fa2637c9d07d192b0ab..643274ddb0426047f7b823dd510e8200283e0d03 100644
--- a/log/src/ana/moscap.c
+++ b/log/src/ana/moscap.c
@@ -28,7 +28,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
   write procedures*/
 
 #include <p2c/p2c.h>
-#include "moscap.h"
+#include "ana/moscap.h"
 
 
 #define N_Model         1
diff --git a/log/src/ana/nfet4.c b/log/src/ana/nfet4.c
index b637cf80130cac2cb18ebfb517df9d6f9673c526..44c3e584979847cf13203dc5e890c9396ccb295f 100644
--- a/log/src/ana/nfet4.c
+++ b/log/src/ana/nfet4.c
@@ -27,7 +27,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "nfet4.h"
+#include "ana/nfet4.h"
 
 
 #define Cstart          1
@@ -99,7 +99,7 @@ Analog_32_action *act;
 	 Vgs_InvBlendVds_dBlendVgsdS, Vds_dTanch_Temp3_Itotal,
 	 F_dTanch_Itotal, dSaturatedD_Itotal, dSaturatedG_Itotal,
 	 dSaturatedS_Itotal;
-/* p2c: gates.text, line 1996: 
+/* p2c: gates.text, line 1996:
  * Note: Line breaker spent 4.0 seconds, 5000 tries on line 85 [251] */
   log_grec *WITH;
   AnaMatRec *WITH1;
diff --git a/log/src/ana/nfet5.c b/log/src/ana/nfet5.c
index 808f4655f9f43f28c51bb1c57423b55dcc0b9aae..6d8f82f317f2761e582cc75ad8f56ee75ced7cf9 100644
--- a/log/src/ana/nfet5.c
+++ b/log/src/ana/nfet5.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "nfet5.h"
+#include "ana/nfet5.h"
 
 
 #define Cstart          1
diff --git a/log/src/ana/nfet7f.c b/log/src/ana/nfet7f.c
index 7d14183e0ba78b4b8af395f497b617c6c96ea886..bb5ffc3a10dd501e68789ed800ed449d779fcf49 100644
--- a/log/src/ana/nfet7f.c
+++ b/log/src/ana/nfet7f.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "nfet7f.h"
+#include "ana/nfet7f.h"
 
 
 #define Cstart          1
@@ -46,12 +46,12 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 typedef struct NfetConst {
-  double k1;  /* Vfb + phi_b */ 
-  double k2;  /* 1/Cox */ 
+  double k1;  /* Vfb + phi_b */
+  double k2;  /* 1/Cox */
   double k3;  /* 2*e_s*rho*1e10*phi_b */
   double k4;  /* 2*e_s*rho*1e10 */
   double k5;  /* phi_f */
-  double k6;  /* 1.66667 */  
+  double k6;  /* 1.66667 */
   double k7;  /* - Vfb */
   double k8;  /* 0.5*rho*e_s*1e10 */
   double k9;  /* (1/(2*Ut)) */
@@ -66,8 +66,8 @@ typedef struct NfetConst {
   double k18; /* Early_s */
   double k19; /* Leff - L_0 */
 
-  double Cgd; /* computed capacitance */  
-  double Cgs; /* computed capacitance */  
+  double Cgd; /* computed capacitance */
+  double Cgs; /* computed capacitance */
   double TauCgd;   /*Tau for capacitor*/
   double TauCgs;   /*Tau for capacitor*/
   double NewVt;
@@ -107,7 +107,7 @@ log_grec *Inst;
   rho     = AnaPhysical.q*AnaNFab.Na*del_Na;
   phi_f   = AnaPhysical.Ut*log((AnaNFab.Na*del_Na)/AnaGenFab.ni);
   phi_b   = 2*phi_f;
-  Vfb   = AnaGenFab.phi_ms - 
+  Vfb   = AnaGenFab.phi_ms -
           (AnaNFab.Qss + Inst->attr[N_QssOffset - 1].UU.r)/AnaNFab.Cox;
   beta  = AnaNFab.mu*1e-4*(Inst->attr[N_MuOffset - 1].UU.r)*
           AnaNFab.Cox*(Weff/Leff);
@@ -245,7 +245,7 @@ Analog_32_action *act;
     }
   if ((NfetVar->k3 + NfetVar->k4*(Vnear - Vb)) > 0)
     {
-      Vt = NfetVar->k1 + NfetVar->k2*AnaSqrt(NfetVar->k3 + 
+      Vt = NfetVar->k1 + NfetVar->k2*AnaSqrt(NfetVar->k3 +
            NfetVar->k4*(Vnear-Vb));
       tmp1 = NfetVar->k14*(1/(Vt - NfetVar->k1));
       dVtdVd =  tmp1*dVneardVd;
@@ -299,9 +299,9 @@ Analog_32_action *act;
   dIfordVd = tmp15*(dkappadVd*tmp6 - kappa*(dVneardVd + dVtdVd));
   dIfordVb = tmp15*(dkappadVb*tmp6 - kappa*dVtdVb);
   dIrevdVg = tmp16*(dkappadVg*tmp6 + kappa);
-  dIrevdVs = tmp16*(dkappadVs*tmp6 - kappa*(dVneardVs + dVtdVs) 
+  dIrevdVs = tmp16*(dkappadVs*tmp6 - kappa*(dVneardVs + dVtdVs)
              + dVneardVs - dVfardVs);
-  dIrevdVd = tmp16*(dkappadVd*tmp6 - kappa*(dVneardVd + dVtdVd) 
+  dIrevdVd = tmp16*(dkappadVd*tmp6 - kappa*(dVneardVd + dVtdVd)
              + dVneardVd -dVfardVd );
   dIrevdVb= tmp16*(dkappadVb*tmp6 - kappa*dVtdVb);
 
@@ -336,7 +336,7 @@ Analog_32_action *act;
   tmp24 = (Vfar - Vb);
   tmp25 = (1 + lambda*tmp24);
   Ids = Idsi*tmp25;
-  dIdsdVg = dIdsidVg*tmp25 + Idsi*dlambdadVg*tmp24; 
+  dIdsdVg = dIdsidVg*tmp25 + Idsi*dlambdadVg*tmp24;
   dIdsdVs = dIdsidVs*tmp25 + Idsi*(dlambdadVs*tmp24 + lambda*dVfardVs);
   dIdsdVd = dIdsidVd*tmp25 + Idsi*(dlambdadVd*tmp24 + lambda*dVfardVd);
   dIdsdVb = dIdsidVb*tmp25 - Idsi*lambda;
@@ -367,7 +367,7 @@ Analog_32_action *act;
 
   if (AnaChangedDt) /* might also need to catch changes in Cgd */
     NfetVar->TauCgd = NfetVar->Cgd/ AnaDt;
-  ICap = NfetVar->TauCgd * (VMem1 - VMem2 - Vg + Vd);   
+  ICap = NfetVar->TauCgd * (VMem1 - VMem2 - Vg + Vd);
   MinI2 -= ICap;
   dI2dV1 -= NfetVar->TauCgd;
   dI2dV2 += NfetVar->TauCgd;
@@ -500,7 +500,7 @@ Analog_32_action *act;
     case 2:
       {
 	VMem2 = A_Gate->Pininfo[1].Vmem;
-	act->Iin = NfetVar->TauCgd * (VPin2 - VPin1 - VMem2 + VMem1) 
+	act->Iin = NfetVar->TauCgd * (VPin2 - VPin1 - VMem2 + VMem1)
 	           + act->Iin;
       }
       break;
@@ -508,7 +508,7 @@ Analog_32_action *act;
     case 3:
       {
 	VMem3 = A_Gate->Pininfo[2].Vmem;
-	act->Iin = NfetVar->TauCgs * (VPin3 - VPin1 - VMem3 + VMem1) 
+	act->Iin = NfetVar->TauCgs * (VPin3 - VPin1 - VMem3 + VMem1)
 	           + act->Iin;
       }
       break;
@@ -532,7 +532,7 @@ Analog_32_action *act;
       }
     if ((NfetVar->k3 + NfetVar->k4*(Vnear-Vb)) > 0)
       {
-	Vt = NfetVar->k1 + NfetVar->k2*AnaSqrt(NfetVar->k3 
+	Vt = NfetVar->k1 + NfetVar->k2*AnaSqrt(NfetVar->k3
 	     + NfetVar->k4*(Vnear-Vb));
       }
     else
@@ -540,7 +540,7 @@ Analog_32_action *act;
 	Vt = NfetVar->k1;
       }
     phi_s = NfetVar->k5*tanh((NfetVar->k6/Vt)*(Vg - Vb + NfetVar->k7));
-    
+
     if (phi_s > NfetVar->k12)
       {
 	tmp0 = 1/phi_s;
@@ -573,11 +573,11 @@ Analog_32_action *act;
     Ids = Idsi*(1 + lambda*(Vfar - Vb));
 
     switch (act->pin) {
-      
+
     case 2:
       act->Iin += Ids;
       break;
-      
+
     case 3:
       act->Iin -= Ids;
       break;
@@ -736,16 +736,16 @@ long Attrnum;
   switch (Attrnum) {
 
   case N_Wdrawn:
-    if (Inst->attr[N_Wdrawn - 1].UU.r < 0.01 || 
+    if (Inst->attr[N_Wdrawn - 1].UU.r < 0.01 ||
         Inst->attr[N_Wdrawn - 1].blnk ||
 	Inst->attr[N_Wdrawn - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
 	Nfetconsts(Inst);
     break;
 
   case N_Ldrawn:
-    if (Inst->attr[N_Ldrawn - 1].UU.r < 0.01 || 
+    if (Inst->attr[N_Ldrawn - 1].UU.r < 0.01 ||
         Inst->attr[N_Ldrawn - 1].blnk ||
 	Inst->attr[N_Ldrawn - 1].UU.r > 1e6)
       Result = false;
@@ -754,56 +754,56 @@ long Attrnum;
     break;
 
   case N_SArea:
-    if (Inst->attr[N_SArea - 1].UU.r < 1e-12 || 
+    if (Inst->attr[N_SArea - 1].UU.r < 1e-12 ||
         Inst->attr[N_SArea - 1].blnk ||
 	Inst->attr[N_SArea - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Nfetconsts(Inst);
     break;
 
   case N_DArea:
-    if (Inst->attr[N_DArea - 1].UU.r < 1e-12 || 
+    if (Inst->attr[N_DArea - 1].UU.r < 1e-12 ||
         Inst->attr[N_DArea - 1].blnk ||
 	Inst->attr[N_DArea - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Nfetconsts(Inst);
     break;
 
   case N_WArea:
-    if (Inst->attr[N_WArea - 1].UU.r < 1e-12 || 
+    if (Inst->attr[N_WArea - 1].UU.r < 1e-12 ||
         Inst->attr[N_WArea - 1].blnk ||
 	Inst->attr[N_WArea - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Nfetconsts(Inst);
     break;
 
   case N_NaOffset:
-    if (Inst->attr[N_NaOffset - 1].UU.r < 1e-10 || 
+    if (Inst->attr[N_NaOffset - 1].UU.r < 1e-10 ||
         Inst->attr[N_NaOffset - 1].blnk ||
 	Inst->attr[N_NaOffset - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Nfetconsts(Inst);
     break;
 
   case N_MuOffset:
-    if (Inst->attr[N_MuOffset - 1].UU.r < 1e-10 || 
+    if (Inst->attr[N_MuOffset - 1].UU.r < 1e-10 ||
         Inst->attr[N_MuOffset - 1].blnk ||
 	Inst->attr[N_MuOffset - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Nfetconsts(Inst);
     break;
 
   case N_QssOffset:
-    if (Inst->attr[N_QssOffset - 1].UU.r < -1000 || 
+    if (Inst->attr[N_QssOffset - 1].UU.r < -1000 ||
         Inst->attr[N_QssOffset - 1].blnk ||
 	Inst->attr[N_QssOffset - 1].UU.r > 1000)
       Result = false;
-    else 
+    else
       Nfetconsts(Inst);
     break;
 
@@ -1155,17 +1155,17 @@ Analog_32_action *act;
   }
 }
 
-#undef Cstart          
-#undef N_Wdrawn             
-#undef N_Ldrawn             
-#undef N_SArea         
-#undef N_DArea         
-#undef N_NaOffset      
-#undef N_MuOffset      
-#undef N_QssOffset      
-#undef N_Vt            
-#undef N_Kappa         
-#undef Gatename        
+#undef Cstart
+#undef N_Wdrawn
+#undef N_Ldrawn
+#undef N_SArea
+#undef N_DArea
+#undef N_NaOffset
+#undef N_MuOffset
+#undef N_QssOffset
+#undef N_Vt
+#undef N_Kappa
+#undef Gatename
 
 
 
diff --git a/log/src/ana/nfet7t.c b/log/src/ana/nfet7t.c
index dc9d1b77b60e7466d9943d6bb30b197a7952032b..958fab193f4b0348e54d7dfd1c001bea2b5b856d 100644
--- a/log/src/ana/nfet7t.c
+++ b/log/src/ana/nfet7t.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "nfet7t.h"
+#include "ana/nfet7t.h"
 
 
 #define Cstart          1
@@ -45,12 +45,12 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 typedef struct NfetConst {
-  double k1;  /* Vfb + phi_b */ 
-  double k2;  /* 1/Cox */ 
+  double k1;  /* Vfb + phi_b */
+  double k2;  /* 1/Cox */
   double k3;  /* 2*e_s*rho*1e10*phi_b */
   double k4;  /* 2*e_s*rho*1e10 */
   double k5;  /* phi_f */
-  double k6;  /* 1.66667 */  
+  double k6;  /* 1.66667 */
   double k7;  /* - Vfb */
   double k8;  /* 0.5*rho*e_s*1e10 */
   double k9;  /* (1/(2*Ut)) */
@@ -65,13 +65,13 @@ typedef struct NfetConst {
   double k18; /* Early_s */
   double k19; /* Leff - L_0 */
 
-  double Cgd; /* computed capacitance */  
-  double Cgs; /* computed capacitance */  
+  double Cgd; /* computed capacitance */
+  double Cgs; /* computed capacitance */
   double TauCgd;   /*Tau for capacitor*/
   double TauCgs;   /*Tau for capacitor*/
   double NewVt;
   double Newkappa;
-  double NewV0;  
+  double NewV0;
 
 } NfetConst;
 
@@ -108,7 +108,7 @@ log_grec *Inst;
   rho     = AnaPhysical.q*AnaNFab.Na*del_Na;
   phi_f   = AnaPhysical.Ut*log((AnaNFab.Na*del_Na)/AnaGenFab.ni);
   phi_b   = 2*phi_f;
-  Vfb   = AnaGenFab.phi_ms - 
+  Vfb   = AnaGenFab.phi_ms -
           (AnaNFab.Qss + Inst->attr[N_QssOffset - 1].UU.r)/AnaNFab.Cox;
   beta  = AnaNFab.mu*1e-4*(Inst->attr[N_MuOffset - 1].UU.r)*
           AnaNFab.Cox*(Weff/Leff);
@@ -287,9 +287,9 @@ Analog_32_action *act;
   dIfordVs = tmp15*(dkappadVs*tmp6 - kappa*(dVneardVs + dVtdVs));
   dIfordVd = tmp15*(dkappadVd*tmp6 - kappa*(dVneardVd + dVtdVd));
   dIrevdVg = tmp16*(dkappadVg*tmp6 + kappa);
-  dIrevdVs = tmp16*(dkappadVs*tmp6 - kappa*(dVneardVs + dVtdVs) 
+  dIrevdVs = tmp16*(dkappadVs*tmp6 - kappa*(dVneardVs + dVtdVs)
              + dVneardVs - dVfardVs);
-  dIrevdVd = tmp16*(dkappadVd*tmp6 - kappa*(dVneardVd + dVtdVd) 
+  dIrevdVd = tmp16*(dkappadVd*tmp6 - kappa*(dVneardVd + dVtdVd)
              + dVneardVd -dVfardVd );
 
   tmp17 = (1/kappa);
@@ -323,7 +323,7 @@ Analog_32_action *act;
   tmp24 = Vfar;
   tmp25 = (1 + lambda*tmp24);
   Ids = Idsi*tmp25;
-  dIdsdVg = dIdsidVg*tmp25 + Idsi*dlambdadVg*tmp24; 
+  dIdsdVg = dIdsidVg*tmp25 + Idsi*dlambdadVg*tmp24;
   dIdsdVs = dIdsidVs*tmp25 + Idsi*(dlambdadVs*tmp24 + lambda*dVfardVs);
   dIdsdVd = dIdsidVd*tmp25 + Idsi*(dlambdadVd*tmp24 + lambda*dVfardVd);
   NfetVar->NewVt = Vt;
@@ -345,7 +345,7 @@ Analog_32_action *act;
 
   if (AnaChangedDt) /* might also need to catch changes in Cgd */
     NfetVar->TauCgd = NfetVar->Cgd/ AnaDt;
-  ICap = NfetVar->TauCgd * (VMem1 - VMem2 - Vg + Vd);   
+  ICap = NfetVar->TauCgd * (VMem1 - VMem2 - Vg + Vd);
   MinI2 -= ICap;
   dI2dV1 -= NfetVar->TauCgd;
   dI2dV2 += NfetVar->TauCgd;
@@ -456,7 +456,7 @@ Analog_32_action *act;
     case 2:
       {
 	VMem2 = A_Gate->Pininfo[1].Vmem;
-	act->Iin = NfetVar->TauCgd * (VPin2 - VPin1 - VMem2 + VMem1) 
+	act->Iin = NfetVar->TauCgd * (VPin2 - VPin1 - VMem2 + VMem1)
 	           + act->Iin;
       }
       break;
@@ -464,7 +464,7 @@ Analog_32_action *act;
     case 3:
       {
 	VMem3 = A_Gate->Pininfo[2].Vmem;
-	act->Iin = NfetVar->TauCgs * (VPin3 - VPin1 - VMem3 + VMem1) 
+	act->Iin = NfetVar->TauCgs * (VPin3 - VPin1 - VMem3 + VMem1)
 	           + act->Iin;
       }
       break;
@@ -495,7 +495,7 @@ Analog_32_action *act;
 	Vt = NfetVar->k1;
       }
     phi_s = NfetVar->k5*tanh((NfetVar->k6/Vt)*(Vg + NfetVar->k7));
-    
+
     if (phi_s > NfetVar->k12)
       {
 	tmp0 = 1/phi_s;
@@ -526,13 +526,13 @@ Analog_32_action *act;
 	lambda = NfetVar->k11;
       }
     Ids = Idsi*(1 + lambda*Vfar);
-   
+
     switch (act->pin) {
-      
+
     case 2:
       act->Iin += Ids;
       break;
-      
+
     case 3:
       act->Iin -= Ids;
       break;
@@ -661,16 +661,16 @@ long Attrnum;
   switch (Attrnum) {
 
   case N_Wdrawn:
-    if (Inst->attr[N_Wdrawn - 1].UU.r < 0.01 || 
+    if (Inst->attr[N_Wdrawn - 1].UU.r < 0.01 ||
         Inst->attr[N_Wdrawn - 1].blnk ||
 	Inst->attr[N_Wdrawn - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
 	Nfetconsts(Inst);
     break;
 
   case N_Ldrawn:
-    if (Inst->attr[N_Ldrawn - 1].UU.r < 0.01 || 
+    if (Inst->attr[N_Ldrawn - 1].UU.r < 0.01 ||
         Inst->attr[N_Ldrawn - 1].blnk ||
 	Inst->attr[N_Ldrawn - 1].UU.r > 1e6)
       Result = false;
@@ -679,47 +679,47 @@ long Attrnum;
     break;
 
   case N_SArea:
-    if (Inst->attr[N_SArea - 1].UU.r < 1e-12 || 
+    if (Inst->attr[N_SArea - 1].UU.r < 1e-12 ||
         Inst->attr[N_SArea - 1].blnk ||
 	Inst->attr[N_SArea - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Nfetconsts(Inst);
     break;
 
   case N_DArea:
-    if (Inst->attr[N_DArea - 1].UU.r < 1e-12 || 
+    if (Inst->attr[N_DArea - 1].UU.r < 1e-12 ||
         Inst->attr[N_DArea - 1].blnk ||
 	Inst->attr[N_DArea - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Nfetconsts(Inst);
     break;
 
   case N_NaOffset:
-    if (Inst->attr[N_NaOffset - 1].UU.r < 1e-10 || 
+    if (Inst->attr[N_NaOffset - 1].UU.r < 1e-10 ||
         Inst->attr[N_NaOffset - 1].blnk ||
 	Inst->attr[N_NaOffset - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Nfetconsts(Inst);
     break;
 
   case N_MuOffset:
-    if (Inst->attr[N_MuOffset - 1].UU.r < 1e-10 || 
+    if (Inst->attr[N_MuOffset - 1].UU.r < 1e-10 ||
         Inst->attr[N_MuOffset - 1].blnk ||
 	Inst->attr[N_MuOffset - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Nfetconsts(Inst);
     break;
 
   case N_QssOffset:
-    if (Inst->attr[N_QssOffset - 1].UU.r < -1000 || 
+    if (Inst->attr[N_QssOffset - 1].UU.r < -1000 ||
         Inst->attr[N_QssOffset - 1].blnk ||
 	Inst->attr[N_QssOffset - 1].UU.r > 1000)
       Result = false;
-    else 
+    else
       Nfetconsts(Inst);
     break;
 
@@ -1066,18 +1066,18 @@ Analog_32_action *act;
   }
 }
 
-#undef Cstart          
-#undef N_Wdrawn             
-#undef N_Ldrawn             
-#undef N_SArea         
-#undef N_DArea         
-#undef N_NaOffset      
-#undef N_MuOffset      
-#undef N_QssOffset      
-#undef N_Vt            
-#undef N_Kappa         
-#undef N_Early         
-#undef Gatename        
+#undef Cstart
+#undef N_Wdrawn
+#undef N_Ldrawn
+#undef N_SArea
+#undef N_DArea
+#undef N_NaOffset
+#undef N_MuOffset
+#undef N_QssOffset
+#undef N_Vt
+#undef N_Kappa
+#undef N_Early
+#undef Gatename
 
 
 
diff --git a/log/src/ana/npn1.c b/log/src/ana/npn1.c
index 4e1ba390406a1f7d3fa4bd9730a612cbc289a386..f51113602f65d1140be140792eb331dc15fe5acc 100644
--- a/log/src/ana/npn1.c
+++ b/log/src/ana/npn1.c
@@ -24,7 +24,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 /* From input file "scott.text" */
 
 #include <p2c/p2c.h>
-#include "npn1.h"
+#include "ana/npn1.h"
 
 
 #define Cstart          1
diff --git a/log/src/ana/npn2.c b/log/src/ana/npn2.c
index 50bf10727bc16808d5febdc5e4deda3c5b98a4a3..023ba8da688aa816a75635de0da44a7f0589fe3c 100644
--- a/log/src/ana/npn2.c
+++ b/log/src/ana/npn2.c
@@ -24,7 +24,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 /* From input file "scott.text" */
 
 #include <p2c/p2c.h>
-#include "npn2.h"
+#include "ana/npn2.h"
 
 
 #define Cstart          1
diff --git a/log/src/ana/nsolver.c b/log/src/ana/nsolver.c
index 7a7c33f4b77a0897e6b1d1de8ab8c02ef2058cef..ace9e31d86b5b01e1f6e79368c7ed34002c2afb7 100644
--- a/log/src/ana/nsolver.c
+++ b/log/src/ana/nsolver.c
@@ -69,7 +69,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 #include <p2c/p2c.h>
 
 
-#include "nsolver.h"
+#include "ana/nsolver.h"
 
 
 
diff --git a/log/src/ana/nspc1.c b/log/src/ana/nspc1.c
index c2df21d5e943d4f93faefe77ec2bb86e73508ab1..58827036940c117139f42283b32fb30d9bb63f32 100644
--- a/log/src/ana/nspc1.c
+++ b/log/src/ana/nspc1.c
@@ -42,7 +42,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "nspc1.h"
+#include "ana/nspc1.h"
 
 
 #define Cstart          1
@@ -95,7 +95,7 @@ int erase;
   float scale;
   Anainstlist *A_Gate;
   NfetConst *NfetVar;
- 
+
   (*AnaLogglobals->hook.hidecursor)();
 /*
   W = Inst->attr[N_W - 1].UU.r;
@@ -105,7 +105,7 @@ int erase;
   NfetVar = (NfetConst *)A_Gate->InstVar;
   W = (int) NfetVar->W;
   L = (int) NfetVar->L;
- 
+
 /* test code
   oldWx = 10;
   oldWy = 9;
@@ -219,7 +219,7 @@ short x, y, n;
 static void Ex_NSPC1(act)
 Analog_32_action *act;
 {
-  double MinI2, dI2dV1, dI2dV2, dI2dV3, dI2dV4, 
+  double MinI2, dI2dV1, dI2dV2, dI2dV3, dI2dV4,
          MinI3, dI3dV1, dI3dV2, dI3dV3, dI3dV4,
          MinI1, dI1dV1, dI1dV2, dI1dV3, dI1dV4,
          MinI4, dI4dV1, dI4dV2, dI4dV3;
@@ -329,7 +329,7 @@ Analog_32_action *act;
   dItotaldS = dIdsdS * Early + Ids * dEarlydS;
   dItotaldD = dIdsdD * Early + Ids * dEarlydD;
   dItotaldB = dIdsdB * Early;
-  
+
   MinI3 = Itotal;
   MinI2 = -Itotal;
   dI2dV1 = dItotaldG;
@@ -340,7 +340,7 @@ Analog_32_action *act;
   dI3dV2 = -dItotaldD;
   dI2dV4 = dItotaldB;
   dI3dV4 = -dItotaldB;
-  
+
   MinI1 = 0.0;
   dI1dV1 = 0.0;
   dI1dV2 = 0.0;
@@ -351,7 +351,7 @@ Analog_32_action *act;
   dI4dV1 = 0.0;
   dI4dV2 = 0.0;
   dI4dV3 = 0.0;
-  
+
   if (WITH->attr[N_Cgd - 1].UU.r != 0) {   /*C gate-drain*/
     if (AnaChangedDt)
       NfetVar->TauCgd = WITH->attr[N_Cgd - 1].UU.r / AnaDt;
@@ -437,7 +437,7 @@ Analog_32_action *act;
   double VPin1, VPin2, VPin3, VPin4, VMem1, VMem2, VMem3;
   NfetConst *NfetVar;
   Anainstlist *A_Gate;
-  double Ids, Vg, Vd, Vs, Vb, Vds, K2Vg, K7Vb, 
+  double Ids, Vg, Vd, Vs, Vb, Vds, K2Vg, K7Vb,
          ExpFor, LogOnePlusExpFor,
 	 Ifor, ExpRev, LogOnePlusExpRev, Irev, Blend,
 	 VdsInvVcross, Early, Itotal;
@@ -738,9 +738,9 @@ long Attrnum;
   NfetVar = (NfetConst *)A_Gate->InstVar;
   switch (Attrnum) {
   case N_W:
-    if (    Inst->attr[N_W - 1].UU.r < 0 
-	 || Inst->attr[N_W - 1].blnk 
-	 || Inst->attr[N_W - 1].UU.r > 1e20) 
+    if (    Inst->attr[N_W - 1].UU.r < 0
+	 || Inst->attr[N_W - 1].blnk
+	 || Inst->attr[N_W - 1].UU.r > 1e20)
       Result = false;
     else {
       Show_W_L(Inst, true);
@@ -759,7 +759,7 @@ long Attrnum;
 
   case N_L:
     if (    Inst->attr[N_L - 1].UU.r <= 0.0
-	 || Inst->attr[N_L - 1].blnk 
+	 || Inst->attr[N_L - 1].blnk
 	 || Inst->attr[N_L - 1].UU.r > 1e20 )
       Result = false;
     else {
@@ -815,7 +815,7 @@ long Attrnum;
       NfetVar->k3 = 1 / Inst->attr[N_Kappa - 1].UU.r;
       NfetVar->k5 = Inst->attr[N_Kappa - 1].UU.r * Inst->attr[N_Vt - 1].UU.r /
 		    (2 * Inst->attr[N_Ktq - 1].UU.r);
-      NfetVar->k7 = (1.0 - Inst->attr[N_Kappa - 1].UU.r) / 
+      NfetVar->k7 = (1.0 - Inst->attr[N_Kappa - 1].UU.r) /
 	            (2 * Inst->attr[N_Ktq - 1].UU.r);
       NfetVar->k8 = 2 * Inst->attr[N_W - 1].UU.r / Inst->attr[N_L - 1].UU.r *
 		    Inst->attr[N_Beta - 1].UU.r * Inst->attr[N_Ktq - 1].UU.r *
@@ -837,7 +837,7 @@ long Attrnum;
       NfetVar->k5 = Inst->attr[N_Kappa - 1].UU.r * Inst->attr[N_Vt - 1].UU.r /
 		    (2 * Inst->attr[N_Ktq - 1].UU.r);
       NfetVar->k6 = 1 / (2 * Inst->attr[N_Ktq - 1].UU.r);
-      NfetVar->k7 = (1.0 - Inst->attr[N_Kappa - 1].UU.r) / 
+      NfetVar->k7 = (1.0 - Inst->attr[N_Kappa - 1].UU.r) /
 	            (2 * Inst->attr[N_Ktq - 1].UU.r);
       NfetVar->k8 = 2 * Inst->attr[N_W - 1].UU.r / Inst->attr[N_L - 1].UU.r *
 		    Inst->attr[N_Beta - 1].UU.r * Inst->attr[N_Ktq - 1].UU.r *
@@ -859,7 +859,7 @@ long Attrnum;
 /* do nothing with the model when given the number of parallel xtor's */
   case N_Number:
     break;
-    
+
   }
   return Result;
 }
@@ -878,7 +878,7 @@ Analog_32_action *act;
   if ((unsigned long)Attrnum < 32 &&
       ((1L << Attrnum) & ((1L << N_Cgs) | (1L << N_Cb) | (1L << N_Cgd))) != 0)
   {
-      
+
     act->ok = AnaCrange(act->inst, Attrnum, true);
   }
   else
@@ -912,7 +912,7 @@ Analog_32_action *act;
                 ((1.0/ICptr->InitKappa) - 1.0);
   NfetVar->W = ICptr->InitW;
   NfetVar->L = ICptr->InitL;
-  
+
   if (ICptr->InitEarly == 0)
     NfetVar->InvVcross = 0.0;
   else
@@ -1055,7 +1055,7 @@ Analog_32_action *act;
   NfetVar->k5 = WITH->attr[N_Kappa - 1].UU.r * WITH->attr[N_Vt - 1].UU.r /
 		(2 * WITH->attr[N_Ktq - 1].UU.r);
   NfetVar->k6 = 1 / (2 * WITH->attr[N_Ktq - 1].UU.r);
-  NfetVar->k7 = (1.0 - WITH->attr[N_Kappa - 1].UU.r) / 
+  NfetVar->k7 = (1.0 - WITH->attr[N_Kappa - 1].UU.r) /
 	        (2 * WITH->attr[N_Ktq - 1].UU.r);
   NfetVar->k8 = 2 * WITH->attr[N_W - 1].UU.r / WITH->attr[N_L - 1].UU.r *
 		WITH->attr[N_Beta - 1].UU.r * WITH->attr[N_Ktq - 1].UU.r *
@@ -1097,9 +1097,9 @@ Analog_32_action *act;
   Node1 = Node1Ptr->ltimestep;
   Node2 = Node2Ptr->ltimestep;
   Node3 = Node3Ptr->ltimestep;
-  Node4 = Node4Ptr->ltimestep; 
-  if (Node1 != Pin1 || Node2 != Pin2 || Node3 != Pin3 
-      || Node1 == AnaNotyet || Node2 == AnaNotyet || Node3 == AnaNotyet 
+  Node4 = Node4Ptr->ltimestep;
+  if (Node1 != Pin1 || Node2 != Pin2 || Node3 != Pin3
+      || Node1 == AnaNotyet || Node2 == AnaNotyet || Node3 == AnaNotyet
       || Node4 != Pin4 || Node4 == AnaNotyet) {
     sprintf(STR1, "%s <undefined>", Gatename);
     AnaScoreboard(STR1, (long)AnaMessGate1);
@@ -1186,7 +1186,7 @@ Analog_32_action *act;
     break;
 
   case ANALOG_ACT_PASS2:
-    AnaCappass2(act->inst);    
+    AnaCappass2(act->inst);
     break;
 
   case ANALOG_ACT_ATTRCHANGE:
@@ -1263,5 +1263,3 @@ Analog_32_action *act;
 
 
 /* End. */
-
-
diff --git a/log/src/ana/numbers.c b/log/src/ana/numbers.c
index 0c90ddd902ca382b378c91b1544edeb758c780e2..10bb2630f06f30589a932cd64230e412c13f4a90 100644
--- a/log/src/ana/numbers.c
+++ b/log/src/ana/numbers.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "numbers.h"
+#include "ana/numbers.h"
 
 
 #define TitleX          (-80)
diff --git a/log/src/ana/pfet4.c b/log/src/ana/pfet4.c
index 2ab350c029ac2d5f7b7eaf8f0aaead344935e16f..2429f056e487c088c135067e592fb498bb045135 100644
--- a/log/src/ana/pfet4.c
+++ b/log/src/ana/pfet4.c
@@ -25,7 +25,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "pfet4.h"
+#include "ana/pfet4.h"
 
 
 #define Cstart          1
@@ -94,7 +94,7 @@ Analog_32_action *act;
 	 Vdg_InvBlendVdg_dBlendVdsdS, InvBlendVsg_BlendVds,
 	 Vsg_BlendVds_dBlendVsgdG, Vds_dTanch_Temp3_Itotal, F_dTanch_Itotal,
 	 dSaturatedD_Itotal, dSaturatedG_Itotal, dSaturatedS_Itotal;
-/* p2c: gates.text, line 998: 
+/* p2c: gates.text, line 998:
  * Note: Line breaker spent 3.0+1.00 seconds, 5000 tries on line 79 [251] */
   log_grec *WITH;
   AnaMatRec *WITH1;
diff --git a/log/src/ana/pfet5.c b/log/src/ana/pfet5.c
index 93816763c68e115ab76b6671925a176a2ce8723b..c6a938dc0e68b070eef54ae3a78e0565035face5 100644
--- a/log/src/ana/pfet5.c
+++ b/log/src/ana/pfet5.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "pfet5.h"
+#include "ana/pfet5.h"
 
 
 #define Cstart          1
diff --git a/log/src/ana/pfet6.c b/log/src/ana/pfet6.c
index 7d48583d688f48cccc82476cf3ed7e0d810200da..193fdd95382f552014b8ac48ab6df05ece3765d1 100644
--- a/log/src/ana/pfet6.c
+++ b/log/src/ana/pfet6.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "pfet6.h"
+#include "ana/pfet6.h"
 
 
 #define Cstart          1
@@ -72,7 +72,7 @@ typedef struct ICPfet {
 static void Ex_PFET6(act)
 Analog_32_action *act;
 {
-  double MinI2, dI2dV1, dI2dV2, dI2dV3, dI2dV4, 
+  double MinI2, dI2dV1, dI2dV2, dI2dV3, dI2dV4,
          MinI3, dI3dV1, dI3dV2, dI3dV3, dI3dV4,
          MinI1, dI1dV1, dI1dV2, dI1dV3, dI1dV4,
          MinI4, dI4dV1, dI4dV2, dI4dV3, dI4dV4;
@@ -293,7 +293,7 @@ Analog_32_action *act;
   PfetConst *PfetVar;
   Anainstlist *A_Gate;
   double Ids, Vg, Vd, Vs, Vw, Vds, K2Vg, K7Vw, ExpFor, OnePlusExpFor,
-         LogOnePlusExpFor, Ifor, ExpRev, OnePlusExpRev, LogOnePlusExpRev, 
+         LogOnePlusExpFor, Ifor, ExpRev, OnePlusExpRev, LogOnePlusExpRev,
          Irev, Blend, VdsInvVcross, Early, Itotal;
   log_grec *WITH1;
 
@@ -639,7 +639,7 @@ long Attrnum;
       PfetVar->k2 = Inst->attr[N_Kappa - 1].UU.r / (2 * Inst->attr[N_Ktq - 1].UU.r);
       PfetVar->k4 = 2 * Inst->attr[N_Ratio - 1].UU.r *
 		    Inst->attr[N_Beta - 1].UU.r * Inst->attr[N_Ktq - 1].UU.r;
-      PfetVar->k5 = (Inst->attr[N_Kappa - 1].UU.r*Inst->attr[N_Vt - 1].UU.r)/ 
+      PfetVar->k5 = (Inst->attr[N_Kappa - 1].UU.r*Inst->attr[N_Vt - 1].UU.r)/
 		    (2 * Inst->attr[N_Ktq - 1].UU.r);
       PfetVar->k6 = 1 / (2 * Inst->attr[N_Ktq - 1].UU.r);
       PfetVar->k7 = (1 - Inst->attr[N_Kappa - 1].UU.r)/
@@ -824,7 +824,7 @@ Analog_32_action *act;
   PfetVar->k3 = 1 / WITH->attr[N_Kappa - 1].UU.r;
   PfetVar->k4 = 2 * WITH->attr[N_Ratio - 1].UU.r *
 		WITH->attr[N_Beta - 1].UU.r * WITH->attr[N_Ktq - 1].UU.r;
-  PfetVar->k5 = (WITH->attr[N_Kappa - 1].UU.r * WITH->attr[N_Vt - 1].UU.r)/ 
+  PfetVar->k5 = (WITH->attr[N_Kappa - 1].UU.r * WITH->attr[N_Vt - 1].UU.r)/
 		(2 * WITH->attr[N_Ktq - 1].UU.r);
   PfetVar->k6 = 1 / (2 * WITH->attr[N_Ktq - 1].UU.r);
   PfetVar->k7 = (1 - WITH->attr[N_Kappa - 1].UU.r)/
diff --git a/log/src/ana/pfet7f.c b/log/src/ana/pfet7f.c
index 2e68acc98700e8d724d02eed2a8aa0b828da2180..dc1d4173b2a988b1026d50e69048de137ea6e440 100644
--- a/log/src/ana/pfet7f.c
+++ b/log/src/ana/pfet7f.c
@@ -25,7 +25,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "pfet7f.h"
+#include "ana/pfet7f.h"
 
 #define Cstart          1
 #define N_Wdrawn        13
@@ -43,12 +43,12 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 typedef struct PfetConst {
-  double k1;  /* Vfb - phi_b */ 
-  double k2;  /* 1/Cox */ 
+  double k1;  /* Vfb - phi_b */
+  double k2;  /* 1/Cox */
   double k3;  /* 2*e_s*rho*1e10*phi_b */
   double k4;  /* 2*e_s*rho*1e10 */
   double k5;  /* phi_f */
-  double k6;  /* 1.66667 */  
+  double k6;  /* 1.66667 */
   double k7;  /* - Vfb */
   double k8;  /* 0.5*rho*e_s*1e10 */
   double k9;  /* (1/(2*Ut)) */
@@ -63,8 +63,8 @@ typedef struct PfetConst {
   double k18; /* Early_s */
   double k19; /* Leff - L_0 */
 
-  double Cgd; /* computed capacitance */  
-  double Cgs; /* computed capacitance */  
+  double Cgd; /* computed capacitance */
+  double Cgs; /* computed capacitance */
   double TauCgd;   /*Tau for capacitor*/
   double TauCgs;   /*Tau for capacitor*/
   double NewVt;
@@ -242,7 +242,7 @@ Analog_32_action *act;
 
   if ((PfetVar->k3 + PfetVar->k4*(Vb - Vnear)) > 0)
     {
-      Vt = PfetVar->k1 - 
+      Vt = PfetVar->k1 -
 	   PfetVar->k2*AnaSqrt(PfetVar->k3 + PfetVar->k4*(Vb - Vnear));
       tmp1   = PfetVar->k14*(1/(PfetVar->k1 - Vt));
       dVtdVs = tmp1*dVneardVs;
@@ -269,7 +269,7 @@ Analog_32_action *act;
              *(tmp0*tmp0 - PfetVar->k16)*tmp3;
       tmp5 = -tmp4*tmp3*(Vg - Vb + PfetVar->k7);
       dkappadVg = tmp4;
-      dkappadVs = tmp5*dVtdVs; 
+      dkappadVs = tmp5*dVtdVs;
       dkappadVd = tmp5*dVtdVd;
       dkappadVb = tmp5*dVtdVb -tmp4;
     }
@@ -302,9 +302,9 @@ Analog_32_action *act;
   dIfordVb = tmp15*(dkappadVb*tmp6 + kappa*dVtdVb);
   dIrevdVg =  tmp16*(dkappadVg*tmp6  - kappa);
   dIrevdVb =  tmp16*(dkappadVb*tmp6 + kappa*dVtdVb);
-  dIrevdVd =  tmp16*(dVfardVd - dVneardVd + dkappadVd*tmp6 + 
+  dIrevdVd =  tmp16*(dVfardVd - dVneardVd + dkappadVd*tmp6 +
 		     kappa*(dVneardVd + dVtdVd));
-  dIrevdVs =  tmp16*(dVfardVs - dVneardVs + dkappadVs*tmp6 + 
+  dIrevdVs =  tmp16*(dVfardVs - dVneardVs + dkappadVs*tmp6 +
 		     kappa*(dVneardVs + dVtdVs));
 
   tmp17 = (1/kappa);
@@ -323,9 +323,9 @@ Analog_32_action *act;
       tmp21 = 1/(Vnear -Vg + PfetVar->k19);
       tmp22 = PfetVar->k18*tmp21;
       lambda  = tmp22;
-      
+
       dlambdadVg =  tmp22*tmp21;
-      dlambdadVd = -tmp22*tmp21*dVneardVd; 
+      dlambdadVd = -tmp22*tmp21*dVneardVd;
       dlambdadVs = -tmp22*tmp21*dVneardVs;
     }
   else
@@ -371,7 +371,7 @@ Analog_32_action *act;
 
   if (AnaChangedDt) /* might also need to catch changes in Cgd */
     PfetVar->TauCgd = PfetVar->Cgd/ AnaDt;
-  ICap = PfetVar->TauCgd * (VMem1 - VMem2 - Vg + Vd);   
+  ICap = PfetVar->TauCgd * (VMem1 - VMem2 - Vg + Vd);
   MinI2 -= ICap;
   dI2dV1 -= PfetVar->TauCgd;
   dI2dV2 += PfetVar->TauCgd;
@@ -503,7 +503,7 @@ Analog_32_action *act;
     case 2:
       {
 	VMem2 = A_Gate->Pininfo[1].Vmem;
-	act->Iin = PfetVar->TauCgd * (VPin2 - VPin1 - VMem2 + VMem1) 
+	act->Iin = PfetVar->TauCgd * (VPin2 - VPin1 - VMem2 + VMem1)
 	           + act->Iin;
       }
       break;
@@ -511,7 +511,7 @@ Analog_32_action *act;
     case 3:
       {
 	VMem3 = A_Gate->Pininfo[2].Vmem;
-	act->Iin = PfetVar->TauCgs * (VPin3 - VPin1 - VMem3 + VMem1) 
+	act->Iin = PfetVar->TauCgs * (VPin3 - VPin1 - VMem3 + VMem1)
 	           + act->Iin;
       }
       break;
@@ -536,17 +536,17 @@ Analog_32_action *act;
 
     if ((PfetVar->k3 + PfetVar->k4*(Vb - Vnear)) > 0)
       {
-	Vt = PfetVar->k1 - 
+	Vt = PfetVar->k1 -
 	  PfetVar->k2*AnaSqrt(PfetVar->k3 + PfetVar->k4*(Vb - Vnear));
       }
     else
       {
 	Vt = PfetVar->k1;
-	
+
       }
-    
+
   phi_s = PfetVar->k5*tanh(PfetVar->k6*((Vg + PfetVar->k7  - Vb)/Vt));
-  
+
   if (phi_s > PfetVar->k12)
     {
       kappa = 1/(1 + PfetVar->k2*AnaSqrt(PfetVar->k8*(1/phi_s)));
@@ -577,11 +577,11 @@ Analog_32_action *act;
 
 
     switch (act->pin) {
-      
+
     case 2:
       act->Iin -= Isd;
       break;
-      
+
     case 3:
       act->Iin += Isd;
       break;
@@ -739,16 +739,16 @@ long Attrnum;
   switch (Attrnum) {
 
   case N_Wdrawn:
-    if (Inst->attr[N_Wdrawn - 1].UU.r < 0.01 || 
+    if (Inst->attr[N_Wdrawn - 1].UU.r < 0.01 ||
         Inst->attr[N_Wdrawn - 1].blnk ||
 	Inst->attr[N_Wdrawn - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
 	Pfetconsts(Inst);
     break;
 
   case N_Ldrawn:
-    if (Inst->attr[N_Ldrawn - 1].UU.r < 0.01 || 
+    if (Inst->attr[N_Ldrawn - 1].UU.r < 0.01 ||
         Inst->attr[N_Ldrawn - 1].blnk ||
 	Inst->attr[N_Ldrawn - 1].UU.r > 1e6)
       Result = false;
@@ -757,56 +757,56 @@ long Attrnum;
     break;
 
   case N_SArea:
-    if (Inst->attr[N_SArea - 1].UU.r < 1e-12 || 
+    if (Inst->attr[N_SArea - 1].UU.r < 1e-12 ||
         Inst->attr[N_SArea - 1].blnk ||
 	Inst->attr[N_SArea - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Pfetconsts(Inst);
     break;
 
   case N_DArea:
-    if (Inst->attr[N_DArea - 1].UU.r < 1e-12 || 
+    if (Inst->attr[N_DArea - 1].UU.r < 1e-12 ||
         Inst->attr[N_DArea - 1].blnk ||
 	Inst->attr[N_DArea - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Pfetconsts(Inst);
     break;
 
   case N_WArea:
-    if (Inst->attr[N_WArea - 1].UU.r < 1e-12 || 
+    if (Inst->attr[N_WArea - 1].UU.r < 1e-12 ||
         Inst->attr[N_WArea - 1].blnk ||
 	Inst->attr[N_WArea - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Pfetconsts(Inst);
     break;
 
   case N_NaOffset:
-    if (Inst->attr[N_NaOffset - 1].UU.r < 1e-10 || 
+    if (Inst->attr[N_NaOffset - 1].UU.r < 1e-10 ||
         Inst->attr[N_NaOffset - 1].blnk ||
 	Inst->attr[N_NaOffset - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Pfetconsts(Inst);
     break;
 
   case N_MuOffset:
-    if (Inst->attr[N_MuOffset - 1].UU.r < 1e-10 || 
+    if (Inst->attr[N_MuOffset - 1].UU.r < 1e-10 ||
         Inst->attr[N_MuOffset - 1].blnk ||
 	Inst->attr[N_MuOffset - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Pfetconsts(Inst);
     break;
 
   case N_QssOffset:
-    if (Inst->attr[N_QssOffset - 1].UU.r < -1000 || 
+    if (Inst->attr[N_QssOffset - 1].UU.r < -1000 ||
         Inst->attr[N_QssOffset - 1].blnk ||
 	Inst->attr[N_QssOffset - 1].UU.r > 1000)
       Result = false;
-    else 
+    else
       Pfetconsts(Inst);
     break;
 
@@ -1156,17 +1156,17 @@ Analog_32_action *act;
   }
 }
 
-#undef Cstart          
-#undef N_Wdrawn             
-#undef N_Ldrawn             
-#undef N_SArea         
-#undef N_DArea         
-#undef N_NaOffset      
-#undef N_QssOffset      
-#undef N_MuOffset      
-#undef N_Vt            
-#undef N_Kappa         
-#undef Gatename        
+#undef Cstart
+#undef N_Wdrawn
+#undef N_Ldrawn
+#undef N_SArea
+#undef N_DArea
+#undef N_NaOffset
+#undef N_QssOffset
+#undef N_MuOffset
+#undef N_Vt
+#undef N_Kappa
+#undef Gatename
 
 
 
diff --git a/log/src/ana/pfet7t.c b/log/src/ana/pfet7t.c
index 5af2fcbe263aaec732293be0411d11ae769d5813..3512fb560696bfb051fc167e5b1c466084c33b75 100644
--- a/log/src/ana/pfet7t.c
+++ b/log/src/ana/pfet7t.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "pfet7t.h"
+#include "ana/pfet7t.h"
 
 #define Cstart          1
 #define N_Wdrawn        10
@@ -44,12 +44,12 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 typedef struct PfetConst {
-  double k1;  /* Vfb - phi_b */ 
-  double k2;  /* 1/Cox */ 
+  double k1;  /* Vfb - phi_b */
+  double k2;  /* 1/Cox */
   double k3;  /* 2*e_s*rho*1e10*phi_b */
   double k4;  /* 2*e_s*rho*1e10 */
   double k5;  /* phi_f */
-  double k6;  /* 1.66667 */  
+  double k6;  /* 1.66667 */
   double k7;  /* - Vfb */
   double k8;  /* 0.5*rho*e_s*1e10 */
   double k9;  /* (1/(2*Ut)) */
@@ -64,13 +64,13 @@ typedef struct PfetConst {
   double k18; /* Early_s */
   double k19; /* Leff - L_0 */
 
-  double Cgd; /* computed capacitance */  
-  double Cgs; /* computed capacitance */  
+  double Cgd; /* computed capacitance */
+  double Cgs; /* computed capacitance */
   double TauCgd;   /*Tau for capacitor*/
   double TauCgs;   /*Tau for capacitor*/
   double NewVt;
   double Newkappa;
-  double NewV0;  
+  double NewV0;
 
 } PfetConst;
 
@@ -108,7 +108,7 @@ log_grec *Inst;
   rho     = AnaPhysical.q*AnaPFab.Na*del_Na;
   phi_f   = AnaPhysical.Ut*log((AnaPFab.Na*del_Na)/AnaGenFab.ni);
   phi_b   = 2*phi_f;
-  Vfb     = - AnaGenFab.phi_ms + 
+  Vfb     = - AnaGenFab.phi_ms +
             (AnaPFab.Qss+Inst->attr[N_QssOffset - 1].UU.r)/AnaPFab.Cox;
   beta    = AnaPFab.mu*1e-4*(Inst->attr[N_MuOffset - 1].UU.r)*
             AnaPFab.Cox*(Weff/Leff);
@@ -238,7 +238,7 @@ Analog_32_action *act;
 
   if ((PfetVar->k3 + PfetVar->k4*(AnaVdd - Vnear)) > 0)
     {
-      Vt = PfetVar->k1 - 
+      Vt = PfetVar->k1 -
 	   PfetVar->k2*AnaSqrt(PfetVar->k3 + PfetVar->k4*(AnaVdd - Vnear));
       tmp1   = PfetVar->k14*(1/(PfetVar->k1 - Vt));
       dVtdVs = tmp1*dVneardVs;
@@ -263,7 +263,7 @@ Analog_32_action *act;
              *(tmp0*tmp0 - PfetVar->k16)*tmp3;
       tmp5 = -tmp4*tmp3*(Vg - AnaVdd + PfetVar->k7);
       dkappadVg = tmp4;
-      dkappadVs = tmp5*dVtdVs; 
+      dkappadVs = tmp5*dVtdVs;
       dkappadVd = tmp5*dVtdVd;
     }
   else
@@ -292,9 +292,9 @@ Analog_32_action *act;
   dIfordVd = tmp15*(dkappadVd*tmp6 + kappa*(dVneardVd + dVtdVd));
   dIfordVs = tmp15*(dkappadVs*tmp6 + kappa*(dVneardVs + dVtdVs));
   dIrevdVg =  tmp16*(dkappadVg*tmp6  - kappa);
-  dIrevdVd =  tmp16*(dVfardVd - dVneardVd + dkappadVd*tmp6 + 
+  dIrevdVd =  tmp16*(dVfardVd - dVneardVd + dkappadVd*tmp6 +
 		     kappa*(dVneardVd + dVtdVd));
-  dIrevdVs =  tmp16*(dVfardVs - dVneardVs + dkappadVs*tmp6 + 
+  dIrevdVs =  tmp16*(dVfardVs - dVneardVs + dkappadVs*tmp6 +
 		     kappa*(dVneardVs + dVtdVs));
 
   tmp17 = (1/kappa);
@@ -312,9 +312,9 @@ Analog_32_action *act;
       tmp21 = 1/(Vnear -Vg + PfetVar->k19);
       tmp22 = PfetVar->k18*tmp21;
       lambda  = tmp22;
-      
+
       dlambdadVg =  tmp22*tmp21;
-      dlambdadVd = -tmp22*tmp21*dVneardVd; 
+      dlambdadVd = -tmp22*tmp21*dVneardVd;
       dlambdadVs = -tmp22*tmp21*dVneardVs;
     }
   else
@@ -353,7 +353,7 @@ Analog_32_action *act;
 
   if (AnaChangedDt) /* might also need to catch changes in Cgd */
     PfetVar->TauCgd = PfetVar->Cgd/ AnaDt;
-  ICap = PfetVar->TauCgd * (VMem1 - VMem2 - Vg + Vd);   
+  ICap = PfetVar->TauCgd * (VMem1 - VMem2 - Vg + Vd);
   MinI2 -= ICap;
   dI2dV1 -= PfetVar->TauCgd;
   dI2dV2 += PfetVar->TauCgd;
@@ -463,7 +463,7 @@ Analog_32_action *act;
     case 2:
       {
 	VMem2 = A_Gate->Pininfo[1].Vmem;
-	act->Iin = PfetVar->TauCgd * (VPin2 - VPin1 - VMem2 + VMem1) 
+	act->Iin = PfetVar->TauCgd * (VPin2 - VPin1 - VMem2 + VMem1)
 	           + act->Iin;
       }
       break;
@@ -471,7 +471,7 @@ Analog_32_action *act;
     case 3:
       {
 	VMem3 = A_Gate->Pininfo[2].Vmem;
-	act->Iin = PfetVar->TauCgs * (VPin3 - VPin1 - VMem3 + VMem1) 
+	act->Iin = PfetVar->TauCgs * (VPin3 - VPin1 - VMem3 + VMem1)
 	           + act->Iin;
       }
       break;
@@ -495,17 +495,17 @@ Analog_32_action *act;
 
     if ((PfetVar->k3 + PfetVar->k4*(AnaVdd - Vnear)) > 0)
       {
-	Vt = PfetVar->k1 - 
+	Vt = PfetVar->k1 -
 	  PfetVar->k2*AnaSqrt(PfetVar->k3 + PfetVar->k4*(AnaVdd - Vnear));
       }
     else
       {
 	Vt = PfetVar->k1;
-	
+
       }
-    
+
     phi_s = PfetVar->k5*tanh(PfetVar->k6*((Vg + PfetVar->k7  - AnaVdd)/Vt));
-    
+
     if (phi_s > PfetVar->k12)
       {
 	kappa = 1/(1 + PfetVar->k2*AnaSqrt(PfetVar->k8*(1/phi_s)));
@@ -514,15 +514,15 @@ Analog_32_action *act;
       {
 	kappa = PfetVar->k13;
       }
-    
+
     tmp11 = log(1 + AnaExpo(PfetVar->k9*kappa*(Vnear -Vg + Vt)));
     tmp14 = log(1+AnaExpo(PfetVar->k9*(kappa*(Vnear -Vg + Vt) + Vfar - Vnear)));
     Ifor =  tmp11*tmp11;
     Irev =  tmp14*tmp14;
-    
-    
+
+
     Isdi = PfetVar->k10*sign*(1/kappa)*(Ifor - Irev);
-    
+
     if (Vg < Vnear)
       {
 	lambda  = PfetVar->k18/(Vnear -Vg + PfetVar->k19);
@@ -531,16 +531,16 @@ Analog_32_action *act;
       {
 	lambda  = PfetVar->k11;
       }
-    
+
     Isd = Isdi*(1 + lambda*(AnaVdd - Vfar));
 
 
     switch (act->pin) {
-      
+
     case 2:
       act->Iin -= Isd;
       break;
-      
+
     case 3:
       act->Iin += Isd;
       break;
@@ -670,16 +670,16 @@ long Attrnum;
   switch (Attrnum) {
 
   case N_Wdrawn:
-    if (Inst->attr[N_Wdrawn - 1].UU.r < 0.01 || 
+    if (Inst->attr[N_Wdrawn - 1].UU.r < 0.01 ||
         Inst->attr[N_Wdrawn - 1].blnk ||
 	Inst->attr[N_Wdrawn - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
 	Pfetconsts(Inst);
     break;
 
   case N_Ldrawn:
-    if (Inst->attr[N_Ldrawn - 1].UU.r < 0.01 || 
+    if (Inst->attr[N_Ldrawn - 1].UU.r < 0.01 ||
         Inst->attr[N_Ldrawn - 1].blnk ||
 	Inst->attr[N_Ldrawn - 1].UU.r > 1e6)
       Result = false;
@@ -688,47 +688,47 @@ long Attrnum;
     break;
 
   case N_SArea:
-    if (Inst->attr[N_SArea - 1].UU.r < 1e-12 || 
+    if (Inst->attr[N_SArea - 1].UU.r < 1e-12 ||
         Inst->attr[N_SArea - 1].blnk ||
 	Inst->attr[N_SArea - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Pfetconsts(Inst);
     break;
 
   case N_DArea:
-    if (Inst->attr[N_DArea - 1].UU.r < 1e-12 || 
+    if (Inst->attr[N_DArea - 1].UU.r < 1e-12 ||
         Inst->attr[N_DArea - 1].blnk ||
 	Inst->attr[N_DArea - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Pfetconsts(Inst);
     break;
 
   case N_NaOffset:
-    if (Inst->attr[N_NaOffset - 1].UU.r < 1e-10 || 
+    if (Inst->attr[N_NaOffset - 1].UU.r < 1e-10 ||
         Inst->attr[N_NaOffset - 1].blnk ||
 	Inst->attr[N_NaOffset - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Pfetconsts(Inst);
     break;
 
   case N_MuOffset:
-    if (Inst->attr[N_MuOffset - 1].UU.r < 1e-10 || 
+    if (Inst->attr[N_MuOffset - 1].UU.r < 1e-10 ||
         Inst->attr[N_MuOffset - 1].blnk ||
 	Inst->attr[N_MuOffset - 1].UU.r > 1e6)
       Result = false;
-    else 
+    else
       Pfetconsts(Inst);
     break;
 
   case N_QssOffset:
-    if (Inst->attr[N_QssOffset - 1].UU.r < -1000 || 
+    if (Inst->attr[N_QssOffset - 1].UU.r < -1000 ||
         Inst->attr[N_QssOffset - 1].blnk ||
 	Inst->attr[N_QssOffset - 1].UU.r > 1000)
       Result = false;
-    else 
+    else
       Pfetconsts(Inst);
     break;
 
@@ -1076,16 +1076,16 @@ Analog_32_action *act;
   }
 }
 
-#undef Cstart          
-#undef N_Wdrawn             
-#undef N_Ldrawn             
-#undef N_SArea         
-#undef N_DArea         
-#undef N_NaOffset      
-#undef N_Vt            
-#undef N_Kappa         
-#undef N_Early         
-#undef Gatename        
+#undef Cstart
+#undef N_Wdrawn
+#undef N_Ldrawn
+#undef N_SArea
+#undef N_DArea
+#undef N_NaOffset
+#undef N_Vt
+#undef N_Kappa
+#undef N_Early
+#undef Gatename
 
 
 
diff --git a/log/src/ana/physical.c b/log/src/ana/physical.c
index 509e58e586e2f605544ed0d724705cd82bc86296..c280ca0ba62b699cbc19de2bcf191d129fa59fdf 100644
--- a/log/src/ana/physical.c
+++ b/log/src/ana/physical.c
@@ -24,7 +24,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 /* From input file "tools.text" */
 
 #include <p2c/p2c.h>
-#include "physical.h"
+#include "ana/physical.h"
 
 #define N_k            1
 #define N_q            2
@@ -36,7 +36,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 #define N_phi_ms       7
 #define N_Eg           8
 #define N_ni           9
- 
+
 #define GateName        "Physical Parameters"
 
 
@@ -294,12 +294,12 @@ Analog_32_action *act;
 }
 
 
-#undef N_k 
+#undef N_k
 #undef N_q
 #undef N_e_v
 #undef N_e_s
 #undef N_e_ox
-#undef N_ktq 
+#undef N_ktq
 #undef N_phi_ms
 #undef N_Eg
 #undef N_ni
diff --git a/log/src/ana/pnp1.c b/log/src/ana/pnp1.c
index c806821e3680dff36c8c0f05fab5241485bc90aa..bbf93acec3a7714cf79df80cf20b202b0edf45d3 100644
--- a/log/src/ana/pnp1.c
+++ b/log/src/ana/pnp1.c
@@ -24,7 +24,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 /* From input file "scott.text" */
 
 #include <p2c/p2c.h>
-#include "pnp1.h"
+#include "ana/pnp1.h"
 
 
 #define Cstart          1
diff --git a/log/src/ana/pnp2.c b/log/src/ana/pnp2.c
index 9fe9402705141f745c42e0a42f65a6058c0df08c..e736b6e71dec15cd8543ac72f7c8816ba5a082bf 100644
--- a/log/src/ana/pnp2.c
+++ b/log/src/ana/pnp2.c
@@ -24,7 +24,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 /* From input file "scott.text" */
 
 #include <p2c/p2c.h>
-#include "pnp2.h"
+#include "ana/pnp2.h"
 
 
 #define Cstart          1
diff --git a/log/src/ana/pspc1.c b/log/src/ana/pspc1.c
index 461c0aac329571e0d09d9f2d97ff26afa5ad62dd..001c1ab4e95f8d4c56e94912589292797d2bbd33 100644
--- a/log/src/ana/pspc1.c
+++ b/log/src/ana/pspc1.c
@@ -44,7 +44,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "pspc1.h"
+#include "ana/pspc1.h"
 
 
 #define Cstart          1
@@ -97,7 +97,7 @@ int erase;
   float scale;
   Anainstlist *A_Gate;
   PfetConst *PfetVar;
-  
+
   (*AnaLogglobals->hook.hidecursor)();
 /*
   W = Inst->attr[N_W - 1].UU.r;
@@ -107,7 +107,7 @@ int erase;
   PfetVar = (PfetConst *)A_Gate->InstVar;
   W = (int) PfetVar->W;
   L = (int) PfetVar->L;
-  
+
   Lx = oldLx = 0;
   Ly = oldLy = 4;
   Wx = oldWx = 0;
@@ -143,15 +143,15 @@ int erase;
       Ly = 7;
       (*AnaLogglobals->hook.xform)(Inst, &Lx, &Ly);
       (*AnaLogglobals->hook.xform)(Inst, &Wx, &Wy);
-  } 
+  }
   else if ( Wy == Ly && Wx > Lx ) /* facing down */
   {
       Lx = 10;
       Ly = (short) (78.95-151.38*scale+82.29*scale*scale);
       Wy = (short) (78.95-151.38*scale+82.29*scale*scale);
       Wx = -3;
-      (*AnaLogglobals->hook.xform)(Inst, &Wx, &Wy);            
-      (*AnaLogglobals->hook.xform)(Inst, &Lx, &Ly);      
+      (*AnaLogglobals->hook.xform)(Inst, &Wx, &Wy);
+      (*AnaLogglobals->hook.xform)(Inst, &Lx, &Ly);
       /* do some intelligent shift */
   }
   else if ( Wy == Ly && Wx < Lx ) /* facing up */
@@ -161,7 +161,7 @@ int erase;
       Lx = 3;
       Ly = (short) -(78.95-151.38*scale+82.29*scale*scale);
       (*AnaLogglobals->hook.xform)(Inst, &Wx, &Wy);
-      (*AnaLogglobals->hook.xform)(Inst, &Lx, &Ly);            
+      (*AnaLogglobals->hook.xform)(Inst, &Lx, &Ly);
       /* do some intelligent shift */
   }
   drawnum3(Wx,Wy,W);
@@ -178,7 +178,7 @@ int erase;
 static void Ex_PSPC1(act)
 Analog_32_action *act;
 {
-  double MinI2, dI2dV1, dI2dV2, dI2dV3, dI2dV4, 
+  double MinI2, dI2dV1, dI2dV2, dI2dV3, dI2dV4,
          MinI3, dI3dV1, dI3dV2, dI3dV3, dI3dV4,
          MinI1, dI1dV1, dI1dV2, dI1dV3, dI1dV4,
          MinI4, dI4dV1, dI4dV2, dI4dV3, dI4dV4;
@@ -400,8 +400,8 @@ Analog_32_action *act;
   double VPin1, VPin2, VPin3, VPin4, VMem1, VMem2, VMem3;
   PfetConst *PfetVar;
   Anainstlist *A_Gate;
-  double Ids, Vg, Vd, Vs, Vb, Vds, K2Vg, K7Vb, ExpFor, 
-         LogOnePlusExpFor,Ifor, ExpRev, LogOnePlusExpRev, 
+  double Ids, Vg, Vd, Vs, Vb, Vds, K2Vg, K7Vb, ExpFor,
+         LogOnePlusExpFor,Ifor, ExpRev, LogOnePlusExpRev,
          Irev, Blend, VdsInvVcross, Early, Itotal;
   log_grec *WITH1;
 
@@ -698,9 +698,9 @@ long Attrnum;
   PfetVar = (PfetConst *)A_Gate->InstVar;
   switch (Attrnum) {
   case N_W:
-    if (    Inst->attr[N_W - 1].UU.r < 0 
-	 || Inst->attr[N_W - 1].blnk 
-	 || Inst->attr[N_W - 1].UU.r > 1e20) 
+    if (    Inst->attr[N_W - 1].UU.r < 0
+	 || Inst->attr[N_W - 1].blnk
+	 || Inst->attr[N_W - 1].UU.r > 1e20)
       Result = false;
     else {
       Show_W_L(Inst, true);
@@ -719,7 +719,7 @@ long Attrnum;
 
   case N_L:
     if (    Inst->attr[N_L - 1].UU.r <= 0.0
-	 || Inst->attr[N_L - 1].blnk 
+	 || Inst->attr[N_L - 1].blnk
 	 || Inst->attr[N_L - 1].UU.r > 1e20 )
       Result = false;
     else {
@@ -840,7 +840,7 @@ Analog_32_action *act;
       act->ok = Pfetcheck(act->inst, Attrnum);
   }
 /*
-  if (AnaLogglobals->showpage == act->page) 
+  if (AnaLogglobals->showpage == act->page)
   {
       Show_W_L(act->inst,false);
   }
@@ -1057,9 +1057,9 @@ Analog_32_action *act;
   Node1 = Node1Ptr->ltimestep;
   Node2 = Node2Ptr->ltimestep;
   Node3 = Node3Ptr->ltimestep;
-  Node4 = Node4Ptr->ltimestep; 
-  if (Node1 != Pin1 || Node2 != Pin2 || Node3 != Pin3 
-      || Node1 == AnaNotyet || Node2 == AnaNotyet || Node3 == AnaNotyet 
+  Node4 = Node4Ptr->ltimestep;
+  if (Node1 != Pin1 || Node2 != Pin2 || Node3 != Pin3
+      || Node1 == AnaNotyet || Node2 == AnaNotyet || Node3 == AnaNotyet
       || Node4 != Pin4 || Node4 == AnaNotyet) {
     sprintf(STR1, "%s <undefined>", Gatename);
     AnaScoreboard(STR1, (long)AnaMessGate1);
@@ -1138,7 +1138,7 @@ Analog_32_action *act;
     break;
 
   case ANALOG_ACT_DISPLAY:
-    if (AnaLogglobals->showpage == act->page) 
+    if (AnaLogglobals->showpage == act->page)
       Show_W_L(act->inst, false);
     break;
 
@@ -1147,7 +1147,7 @@ Analog_32_action *act;
     break;
 
   case ANALOG_ACT_PASS2:
-    AnaCappass2(act->inst);    
+    AnaCappass2(act->inst);
     break;
 
   case ANALOG_ACT_ATTRCHANGE:
@@ -1225,5 +1225,3 @@ Analog_32_action *act;
 
 
 /* End. */
-
-
diff --git a/log/src/ana/pwl.c b/log/src/ana/pwl.c
index 35a07fb7873bf85f06dc83e0c858ecfaaf0aa125..0b1511671de5d8342f98792bd1fb19cd81883640 100644
--- a/log/src/ana/pwl.c
+++ b/log/src/ana/pwl.c
@@ -82,7 +82,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #include <p2c/p2c.h>
 
 #define PWL_G
-#include "pwl.h"
+#include "ana/pwl.h"
 
 
 /* Defaults */
diff --git a/log/src/ana/resfloat.c b/log/src/ana/resfloat.c
index 38d9cd9802318ac7daa3e65e097442094f19c165..6153ad08ad948b3ea50c2b7e099e8f2e56a01820 100644
--- a/log/src/ana/resfloat.c
+++ b/log/src/ana/resfloat.c
@@ -27,7 +27,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "resfloat.h"
+#include "ana/resfloat.h"
 
 
 #define N_Res           1
diff --git a/log/src/ana/rtd.c b/log/src/ana/rtd.c
index 1e6a99520c7986110833b4e42c14bd6ce507dc25..48c30a89ac7ec9b88222bc1859481d5cda0f134b 100644
--- a/log/src/ana/rtd.c
+++ b/log/src/ana/rtd.c
@@ -56,7 +56,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 #include <math.h>
 #include <p2c/p2c.h>
-#include "rtd.h"
+#include "ana/rtd.h"
 
 /* Defaults */
 #define	D_Sharpness	100.0
diff --git a/log/src/ana/runspec.c b/log/src/ana/runspec.c
index a4dfb618d30c13ee8c190db289eab57de9001b39..f248ef1ae3370db73fb876e65ef9316c0512ba57 100644
--- a/log/src/ana/runspec.c
+++ b/log/src/ana/runspec.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "runspec.h"
+#include "ana/runspec.h"
 
 #define N_fabrun       1
 #define N_N_Na         2
@@ -293,13 +293,13 @@ Analog_32_action *act;
   }
 }
 
-#undef N_fabrun       
-#undef N_N_Na         
-#undef N_N_Mu         
-#undef N_N_Qss        
+#undef N_fabrun
+#undef N_N_Na
+#undef N_N_Mu
+#undef N_N_Qss
 
-#undef N_P_Na         
-#undef N_P_Mu         
-#undef N_P_Qss        
+#undef N_P_Na
+#undef N_P_Mu
+#undef N_P_Qss
 
 /* End. */
diff --git a/log/src/ana/stairs.c b/log/src/ana/stairs.c
index e959dadeb46d9b31f990c8449e20c5b0bba011ef..5769ad28cd65cd207d5c9c4f7633bdc2cf7fedba 100644
--- a/log/src/ana/stairs.c
+++ b/log/src/ana/stairs.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "stairs.h"
+#include "ana/stairs.h"
 
 
 /*For Attributes*/
@@ -204,8 +204,8 @@ Analog_32_action *act;
     	Ftime = StairsVar->Timez;
   	else
     	Ftime = StairsVar->Timez + AnaDt;
-  	
-	switch (WITH->attr[N_Type - 1].UU.nv) 
+
+	switch (WITH->attr[N_Type - 1].UU.nv)
 	{
   		case 0:
     		Fout = Stairmaker(act->inst, Ftime, StairsVar->First);
@@ -262,7 +262,7 @@ Analog_32_action *act;
   	VPin1 = Pin1Ptr->now;
   	Pin2Ptr = (AnaExt_rec *)WITH->pin[1]->info;
   	Vpin2 = Pin2Ptr->now;
-  	switch (act->pin) 
+  	switch (act->pin)
 	{
 	  	case 1:
 	    	WITH = act->inst;
@@ -270,8 +270,8 @@ Analog_32_action *act;
 	      		Ftime = StairsVar->Timez;
 			else
 				Ftime = StairsVar->Timez + AnaDtlast;
-	    
-			switch (WITH->attr[N_Type - 1].UU.nv) 
+
+			switch (WITH->attr[N_Type - 1].UU.nv)
 			{
 	    		case 0:
 	      			Fout = Stairmaker(act->inst, Ftime, StairsVar->First);
@@ -283,27 +283,27 @@ Analog_32_action *act;
 	    	act->Iin = StairsVar->Conductance * (VPin1 - Vpin2 - Fout) + act->Iin;
 	    	AnaCapIin(act);
 	    	break;
-	
+
 	  	case 2:
 	    	WITH = act->inst;
 	    	if (WITH->attr[N_Freeze - 1].UU.b)
 	      		Ftime = StairsVar->Timez;
 			else
 				Ftime = StairsVar->Timez + AnaDtlast;
-	
-			switch (WITH->attr[N_Type - 1].UU.nv) 
+
+			switch (WITH->attr[N_Type - 1].UU.nv)
 			{
 	    		case 0:
 	      			Fout = Stairmaker(act->inst, Ftime, StairsVar->First);
 	      			break;
-				
+
 				default:
 					Fout = 0;
 	    	}
 	    	act->Iin = StairsVar->Conductance * (Vpin2 + Fout - VPin1) + act->Iin;
 	    	AnaCapIin(act);
 	    	break;
-	
+
 	  	default:
 	    	printf("Data Structure Corruption\n");
 	    	_Escape(1002);
diff --git a/log/src/ana/tc.c b/log/src/ana/tc.c
index a76c7d2068a99a11b1ebfcb73f7b8da3b626a51c..5aeac7b599f9d6afdb491934d30cb348701b6c27 100644
--- a/log/src/ana/tc.c
+++ b/log/src/ana/tc.c
@@ -29,7 +29,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "tc.h"
+#include "ana/tc.h"
 
 
 #define Normal          0
@@ -758,7 +758,7 @@ Analog_32_action *act;
   	A_Gate = (Anainstlist *)act->inst->info;
   	TCAmpVar = (TCAmpConst *)A_Gate->InstVar;
   	WITH1 = act->inst;
-  	switch (AmpRange) 
+  	switch (AmpRange)
 	{
   		case Normal:
   		case Wide:
@@ -862,8 +862,8 @@ Analog_32_action *act;
   	WITH = act->inst;
   	IntAmp = AmpRange;
   	A_Gate = (Anainstlist *)WITH->info;
-  	
-	switch (IntAmp) 
+
+	switch (IntAmp)
 	{
   		case Normal:
   		case Wide:
@@ -897,8 +897,8 @@ Analog_32_action *act;
   	Node3 = Node3Ptr->ltimestep;
   	Node4 = Node4Ptr->ltimestep;
   	TCAmpVar = (TCAmpConst *)A_Gate->InstVar;
-  	
-	switch (IntAmp) 
+
+	switch (IntAmp)
 	{
   		case Normal:
     		AnaScoreboard(NormalName, (long)AnaMessGate1);
@@ -918,7 +918,7 @@ Analog_32_action *act;
   	}
   	if (Node1 != Pin1 || Node2 != Pin2 || Node1 == AnaNotyet ||
 			Node2 == AnaNotyet || Node3 != Pin3 || Node4 != Pin4 ||
-      		Node3 == AnaNotyet || Node4 == AnaNotyet) 
+      		Node3 == AnaNotyet || Node4 == AnaNotyet)
 	{
     	AnaScoreboard(" <undefined>", (long)AnaMessGate2);
     	AnaScoreboard("$", (long)AnaMessGate3);
@@ -927,11 +927,11 @@ Analog_32_action *act;
   	}
   	if (Pin4 > WITH->attr[N_Vt - 1].UU.r)
    		AnaScoreboard("Iset out of subthreshold", (long)AnaMessGate2);
-  	else 
+  	else
 	{
     	if (Pin1 < Pin4 && Pin2 < Pin4)
       		AnaScoreboard("Iset limited by V+,V-", (long)AnaMessGate2);
-    	else 
+    	else
 		{
       		ExpoVset = AnaExpo(TCAmpVar->Kn2 * Pin4);
       		BlendVset = 1 / (1 + TCAmpVar->Kn5 * ExpoVset);
@@ -945,15 +945,15 @@ Analog_32_action *act;
     	AnaScoreboard("Tanh linear", (long)AnaMessGate3);
   	else
     	AnaScoreboard("Tanh saturated", (long)AnaMessGate3);
-  	
-	switch (IntAmp) 
+
+	switch (IntAmp)
 	{
   		case Normal:
-    		if (Pin1 < Pin2) 
+    		if (Pin1 < Pin2)
 			{
       			Outhigh = (Pin3 >= AnaVdd + Pin4);
       			Outlow = (Pin3 <= Pin1 - Pin4);
-    
+
 			}
 			else
 			{
@@ -963,12 +963,12 @@ Analog_32_action *act;
 			break;
 
   		case Wide:
-    		if (Pin1 < Pin2) 
+    		if (Pin1 < Pin2)
 			{
       			Outhigh = (Pin3 >= AnaVdd + Pin4);
       			Outlow = (Pin3 < 0);
-    		} 
-			else 
+    		}
+			else
 			{
       			Outhigh = (Pin3 >= AnaVdd);
       			Outlow = (Pin3 + Pin4 < 0);
@@ -993,7 +993,7 @@ Analog_32_action *act;
 			Outhigh = false;
 			Outlow = false;
   	}
-  	if (Outhigh) 
+  	if (Outhigh)
 	{
     	AnaScoreboard("Vout too high", (long)AnaMessGate4);
     	return;
@@ -1048,10 +1048,10 @@ Analog_32_action *act;
 	 dBlendVtop2dVset, dBlendVtop2dV2, Itop2, dItop2Temp1, dItop2Temp2,
 	 dItop2dVout, dItop2dVset, dItop2dV2, Ihigh, dIhighTemp, dIhighdV1,
 	 dIhighdV2, dIhighdVout, dIhighdVset;
-/* p2c: stdlib.text, line 4982: 
+/* p2c: stdlib.text, line 4982:
  * Note: Line breaker spent 2.0 seconds, 5000 tries on line 1035 [251] */
   Deltasign Sign;
-  double ResPositive, ResNegative, 
+  double ResPositive, ResNegative,
 	 IresTempPos, IresTempNeg, Ires, dIresTemp, dIresdV1, dIresdV2,
 	 dIresdVout, TCRes, dTCTemp, dTCResdV1, dTCResdV2, dTCResdVout, Vlow1,
 	 ExpoVlow1, ExpoVlow1Temp, BlendVlow1, InvBlendVlow1,
@@ -1060,7 +1060,7 @@ Analog_32_action *act;
 	 ExpoVlow2Temp, BlendVlow2, InvBlendVlow2, dBlendVlow2dVout,
 	 Ilow2Temp1, Ilow2Temp2, Ilow2Temp3, Ilow2, dIlow2dVout, Delta1,
 	 Delta2, Delta3, Delta4, Itop2Temp1, Itop2Temp2, Itop2Temp3;
-/* p2c: stdlib.text, line 4982: 
+/* p2c: stdlib.text, line 4982:
  * Note: Line breaker spent 2.0 seconds, 5000 tries on line 1047 [251] */
   log_grec *WITH;
   AnaMatRec *WITH1;
@@ -1620,7 +1620,7 @@ Analog_32_action *act;
   	Pin4Ptr = (AnaExt_rec *)WITH->pin[R_Vset - 1]->info;
   	VPin4 = Pin4Ptr->now;
   	VMem4 = A_Gate->Pininfo[R_Vset - 1].Vmem;
-  	switch (act->pin) 
+  	switch (act->pin)
 	{
   		case R_Vplus:   /*Allows attr^[]. access*/
     		WITH = act->inst;
@@ -1653,8 +1653,8 @@ Analog_32_action *act;
       			MaxV1V2 = V2Offset * BlendDel + V1Offset * InvBlendDel;
       			MinV1V2 = V1Offset * BlendDel + V2Offset * InvBlendDel;
       			Sign = Zero;
-    		} 
-			else 
+    		}
+			else
 			{
       			if (Del > 0) {
 					BlendDel = 0.0;
@@ -1663,7 +1663,7 @@ Analog_32_action *act;
 					MinV1V2 = V2Offset;
 					Sign = Positive;
       			}
-				else 
+				else
 				{
 					BlendDel = 1.0;
 					InvBlendDel = 0.0;
@@ -1677,15 +1677,15 @@ Analog_32_action *act;
     		if (fabs(Vcmp) < 0.000708) {
       			BlendVcmp = 1 / (1 + AnaExpo(100000L * Vcmp));
       			Vstr = MaxV1V2 * BlendVcmp + VPin4 * (1 - BlendVcmp);
-    		} 
-			else 
+    		}
+			else
 			{
       			if (Vcmp > 0)
 					Vstr = VPin4;
       			else
 					Vstr = MaxV1V2;
     		}
-			
+
     		ExpoVstr = AnaExpo(TCAmpVar->Kn2 * Vstr);
     		BlendVstr = 1 / (1 + TCAmpVar->Kn5 * ExpoVstr);
     		Iset = TCAmpVar->Kn1 * ExpoVstr * BlendVstr +
@@ -1693,15 +1693,15 @@ Analog_32_action *act;
 
     		TCtanch = AnaTanch(Del * TCAmpVar->HalfIKn2);
 
-    		if (AmpRange == Normal) 
+    		if (AmpRange == Normal)
 			{
       			VcmpVdd = AnaVdd - MinV1V2;
-      			if (fabs(VcmpVdd) < 0.000708) 
+      			if (fabs(VcmpVdd) < 0.000708)
 				{
 					BlendVcmpVdd = 1 / (1 + AnaExpo(100000L * VcmpVdd));
 					MinV1V2Vdd = AnaVdd * BlendVcmpVdd + MinV1V2 * (1 - BlendVcmpVdd);
       			}
-				else 
+				else
 				{
 					if (VcmpVdd > 0)
 	  					MinV1V2Vdd = MinV1V2;
@@ -1714,8 +1714,8 @@ Analog_32_action *act;
       			BlendVbot = 1 / (1 + TCAmpVar->Kn5 * ExpoVbot);
       			Ibot = TCAmpVar->Kn1 * ExpoVbot * BlendVbot +
 	     				(1 - BlendVbot) * TCAmpVar->Kn4 * Vbot * Vbot;
-    		} 
-			else 
+    		}
+			else
 			{
       			Vlow1 = VPin4 - VPin3;
       			ExpoVlow1 = AnaExpo(TCAmpVar->Kn2 * Vlow1);
@@ -1730,7 +1730,7 @@ Analog_32_action *act;
 			    		(1 - BlendVlow2) * TCAmpVar->Kn4 * Vlow2 * Vlow2);
     		}
 
-    		if (AmpRange == Normal) 
+    		if (AmpRange == Normal)
 			{
       			Vhighcmp = AnaVdd - VPin2;
       			if (fabs(Vhighcmp) < 0.000708) {
@@ -1748,7 +1748,7 @@ Analog_32_action *act;
 			else
       			MaxVddV2 = AnaVdd;
 
-    		if (Sign == Zero) 
+    		if (Sign == Zero)
 			{
       			Vtop1 = VPin3 - AnaVdd;
       			ExpoVtop1 = AnaExpo(TCAmpVar->Kn2 * Vtop1);
@@ -1761,9 +1761,9 @@ Analog_32_action *act;
 				InvBlendDel * (TCAmpVar->Kp1 * ExpVtop2 * BlendVtop2 +
 		  				(1 - BlendVtop2) * TCAmpVar->Kp4 * Vtop2 * Vtop2));
     		}
-			else 
+			else
 			{
-      			if (Sign == Positive) 
+      			if (Sign == Positive)
 				{
 					Vtop2 = VPin3 + VPin4 - MaxVddV2;
 					ExpVtop2 = AnaExpo(TCAmpVar->Kn2 * Vtop2);
@@ -1950,7 +1950,7 @@ Analog_32_action *act;
 	 dBlendVtop2dVout, dBlendVtop2dVset, Itop2, dItop2Temp1, dItop2Temp2,
 	 dItop2dVout, dItop2dVset, Ihigh, dIhighTemp, dIhighdV1, dIhighdV2,
 	 dIhighdVout, dIhighdVset;
-/* p2c: stdlib.text, line 5669: 
+/* p2c: stdlib.text, line 5669:
  * Note: Line breaker spent 2.0 seconds, 5000 tries on line 1919 [251] */
   Deltasign Sign;
   double Ires, dIresdVout, TCRes, dTCTemp, dTCResdV1, dTCResdV2, dTCResdVout,
diff --git a/log/src/ana/thermal.c b/log/src/ana/thermal.c
index 1ea48dfa5c86fdcc3e38a6abe4bbc69395ed25e5..842f3b03cad1adb04d3106424322f9529acdef41 100644
--- a/log/src/ana/thermal.c
+++ b/log/src/ana/thermal.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "thermal.h"
+#include "ana/thermal.h"
 
 #define N_Kelvin       1
 #define N_Celsius      2
@@ -70,13 +70,13 @@ ICThermal *NewIC;
       if (!strcmp(Keyword, "UNITS")) {
 	TRY(try1);
 	   (*AnaLogglobals->hook.getword)(Arg, Keyword);
-	 if (!strcmp(Keyword, "CELSIUS")) 
+	 if (!strcmp(Keyword, "CELSIUS"))
 	   {
 	     WITH->InitUnits = Cdisplay;
 	   }
 	 else
 	   {
-	     if (!strcmp(Keyword, "FAHRENHEIT")) 
+	     if (!strcmp(Keyword, "FAHRENHEIT"))
 	       {
 		 WITH->InitUnits = Fdisplay;
 	       }
@@ -155,7 +155,7 @@ Analog_32_action *act;
 	  break;
 	case Fdisplay:
 	  {
-	    (*AnaLogglobals->hook.realunit)(((AnaPhysical.T - 273)*(9.0/5.0) + 32), 
+	    (*AnaLogglobals->hook.realunit)(((AnaPhysical.T - 273)*(9.0/5.0) + 32),
 					    (int)1, "F", Newout);
 	    strcpy(ThermalVar->OldDisplay, Newout);
 	  }
@@ -186,12 +186,12 @@ Analog_32_action *act;
   (*AnaLogglobals->hook.xform)(act->inst, &Tx, &Ty);
   m_centerstr((long)Tx, (long)Ty, NULL, ThermalVar->OldDisplay);
   (*AnaLogglobals->hook.unhidecursor)();
-  
+
 
 }
 
 
- 
+
 static void Attr_Thermal(act)
 Analog_32_action *act;
 {
@@ -346,7 +346,7 @@ Analog_32_action *act;
   Newact.ok = true;
   Openconfig_Thermal(&Newact);
   ThermalVar->Changed = false;
-  
+
   switch (act->inst->attr[N_Selection - 1].UU.nv)
     {
       case Kdisplay:
@@ -363,7 +363,7 @@ Analog_32_action *act;
 	break;
       case Fdisplay:
 	{
-	  (*AnaLogglobals->hook.realunit)(((AnaPhysical.T - 273)*(9.0/5.0) + 32), 
+	  (*AnaLogglobals->hook.realunit)(((AnaPhysical.T - 273)*(9.0/5.0) + 32),
                                           (int)0, "F", Newout);
 	  strcpy(ThermalVar->OldDisplay, Newout);
 	}
@@ -452,10 +452,10 @@ Analog_32_action *act;
 }
 
 
-#undef N_Kelvin       
-#undef N_Celsius      
-#undef N_Farenheit    
-#undef N_Selection    
+#undef N_Kelvin
+#undef N_Celsius
+#undef N_Farenheit
+#undef N_Selection
 #undef Kdisplay
 #undef Cdisplay
 #undef Fdisplay
diff --git a/log/src/ana/vdiff.c b/log/src/ana/vdiff.c
index cae8b7e8d7792b5f8c1062ed661e00bb1a47c329..cadbd4f214640050ca84c0a02fe25cd8830c3614 100644
--- a/log/src/ana/vdiff.c
+++ b/log/src/ana/vdiff.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "vdiff.h"
+#include "ana/vdiff.h"
 
 
 /*For Attributes*/
@@ -212,8 +212,8 @@ static void Ex_Vdiff(Analog_32_action *act)
    		Ftime = VdiffVar->Timez;
   	else
     	Ftime = VdiffVar->Timez + AnaDt;
-  
-	switch (WITH->attr[N_Type - 1].UU.nv) 
+
+	switch (WITH->attr[N_Type - 1].UU.nv)
 	{
 		case 0:
     		Fout = WITH->attr[N_Dc - 1].UU.r;
@@ -282,7 +282,7 @@ static void Iin_Vdiff(Analog_32_action *act)
   	VPin1 = Pin1Ptr->now;
   	Pin2Ptr = (AnaExt_rec *)WITH->pin[1]->info;
   	Vpin2 = Pin2Ptr->now;
-  	switch (act->pin) 
+  	switch (act->pin)
 	{
   		case 1:
     		WITH = act->inst;
@@ -290,7 +290,7 @@ static void Iin_Vdiff(Analog_32_action *act)
       			Ftime = VdiffVar->Timez;
     		else
       			Ftime = VdiffVar->Timez + AnaDtlast;
-    		switch (WITH->attr[N_Type - 1].UU.nv) 
+    		switch (WITH->attr[N_Type - 1].UU.nv)
 			{
 				case 0:
       				Fout = WITH->attr[N_Dc - 1].UU.r;
@@ -325,7 +325,7 @@ static void Iin_Vdiff(Analog_32_action *act)
     		else
 				Ftime = VdiffVar->Timez + AnaDtlast;
 
-			switch (WITH->attr[N_Type - 1].UU.nv) 
+			switch (WITH->attr[N_Type - 1].UU.nv)
 			{
     			case 0:
       				Fout = WITH->attr[N_Dc - 1].UU.r;
diff --git a/log/src/ana/vswitch.c b/log/src/ana/vswitch.c
index 010f607140a61650e91e1d61f88411ff4e2ab2dc..6f79f19a72eccf55faa9222926a069eecda760fe 100644
--- a/log/src/ana/vswitch.c
+++ b/log/src/ana/vswitch.c
@@ -26,7 +26,7 @@ the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 
 #include <p2c/p2c.h>
-#include "vswitch.h"
+#include "ana/vswitch.h"
 
 
 /*For Attributes*/
@@ -207,7 +207,7 @@ static void Ex_Vswitch(Analog_32_action *act)
   	Pin1Ptr = (AnaExt_rec *)WITH->pin[0]->info;
   	Pin1 = Pin1Ptr->nodenum;
   	VPin1 = Pin1Ptr->last;   /*Use with statement to get to internal variables*/
-  	switch (WITH->attr[N_Type - 1].UU.nv) 
+  	switch (WITH->attr[N_Type - 1].UU.nv)
 	{
   		case Bistable:
     		Fout = Bistablemaker(act->inst, VswitchVar->Time, VswitchVar->State, true,
@@ -253,7 +253,7 @@ static void Iin_Vswitch(Analog_32_action *act)
   	VswitchVar = (VswitchConst *)A_Gate->InstVar;
   	Pin1Ptr = (AnaExt_rec *)WITH->pin[0]->info;
   	VPin1 = Pin1Ptr->now;
-  	switch (act->pin) 
+  	switch (act->pin)
 	{
 
   		case 1:
@@ -764,7 +764,7 @@ static void Touch_Vswitch(Analog_32_action *act)
 
   WITH = AnaLogglobals;
   WITH1 = act->inst;
-  if ((WITH->actx != -2 && WITH->actx != -3) && 
+  if ((WITH->actx != -2 && WITH->actx != -3) &&
       (WITH->actx != -4 || WITH->acty != 0))
     return;
   A_Gate = (Anainstlist *)act->inst->info;
diff --git a/log/src/log_action.h b/log/src/log_action.h
deleted file mode 100644
index f4118fb15f181a6bfe8a51296abf648b3e3ead01..0000000000000000000000000000000000000000
--- a/log/src/log_action.h
+++ /dev/null
@@ -1,362 +0,0 @@
-#ifndef LOG_ACTION_H
-#define LOG_ACTION_H
-
-#include"logdef.h"
-#include<limits.h>
-
-typedef enum
-{
-	act_init,
-	act_endinit,
-	act_exit,
-	act_clearmsg,
-	act_status,
-	act_cnf,
-	act_immed,
-	act_func,
-	act_color,
-	act_select,
-	act_clear,
-	act_edit,
-	act_pass,
-	act_tstep,
-	act_erasegate,
-	act_touchgate,
-	act_history,
-	act_histval,
-	act_histstr,
-	act_trigger,
-	act_glowcol,
-	act_newgate,
-	act_disposegate,
-	act_copygate,
-	act_writegate,
-	act_readgate,
-	act_connectgate,
-	act_disconnectgate,
-    act_configgate,
-	act_configchgate,
-	act_configrelgate,
-	act_confignode,
-	act_configchnode,
-	act_configrelnode,
-	act_confighist,
-	act_configchhist,
-	act_configrelhist,
-	act_newkind,
-	act_disposekind,
-	act_newnode,
-	act_disposenode,
-	act_copynode,
-	act_combinenodes,
-	act_combineintonode,
-	act_writenode,
-	act_readnode,
-	act_refnodes,
-	act_nodeval,
-	act_general,
-	act_gennode,
-	act_genkind,
-	act_gengate
-} log_actionkinds;
-
-typedef struct log_hooks_t
-{
-	void (*hidecursor) ();
-	void (*hidecursorrect) (long x1, long y1, long x2, long y2);
-	void (*unhidecursor) ();
-	void (*nodeconflict) (log_nrec *n);
-	void (*gateconflict) (log_grec *g);
-	void (*clearconflicts) (struct log_tool *tool);
-	void (*setdimgate) (log_grec *g, int dim);
-	void (*xform) (log_grec *g, short *x, short *y);
-	void (*getsig) (char *name, log_sigrec **sig);
-	void (*report) (int num, char *name);
-	void (*alert) ();
-	void (*warning) ();
-	void (*working) ();
-	void (*message) (char *msg);
-	void (*vmessage) (char *msg);
-	void (*vmessageflag) (char *msg, int b);
-	void (*trace) (char *msg);
-	void (*dump) (char *msg);
-	void (*setdump) (char *name);
-	void (*closefiles) ();
-	void (*clearalpha) ();
-	void (*drawstr) (int x, int y, char *s);
-	void (*rightstr) (int x, int y, char *s);
-	void (*centerstr) (int x, int y, char *s);
-	void (*clip) ();
-	void (*remcursor) ();
-	void (*clearscreen) ();
-	void (*setmode) (char *s);
-	void (*getword) (char *buf, char *wrd);
-	void (*getint) (char *buf, long *i, long def);
-	void (*getreal) (char *buf, double *r, double def);
-	void (*getbool) (char *buf, int *b);
-	void (*pen) ();
-	void (*pass) ();
-	void (*trykbd) ();
-	void (*scroll) ();
-	void (*trykbdscroll) ();
-	void (*inkey) (char *ch);
-	void (*udrawgate) (int x, int y, int g, int c);
-	void (*gdrawgate) (int x, int y, int g, int c);
-	void (*drawgate) (log_grec *g);
-	void (*erasegate) (log_grec *g);
-	void (*drawnode) (log_nrec *n, int c);
-	void (*refresh) ();   /*quietly refresh drawing area*/
-	void (*refreshsoon) ();
-	void (*beginbottom) ();
-	void (*endbottom) ();
-	void (*beginerror) ();
-	void (*enderror) ();
-	void (*redraw) ();   /*redraw drawing area*/
-	void (*redrawscreen) ();   /*redraw entire screen*/
-	void (*change) (int pg);
-	void (*newgate) (log_grec **g, int gt);
-	void (*copygate) (log_grec *old, log_grec **g);
-	void (*disposegate) (log_grec **g);
-	void (*newnode) (log_nrec **n, int st);
-	void (*copynode) (log_nrec *old, log_nrec **n);
-	void (*disposenode) (log_nrec **n);
-	void (*switchnode) (log_nrec **n, log_nrec *n2);
-	void (*dumpnodes) ();
-	void (*readlnpass) (char *s, int mode);
-	void (*clearfunc) ();
-	void (*refrfunc) ();
-	void (*assertfunc) (char *name);
-	void (*findobject) (int x, int y);
-	void (*findwire) (int x, int y);
-	void (*deletehw) (log_hwrec *hw);
-	void (*deletevw) (log_vwrec *vw);
-	void (*disconnectgate) (log_grec *g);
-	void (*deletegate) (log_grec *g);
-	void (*addhw) (int x1, int x2, int y);
-	void (*addvw) (int x, int y1, int y2);
-	void (*connectgate) (log_grec *g, int *success);
-	void (*waitnear) ();
-	void (*addgate) (int x, int y, int gtype);
-	void (*uaddgate) (int x, int y, int gtype);
-	void (*getgate) (char *name, short *gtype);
-	void (*realunit) (double r, int p, char *u, char *s);
-	void (*realunit2) (double r, int p, char *u, char *s);
-	void (*addlabel) (log_lrec **l, char *s);
-	void (*getcolor) (char *name, short *val, int def);
-	void (*setcmap) (int n, int r, int g, int b);
-	void (*parselabel) (na_strlist_t **lbl, short *numattrs, log_kattrrec **attr);
-	void (*editattrs) (log_gattrrec *gattr, int numattrs, log_kattrrec *kattr, na_strlist_t *lbl,
-			char *name, void (*proc) (), void (*chproc) (), void (*relproc) ());
-	void (*newattrs) (log_gattrrec **gattr, int numattrs, log_kattrrec *kattr);
-	void (*disposeattrs) (log_gattrrec **gattr, int numattrs, log_kattrrec *kattr);
-	void (*copyattrs) (log_gattrrec **gattr, log_gattrrec *oldattr, int numattrs, log_kattrrec *kattr);
-	void (*initscreen) ();
-	void (*clearshowalpha) ();
-	void (*setupregion) (log_regrec **r, int pagenum);
-	void (*stamp) (long *i);
-	void (*noclip) ();
-} log_hooks_t;
-
-typedef struct log_hook2_t
-{
-	void (*getnodeval) (log_nrec *n, double *val, char *opts);
-	void (*solderat) (int x, int y);
-	void (*unsolderwires) (log_hwrec *hw, log_vwrec *vw);
-	void (*settofrom) (log_grec **g, char *name);
-	void (*findattrnum) (log_krec *k, char *name, char *kinds, short *num);
-	void (*findattrname) (log_krec *k, int num, char *name);
-	void (*findpinnum) (log_krec *k, char *name, short *num);
-	void (*findpinname) (log_krec *k, int num, char *name);
-	void (*setgattr) (log_grec *g, int num, char *value);
-	void (*setnattr) (log_nrec *n, int num, char *value);
-	void (*findpointmarker) (log_krec *k, int num, short *x, short *y);
-	void (*findboxmarker) (log_krec *k, int num, short *x1, short *y1, short *x2, short *y2);
-	void (*send_general) (struct log_tool *sim, char *act);
-	void (*send_gennode) (log_nrec *n, char *act);
-	void (*send_genkind) (log_krec *k, char *act);
-	void (*send_gengate) (log_grec *g, char *act);
-	void (*send_all) (char *act);
-	void (*send_allnodes) (char *act);
-	void (*send_allkinds) (char *act);
-	void (*send_allgates) (char *act);
-	void (*addlabelat) (int x, int y, char *s);
-	void (*addboxat) (int x1, int y1, int x2, int y2);
-	void (*plainxform) (log_grec *g, short *x, short *y);
-	void (*findattrnum2) (int numattrs, log_kattrrec *kattr, na_strlist_t *lbl, char *name, char *kinds, short *num);
-	void (*findattrname2) (int numattrs, log_kattrrec *kattr, na_strlist_t *lbl, int num, char *name);
-	void (*showpinname) (log_grec *g, int i, int c, char *name);
-} log_hook2_t;
-
-typedef struct log_action_t
-{
-	log_actionkinds action;
-	log_krec *actkind;
-	log_grec *actgate;
-	log_grec *actgate2;
-	log_nrec *actnode;
-	log_nrec *actnode2;
-	long actx;
-	long acty;
-	int actflag;
-	int actflag2;
-	FILE **actfile;
-	struct log_tool *acttool;
-	char *actstr;
-	double actval;
-	double actval2;
-	double actval3;
-	log_gattrrec *actgattr;
-	log_kattrrec *actkattr;
-	unsigned char *actproc;
-
-	int pagechanged[log_maxpages];
-	log_grec *gbase[log_maxpages];
-	log_srec *sbase[log_maxpages];
-	log_hwrec *hwbase[log_maxpages];
-	log_vwrec *vwbase[log_maxpages];
-	log_lrec *lbase[log_maxpages];
-	log_brec *bbase[log_maxpages];
-	log_nrec *nbase;
-
-	log_sigrec *signaltab;
-	short maxsignal;
-	short lastsignal;
-
-	long numpages; /**< number of pages */
-	long curpage;  /**< current page number */
-	long showpage; /**< currenctly displayed page number */
-
-	short scale;
-	short hscale;
-	long xoff;	   /**< screen_x = grid_x * scale - xoff */
-	long yoff;
-
-	char func[17];
-	char *funcarg;
-
-	log_grec *neargate;
-	log_lrec *nearlabel;
-	log_brec *nearbox;
-	log_hwrec *nearhw;
-	log_hwrec *movinghw;
-	log_vwrec *nearvw;
-	log_vwrec *movingvw;
-
-	log_nrec *probenode;
-	log_grec *probegate;
-	short probepin;
-	struct log_tool *probesimtype;
-	short baselinecolor;
-
-	log_hnrec *hnbase;
-	log_htrec *htbase;
-	log_htrec *htlast;
-
-	long fastspeed;
-	long fastmin;
-	long fastmax;
-	long fastrate;
-
-	long singlestepcount;
-
-	double time;
-	double prevtimestep;
-
-	log_simstatekinds simstate;
-	log_simstatekinds oldsimstate;
-
-	struct log_tool *simstatetool;
-	struct log_tool *oldsimstatetool;
-
-	int histactive;      /** Scope mode is triggered */
-	int dumpopen;        /** Dump output file is open */
-	int traceopen;       /** Trace output is open */
-	int verbose;         /** Commands acknowledge with messages */
-	int traceflag;       /** Debuggin/trace mode on */
-	int quiet;           /** Suppress sound signals */
-	int glowmode;        /** Glowing-wires mode */
-	int probemode;       /** Probe-cursor mode */
-	int markers;         /** Printing markers are defined */
-	int invisible;       /** Gates and wires are invisible */
-	int textinvisible;   /** Lablels and boxes are invisible */
-	int pnuminvisible;   /** Pin numbers are invisible */
-	int dotsvisible;      /** Are "red dots" on or off normally? */
-	int showconflicts;   /** Show onlyconflict */
-	int resetflag;       /** "Reset" command has been given */
-	int pwrflag;         /** Simulator is turned on */
-	int initdone;       /** Done with program initialization */
-	int refrflag;        /** Refreshing all displays */
-
-	int busyflag;        /** Flag for idling simulations */
-
-	short markerx1;
-	short markery1;
-	short markerx2;
-	short markery2;
-
-	m_tablet_info t;
-	m_tablet_info t0;
-	int startpoint;
-	int stillnear;
-	int incircuit;
-
-	short gridx;
-	short gridy;
-	short posx;
-	short posy;
-	short oldx;
-	short oldy;
-	short cx_min;
-	short cy_min;
-	short cx_max;
-	short cy_max;
-	/** Area covered bu cyrsor */
-
-	FILE **dumpfile;
-	FILE **tracefile;
-
-	long rndseed; /** Seed for RAND funtion */
-
-	char *homedirname;
-
-	enum
-	{
-		log_host_log,
-		log_host_loged,
-		log_host_3,
-		log_host_4
-	} host;
-	struct log_tool *toolbase;
-
-	log_hooks_t hook;
-	log_colorrec color;
-
-	long curstamp;
-	long labelstamp;                /** Changes to labels */
-	long boxstamp;                  /** Changes to boxes */
-	long msgstamp;                  /** Clearing messages screen */
-	long refrstamp;                 /** Clearing graphics screen */
-	long nattrstamp;                /** Changes to note attributes */
-	long gattrstamp;                /** Changes to gate attributes */
-	long sigstamp;                  /** Changes to signal table */
-	long loadstamp;                 /** A page was loaded */
-	long pagestamp[log_maxpages];
-	long colorstamp;                /** Color assignment have changes */
-    long resetstamp;   /* Simulation has been reset */
-    log_regrec *pageregions[log_maxpages];
-	long markerstamp;               /** Page markers moved */
-
-	log_krec *probekind;
-	na_strlist_t *actstrlist;
-	log_hook2_t *hook2;
-	log_hwrec *probehwire;
-	log_vwrec *probevwire;
-	long actx2;
-	long acty2;
-	na_quadword actq1;
-	na_quadword actq2;
-	char genfunc [17];
-	long runstamp;
-} log_action_t;
-
-#endif
diff --git a/log/src/fixfet7 b/log/tools/fixfet7
similarity index 100%
rename from log/src/fixfet7
rename to log/tools/fixfet7
diff --git a/log/src/munch b/log/tools/munch
similarity index 100%
rename from log/src/munch
rename to log/tools/munch