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

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

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

revision 221 by johnpye, Tue Jan 17 05:48:00 2006 UTC revision 222 by johnpye, Fri Jan 27 04:23:20 2006 UTC
# Line 1088  int DoExternal(symchar *type, Line 1088  int DoExternal(symchar *type,
1088     * must be named.     * must be named.
1089     */     */
1090    nptr = ExternalStatName(stat);    nptr = ExternalStatName(stat);
1091    error_reporter_start(ASC_PROG_NOTE,NULL,0);    ERROR_REPORTER_START_NOLINE(ASC_PROG_NOTE);
1092    FPRINTF(ASCERR,"DOEXTERNAL: nptr = ");    FPRINTF(ASCERR,"DOEXTERNAL: nptr = ");
1093    WriteName(ASCERR,nptr);    WriteName(ASCERR,nptr);
1094    FPRINTF(ASCERR,"\n");    FPRINTF(ASCERR,"\n");
# Line 2418  enum typelinterr DeriveRefinedTypes(stru Line 2418  enum typelinterr DeriveRefinedTypes(stru
2418                  "%sRefinement can only be done on array elements.\n",                  "%sRefinement can only be done on array elements.\n",
2419                  StatioLabel(3));                  StatioLabel(3));
2420              }              }
2421              error_reporter_start(ASC_USER_ERROR,NULL,0);              ERROR_REPORTER_START_NOLINE(ASC_USER_ERROR);
2422              FPRINTF(ASCERR,"Incompatible type (%s) of LHS name: ",              FPRINTF(ASCERR,"Incompatible type (%s) of LHS name: ",
2423                (d!=NULL)?SCP(GetName(d)):"UNDEFINED");                (d!=NULL)?SCP(GetName(d)):"UNDEFINED");
2424              WriteName(ASCERR,n);              WriteName(ASCERR,n);
# Line 3785  enum typelinterr CheckParameterSubscript Line 3785  enum typelinterr CheckParameterSubscript
3785      /* n will be a set expression sort of name */      /* n will be a set expression sort of name */
3786      s = NameSetPtr(n);      s = NameSetPtr(n);
3787      if (SetNamesInLCL(s)==0) {      if (SetNamesInLCL(s)==0) {
3788        error_reporter_start(ASC_USER_ERROR,NULL,0);        ERROR_REPORTER_START_NOLINE(ASC_USER_ERROR);
3789        FPRINTF(ASCERR,"Undefined subscript: [");        FPRINTF(ASCERR,"Undefined subscript: [");
3790        WriteSet(ASCERR,s);        WriteSet(ASCERR,s);
3791        FPRINTF(ASCERR,"]\n");        FPRINTF(ASCERR,"]\n");
# Line 3854  enum typelinterr DoParamName(CONST struc Line 3854  enum typelinterr DoParamName(CONST struc
3854      ok = AddLCL( name,type,isarray, stat, STATPARAMETRIC );      ok = AddLCL( name,type,isarray, stat, STATPARAMETRIC );
3855      if (ok < 1) {      if (ok < 1) {
3856        if (ok==0) {        if (ok==0) {
3857          error_reporter_start(ASC_USER_ERROR,NULL,0);          ERROR_REPORTER_START_NOLINE(ASC_USER_ERROR);
3858          FPRINTF(ASCERR,"Parameter \"%s\" redeclared.",SCP(name));          FPRINTF(ASCERR,"Parameter \"%s\" redeclared.",SCP(name));
3859          assert(g_lcl_pivot!=NULL);          assert(g_lcl_pivot!=NULL);
3860          if (g_lcl_pivot->e.statement != stat ) {          if (g_lcl_pivot->e.statement != stat ) {
# Line 4171  enum typelinterr ExtractRLEs(CONST struc Line 4171  enum typelinterr ExtractRLEs(CONST struc
4171        rle->assigned = 1;        rle->assigned = 1;
4172        break;        break;
4173      default: /* should be impossible due to TypedefIllegal functions */      default: /* should be impossible due to TypedefIllegal functions */
4174        error_reporter_start(ASC_PROG_FATAL,NULL,0);        ERROR_REPORTER_START_NOLINE(ASC_PROG_FATAL);
4175        FPRINTF(ASCERR,"Incorrect statement found in %s list.\n",        FPRINTF(ASCERR,"Incorrect statement found in %s list.\n",
4176                (absorbed != 0) ? "absorbed" : "parameter");                (absorbed != 0) ? "absorbed" : "parameter");
4177        TypeLintError(ASCERR,s,DEF_STAT_MISLOCATED);        TypeLintError(ASCERR,s,DEF_STAT_MISLOCATED);
# Line 4202  int FindAssignedStatement(struct gl_list Line 4202  int FindAssignedStatement(struct gl_list
4202    test.olddeclstat = s;    test.olddeclstat = s;
4203    pos = gl_search(nspace,&test,(CmpFunc)CmpRLEStat);    pos = gl_search(nspace,&test,(CmpFunc)CmpRLEStat);
4204    if (pos==0) {    if (pos==0) {
4205      error_reporter_start(ASC_PROG_FATAL,NULL,0);      ERROR_REPORTER_START_NOLINE(ASC_PROG_FATAL);
4206      FPRINTF(ASCERR,"FindAssignedStatement called with unknown stat: ");      FPRINTF(ASCERR,"FindAssignedStatement called with unknown stat: ");
4207      WriteStatement(ASCERR,s,2);      WriteStatement(ASCERR,s,2);
4208      error_reporter_end_flush();      error_reporter_end_flush();
# Line 4438  enum typelinterr MatchModelParameters(sy Line 4438  enum typelinterr MatchModelParameters(sy
4438    newlen = StatementListLength(psl);    newlen = StatementListLength(psl);
4439    oldlen = StatementListLength(pslbase);    oldlen = StatementListLength(pslbase);
4440    if (newlen < oldlen) {    if (newlen < oldlen) {
4441      error_reporter_start(ASC_USER_ERROR,NULL,0);      ERROR_REPORTER_START_NOLINE(ASC_PROG_FATAL);
4442      FPRINTF(ASCERR,"Parameter list mismatch with '%s': missing declarations in\n  ",      FPRINTF(ASCERR,"Parameter list mismatch with '%s': missing declarations in\n  ",
4443        SCP(refname));        SCP(refname));
4444      for (diff = 1; diff <=oldlen; diff++) {      for (diff = 1; diff <=oldlen; diff++) {
# Line 4470  enum typelinterr MatchModelParameters(sy Line 4470  enum typelinterr MatchModelParameters(sy
4470    if (newlen==0) return DEF_OKAY; /* no parameters for either */    if (newlen==0) return DEF_OKAY; /* no parameters for either */
4471    c = CompareISLists(pslbase,psl,&diff);    c = CompareISLists(pslbase,psl,&diff);
4472    if (c != 0 && diff <= oldlen) {    if (c != 0 && diff <= oldlen) {
4473      error_reporter_start(ASC_USER_ERROR,NULL,0);      ERROR_REPORTER_START_NOLINE(ASC_USER_ERROR);
4474      FPRINTF(ASCERR,"Parameter %lu mismatch between %s and %s.\n",diff,SCP(name),SCP(refname));      FPRINTF(ASCERR,"Parameter %lu mismatch between %s and %s.\n",diff,SCP(name),SCP(refname));
4475      stat = (CONST struct Statement *)gl_fetch(GetList(psl),diff);      stat = (CONST struct Statement *)gl_fetch(GetList(psl),diff);
4476      WriteStatement(ASCERR,stat,2);      WriteStatement(ASCERR,stat,2);
# Line 4502  enum typelinterr MatchParameterWheres(sy Line 4502  enum typelinterr MatchParameterWheres(sy
4502    newlen = StatementListLength(wsl);    newlen = StatementListLength(wsl);
4503    oldlen = StatementListLength(wslbase);    oldlen = StatementListLength(wslbase);
4504    if (newlen < oldlen) {    if (newlen < oldlen) {
4505      error_reporter_start(ASC_USER_ERROR,NULL,0);      ERROR_REPORTER_START_NOLINE(ASC_USER_ERROR);
4506      FPRINTF(ASCERR,"WHERE list mismatch with %s.\n",SCP(refname));      FPRINTF(ASCERR,"WHERE list mismatch with %s.\n",SCP(refname));
4507      FPRINTF(ASCERR,"  %s is missing declarations:\n",SCP(name));      FPRINTF(ASCERR,"  %s is missing declarations:\n",SCP(name));
4508      for (diff = 1; diff <=oldlen; diff++) {      for (diff = 1; diff <=oldlen; diff++) {
# Line 4518  enum typelinterr MatchParameterWheres(sy Line 4518  enum typelinterr MatchParameterWheres(sy
4518    if (newlen==0) return DEF_OKAY; /* no parameters for either */    if (newlen==0) return DEF_OKAY; /* no parameters for either */
4519    c = CompareISLists(wslbase,wsl,&diff);    c = CompareISLists(wslbase,wsl,&diff);
4520    if (c != 0 && diff <= oldlen) {    if (c != 0 && diff <= oldlen) {
4521      error_reporter_start(ASC_USER_ERROR,NULL,0);      ERROR_REPORTER_START_NOLINE(ASC_USER_ERROR);
4522      FPRINTF(ASCERR,"WHERE statement %lu mismatch between %s and %s.\n",      FPRINTF(ASCERR,"WHERE statement %lu mismatch between %s and %s.\n",
4523          diff,SCP(name),SCP(refname));          diff,SCP(name),SCP(refname));
4524      stat = (CONST struct Statement *)gl_fetch(GetList(wsl),diff);      stat = (CONST struct Statement *)gl_fetch(GetList(wsl),diff);
# Line 4806  struct TypeDescription *CreateModelTypeD Line 4806  struct TypeDescription *CreateModelTypeD
4806    } else {    } else {
4807      rdesc=FindType(refines);      rdesc=FindType(refines);
4808      if (rdesc==NULL) {      if (rdesc==NULL) {
4809        error_reporter_start(ASC_USER_ERROR,NULL,0);        ERROR_REPORTER_START_NOLINE(ASC_USER_ERROR);
4810        FPRINTF(ASCERR,"Unable to locate type %s for %s's type definition.\n",        FPRINTF(ASCERR,"Unable to locate type %s for %s's type definition.\n",
4811                SCP(refines),SCP(name));                SCP(refines),SCP(name));
4812        DestroyTypeDefArgs(sl,pl,psl,rsl,NULL,wsl);        DestroyTypeDefArgs(sl,pl,psl,rsl,NULL,wsl);
# Line 4814  struct TypeDescription *CreateModelTypeD Line 4814  struct TypeDescription *CreateModelTypeD
4814        return NULL;        return NULL;
4815      }      }
4816      if (GetBaseType(rdesc) != model_type){      if (GetBaseType(rdesc) != model_type){
4817        error_reporter_start(ASC_USER_ERROR,NULL,0);        ERROR_REPORTER_START_NOLINE(ASC_USER_ERROR);
4818        FPRINTF(ASCERR,"Model %s attempts to refine non-MODEL type %s.\n",        FPRINTF(ASCERR,"Model %s attempts to refine non-MODEL type %s.\n",
4819                SCP(name),SCP(refines));                SCP(name),SCP(refines));
4820        DestroyTypeDefArgs(sl,pl,psl,rsl,NULL,wsl);        DestroyTypeDefArgs(sl,pl,psl,rsl,NULL,wsl);
# Line 4847  struct TypeDescription *CreateModelTypeD Line 4847  struct TypeDescription *CreateModelTypeD
4847        /* no parameters in rdesc. */        /* no parameters in rdesc. */
4848        if (StatementListLength(rsl) != 0L) {        if (StatementListLength(rsl) != 0L) {
4849          /* error. can't reduce what ain't there */          /* error. can't reduce what ain't there */
4850          error_reporter_start(ASC_USER_ERROR,NULL,0);          ERROR_REPORTER_START_NOLINE(ASC_USER_ERROR);
4851          FPRINTF(ASCERR,"Model %s attempts to reduce non-parameters in %s.\n",          FPRINTF(ASCERR,"Model %s attempts to reduce non-parameters in %s.\n",
4852            SCP(name),SCP(refines));            SCP(name),SCP(refines));
4853          WriteStatementList(ASCERR,rsl,4);          WriteStatementList(ASCERR,rsl,4);
# Line 4902  struct TypeDescription *CreateModelTypeD Line 4902  struct TypeDescription *CreateModelTypeD
4902         */         */
4903        if (ParametricChildList(name,tsl,NOCHECKSUBS) != DEF_OKAY) {        if (ParametricChildList(name,tsl,NOCHECKSUBS) != DEF_OKAY) {
4904          /* contents of tsl, if any, have been checked already */          /* contents of tsl, if any, have been checked already */
4905          error_reporter_start(ASC_PROG_ERROR,NULL,0);          ERROR_REPORTER_START_NOLINE(ASC_PROG_ERROR);
4906          FPRINTF(ASCERR,"Model %s victim of bizarre error 2.\n",SCP(name));          FPRINTF(ASCERR,"Model %s victim of bizarre error 2.\n",SCP(name));
4907          WriteStatementList(ASCERR,tsl,2);          WriteStatementList(ASCERR,tsl,2);
4908          error_reporter_end_flush();          error_reporter_end_flush();

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

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