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

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

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

revision 222 by johnpye, Fri Jan 27 04:23:20 2006 UTC revision 371 by johnpye, Tue Mar 14 05:04:06 2006 UTC
# Line 3866  void MakeInstance(CONST struct Name *nam Line 3866  void MakeInstance(CONST struct Name *nam
3866    struct TypeDescription *arydef;    struct TypeDescription *arydef;
3867    struct gl_list_t *indices;    struct gl_list_t *indices;
3868    int tce;    int tce;
3869      char *nstr;
3870      nstr = WriteNameString(name);
3871      CONSOLE_DEBUG(nstr);
3872      ascfree(nstr);
3873    if ((childname = SimpleNameIdPtr(name))!=NULL){ /* simple 1 element name */    if ((childname = SimpleNameIdPtr(name))!=NULL){ /* simple 1 element name */
3874      if (StatInFOR(statement) && StatWrong(statement)==0) {      if (StatInFOR(statement) && StatWrong(statement)==0) {
3875        MarkStatContext(statement,context_WRONG);        MarkStatContext(statement,context_WRONG);
# Line 4648  struct Instance *MakeRelationInstance(st Line 4652  struct Instance *MakeRelationInstance(st
4652                                        struct Statement *stat,                                        struct Statement *stat,
4653                                        enum Expr_enum type)                                        enum Expr_enum type)
4654  {  {
4655      CONSOLE_DEBUG("...");
4656    symchar *childname;    symchar *childname;
4657    struct Instance *child;    struct Instance *child;
4658    struct InstanceName rec;    struct InstanceName rec;
# Line 5530  int CheckGlassBoxIndex(struct Instance * Line 5535  int CheckGlassBoxIndex(struct Instance *
5535    
5536    str = SimpleNameIdPtr(n);    str = SimpleNameIdPtr(n);
5537    if (str) {    if (str) {
5538      result = atoi(SCP(str));    /* convert to integer. fixme strtod */      result = atoi(SCP(str));    /* convert to integer. FIXME strtod */
5539      *err = okay;      *err = okay;
5540      return result;      return result;
5541    }    }
# Line 5657  int ExecuteEXT(struct Instance *inst, st Line 5662  int ExecuteEXT(struct Instance *inst, st
5662  {  {
5663    int mode;    int mode;
5664    
5665      CONSOLE_DEBUG("...");
5666    
5667    mode = ExternalStatMode(statement);    mode = ExternalStatMode(statement);
5668    switch(mode) {    switch(mode) {
5669    default:    default:
# Line 7747  int Pass2CheckStatement(struct Instance Line 7754  int Pass2CheckStatement(struct Instance
7754    }    }
7755  }  }
7756    
7757  /*  /**
7758   * checking statementlist, as in a FOR loop check.   * checking statementlist, as in a FOR loop check.
7759   * BUG!: CheckStatement and New flavors of same ignore the   * @TODO FIXME BUG!: CheckStatement and New flavors of same ignore the
7760   * type EXT. We never use external relations inside a loop?!   * type EXT. We never use external relations inside a loop?!
7761   */   */
7762  static  static
# Line 10976  int Pass2ExecuteStatement(struct Instanc Line 10983  int Pass2ExecuteStatement(struct Instanc
10983      /* ER expected to succeed or fail permanently. this may change. */      /* ER expected to succeed or fail permanently. this may change. */
10984      return ExecuteREL(inst,statement);      return ExecuteREL(inst,statement);
10985    case EXT:    case EXT:
10986        CONSOLE_DEBUG("ABOUT TO EXECUTEEXT");
10987      return ExecuteEXT(inst,statement);      return ExecuteEXT(inst,statement);
10988    case COND:    case COND:
10989      return Pass2ExecuteCOND(inst,statement);      return Pass2ExecuteCOND(inst,statement);
# Line 11314  void Pass3ProcessPendingInstances(void) Line 11322  void Pass3ProcessPendingInstances(void)
11322   * This is the singlepass phase2 with anontype sharing of   * This is the singlepass phase2 with anontype sharing of
11323   * relations implemented. If relations can depend on other   * relations implemented. If relations can depend on other
11324   * relations (as in future differential work) then this function   * relations (as in future differential work) then this function
11325   * Needs to be slightly more sophisticated.   * needs to be slightly more sophisticated.
11326   */   */
11327  static  static
11328  void Pass2ProcessPendingInstancesAnon(struct Instance *result)  void Pass2ProcessPendingInstancesAnon(struct Instance *result)
# Line 11330  void Pass2ProcessPendingInstancesAnon(st Line 11338  void Pass2ProcessPendingInstancesAnon(st
11338  #if TIMECOMPILER  #if TIMECOMPILER
11339    clock_t start,classt;    clock_t start,classt;
11340  #endif  #endif
11341      CONSOLE_DEBUG("...");
11342    
11343    /* pending will have at least one instance, or quick return. */    /* pending will have at least one instance, or quick return. */
11344    assert(PASS2MAXNUMBER==1);    assert(PASS2MAXNUMBER==1);
# Line 11986  static Line 11995  static
11995  struct Instance *Pass2InstantiateModel(struct Instance *result,  struct Instance *Pass2InstantiateModel(struct Instance *result,
11996                                         unsigned long *pcount)                                         unsigned long *pcount)
11997  {  {
11998      CONSOLE_DEBUG("starting...");
11999    /* do we need a ForTable on the stack here? don't think so. np2ppi does it */    /* do we need a ForTable on the stack here? don't think so. np2ppi does it */
12000    if (result!=NULL) {    if (result!=NULL) {
12001        CONSOLE_DEBUG("result!=NULL...");
12002      /* pass2 pendings already set by visit */      /* pass2 pendings already set by visit */
12003      if (ANONFORCE || g_use_copyanon != 0) {      if (ANONFORCE || g_use_copyanon != 0) {
12004  #if TIMECOMPILER  #if TIMECOMPILER
# Line 12011  struct Instance *Pass2InstantiateModel(s Line 12022  struct Instance *Pass2InstantiateModel(s
12022      }      }
12023      ClearList();      ClearList();
12024    }    }
12025      CONSOLE_DEBUG("...done");
12026    return result;    return result;
12027  }  }
12028    
# Line 12022  void Pass2SetRelationBits(struct Instanc Line 12034  void Pass2SetRelationBits(struct Instanc
12034      struct BitList *blist;      struct BitList *blist;
12035  #ifdef DEBUG_RELS  #ifdef DEBUG_RELS
12036      ERROR_REPORTER_START_NOLINE(ASC_PROG_NOTE);      ERROR_REPORTER_START_NOLINE(ASC_PROG_NOTE);
12037      FPRINTF(stderr,"P2SRB: ");      FPRINTF(ASCERR,"P2SRB: ");
12038      WriteInstanceName(ASCERR,inst,debug_rels_work);      WriteInstanceName(ASCERR,inst,debug_rels_work);
12039        FPRINTF(ASCERR,"\n");
12040      error_reporter_end_flush();      error_reporter_end_flush();
12041  #endif  #endif
12042    
# Line 12201  struct Instance *NewInstantiateModel(str Line 12214  struct Instance *NewInstantiateModel(str
12214    FPRINTF(ASCERR,"Phase 2 relations \t\t%lu\n",    FPRINTF(ASCERR,"Phase 2 relations \t\t%lu\n",
12215      (unsigned long)(phase2t-phase1t));      (unsigned long)(phase2t-phase1t));
12216  #endif  #endif
12217      CONSOLE_DEBUG("Starting phase 3...");
12218    /* at this point, there may be unexecuted non-logical relation    /* at this point, there may be unexecuted non-logical relation
12219     * statements, but they can never be executed. The     * statements, but they can never be executed. The
12220     * pending list is therefore empty. We know how many.     * pending list is therefore empty. We know how many.
# Line 12323  struct Instance *NewRealInstantiate(stru Line 12337  struct Instance *NewRealInstantiate(stru
12337                                   int intset)                                   int intset)
12338  {  {
12339    struct Instance *result;    struct Instance *result;
12340      CONSOLE_DEBUG("...");
12341    
12342    result = ShortCutMakeUniversalInstance(def); /*does quick Universal check */    result = ShortCutMakeUniversalInstance(def); /*does quick Universal check */
12343    if (result) return result;    if (result) return result;

Legend:
Removed from v.222  
changed lines
  Added in v.371

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