/usr.bin/rpcgen/rpc_parse.h

https://bitbucket.org/freebsd/freebsd-head/ · C++ Header · 200 lines · 112 code · 27 blank · 61 comment · 0 complexity · dd4c9ae07a9f3c73c987a6fa09c43f72 MD5 · raw file

  1. /*
  2. * $FreeBSD$
  3. */
  4. /*
  5. * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  6. * unrestricted use provided that this legend is included on all tape
  7. * media and as a part of the software program in whole or part. Users
  8. * may copy or modify Sun RPC without charge, but are not authorized
  9. * to license or distribute it to anyone else except as part of a product or
  10. * program developed by the user.
  11. *
  12. * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  13. * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  14. * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  15. *
  16. * Sun RPC is provided with no support and without any obligation on the
  17. * part of Sun Microsystems, Inc. to assist in its use, correction,
  18. * modification or enhancement.
  19. *
  20. * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  21. * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  22. * OR ANY PART THEREOF.
  23. *
  24. * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  25. * or profits or other special, indirect and consequential damages, even if
  26. * Sun has been advised of the possibility of such damages.
  27. *
  28. * Sun Microsystems, Inc.
  29. * 2550 Garcia Avenue
  30. * Mountain View, California 94043
  31. */
  32. /* #pragma ident "@(#)rpc_parse.h 1.10 94/05/15 SMI" */
  33. /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  34. /* All Rights Reserved */
  35. /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
  36. /* The copyright notice above does not evidence any */
  37. /* actual or intended publication of such source code. */
  38. /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  39. * PROPRIETARY NOTICE (Combined)
  40. *
  41. * This source code is unpublished proprietary information
  42. * constituting, or derived under license from AT&T's UNIX(r) System V.
  43. * In addition, portions of such source code were derived from Berkeley
  44. * 4.3 BSD under license from the Regents of the University of
  45. * California.
  46. *
  47. *
  48. *
  49. * Copyright Notice
  50. *
  51. * Notice of copyright on this source code product does not indicate
  52. * publication.
  53. *
  54. * (c) 1986,1987,1988.1989 Sun Microsystems, Inc
  55. * (c) 1983,1984,1985,1986,1987,1988,1989 AT&T.
  56. * All rights reserved.
  57. */
  58. /* @(#)rpc_parse.h 1.3 90/08/29 (C) 1987 SMI */
  59. /*
  60. * rpc_parse.h, Definitions for the RPCL parser
  61. */
  62. enum defkind {
  63. DEF_CONST,
  64. DEF_STRUCT,
  65. DEF_UNION,
  66. DEF_ENUM,
  67. DEF_TYPEDEF,
  68. DEF_PROGRAM
  69. };
  70. typedef enum defkind defkind;
  71. typedef const char *const_def;
  72. enum relation {
  73. REL_VECTOR, /* fixed length array */
  74. REL_ARRAY, /* variable length array */
  75. REL_POINTER, /* pointer */
  76. REL_ALIAS, /* simple */
  77. };
  78. typedef enum relation relation;
  79. struct typedef_def {
  80. const char *old_prefix;
  81. const char *old_type;
  82. relation rel;
  83. const char *array_max;
  84. };
  85. typedef struct typedef_def typedef_def;
  86. struct enumval_list {
  87. const char *name;
  88. const char *assignment;
  89. struct enumval_list *next;
  90. };
  91. typedef struct enumval_list enumval_list;
  92. struct enum_def {
  93. enumval_list *vals;
  94. };
  95. typedef struct enum_def enum_def;
  96. struct declaration {
  97. const char *prefix;
  98. const char *type;
  99. const char *name;
  100. relation rel;
  101. const char *array_max;
  102. };
  103. typedef struct declaration declaration;
  104. struct decl_list {
  105. declaration decl;
  106. struct decl_list *next;
  107. };
  108. typedef struct decl_list decl_list;
  109. struct struct_def {
  110. decl_list *decls;
  111. };
  112. typedef struct struct_def struct_def;
  113. struct case_list {
  114. const char *case_name;
  115. int contflag;
  116. declaration case_decl;
  117. struct case_list *next;
  118. };
  119. typedef struct case_list case_list;
  120. struct union_def {
  121. declaration enum_decl;
  122. case_list *cases;
  123. declaration *default_decl;
  124. };
  125. typedef struct union_def union_def;
  126. struct arg_list {
  127. char *argname; /* name of struct for arg*/
  128. decl_list *decls;
  129. };
  130. typedef struct arg_list arg_list;
  131. struct proc_list {
  132. const char *proc_name;
  133. const char *proc_num;
  134. arg_list args;
  135. int arg_num;
  136. const char *res_type;
  137. const char *res_prefix;
  138. struct proc_list *next;
  139. };
  140. typedef struct proc_list proc_list;
  141. struct version_list {
  142. const char *vers_name;
  143. const char *vers_num;
  144. proc_list *procs;
  145. struct version_list *next;
  146. };
  147. typedef struct version_list version_list;
  148. struct program_def {
  149. const char *prog_num;
  150. version_list *versions;
  151. };
  152. typedef struct program_def program_def;
  153. struct definition {
  154. const char *def_name;
  155. defkind def_kind;
  156. union {
  157. const_def co;
  158. struct_def st;
  159. union_def un;
  160. enum_def en;
  161. typedef_def ty;
  162. program_def pr;
  163. } def;
  164. };
  165. typedef struct definition definition;
  166. definition *get_definition(void);
  167. struct bas_type
  168. {
  169. const char *name;
  170. int length;
  171. struct bas_type *next;
  172. };
  173. typedef struct bas_type bas_type;