xref: /titanic_50/usr/src/cmd/rpcgen/rpc_parse.h (revision a2f144d1eca25f33af1e19affd8eda208f547108)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*a2f144d1SJordan Brown  * Common Development and Distribution License (the "License").
6*a2f144d1SJordan Brown  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
2161961e0fSrobinson 
227c478bd9Sstevel@tonic-gate /*
23*a2f144d1SJordan Brown  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
277c478bd9Sstevel@tonic-gate /* All Rights Reserved */
287c478bd9Sstevel@tonic-gate /*
297c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
307c478bd9Sstevel@tonic-gate  * The Regents of the University of California
317c478bd9Sstevel@tonic-gate  * All Rights Reserved
327c478bd9Sstevel@tonic-gate  *
337c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
347c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
357c478bd9Sstevel@tonic-gate  * contributors.
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #ifndef _RPC_PARSE_H
397c478bd9Sstevel@tonic-gate #define	_RPC_PARSE_H
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef __cplusplus
427c478bd9Sstevel@tonic-gate extern "C" {
437c478bd9Sstevel@tonic-gate #endif
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /*
467c478bd9Sstevel@tonic-gate  * rpc_parse.h, Definitions for the RPCL parser
477c478bd9Sstevel@tonic-gate  */
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate enum defkind {
507c478bd9Sstevel@tonic-gate 	DEF_CONST,
517c478bd9Sstevel@tonic-gate 	DEF_STRUCT,
527c478bd9Sstevel@tonic-gate 	DEF_UNION,
537c478bd9Sstevel@tonic-gate 	DEF_ENUM,
547c478bd9Sstevel@tonic-gate 	DEF_TYPEDEF,
557c478bd9Sstevel@tonic-gate 	DEF_PROGRAM,
567c478bd9Sstevel@tonic-gate 	DEF_RESULT
577c478bd9Sstevel@tonic-gate };
587c478bd9Sstevel@tonic-gate typedef enum defkind defkind;
597c478bd9Sstevel@tonic-gate 
607c478bd9Sstevel@tonic-gate typedef char *const_def;
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate enum relation {
637c478bd9Sstevel@tonic-gate 	REL_VECTOR,	/* fixed length array */
647c478bd9Sstevel@tonic-gate 	REL_ARRAY,	/* variable length array */
657c478bd9Sstevel@tonic-gate 	REL_POINTER,	/* pointer */
6661961e0fSrobinson 	REL_ALIAS	/* simple */
677c478bd9Sstevel@tonic-gate };
687c478bd9Sstevel@tonic-gate typedef enum relation relation;
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate struct typedef_def {
717c478bd9Sstevel@tonic-gate 	char *old_prefix;
727c478bd9Sstevel@tonic-gate 	char *old_type;
737c478bd9Sstevel@tonic-gate 	relation rel;
747c478bd9Sstevel@tonic-gate 	char *array_max;
757c478bd9Sstevel@tonic-gate };
767c478bd9Sstevel@tonic-gate typedef struct typedef_def typedef_def;
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate struct enumval_list {
797c478bd9Sstevel@tonic-gate 	char *name;
807c478bd9Sstevel@tonic-gate 	char *assignment;
817c478bd9Sstevel@tonic-gate 	struct enumval_list *next;
827c478bd9Sstevel@tonic-gate };
837c478bd9Sstevel@tonic-gate typedef struct enumval_list enumval_list;
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate struct enum_def {
867c478bd9Sstevel@tonic-gate 	enumval_list *vals;
877c478bd9Sstevel@tonic-gate };
887c478bd9Sstevel@tonic-gate typedef struct enum_def enum_def;
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate struct declaration {
917c478bd9Sstevel@tonic-gate 	char *prefix;
927c478bd9Sstevel@tonic-gate 	char *type;
937c478bd9Sstevel@tonic-gate 	char *name;
947c478bd9Sstevel@tonic-gate 	relation rel;
957c478bd9Sstevel@tonic-gate 	char *array_max;
967c478bd9Sstevel@tonic-gate };
977c478bd9Sstevel@tonic-gate typedef struct declaration declaration;
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate struct decl_list {
1007c478bd9Sstevel@tonic-gate 	declaration decl;
1017c478bd9Sstevel@tonic-gate 	struct decl_list *next;
1027c478bd9Sstevel@tonic-gate };
1037c478bd9Sstevel@tonic-gate typedef struct decl_list decl_list;
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate struct struct_def {
1067c478bd9Sstevel@tonic-gate 	decl_list *decls;
1077c478bd9Sstevel@tonic-gate 	decl_list *tail;
1087c478bd9Sstevel@tonic-gate 	char self_pointer;
1097c478bd9Sstevel@tonic-gate };
1107c478bd9Sstevel@tonic-gate typedef struct struct_def struct_def;
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate struct case_list {
1137c478bd9Sstevel@tonic-gate 	char *case_name;
1147c478bd9Sstevel@tonic-gate 	int contflag;
1157c478bd9Sstevel@tonic-gate 	declaration case_decl;
1167c478bd9Sstevel@tonic-gate 	struct case_list *next;
1177c478bd9Sstevel@tonic-gate };
1187c478bd9Sstevel@tonic-gate typedef struct case_list case_list;
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate struct union_def {
1217c478bd9Sstevel@tonic-gate 	declaration enum_decl;
1227c478bd9Sstevel@tonic-gate 	case_list *cases;
1237c478bd9Sstevel@tonic-gate 	declaration *default_decl;
1247c478bd9Sstevel@tonic-gate };
1257c478bd9Sstevel@tonic-gate typedef struct union_def union_def;
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate struct arg_list {
1287c478bd9Sstevel@tonic-gate 	char *argname; /* name of struct for arg */
1297c478bd9Sstevel@tonic-gate 	decl_list *decls;
1307c478bd9Sstevel@tonic-gate };
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate typedef struct arg_list arg_list;
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate struct proc_list {
1357c478bd9Sstevel@tonic-gate 	char *proc_name;
1367c478bd9Sstevel@tonic-gate 	char *proc_num;
1377c478bd9Sstevel@tonic-gate 	arg_list args;
1387c478bd9Sstevel@tonic-gate 	int arg_num;
1397c478bd9Sstevel@tonic-gate 	char *res_type;
1407c478bd9Sstevel@tonic-gate 	char *res_prefix;
1417c478bd9Sstevel@tonic-gate 	struct proc_list *next;
1427c478bd9Sstevel@tonic-gate };
1437c478bd9Sstevel@tonic-gate typedef struct proc_list proc_list;
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate struct version_list {
1467c478bd9Sstevel@tonic-gate 	char *vers_name;
1477c478bd9Sstevel@tonic-gate 	char *vers_num;
1487c478bd9Sstevel@tonic-gate 	proc_list *procs;
1497c478bd9Sstevel@tonic-gate 	struct version_list *next;
1507c478bd9Sstevel@tonic-gate };
1517c478bd9Sstevel@tonic-gate typedef struct version_list version_list;
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate struct program_def {
1547c478bd9Sstevel@tonic-gate 	char *prog_num;
1557c478bd9Sstevel@tonic-gate 	version_list *versions;
1567c478bd9Sstevel@tonic-gate };
1577c478bd9Sstevel@tonic-gate typedef struct program_def program_def;
1587c478bd9Sstevel@tonic-gate 
1597c478bd9Sstevel@tonic-gate struct definition {
1607c478bd9Sstevel@tonic-gate 	char *def_name;
1617c478bd9Sstevel@tonic-gate 	defkind def_kind;
1627c478bd9Sstevel@tonic-gate 	union {
1637c478bd9Sstevel@tonic-gate 		const_def co;
1647c478bd9Sstevel@tonic-gate 		struct_def st;
1657c478bd9Sstevel@tonic-gate 		union_def un;
1667c478bd9Sstevel@tonic-gate 		enum_def en;
1677c478bd9Sstevel@tonic-gate 		typedef_def ty;
1687c478bd9Sstevel@tonic-gate 		program_def pr;
1697c478bd9Sstevel@tonic-gate 	} def;
1707c478bd9Sstevel@tonic-gate };
1717c478bd9Sstevel@tonic-gate typedef struct definition definition;
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate definition *get_definition();
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate struct bas_type
1777c478bd9Sstevel@tonic-gate {
1787c478bd9Sstevel@tonic-gate 	char *name;
1797c478bd9Sstevel@tonic-gate 	int length;
1807c478bd9Sstevel@tonic-gate 	struct bas_type *next;
1817c478bd9Sstevel@tonic-gate };
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate typedef struct bas_type bas_type;
1847c478bd9Sstevel@tonic-gate 
1857c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1867c478bd9Sstevel@tonic-gate }
1877c478bd9Sstevel@tonic-gate #endif
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate #endif	/* !_RPC_PARSE_H */
190