/[ascend]/trunk/base/generic/compiler/typelint.h
ViewVC logotype

Diff of /trunk/base/generic/compiler/typelint.h

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

revision 1603 by johnpye, Sun Jan 7 10:11:50 2007 UTC revision 1604 by jpye, Wed Aug 29 10:47:23 2007 UTC
# Line 1  Line 1 
1  /*  /*  ASCEND modelling environment
2   *  Ascend Type Definition Lint Module      Copyright (C) 1996 Benjamin Andrew Allan
3   *  by Benjamin Andrew Allan      Copyright (C) 2007 Carnegie Mellon University
4   *  Created: 9/16/96  
  *  Version: $Revision: 1.27 $  
  *  Version control file: $RCSfile: typelint.h,v $  
  *  Date last modified: $Date: 1998/04/21 23:50:10 $  
  *  Last modified by: $Author: ballan $  
  *  
  *  This file is part of the Ascend Language Interpreter.  
  *  
  *  Copyright (C) 1996 Benjamin Andrew Allan  
  *  
5      This program is free software; you can redistribute it and/or modify      This program is free software; you can redistribute it and/or modify
6      it under the terms of the GNU General Public License as published by      it under the terms of the GNU General Public License as published by
7      the Free Software Foundation; either version 2, or (at your option)      the Free Software Foundation; either version 2, or (at your option)
# Line 25  Line 16 
16      along with this program; if not, write to the Free Software      along with this program; if not, write to the Free Software
17      Foundation, Inc., 59 Temple Place - Suite 330,      Foundation, Inc., 59 Temple Place - Suite 330,
18      Boston, MA 02111-1307, USA.      Boston, MA 02111-1307, USA.
19   */  *//** @file
20        Ascend Type Definition Lint Module.
21  /** @file      
22   *  Ascend Type Definition Lint Module.      This module provides some lint-like functionality for ascend type
23   *      definitions.  That is, it checks for the most obvious sorts of blunders
24   *  This module provides some lint-like functionality for ascend type      but due to the nature of the ascend language, not all can be
25   *  definitions.  That is, it checks for the most obvious sorts of blunders      conveniently checked for.
26   *  but due to the nature of the ascend language, not all can be  
27   *  conveniently checked for.      This implementation is merely a start. It needs to be much better.
28   *  
29   *  This implementation is merely a start. It needs to be much better.      @TODO upgrade type definition lint module.
30   *  <pre>  *//**
31   *  When #including typelint.h, make sure these files are #included first:      by Benjamin Andrew Allan, 9/16/96
32   *         #include "utilities/ascConfig.h"      Last in CVS: $Revision: 1.27 $ $Date: 1998/04/21 23:50:10 $ $Author: ballan $
33   *         #include "compiler.h"  */
  *         #include "list.h"  
  *         #include "stattypes.h"  
  *  </pre>  
  *  @todo Upgrade type definition lint module.  
  */  
34    
35  #ifndef ASC_TYPELINT_H  #ifndef ASC_TYPELINT_H
36  #define ASC_TYPELINT_H  #define ASC_TYPELINT_H
37    
38    #include <general/list.h>
39    #include <utilities/ascConfig.h>
40    #include "compiler.h"
41    #include "stattypes.h"
42    
43  /** @addtogroup compiler Compiler  /** @addtogroup compiler Compiler
44      @{      @{
45  */  */
# Line 118  extern void TypeLintError(FILE *file, Line 109  extern void TypeLintError(FILE *file,
109                            CONST struct Statement *statement,                            CONST struct Statement *statement,
110                            enum typelinterr error_code);                            enum typelinterr error_code);
111  /**<  /**<
112   *  <!--  TypeLintError(file,statement,error_code)                     -->      Writes a message describing the error and giving the statement to
113   *  Writes a message describing the error and giving the statement to      the file given.
114   *  the file given.      file and statement should not be NULL.
115   *  file and statement should not be NULL.      Message will be suppressed if g_parse_warnings is high enough.
  *  Message will be suppressed if g_parse_warnings is high enough.  
116   */   */
117    
118  extern void TypeLintErrorAuxillary(FILE *file,  extern void TypeLintErrorAuxillary(FILE *file,
# Line 130  extern void TypeLintErrorAuxillary(FILE Line 120  extern void TypeLintErrorAuxillary(FILE
120                                     enum typelinterr error_code,                                     enum typelinterr error_code,
121                                     int uselabel);                                     int uselabel);
122  /**<  /**<
  *  <!--  TypeLintErrorAuxillary(file,string,error_code,uselabel)      -->  
123   *  Writes a string describing the error in some context to the   *  Writes a string describing the error in some context to the
124   *  the file given.   *  the file given.
125   *  file and string should not be NULL.   *  file and string should not be NULL.
# Line 143  extern void TypeLintName(FILE *file, Line 132  extern void TypeLintName(FILE *file,
132                           CONST struct Name *name,                           CONST struct Name *name,
133                           char *mesg);                           char *mesg);
134  /**<  /**<
135   *  <!--  TypeLintName(file,name,mesg)                                 -->   *  Writes a message followed by the name and a newline to the file given.
  *  Writes a message followed by the name and a return to the file given.  
136   *  No NULL arguments allowed.   *  No NULL arguments allowed.
137   */   */
138    
# Line 154  extern void TypeLintNameMsg(FILE *file, Line 142  extern void TypeLintNameMsg(FILE *file,
142                              char *mesg,                              char *mesg,
143                              int level);                              int level);
144  /**<  /**<
145   *  <!--  TypeLintNameMsg(file,name,mesg,level)                        -->   *  Writes a message followed by the name and a newline to the file given.
  *  Writes a message followed by the name and a return to the file given.  
146   *  Uses the StatioLabel matching level given here.   *  Uses the StatioLabel matching level given here.
147   *  No NULL arguments allowed.   *  No NULL arguments allowed.
148   *  Message will be suppressed if level < g_parse_warnings.   *  Message will be suppressed if level < g_parse_warnings.
# Line 165  extern void TypeLintNameNode(FILE *file, Line 152  extern void TypeLintNameNode(FILE *file,
152                               CONST struct Name *name,                               CONST struct Name *name,
153                               char *mesg);                               char *mesg);
154  /**<  /**<
155   *  <!--  TypeLintNameNode(file,name,mesg)                             -->   *  Writes a message followed by the first element of name and a newline
  *  Writes a message followed by the first element of name and a return  
156   *  to the file given.   *  to the file given.
157   *  No NULL arguments allowed.   *  No NULL arguments allowed.
158   */   */
159    
160  #define TLNNM(f,n,m,l) TypeLintNameNodeMsg((f),(n),(m),(l))  #define TLNNE(f,n,m) TypeLintNameNodeMsg((f),(n),(m))
161    
162  extern void TypeLintNameNodeMsg(FILE *file,  extern void TypeLintNameNodeMsg(FILE *file,
163                                  CONST struct Name *name,      const struct Name *name, char *mesg
164                                  char *mesg,  );
                                 int level);  
