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

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

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

revision 612 by ben.allan, Mon Apr 17 03:18:06 2006 UTC revision 613 by johnpye, Wed May 17 05:09:17 2006 UTC
# Line 1  Line 1 
1    /*  ASCEND modelling environment
2  /*      Copyright 1997, Carnegie Mellon University
3   *  anontypes      Copyright (C) 2006 Carnegie Mellon University
4   *  Anonymous ASCEND IV type classification functions.  
5   *  By Benjamin Andrew Allan      This program is free software; you can redistribute it and/or modify
6   *  Created August 30, 1997.      it under the terms of the GNU General Public License as published by
7   *  Copyright 1997, Carnegie Mellon University.      the Free Software Foundation; either version 2, or (at your option)
8   *  Version: $Revision: 1.9 $      any later version.
9   *  Version control file: $RCSfile: anontype.c,v $  
10   *  Date last modified: $Date: 2000/01/25 02:25:55 $      This program is distributed in the hope that it will be useful,
11   *  Last modified by: $Author: ballan $      but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   *  This file is part of the Ascend Language Interpreter.      GNU General Public License for more details.
14   *  
15   *  The Ascend Language Interpreter is free software; you can redistribute      You should have received a copy of the GNU General Public License
16   *  it and/or modify it under the terms of the GNU General Public License as      along with this program; if not, write to the Free Software
17   *  published by the Free Software Foundation; either version 2 of the      Foundation, Inc., 59 Temple Place - Suite 330,
18   *  License, or (at your option) any later version.      Boston, MA 02111-1307, USA.
19   *  *//**
20   *  The Ascend Language Interpreter is distributed in hope that it will be      @file
21   *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of      Anonymous ASCEND IV type classification functions.
22   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  *//*
23   *  General Public License for more details.      By Benjamin Andrew Allan
24   *      Created August 30, 1997.
25   *  You should have received a copy of the GNU General Public License      Copyright 1997, Carnegie Mellon University.
26   *  along with the program; if not, write to the Free Software Foundation,      Version: $Revision: 1.9 $
27   *  Inc., 675 Mass Ave, Cambridge, MA 02139 USA.  Check the file named      Version control file: $RCSfile: anontype.c,v $
28   *  COPYING.      Date last modified: $Date: 2000/01/25 02:25:55 $
29   */      Last modified by: $Author: ballan $
30    */
31    
32  #include <limits.h> /* for LONG_MAX */  #include <limits.h> /* for LONG_MAX */
33  #include <utilities/ascConfig.h>  #include <utilities/ascConfig.h>
# Line 82  static CONST char AnonTypeModuleID[] = " Line 83  static CONST char AnonTypeModuleID[] = "
83   * write merge list before returning.   * write merge list before returning.
84   */   */
85  #define AWAL 1  #define AWAL 1
86    #if AWAL
87    # include <stdio.h>
88    #endif
89    
90    
91  /*  /*
92   * enum for use in sorting compound types   * enum for use in sorting compound types
# Line 208  struct AnonBucket *FindAnonBucket(struct Line 213  struct AnonBucket *FindAnonBucket(struct
213    }    }
214    index = TYPEHASHINDEX(SCP(GetName(d)));    index = TYPEHASHINDEX(SCP(GetName(d)));
215    result = t[index];    result = t[index];
216    while (result != NULL &&    while (result != NULL &&
217            (d != result->d ||  /* not type wanted */            (d != result->d ||  /* not type wanted */
218              (indirected != LONG_MAX  && /* is array */              (indirected != LONG_MAX  && /* is array */
219               indirected != result->indirected /*wrong level*/               indirected != result->indirected /*wrong level*/
220              )              )
221            )            )
222          ) {          ) {
223      result = result->next;      result = result->next;
224    }    }
# Line 250  struct AnonBucket *AddAnonBucket(struct Line 255  struct AnonBucket *AddAnonBucket(struct
255    return b;    return b;
256  }  }
257    
258  /*  /*
259   * Insert 'at' in anonlist of b after the AT 'after'.   * Insert 'at' in anonlist of b after the AT 'after'.
260   * after == NULL --> insert at head of anonlist of b.   * after == NULL --> insert at head of anonlist of b.
261   */   */
# Line 335  double AnonRealAtomValue(struct Instance Line 340  double AnonRealAtomValue(struct Instance
340    }    }
341  }  }
342    
343  /* In the following atom/constant cases it is simply cheaper to  /* In the following atom/constant cases it is simply cheaper to
344   * check the value directly instead of checking first to see that   * check the value directly instead of checking first to see that
345   * the FT defines value or dimensionality.   * the FT defines value or dimensionality.
346   * In all atom-like cases, we are ignoring subatomic structure,   * In all atom-like cases, we are ignoring subatomic structure,
# Line 382  struct AnonType *NearestAnonTypeRC(struc Line 387  struct AnonType *NearestAnonTypeRC(struc
387     * We get rid of the NULL case so we can cope more easily with     * We get rid of the NULL case so we can cope more easily with
388     * unassigned.     * unassigned.
389     */     */
390    if (testat == NULL) {    if (testat == NULL) {
391      /* off end */      /* off end */
392      *exact = 0;      *exact = 0;
393      return after;      return after;
394    }    }
395        
396    val = AnonRealAtomValue(i);    val = AnonRealAtomValue(i);
397    /* Find same value. Sorted by decreasing value. */    /* Find same value. Sorted by decreasing value. */
398    while (testat != NULL &&    while (testat != NULL &&
399           ((testi = GAP(testat)), dim == RealAtomDims(testi)) &&           ((testi = GAP(testat)), dim == RealAtomDims(testi)) &&
400           val < AnonRealAtomValue(testi)) {           val < AnonRealAtomValue(testi)) {
401      /* C comma syntax: testi = in the logic above does nothing to      /* C comma syntax: testi = in the logic above does nothing to
# Line 399  struct AnonType *NearestAnonTypeRC(struc Line 404  struct AnonType *NearestAnonTypeRC(struc
404      after = testat;      after = testat;
405      testat = testat->next;      testat = testat->next;
406    }    }
407    if (testat == NULL) {    if (testat == NULL) {
408      /* off end */      /* off end */
409      *exact = 0;      *exact = 0;
410      return after;      return after;
411    }    }
412    if (val > AnonRealAtomValue(testi) ||    if (val > AnonRealAtomValue(testi) ||
413        dim != RealAtomDims(testi)) {        dim != RealAtomDims(testi)) {
414      /* insert at head or after */      /* insert at head or after */
# Line 457  struct AnonType *NearestAnonTypeRA(struc Line 462  struct AnonType *NearestAnonTypeRA(struc
462    if (testat == NULL) {    if (testat == NULL) {
463      *exact = 0;      *exact = 0;
464      return after; /* Works if after NULL or not. */      return after; /* Works if after NULL or not. */
465    }    }
466    if (dim == RealAtomDims(testi)) {    if (dim == RealAtomDims(testi)) {
467      *exact = 1;      *exact = 1;
468      return testat;      return testat;
# Line 523  struct AnonType *NearestAnonTypeIC(struc Line 528  struct AnonType *NearestAnonTypeIC(struc
528    if (testat == NULL) {    if (testat == NULL) {
529      *exact = 0;      *exact = 0;
530      return after; /* Works if after NULL or not. */      return after; /* Works if after NULL or not. */
531    }    }
532    if ( val == AnonIntegerAtomValue(testi) ) {    if ( val == AnonIntegerAtomValue(testi) ) {
533      /* stopped within list on a match */      /* stopped within list on a match */
534      *exact = 1;      *exact = 1;
# Line 589  struct AnonType *NearestAnonTypeSC(struc Line 594  struct AnonType *NearestAnonTypeSC(struc
594    if (testat == NULL) {    if (testat == NULL) {
595      *exact = 0;      *exact = 0;
596      return after; /* Works if after NULL or not. */      return after; /* Works if after NULL or not. */
597    }    }
598    if ( val == GetAnonInstSymbol(testi) ) {    if ( val == GetAnonInstSymbol(testi) ) {
599      /* stopped within list on a match */      /* stopped within list on a match */
600      *exact = 1;      *exact = 1;
# Line 627  struct AnonType *NearestAnonTypeBC(struc Line 632  struct AnonType *NearestAnonTypeBC(struc
632        *exact = 0; /* add undefined at head */        *exact = 0; /* add undefined at head */
633        return NULL;        return NULL;
634      }      }
635    } else {    } else {
636      /* i is not unassigned */      /* i is not unassigned */
637      val = GetBooleanAtomValue(i);      val = GetBooleanAtomValue(i);
638      if (!AtomAssigned(testi)) {      if (!AtomAssigned(testi)) {
# Line 676  struct AnonType *NearestAnonTypeSA(struc Line 681  struct AnonType *NearestAnonTypeSA(struc
681      *exact = 0;      *exact = 0;
682      return after;      return after;
683    }    }
684      
685    /* check for add at front */    /* check for add at front */
686    cmp = CmpAtomValues(i,GAP(after));    cmp = CmpAtomValues(i,GAP(after));
687    if (cmp < 0) {    if (cmp < 0) {
# Line 697  struct AnonType *NearestAnonTypeSA(struc Line 702  struct AnonType *NearestAnonTypeSA(struc
702    if (testat == NULL) {    if (testat == NULL) {
703      *exact = 0;      *exact = 0;
704      return after; /* Works if after NULL or not. */      return after; /* Works if after NULL or not. */
705    }    }
706    if ( CmpAtomValues(i,testi)==0 ) {    if ( CmpAtomValues(i,testi)==0 ) {
707      /* stopped within list on a match */      /* stopped within list on a match */
708      *exact = 1;      *exact = 1;
# Line 714  struct AnonType *NearestAnonTypeSA(struc Line 719  struct AnonType *NearestAnonTypeSA(struc
719   * We aren't doing a full treatment because parent ft is   * We aren't doing a full treatment because parent ft is
720   * available only after a full pass with this partial treatment.   * available only after a full pass with this partial treatment.
721   * Finished comes first, then hollow, in the very limited   * Finished comes first, then hollow, in the very limited
722   * sort order. NULL is not to be here.   * sort order. NULL is not to be here.
723   */   */
724  static  static
725  struct AnonType *NearestAnonTypeRelation(struct Instance *i,  struct AnonType *NearestAnonTypeRelation(struct Instance *i,
# Line 765  struct AnonType *NearestAnonTypeRelation Line 770  struct AnonType *NearestAnonTypeRelation
770   * We aren't doing a full treatment because parent ft is   * We aren't doing a full treatment because parent ft is
771   * available only after a full pass with this partial treatment.   * available only after a full pass with this partial treatment.
772   * Finished comes first, then hollow, in the very limited   * Finished comes first, then hollow, in the very limited
773   * sort order. NULL is not to be here.   * sort order. NULL is not to be here.
774   */   */
775  static  static
776  struct AnonType *NearestAnonTypeLogRel(struct Instance *i,  struct AnonType *NearestAnonTypeLogRel(struct Instance *i,
# Line 873  enum search_status MatchATMerges(struct Line 878  enum search_status MatchATMerges(struct
878          if (testat->next == NULL) {          if (testat->next == NULL) {
879            s = at_append;  /* testat is end of at list, exact is 0 */            s = at_append;  /* testat is end of at list, exact is 0 */
880            break;          /* exit while early */            break;          /* exit while early */
881          }          }
882          if (testat->next->exactfamily != *exactfamily) {          if (testat->next->exactfamily != *exactfamily) {
883            /* ok, so testat is the right edge of our exactfamily            /* ok, so testat is the right edge of our exactfamily
884             * and we want to append the family.             * and we want to append the family.
885             */             */
886            s = at_append;            s = at_append;
# Line 904  enum search_status MatchATMerges(struct Line 909  enum search_status MatchATMerges(struct
909    return s;    return s;
910  }  }
911    
912  /* i1, i2 assumed != and not NULL.  /* i1, i2 assumed != and not NULL.
913   * The ArrayAnonCmp function assume that the arrays to be compared have the   * The ArrayAnonCmp function assume that the arrays to be compared have the
914   * same array type description and level of indirection so that   * same array type description and level of indirection so that
915   * the basetype and set description   * the basetype and set description
916   * of the subscripts are identical -- eliminates int vs enum problems.   * of the subscripts are identical -- eliminates int vs enum problems.
917   */   */
# Line 1026  struct AnonType *NearestAnonTypeArrayEnu Line 1031  struct AnonType *NearestAnonTypeArrayEnu
1031        Asc_Panic(2,"NearestAnonTypeArrayInt","Returning while not (1) done");        Asc_Panic(2,"NearestAnonTypeArrayInt","Returning while not (1) done");
1032        exit(2); /* NOTREACHED, but quiets gcc */        exit(2); /* NOTREACHED, but quiets gcc */
1033      }      }
1034    }    }
1035    if (ArrayAnonCmpEnum(i,GAP(after)) < 0) {    if (ArrayAnonCmpEnum(i,GAP(after)) < 0) {
1036      *exact = 0;      *exact = 0;
1037      return after;      return after;
# Line 1059  struct AnonType *NearestAnonTypeArrayEnu Line 1064  struct AnonType *NearestAnonTypeArrayEnu
1064   * and the subscript name/AT of each child.   * and the subscript name/AT of each child.
1065   * This classification function looks rather simple, mainly   * This classification function looks rather simple, mainly
1066   * because the real dirt goes on in the ArrayAnonCmpInt call.   * because the real dirt goes on in the ArrayAnonCmpInt call.
1067   *   *
1068   * We also have to compare mergedness of arrays of models/vars.   * We also have to compare mergedness of arrays of models/vars.
1069   */   */
1070  static  static
# Line 1116  struct AnonType *NearestAnonTypeArrayInt Line 1121  struct AnonType *NearestAnonTypeArrayInt
1121        Asc_Panic(2,"NearestAnonTypeArrayInt","Returning while not (1) done");        Asc_Panic(2,"NearestAnonTypeArrayInt","Returning while not (1) done");
1122        exit(2); /* NOTREACHED, but quiets gcc */        exit(2); /* NOTREACHED, but quiets gcc */
1123      }      }
1124    }    }
1125    if (ArrayAnonCmpInt(i,GAP(after)) < 0) {    if (ArrayAnonCmpInt(i,GAP(after)) < 0) {
1126      *exact = 0;      *exact = 0;
1127      return after;      return after;
# Line 1148  struct AnonType *NearestAnonTypeArrayInt Line 1153  struct AnonType *NearestAnonTypeArrayInt
1153   * find exact matches (or the need for a new AT) in linear time.   * find exact matches (or the need for a new AT) in linear time.
1154   * Presumably a sorted strucure is faster as it permits us to do   * Presumably a sorted strucure is faster as it permits us to do
1155   * fewer than nAT comparisons of the instance being classified   * fewer than nAT comparisons of the instance being classified
1156   * against the anonlist.   * against the anonlist.
1157   * The minimum time to diagnose an exact match of two instances,   * The minimum time to diagnose an exact match of two instances,
1158   * assuming all children already classified or NULL, is linear   * assuming all children already classified or NULL, is linear
1159   * in the number of children.   * in the number of children.
# Line 1173  struct AnonType *NearestAnonTypeArrayInt Line 1178  struct AnonType *NearestAnonTypeArrayInt
1178   * So, the logic required for this picture is given in the function body.   * So, the logic required for this picture is given in the function body.
1179   * The obscuring boundary case (there's always one of those :-() is   * The obscuring boundary case (there's always one of those :-() is
1180   * what to do with NULL instances. They can be most conveniently dealt   * what to do with NULL instances. They can be most conveniently dealt
1181   * with by assigning them all (regardless of eventual kind) the   * with by assigning them all (regardless of eventual kind) the
1182   * AT index of 0 (convenient since real indices start at 1, as they   * AT index of 0 (convenient since real indices start at 1, as they
1183   * are stored in a gl_list). Unfortunately, this makes a special case   * are stored in a gl_list). Unfortunately, this makes a special case
1184   * out of them for TmpNum purposes because GetTmpNum returns   * out of them for TmpNum purposes because GetTmpNum returns
# Line 1234  struct AnonType *NearestAnonTypeModel(st Line 1239  struct AnonType *NearestAnonTypeModel(st
1239      return after;      return after;
1240    }    }
1241    len = ChildListLen(GetChildList(b->d));    len = ChildListLen(GetChildList(b->d));
1242    if (!len) {      if (!len) {
1243      /* childless --> AT == FT */      /* childless --> AT == FT */
1244      *exact = 1;      *exact = 1;
1245      return after;      return after;
# Line 1288  struct AnonType *NearestAnonTypeModel(st Line 1293  struct AnonType *NearestAnonTypeModel(st
1293      /* now we have to compare the merge lists, sigh.  The for loop      /* now we have to compare the merge lists, sigh.  The for loop
1294       * leaves us with the first AT in our exact family.       * leaves us with the first AT in our exact family.
1295       */       */
1296      s = MatchATMerges(i,&after,&testat,exactfamily);      s = MatchATMerges(i,&after,&testat,exactfamily);
1297    }    }
1298  #if ATDEBUG  #if ATDEBUG
1299    FPRINTF(ASCERR,"NearestAnonTypeModel: after merge check c = %lu, s = %d\n",c,s);    FPRINTF(ASCERR,"NearestAnonTypeModel: after merge check c = %lu, s = %d\n",c,s);
# Line 1331  struct AnonType *NearestAnonTypeModel(st Line 1336  struct AnonType *NearestAnonTypeModel(st
1336   * In the comments of this function, CT -> context, FT -> formal type.   * In the comments of this function, CT -> context, FT -> formal type.
1337   * By the time we reach this function, there isn't a question of   * By the time we reach this function, there isn't a question of
1338   * competing types with the same name, so anything determined entirely   * competing types with the same name, so anything determined entirely
1339   * by the formal type of the bucket, b, will have a bucket with length   * by the formal type of the bucket, b, will have a bucket with length
1340   * 0 or 1. Every existing AT encountered is assumed to have at least   * 0 or 1. Every existing AT encountered is assumed to have at least
1341   * 1 instance associated with it.   * 1 instance associated with it.
1342   *   *
# Line 1371  struct AnonType *NearestAnonType(struct Line 1376  struct AnonType *NearestAnonType(struct
1376    
1377    case MODEL_INST:    case MODEL_INST:
1378      return NearestAnonTypeModel(i,b, /* need the whole bucket */      return NearestAnonTypeModel(i,b, /* need the whole bucket */
1379                                  exact, exactfamily);                                  exact, exactfamily);
1380    
1381    /* For all the following anon type -> FT.    /* For all the following anon type -> FT.
1382     * either there's already an AT or there isn't.     * either there's already an AT or there isn't.
1383     * Strictly speaking, the wheninst is determined by parent AT,     * Strictly speaking, the wheninst is determined by parent AT,
1384     * but this is not available.     * but this is not available.
1385     */     */
# Line 1445  void DeriveAnonType(struct Instance *i, Line 1450  void DeriveAnonType(struct Instance *i,
1450    }    }
1451    exactfamily = 0;    exactfamily = 0;
1452    after = NearestAnonType(i,b,&exact,&exactfamily);    after = NearestAnonType(i,b,&exact,&exactfamily);
1453    
1454  #if ATDEBUG  #if ATDEBUG
1455    WriteInstanceName(ASCERR,i,info->root);    WriteInstanceName(ASCERR,i,info->root);
1456    FPRINTF(ASCERR,"\nexact = %d. after = 0x%p\n",exact,(void *)after);    FPRINTF(ASCERR,"\nexact = %d. after = 0x%p\n",exact,(void *)after);
1457  #endif  #endif
1458    
1459    if (!exact) {    if (!exact) {
1460      at = ExpandAnonResult(info->atl); /* create, add to atl , set index */      at = ExpandAnonResult(info->atl); /* create, add to atl , set index */
1461      if (exactfamily != 0) {      if (exactfamily != 0) {
# Line 1457  void DeriveAnonType(struct Instance *i, Line 1464  void DeriveAnonType(struct Instance *i,
1464        at->exactfamily = ++(info->nextfamily);        at->exactfamily = ++(info->nextfamily);
1465      }      }
1466      InsertAnonType(b,at,after);      InsertAnonType(b,at,after);
1467    
1468  #if ATDEBUG  #if ATDEBUG
1469      FPRINTF(ASCERR,"\tnew-at = 0x%p\n",(void *)at);      FPRINTF(ASCERR,"\tnew-at = 0x%p\n",(void *)at);
1470  #endif  #endif
1471    
1472    } else {    } else {
1473      at = after;      at = after;
1474    }    }
# Line 1472  void DeriveAnonType(struct Instance *i, Line 1481  void DeriveAnonType(struct Instance *i,
1481    
1482  static  static
1483  void DestroyAnonType(struct AnonType *at)  void DestroyAnonType(struct AnonType *at)
1484  {  {
1485    if (at == NULL) {    if (at == NULL) {
1486      return;      return;
1487    }    }
# Line 1493  void Asc_DestroyAnonList(struct gl_list_ Line 1502  void Asc_DestroyAnonList(struct gl_list_
1502    gl_destroy(l);    gl_destroy(l);
1503  }  }
1504    
1505  /*  
1506   * This function classifies an instance tree from the  /**
1507   * bottom up and returns the list described above.      This function classifies an instance tree from the
1508   * The list should be destroyed with Asc_DestroyAnonList.      bottom up and returns the list described above.
1509   */      The list should be destroyed with Asc_DestroyAnonList.
1510    */
1511  struct gl_list_t *Asc_DeriveAnonList(struct Instance *i)  struct gl_list_t *Asc_DeriveAnonList(struct Instance *i)
1512  {  {
1513    struct AnonBucket **t;    struct AnonBucket **t;
# Line 1507  struct gl_list_t *Asc_DeriveAnonList(str Line 1517  struct gl_list_t *Asc_DeriveAnonList(str
1517  #if (TIMECOMPILER && AMSTAT)  #if (TIMECOMPILER && AMSTAT)
1518    clock_t start,classt;    clock_t start,classt;
1519  #endif  #endif
1520  #if (AWAL && defined(__WIN32__))  
1521    #if AWAL
1522      char *WAL_file;
1523    
1524    # ifdef __WIN32__
1525    char WAL_filename[] = "atmlist.txt";    char WAL_filename[] = "atmlist.txt";
1526    char WAL_file[PATH_MAX + 12];    char WAL_file[PATH_MAX + 12];
1527    char *temp_path;    char *temp_path;
1528    # endif
1529    
1530  #endif  #endif
1531    
1532    ZeroTmpNums(i,0);    ZeroTmpNums(i,0);
# Line 1542  struct gl_list_t *Asc_DeriveAnonList(str Line 1558  struct gl_list_t *Asc_DeriveAnonList(str
1558              "Mergedetect\t\t%lu\n",(unsigned long)(classt-start));              "Mergedetect\t\t%lu\n",(unsigned long)(classt-start));
1559  #endif  #endif
1560    SilentVisitInstanceTreeTwo(i,(VisitTwoProc)DeriveAnonType,1,0,(void *)&info);    SilentVisitInstanceTreeTwo(i,(VisitTwoProc)DeriveAnonType,1,0,(void *)&info);
1561    
1562    
1563  #if AWAL  #if AWAL
1564    {    {
1565      FILE *fp;      FILE *fp;
1566    
1567  #if TIMECOMPILER  #if TIMECOMPILER
1568      FPRINTF(ASCERR, "start atmlist: %lu\n",(unsigned long)clock());      FPRINTF(ASCERR, "start atmlist: %lu\n",(unsigned long)clock());
1569  #endif  #endif
1570    
1571  #ifdef __WIN32__  #ifdef __WIN32__
1572      temp_path = getenv("TEMP");   /* put file in TEMP, if defined */      temp_path = getenv("TEMP");   /* put file in TEMP, if defined */
1573      if (temp_path && (PATH_MAX > strlen(temp_path))) {      if (temp_path && (PATH_MAX > strlen(temp_path))) {
# Line 1557  struct gl_list_t *Asc_DeriveAnonList(str Line 1577  struct gl_list_t *Asc_DeriveAnonList(str
1577      strcat(WAL_file, WAL_filename);      strcat(WAL_file, WAL_filename);
1578      fp = fopen(WAL_file,"w+");      fp = fopen(WAL_file,"w+");
1579  #else   /* !__WIN32__ */  #else   /* !__WIN32__ */
1580      fp = fopen("/tmp/atmlist","w+");      WAL_file = tmpnam(NULL);
1581        fp = fopen(WAL_file,"w+");
1582  #endif  /* __WIN32__ */  #endif  /* __WIN32__ */
1583    
1584      if (fp == NULL) {      if (fp == NULL) {
1585        FPRINTF(ASCERR, "Error opening output file in Asc_DeriveAnonList().\n");        FPRINTF(ASCERR, "Error opening output file '%s'in Asc_DeriveAnonList().\n",WAL_file);
1586      }      }else{
     else {  
1587        Asc_WriteAnonList(fp, atl, i, 1);        Asc_WriteAnonList(fp, atl, i, 1);
1588        fclose(fp);        fclose(fp);
1589      }      }
1590    
1591  #if TIMECOMPILER  #if TIMECOMPILER
1592      FPRINTF(ASCERR, "done atmlist: %lu\n",(unsigned long)clock());      FPRINTF(ASCERR, "done atmlist: %lu\n",(unsigned long)clock());
1593  #endif  #endif
1594    
1595    }    }
1596  #endif /* awal */  
1597    #endif /* AWAL */
1598    
1599    
1600    Asc_AnonMergeUnmarkIPs(vp);    Asc_AnonMergeUnmarkIPs(vp);
1601    DestroyAnonTable(t);    DestroyAnonTable(t);
1602    /* ZeroTmpNums(i,0);  */    /* ZeroTmpNums(i,0);  */
# Line 1578  struct gl_list_t *Asc_DeriveAnonList(str Line 1604  struct gl_list_t *Asc_DeriveAnonList(str
1604    return atl;    return atl;
1605  }  }
1606    
1607    
1608    
1609    
1610  static  static
1611  void WriteAnonType(FILE *fp, struct AnonType *at,  void WriteAnonType(FILE *fp, struct AnonType *at,
1612                     struct Instance *root, char *simple, int mlists)                     struct Instance *root, char *simple, int mlists)
# Line 1636  void Asc_WriteAnonList(FILE *fp, struct Line 1665  void Asc_WriteAnonList(FILE *fp, struct
1665    CONST struct TypeDescription *d, *base;    CONST struct TypeDescription *d, *base;
1666    int tot;    int tot;
1667    char *reln, *simple;    char *reln, *simple;
1668      
1669    if (atl==NULL) {    if (atl==NULL) {
1670      return;      return;
1671    }    }
# Line 1680  void Asc_WriteAnonList(FILE *fp, struct Line 1709  void Asc_WriteAnonList(FILE *fp, struct
1709        }        }
1710  #define ABP 1 /* ATOMic bypass in writing anontypes */  #define ABP 1 /* ATOMic bypass in writing anontypes */
1711  #if ABP  #if ABP
1712        if (simple[0]!='S' /*  && InstanceKind(i) != MODEL_INST */) {        if (simple[0]!='S' /*  && InstanceKind(i) != MODEL_INST */) {
1713          /* bypass details of ATOmlike things and models. */          /* bypass details of ATOmlike things and models. */
1714  #endif  #endif
1715          FPRINTF(fp,          FPRINTF(fp,

Legend:
Removed from v.612  
changed lines
  Added in v.613

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