/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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) 2014 Gary Mills
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
/* $Id: attribute.c 157 2006-04-26 15:07:55Z ktou $ */
/*LINTLIBRARY*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <alloca.h>
#include <papi.h>
#include <regex.h>
/*
* Assuming the maximum number of pages in
* a document to be 32767
*/
static void
{
switch (type) {
case PAPI_STRING:
break;
case PAPI_COLLECTION:
int i;
}
break;
default: /* don't need to free anything extra */
break;
}
}
}
static void
{
int i;
}
}
static void
{
}
}
void
{
int i;
papiAttributeFree(list[i]);
}
}
static papi_attribute_t **
{
/* allows a NULL collection that is "empty" or "no value" */
if (collection != NULL) {
int i;
i++) {
papi_attribute_t *a = collection[i];
NULL);
int j;
&result,
a->values[j]);
}
}
}
}
return (result);
}
static papi_attribute_value_t *
{
switch (type) {
case PAPI_STRING:
} else
break;
case PAPI_INTEGER:
break;
case PAPI_BOOLEAN:
break;
case PAPI_RANGE:
break;
case PAPI_RESOLUTION:
break;
case PAPI_DATETIME:
break;
case PAPI_COLLECTION:
break;
case PAPI_METADATA:
break;
default: /* unknown type, fail to duplicate */
}
}
return (result);
}
static papi_attribute_t *
{
}
return (result);
}
static papi_status_t
{
return (PAPI_BAD_ARGUMENT);
return (PAPI_TEMPORARY_ERROR);
}
return (PAPI_OK);
}
{
return (PAPI_BAD_ARGUMENT);
return (PAPI_BAD_ARGUMENT); /* RANGE must have min <= max */
if (flags == 0) /* if it wasn't set, set a default behaviour */
/* look for an existing one */
return (PAPI_CONFLICT); /* EXISTS */
return (PAPI_CONFLICT); /* TYPE CONFLICT */
/* if we don't have one, create it and add it to the list */
/* if we don't have one by now, it's most likely an alloc fail */
return (PAPI_TEMPORARY_ERROR);
/*
* if we are replacing, clear any existing values, but don't free
* until after we have replaced the values, in case we are replacing
* a collection with a relocated version of the original collection.
*/
}
/* free old values if we replaced them */
return (result);
}
{
}
{
}
{
}
{
}
{
PAPI_RESOLUTION, &v));
}
{
PAPI_DATETIME, &v));
}
{
PAPI_COLLECTION, &v));
}
{
PAPI_METADATA, &v));
}
{
return (PAPI_BAD_ARGUMENT);
return (PAPI_NOT_FOUND);
return (PAPI_OK);
}
{
int i;
return (NULL);
return ((papi_attribute_t *)list[i]);
return (NULL);
}
{
return (NULL);
return (result);
}
{
return (PAPI_BAD_ARGUMENT);
return (PAPI_NOT_FOUND);
return (PAPI_NOT_POSSIBLE);
} else
return (PAPI_NOT_FOUND);
return (PAPI_GONE);
return (PAPI_OK);
}
{
return (PAPI_BAD_ARGUMENT);
PAPI_STRING, &value);
return (status);
}
{
return (PAPI_BAD_ARGUMENT);
PAPI_INTEGER, &value);
return (status);
}
{
return (PAPI_BAD_ARGUMENT);
PAPI_BOOLEAN, &value);
return (status);
}
{
return (PAPI_BAD_ARGUMENT);
PAPI_RANGE, &value);
}
return (status);
}
char *name, int *x, int *y,
{
return (PAPI_BAD_ARGUMENT);
PAPI_RESOLUTION, &value);
}
return (status);
}
{
return (PAPI_BAD_ARGUMENT);
PAPI_DATETIME, &value);
}
return (status);
}
{
if (collection == NULL)
return (PAPI_BAD_ARGUMENT);
PAPI_COLLECTION, &value);
}
return (status);
}
{
return (PAPI_BAD_ARGUMENT);
PAPI_METADATA, &value);
return (status);
}
/* The string is modified by this call */
static char *
{
}
return (result);
}
static papi_attribute_value_type_t
{
int i;
static struct {
char *expression;
int compiled;
} types[] = {
/* PAPI_DATETIME is unsupported, too much like an integer */
0 },
};
for (i = 0; i < 5; i++) {
int j;
}
matches, 0) == REG_NOMATCH)
continue;
}
return (PAPI_STRING);
}
static void
{
switch(type) {
case PAPI_STRING:
break;
case PAPI_BOOLEAN:
break;
case PAPI_INTEGER:
break;
case PAPI_RANGE:
if (dtype == PAPI_INTEGER) {
/*
* Handles -P -x case
* which prints from page number 1
* till page number x
*/
} else {
}
} else if (dtype == PAPI_RANGE) {
/*
* Imposing an artificial limit on
* the upper bound for page range.
*/
}
}
break;
case PAPI_RESOLUTION:
else
break;
case PAPI_COLLECTION:
break;
}
}
static papi_status_t
{
int i;
/* these are specified in the papi spec as ranges */
"job-k-octets-supported",
"job-media-sheets-supported", "page-ranges",
NULL };
return (PAPI_TEMPORARY_ERROR);
/* these are known ranges */
break;
}
}
}
return (result);
}
static papi_status_t
{
char *ptr;
return (PAPI_BAD_ARGUMENT);
return (PAPI_TEMPORARY_ERROR);
/* strip any leading whitespace */
ptr++;
/* Get the name: name[=value] */
ptr++;
if (*ptr == '=') {
*ptr++ = '\0';
char q = *ptr++;
/* quoted string value */
ptr++;
if (*ptr == q)
ptr++;
} else if (*ptr == '{') {
/* collection */
ptr++;
if (*ptr == '}')
ptr++;
} else {
/* value */
while ((*ptr != '\0') &&
(*ptr != ',') &&
ptr++;
}
if (*ptr == ',')
*ptr++ = '\0';
}
} else { /* boolean "[no]key" */
key += 2;
value = "false";
}
}
if (*ptr != '\0')
*ptr++ = '\0';
}
return (result);
}
{
== 0)) {
} else {
}
return (result);
}
static papi_status_t
{
int rc, i;
else
}
} else {
}
return (PAPI_OK);
case PAPI_STRING:
break;
case PAPI_INTEGER: {
}
break;
case PAPI_BOOLEAN:
break;
case PAPI_RANGE: {
else
}
break;
case PAPI_RESOLUTION: {
? 'c' : 'i'));
}
break;
case PAPI_DATETIME: {
}}
break;
case PAPI_COLLECTION: {
}
break;
default: {
}
}
return (PAPI_NOT_POSSIBLE);
}
return (PAPI_OK);
}
{
int i;
return (PAPI_BAD_ARGUMENT);
buffer[0] = '\0';
if (!delim)
delim = " ";
}
return (status);
}
static int
{
int i;
return (0);
}
return (1);
}
static papi_status_t
{
int i = 0;
return (PAPI_BAD_ARGUMENT);
i++;
return (status);
}
void
{
int i;
return;
for (i = 0; attributes[i] != NULL; i++)
}
void
{
int i;
return;
for (i = 0; attributes[i] != NULL; i++)
else
}
void
char *prefix_fmt, ...)
{
void *mem;
size += 1024;
}
if (attributes) {
size = 0;
size += 1024;
}
}
}