tran.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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 2.13 */
#define DEBUG
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "awk.h"
#include "y.tab.h"
syminit()
{
int i;
for (i = 1; i < MAXFLD; i++) {
}
/* this is used for if(x)... tests: */
/* recloc = setsymtab("$0", record, 0.0, REC|STR|DONTFREE, symtab); */
}
int ac;
{
Array *makesymtab();
int i;
break;
}
for (i = 0; i < ac; i++) {
else
av++;
}
}
{
Array *makesymtab();
uchar *p;
continue;
*p++ = 0; /* split into two strings at = */
if (isnumber(p))
else
p[-1] = '='; /* restore in case env is passed down to a shell */
}
}
Array *makesymtab(n)
int n;
{
return(ap);
}
{
int i;
return;
return;
}
}
}
uchar *s;
{
int h;
else /* middle somewhere */
if (freeable(p))
free(p);
return;
}
}
uchar *n, *s;
Awkfloat f;
unsigned t;
{
register int h;
register Cell *p;
return(p);
}
if (p == NULL)
p->fval = f;
p->tval = t;
p->csub = 0;
return(p);
}
hash(s, n) /* form hash value for string s */
register uchar *s;
int n;
{
register unsigned hashval;
for (hashval = 0; *s != '\0'; s++)
return hashval % n;
}
{
}
}
}
register uchar *s;
{
int h;
return(p); /* found it */
return(NULL); /* not found */
}
Awkfloat f;
{
donerec = 0; /* mark $0 invalid */
donefld = 0; /* mark $1... invalid */
donerec = 1;
}
}
char *rw;
{
ERROR "funny variable %o: n=%s s=\"%s\" f=%g t=%o",
}
uchar *s;
{
donerec = 0; /* mark $0 invalid */
donefld = 0; /* mark $1... invalid */
donerec = 1;
}
}
{
/* if (vp->tval & ARR)
ERROR "illegal reference to array %s", vp->nval FATAL;
return 0.0; */
fldbld();
recbld();
}
}
{
uchar s[100];
/* if (vp->tval & ARR)
ERROR "illegal reference to array %s", vp->nval FATAL;
return ""; */
fldbld();
recbld();
else
}
}
register uchar *s;
{
register uchar *p;
if (p == NULL)
strcpy((char *) p, (char *) s);
return(p);
}
uchar *s;
int delim;
{
uchar *q;
int c, n;
else if (c == '\n')
else if (c != '\\')
*q++ = c;
else /* \something */
switch (c = *++s) {
case '\\': *q++ = '\\'; break;
case 'n': *q++ = '\n'; break;
case 't': *q++ = '\t'; break;
case 'b': *q++ = '\b'; break;
case 'f': *q++ = '\f'; break;
case 'r': *q++ = '\r'; break;
default:
if (!isdigit(c)) {
*q++ = c;
break;
}
n = c - '0';
if (isdigit(s[1])) {
n = 8 * n + *++s - '0';
if (isdigit(s[1]))
n = 8 * n + *++s - '0';
}
*q++ = n;
break;
}
}
*q = '\0';
return cbuf;
}