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