rpc_parse.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /* @(#)rpc_parse.h 1.3 90/08/29
  2. *
  3. * Copyright (c) 2010, Oracle America, Inc.
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are
  6. * met:
  7. *
  8. * * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above
  11. * copyright notice, this list of conditions and the following
  12. * disclaimer in the documentation and/or other materials
  13. * provided with the distribution.
  14. * * Neither the name of the "Oracle America, Inc." nor the names of its
  15. * contributors may be used to endorse or promote products derived
  16. * from this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  21. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  22. * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  23. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  25. * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  26. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  27. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  28. * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. *
  31. * rpc_parse.h, Definitions for the RPCL parser
  32. */
  33. enum defkind {
  34. DEF_CONST,
  35. DEF_STRUCT,
  36. DEF_UNION,
  37. DEF_ENUM,
  38. DEF_TYPEDEF,
  39. DEF_PROGRAM
  40. };
  41. typedef enum defkind defkind;
  42. typedef const char *const_def;
  43. enum relation {
  44. REL_VECTOR, /* fixed length array */
  45. REL_ARRAY, /* variable length array */
  46. REL_POINTER, /* pointer */
  47. REL_ALIAS /* simple */
  48. };
  49. typedef enum relation relation;
  50. struct typedef_def {
  51. const char *old_prefix;
  52. const char *old_type;
  53. relation rel;
  54. const char *array_max;
  55. };
  56. typedef struct typedef_def typedef_def;
  57. struct enumval_list {
  58. const char *name;
  59. const char *assignment;
  60. struct enumval_list *next;
  61. };
  62. typedef struct enumval_list enumval_list;
  63. struct enum_def {
  64. enumval_list *vals;
  65. };
  66. typedef struct enum_def enum_def;
  67. struct declaration {
  68. const char *prefix;
  69. const char *type;
  70. const char *name;
  71. relation rel;
  72. const char *array_max;
  73. };
  74. typedef struct declaration declaration;
  75. struct decl_list {
  76. declaration decl;
  77. struct decl_list *next;
  78. };
  79. typedef struct decl_list decl_list;
  80. struct struct_def {
  81. decl_list *decls;
  82. };
  83. typedef struct struct_def struct_def;
  84. struct case_list {
  85. const char *case_name;
  86. int contflag;
  87. declaration case_decl;
  88. struct case_list *next;
  89. };
  90. typedef struct case_list case_list;
  91. struct union_def {
  92. declaration enum_decl;
  93. case_list *cases;
  94. declaration *default_decl;
  95. };
  96. typedef struct union_def union_def;
  97. struct arg_list {
  98. const char *argname; /* name of struct for arg*/
  99. decl_list *decls;
  100. };
  101. typedef struct arg_list arg_list;
  102. struct proc_list {
  103. const char *proc_name;
  104. const char *proc_num;
  105. arg_list args;
  106. int arg_num;
  107. const char *res_type;
  108. const char *res_prefix;
  109. struct proc_list *next;
  110. };
  111. typedef struct proc_list proc_list;
  112. struct version_list {
  113. const char *vers_name;
  114. const char *vers_num;
  115. proc_list *procs;
  116. struct version_list *next;
  117. };
  118. typedef struct version_list version_list;
  119. struct program_def {
  120. const char *prog_num;
  121. version_list *versions;
  122. };
  123. typedef struct program_def program_def;
  124. struct definition {
  125. const char *def_name;
  126. defkind def_kind;
  127. union {
  128. const_def co;
  129. struct_def st;
  130. union_def un;
  131. enum_def en;
  132. typedef_def ty;
  133. program_def pr;
  134. } def;
  135. };
  136. typedef struct definition definition;
  137. definition *get_definition(void);
  138. struct bas_type
  139. {
  140. const char *name;
  141. int length;
  142. struct bas_type *next;
  143. };
  144. typedef struct bas_type bas_type;