mms_par_util.c revision cee0fb94c0d4227de0a00efc162fb2739844b641
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <synch.h>
#include <mms_list.h>
#include <mms_sym.h>
#include <mms_parser.h>
#include <mms_par_impl.h>
#include <mms_sym.h>
#include <msg_sub.h>
#include <mms_trace.h>
int mms_symtab_initialized = 0;
extern mutex_t mms_par_mutex;
#define MMS_FUZZ 5
/*
* Translate chars &, <. >, " and ' to xml mms_escape sequence
*/
typedef struct mms_escape_seq {
char *es_char;
char *es_seq;
int es_len;
/* from complaining */
static mms_escape_seq_t mms_esseq[] = {
};
static void
{
int i;
for (i = 0; i < level; i++) {
line[i] = ' ';
}
}
void
{
}
}
void
{
}
}
void
{
}
{
return (NULL);
}
return (NULL);
}
return (node);
}
void
{
return;
}
}
}
}
/*
* mms_pn_len_xml - return the length needed to convert this node to text
*/
int
{
int len = 0;
int i, j;
char *str;
switch (mms_pn_type(node)) {
case MMS_PN_CMD:
break;
case MMS_PN_OPS:
break;
case MMS_PN_CLAUSE:
break;
case MMS_PN_RANGE:
break;
case MMS_PN_OBJ:
break;
case MMS_PN_ATTR:
break;
case MMS_PN_STRING:
break;
case MMS_PN_NUMERIC | MMS_PN_STRING:
break;
case MMS_PN_NULLSTR | MMS_PN_STRING:
break;
case MMS_PN_KEYWORD:
break;
default:
len += 1;
break;
}
for (j = 0; j < mms_num_esseq; j++) {
len += 10;
}
}
}
}
/*
* mms_pn_cmd_len_xml - return the length needed to convert this node
* and the list of nodes attached to this node.
*/
int
{
return (mms_pn_cmd_len_xml_aux(top, 0));
}
static int
{
int len;
}
return (len);
}
/*
* par_node_to_text_start - convert the beginning part of this node
*/
static int
{
char *text;
switch (mms_pn_type(node)) {
case MMS_PN_CMD:
break;
case MMS_PN_OPS:
break;
case MMS_PN_CLAUSE:
break;
case MMS_PN_RANGE:
break;
case MMS_PN_OBJ:
break;
case MMS_PN_ATTR:
break;
case MMS_PN_STRING:
text = "\n****** OUT OF MEMORY ******\n\n";
}
"<arg value=\"%s\"/>\n", text);
break;
case MMS_PN_KEYWORD:
case MMS_PN_NULLSTR | MMS_PN_STRING:
break;
case MMS_PN_NUMERIC | MMS_PN_STRING:
break;
default:
break;
}
}
/*
* par_node_to_text_end - terminate the converted text.
*/
static int
{
switch (mms_pn_type(node)) {
case MMS_PN_CMD:
break;
case MMS_PN_OPS:
break;
case MMS_PN_CLAUSE:
break;
case MMS_PN_RANGE:
break;
case MMS_PN_OBJ:
break;
case MMS_PN_ATTR:
break;
case MMS_PN_STRING:
break;
case MMS_PN_KEYWORD:
break;
case MMS_PN_NUMERIC | MMS_PN_STRING:
break;
}
}
/*
* mms_pn_build_cmd_xml - convert a node structure to a line of text
*/
char *
{
int len;
int off;
char *prolog = "<?xml version=\"1.0\"?>\n";
char *buf;
return (NULL);
}
return (buf);
}
static int
{
int len = 0;
return (0);
line[0] = '\0';
size);
}
return (len);
}
char *
{
int len = 0;
char *line;
return (NULL);
}
line[0] = '\0';
return (line);
}
int
{
int len;
len--;
}
} else {
size);
}
}
return (len);
}
int
{
int len;
}
return (len);
}
int
{
int len = 0;
switch (mms_pn_type(node)) {
case MMS_PN_CMD:
len += 2;
break;
case MMS_PN_OPS:
len += 3;
break;
case MMS_PN_CLAUSE:
len += 3;
break;
case MMS_PN_OBJ:
len += 1;
break;
case MMS_PN_ATTR:
len += 4;
break;
case MMS_PN_STRING:
len += 3;
break;
case MMS_PN_NUMERIC | MMS_PN_STRING:
len += 3;
break;
case MMS_PN_NULLSTR | MMS_PN_STRING:
len += 3;
break;
case MMS_PN_KEYWORD:
len += 3;
break;
default:
len += 1;
break;
}
}
static int
{
switch (mms_pn_type(node)) {
case MMS_PN_CMD:
break;
case MMS_PN_OPS:
else
break;
case MMS_PN_CLAUSE:
else
break;
case MMS_PN_OBJ:
break;
case MMS_PN_ATTR:
break;
case MMS_PN_STRING:
break;
case MMS_PN_KEYWORD:
break;
case MMS_PN_NUMERIC | MMS_PN_STRING:
break;
case MMS_PN_RANGE:
break;
}
}
static int
{
switch (mms_pn_type(node)) {
case MMS_PN_CMD:
break;
case MMS_PN_OPS:
break;
case MMS_PN_CLAUSE:
break;
case MMS_PN_OBJ:
break;
case MMS_PN_ATTR:
/* Back up over blank following object name */
break;
case MMS_PN_STRING:
break;
case MMS_PN_KEYWORD:
break;
case MMS_PN_NUMERIC | MMS_PN_STRING:
break;
case MMS_PN_NULLSTR | MMS_PN_STRING:
break;
case MMS_PN_RANGE:
break;
default:
break;
}
}
{
/* first time */
} else {
}
/* Found a matching start */
}
return (start);
}
}
/*
* No matching node
*/
return (NULL);
}
{
int self = 1;
return (NULL);
}
self = 0;
}
}
/*
* Go up 1 level and get the next node to start
*/
}
} else {
}
/*
* No more node at this level
*/
continue;
}
self = 1;
/*
* Found a matching node
*/
break;
}
}
}
return (node);
}
static mms_par_node_t *
int self)
{
return (NULL);
}
/*
* Start from the start node
*/
if (self == 1) {
/*
* Do self check
*/
/* found a matching node */
return (start);
}
}
/*
* Already did self check, don't do it again
*/
self = 0;
}
/*
* Check each of the attributes of this node.
*/
/*
* Have a new start node, do self check on this one
*/
self = 1;
}
self);
/* found a matching node */
return (result);
}
/*
* Do self check from now on
*/
self = 1;
}
}
/*
* Start search of arglist
*/
/*
* Have a new start node, do self check on this one
*/
self = 1;
}
/* found a matching node */
return (result);
}
/*
* Do self check from now on
*/
self = 1;
}
/*
* Can't find a matching node.
*/
return (NULL);
}
{
/*
* Look in parser dependent table first
*/
return (syment);
}
return (syment);
}
} else {
return (syment);
}
return (syment);
}
}
return (NULL);
}
char *
mms_par_char_to_xml_escape(char *src)
{
int out_incr;
int out_len;
int out_off;
char *out;
int in_len;
int in_off;
char *in;
int esc_len;
int i;
in_off = 0;
out_off = 0;
return (NULL);
}
out_incr = 1;
for (i = 0; i < mms_num_esseq; i++) {
break;
}
}
if (i == mms_num_esseq) {
/* No need to mms_escape */
} else {
/* mms_escape this char */
/*
* If output buf cannot hold the remaining
* input and the escapeext length, then
* get more space
*/
char *new;
return (NULL);
}
}
}
}
return (out);
}
char *
mms_par_xml_escape_to_char(char *src)
{
int out_len;
int out_off;
char *out;
int in_incr;
int in_len;
int in_off;
char *in;
int esc_len;
int i;
in_off = 0;
out_off = 0;
return (NULL);
}
in_incr = 1;
for (i = 0; i < mms_num_esseq; i++) {
== 0) {
break;
}
}
if (i == mms_num_esseq) {
/* No need to mms_escape */
} else {
/* found an mms_escape sequence */
}
}
return (out);
}
void
{
char msgtext[500];
/*
* Do this only once.
*/
wka->par_wka_err_count++;
if (wka->par_wka_error == 0) {
return;
}
}
if (wka->par_wka_error == 0) {
}
}
void
{
}
}
void
{
/*
* Check each of the attributes of this node.
*/
}
/*
* Check each of the arguements of this node.
*/
}
}