1  /* m2linemap.h header file for m2linemap.cc.
       2  
       3  Copyright (C) 2012-2023 Free Software Foundation, Inc.
       4  Contributed by Gaius Mulley <gaius@glam.ac.uk>.
       5  
       6  This file is part of GNU Modula-2.
       7  
       8  GNU Modula-2 is free software; you can redistribute it and/or modify
       9  it under the terms of the GNU General Public License as published by
      10  the Free Software Foundation; either version 3, or (at your option)
      11  any later version.
      12  
      13  GNU Modula-2 is distributed in the hope that it will be useful, but
      14  WITHOUT ANY WARRANTY; without even the implied warranty of
      15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16  General Public License for more details.
      17  
      18  You should have received a copy of the GNU General Public License
      19  along with GNU Modula-2; see the file COPYING3.  If not see
      20  <http://www.gnu.org/licenses/>.  */
      21  
      22  #if !defined(m2linemap_h)
      23  
      24  #include "input.h"
      25  
      26  #define m2linemap_h
      27  #if defined(m2linemap_c)
      28  #if (__cplusplus)
      29  #define EXTERN extern "C"
      30  #else /* !__cplusplus.  */
      31  #define EXTERN
      32  #endif /*!__cplusplus.  */
      33  #else /* !m2linemap_c.  */
      34  #if (__cplusplus)
      35  #define EXTERN extern "C"
      36  #else /* !__cplusplus.  */
      37  #define EXTERN extern
      38  #endif /* !__cplusplus.  */
      39  #endif /* !m2linemap_c.  */
      40  
      41  EXTERN void m2linemap_StartFile (void *filename, unsigned int linebegin);
      42  EXTERN void m2linemap_EndFile (void);
      43  EXTERN void m2linemap_StartLine (unsigned int linenumber,
      44                                   unsigned int linesize);
      45  EXTERN location_t m2linemap_GetLocationColumn (unsigned int column);
      46  EXTERN location_t m2linemap_GetLocationRange (unsigned int start, unsigned int end);
      47  EXTERN location_t m2linemap_GetLocationBinary (location_t caret,
      48  					       location_t start, location_t finish);
      49  
      50  EXTERN location_t m2linemap_UnknownLocation (void);
      51  EXTERN location_t m2linemap_BuiltinsLocation (void);
      52  
      53  EXTERN location_t m2linemap_GetLocationColumn (unsigned int column);
      54  EXTERN int m2linemap_GetLineNoFromLocation (location_t location);
      55  EXTERN int m2linemap_GetColumnNoFromLocation (location_t location);
      56  EXTERN const char *m2linemap_GetFilenameFromLocation (location_t location);
      57  EXTERN void m2linemap_ErrorAt (location_t location, char *message);
      58  EXTERN void m2linemap_ErrorAtf (location_t location, const char *message);
      59  EXTERN void m2linemap_WarningAtf (location_t location, const char *message);
      60  EXTERN void m2linemap_NoteAtf (location_t location, const char *message);
      61  EXTERN void m2linemap_internal_error (const char *message);
      62  EXTERN void m2linemap_internal_error_at (location_t location, const char *fmt, ...);
      63  
      64  EXTERN location_t UnknownLocation (void);
      65  EXTERN location_t BuiltinsLocation (void);
      66  EXTERN void ErrorAt (location_t location, char *message);
      67  EXTERN void ErrorAtf (location_t location, const char *message, ...);
      68  EXTERN void WarningAtf (location_t location, const char *message, ...);
      69  EXTERN void NoteAtf (location_t location, const char *message, ...);
      70  
      71  #undef EXTERN
      72  #endif /* m2linemap_h.  */