/[ascend]/trunk/ascend/compiler/destroyinst.c
ViewVC logotype

Diff of /trunk/ascend/compiler/destroyinst.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2686 by jpye, Wed Dec 12 12:39:25 2012 UTC revision 2687 by jpye, Fri Mar 1 02:15:09 2013 UTC
# Line 612  static void DestroyInstanceParts(struct Line 612  static void DestroyInstanceParts(struct
612    }    }
613  }  }
614    
615  void DestroyInstance(struct Instance *inst, struct Instance *parent)  void DestroyInstance(struct Instance *inst, struct Instance *parent){
 {  
616    struct TypeDescription *desc;    struct TypeDescription *desc;
617    int delete;    int delete;
618    if (inst==NULL) return;    if(inst==NULL) return;
619    
620    /*char *temp = WriteInstanceNameString(parent,NULL);    if(InterfacePtrDelete!=NULL){
   CONSOLE_DEBUG("parent name = %s",temp);  
   ASC_FREE(temp);*/  
   
   if (InterfacePtrDelete!=NULL) {  
621      DeleteIPtr(inst);      DeleteIPtr(inst);
622    }    }
623    delete = RemoveParentReferences(inst,parent);    delete = RemoveParentReferences(inst,parent);
624    if (delete) {    if(delete){
625      if (inst->t != DUMMY_INST) {      if (inst->t != DUMMY_INST){
626        desc = InstanceTypeDesc(inst);        desc = InstanceTypeDesc(inst);
627        if (GetUniversalFlag(desc)){ /* universal is being deleted */        if(GetUniversalFlag(desc)){ /* universal is being deleted */
628          RemoveUniversalInstance(GetUniversalTable(),inst);          RemoveUniversalInstance(GetUniversalTable(),inst);
629        }        }
630        if (IsCompoundInstance(inst) &&        if(IsCompoundInstance(inst) &&
631            InstanceKind(inst) != SIM_INST &&            InstanceKind(inst) != SIM_INST &&
632            ((struct PendInstance *)(inst))->p != NULL            ((struct PendInstance *)(inst))->p != NULL
633           ) {        ){
634          RemoveInstance(inst);          RemoveInstance(inst);
635        }        }
636        /* remove PENDING or maybe not pending instance in destroy process. */        /* remove PENDING or maybe not pending instance in destroy process. */
637        RemoveFromClique(inst);        RemoveFromClique(inst);
638        DestroyInstanceParts(inst);        DestroyInstanceParts(inst);
639      } else {      }else{
640        if (D_INST(inst)->ref_count<2) {        if(D_INST(inst)->ref_count<2){
641          desc = InstanceTypeDesc(inst);          desc = InstanceTypeDesc(inst);
642          if (GetUniversalFlag(desc)){ /* universal is being deleted */          if(GetUniversalFlag(desc)){ /* universal is being deleted */
643            RemoveUniversalInstance(GetUniversalTable(),inst);            RemoveUniversalInstance(GetUniversalTable(),inst);
644          }          }
645          /* dummy is never in cliques or pending */          /* dummy is never in cliques or pending */

Legend:
Removed from v.2686  
changed lines
  Added in v.2687

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22