165  /**<  /**<
166   *  <!--  TypeLintNameNodeMsg(file,name,mesg,level)                    -->   *  Writes a message followed by the first element of name and a newline
  *  Writes a message followed by the first element of name and a return  
167   *  to the file given.   *  to the file given.
168   *  Uses the StatioLabel matching level given here.   *  Uses the StatioLabel matching level given here.
169   *  Message will be suppressed if level < g_parse_warnings.   *  Message will be suppressed if level < g_parse_warnings.
# Line 198  TypeLintIllegalBodyStats(FILE *fp, Line 183  TypeLintIllegalBodyStats(FILE *fp,
183                           CONST struct StatementList *statements,                           CONST struct StatementList *statements,
184                           unsigned int context);                           unsigned int context);
185  /**<  /**<
  *  <!--  error_code = TypeLintIllegalBodyStats(fp,typename,statements,context); -->  
186   *  Checks all statements for type legality, i.e.   *  Checks all statements for type legality, i.e.
187   *  is the statement of a type allowed in body and are any   *  is the statement of a type allowed in body and are any
188   *  rhs types referred to at least minimally legal in the body?   *  rhs types referred to at least minimally legal in the body?
# Line 216  TypeLintIllegalParamStats(FILE *fp, Line 200  TypeLintIllegalParamStats(FILE *fp,
200                            symchar *typename,                            symchar *typename,
201                            CONST struct StatementList *statements);                            CONST struct StatementList *statements);
202  /**<  /**<
  *  <!--  error_code = TypeLintIllegalParamStats(fp,typename,statements); -->  
203   *  Checks all statements for type legality, i.e.   *  Checks all statements for type legality, i.e.
204   *  is the statement of a type allowed in parameter list and are any   *  is the statement of a type allowed in parameter list and are any
205   *  rhs types referred to at least minimally legal in the parameter list?   *  rhs types referred to at least minimally legal in the parameter list?
# Line 232  TypeLintIllegalWhereStats(FILE *fp, Line 215  TypeLintIllegalWhereStats(FILE *fp,
215                            symchar *typename,                            symchar *typename,
216                            CONST struct StatementList *statements);                            CONST struct StatementList *statements);
217  /**<  /**<
  *  <!--  error_code = TypeLintIllegalWhereStats(fp,typename,statements);  -->  
218   *  Checks all statements for type legality, i.e.   *  Checks all statements for type legality, i.e.
219   *  is the statement of a type allowed in WHERE list.   *  is the statement of a type allowed in WHERE list.
220   *  Currently only WILL_BE_THE_SAME allowed.   *  Currently only WILL_BE_THE_SAME allowed.
# Line 246  TypeLintIllegalReductionStats(FILE *fp, Line 228  TypeLintIllegalReductionStats(FILE *fp,
228                                symchar *typename,                                symchar *typename,
229                                CONST struct StatementList *statements);                                CONST struct StatementList *statements);
230  /**<  /**<
  *  <!--  error_code = TypeLintIllegalReductionStats(fp,typename,statements);  -->  
231   *  Checks all statements for type legality, i.e.   *  Checks all statements for type legality, i.e.
232   *  is the statement of a type allowed in reduction list?   *  is the statement of a type allowed in reduction list?
233   *  Currently only CASGN allowed.   *  Currently only CASGN allowed.
# Line 261  TypeLintIllegalMethodStats(FILE *fp, Line 242  TypeLintIllegalMethodStats(FILE *fp,
242                             struct gl_list_t *pl,                             struct gl_list_t *pl,
243                             unsigned int context);                             unsigned int context);
244  /**<  /**<
  *  <!--  error_code = TypeLintIllegalMethodStats(fp,typename,pl,context); -->  
245   *  Checks all init procedures for type legality, i.e.   *  Checks all init procedures for type legality, i.e.
246   *  is the statement of a type allowed in a method.   *  is the statement of a type allowed in a method.
247   *  Returns DEF_OKAY under normal circumstances,   *  Returns DEF_OKAY under normal circumstances,

Legend:
Removed from v.1603  
changed lines
  Added in v.1604

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