main.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 <unistd.h>
#include <math.h>
#include <stdlib.h>
#include "stabs.h"
int debug_level = 0;
int line;
struct model_info models[] = {
{ "ilp32", 4, 1, 2, 4, 4 },
{ "lp64", 8, 1, 2, 4, 8 },
{ NULL, 0, 0, 0 }
};
struct stab_ops {
char *type;
} ops_table[] = {
{ "forth",
{ "genassym",
{ "squander",
};
struct model_info *model;
int
{
char *output_type = NULL;
char *model_name = NULL;
int c;
program++;
else
/* defaults */
output_type = "forth";
model_name = "ilp32";
switch (c) {
case 't':
break;
case 'm':
model_name = optarg;
break;
case 'd':
debug_level++;
break;
case '?':
default:
break;
}
}
if (!error) {
/*
* Find ops for the specified output type
*/
break;
}
}
if (!error) {
/*
* Find model characteristics
*/
break;
}
}
/* skip over previously processed arguments */
if (argc < 1)
if (error) {
"{-t output_type} files\n", program);
return (1);
}
parse_input();
return (error ? 1 : 0);
}
/*
* This routine will read the .dbg files and build a list of the structures
* and fields that user is interested in. Any struct specified will get all
* its fields included. If nested struct needs to be printed - then the
* field name and name of struct type needs to be included in the next line.
*/
static void
{
return;
}
/* add all types in this file to our table */
}
}
static char *
{
int len;
if (*cp == '\0') {
*w = NULL;
return (cp);
}
;
c = *cp++;
;
*new = '\0';
} else if (c != '\0') {
}
return (cp);
}
/*
* checks to see if this field in the struct was requested for by user
* in the .dbg file.
*/
struct child *
{
return (chp);
}
return (NULL);
}
static struct tdesc *
{
return (NULL);
return (NULL);
}
/*
* requested in the .dbg files
*/
static void
{
char *w;
if (w == NULL) {
exit(1);
}
/* XXX - always convert to upper-case? */
} else {
}
}
/*
* requested in the .dbg files
*/
static struct node *
{
char *w;
/*
* XXX - These positional parameters are a hack
* We have two right now for genassym. The back-ends
* can use format and format2 any way they'd like.
*/
if (w != NULL) {
w = NULL;
} else {
}
return (np);
}
/*
* Format for .dbg files should be
* Ex:
* seg
* as s_as
* if you wanted the contents of "s_as" (a pointer) to be printed in
* the format of a "as"
*/
static void
{
char *cp;
int copy_flag = 0;
int ignore_flag = 0;
size_t c;
/* grab each line and add them to our table */
if (*cp == '\n') {
if (copy_flag)
printf("\n");
continue;
}
if (*cp == '\\') {
continue;
}
if (ignore_flag)
ignore_flag = 0;
continue;
}
if (ignore_flag)
continue;
c = strlen("model_start ");
/* model matches */;
else
ignore_flag = 1;
continue;
}
copy_flag = 1;
continue;
}
copy_flag = 0;
continue;
}
if (copy_flag) {
continue;
}
for (line++;
/* members of struct, union or enum */
}
}
}
static void
{
char *member;
*member = '\0';
*member = '.';
}
return;
}
}
case STRUCT:
case UNION:
break;
case ENUM:
break;
case TYPEOF:
goto again;
case INTRINSIC:
break;
default:
break;
}
}
char *
{
return (dfault);
return (dot);
} else
return (format);
}
char *
uc(const char *s)
{
char *buf;
int i;
buf[i] = '\0';
return (buf);
}