/*
* 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 (c) 1999 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <libgen.h>
#include <fcntl.h>
#include <locale.h>
#include <string.h>
#include <stdarg.h>
#include <errno.h>
#include "itmcomp.h"
#include "maptype.h"
#if !defined(TEXT_DOMAIN)
#endif
char *itm_output_file;
int error_deferred;
char *itm_name_type_name[] = {
"UNKNOWN",
"ITM",
"STRING",
"DIRECTION",
"CONDITION",
"MAP",
"OPERATION",
"EXPRESSION",
"DATA",
"NAME",
"RANGE",
"REGISTER",
};
static void cpp_opt_trunc(int num);
static char *prog_path_expand(const char *base_name);
static void map_name_type_append(char *optarg);
static char *map_type_name_str(itmc_map_type_t);
static char *strdup_vital(const char *);
#if defined(ENABLE_TRACE)
static void trace_option(void);
#endif /* ENABLE_TRACE */
static int itm_compile(char *file);
static int fork_error(void);
int
{
char **pp;
(void) textdomain(TEXT_DOMAIN);
#if defined(ENABLE_TRACE)
trace_option();
#endif /* ENABLE_TRACE */
(void) itm_compile(NULL);
} else {
switch (pid) {
case 0:
break;
case -1:
(void) fork_error();
break;
default:
}
}
} else {
}
}
return (0);
}
static int
{
char *cmd_line;
char *command;
char *p;
extern int yyparse();
} else {
int e = errno;
gettext("%1$s: can not access %2$s: "),
errno = e;
}
}
if (NULL == p) {
} else {
}
} else {
}
if (0 != cmd_opt.preprocess) {
} else {
cpp_opt_trunc(1);
}
if (NULL == p) {
} else {
}
gettext("%1$s: can not start %2$s on %3$s\n"),
} else {
}
(void) yyparse();
}
} else {
} else {
gettext("%1$s: can not open %2$s\n"),
}
}
(void) yyparse();
}
}
return (ITMC_STATUS_SUCCESS);
}
static void
{
int stat_loc;
char *msgstr;
} else {
}
}
}
static int
fork_error(void)
{
return (0); /* never return */
}
static int
{
int c;
int i;
char *p;
int error_num = 0;
#ifdef YYDEBUG
extern int yydebug;
#endif /* YYDEBUG */
extern char *optarg;
extern int optind;
}
switch (c) {
case 'd':
break;
case 'i':
break;
case 'p':
gettext("multiple -p options are specified\n"));
error_num += 1;
}
gettext("cannot find preprocessor \"%s\"\n"),
optarg);
error_num += 1;
}
if (NULL == p) {
} else {
}
break;
case 'W':
error_num += 1;
}
break;
case 'I':
error_num += 1;
}
break;
case 'D':
error_num += 1;
}
break;
case 'U':
error_num += 1;
}
break;
case 'f':
break;
case 'n':
break;
case 'M':
break;
case 'l':
break;
case 'o':
break;
case 's':
break;
case 'q':
break;
#if defined(ENABLE_TRACE)
case 'X':
for (p = optarg; *p; p++) {
}
#ifdef YYDEBUG
#endif /* YYDEBUG */
break;
#endif /* ENABLE_TRACE */
case 'h':
break;
default:
}
}
malloc_vital((sizeof (char *)) *
}
}
/* check conflict */
error_num++;
}
if ((cmd_opt.input_file_num <= 0) &&
"output file is unnamed. "
"use -o to specify output file\n"));
error_num++;
}
if (cmd_opt.disassemble &&
(cmd_opt.interpreter ||
cmd_opt.output_file)) {
gettext("-d may not specified with other options\n"));
error_num++;
}
if (error_num) {
}
/*
* do not move upward
* may conflict with -d option
*/
if (NULL == p) {
} else {
}
}
return (0);
}
static FILE *
cpp_open(void)
{
int i;
for (i = 0; i < cmd_opt.cpp_opt_num; i++) {
}
}
if (pid == 0) { /* child */
(void) close(1);
exit(0);
return (NULL);
} else {
}
return (NULL); /* NEVER */
}
static int
{
char *new_opt;
char **new_opt_list;
}
}
} else {
}
if (0 == cmd_opt.cpp_opt_reserved) {
new_opt_list = malloc_vital((sizeof (char *)) *
(sizeof (char *)) * cmd_opt.cpp_opt_num);
}
}
return (0);
}
static void
{
}
--(cmd_opt.cpp_opt_num);
}
}
static void
{
(void) wait_child(0);
}
static char *
{
char *p;
char *pe;
path[0] = '\0';
return (strdup_vital(base_name));
} else {
return (NULL);
}
}
for (p = getenv("PATH"); p; ) {
if ((0 != dir_len) &&
dir_len += 1;
}
return (strdup_vital(path));
}
}
}
return (NULL);
}
static void
{
if (ITMC_STATUS_SUCCESS == status) {
gettext("Usage: %1$s [-n] [-f] [-q]\n"
" [-p preprocessor] [-W argument]\n"
" [-Dname] [-Dname=def] [-Idirectory] [-Uname]\n"
" [file ...]\n %2$s -h\n"),
} else {
(void) itm_error(
gettext("Usage: %1$s [-n] [-f] [-q]\n"
" [-p preprocessor] [-W argument]\n"
" [-Dname] [-Dname=def] [-Idirectory] [-Uname]\n"
" [file ...]\n %2$s -h\n"),
}
}
static char *
{
int i;
return (map_type_name[i].name);
}
}
return ("");
}
static void
{
char *oa;
char *oa_save;
char *name;
char *p;
char *phf;
int hash_factor = 0;
int i;
*(oa++) = '\0';
}
if (NULL == p) {
} else {
*(p++) = '\0';
if ('\0' == *p) {
} else {
*(phf++) = '\0';
if (hash_factor < 0) {
"invalid hash factor is "
"specified: %s\n"),
phf);
hash_factor = 0;
error_deferred += 1;
}
}
for (i = 0;
if (0 ==
break;
}
}
"unknown map type is specified: %s\n"),
p);
error_deferred += 1;
continue;
}
}
}
*name = '\0';
}
m = cmd_opt.map_name_type;
if (NULL == m) {
m = malloc_vital(sizeof (itmc_map_name_type_t));
m->hash_factor = hash_factor;
cmd_opt.map_name_type = m;
continue;
}
for (; ; m = m->next) {
m = NULL;
break;
}
if ('\0' == *name) {
"multiple default types are specified:"
" \"%1$s\" and \"%2$s\"\n"),
map_type_name_str(m->type));
} else {
gettext("map \"%1$s\" is specified as "
"two types \"%2$s\" and \"%3$s\"\n"),
name,
map_type_name_str(m->type));
}
error_deferred += 1;
m = NULL;
break;
}
break;
}
}
if (NULL != m) {
m = m->next;
m->hash_factor = hash_factor;
}
}
}
void *
{
void *p;
if (NULL == p) {
}
return (p);
}
static char *
{
char *p;
return (NULL);
}
p = malloc_vital(len);
return (p);
}
{
} else {
}
return (data);
}
char *
{
char *p;
p = gettext("(no name)");
} else {
}
len += 512;
}
} else {
}
return (ptr);
}
char *
{
static int index = 0;
char *hdp;
char *p;
long i;
int val;
}
} else {
}
} else {
}
hdp++;
val = (*p & 0x000f);
} else {
}
hdp++;
}
*hdp = '\0';
}
void
{
}
}
#if defined(ENABLE_TRACE)
static void
trace_option(void)
{
char **pp;
int i;
if (!(TRACE('o')))
return;
} else {
}
}
itm_error("output_file = %s\n",
itm_error("interpreter = %s\n",
}
} else {
}
itm_error("preprocess_default = %s\n",
"(no)");
itm_error("preprocess_specified = %s\n",
"(no)");
itm_error("preprocess = %s\n",
itm_error("disassemble = %s\n",
itm_error("map type =");
itm_error("\n");
} else {
itm_error(" ");
m = cmd_opt.map_name_type;
itm_error("%s=%s",
"default" : m->name),
map_type_name_str(m->type));
if (0 != m->hash_factor) {
} else {
}
itm_error(" %s=%s",
"default" : m->name),
map_type_name_str(m->type));
if (0 != m->hash_factor) {
} else {
}
}
}
itm_error("large table = %s\n",
itm_error("overwrite = %s\n",
itm_error("strip = %s\n",
itm_error("no_output = %s\n",
itm_error("trace = ");
itm_error("(no)\n");
} else {
for (i = 0x21; i < 0x7f; i++) {
if (TRACE(i)) {
}
}
}
}
#endif /* ENABLE_TRACE */
#if defined(ENABLE_TRACE)
extern void
{
}
#endif /* ENABLE_TRACE */