From a7a48ac8d39455e24b7711222fc1d23f9b52590c Mon Sep 17 00:00:00 2001 From: rlar Date: Mon, 30 Dec 2013 17:19:14 +0100 Subject: [PATCH] analog/{square,triangle}, store boolean tran_init in STATIC_VAR itself --- src/xspice/icm/analog/square/cfunc.mod | 15 +++------------ src/xspice/icm/analog/square/ifspec.ifs | 6 +++--- src/xspice/icm/analog/triangle/cfunc.mod | 19 +++---------------- src/xspice/icm/analog/triangle/ifspec.ifs | 6 +++--- 4 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/xspice/icm/analog/square/cfunc.mod b/src/xspice/icm/analog/square/cfunc.mod index 6920cd6f8..cb85d1796 100644 --- a/src/xspice/icm/analog/square/cfunc.mod +++ b/src/xspice/icm/analog/square/cfunc.mod @@ -181,9 +181,6 @@ cm_square(ARGS) Mif_Complex_t ac_gain; - Local_Data_t *loc; /* Pointer to local static data, not to be included - in the state vector */ - /**** Retrieve frequently used parameters... ****/ cntl_size = PARAM_SIZE(cntl_array); @@ -210,11 +207,7 @@ cm_square(ARGS) cm_analog_alloc(T3, sizeof(double)); cm_analog_alloc(T4, sizeof(double)); - /*** allocate static storage for *loc ***/ - STATIC_VAR(locdata) = calloc(1, sizeof(Local_Data_t)); - loc = STATIC_VAR(locdata); - - loc->tran_init = FALSE; + STATIC_VAR(tran_init) = MIF_FALSE; } x = (Mif_Value_t*) &PARAM(cntl_array[0]); @@ -253,11 +246,9 @@ cm_square(ARGS) time3 = *t3; time4 = *t4; - loc = STATIC_VAR(locdata); - - if (!loc->tran_init) { + if (STATIC_VAR(tran_init) == MIF_FALSE) { *phase1 = 0.0; - loc->tran_init = TRUE; + STATIC_VAR(tran_init) = MIF_TRUE; } /* Retrieve cntl_input value. */ diff --git a/src/xspice/icm/analog/square/ifspec.ifs b/src/xspice/icm/analog/square/ifspec.ifs index 27559c116..cee774dcb 100644 --- a/src/xspice/icm/analog/square/ifspec.ifs +++ b/src/xspice/icm/analog/square/ifspec.ifs @@ -83,6 +83,6 @@ Null_Allowed: yes STATIC_VAR_TABLE: -Static_Var_Name: locdata -Description: "local static data" -Data_Type: pointer +Static_Var_Name: tran_init +Description: "tran initialisation" +Data_Type: boolean diff --git a/src/xspice/icm/analog/triangle/cfunc.mod b/src/xspice/icm/analog/triangle/cfunc.mod index 69521c8c7..3443a5445 100644 --- a/src/xspice/icm/analog/triangle/cfunc.mod +++ b/src/xspice/icm/analog/triangle/cfunc.mod @@ -72,10 +72,6 @@ char *triangle_array_error = "\n**** Error ****\nTRIANGLE: Size of control array /*=== LOCAL VARIABLES & TYPEDEFS =======*/ -typedef struct { - int tran_init; /* for initialization of phase1) */ -} Local_Data_t; - /*=== FUNCTION PROTOTYPE DEFINITIONS ===*/ @@ -176,9 +172,6 @@ cm_triangle(ARGS) Mif_Complex_t ac_gain; - Local_Data_t *loc; /* Pointer to local static data, not to be included - in the state vector */ - /**** Retrieve frequently used parameters... ****/ @@ -201,11 +194,7 @@ cm_triangle(ARGS) cm_analog_alloc(T2, sizeof(double)); cm_analog_alloc(T3, sizeof(double)); - /*** allocate static storage for *loc ***/ - STATIC_VAR(locdata) = calloc(1, sizeof(Local_Data_t)); - loc = STATIC_VAR(locdata); - - loc->tran_init = FALSE; + STATIC_VAR(tran_init) = MIF_FALSE; } x = (Mif_Value_t*) &PARAM(cntl_array[0]); @@ -241,11 +230,9 @@ cm_triangle(ARGS) time2 = *t2; t_start = *t_end; - loc = STATIC_VAR(locdata); - - if (! loc->tran_init) { + if (STATIC_VAR(tran_init) == MIF_FALSE) { *phase1 = 0.0; - loc->tran_init = TRUE; + STATIC_VAR(tran_init) = MIF_TRUE; } /* Retrieve cntl_input value. */ diff --git a/src/xspice/icm/analog/triangle/ifspec.ifs b/src/xspice/icm/analog/triangle/ifspec.ifs index 780b5a0b4..4f5da74e1 100644 --- a/src/xspice/icm/analog/triangle/ifspec.ifs +++ b/src/xspice/icm/analog/triangle/ifspec.ifs @@ -72,6 +72,6 @@ Null_Allowed: yes STATIC_VAR_TABLE: -Static_Var_Name: locdata -Description: "local static data" -Data_Type: pointer +Static_Var_Name: tran_init +Description: "tran initialisation" +Data_Type: boolean