ael_structs.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Asterisk -- An open source telephony toolkit.
  3. *
  4. * Copyright (C) 1999 - 2007, Digium, Inc.
  5. *
  6. * Mark Spencer <markster@digium.com>
  7. *
  8. * See http://www.asterisk.org for more information about
  9. * the Asterisk project. Please do not directly contact
  10. * any of the maintainers of this project for assistance;
  11. * the project provides a web site, mailing lists and IRC
  12. * channels for your use.
  13. *
  14. * This program is free software, distributed under the terms of
  15. * the GNU General Public License Version 2. See the LICENSE file
  16. * at the top of the source tree.
  17. */
  18. /*! \file
  19. * \brief Structures for AEL - the Asterisk extension language
  20. *
  21. * \ref pbx_ael.c
  22. * \todo document this file (ael.h)
  23. */
  24. #ifndef _ASTERISK_AEL_STRUCTS_H
  25. #define _ASTERISK_AEL_STRUCTS_H
  26. /*
  27. * We include asterisk/paths.h here because it is a convenient place
  28. * that doesn't require us to rebuild ael files from .fl/.y
  29. */
  30. #include "asterisk/paths.h"
  31. #include "pval.h"
  32. #if !defined(SOLARIS) && !defined(__CYGWIN__)
  33. /* #include <err.h> */
  34. #else
  35. #define quad_t int64_t
  36. #endif
  37. #if defined(LONG_LONG_MIN) && !defined(QUAD_MIN)
  38. #define QUAD_MIN LONG_LONG_MIN
  39. #endif
  40. #if defined(LONG_LONG_MAX) && !defined(QUAD_MAX)
  41. #define QUAD_MAX LONG_LONG_MAX
  42. #endif
  43. # if ! defined(QUAD_MIN)
  44. # define QUAD_MIN (-0x7fffffffffffffffLL-1)
  45. # endif
  46. # if ! defined(QUAD_MAX)
  47. # define QUAD_MAX (0x7fffffffffffffffLL)
  48. # endif
  49. #if 0
  50. #endif
  51. void ael2_semantic_check(pval *item, int *errs, int *warns, int *notes);
  52. pval *npval(pvaltype type, int first_line, int last_line, int first_column, int last_column);
  53. pval *linku1(pval *head, pval *tail);
  54. void ael2_print(char *fname, pval *tree);
  55. struct pval *ael2_parse(char *fname, int *errs); /* in ael.flex */
  56. void destroy_pval(pval *item);
  57. extern char *prev_word; /* in ael.flex */
  58. #ifndef YY_TYPEDEF_YY_SCANNER_T
  59. #define YY_TYPEDEF_YY_SCANNER_T
  60. typedef void* yyscan_t;
  61. #endif
  62. /* for passing info into and out of yyparse */
  63. struct parse_io
  64. {
  65. struct pval *pval; /* yyparse will set this to point to the parse tree */
  66. yyscan_t scanner; /* yylex needs a scanner. Set it up, and pass it in */
  67. int syntax_error_count; /* the count of syntax errors encountered */
  68. };
  69. /* for CODE GENERATION */
  70. typedef enum { AEL_APPCALL, AEL_CONTROL1, AEL_FOR_CONTROL, AEL_IF_CONTROL, AEL_IFTIME_CONTROL, AEL_RAND_CONTROL, AEL_LABEL, AEL_RETURN } ael_priority_type;
  71. struct ael_priority
  72. {
  73. int priority_num;
  74. ael_priority_type type;
  75. char *app;
  76. char *appargs;
  77. struct pval *origin;
  78. struct ael_extension *exten;
  79. struct ael_priority *goto_true;
  80. struct ael_priority *goto_false;
  81. struct ael_priority *next;
  82. };
  83. struct ael_extension
  84. {
  85. char *name;
  86. char *cidmatch;
  87. char *hints;
  88. int regexten;
  89. int is_switch;
  90. int has_switch; /* set if a switch exists in the extension */
  91. int checked_switch; /* set if we checked for a switch in the extension -- so we don't have to do it again */
  92. struct ast_context *context;
  93. struct ael_priority *plist;
  94. struct ael_priority *plist_last;
  95. struct ael_extension *next_exten;
  96. struct ael_priority *loop_break; /*!< set by latest loop for breaks */
  97. struct ael_priority *loop_continue; /*!< set by lastest loop for continuing */
  98. struct ael_priority *return_target;
  99. int return_needed;
  100. };
  101. #endif /* _ASTERISK_AEL_STRUCTS_H */