diff --git a/log/src/ana/devtechn.c b/log/src/ana/devtechn.c
index d6ce2003e00b69067fa0483496333a18e9ed8d33..969b6f70138acea61505029544b173d2e9c73523 100644
--- a/log/src/ana/devtechn.c
+++ b/log/src/ana/devtechn.c
@@ -389,12 +389,8 @@ Analog_32_action *act;
 static void Openconfig_Devtechn(act)
 Analog_32_action *act;
 {
-  long Index;
-  log_grec *WITH;
-
   if (!act->ok)
     return;
-  WITH = act->inst;
   Reload_Devtechn(act);
 }
 
@@ -402,7 +398,6 @@ static void Readgate_Devtechn(act)
 Analog_32_action *act;
 {
   log_grec *WITH;
-  char STR1[256];
 
   WITH = act->inst;
   if (AnaOldmodel && !WITH->attr[0].blnk) {
@@ -433,7 +428,6 @@ static void Newgate_Devtechn(act)
 Analog_32_action *act;
 {
   Analog_32_action Newact;
-  char Newout[256];
 
   Newact.inst = act->inst;
   Newact.ok = true;
@@ -483,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 85f1ae0fb6dc2abe383a1a2d10a9ad63e2f0619c..50654c403d89e6c81cd9bc720121f947ede3d7a8 100644
--- a/log/src/ana/diode1.c
+++ b/log/src/ana/diode1.c
@@ -125,7 +125,7 @@ Analog_32_action *act;
 
   dBlenddS = lamBlend * K2ExpVgs * Blend;
   dIfordG = IsExpVgs * lamBlend - IsExpVgsMinOne * dBlenddS +
-	    Diode1Var->K1 * InvBlend + K1Vgs * dBlenddS;
+		Diode1Var->K1 * InvBlend + K1Vgs * dBlenddS;
 
   MinI1 = -Ifor;
   MinI2 = Ifor;
@@ -164,9 +164,9 @@ static void Iin_Diode1(act)
 Analog_32_action *act;
 {
   AnaExt_rec *Pin1Ptr;
-  double VPin1, VMem1;
+  double VPin1;
   AnaExt_rec *Pin2Ptr;
-  double VPin2, VMem2;
+  double VPin2;
   Diode1Const *Diode1Var;
   Anainstlist *A_Gate;
   double Vgs, ExpVgs, Blend, Ifor;
@@ -177,10 +177,8 @@ Analog_32_action *act;
   Diode1Var = (Diode1Const *)A_Gate->InstVar;
   Pin1Ptr = (AnaExt_rec *)WITH->pin[0]->info;
   VPin1 = Pin1Ptr->now;
-  VMem1 = A_Gate->Pininfo[0].Vmem;
   Pin2Ptr = (AnaExt_rec *)WITH->pin[1]->info;
   VPin2 = Pin2Ptr->now;
-  VMem2 = A_Gate->Pininfo[1].Vmem;
   switch (act->pin) {
 
   case 1:
@@ -215,7 +213,6 @@ ICDiode1 *NewIC;
 {
   int Found;
   char Arg[256], Keyword[256];
-  long Dummy;
   ICDiode1 *WITH;
   char *STR1;
 
@@ -227,7 +224,6 @@ ICDiode1 *NewIC;
       if (!strcmp(Keyword, "IS")) {
 	TRY(try1);
 	  WITH->ICIs = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try1);
 	  WITH->ICIs = 1e-15;
 	ENDTRY(try1);
@@ -235,7 +231,6 @@ ICDiode1 *NewIC;
       if (!strcmp(Keyword, "KT/QN")) {
 	TRY(try2);
 	  WITH->ICKtqn = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try2);
 	  WITH->ICKtqn = 0.04;
 	ENDTRY(try2);
@@ -243,7 +238,6 @@ ICDiode1 *NewIC;
       if (!strcmp(Keyword, "VCROW")) {
 	TRY(try3);
 	  WITH->ICVcrow = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try3);
 	  WITH->ICVcrow = 0.8;
 	ENDTRY(try3);
@@ -251,7 +245,6 @@ ICDiode1 *NewIC;
       if (!strcmp(Keyword, "CCSUB")) {
 	TRY(try4);
 	  WITH->InitCcb = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try4);
 	  WITH->InitCcb = 10e-15;
 	ENDTRY(try4);
@@ -259,7 +252,6 @@ ICDiode1 *NewIC;
       if (!strcmp(Keyword, "CASUB")) {
 	TRY(try5);
 	  WITH->InitCab = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try5);
 	  WITH->InitCab = 10e-15;
 	ENDTRY(try5);
@@ -481,7 +473,7 @@ Analog_32_action *act;
   char Name1[256], Name2[256];
   log_grec *WITH;
   char STR1[20];
-  char STR2[256];
+  char STR2[262];
   char STR3[256];
 
   WITH = act->inst;
@@ -580,11 +572,9 @@ Analog_32_action *act;
 {
   Diode1Const *Diode1Var;
   Anainstlist *A_Gate;
-  log_grec *WITH1;
 
   A_Gate = (Anainstlist *)act->inst->info;
   Diode1Var = (Diode1Const *)A_Gate->InstVar;
-  WITH1 = act->inst;
   if (AnaLogglobals->showpage == act->page) {
     if (Diode1Var->OldLimit != Diode1Var->Limit)
       Limitfill(act->inst, Diode1Var->Limit, false);
diff --git a/log/src/ana/npn2.c b/log/src/ana/npn2.c
index 2dcf476cb332a684c2d9fe3d2d23feafa410143b..50bf10727bc16808d5febdc5e4deda3c5b98a4a3 100644
--- a/log/src/ana/npn2.c
+++ b/log/src/ana/npn2.c
@@ -95,7 +95,7 @@ int Limitflag, Erase;
 /*   Model used:                                                            */
 /*                                                                          */
 /*       Base = VPin1, Emitter = VPin3 Collector = VPin2                    */
-/*	                                                                        */
+/*																			*/
 /*  ICEO = Is / betaF                                                       */
 /*  IECO = Is / betaR                                                       */
 /*                                                                          */
@@ -108,8 +108,8 @@ int Limitflag, Erase;
 /*                                                                          */
 /*   2nd-order Model (Early effect):                                        */
 /*                                                                          */
-/*  IColl = (betaF * Ifor - betaR * Irev) *	                                */
-/*	    (1 - (((Vbase - Vemit) + (Vbase - Vcoll)) / |Va|)) - Irev           */
+/*  IColl = (betaF * Ifor - betaR * Irev) *									*/
+/*		(1 - (((Vbase - Vemit) + (Vbase - Vcoll)) / |Va|)) - Irev           */
 /*                                                                          */
 /****************************************************************************/
 
@@ -125,9 +125,9 @@ Analog_32_action *act;
   NPN2Const *Npn2Var;
   Anainstlist *A_Gate;
   double Vbe, Vbc, Icap, ExpVbe, For2ExpVbe, ICEOExpVbe, ICEOExpVbeMinOne,
-	 FBlend, InvFBlend, For1Vbe, lamFBlend, Ifor, dFBlenddS, dIfdC, dIfdB,
+	 FBlend, InvFBlend, For1Vbe, lamFBlend, Ifor, dFBlenddS, dIfdB,
 	 dIfdE, ExpVbc, For2ExpVbc, IECOExpVbc, IECOExpVbcMinOne, RBlend,
-	 InvRBlend, R1Vbc, lamRBlend, Irev, dRBlenddS, dIrdE, dIrdB, dIrdC,
+	 InvRBlend, R1Vbc, lamRBlend, Irev, dRBlenddS, dIrdB, dIrdC,
 	 Ib, dIbdE, dIbdB, dIbdC, Ic, dIcdE, dIcdC, dIcdB, Ie, dIedE, dIedB,
 	 dIedC, Early, Ic0;
   log_grec *WITH;
@@ -170,7 +170,6 @@ Analog_32_action *act;
 
   dFBlenddS = lamFBlend * For2ExpVbe * FBlend;
 
-  dIfdC = 0.0;
   dIfdB = ICEOExpVbe * lamFBlend - ICEOExpVbeMinOne * dFBlenddS +
 	  Npn2Var->For1 * InvFBlend + For1Vbe * dFBlenddS;
   dIfdE = -dIfdB;
@@ -190,7 +189,6 @@ Analog_32_action *act;
 
   dRBlenddS = lamRBlend * For2ExpVbc * RBlend;
 
-  dIrdE = 0.0;
   dIrdB = IECOExpVbc * lamRBlend - IECOExpVbcMinOne * dRBlenddS +
 	  Npn2Var->R1 * InvRBlend + R1Vbc * dRBlenddS;
   dIrdC = -dIrdB;
@@ -201,7 +199,7 @@ Analog_32_action *act;
   dIbdC = dIrdC;
 
   Early = 1 - (Vbe + Vbc) / Npn2Var->Va;
-  Ic0 = Npn2Var->betaF * Ifor - Npn2Var->betaR * Irev; 
+  Ic0 = Npn2Var->betaF * Ifor - Npn2Var->betaR * Irev;
   Ic = Ic0 * Early - Irev;
 
   dIcdE = Npn2Var->betaF * dIfdE * Early + (Ic0 / Npn2Var->Va);
@@ -357,7 +355,7 @@ Analog_32_action *act;
     FBlend = 1 / (1 + NPN2Var->For2 * ExpVbe);
     Ifor = (NPN2Var->ICEO * ExpVbe - NPN2Var->ICEO) * FBlend +
 	   (1 - FBlend) * NPN2Var->For1 * Vbe;
- 
+
     ExpVbc = AnaExpo(NPN2Var->lam * Vbc);
     RBlend = 1 / (1 + NPN2Var->For2 * ExpVbc);
     Irev = (NPN2Var->IECO * ExpVbc - NPN2Var->IECO) * RBlend +
@@ -409,7 +407,6 @@ ICNPN2 *NewIC;
 {
   int Found;
   char Arg[256], Keyword[256];
-  long Dummy;
   ICNPN2 *WITH;
   char *STR1;
 
@@ -421,7 +418,6 @@ ICNPN2 *NewIC;
       if (!strcmp(Keyword, "BETAF")) {
 	TRY(try1);
 	  WITH->ICbetaF = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try1);
 	  WITH->ICbetaF = 100.0;
 	ENDTRY(try1);
@@ -429,7 +425,6 @@ ICNPN2 *NewIC;
       if (!strcmp(Keyword, "VCROW")) {
 	TRY(try2);
 	  WITH->ICVcrow = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try2);
 	  WITH->ICVcrow = 0.8;
 	ENDTRY(try2);
@@ -437,7 +432,6 @@ ICNPN2 *NewIC;
       if (!strcmp(Keyword, "BETAR")) {
 	TRY(try3);
 	  WITH->ICbetaR = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try3);
 	  WITH->ICbetaR = 0.4;
 	ENDTRY(try3);
@@ -445,7 +439,6 @@ ICNPN2 *NewIC;
       if (!strcmp(Keyword, "IS")) {
 	TRY(try4);
 	  WITH->ICIs = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try4);
 	  WITH->ICIs = 1.3e-16;
 	ENDTRY(try4);
@@ -453,7 +446,6 @@ ICNPN2 *NewIC;
       if (!strcmp(Keyword, "VA")) {
 	TRY(try5);
 	  WITH->ICVa = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try5);
 	  WITH->ICVa = 20.0;
 	ENDTRY(try5);
@@ -461,7 +453,6 @@ ICNPN2 *NewIC;
       if (!strcmp(Keyword, "KT/Q")) {
 	TRY(try6);
 	  WITH->ICKtq = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try6);
 	  WITH->ICKtq = 0.025;
 	ENDTRY(try6);
@@ -469,7 +460,6 @@ ICNPN2 *NewIC;
       if (!strcmp(Keyword, "CBE")) {
 	TRY(try7);
 	  WITH->InitCbe = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try7);
 	  WITH->InitCbe = 10e-15;
 	ENDTRY(try7);
@@ -477,7 +467,6 @@ ICNPN2 *NewIC;
       if (!strcmp(Keyword, "CBC")) {
 	TRY(try8);
 	  WITH->InitCbc = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try8);
 	  WITH->InitCbc = 10e-15;
 	ENDTRY(try8);
@@ -485,7 +474,6 @@ ICNPN2 *NewIC;
       if (!strcmp(Keyword, "CBSUB")) {
 	TRY(try9);
 	  WITH->InitCgb = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try9);
 	  WITH->InitCgb = 10e-15;
 	ENDTRY(try9);
@@ -493,7 +481,6 @@ ICNPN2 *NewIC;
       if (!strcmp(Keyword, "CCSUB")) {
 	TRY(try10);
 	  WITH->InitCdb = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try10);
 	  WITH->InitCdb = 10e-15;
 	ENDTRY(try10);
@@ -501,7 +488,6 @@ ICNPN2 *NewIC;
       if (!strcmp(Keyword, "CESUB")) {
 	TRY(try11);
 	  WITH->InitCsb = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try11);
 	  WITH->InitCsb = 10e-15;
 	ENDTRY(try11);
@@ -842,7 +828,7 @@ Analog_32_action *act;
 {
   Anainstlist *A_Gate;
   AnaExt_rec *Node1Ptr, *Node2Ptr, *Node3Ptr;
-  double Node1, Node2, Node3, Pin1, Pin2, Pin3, d1, d2;
+  double Node1, Node2, Node3, Pin1, Pin2, Pin3;
   log_grec *WITH;
   char STR1[18];
   char STR2[12];
@@ -869,8 +855,6 @@ Analog_32_action *act;
     AnaScoreboard("$", (long)AnaMessGate3);
     return;
   }
-  d1 = Pin2 - Pin3;
-  d2 = Pin1 - Pin3;
   switch (AnaLogglobals->probepin) {
 
   case 0:
@@ -938,7 +922,7 @@ Analog_32_action *act;
   Vpin2 = Pin2Ptr->last;
   Vpin3 = Pin3Ptr->last;
   NPN2Var->NewLimit = (VPin1 - Vpin3 >= WITH1->attr[N_Vcrow - 1].UU.r ||
-		       VPin1 - Vpin2 >= WITH1->attr[N_Vcrow - 1].UU.r);
+			   VPin1 - Vpin2 >= WITH1->attr[N_Vcrow - 1].UU.r);
 }
 
 static void Update_NPN2(act)
@@ -959,11 +943,9 @@ Analog_32_action *act;
 {
   NPN2Const *NPN2Var;
   Anainstlist *A_Gate;
-  log_grec *WITH1;
 
   A_Gate = (Anainstlist *)act->inst->info;
   NPN2Var = (NPN2Const *)A_Gate->InstVar;
-  WITH1 = act->inst;
   if (AnaLogglobals->showpage == act->page) {
     if (NPN2Var->OldLimit != NPN2Var->Limit)
       Limitfill(act->inst, NPN2Var->Limit, false);
diff --git a/log/src/ana/pnp1.c b/log/src/ana/pnp1.c
index 6b141c69487f9308b2cbd62198a4c32bc84021c3..c806821e3680dff36c8c0f05fab5241485bc90aa 100644
--- a/log/src/ana/pnp1.c
+++ b/log/src/ana/pnp1.c
@@ -115,9 +115,9 @@ Analog_32_action *act;
   PNP1Const *PNP1Var;
   Anainstlist *A_Gate;
   double Veb, Vcb, Icap, ExpVeb, For2ExpVeb, ICEOExpVeb, ICEOExpVebMinOne,
-	 FBlend, InvFBlend, For1Veb, lamFBlend, Ifor, dFBlenddS, dIfdC, dIfdB,
+	 FBlend, InvFBlend, For1Veb, lamFBlend, Ifor, dFBlenddS, dIfdB,
 	 dIfdE, ExpVcb, For2ExpVcb, IECOExpVcb, IECOExpVcbMinOne, RBlend,
-	 InvRBlend, R1Vcb, lamRBlend, Irev, dRBlenddS, dIrdE, dIrdB, dIrdC,
+	 InvRBlend, R1Vcb, lamRBlend, Irev, dRBlenddS, dIrdB, dIrdC,
 	 Ib, dIbdE, dIbdB, dIbdC, Ic, dIcdE, dIcdC, dIcdB, Ie, dIedE, dIedB,
 	 dIedC;
   log_grec *WITH;
@@ -160,7 +160,6 @@ Analog_32_action *act;
 
   dFBlenddS = lamFBlend * For2ExpVeb * FBlend;
 
-  dIfdC = 0.0;
   dIfdE = ICEOExpVeb * lamFBlend - ICEOExpVebMinOne * dFBlenddS +
 	  PNP1Var->For1 * InvFBlend + For1Veb * dFBlenddS;
   dIfdB = -dIfdE;
@@ -180,7 +179,6 @@ Analog_32_action *act;
 
   dRBlenddS = lamRBlend * For2ExpVcb * RBlend;
 
-  dIrdE = 0.0;
   dIrdC = IECOExpVcb * lamRBlend - IECOExpVcbMinOne * dRBlenddS +
 	  PNP1Var->R1 * InvRBlend + R1Vcb * dRBlenddS;
   dIrdB = -dIrdC;
@@ -393,7 +391,6 @@ ICPNP1 *NewIC;
 {
   int Found;
   char Arg[256], Keyword[256];
-  long Dummy;
   ICPNP1 *WITH;
   char *STR1;
 
@@ -405,7 +402,6 @@ ICPNP1 *NewIC;
       if (!strcmp(Keyword, "BETAF")) {
 	TRY(try1);
 	  WITH->ICbetaF = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try1);
 	  WITH->ICbetaF = 100.0;
 	ENDTRY(try1);
@@ -413,7 +409,6 @@ ICPNP1 *NewIC;
       if (!strcmp(Keyword, "VCROW")) {
 	TRY(try2);
 	  WITH->ICVcrow = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try2);
 	  WITH->ICVcrow = 0.8;
 	ENDTRY(try2);
@@ -421,7 +416,6 @@ ICPNP1 *NewIC;
       if (!strcmp(Keyword, "BETAR")) {
 	TRY(try3);
 	  WITH->ICbetaR = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try3);
 	  WITH->ICbetaR = 1.0;
 	ENDTRY(try3);
@@ -429,7 +423,6 @@ ICPNP1 *NewIC;
       if (!strcmp(Keyword, "IS")) {
 	TRY(try4);
 	  WITH->ICIs = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try4);
 	  WITH->ICIs = 1e-15;
 	ENDTRY(try4);
@@ -437,7 +430,6 @@ ICPNP1 *NewIC;
       if (!strcmp(Keyword, "KT/Q")) {
 	TRY(try5);
 	  WITH->ICKtq = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try5);
 	  WITH->ICKtq = 0.025;
 	ENDTRY(try5);
@@ -445,7 +437,6 @@ ICPNP1 *NewIC;
       if (!strcmp(Keyword, "CBE")) {
 	TRY(try6);
 	  WITH->InitCbe = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try6);
 	  WITH->InitCbe = 10e-15;
 	ENDTRY(try6);
@@ -453,7 +444,6 @@ ICPNP1 *NewIC;
       if (!strcmp(Keyword, "CBC")) {
 	TRY(try7);
 	  WITH->InitCbc = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try7);
 	  WITH->InitCbc = 10e-15;
 	ENDTRY(try7);
@@ -461,7 +451,6 @@ ICPNP1 *NewIC;
       if (!strcmp(Keyword, "CBSUB")) {
 	TRY(try8);
 	  WITH->InitCgb = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try8);
 	  WITH->InitCgb = 10e-15;
 	ENDTRY(try8);
@@ -469,7 +458,6 @@ ICPNP1 *NewIC;
       if (!strcmp(Keyword, "CCSUB")) {
 	TRY(try9);
 	  WITH->InitCdb = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try9);
 	  WITH->InitCdb = 10e-15;
 	ENDTRY(try9);
@@ -477,7 +465,6 @@ ICPNP1 *NewIC;
       if (!strcmp(Keyword, "CESUB")) {
 	TRY(try10);
 	  WITH->InitCsb = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try10);
 	  WITH->InitCsb = 10e-15;
 	ENDTRY(try10);
@@ -900,7 +887,7 @@ Analog_32_action *act;
   Vpin2 = Pin2Ptr->last;
   Vpin3 = Pin3Ptr->last;
   PNP1Var->NewLimit = (Vpin3 - VPin1 >= WITH1->attr[N_Vcrow - 1].UU.r ||
-		       Vpin2 - VPin1 >= WITH1->attr[N_Vcrow - 1].UU.r);
+			   Vpin2 - VPin1 >= WITH1->attr[N_Vcrow - 1].UU.r);
 }
 
 static void Update_PNP1(act)
@@ -921,11 +908,9 @@ Analog_32_action *act;
 {
   PNP1Const *PNP1Var;
   Anainstlist *A_Gate;
-  log_grec *WITH1;
 
   A_Gate = (Anainstlist *)act->inst->info;
   PNP1Var = (PNP1Const *)A_Gate->InstVar;
-  WITH1 = act->inst;
   if (AnaLogglobals->showpage == act->page) {
     if (PNP1Var->OldLimit != PNP1Var->Limit)
       Limitfill(act->inst, PNP1Var->Limit, false);
diff --git a/log/src/ana/pnp2.c b/log/src/ana/pnp2.c
index 77279f8bf4029f7e819f20166c81aeb36d382b71..9fe9402705141f745c42e0a42f65a6058c0df08c 100644
--- a/log/src/ana/pnp2.c
+++ b/log/src/ana/pnp2.c
@@ -99,8 +99,8 @@ int Limitflag, Erase;
 /*  ICEO = Is / betaF                                                       */
 /*  IECO = Is / betaR                                                       */
 /*                                                                          */
-/*  Ifor = ICEO * (Exp((Vbase - Vemit)/Vo) - 1)	                            */
-/*  Irev = IECO * (Exp((Vbase - Vcoll)/Vo) - 1)	                            */
+/*  Ifor = ICEO * (Exp((Vbase - Vemit)/Vo) - 1)								*/
+/*  Irev = IECO * (Exp((Vbase - Vcoll)/Vo) - 1)								*/
 /*                                                                          */
 /*  IBase = Ifor - Irev                                                     */
 /*  IColl = betaF * Ifor - (1 + betaR) * Irev                               */
@@ -108,8 +108,8 @@ int Limitflag, Erase;
 /*                                                                          */
 /*   2nd-order Model (Early effect):                                        */
 /*                                                                          */
-/*  IColl = (betaF * Ifor - betaR * Irev) *	                                */
-/*	    (1 - (((Vbase - Vemit) + (Vbase - Vcoll)) / |Va|)) - Irev           */
+/*  IColl = (betaF * Ifor - betaR * Irev) *									*/
+/*		(1 - (((Vbase - Vemit) + (Vbase - Vcoll)) / |Va|)) - Irev           */
 /*                                                                          */
 /****************************************************************************/
 
@@ -126,9 +126,9 @@ Analog_32_action *act;
   PNP2Const *PNP2Var;
   Anainstlist *A_Gate;
   double Veb, Vcb, Icap, ExpVeb, For2ExpVeb, ICEOExpVeb, ICEOExpVebMinOne,
-	 FBlend, InvFBlend, For1Veb, lamFBlend, Ifor, dFBlenddS, dIfdC, dIfdB,
+	 FBlend, InvFBlend, For1Veb, lamFBlend, Ifor, dFBlenddS, dIfdB,
 	 dIfdE, ExpVcb, For2ExpVcb, IECOExpVcb, IECOExpVcbMinOne, RBlend,
-	 InvRBlend, R1Vcb, lamRBlend, Irev, dRBlenddS, dIrdE, dIrdB, dIrdC,
+	 InvRBlend, R1Vcb, lamRBlend, Irev, dRBlenddS, dIrdB, dIrdC,
 	 Ib, dIbdE, dIbdB, dIbdC, Ic, dIcdE, dIcdC, dIcdB, Ie, dIedE, dIedB,
 	 dIedC, Early, Ic0;
   log_grec *WITH;
@@ -171,7 +171,6 @@ Analog_32_action *act;
 
   dFBlenddS = lamFBlend * For2ExpVeb * FBlend;
 
-  dIfdC = 0.0;
   dIfdE = ICEOExpVeb * lamFBlend - ICEOExpVebMinOne * dFBlenddS +
 	  PNP2Var->For1 * InvFBlend + For1Veb * dFBlenddS;
   dIfdB = -dIfdE;
@@ -191,7 +190,6 @@ Analog_32_action *act;
 
   dRBlenddS = lamRBlend * For2ExpVcb * RBlend;
 
-  dIrdE = 0.0;
   dIrdC = IECOExpVcb * lamRBlend - IECOExpVcbMinOne * dRBlenddS +
 	  PNP2Var->R1 * InvRBlend + R1Vcb * dRBlenddS;
   dIrdB = -dIrdC;
@@ -204,7 +202,7 @@ Analog_32_action *act;
 
   Early = 1 - (Veb + Vcb) / PNP2Var->Va;
   Ic0 = (PNP2Var->betaF * Ifor - PNP2Var->betaR * Irev);
-  
+
   Ic = Ic0 * Early - Irev;
 
   dIcdE = PNP2Var->betaF * dIfdE * Early + (Ic0 / PNP2Var->Va);
@@ -391,7 +389,7 @@ Analog_32_action *act;
     Irev = (PNP2Var->IECO * ExpVcb - PNP2Var->IECO) * RBlend +
 	   (1 - RBlend) * PNP2Var->R1 * Vcb;
 
-    
+
     Early = 1 - (Veb + Vcb) / PNP2Var->Va;
     Ib = Irev + Ifor;
     Ic = (PNP2Var->betaF * Ifor - PNP2Var->betaR * Irev) * Early - Irev;
@@ -413,7 +411,6 @@ ICPNP2 *NewIC;
 {
   int Found;
   char Arg[256], Keyword[256];
-  long Dummy;
   ICPNP2 *WITH;
   char *STR1;
 
@@ -425,7 +422,6 @@ ICPNP2 *NewIC;
       if (!strcmp(Keyword, "BETAF")) {
 	TRY(try1);
 	  WITH->ICbetaF = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try1);
 	  WITH->ICbetaF = 100.0;
 	ENDTRY(try1);
@@ -433,7 +429,6 @@ ICPNP2 *NewIC;
       if (!strcmp(Keyword, "VCROW")) {
 	TRY(try2);
 	  WITH->ICVcrow = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try2);
 	  WITH->ICVcrow = 0.8;
 	ENDTRY(try2);
@@ -441,7 +436,6 @@ ICPNP2 *NewIC;
       if (!strcmp(Keyword, "BETAR")) {
 	TRY(try3);
 	  WITH->ICbetaR = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try3);
 	  WITH->ICbetaR = 0.25;
 	ENDTRY(try3);
@@ -449,7 +443,6 @@ ICPNP2 *NewIC;
       if (!strcmp(Keyword, "IS")) {
 	TRY(try4);
 	  WITH->ICIs = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try4);
 	  WITH->ICIs = 1e-14;
 	ENDTRY(try4);
@@ -457,7 +450,6 @@ ICPNP2 *NewIC;
       if (!strcmp(Keyword, "KT/Q")) {
 	TRY(try5);
 	  WITH->ICKtq = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try5);
 	  WITH->ICKtq = 0.025;
 	ENDTRY(try5);
@@ -465,7 +457,6 @@ ICPNP2 *NewIC;
       if (!strcmp(Keyword, "VA")) {
         TRY(try6);
           WITH->ICVa = strtod(Arg, &STR1);
-          Dummy = STR1 - Arg + 1;
         RECOVER(try6);
           WITH->ICVa = 6.0;
         ENDTRY(try6);
@@ -473,7 +464,6 @@ ICPNP2 *NewIC;
       if (!strcmp(Keyword, "CBE")) {
 	TRY(try7);
 	  WITH->InitCbe = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try7);
 	  WITH->InitCbe = 10e-15;
 	ENDTRY(try7);
@@ -481,7 +471,6 @@ ICPNP2 *NewIC;
       if (!strcmp(Keyword, "CBC")) {
 	TRY(try8);
 	  WITH->InitCbc = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try8);
 	  WITH->InitCbc = 10e-15;
 	ENDTRY(try8);
@@ -489,7 +478,6 @@ ICPNP2 *NewIC;
       if (!strcmp(Keyword, "CBSUB")) {
 	TRY(try9);
 	  WITH->InitCgb = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try9);
 	  WITH->InitCgb = 10e-15;
 	ENDTRY(try9);
@@ -497,7 +485,6 @@ ICPNP2 *NewIC;
       if (!strcmp(Keyword, "CCSUB")) {
 	TRY(try10);
 	  WITH->InitCdb = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try10);
 	  WITH->InitCdb = 10e-15;
 	ENDTRY(try10);
@@ -505,7 +492,6 @@ ICPNP2 *NewIC;
       if (!strcmp(Keyword, "CESUB")) {
 	TRY(try11);
 	  WITH->InitCsb = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try11);
 	  WITH->InitCsb = 10e-15;
 	ENDTRY(try11);
@@ -940,7 +926,7 @@ Analog_32_action *act;
   Vpin2 = Pin2Ptr->last;
   Vpin3 = Pin3Ptr->last;
   PNP2Var->NewLimit = (Vpin3 - VPin1 >= WITH1->attr[N_Vcrow - 1].UU.r ||
-		       Vpin2 - VPin1 >= WITH1->attr[N_Vcrow - 1].UU.r);
+			   Vpin2 - VPin1 >= WITH1->attr[N_Vcrow - 1].UU.r);
 }
 
 static void Update_PNP2(act)
@@ -961,11 +947,9 @@ Analog_32_action *act;
 {
   PNP2Const *PNP2Var;
   Anainstlist *A_Gate;
-  log_grec *WITH1;
 
   A_Gate = (Anainstlist *)act->inst->info;
   PNP2Var = (PNP2Const *)A_Gate->InstVar;
-  WITH1 = act->inst;
   if (AnaLogglobals->showpage == act->page) {
     if (PNP2Var->OldLimit != PNP2Var->Limit)
       Limitfill(act->inst, PNP2Var->Limit, false);
diff --git a/log/src/ana/pwl.c b/log/src/ana/pwl.c
index db03711fc51c2f673172b877182a4b9b1e742a12..35a07fb7873bf85f06dc83e0c858ecfaaf0aa125 100644
--- a/log/src/ana/pwl.c
+++ b/log/src/ana/pwl.c
@@ -29,7 +29,7 @@
  *                              being exceeded), and yellow if the device can-
  *                              not find the definition file (in which case the
  *                              device will act as an open circuit).
- *                              
+ *
  *
  *	Notes:			har@caltech.edu
  *				128-95 Caltech/Pasadena, CA 91125
@@ -205,7 +205,7 @@ int     n, *j;
         while (ju-jl > 1)
         {
                 jm=(ju+jl) >> 1;
-                if (v > x[jm-1] == ascnd)
+                if ((v > x[jm-1]) == ascnd)
                   jl=jm;
                 else
                   ju=jm;
@@ -285,7 +285,7 @@ Analog_32_action *act;
     locate (PWLVar->x, PWLVar->npwlx, deltaV, &j);
     interp (deltaV, j, PWLVar, &MinI1, &dI1dV1);
   }
-  
+
 
   MinI2 = -MinI1;
   dI1dV2 = -dI1dV1;
@@ -324,9 +324,9 @@ static void Iin_PWL(act)
 Analog_32_action *act;
 {
   AnaExt_rec *Pin1Ptr;
-  double VPin1, VMem1;
+  double VPin1;
   AnaExt_rec *Pin2Ptr;
-  double VPin2, VMem2;
+  double VPin2;
   PWLConst *PWLVar;
   Anainstlist *A_Gate;
   log_grec *WITH;
@@ -339,10 +339,8 @@ Analog_32_action *act;
   PWLVar = (PWLConst *)A_Gate->InstVar;
   Pin1Ptr = (AnaExt_rec *)WITH->pin[0]->info;
   VPin1 = Pin1Ptr->now;
-  VMem1 = A_Gate->Pininfo[0].Vmem;
   Pin2Ptr = (AnaExt_rec *)WITH->pin[1]->info;
   VPin2 = Pin2Ptr->now;
-  VMem2 = A_Gate->Pininfo[1].Vmem;
   switch (act->pin) {
 
   case 1:
@@ -394,7 +392,7 @@ static void findcircle (x1, y1, x2, y2, x3, y3, rd,
 {
   double        r;
   double        pxl, pyl, pxr, pyr;
-  double        a, b, c;
+  double        a, b;
   double        al, ar;
 
   *ml = (y2 - y1) / (x2 - x1);
@@ -435,12 +433,10 @@ retry:
 
   a = 1.0 + sqr(*ml);
   b = (2.0 * (*bl) * (*ml)) - (2.0 * (*yc) * (*ml)) - (2.0 * (*xc));
-  c = sqr(*xc) - (2.0 * (*bl) * (*yc)) + sqr(*bl) + sqr(*yc) - sqr(r);
   *xl = -b / (2.0 * a);
 
   a = 1.0 + sqr(*mr);
   b = (2.0 * (*br) * (*mr)) - (2.0 * (*yc) * (*mr)) - (2.0 * (*xc));
-  c = sqr(*xc) - (2.0 * (*br) * (*yc)) + sqr(*br) * sqr(*yc) - sqr(r);
   *xr = -b / (2.0 * a);
 
   al = (x1 + x2) / 2.0;
@@ -534,9 +530,8 @@ static void LoadPWLVar (PWLVar, datafileName, radius)
   double	radius;
 {
   double        x[MAX_PWL], y[MAX_PWL];
-  int           n, i;
+  int           n;
   FILE          *datafile;
-  char		badPWLFile = 0;
   char		str[256];
 
   datafile = fopen (datafileName, "r");
@@ -564,12 +559,10 @@ ICPWL *NewIC;
 {
   int Found;
   char Arg[256], Keyword[256];
-  long Dummy;
   ICPWL *WITH;
   char *STR1;
 
   FILE		*datafile;
-  char		badPWLFile = 0;
 
 /* Read in defaults from models.cnf */
 
@@ -584,15 +577,15 @@ ICPWL *NewIC;
       {
 	TRY(try1);
 	  if (!strcmp (Arg, D_NoDataFile))
-	    strcpy (WITH->ICDataFile, D_NoDataFile);
+		strcpy (WITH->ICDataFile, D_NoDataFile);
 	  else
 	  {
-	    datafile = fopen (Arg, "r");
+		datafile = fopen (Arg, "r");
             if (datafile && CheckPWLFile (datafile))
-	    {
-	      strcpy (WITH->ICDataFile, Arg);
+		{
+		  strcpy (WITH->ICDataFile, Arg);
             }
-	    if (datafile) fclose (datafile);
+		if (datafile) fclose (datafile);
 	  }
 	RECOVER(try1);
 	  strcpy (WITH->ICDataFile, D_NoDataFile);
@@ -603,7 +596,6 @@ ICPWL *NewIC;
       {
         TRY(try1);
 	  WITH->ICRadius = strtod(Arg, &STR1);
-	  Dummy = STR1 - Arg + 1;
 	RECOVER(try1);
 	  WITH->ICRadius = D_Radius;
 	ENDTRY(try1);
@@ -669,7 +661,7 @@ long Attrnum;
           Result = false;
         else
 	  LoadPWLVar (PWLVar, Inst->attr[N_DataFile - 1].UU.c,
-			      Inst->attr[N_Radius - 1].UU.r);
+				  Inst->attr[N_Radius - 1].UU.r);
         if (datafile) fclose (datafile);
       }
       else
@@ -681,7 +673,7 @@ long Attrnum;
       if (Inst->attr[N_Radius - 1].UU.r <= 0 || Inst->attr[N_Radius - 1].blnk)
         Result = false;
       else
-	LoadPWLVar (PWLVar, Inst->attr[N_DataFile - 1].UU.c, 
+	LoadPWLVar (PWLVar, Inst->attr[N_DataFile - 1].UU.c,
                             Inst->attr[N_Radius - 1].UU.r);
       break;
   }
@@ -712,9 +704,6 @@ Analog_32_action *act;
   ICPWL *ICptr;
   log_grec *WITH;
 
-  double	x[MAX_PWL], y[MAX_PWL];
-  int		n, i;
-  FILE		*datafile;
   long		Index;
 
   Cellptr = (AnaCell_rec *)act->inst->kind->info;
@@ -801,7 +790,7 @@ Analog_32_action *act;
   char Name1[256], Name2[256];
   log_grec *WITH;
   char STR1[22];
-  char STR2[256];
+  char STR2[263];
   char STR3[256];
 
   WITH = act->inst;
@@ -910,11 +899,9 @@ Analog_32_action *act;
 {
   PWLConst *PWLVar;
   Anainstlist *A_Gate;
-  log_grec *WITH1;
 
   A_Gate = (Anainstlist *)act->inst->info;
   PWLVar = (PWLConst *)A_Gate->InstVar;
-  WITH1 = act->inst;
   if (AnaLogglobals->showpage == act->page) {
     if (PWLVar->OldLimit != PWLVar->Limit)
       Limitfill(act->inst, PWLVar->Limit, false);
diff --git a/log/src/ana/rtd.c b/log/src/ana/rtd.c
index 0ed4397d17c5339c26e16068421b1f362d69a54c..1e6a99520c7986110833b4e42c14bd6ce507dc25 100644
--- a/log/src/ana/rtd.c
+++ b/log/src/ana/rtd.c
@@ -146,7 +146,7 @@ Analog_32_action *act;
   AnaMatRec *WITH2;
 
   double	deltaV, signDV, x;
-  double	g0, g1, x0, x1, y0, y1, b, u, s, m;
+  double	g0, g1, x0, x1, y1, b, s, m;
   double	b1x0, b2x0, b1x1, b2x1, d1x0, d2x0, d1x1, d2x1;
   double	ex0, ex1, exm, tail, dtail, t1, t2;
   double	tailC, tailV, aOnsC, aOnsV, onset, dOnset;
@@ -191,7 +191,6 @@ Analog_32_action *act;
   aOnsV = WITH->attr[N_aOnsV - 1].UU.r;
 
   g0 = RTDVar->g0;
-  y0 = RTDVar->y0;
   g1 = RTDVar->g1;
   b = RTDVar->b;
 
@@ -225,11 +224,11 @@ Analog_32_action *act;
       dI1dV1 = t2*b1x1 + t1*d1x1 + dtail*b2x1 + tail*d2x1;
 
       if (signDV == -1.0) MinI1 = -MinI1;
-      
+
       break;
 
     case 1:
-      
+
       onset = aOnsC * (SafeExp (x / aOnsV) - 1);
       dOnset = (aOnsC / aOnsV) * SafeExp (x / aOnsV);
 
@@ -240,8 +239,12 @@ Analog_32_action *act;
       dI1dV1 = t2*b1x1 + t1*d1x1 + dtail*b2x1 + tail*d2x1;
 
       if (signDV == -1.0) MinI1 = -MinI1;
-      
+
       break;
+
+	default:
+	  MinI1 = 0;
+	  dI1dV1 = 0;
   }
 
   MinI2 = -MinI1;
@@ -280,159 +283,150 @@ Analog_32_action *act;
 static void Iin_RTD(act)
 Analog_32_action *act;
 {
-  AnaExt_rec *Pin1Ptr;
-  double VPin1, VMem1;
-  AnaExt_rec *Pin2Ptr;
-  double VPin2, VMem2;
-  RTDConst *RTDVar;
-  Anainstlist *A_Gate;
-  log_grec *WITH;
-
-  double        deltaV, signDV, x;
-  double        g0, g1, x0, x1, y0, y1, b, u, s, m;
-  double        b1x0, b2x0, b1x1, b2x1, d1x0, d2x0, d1x1, d2x1;
-  double        ex0, ex1, exm, tail, dtail, t1, t2;
-  double	tailC, tailV, aOnsC, aOnsV, onset, dOnset;
-  double	MinI1, dI1dV1;
-
-  WITH = act->inst;
-  A_Gate = (Anainstlist *)WITH->info;
-  RTDVar = (RTDConst *)A_Gate->InstVar;
-  Pin1Ptr = (AnaExt_rec *)WITH->pin[0]->info;
-  VPin1 = Pin1Ptr->now;
-  VMem1 = A_Gate->Pininfo[0].Vmem;
-  Pin2Ptr = (AnaExt_rec *)WITH->pin[1]->info;
-  VPin2 = Pin2Ptr->now;
-  VMem2 = A_Gate->Pininfo[1].Vmem;
-  switch (act->pin) {
-
-  case 1:
-    WITH = act->inst;
-    deltaV = VPin1 - VPin2;
-
-  if (deltaV > 0.0)
-    signDV = 1.0;
-  else if (deltaV == 0.0)
-    signDV = 0.0;
-  else
-    signDV = -1.0;
-  x = fabs (deltaV);
-
-  x0 = WITH->attr[N_NDRSV - 1].UU.r;
-  x1 = WITH->attr[N_NDREV - 1].UU.r;
-  y1 = WITH->attr[N_VllyC - 1].UU.r;
-  tailC = WITH->attr[N_TailC - 1].UU.r;
-  tailV = WITH->attr[N_TailV - 1].UU.r;
-  aOnsC = WITH->attr[N_aOnsC - 1].UU.r;
-  aOnsV = WITH->attr[N_aOnsV - 1].UU.r;
-  g0 = RTDVar->g0;
-  y0 = RTDVar->y0;
-  g1 = RTDVar->g1;
-  b = RTDVar->b;
-  s = WITH->attr[N_Sharpness - 1].UU.r;
-  m = 0.01;
-  ex0 = SafeExp (s * (x - x0));
-  ex1 = SafeExp (s * (x - x1));
-  exm = SafeExp (-x / m);
-  b1x0 = 1 / (1 + ex0);
-  b1x1 = 1 / (1 + ex1);
-  b2x0 = (1 - exm) * (1 - b1x0);
-  b2x1 = (1 - exm) * (1 - b1x1);
-  d1x0 = -s * ex0 * b1x0 * b1x0;
-  d1x1 = -s * ex1 * b1x1 * b1x1;
-  d2x0 = (exm / m) * (1 - b1x0) - d1x0 * (1 - exm);
-  d2x1 = (exm / m) * (1 - b1x1) - d1x1 * (1 - exm);
-  tail = y1 + tailC * (SafeExp ((x - x1) / tailV) - 1);
-  dtail = (tailC / tailV) * SafeExp ((x - x1) / tailV);
-  switch (WITH->attr[N_Mode - 1].UU.nv)
-  {
-    case 0:
-      t1 = (g0*x)*b1x0 + (g1*x+b)*b2x0;
-      MinI1 = t1*b1x1 + tail*b2x1;
-      t2 = g0*(b1x0+x*d1x0) + g1*(b2x0+x*d2x0) + b*d2x0;
-      dI1dV1 = t2*b1x1 + t1*d1x1 + dtail*b2x1 + tail*d2x1;
-      if (signDV == -1.0) MinI1 = -MinI1;
-      break;
-    case 1:
-      onset = aOnsC * (SafeExp (x / aOnsV) - 1);
-      dOnset = (aOnsC / aOnsV) * SafeExp (x / aOnsV);
-      t1 = (onset)*b1x0 + (g1*x+b)*b2x0;
-      MinI1 = t1*b1x1 + tail*b2x1;
-      t2 = (dOnset*b1x0+onset*d1x0) + g1*(b2x0+x*d2x0) + b*d2x0;
-      dI1dV1 = t2*b1x1 + t1*d1x1 + dtail*b2x1 + tail*d2x1;
-      if (signDV == -1.0) MinI1 = -MinI1;
-      break;
-  }
-    act->Iin += MinI1;
-    AnaCapIin(act);
-    break;
-
-  case 2:
-    WITH = act->inst;
-    deltaV = VPin2 - VPin1;
-
-  if (deltaV > 0.0)
-    signDV = 1.0;
-  else if (deltaV == 0.0)
-    signDV = 0.0;
-  else
-    signDV = -1.0;
-  x = fabs (deltaV);
-  
-  x0 = WITH->attr[N_NDRSV - 1].UU.r;
-  x1 = WITH->attr[N_NDREV - 1].UU.r;
-  y1 = WITH->attr[N_VllyC - 1].UU.r;
-  tailC = WITH->attr[N_TailC - 1].UU.r;
-  tailV = WITH->attr[N_TailV - 1].UU.r;
-  aOnsC = WITH->attr[N_aOnsC - 1].UU.r;
-  aOnsV = WITH->attr[N_aOnsV - 1].UU.r;
-  g0 = RTDVar->g0;
-  y0 = RTDVar->y0;
-  g1 = RTDVar->g1;
-  b = RTDVar->b;
-  s = WITH->attr[N_Sharpness - 1].UU.r;
-  m = 0.01;
-  ex0 = SafeExp (s * (x - x0));
-  ex1 = SafeExp (s * (x - x1));
-  exm = SafeExp (-x / m);
-  b1x0 = 1 / (1 + ex0);
-  b1x1 = 1 / (1 + ex1);
-  b2x0 = (1 - exm) * (1 - b1x0);
-  b2x1 = (1 - exm) * (1 - b1x1);
-  d1x0 = -s * ex0 * b1x0 * b1x0;
-  d1x1 = -s * ex1 * b1x1 * b1x1;
-  d2x0 = (exm / m) * (1 - b1x0) - d1x0 * (1 - exm);
-  d2x1 = (exm / m) * (1 - b1x1) - d1x1 * (1 - exm);
-  tail = y1 + tailC * (SafeExp ((x - x1) / tailV) - 1);
-  dtail = (tailC / tailV) * SafeExp ((x - x1) / tailV);
-  switch (WITH->attr[N_Mode - 1].UU.nv)
-  {
-    case 0:
-      t1 = (g0*x)*b1x0 + (g1*x+b)*b2x0;
-      MinI1 = t1*b1x1 + tail*b2x1;
-      t2 = g0*(b1x0+x*d1x0) + g1*(b2x0+x*d2x0) + b*d2x0;
-      dI1dV1 = t2*b1x1 + t1*d1x1 + dtail*b2x1 + tail*d2x1;
-      if (signDV == -1.0) MinI1 = -MinI1;
-      break;
-    case 1:
-      onset = aOnsC * (SafeExp (x / aOnsV) - 1);
-      dOnset = (aOnsC / aOnsV) * SafeExp (x / aOnsV);
-      t1 = (onset)*b1x0 + (g1*x+b)*b2x0;
-      MinI1 = t1*b1x1 + tail*b2x1;
-      t2 = (dOnset*b1x0+onset*d1x0) + g1*(b2x0+x*d2x0) + b*d2x0;
-      dI1dV1 = t2*b1x1 + t1*d1x1 + dtail*b2x1 + tail*d2x1;
-      if (signDV == -1.0) MinI1 = -MinI1;
-      break;
-  }
-    act->Iin += MinI1;
-    AnaCapIin(act);
-    break;
-
-  default:
-    fprintf(stderr, "Data Structure Corruption\n");
-    _Escape(1002);
-    break;
-  }
+	AnaExt_rec *Pin1Ptr;
+	double VPin1;
+	AnaExt_rec *Pin2Ptr;
+	double VPin2;
+	RTDConst *RTDVar;
+	Anainstlist *A_Gate;
+	log_grec *WITH;
+
+	double      deltaV, signDV, x;
+	double      g0, g1, x0, x1, y1, b, s, m;
+	double      b1x0, b2x0, b1x1, b2x1;
+	double      ex0, ex1, exm, tail, t1;
+	double		tailC, tailV, aOnsC, aOnsV, onset;
+	double		MinI1;
+
+	WITH = act->inst;
+	A_Gate = (Anainstlist *)WITH->info;
+	RTDVar = (RTDConst *)A_Gate->InstVar;
+	Pin1Ptr = (AnaExt_rec *)WITH->pin[0]->info;
+	VPin1 = Pin1Ptr->now;
+	Pin2Ptr = (AnaExt_rec *)WITH->pin[1]->info;
+	VPin2 = Pin2Ptr->now;
+	switch (act->pin)
+	{
+
+		case 1:
+			WITH = act->inst;
+			deltaV = VPin1 - VPin2;
+
+			if (deltaV > 0.0)
+				signDV = 1.0;
+			else if (deltaV == 0.0)
+				signDV = 0.0;
+			else
+				signDV = -1.0;
+
+			x = fabs (deltaV);
+
+			x0 = WITH->attr[N_NDRSV - 1].UU.r;
+			x1 = WITH->attr[N_NDREV - 1].UU.r;
+			y1 = WITH->attr[N_VllyC - 1].UU.r;
+			tailC = WITH->attr[N_TailC - 1].UU.r;
+			tailV = WITH->attr[N_TailV - 1].UU.r;
+			aOnsC = WITH->attr[N_aOnsC - 1].UU.r;
+			aOnsV = WITH->attr[N_aOnsV - 1].UU.r;
+			g0 = RTDVar->g0;
+			g1 = RTDVar->g1;
+			b = RTDVar->b;
+			s = WITH->attr[N_Sharpness - 1].UU.r;
+			m = 0.01;
+			ex0 = SafeExp (s * (x - x0));
+			ex1 = SafeExp (s * (x - x1));
+			exm = SafeExp (-x / m);
+			b1x0 = 1 / (1 + ex0);
+			b1x1 = 1 / (1 + ex1);
+			b2x0 = (1 - exm) * (1 - b1x0);
+			b2x1 = (1 - exm) * (1 - b1x1);
+			tail = y1 + tailC * (SafeExp ((x - x1) / tailV) - 1);
+			switch (WITH->attr[N_Mode - 1].UU.nv)
+			{
+				case 0:
+					t1 = (g0*x)*b1x0 + (g1*x+b)*b2x0;
+					MinI1 = t1*b1x1 + tail*b2x1;
+					if (signDV == -1.0)
+						MinI1 = -MinI1;
+
+					break;
+				case 1:
+					onset = aOnsC * (SafeExp (x / aOnsV) - 1);
+					t1 = (onset)*b1x0 + (g1*x+b)*b2x0;
+					MinI1 = t1*b1x1 + tail*b2x1;
+					if (signDV == -1.0)
+						MinI1 = -MinI1;
+					break;
+
+				default:
+					MinI1 = 0;
+			}
+			act->Iin += MinI1;
+			AnaCapIin(act);
+			break;
+
+		case 2:
+			WITH = act->inst;
+			deltaV = VPin2 - VPin1;
+
+			if (deltaV > 0.0)
+				signDV = 1.0;
+			else if (deltaV == 0.0)
+				signDV = 0.0;
+			else
+				signDV = -1.0;
+
+			x = fabs (deltaV);
+
+			x0 = WITH->attr[N_NDRSV - 1].UU.r;
+			x1 = WITH->attr[N_NDREV - 1].UU.r;
+			y1 = WITH->attr[N_VllyC - 1].UU.r;
+			tailC = WITH->attr[N_TailC - 1].UU.r;
+			tailV = WITH->attr[N_TailV - 1].UU.r;
+			aOnsC = WITH->attr[N_aOnsC - 1].UU.r;
+			aOnsV = WITH->attr[N_aOnsV - 1].UU.r;
+			g0 = RTDVar->g0;
+			g1 = RTDVar->g1;
+			b = RTDVar->b;
+			s = WITH->attr[N_Sharpness - 1].UU.r;
+			m = 0.01;
+			ex0 = SafeExp (s * (x - x0));
+			ex1 = SafeExp (s * (x - x1));
+			exm = SafeExp (-x / m);
+			b1x0 = 1 / (1 + ex0);
+			b1x1 = 1 / (1 + ex1);
+			b2x0 = (1 - exm) * (1 - b1x0);
+			b2x1 = (1 - exm) * (1 - b1x1);
+			tail = y1 + tailC * (SafeExp ((x - x1) / tailV) - 1);
+			switch (WITH->attr[N_Mode - 1].UU.nv)
+			{
+				case 0:
+					t1 = (g0*x)*b1x0 + (g1*x+b)*b2x0;
+					MinI1 = t1*b1x1 + tail*b2x1;
+					if (signDV == -1.0)
+						MinI1 = -MinI1;
+
+					break;
+				case 1:
+					onset = aOnsC * (SafeExp (x / aOnsV) - 1);
+					t1 = (onset)*b1x0 + (g1*x+b)*b2x0;
+					MinI1 = t1*b1x1 + tail*b2x1;
+					if (signDV == -1.0)
+						MinI1 = -MinI1;
+
+					break;
+				default:
+					MinI1 = 0;
+			}
+			act->Iin += MinI1;
+			AnaCapIin(act);
+			break;
+
+		default:
+			fprintf(stderr, "Data Structure Corruption\n");
+			_Escape(1002);
+			break;
+	}
 }  /*Iin_RTD*/
 
 
@@ -441,7 +435,6 @@ ICRTD *NewIC;
 {
   int Found;
   char Arg[256], Keyword[256];
-  long Dummy;
   ICRTD *WITH;
   char *STR1;
 
@@ -465,27 +458,24 @@ ICRTD *NewIC;
       {
         TRY(try1);
           WITH->ICSharpness = strtod(Arg, &STR1);
-          Dummy = STR1 - Arg + 1;
         RECOVER(try1);
           WITH->ICSharpness = D_Sharpness;
         ENDTRY(try1);
       }
 
       if (!strcmp(Keyword, "NDRSV"))
-      {    
+      {
         TRY(try1)
           WITH->ICNDRSV = strtod(Arg, &STR1);
-          Dummy = STR1 - Arg + 1;
         RECOVER(try1);
           WITH->ICNDRSV = D_NDRSV;
         ENDTRY(try1);
       }
 
       if (!strcmp(Keyword, "NDREV"))
-      {    
+      {
         TRY(try1);
           WITH->ICNDREV = strtod(Arg, &STR1);
-          Dummy = STR1 - Arg + 1;
         RECOVER(try1);
           WITH->ICNDREV = D_NDREV;
         ENDTRY(try1);
@@ -495,7 +485,6 @@ ICRTD *NewIC;
       {
         TRY(try1);
           WITH->ICVllyC = strtod(Arg, &STR1);
-          Dummy = STR1 - Arg + 1;
         RECOVER(try1);
           WITH->ICVllyC = D_VllyC;
         ENDTRY(try1);
@@ -505,17 +494,15 @@ ICRTD *NewIC;
       {
         TRY(try1);
           WITH->ICTailC = strtod(Arg, &STR1);
-          Dummy = STR1 - Arg + 1;
         RECOVER(try1);
           WITH->ICTailC = D_TailC;
         ENDTRY(try1);
       }
- 
+
       if (!strcmp(Keyword, "TAILV"))
       {
         TRY(try1);
           WITH->ICTailV = strtod(Arg, &STR1);
-          Dummy = STR1 - Arg + 1;
         RECOVER(try1);
           WITH->ICTailV = D_TailV;
         ENDTRY(try1);
@@ -523,13 +510,12 @@ ICRTD *NewIC;
 
       if (!strcmp(Keyword, "INTERBAND"))
       {
- 	(*AnaLogglobals->hook.getword) (Arg, Keyword);
+	(*AnaLogglobals->hook.getword) (Arg, Keyword);
 
         if (!strcmp(Keyword, "EONSRES"))
         {
           TRY(try1);
             WITH->ICeOnsRes = strtod(Arg, &STR1);
-            Dummy = STR1 - Arg + 1;
           RECOVER(try1);
             WITH->ICeOnsRes = D_eOnsRes;
           ENDTRY(try1);
@@ -544,7 +530,6 @@ ICRTD *NewIC;
         {
           TRY(try1);
             WITH->ICaOnsC = strtod(Arg, &STR1);
-            Dummy = STR1 - Arg + 1;
           RECOVER(try1);
             WITH->ICaOnsC = D_aOnsC;
           ENDTRY(try1);
@@ -554,8 +539,7 @@ ICRTD *NewIC;
         {
           TRY(try2);
              WITH->ICaOnsV = strtod(Arg, &STR1);
-            Dummy = STR1 - Arg + 1;
-          RECOVER(try2); 
+          RECOVER(try2);
             WITH->ICaOnsV = D_aOnsV;
           ENDTRY(try2);
         }
@@ -656,14 +640,14 @@ long Attrnum;
       aOnsC = Inst->attr[N_aOnsC - 1].UU.r;
       aOnsV = Inst->attr[N_aOnsV - 1].UU.r;
       RTDVar->g0 = 1 / Inst->attr[N_eOnsRes - 1].UU.r;
-      switch (Inst->attr[N_Mode - 1].UU.nv) 
-      { 
-        case 0: 
+      switch (Inst->attr[N_Mode - 1].UU.nv)
+      {
+        case 0:
           RTDVar->y0 = RTDVar->g0 * x0;
           break;
-        case 1: 
-          RTDVar->y0 = aOnsC * (SafeExp (x0 / aOnsV) - 1); 
-          break; 
+        case 1:
+          RTDVar->y0 = aOnsC * (SafeExp (x0 / aOnsV) - 1);
+          break;
       }
       RTDVar->g1 = (RTDVar->y0 - y1) / (x0 - x1);
       RTDVar->b = y1 - (RTDVar->g1 * x1);
@@ -685,14 +669,14 @@ long Attrnum;
       aOnsC = Inst->attr[N_aOnsC - 1].UU.r;
       aOnsV = Inst->attr[N_aOnsV - 1].UU.r;
       RTDVar->g0 = 1 / Inst->attr[N_eOnsRes - 1].UU.r;
-      switch (Inst->attr[N_Mode - 1].UU.nv) 
-      { 
-        case 0: 
+      switch (Inst->attr[N_Mode - 1].UU.nv)
+      {
+        case 0:
           RTDVar->y0 = RTDVar->g0 * x0;
           break;
-        case 1: 
-          RTDVar->y0 = aOnsC * (SafeExp (x0 / aOnsV) - 1); 
-          break; 
+        case 1:
+          RTDVar->y0 = aOnsC * (SafeExp (x0 / aOnsV) - 1);
+          break;
       }
       RTDVar->g1 = (RTDVar->y0 - y1) / (x0 - x1);
       RTDVar->b = y1 - (RTDVar->g1 * x1);
@@ -704,7 +688,7 @@ long Attrnum;
   case N_aOnsC:
     if (Inst->attr[Attrnum - 1].UU.r < 0 ||
         Inst->attr[Attrnum - 1].blnk ||
-        Inst->attr[Attrnum - 1].UU.r > AnaITooBig) 
+        Inst->attr[Attrnum - 1].UU.r > AnaITooBig)
       Result = false;
     else {
       x0 = Inst->attr[N_NDRSV - 1].UU.r;
@@ -767,7 +751,7 @@ Analog_32_action *act;
   y1 = ICptr->ICVllyC;
   aOnsC = ICptr->ICaOnsC;
   aOnsV = ICptr->ICaOnsV;
- 
+
   RTDVar->g0 = 1 / ICptr->ICeOnsRes;
   switch (ICptr->ICMode)
   {
@@ -879,7 +863,7 @@ Analog_32_action *act;
   char Name1[256], Name2[256];
   log_grec *WITH;
   char STR1[22];
-  char STR2[256];
+  char STR2[259];
   char STR3[256];
 
   WITH = act->inst;