/[ascend]/trunk/pygtk/type.cpp
ViewVC logotype

Diff of /trunk/pygtk/type.cpp

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

revision 899 by johnpye, Tue Oct 24 11:05:18 2006 UTC revision 900 by johnpye, Wed Oct 25 06:03:04 2006 UTC
# Line 1  Line 1 
1  #include <iostream>  #include <iostream>
2  #include <stdexcept>  #include <stdexcept>
3  #include <string>  #include <string>
4    #include <sstream>
5  using namespace std;  using namespace std;
6    
7  extern "C"{  extern "C"{
# Line 39  extern "C"{ Line 40  extern "C"{
40  #include "simulation.h"  #include "simulation.h"
41  #include "library.h"  #include "library.h"
42  #include "dimensions.h"  #include "dimensions.h"
43    #include "name.h"
44    
45  /**  /**
46      @TODO FIXME for some reason there are a lot of empty Type objects being created      @TODO FIXME for some reason there are a lot of empty Type objects being created
# Line 140  Type::getSimulation(SymChar sym){ Line 142  Type::getSimulation(SymChar sym){
142    
143      // Tell ASCEND file locations and compiler commands:      // Tell ASCEND file locations and compiler commands:
144      if(0 && !have_bintoken_setup){      if(0 && !have_bintoken_setup){
145          cerr << "SETUP BINTOKENS..." << endl;          CONSOLE_DEBUG("SETUP BINTOKENS...");
146    
147  /*  /*
148      THE FOLLOWING STUFF IS CURRENTLY BROKEN.      THE FOLLOWING STUFF IS CURRENTLY BROKEN.
# Line 173  Type::getSimulation(SymChar sym){ Line 175  Type::getSimulation(SymChar sym){
175          BinTokenSetOptions(bin_srcname.c_str(), bin_objname.c_str(), bin_libname.c_str()          BinTokenSetOptions(bin_srcname.c_str(), bin_objname.c_str(), bin_libname.c_str()
176                              , bin_cmd.c_str(), bin_rm.c_str(), 1000, 1, 0);                              , bin_cmd.c_str(), bin_rm.c_str(), 1000, 1, 0);
177    
178          cerr << "...SETUP BINTOKENS" << endl;          CONSOLE_DEBUG("...SETUP BINTOKENS");
179          have_bintoken_setup = true;          have_bintoken_setup = true;
180      }      }
181    
# Line 181  Type::getSimulation(SymChar sym){ Line 183  Type::getSimulation(SymChar sym){
183      // Perform the instantiation (C compile etc):      // Perform the instantiation (C compile etc):
184      /*Instance *i = Instantiate(getInternalType()->name, sym.getInternalType(),      /*Instance *i = Instantiate(getInternalType()->name, sym.getInternalType(),
185                                   0, SymChar("on_load").getInternalType()); */                                   0, SymChar("on_load").getInternalType()); */
186      Instance *i = SimsCreateInstance(getInternalType()->name, sym.getInternalType(), e_normal, SymChar("on_load").getInternalType());      Instance *i = SimsCreateInstance(getInternalType()->name, sym.getInternalType(), e_normal, NULL);
187        Simulation sim(i,sym);
188    
189      if(i==NULL){      if(i==NULL){
190          throw runtime_error("Failed to create instance");          throw runtime_error("Failed to create instance");
# Line 202  Type::getMethods() const{ Line 205  Type::getMethods() const{
205      return v;      return v;
206  }  }
207    
208    Method
209    Type::getMethod(const SymChar &name) const{
210        struct gl_list_t *l = GetInitializationList(getInternalType());
211        if(l==NULL){
212            stringstream ss;
213            ss << "No methods present in type '" << getName() << "'";
214            throw runtime_error(ss.str());
215        }
216        struct InitProcedure *m;
217        m = SearchProcList(l,name.getInternalType());
218        if(m==NULL){
219            stringstream ss;
220            ss << "No method named '" << name << "' in type '" << getName() << "'";
221            throw runtime_error(ss.str());
222            return NULL;
223        }
224        return Method(m);
225    }  
226    
227  const bool  const bool
228  Type::isRefinedSolverVar() const{  Type::isRefinedSolverVar() const{
229      static const TypeDescription *solver_var_type;      static const TypeDescription *solver_var_type;

Legend:
Removed from v.899  
changed lines
  Added in v.900

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