/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
/*
* rpc_util.c, Utility routines for the RPC protocol compiler
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include <string.h>
#include "rpc_scan.h"
#include "rpc_parse.h"
#include "rpc_util.h"
extern void crash(void);
static void printwhere(void);
int nfiles;
list *defined; /* list of defined things */
/*
* Reinitialize the world
*/
void
reinitialize(void)
{
linenum = 0;
defined = NULL;
}
/*
* string equality
*/
int
streq(char *a, char *b)
{
return (strcmp(a, b) == 0);
}
/*
* find a value in a list
*/
{
}
return (NULL);
}
/*
* store a value in a list
*/
void
{
list **l;
/* LOOP */;
*l = lst;
}
static int
{
}
static char *
{
return (orig);
case REL_VECTOR:
return ("char");
case REL_ALIAS:
default:
return (orig);
}
}
char *
{
}
char *
{
return ("wrapstring");
return (type);
}
void
{
} else {
}
}
} else {
}
}
static int
{
return (0);
}
int
{
for (;;) {
switch (rel) {
case REL_VECTOR:
case REL_ARRAY:
return (0);
case REL_POINTER:
return (0);
case REL_ALIAS:
return (0);
}
}
}
char *
{
char c;
char *p = buf;
while (c = *str++)
*p++ = (c >= 'A' && c <= 'Z') ? (c - 'A' + 'a') : c;
*p = 0;
return (buf);
}
void
{
}
void
{
}
/*
* print a useful (?) error message, and then die
*/
void
{
printwhere();
crash();
}
/*
* Something went wrong, unlink any files that we may have created and then
* die.
*/
void
crash(void)
{
int i;
for (i = 0; i < nfiles; i++)
exit(1);
}
void
{
return;
}
crash();
}
static char *toktostr();
/*
* error, token encountered was not the expected one
*/
void
{
}
/*
* error, token encountered was not one of two expected ones
*/
void
{
}
/*
* error, token encountered was not one of 3 expected ones
*/
void
{
sizeof (expectbuf), "expected '%s', '%s' or '%s'",
}
void
{
while (tab--)
(void) fputc('\t', f);
}
{TOK_IDENT, "identifier"},
{TOK_CONST, "const"},
{TOK_RPAREN, ")"},
{TOK_LPAREN, "("},
{TOK_RBRACE, "}"},
{TOK_LBRACE, "{"},
{TOK_LBRACKET, "["},
{TOK_RBRACKET, "]"},
{TOK_STAR, "*"},
{TOK_COMMA, ","},
{TOK_EQUAL, "="},
{TOK_COLON, ":"},
{TOK_SEMICOLON, ";"},
{TOK_UNION, "union"},
{TOK_STRUCT, "struct"},
{TOK_SWITCH, "switch"},
{TOK_CASE, "case"},
{TOK_DEFAULT, "default"},
{TOK_ENUM, "enum"},
{TOK_TYPEDEF, "typedef"},
{TOK_INT, "int"},
{TOK_SHORT, "short"},
{TOK_LONG, "long"},
{TOK_UNSIGNED, "unsigned"},
{TOK_DOUBLE, "double"},
{TOK_FLOAT, "float"},
{TOK_CHAR, "char"},
{TOK_STRING, "string"},
{TOK_OPAQUE, "opaque"},
{TOK_BOOL, "bool"},
{TOK_VOID, "void"},
{TOK_PROGRAM, "program"},
{TOK_VERSION, "version"},
{TOK_EOF, "??????"}
};
static char *
{
/* LOOP */;
}
static void
printbuf(void)
{
char c;
int i;
int cnt;
for (i = 0; (c = curline[i]) != '\0'; i++) {
if (c == '\t') {
c = ' ';
} else {
cnt = 1;
}
while (cnt--)
}
}
static void
printwhere(void)
{
int i;
char c;
int cnt;
printbuf();
c = curline[i];
if (c == '\t') {
} else {
cnt = 1;
}
while (cnt--)
}
}
char *
{
char *name;
exit(1);
}
return (name);
}
void
{
exit(1);
}
if (typ_list_t == NULL) {
typ_list_t = ptr;
typ_list_h = ptr;
} else {
typ_list_t = ptr;
}
}
bas_type *
{
ptr = typ_list_h;
return (ptr);
}
return (NULL);
}