/***************
Copyright © 1996 Norlinvest Ltd. All rights reserved.
Visual Code Model Generator, EDSpice, EDWin, EE Designer, CompCAD,
CAD 1000, CAD ABC and Visionics are trade marks of Norlinvest Ltd.
Copyright © 1983 - 1996.
*
*
Copyright 1991
Georgia Tech Research Corporation
Atlanta, Georgia 30332
All Rights Reserved
****************/
#ifndef MIFCMDAT
#define MIFCMDAT

#include  "MIFtypes.h"

typedef struct Mif_E_Ptr_s {

    double      *branch_poscntl;   
    double      *branch_negcntl;

} Mif_E_Ptr_t;


typedef struct Mif_F_Ptr_s {

    double      *pos_ibranchcntl; 
    double      *neg_ibranchcntl;

} Mif_F_Ptr_t;


typedef struct Mif_G_Ptr_s {

    double      *pos_poscntl;   
    double      *pos_negcntl;  
    double      *neg_poscntl;  
    double      *neg_negcntl;  

} Mif_G_Ptr_t;


typedef struct Mif_H_Ptr_s {

    double      *branch_ibranchcntl; 

} Mif_H_Ptr_t;


typedef union Mif_Port_Ptr_u {

    Mif_E_Ptr_t    e;        
    Mif_F_Ptr_t    f;    
    Mif_G_Ptr_t    g;   
    Mif_H_Ptr_t    h;   

} Mif_Port_Ptr_t;


typedef struct Mif_Conn_Ptr_s {

    Mif_Port_Ptr_t      *port;   

} Mif_Conn_Ptr_t;

typedef struct Mif_Smp_Ptr_s {
    int             pos_node; 
    int             neg_node;
    int             branch;   
    int             ibranch; 

    double          *pos_branch;      
    double          *neg_branch;     
    double          *branch_pos;     
    double          *branch_neg;     

    double          *pos_ibranch;      
    double          *neg_ibranch;      
    double          *ibranch_pos;    
    double          *ibranch_neg;   

    Mif_Conn_Ptr_t  *input;  

} Mif_Smp_Ptr_t;


typedef struct Mif_Partial_s {

    double      *port;          

} Mif_Partial_t;

typedef struct Mif_AC_Gain_s {

    Mif_Complex_t      *port;  

} Mif_AC_Gain_t;

typedef struct {
    int         node_index;      
    int         output_subindex; 
    int         port_index;     
    int         output_index;   
} Mif_Evt_Data_t;

typedef struct Mif_Port_Data_s {

    Mif_Port_Type_t type;           
    char            *type_str;     
    char            *pos_node_str;  
    char            *neg_node_str;  
    char            *vsource_str;   

    Mif_Boolean_t   is_null;       
    Mif_Value_t     input;         
    Mif_Value_t     output;         
    Mif_Partial_t   *partial;       
    Mif_AC_Gain_t   *ac_gain;      
    int             old_input;      

    Mif_Boolean_t   invert;         
    Mif_Boolean_t   changed;   
    double          load;       
    double          total_load;  
    double          delay;  
    char            *msg;   

    Mif_Smp_Ptr_t   smp_data; 
    Mif_Evt_Data_t  evt_data;  

    double          nominal_output; 

} Mif_Port_Data_t;

typedef struct Mif_State_s {   

    int         tag;          
    int         index;  
    int         doubles;  
    int         bytes;         

} Mif_State_t;


typedef struct Mif_Intgr_s {  

    int         byte_index;  

} Mif_Intgr_t;


typedef struct Mif_Conv_s {  

    int         byte_index;  
    double      last_value; 

} Mif_Conv_t;


typedef struct Mif_Circ_Data_s {

    Mif_Boolean_t         init;     
    Mif_Analysis_t        anal_type;  
    Mif_Boolean_t         anal_init; 
    Mif_Call_Type_t       call_type; 
    double                time;      
    double                frequency;  
    double                temperature;
    double                t[8];  

} Mif_Circ_Data_t;


typedef struct Mif_Conn_Data_s {

    char             *name;   
    char             *description; 
    Mif_Boolean_t    is_null; 
    Mif_Boolean_t    is_input; 
    Mif_Boolean_t    is_output;  
    int              size;     
    Mif_Port_Data_t  **port;   

} Mif_Conn_Data_t;


typedef struct Mif_Param_Data_s {

    Mif_Boolean_t   is_null;   
    int             size;    
    Mif_Value_t     *element; 

} Mif_Param_Data_t;


typedef struct Mif_Inst_Var_Data_s {

    int         size;      
    Mif_Value_t *element;

} Mif_Inst_Var_Data_t;


typedef struct StateData_s {
	int			StateTag;
	int			StateBytes;
	struct StateData_s	*Next;
} StateData;


typedef struct Mif_Private_s {

    Mif_Circ_Data_t        circuit; 
    int                    num_conn; 
    Mif_Conn_Data_t        **conn;     
    int                    num_param;  
    Mif_Param_Data_t       **param; 
    int                    num_inst_var; 
    Mif_Inst_Var_Data_t    **inst_var;  

} Mif_Private_t;


#endif /* MIFCMDAT */
