Subversion Repositories Kolibri OS

Rev

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

  1. /*
  2.  * Tiny BASIC Interpreter and Compiler Project
  3.  * C Output Header
  4.  *
  5.  * Copyright (C) Damian Gareth Walker 2019
  6.  * Created: 03-Oct-2019
  7.  */
  8.  
  9.  
  10. #ifndef __GENERATEC_H__
  11. #define __GENERATEC_H__
  12.  
  13.  
  14. /* included headers */
  15. #include "errors.h"
  16. #include "options.h"
  17.  
  18. /* forward references */
  19. typedef struct c_program CProgram;
  20.  
  21. /* object structure */
  22. typedef struct c_program {
  23.   void *private_data; /* private data */
  24.   char *c_output; /* the generated C code */
  25.   void (*generate) (CProgram *, ProgramNode *); /* generate function */
  26.   void (*destroy) (CProgram *); /* destructor */
  27. } CProgram;
  28.  
  29.  
  30. /*
  31.  * Function Declarations
  32.  */
  33.  
  34.  
  35. /*
  36.  * Constructor
  37.  * params:
  38.  *   ErrorHandler*      compiler_errors    the error handler
  39.  *   LanguageOptions*   compiler_options   language options
  40.  * changes:
  41.  *   CProgram*       this                  the object being created
  42.  *   Private*        data                  the object's private data
  43.  * returns:
  44.  *   CProgram*                             the created object
  45.  */
  46. CProgram *new_CProgram (ErrorHandler *compiler_errors,
  47.   LanguageOptions *compiler_options);
  48.  
  49.  
  50. #endif