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

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

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

revision 977 by johnpye, Fri Nov 24 01:06:10 2006 UTC revision 978 by johnpye, Wed Dec 20 10:26:04 2006 UTC
# Line 1  Line 1 
1  /*  /*  ASCEND modelling environment
2   *  Temporary Statement Output routines      Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
3   *  by Tom Epperly      Copyright (C) 2006 Carnegie Mellon University
4   *  Version: $Revision: 1.41 $  
5   *  Version control file: $RCSfile: statio.c,v $      This program is free software; you can redistribute it and/or modify
6   *  Date last modified: $Date: 1998/04/21 23:49:55 $      it under the terms of the GNU General Public License as published by
7   *  Last modified by: $Author: ballan $      the Free Software Foundation; either version 2, or (at your option)
8   *      any later version.
9   *  This file is part of the Ascend Language Interpreter.  
10   *      This program is distributed in the hope that it will be useful,
11   *  Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly      but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   *  The Ascend Language Interpreter is free software; you can redistribute      GNU General Public License for more details.
14   *  it and/or modify it under the terms of the GNU General Public License as  
15   *  published by the Free Software Foundation; either version 2 of the      You should have received a copy of the GNU General Public License
16   *  License, or (at your option) any later version.      along with this program; if not, write to the Free Software
17   *      Foundation, Inc., 59 Temple Place - Suite 330,
18   *  The Ascend Language Interpreter is distributed in hope that it will be      Boston, MA 02111-1307, USA.
19   *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of  *//** @file
20   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      Temporary Statement Output routines
21   *  General Public License for more details.  *//*
22   *      by Tom Epperly
23   *  You should have received a copy of the GNU General Public License along      Last in CVS: $Revision: 1.41 $ $Date: 1998/04/21 23:49:55 $ $Author: ballan $
24   *  with the program; if not, write to the Free Software Foundation, Inc., 675  */
25   *  Mass Ave, Cambridge, MA 02139 USA.  Check the file named COPYING.  
  */  
26  #define INDENTATION 4  #define INDENTATION 4
27    
28  #include <utilities/ascConfig.h>  #include <utilities/ascConfig.h>
# Line 528  void WriteStatement(FILE *f, CONST struc Line 527  void WriteStatement(FILE *f, CONST struc
527      WriteSet(f,CallStatArgs(s));      WriteSet(f,CallStatArgs(s));
528      FPRINTF(f,");\n");      FPRINTF(f,");\n");
529      break;      break;
530      case ASSERT:
531        FPRINTF(f,"ASSERT ");
532        WriteExpr(f,AssertStatExpr(s));
533        FPRINTF(f,"\n");
534        break;
535    case WHILE:    case WHILE:
536      FPRINTF(f,"WHILE (");      FPRINTF(f,"WHILE (");
537      WriteExpr(f,WhileStatExpr(s));      WriteExpr(f,WhileStatExpr(s));
# Line 596  void WriteStatement(FILE *f, CONST struc Line 600  void WriteStatement(FILE *f, CONST struc
600      FPRINTF(f,"END;\n");      FPRINTF(f,"END;\n");
601      break;      break;
602    default:    default:
603      FPRINTF(f,"Unknown\n");      FPRINTF(f,"<Implemented statement type in WriteStatement>");
604      break;      break;
605    }    }
606  }  }
# Line 658  void WriteStatementSuppressed(FILE *f, C Line 662  void WriteStatementSuppressed(FILE *f, C
662    }    }
663  }  }
664    
665    void WriteStatementError(const error_severity_t sev
666            , const struct Statement *stat
667            , const int outputstatement
668            , const char *fmt
669            , ...
670    ){
671        va_list args;
672        int res;
673    
674        error_reporter_start(sev,Asc_ModuleFileName(stat->mod),stat->linenum,SCP(StatementTypeString(stat)));
675        va_start(args,fmt);
676        vfprintf_error_reporter(ASCERR,fmt,args);
677        va_end(args);
678        if(outputstatement){
679            FPRINTF(ASCERR,"\n");
680            WriteStatement(ASCERR,stat,4);
681        }
682        error_reporter_end_flush();
683    }
684    
685  void WriteStatementErrorMessage(FILE *f, CONST struct Statement *stat,  void WriteStatementErrorMessage(FILE *f, CONST struct Statement *stat,
686                                  CONST char *message, int noisy,int level)                                  CONST char *message, int noisy,int level)
687  {  {
# Line 775  symchar *StatementTypeString(CONST struc Line 799  symchar *StatementTypeString(CONST struc
799      g_statio_stattypenames[SWITCH] = AddSymbol("SWITCH");      g_statio_stattypenames[SWITCH] = AddSymbol("SWITCH");
800      g_statio_stattypenames[EXT] = AddSymbol("EXTERNAL");      g_statio_stattypenames[EXT] = AddSymbol("EXTERNAL");
801      g_statio_stattypenames[CALL] = AddSymbol("CALL");      g_statio_stattypenames[CALL] = AddSymbol("CALL");
802        g_statio_stattypenames[ASSERT] = AddSymbol("ASSERT");
803      g_statio_stattypenames[FLOW] = AddSymbol("<flow-control>");      g_statio_stattypenames[FLOW] = AddSymbol("<flow-control>");
804      g_statio_stattypenames[WHILE] = AddSymbol("WHILE");      g_statio_stattypenames[WHILE] = AddSymbol("WHILE");
805      g_statio_stattypenames[REF] = AddSymbol("_IS_");      g_statio_stattypenames[REF] = AddSymbol("_IS_");
# Line 808  symchar *StatementTypeString(CONST struc Line 833  symchar *StatementTypeString(CONST struc
833    case SWITCH:    case SWITCH:
834    case EXT:    case EXT:
835    case CALL:    case CALL:
836      case ASSERT:
837    case REF:    case REF:
838    case COND:    case COND:
839    case WBTS:    case WBTS:

Legend:
Removed from v.977  
changed lines
  Added in v.978

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