示例#1
0
void
fz_debugtree(fz_tree *tree)
{
    printf("<tree>\n");
    xmlnode(tree->root, 1);
    printf("</tree>\n");
}
示例#2
0
static void xmlmask(fz_masknode *node, int level)
{
    fz_node *child;
    indent(level);
    printf("<mask>\n");
    for (child = node->super.first; child; child = child->next)
        xmlnode(child, level + 1);
    indent(level);
    printf("</mask>\n");
}
示例#3
0
static void xmlover(fz_overnode *node, int level)
{
    fz_node *child;
    indent(level);
    printf("<over>\n");
    for (child = node->super.first; child; child = child->next)
        xmlnode(child, level + 1);
    indent(level);
    printf("</over>\n");
}
示例#4
0
static void xmltransform(fz_transformnode *node, int level)
{
    indent(level);
    printf("<transform matrix=\"%g %g %g %g %g %g\">\n",
           node->m.a, node->m.b,
           node->m.c, node->m.d,
           node->m.e, node->m.f);
    xmlnode(node->super.first, level + 1);
    indent(level);
    printf("</transform>\n");
}
示例#5
0
static void xmlblend(fz_blendnode *node, int level)
{
    fz_node *child;
    indent(level);
    printf("<blend mode=\"%d\" isolated=\"%d\" knockout=\"%d\">\n",
           node->mode, node->isolated, node->knockout);
    for (child = node->super.first; child; child = child->next)
        xmlnode(child, level + 1);
    indent(level);
    printf("</blend>\n");
}
示例#6
0
signed xmlscan (NODE * node) 

{
	NODE * section = node;
	NODE * element;
	NODE * attribute;
	NODE * value;
	char prefix = (char)(0);
	char suffix = (char)(0);
	char * string = node->text;
	unsigned lineno = 1;
	if (!section) 
	{
		error (1, EFAULT, "section is null");
	}
	if (!string) 
	{
		error (1, EFAULT, "string is null");
	}
	while (*string) 
	{
		if (*string == '<') 
		{
			prefix = '<';
			suffix = '>';
			string = discard (string, &lineno);
			if ((*string == '/') || (*string == '?') || (*string == '!')) 
			{
				prefix = *string;
				string = discard (string, &lineno);
			}
			element = xmlnode (section);
			element->line = lineno;
			element->type = NODE_ELEM;
			element->text = string;
			if (isalpha (*string)) 
			{
				string = nmtoken (string);
			}
			else if (*string == '-') 
			{
				string = comment (string, &lineno);
			}
			else if (*string == '[') 
			{
				string = context (string, ']', &lineno);
			}
			else 
			{
				string = collect (string);
			}
			string = advance (string, &lineno);
			while ((*string) && (*string != '<') && (*string != '/') && (*string != '?') && (*string != '>')) 
			{
				attribute = xmlnode (element);
				attribute->line = lineno;
				attribute->type = NODE_ATTR;
				attribute->text = string;
				if (isalpha (*string)) 
				{
					string = nmtoken (string);
				}
				else if (*string == '-') 
				{
					string = comment (string, &lineno);
				}
				else if (*string == '[') 
				{
					string = context (string, ']', &lineno);
				}
				else if ((*string == '\"') || (*string == '\'')) 
				{
					string = content (string, *string, &lineno);
					attribute->text++;
				}
				else 
				{
					string = collect (string);
				}
				string = advance (string, &lineno);
				if (*string == '=') 
				{
					string = discard (string, &lineno);
					value = xmlnode (attribute);
					value->line = lineno;
					value->type = NODE_VALU;
					value->text = string;
					if ((*string == '\"') || (*string == '\'')) 
					{
						string = content (string, *string, &lineno);
						value->text++;
					}
					else 
					{
						string = collect (string);
					}
					string = advance (string, &lineno);
				}
			}
			if ((*string == '/') || (*string == '?')) 
			{
				suffix = *string;
				string = discard (string, &lineno);
			}
		}
		else if (*string == '>') 
		{
			string = discard (string, &lineno);
			if (prefix == '!') 
			{
				element->type = NODE_SGML;
			}
			else if (prefix == '?') 
			{
				element->type = NODE_INST;
			}
			else if (suffix == '?') 
			{
			}
			else if (prefix == '/') 
			{
				element->type = NODE_ETAG;
				if (element->below) 
				{
					error (1, 0, "Element </%s> on line %d has attributes or content.", element->text, element->line);
				}
				if (strcmp (section->text, element->text)) 
				{
					error (1, 0, "Element <%s> on line %d teminated by </%s> on line %d", section->text, section->line, element->text, element->line);
				}
				if (section->above) 
				{
					section = section->above;
				}
			}
			else if (suffix == '/') 
			{
			}
			else 
			{
				section = element;
			}
		}
		else 
		{
			signed space = 0;
			char * output = string;
			NODE * segment = xmlnode (section);
			segment->line = lineno;
			segment->type = NODE_DATA;
			segment->text = string;
			while (*string) 
			{
				if (*string == '<') 
				{
					break;
				}
				if (isspace (*string)) 
				{
					string = advance (string, &lineno);
					space++;
					continue;
				}
				if (space) 
				{
					*output++ = ' ';
					space--;
				}
				*output++ = *string++;
			}
			if (output < string) 
			{
				*output = (char)(0);
			}
		}
	}
	return (0);
}
示例#7
0
void
fz_debugnode(fz_node *node)
{
    xmlnode(node, 0);
}