/*
* 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
*/
/*
* awk -- functions
*
* Copyright (c) 1995, 1996 by Sun Microsystems, Inc.
* All rights reserved.
*
* Copyright 1986, 1994 by Mortice Kern Systems Inc. All rights reserved.
*
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "awk.h"
#include "y.tab.h"
#include <time.h>
/*
* Return the value of exp(x).
* Usage: y = exp(x)
* y = exp()
*/
NODE *
{
}
/*
* Return the integer part of the argument.
* Usage: i = int(r)
* i = int()
*/
NODE *
{
}
/*
* Logarithm function.
* Usage: y = log(x)
* y = log()
*/
NODE *
{
}
/*
* Square root function.
* Usage: y = sqrt(x)
* y = sqrt()
*/
NODE *
{
}
/*
* Trigonometric sine function.
* Usage: y = sin(x)
*/
NODE *
{
}
/*
* Trigonometric cosine function.
* Usage: y = cos(x)
*/
NODE *
{
}
/*
* Arctangent of y/x.
* Usage: z = atan2(y, x)
*/
NODE *
{
double y, x;
}
/*
* Set the seed for the random number generator function -- rand.
* Usage: srand(x)
* srand()
*/
NODE *
{
if (na == 0)
}
/*
* Generate a random number.
* Usage: x = rand()
*/
NODE *
{
double result;
int expon;
}
/*
* Substitute function.
* Usage: n = sub(regex, replace, target)
* n = sub(regex, replace)
*/
NODE *
{
}
/*
* Global substitution function.
* Usage: n = gsub(regex, replace, target)
* n = gsub(regex, replace)
*/
NODE *
{
}
/*
* Do actual substitutions.
* `glob' is the number to substitute, 0 for all.
*/
static NODE *
{
register uint n;
if (na == 3) {
} else {
}
case REG_OK:
case REG_NOMATCH:
n = glob;
break;
case REG_ESPACE:
default:
}
}
/*
* Match function. Return position (origin 1) or 0 for regular
* expression match in string. Set new variables RSTART and RLENGTH
* as well.
* Usage: pos = match(string, re)
*/
NODE *
{
} else {
pos = 0;
length = -1;
}
}
/*
* Call shell or command interpreter.
* Usage: status = system(command)
*/
NODE *
{
int retcode;
}
/*
* Search for string within string.
* Usage: pos = index(string1, string2)
*/
NODE *
{
register int result;
result = 1;
break;
result++;
s1++;
l1--;
}
result = 0;
}
/*
* Return length of argument or $0
* Usage: n = length(string)
* n = length()
* n = length
*/
NODE *
{
if (na == 0)
}
/*
* Split string into fields.
* Usage: nfields = split(string, array [, separator]);
*/
NODE *
{
uint n;
wint_t c;
if (n == 3) {
} else
case ARRAY:
break;
case PARM:
break;
case VAR:
break;
default:
"second parameter to \"split\" must be an array"));
/*NOTREACHED*/
}
/*
* If an argument has been passed in to be used as the
* field separator check to see if it is a constant regular
* expression. If so, use it directly otherwise reduce the
* expression, convert the result into a string and assign it
* to "FS" (after saving the old value for FS.)
*/
} else {
}
}
/*
* Iterate over the record, extracting each field and assigning it to
* the corresponding element in the array.
*/
fcount = 0;
for (;;) {
if (fcount == 0) {
}
break;
}
c = *ep;
*ep = '\0';
*ep = c;
}
/*
*/
if (old_awkfield != 0) {
} else {
}
}
if (saved)
}
/*
* Sprintf function.
* Usage: string = sprintf(format, arg, ...)
*/
NODE *
{
return (np);
}
/*
* Substring.
* newstring = substr(string, start, [length])
*/
NODE *
{
register size_t n;
register int start;
start = 0;
if (n == 3) {
int x;
if (x < 0)
len = 0;
else
} else
if (start > n)
start = n;
n -= start;
if (len > n)
len = n;
return (np);
}
/*
* Close an output or input file stream.
*/
NODE *
{
register char *name;
break;
}
return (const1);
return (const0);
}
/*
* Return the integer value of the first character of a string.
* Usage: char = ord(string)
*/
NODE *
{
}
/*
* Return the argument string in lower case:
* Usage:
* lower = tolower(upper)
*/
NODE *
{
}
/*
* Return the argument string in upper case:
* Usage:
* upper = toupper(lower)
*/
NODE *
{
}
/*
* Sort the array into traversal order by the next "for (i in array)" loop.
* Usage:
* asort(array, "cmpfunc")
* cmpfunc(array, index1, index2)
* returns:
* <0 if array[index1] < array[index2]
* 0 if array[index1] == array[index2]
* >0 if array[index1] > array[index2]
*/
NODE *
{
s_asort);
/*
* Count size of array, allowing one extra for NULL at end
*/
nel = 1;
++nel;
/*
* Create UFUNC node that points at the funcnp on left and the
* list of three variables on right (array, index1, index2)
* UFUNC
* / \
* funcnp COMMA
* / \
* array COMMA
* / \
* index1 index2
*/
running = 0;
running = 1;
}
/*
* Copy array into alist.
*/
/*
* Re-order array to this list
*/
do {
return (constundef);
}
/*
* Return the number of arguments of a function.
*/
static uint
{
register int n;
return (0);
n = 1;
n++;
}
return (n);
}
/*
* Do case translation.
*/
static NODE *
{
register int c;
if (upper) {
while ((c = *cp++) != '\0')
} else {
while ((c = *cp++) != '\0')
}
}
/*
* The comparison routine used by qsort inside f_asort()
*/
static int
{
}
#if M_MATHERR
/* So it won't optimize registers our FP is using */
#else
#define flushesbx() (0)
#endif
/*
* Math error for awk.
*/
int
{
if (first_time) {
first_time = 0;
}
type = 0;
" error in function %s(%g) at NR=%lld\n"),
return (1);
}
#endif /*M_MATHERR*/