/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 1996-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include "stabs.h"
static void reset(void);
static char *get_line(void);
static int compute_sum(char *w);
static int line_number = 0;
static int debug_line = 0;
extern int debug_level;
static void
{
int i;
if (level > debug_level)
return;
for (i = 0; i < 30; i++) {
if (cp[i] == '\0')
break;
}
tmp[i] = '\0';
} else {
}
}
/* Report unexpected syntax in stabs. */
static void
char *who, /* what function, or part thereof, is reporting */
char *what, /* what was expected */
char *where) /* where we were in the line of input */
{
exit(1);
}
/* Read a line from stdin into linebuf and increment line_number. */
static char *
get_line(void)
{
line_number++;
/* For debugging, you can set debug_line to a line to stop on. */
if (line_number == debug_line) {
for (;;)
sleep(1);
}
return (cp);
}
/* Get the continuation of the current input line. */
static char *
get_continuation(void)
{
if (!cp) {
"got end of input\n");
exit(1);
}
/* Skip to the quoted stuff. */
while (*cp++ != '"')
;
return (cp);
}
void
parse_input(void)
{
char *cp;
int i = 0;
for (i = 0; i < BUCKETS; i++) {
hash_table[i] = NULL;
name_table[i] = NULL;
}
/*
* get a line at a time from the .s stabs file and parse.
*/
}
/*
* Parse each line of the .s file (stabs entry) gather meaningful information
* like name of type, size, offsets of fields etc.
*/
static void
{
char c, *w;
int h, tagdef;
/*
* setup for reset()
*/
return;
/*
* Look for lines of the form
* .stabs "str",n,n,n,n
* The part in '"' is then parsed.
*/
reset();
if (*cp++ != '"')
reset();
/*
* name:type variable (ignored)
* name:ttype typedef
* name:Ttype struct tag define
*/
tagdef = 0;
switch (c = *cp++) {
case 't': /* type */
break;
case 'T': /* struct, union, enum */
tagdef = 1;
break;
default:
reset();
}
/*
* The type id and definition follow.
*/
if (*cp == '"') {
cp++;
} else { /* that type is already defined */
}
return;
} else if (*cp++ != '=') {
}
if (tagdef) {
} else {
}
}
/*
* Check if we have this node in the hash table already
*/
static struct tdesc *
lookup(int h)
{
return (tdp);
}
return (NULL);
}
static char *
{
char *orig, c;
;
--cp;
return (cp);
}
static char *
{
int len;
c = *cp++;
if (c == ':')
*w = NULL;
else if (isalpha(c) || c == '_') {
;
if (c != ':')
reset();
*new = '\0';
} else
reset();
return (cp);
}
static char *
{
char *next;
return (next);
}
static char *
{
cp++;
if (*cp++ != ',')
if (*cp++ != ')')
*h = n1;
} else {
}
return (cp);
}
static void
{
}
}
static void
{
if (w != NULL) {
}
}
} else {
}
switch (*cp++) {
case 's':
break;
case 'u':
break;
case 'e':
break;
default:
break;
}
}
static char *
{
char *w;
int c, h2;
char type;
/* Type codes */
case 'b': /* integer */
c = *++cp;
if (c != 's' && c != 'u')
c = *++cp;
if (c == 'c')
cp++;
break;
case 'R': /* fp */
/* skip up to and past ';' */
while (*cp++ != ';')
/* NULL */;
break;
case '(': /* equiv to another type */
} else { /* that type is already defined */
}
break;
case '*':
break;
case 'f':
break;
case 'a':
cp++;
if (*cp++ != 'r')
break;
case 'x':
c = *++cp;
if (c != 's' && c != 'u' && c != 'e')
break;
case 'B': /* volatile */
break;
case 'k': /* const */
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
/* gcc equiv to another type */
/* better be defining it now */
if (*cp++ != '=') {
if (h != h2)
/* defined in terms of itself */
} else {
}
} else { /* that type is already defined */
}
break;
case 'u':
case 's':
cp++;
break;
default:
}
return (cp);
}
static char *
{
int size;
return (cp);
}
static char *
{
char *w;
int size;
/*
* An '@' here indicates a bitmask follows. This is so the
* compiler can pass information to debuggers about how structures
* are passed in the v9 world. We don't need this information
* so we skip over it.
*/
if (cp[0] == '@')
cp += 3;
/* fill up the fields */
int h;
/*
* find the tdesc struct in the hash table for this type
* and stick a ptr in here
*/
if (*cp++ != '=')
cp++;
} else {
}
cp = get_continuation();
}
return (cp);
}
static char *
{
if (*cp == ',')
cp++;
if (*cp++ != ',')
if (*cp++ != ';')
return (cp);
}
static char *
{
int h;
if (*cp++ != ';')
if (*cp++ != ';')
if (*cp++ != ';')
#if 0
} else {
if (*cp != '=')
}
} /* else */
#endif
return (cp);
}
static void
{
char *w;
while (*cp != ';') {
if (*cp++ != ',')
if (*cp == '\\')
cp = get_continuation();
}
}
/*
* Add a node to the hash queues.
*/
static void
{
/*
* If it already exists in the hash table don't add it again
* (but still check to see if the name should be hashed).
*/
added_num = 1;
}
added_name = 1;
}
}
if (!added_num && !added_name) {
exit(1);
}
}
struct tdesc *
{
return (tdp);
}
}
return (ttdp);
}
static int
compute_sum(char *w)
{
char c;
int sum;
;
}
static void
reset(void)
{
/* NOTREACHED */
}