Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Tiny BASIC
  3.  * Listing Output Header
  4.  *
  5.  * Released as Public Domain by Damian Gareth Walker, 2019
  6.  * Created: 18-Sep-2019
  7.  */
  8.  
  9.  
  10. #ifndef __FORMATTER_H__
  11. #define __FORMATTER_H__
  12.  
  13.  
  14. /* included headers */
  15. #include "errors.h"
  16. #include "statement.h"
  17.  
  18.  
  19. /*
  20.  * Data Declarations
  21.  */
  22.  
  23.  
  24. /* Formatter Class */
  25. typedef struct formatter_data FormatterData;
  26. typedef struct formatter Formatter;
  27. typedef struct formatter {
  28.  
  29.   /* Properties */
  30.   FormatterData *priv; /* private data */
  31.   char *output; /* the formatted output */
  32.  
  33.   /*
  34.    * Create a formatted version of the program
  35.    * params:
  36.    *   Formatter*     the formatter
  37.    *   ProgramNode*   the syntax tree
  38.    * returns:
  39.    *   char*          the formatted BASIC program
  40.    */
  41.   void (*generate) (Formatter *, ProgramNode *);
  42.  
  43.   /*
  44.    * Destroy the formatter when no longer needed
  45.    * params:
  46.    *   Formatter*   the doomed formatter
  47.    */
  48.   void (*destroy) (Formatter *);
  49.  
  50. } Formatter;
  51.  
  52.  
  53. /*
  54.  * Function Declarations
  55.  */
  56.  
  57.  
  58. /*
  59.  * The Formatter constructor
  60.  * returns:
  61.  *   Formatter*   the new formatter
  62.  */
  63. Formatter *new_Formatter (ErrorHandler *errors);
  64.  
  65.  
  66. #endif
  67.