/[ascend]/trunk/base/generic/compiler/extinst.c
ViewVC logotype

Diff of /trunk/base/generic/compiler/extinst.c

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

revision 669 by johnpye, Wed Jun 21 07:00:45 2006 UTC revision 697 by johnpye, Mon Jun 26 07:55:45 2006 UTC
# Line 1  Line 1 
1  /*  /*  ASCEND modelling environment
2   *  Ascend Instance External Vars Functions      Copyright (C) 2006 Carnegie Mellon University
3   *  by Kirk Abbott      Copyright (C) 1995 Kirk Andre Abbott
4   *  1995  
5   *  Version: $Revision: 1.7 $      This program is free software; you can redistribute it and/or modify
6   *  Version control file: $RCSfile: extinst.c,v $      it under the terms of the GNU General Public License as published by
7   *  Date last modified: $Date: 1997/07/18 12:29:34 $      the Free Software Foundation; either version 2, or (at your option)
8   *  Last modified by: $Author: mthomas $      any later version.
9   *  
10   *  This file is part of the Ascend Language Interpreter.      This program is distributed in the hope that it will be useful,
11   *      but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *  Copyright (C) 1995 Kirk Andre' Abbott      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   *      GNU General Public License for more details.
14   *  The Ascend Language Interpreter is free software; you can redistribute  
15   *  it and/or modify it under the terms of the GNU General Public License as      You should have received a copy of the GNU General Public License
16   *  published by the Free Software Foundation; either version 2 of the      along with this program; if not, write to the Free Software
17   *  License, or (at your option) any later version.      Foundation, Inc., 59 Temple Place - Suite 330,
18   *      Boston, MA 02111-1307, USA.
19   *  The Ascend Language Interpreter is distributed in hope that it will be  *//*
20   *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of      Ascend Instance External Vars Functions
21   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      by Kirk Abbott
22   *  General Public License for more details.      Last in CVS $Revision: 1.7 $ $Date: 1997/07/18 12:29:34 $ $Author: mthomas $
23   *  */
24   *  You should have received a copy of the GNU General Public License  
  *  along with the program; if not, write to the Free Software Foundation,  
  *  Inc., 675 Mass Ave, Cambridge, MA 02139 USA.  Check the file named  
  *  COPYING.  
  *  
  */  
25  #include <stdarg.h>  #include <stdarg.h>
26  #include <utilities/ascConfig.h>  #include <utilities/ascConfig.h>
27  #include "compiler.h"  #include "compiler.h"
# Line 44  Line 39 
39  #include "cmpfunc.h"  #include "cmpfunc.h"
40  #include "extinst.h"  #include "extinst.h"
41    
 #ifndef lint  
 static CONST char ExtInstModuleID[] = "$Id: extinst.c,v 1.7 1997/07/18 12:29:34 mthomas Exp $";  
 #endif  
   
 /*********************************************************************\  
  External Relations Table  
 \*********************************************************************/  
   
42  struct Instance **g_ExtVariablesTable = NULL;  struct Instance **g_ExtVariablesTable = NULL;
43    
44  static  static
# Line 59  void InitExtVariablesTable(void) Line 46  void InitExtVariablesTable(void)
46  {  {
47    int c;    int c;
48    if (g_ExtVariablesTable==NULL) {    if (g_ExtVariablesTable==NULL) {
49      g_ExtVariablesTable = (struct Instance **)      g_ExtVariablesTable = ASC_NEW_ARRAY(struct Instance *,MAX_EXTRELATIONS);
       ascmalloc(MAX_EXTRELATIONS*sizeof(struct Instance *));  
50      for (c=0;c<MAX_EXTRELATIONS;c++) {      for (c=0;c<MAX_EXTRELATIONS;c++) {
51        g_ExtVariablesTable[c] = NULL;        g_ExtVariablesTable[c] = NULL;
52      }      }
# Line 122  struct Instance **AddVarToTable(struct I Line 108  struct Instance **AddVarToTable(struct I
108      }      }
109      c++;      c++;
110    }    }
111    Asc_Panic(2, NULL,    Asc_Panic(2, __FUNCTION__, "MAX_EXTRELATIONS limit exceeded.");
             "MAX_EXTRELATIONS internal limit has just been exceeded.\n"  
             "Please report failure in AddVarToTable to :\n"  
             "%s\n", ASC_BIG_BUGMAIL);  
112    exit(2);/* Needed to keep gcc from whining */    exit(2);/* Needed to keep gcc from whining */
113  }  }
114    
115  /*  
116   * This will be called only for models.  void FixExternalVars(struct Instance *old,struct Instance *new){
  */  
 void FixExternalVars(struct Instance *old,struct Instance *new)  
 {  
117    struct Instance **hndl;    struct Instance **hndl;
118    struct gl_list_t *exists;    struct gl_list_t *exists;
119    unsigned long len,c;    unsigned long len,c;
# Line 142  void FixExternalVars(struct Instance *ol Line 122  void FixExternalVars(struct Instance *ol
122    if (old==new)    if (old==new)
123      return;      return;
124    if ((old==NULL) || (new==NULL)) {    if ((old==NULL) || (new==NULL)) {
125      Asc_Panic(2, NULL,      Asc_Panic(2, __FUNCTION__,"Cannot handle NULL instances.");
               "Internal error in FixExternalVars\n"  
               "Cannot handle NULL instances... exiting.\n");  
126    }    }
127    exists = LookupVarInTable(old);    exists = LookupVarInTable(old);
128    if (exists) {    if (exists) {
# Line 165  void SetSimulationExtVars(struct Instanc Line 143  void SetSimulationExtVars(struct Instanc
143    SIM_INST(i)->extvars = extvars;    SIM_INST(i)->extvars = extvars;
144  }  }
145    
   

Legend:
Removed from v.669  
changed lines
  Added in v.697

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