Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * This file is part of Hubbub.
  3.  * Licensed under the MIT License,
  4.  *                http://www.opensource.org/licenses/mit-license.php
  5.  * Copyright 2007-8 John-Mark Bell <jmb@netsurf-browser.org>
  6.  */
  7.  
  8. #ifndef hubbub_functypes_h_
  9. #define hubbub_functypes_h_
  10.  
  11. #ifdef __cplusplus
  12. extern "C"
  13. {
  14. #endif
  15.  
  16. #include <stdbool.h>
  17. #include <stdint.h>
  18. #include <stdlib.h>
  19.  
  20. #include <hubbub/types.h>
  21.  
  22. /**
  23.  * Type of allocation function for hubbub
  24.  *
  25.  * The semantics of this function are the same as for realloc().
  26.  *
  27.  * \param ptr   Pointer to object to reallocate, or NULL for a new allocation
  28.  * \param size  Required length in bytes, or zero to free ::ptr
  29.  * \param pw    Pointer to client data
  30.  * \return Pointer to allocated object, or NULL on failure
  31.  */
  32. typedef void *(*hubbub_allocator_fn)(void *ptr, size_t size, void *pw);
  33.  
  34. /**
  35.  * Type of token handling function
  36.  *
  37.  * \param token  Pointer to token to handle
  38.  * \param pw     Pointer to client data
  39.  * \return HUBBUB_OK on success, appropriate error otherwise.
  40.  */
  41. typedef hubbub_error (*hubbub_token_handler)(
  42.                 const hubbub_token *token, void *pw);
  43.  
  44. /**
  45.  * Type of parse error handling function
  46.  *
  47.  * \param line     Source line on which error occurred
  48.  * \param col      Column in ::line of start of erroneous input
  49.  * \param message  Error message
  50.  * \param pw       Pointer to client data
  51.  */
  52. typedef void (*hubbub_error_handler)(uint32_t line, uint32_t col,
  53.                 const char *message, void *pw);
  54.  
  55. #ifdef __cplusplus
  56. }
  57. #endif
  58.  
  59. #endif
  60.  
  61.