a68g-diagnostics.h

     
   1  //! @file a68g-diagnostics.h
   2  //! @author J. Marcel van der Veer
   3  
   4  //! @section Copyright
   5  //!
   6  //! This file is part of Algol68G - an Algol 68 compiler-interpreter.
   7  //! Copyright 2001-2024 J. Marcel van der Veer [algol68g@xs4all.nl].
   8  
   9  //! @section License
  10  //!
  11  //! This program is free software; you can redistribute it and/or modify it 
  12  //! under the terms of the GNU General Public License as published by the 
  13  //! Free Software Foundation; either version 3 of the License, or 
  14  //! (at your option) any later version.
  15  //!
  16  //! This program is distributed in the hope that it will be useful, but 
  17  //! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
  18  //! or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 
  19  //! more details. You should have received a copy of the GNU General Public 
  20  //! License along with this program. If not, see [http://www.gnu.org/licenses/].
  21  
  22  //! @section Synopsis
  23  //!
  24  //! Macros and text strings for diagnostics.
  25  
  26  #if !defined (A68G_DIAGNOSTICS_H)
  27  #define A68G_DIAGNOSTICS_H
  28  
  29  char *error_specification (void);
  30  void diagnostic (STATUS_MASK_T, NODE_T *, char *, ...);
  31  void diagnostics_to_terminal (LINE_T *, int);
  32  void scan_error (LINE_T *, char *, char *);
  33  void scan_warning (LINE_T *, char *, char *);
  34  void write_source_line (FILE_T, LINE_T *, NODE_T *, int);
  35  
  36  // Error codes
  37  
  38  #define A68_NO_DIAGNOSTICS    ((STATUS_MASK_T) 0x0)
  39  #define A68_ERROR             ((STATUS_MASK_T) 0x1)
  40  #define A68_SYNTAX_ERROR      ((STATUS_MASK_T) 0x2)
  41  #define A68_MATH_ERROR        ((STATUS_MASK_T) 0x4)
  42  #define A68_MATH_WARNING      ((STATUS_MASK_T) 0x8)
  43  #define A68_WARNING           ((STATUS_MASK_T) 0x10)
  44  #define A68_RUNTIME_ERROR     ((STATUS_MASK_T) 0x20)
  45  #define A68_SUPPRESS_SEVERITY ((STATUS_MASK_T) 0x40)
  46  #define A68_ALL_DIAGNOSTICS   ((STATUS_MASK_T) 0x80)
  47  #define A68_RERUN             ((STATUS_MASK_T) 0x100)
  48  #define A68_FORCE_DIAGNOSTICS ((STATUS_MASK_T) 0x200)
  49  #define A68_FORCE_QUIT        ((STATUS_MASK_T) 0x400)
  50  #define A68_NO_SYNTHESIS      ((STATUS_MASK_T) 0x800)
  51  
  52  // Diagnostic texts
  53  
  54  #define ERROR_ACCESSING_NIL "attempt to access N"
  55  #define ERROR_ACTION "action failed"
  56  #define ERROR_ALIGNMENT "alignment error"
  57  #define ERROR_ALLOCATION "allocation error"
  58  #define ERROR_ARGUMENT_NUMBER "incorrect number of arguments for M"
  59  #define ERROR_ASSERTION "assertion failure"
  60  #define ERROR_CANNOT_OPEN_PLUGIN "cannot open plugin"
  61  #define ERROR_CANNOT_OPEN_NAME "cannot open Z"
  62  #define ERROR_CANNOT_WIDEN "cannot widen M to M"
  63  #define ERROR_CANNOT_WRITE_LISTING "cannot write listing file"
  64  #define ERROR_CHANNEL_DOES_NOT_ALLOW "channel does not allow Y"
  65  #define ERROR_CLAUSE_WITHOUT_VALUE "clause does not yield a value"
  66  #define ERROR_CLOSING_DEVICE "error while closing device"
  67  #define ERROR_CLOSING_FILE "error while closing file"
  68  #define ERROR_CODE "clause should be compiled"
  69  #define ERROR_COMMA_MUST_SEPARATE "A and A must be separated by a comma-symbol"
  70  #define ERROR_COMPONENT_NUMBER "M must have at least two components"
  71  #define ERROR_COMPONENT_RELATED "M has firmly related components"
  72  #define ERROR_CURSES "error in curses operation"
  73  #define ERROR_CURSES_OFF_SCREEN "curses operation moves cursor off the screen"
  74  #define ERROR_DEVICE_ALREADY_SET "device parameters already set"
  75  #define ERROR_DEVICE_CANNOT_ALLOCATE "cannot allocate device parameters"
  76  #define ERROR_DEVICE_CANNOT_OPEN "cannot open device"
  77  #define ERROR_DEVICE_NOT_OPEN "device is not open"
  78  #define ERROR_DEVICE_NOT_SET "device parameters not set"
  79  #define ERROR_DIFFERENT_BOUNDS "rows have different bounds"
  80  #define ERROR_DIVISION_BY_ZERO "attempt at M division by zero"
  81  #define ERROR_DYADIC_PRIORITY "dyadic S has no priority declaration"
  82  #define ERROR_EMPTY_ARGUMENT "empty argument"
  83  #define ERROR_EMPTY_VALUE "attempt to use an uninitialised M value"
  84  #define ERROR_EMPTY_VALUE_FROM (ERROR_EMPTY_VALUE)
  85  #define ERROR_EXPECTED "Y expected"
  86  #define ERROR_EXPECTED_NEAR "B expected in A, near Z L"
  87  #define ERROR_EXPONENT_DIGIT "invalid exponent digit"
  88  #define ERROR_EXPONENT_INVALID "invalid M exponent"
  89  #define ERROR_FALSE_ASSERTION "false assertion"
  90  #define ERROR_FFT "fourier transform error; Y; Y"
  91  #define ERROR_FILE_ACCESS "file access error"
  92  #define ERROR_FILE_ALREADY_OPEN "file is already open"
  93  #define ERROR_FILE_CANNOT_OPEN_FOR "cannot open Z for Y"
  94  #define ERROR_FILE_CANT_RESET "cannot reset file"
  95  #define ERROR_FILE_CANT_SET "cannot set file"
  96  #define ERROR_FILE_CLOSE "error while closing file"
  97  #define ERROR_FILE_ENDED "end of file reached"
  98  #define ERROR_FILE_INCLUDE_CTRL "invalid characters in include file"
  99  #define ERROR_FILE_LOCK "error while locking file"
 100  #define ERROR_FILE_NOT_OPEN "file is not open"
 101  #define ERROR_FILE_NO_TEMP "cannot create unique temporary file name"
 102  #define ERROR_FILE_READ "error while reading file"
 103  #define ERROR_FILE_RESET "error while resetting file"
 104  #define ERROR_FILE_SCRATCH "error while scratching file"
 105  #define ERROR_FILE_SET "error while setting file"
 106  #define ERROR_FILE_SOURCE_CTRL "invalid characters in source file"
 107  #define ERROR_FILE_TRANSPUT "error transputting M value"
 108  #define ERROR_FILE_TRANSPUT_SIGN "error transputting sign in M value"
 109  #define ERROR_FILE_WRONG_MOOD "file is in Y mood"
 110  #define ERROR_FORMAT_CANNOT_TRANSPUT "cannot transput M value with A"
 111  #define ERROR_FORMAT_EXHAUSTED "patterns exhausted in format"
 112  #define ERROR_FORMAT_INTS_REQUIRED "1 .. 3 M arguments required"
 113  #define ERROR_FORMAT_INVALID_REPLICATOR "negative replicator"
 114  #define ERROR_FORMAT_PICTURES "number of pictures does not match number of arguments"
 115  #define ERROR_FORMAT_PICTURE_NUMBER "incorrect number of pictures for A"
 116  #define ERROR_FORMAT_UNDEFINED "cannot use undefined format"
 117  #define ERROR_INCORRECT_FILENAME "incorrect filename"
 118  #define ERROR_INDEXER_NUMBER "incorrect number of indexers for M"
 119  #define ERROR_INDEX_OUT_OF_BOUNDS "index out of bounds"
 120  #define ERROR_INFINITE "infinite M value"
 121  #define ERROR_INTERNAL_CONSISTENCY "internal consistency check failure"
 122  #define ERROR_INVALID_ARGUMENT "invalid M argument"
 123  #define ERROR_INVALID_DIMENSION "invalid dimension D"
 124  #define ERROR_INVALID_OPERAND "M construct is an invalid operand"
 125  #define ERROR_INVALID_OPERATOR_TAG "invalid operator tag"
 126  #define ERROR_INVALID_PARAMETER "invalid parameter (U Z)"
 127  #define ERROR_INVALID_PRIORITY "invalid priority declaration"
 128  #define ERROR_INVALID_RADIX "invalid radix D"
 129  #define ERROR_INVALID_SEQUENCE "Y is an invalid A"
 130  #define ERROR_INVALID_SIZE "object of invalid size"
 131  #define ERROR_INVALID_VALUE "invalid value"
 132  #define ERROR_IN_DENOTATION "error in M denotation"
 133  #define ERROR_KEYWORD "check for missing or unmatched keyword in clause starting at S"
 134  #define ERROR_LABELED_UNIT_MUST_FOLLOW "S must be followed by a labeled unit"
 135  #define ERROR_LABEL_BEFORE_DECLARATION "declaration cannot follow a labeled unit"
 136  #define ERROR_LAPLACE "laplace transform error; Y; Y"
 137  #define ERROR_LONG_STRING "string exceeds end of line"
 138  #define ERROR_MATH "M math error"
 139  #define ERROR_MATH_CHEBYSHEV "error while evaluating Chebyshev series"
 140  #define ERROR_MATH_CONVERGENCE "no convergence"
 141  #define ERROR_MATH_EXCEPTION "math exception"
 142  #define ERROR_MATH_EXP "exp argument out of range"
 143  #define ERROR_MODE_SPECIFICATION "M construct must yield a routine, row or structured value"
 144  #define ERROR_MP_OUT_OF_BOUNDS "multiprecision value out of bounds"
 145  #define ERROR_MULTIPLE_FIELD "multiple declaration of field S"
 146  #define ERROR_MULTIPLE_TAG "multiple declaration of tag S"
 147  #define ERROR_NOT_WELL_FORMED "M does not specify a well formed mode"
 148  #define ERROR_NO_COMPONENT "M is neither component nor subset of M"
 149  #define ERROR_NO_DYADIC "dyadic operator O S O has not been declared"
 150  #define ERROR_NO_FIELD "M has no field Z"
 151  #define ERROR_NO_FLEX_ARGUMENT "M value from A cannot be flexible"
 152  #define ERROR_NO_MATRIX "M A does not yield a two-dimensional row"
 153  #define ERROR_NO_MONADIC "monadic operator S O has not been declared"
 154  #define ERROR_NO_NAME "M A does not yield a name"
 155  #define ERROR_NO_NAME_REQUIRED "context does not require a name"
 156  #define ERROR_NO_PARALLEL_CLAUSE "interpreter was built without parallel-clause support"
 157  #define ERROR_NO_PRIORITY "S has no priority declaration"
 158  #define ERROR_IS_DIRECTORY "source file cannot be a directory"
 159  #define ERROR_NO_REGULAR_FILE "source is not a regular file"
 160  #define ERROR_NO_ROW_OR_PROC "M A does not yield a row or procedure"
 161  #define ERROR_NO_SOURCE_FILE "no source file specified"
 162  #define ERROR_NO_SQUARE_MATRIX "M matrix is not square"
 163  #define ERROR_NO_STRUCT "M A does not yield a structured value"
 164  #define ERROR_NO_UNION "M is not a united mode"
 165  #define ERROR_NO_UNIQUE_MODE "construct has no unique mode"
 166  #define ERROR_NO_VECTOR "M A does not yield a one-dimensional row"
 167  #define ERROR_DEPRECATED "M in this construct is deprecated in V"
 168  #define ERROR_OPERAND_NUMBER "incorrect number of operands for S"
 169  #define ERROR_OPERATOR_INVALID "monadic S cannot start with a character from Z"
 170  #define ERROR_OPERATOR_INVALID_END "probably a missing symbol near invalid operator S"
 171  #define ERROR_OPERATOR_RELATED "M Z is firmly related to M Z"
 172  #define ERROR_OUT_OF_BOUNDS "M value out of bounds"
 173  #define ERROR_OUT_OF_CORE "insufficient memory"
 174  #define ERROR_OVER_2G "requesting over 2GB"
 175  #define ERROR_PAGE_SIZE "error in page size"
 176  #define ERROR_PARALLEL_JUMP "jump into different thread"
 177  #define ERROR_PARALLEL_CANNOT_CREATE "cannot create thread"
 178  #define ERROR_PARALLEL_OUTSIDE "invalid outside a parallel-clause"
 179  #define ERROR_PARALLEL_OVERFLOW "too many parallel units (Y)"
 180  #define ERROR_PARENTHESIS "incorrect nesting, check for Y"
 181  #define ERROR_PARENTHESIS_2 "encountered X L but expected X, check for Y"
 182  #define ERROR_PRAGMENT "error in pragment"
 183  #define ERROR_HIGH_PRECISION "unsupported precision"
 184  #define ERROR_QUOTED_BOLD_TAG "error in quoted bold-tag"
 185  #define ERROR_REDEFINED_KEYWORD "attempt to redefine keyword Y in A"
 186  #define ERROR_REFINEMENT_APPLIED "refinement is applied more than once"
 187  #define ERROR_REFINEMENT_DEFINED "refinement already defined"
 188  #define ERROR_REFINEMENT_EMPTY "empty refinement at end of source"
 189  #define ERROR_REFINEMENT_INVALID "invalid refinement"
 190  #define ERROR_REFINEMENT_NOT_APPLIED "refinement is not applied"
 191  #define ERROR_RESOLVE "cannot resolve symbol"
 192  #define ERROR_SCOPE_DYNAMIC_0 "value is exported out of its scope"
 193  #define ERROR_SCOPE_DYNAMIC_1 "M value is exported out of its scope"
 194  #define ERROR_SCOPE_DYNAMIC_2 "M value from %s is exported out of its scope"
 195  #define ERROR_SHELL_SCRIPT "source is a shell script"
 196  #define ERROR_SOUND_INTERNAL "error while processing M value (Y)"
 197  #define ERROR_SOUND_INTERNAL_STRING "error while processing M value (Y \"Y\")"
 198  #define ERROR_SOURCE_FILE_EMPTY "source file contains no program" 
 199  #define ERROR_SOURCE_FILE_INCLUDE_OPEN "error opening include file"
 200  #define ERROR_SOURCE_FILE_OPEN "error opening source file"
 201  #define ERROR_STACK_OVERFLOW "stack overflow"
 202  #define ERROR_SUBSET_RELATED "M has firmly related subset M"
 203  #define ERROR_SYNTAX "detected in A"
 204  #define ERROR_SYNTAX_EXPECTED "expected A"
 205  #define ERROR_SYNTAX_MIXED_DECLARATION "possibly mixed identity-declaration and variable-declaration"
 206  #define ERROR_SYNTAX_STRANGE_SEPARATOR "possibly a missing or erroneous separator nearby"
 207  #define ERROR_SYNTAX_STRANGE_TOKENS "possibly a missing or erroneous symbol nearby"
 208  #define ERROR_TIME_LIMIT_EXCEEDED "time limit exceeded"
 209  #define ERROR_TOO_MANY_ARGUMENTS "too many arguments"
 210  #define ERROR_TOO_MANY_OPEN_FILES "too many open files"
 211  #define ERROR_TORRIX "linear algebra error; Y; Y"
 212  #define ERROR_TRANSIENT_NAME "attempt at storing a transient name"
 213  #define ERROR_UNBALANCED_KEYWORD "missing or unbalanced keyword in A, near Z L"
 214  #define ERROR_UNDECLARED_TAG "tag S has not been declared properly"
 215  #define ERROR_UNDECLARED_TAG_2 "tag Z has not been declared properly"
 216  #define ERROR_UNDEFINED_TRANSPUT "transput of M value by this procedure is not defined"
 217  #define ERROR_UNDERDETERMINED_SYSTEM "underdetermined system of linear equations"
 218  #define ERROR_UNIMPLEMENTED "S is either not implemented or not compiled"
 219  #define ERROR_UNSPECIFIED "unspecified error"
 220  #define ERROR_UNTERMINATED_COMMENT "unterminated comment"
 221  #define ERROR_UNTERMINATED_PRAGMAT "unterminated pragmat"
 222  #define ERROR_UNTERMINATED_PRAGMENT "unterminated pragment"
 223  #define ERROR_UNTERMINATED_STRING "unterminated string"
 224  #define ERROR_UNWORTHY_CHARACTER "unworthy character"
 225  #define ERROR_VACUUM "vacuum cannot have row elements (use a Y generator)"
 226  #define INFO_APPROPRIATE_DECLARER "appropriate declarer"
 227  #define INFO_MISSING_KEYWORDS "missing or unmatched keyword"
 228  #define WARNING_EXTENSION "@ is an extension"
 229  #define WARNING_HIDES "declaration hides a declaration of S with larger reach"
 230  #define WARNING_HIDES_PRELUDE "declaration hides prelude declaration of M S"
 231  #define WARNING_HIP "@ should not be in C context"
 232  #define WARNING_MATH_ACCURACY "accuracy loss due to choice of parameters"
 233  #define WARNING_MATH_PRECISION "M A precision limited due to choice of parameters"
 234  #define WARNING_OPTIMISATION "optimisation has no effect on this platform"
 235  #define WARNING_OVERFLOW "M constant overflow"
 236  #define WARNING_PRECISION "D digits precision impacts performance"
 237  #define WARNING_SCOPE_STATIC "M A is a potential scope violation"
 238  #define WARNING_SKIPPED_SUPERFLUOUS "skipped superfluous A"
 239  #define WARNING_TAG_NOT_PORTABLE "tag S is not portable"
 240  #define WARNING_TAG_UNUSED "tag S is not used"
 241  #define WARNING_TRAILING "ignoring trailing character H in A"
 242  #define WARNING_UNDERFLOW "M constant underflow"
 243  #define WARNING_UNINITIALISED "identifier S might be used uninitialised"
 244  #define WARNING_UNINTENDED "possibly unintended M A in M A"
 245  #define WARNING_VOIDED "value of M @ will be voided"
 246  #define WARNING_WIDENING_NOT_PORTABLE "implicit widening is not portable"
 247  
 248  #endif