예제 #1
0
파일: v1.c 프로젝트: ARSekkat/gpac
void generateNodeImpl(FILE *output, SVGGenElement* svg_elt)
{
	u32 i;

	/***************************************************/
	/*				Constructor						   */
	/***************************************************/
	fprintf(output, "void *gf_svg_new_%s()\n{\n\tSVG_SA_%sElement *p;\n", svg_elt->implementation_name,svg_elt->implementation_name);
	fprintf(output, "\tGF_SAFEALLOC(p, SVG_SA_%sElement);\n\tif (!p) return NULL;\n\tgf_node_setup((GF_Node *)p, TAG_SVG_%s);\n\tgf_sg_parent_setup((GF_Node *) p);\n",svg_elt->implementation_name,svg_elt->implementation_name);

	fprintf(output, "\tgf_svg_sa_init_core((SVG_SA_Element *)p);\n");
	if (svg_elt->has_properties ||
	        svg_elt->has_media_properties ||
	        svg_elt->has_opacity_properties) {
		fprintf(output, "\tgf_svg_sa_init_properties((SVG_SA_Element *)p);\n");
	}
	if (svg_elt->has_focus) {
		fprintf(output, "\tgf_svg_sa_init_focus((SVG_SA_Element *)p);\n");
	}
	if (svg_elt->has_xlink) {
		fprintf(output, "\tgf_svg_sa_init_xlink((SVG_SA_Element *)p);\n");
	}
	if (svg_elt->has_timing) {
		fprintf(output, "\tgf_svg_sa_init_timing((SVG_SA_Element *)p);\n");
	}
	if (svg_elt->has_sync) {
		fprintf(output, "\tgf_svg_sa_init_sync((SVG_SA_Element *)p);\n");
	}
	if (svg_elt->has_animation) {
		fprintf(output, "\tgf_svg_sa_init_anim((SVG_SA_Element *)p);\n");
	}
	if (svg_elt->has_conditional) {
		fprintf(output, "\tgf_svg_sa_init_conditional((SVG_SA_Element *)p);\n");
	}

	if (svg_elt->has_transform) {
		fprintf(output, "\tgf_mx2d_init(p->transform.mat);\n");
	}

	if (!strcmp(svg_elt->implementation_name, "conditional")) {
		fprintf(output, "\tgf_svg_sa_init_lsr_conditional(&p->updates);\n");
		fprintf(output, "\tgf_svg_sa_init_timing((SVG_SA_Element *)p);\n");

	}

	for (i = 0; i < gf_list_count(svg_elt->attributes); i++) {
		SVGGenAttribute *att = gf_list_get(svg_elt->attributes, i);
		/* Initialization of complex types */
		if ( !strcmp("SVG_Points", att->impl_type) ||
		        !strcmp("SVG_Coordinates", att->impl_type) ||
		        !strcmp("SMIL_KeyPoints", att->impl_type)) {
			fprintf(output, "\tp->%s = gf_list_new();\n", att->implementation_name);
		} else if (!strcmp("SVG_PathData", att->impl_type) && !strcmp(svg_elt->svg_name, "animateMotion")) {
			fprintf(output, "#ifdef USE_GF_PATH\n");
			fprintf(output, "\tgf_path_reset(&p->path);\n");
			fprintf(output, "#else\n");
			fprintf(output, "\tp->path.commands = gf_list_new();\n");
			fprintf(output, "\tp->path.points = gf_list_new();\n");
			fprintf(output, "#endif\n");
		} else if (!strcmp("SVG_PathData", att->impl_type)) {
			fprintf(output, "#ifdef USE_GF_PATH\n");
			fprintf(output, "\tgf_path_reset(&p->d);\n");
			fprintf(output, "#else\n");
			fprintf(output, "\tp->d.commands = gf_list_new();\n");
			fprintf(output, "\tp->d.points = gf_list_new();\n");
			fprintf(output, "#endif\n");
		} else if (!strcmp(att->svg_name, "lsr:enabled")) {
			fprintf(output, "\tp->lsr_enabled = 1;\n");
		}
	}
	/*some default values*/
	if (!strcmp(svg_elt->svg_name, "svg")) {
		fprintf(output, "\tp->width.type = SVG_NUMBER_PERCENTAGE;\n");
		fprintf(output, "\tp->width.value = INT2FIX(100);\n");
		fprintf(output, "\tp->height.type = SVG_NUMBER_PERCENTAGE;\n");
		fprintf(output, "\tp->height.value = INT2FIX(100);\n");
	}
	else if (!strcmp(svg_elt->svg_name, "solidColor")) {
		fprintf(output, "\tp->properties->solid_opacity.value = FIX_ONE;\n");
	}
	else if (!strcmp(svg_elt->svg_name, "stop")) {
		fprintf(output, "\tp->properties->stop_opacity.value = FIX_ONE;\n");
	}
	else if (!strcmp(svg_elt->svg_name, "linearGradient")) {
		fprintf(output, "\tp->x2.value = FIX_ONE;\n");
		fprintf(output, "\tgf_mx2d_init(p->gradientTransform.mat);\n");
	}
	else if (!strcmp(svg_elt->svg_name, "radialGradient")) {
		fprintf(output, "\tp->cx.value = FIX_ONE/2;\n");
		fprintf(output, "\tp->cy.value = FIX_ONE/2;\n");
		fprintf(output, "\tp->r.value = FIX_ONE/2;\n");
		fprintf(output, "\tgf_mx2d_init(p->gradientTransform.mat);\n");
		fprintf(output, "\tp->fx.value = FIX_ONE/2;\n");
		fprintf(output, "\tp->fy.value = FIX_ONE/2;\n");
	}
	else if (!strcmp(svg_elt->svg_name, "video") || !strcmp(svg_elt->svg_name, "audio") || !strcmp(svg_elt->svg_name, "animation")) {
		fprintf(output, "\tp->timing->dur.type = SMIL_DURATION_MEDIA;\n");
	}
	fprintf(output, "\treturn p;\n}\n\n");

	/***************************************************/
	/*                     Destructor                  */
	/***************************************************/
	fprintf(output, "static void gf_svg_sa_%s_del(GF_Node *node)\n{\n", svg_elt->implementation_name);
	fprintf(output, "\tSVG_SA_%sElement *p = (SVG_SA_%sElement *)node;\n", svg_elt->implementation_name, svg_elt->implementation_name);

	fprintf(output, "\tgf_svg_sa_reset_base_element((SVG_SA_Element *)p);\n");

	if (!strcmp(svg_elt->implementation_name, "conditional")) {
		fprintf(output, "\tgf_svg_sa_reset_lsr_conditional(&p->updates);\n");
	}
	else if (!strcmp(svg_elt->implementation_name, "a")) {
		fprintf(output, "\tif (p->target) free(p->target);\n");
	}

	for (i = 0; i < gf_list_count(svg_elt->attributes); i++) {
		SVGGenAttribute *att = gf_list_get(svg_elt->attributes, i);
		if (!strcmp("SMIL_KeyPoints", att->impl_type)) {
			fprintf(output, "\tgf_smil_delete_key_types(p->%s);\n", att->implementation_name);
		} else if (!strcmp("SVG_Coordinates", att->impl_type)) {
			fprintf(output, "\tgf_svg_delete_coordinates(p->%s);\n", att->implementation_name);
		} else if (!strcmp("SVG_Points", att->impl_type)) {
			fprintf(output, "\tgf_svg_delete_points(p->%s);\n", att->implementation_name);
		} else if (!strcmp("SVG_PathData", att->impl_type)) {
			if (!strcmp(svg_elt->svg_name, "animateMotion")) {
				fprintf(output, "\tgf_svg_reset_path(p->path);\n");
			} else {
				fprintf(output, "\tgf_svg_reset_path(p->d);\n");
			}
		} else if (!strcmp("XMLRI", att->impl_type)) {
			fprintf(output, "\tgf_svg_reset_iri(node->sgprivate->scenegraph, &p->%s);\n", att->implementation_name);
		} else if (!strcmp("SVG_FontFamily", att->impl_type)) {
			fprintf(output, "\tif (p->%s.value) free(p->%s.value);\n", att->implementation_name, att->implementation_name);
		} else if (!strcmp("SVG_String", att->impl_type) || !strcmp("SVG_ContentType", att->impl_type)) {
			fprintf(output, "\tfree(p->%s);\n", att->implementation_name);
		}
	}
	if (svg_elt->has_transform) {
		fprintf(output, "\tif (p->motionTransform) free(p->motionTransform);\n");
	}

	fprintf(output, "\tgf_sg_parent_reset((GF_Node *) p);\n");
	fprintf(output, "\tgf_node_free((GF_Node *)p);\n");
	fprintf(output, "}\n\n");

	/***************************************************/
	/*				Attribute Access				   */
	/***************************************************/
	fprintf(output, "static GF_Err gf_svg_sa_%s_get_attribute(GF_Node *node, GF_FieldInfo *info)\n{\n", svg_elt->implementation_name);
	fprintf(output, "\tswitch (info->fieldIndex) {\n");
	svg_elt->nb_atts = 0;
	svg_elt->nb_atts = generateCoreInfo(output, svg_elt, svg_elt->nb_atts);

	if (svg_elt->has_media_properties)
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 2, "((SVG_SA_Element *)node)->properties->", svg_elt->nb_atts);
	if (svg_elt->has_properties)
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 1, "((SVG_SA_Element *)node)->properties->", svg_elt->nb_atts);
	if (svg_elt->has_opacity_properties)
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 3, "((SVG_SA_Element *)node)->properties->", svg_elt->nb_atts);
	if (svg_elt->has_focus)
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 4, "((SVG_SA_Element *)node)->focus->", svg_elt->nb_atts);
	if (svg_elt->has_xlink)
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 5, "((SVG_SA_Element *)node)->xlink->", svg_elt->nb_atts);
	if (svg_elt->has_timing)
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 6, "((SVG_SA_Element *)node)->timing->", svg_elt->nb_atts);
	if (svg_elt->has_sync)
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 7, "((SVG_SA_Element *)node)->sync->", svg_elt->nb_atts);
	if (svg_elt->has_animation)
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 8, "((SVG_SA_Element *)node)->anim->", svg_elt->nb_atts);
	if (svg_elt->has_conditional)
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 9, "((SVG_SA_Element *)node)->conditional->", svg_elt->nb_atts);
	if (svg_elt->has_transform) {
		svg_elt->nb_atts = generateTransformInfo(output, svg_elt, svg_elt->nb_atts);
		svg_elt->nb_atts = generateMotionTransformInfo(output, svg_elt, svg_elt->nb_atts);
	}
	if (svg_elt->has_xy)
		svg_elt->nb_atts = generateXYInfo(output, svg_elt, svg_elt->nb_atts);

	for (i = 0; i < gf_list_count(svg_elt->attributes); i++) {
		SVGGenAttribute *att = gf_list_get(svg_elt->attributes, i);
		generateAttributeInfo(output, svg_elt->implementation_name, att, svg_elt->nb_atts++);
	}
	fprintf(output, "\t\tdefault: return GF_BAD_PARAM;\n\t}\n}\n\n");

	/***************************************************/
	/*	gf_svg_sa_%s_get_attribute_index_from_name		   */
	/***************************************************/
	fprintf(output, "s32 gf_svg_sa_%s_get_attribute_index_from_name(char *name)\n{\n", svg_elt->implementation_name);
	{
		u32 att_index = 0;
		fprintf(output, "\tif(!strcmp(\"id\", name)) return %d;\n", att_index);
		att_index++;
		fprintf(output, "\tif(!strcmp(\"xml:id\", name)) return %d;\n", att_index);
		att_index++;
		fprintf(output, "\tif(!strcmp(\"class\", name)) return %d;\n", att_index);
		att_index++;
		fprintf(output, "\tif(!strcmp(\"xml:lang\", name)) return %d;\n", att_index);
		att_index++;
		fprintf(output, "\tif(!strcmp(\"xml:base\", name)) return %d;\n", att_index);
		att_index++;
		fprintf(output, "\tif(!strcmp(\"xml:space\", name)) return %d;\n", att_index);
		att_index++;
		fprintf(output, "\tif(!strcmp(\"externalResourcesRequired\", name)) return %d;\n", att_index);
		att_index++;
		if (svg_elt->has_media_properties)
			att_index = generateIndexInfo(output, svg_elt, 2, att_index);
		if (svg_elt->has_properties)
			att_index = generateIndexInfo(output, svg_elt, 1, att_index);
		if (svg_elt->has_opacity_properties)
			att_index = generateIndexInfo(output, svg_elt, 3, att_index);
		if (svg_elt->has_focus)
			att_index = generateIndexInfo(output, svg_elt, 4, att_index);
		if (svg_elt->has_xlink)
			att_index = generateIndexInfo(output, svg_elt, 5, att_index);
		if (svg_elt->has_timing)
			att_index = generateIndexInfo(output, svg_elt, 6, att_index);
		if (svg_elt->has_sync)
			att_index = generateIndexInfo(output, svg_elt, 7, att_index);
		if (svg_elt->has_animation)
			att_index = generateIndexInfo(output, svg_elt, 8, att_index);
		if (svg_elt->has_conditional)
			att_index = generateIndexInfo(output, svg_elt, 9, att_index);
		if (svg_elt->has_transform) {
			fprintf(output, "\tif(!strcmp(\"transform\", name)) return %d;\n", att_index);
			att_index++;
			/*motionTransform*/
			fprintf(output, "\tif(!strcmp(\"motionTransform\", name)) return %d;\n", att_index);
			att_index++;
		}
		if (svg_elt->has_xy) {
			fprintf(output, "\tif(!strcmp(\"x\", name)) return %d;\n", att_index);
			att_index++;
			fprintf(output, "\tif(!strcmp(\"y\", name)) return %d;\n", att_index);
			att_index++;
		}

		for (i = 0; i < gf_list_count(svg_elt->attributes); i++) {
			SVGGenAttribute *att = gf_list_get(svg_elt->attributes, i);
			fprintf(output, "\tif(!strcmp(\"%s\", name)) return %d;\n", att->svg_name, att_index);
			att_index++;
		}
	}
	fprintf(output, "\treturn -1;\n}\n\n");
}
예제 #2
0
void generateNodeImpl2(FILE *output, SVGGenElement* svg_elt) 
{
	u32 i;	

	/* Constructor */
	fprintf(output, "void *gf_svg_sani_new_%s()\n{\n\tSVG_SANI_%sElement *p;\n", svg_elt->implementation_name,svg_elt->implementation_name);
	fprintf(output, "\tGF_SAFEALLOC(p, SVG_SANI_%sElement);\n\tif (!p) return NULL;\n\tgf_node_setup((GF_Node *)p, TAG_SVG_SANI_%s);\n\tgf_sg_parent_setup((GF_Node *) p);\n",svg_elt->implementation_name,svg_elt->implementation_name);
	fprintf(output, "#ifdef GF_NODE_USE_POINTERS\n");
	fprintf(output, "\t((GF_Node *p)->sgprivate->name = \"%s\";\n", svg_elt->implementation_name);
	fprintf(output, "\t((GF_Node *p)->sgprivate->node_del = gf_svg_sani_%s_del;\n", svg_elt->implementation_name);
	fprintf(output, "\t((GF_Node *p)->sgprivate->get_field = gf_svg_sani_%s_get_attribute;\n", svg_elt->implementation_name);
	fprintf(output, "#endif\n");

	fprintf(output, "\tgf_svg_sani_init_core((SVG_SANI_Element *)p);\n");		
	if (svg_elt->has_focus) {
		fprintf(output, "\tgf_svg_sani_init_focus((SVG_SANI_Element *)p);\n");		
	} 
	if (svg_elt->has_xlink) {
		fprintf(output, "\tgf_svg_sani_init_xlink((SVG_SANI_Element *)p);\n");		
	} 
	if (svg_elt->has_timing) {
		fprintf(output, "\tgf_svg_sani_init_timing((SVG_SANI_Element *)p);\n");		
	} 
	if (svg_elt->has_sync) {
		fprintf(output, "\tgf_svg_sani_init_sync((SVG_SANI_Element *)p);\n");		
	}
	if (svg_elt->has_animation){
		fprintf(output, "\tgf_svg_sani_init_anim((SVG_SANI_Element *)p);\n");		
	} 
	if (svg_elt->has_conditional) {
		fprintf(output, "\tgf_svg_sani_init_conditional((SVG_SANI_Element *)p);\n");		
	} 

	if (svg_elt->has_transform) {
		fprintf(output, "\tgf_mx2d_init(p->transform.mat);\n");
	} 

	if (!strcmp(svg_elt->implementation_name, "conditional")) {
		fprintf(output, "\tgf_svg_sa_init_lsr_conditional(&p->updates);\n");
		fprintf(output, "\tgf_svg_sani_init_timing((SVG_SANI_Element *)p);\n");		

	} 

	for (i = 0; i < gf_list_count(svg_elt->attributes); i++) {
		SVGGenAttribute *att = gf_list_get(svg_elt->attributes, i);
		
		/* forcing initialization of old-properties */
		if (!strcmp("audio-level", att->svg_name)) {
			fprintf(output, "\tp->audio_level.type = SVG_NUMBER_VALUE;\n");
			fprintf(output, "\tp->audio_level.value = FIX_ONE;\n");
		} else if (!strcmp("display", att->svg_name)) {
			fprintf(output, "\tp->display = SVG_DISPLAY_INLINE;\n");
		} else if (!strcmp("display-align", att->svg_name)) {
			fprintf(output, "\tp->display_align = SVG_DISPLAYALIGN_AUTO;\n");
		} else if (!strcmp("fill", att->svg_name)) {
			fprintf(output, "\tp->fill.type = SVG_PAINT_COLOR;\n");
			fprintf(output, "\tp->fill.color.type = SVG_COLOR_RGBCOLOR;\n");
		} else if (!strcmp("fill-opacity", att->svg_name)) {
			fprintf(output, "\tp->fill_opacity.type = SVG_NUMBER_VALUE;\n");
			fprintf(output, "\tp->fill_opacity.value = FIX_ONE;\n");
		} else if (!strcmp("fill-rule", att->svg_name)) {
			fprintf(output, "\tp->fill_rule = SVG_FILLRULE_NONZERO;\n");
		} else if (!strcmp("font-family", att->svg_name)) {
			fprintf(output, "\tp->font_family.type = SVG_FONTFAMILY_VALUE;\n");
			fprintf(output, "\tp->font_family.value = strdup(\"Arial\");\n");
		} else if (!strcmp("font-size", att->svg_name)) {
			fprintf(output, "\tp->font_size.type = SVG_NUMBER_VALUE;\n");
			fprintf(output, "\tp->font_size.value = 12*FIX_ONE;\n");
		} else if (!strcmp("font-style", att->svg_name)) {
			fprintf(output, "\tp->font_style = SVG_FONTSTYLE_NORMAL;\n");
		} else if (!strcmp("font-variant", att->svg_name)) {
			fprintf(output, "\tp->font_variant = SVG_FONTVARIANT_NORMAL;\n");
		} else if (!strcmp("font-weight", att->svg_name)) {
			fprintf(output, "\tp->font_weight = SVG_FONTWEIGHT_NORMAL;\n");
		} else if (!strcmp("line-increment", att->svg_name)) {
			fprintf(output, "\tp->line_increment.type = SVG_NUMBER_AUTO;\n");
			fprintf(output, "\tp->line_increment.value = FIX_ONE;\n");
		} else if (!strcmp("opacity", att->svg_name)) {
			fprintf(output, "\tp->opacity.type = SVG_NUMBER_VALUE;\n");
			fprintf(output, "\tp->opacity.value = FIX_ONE;\n");
		} else if (!strcmp("solid-color", att->svg_name)) {
			fprintf(output, "\tp->solid_color.type = SVG_PAINT_COLOR;\n");
			fprintf(output, "\tp->solid_color.color.type = SVG_COLOR_RGBCOLOR;\n");
		} else if (!strcmp("solid-opacity", att->svg_name)) {
			fprintf(output, "\tp->solid_opacity.type = SVG_NUMBER_VALUE;\n");
			fprintf(output, "\tp->solid_opacity.value = FIX_ONE;\n");
		} else if (!strcmp("solid-color", att->svg_name)) {
			fprintf(output, "\tp->stop_color.type = SVG_PAINT_COLOR;\n");
			fprintf(output, "\tp->stop_color.color.type = SVG_COLOR_RGBCOLOR;\n");
		} else if (!strcmp("stop-opacity", att->svg_name)) {
			fprintf(output, "\tp->stop_opacity.type = SVG_NUMBER_VALUE;\n");
			fprintf(output, "\tp->stop_opacity.value = FIX_ONE;\n");
		} else if (!strcmp("stroke", att->svg_name)) {
			fprintf(output, "\tp->stroke.type = SVG_PAINT_NONE;\n");
			fprintf(output, "\tp->stroke.color.type = SVG_COLOR_RGBCOLOR;\n");
		} else if (!strcmp("stroke-dasharray", att->svg_name)) {
			fprintf(output, "\tp->stroke_dasharray.type = SVG_STROKEDASHARRAY_NONE;\n");
		} else if (!strcmp("stroke-dashoffset", att->svg_name)) {
			fprintf(output, "\tp->stroke_dashoffset.type = SVG_NUMBER_VALUE;\n");
		} else if (!strcmp("stroke-linecap", att->svg_name)) {
			fprintf(output, "\tp->stroke_linecap = SVG_STROKELINECAP_BUTT;\n");
		} else if (!strcmp("stroke-linejoin", att->svg_name)) {
			fprintf(output, "\tp->stroke_linejoin = SVG_STROKELINEJOIN_MITER;\n");
		} else if (!strcmp("stroke-miterlimit", att->svg_name)) {
			fprintf(output, "\tp->stroke_miterlimit.type = SVG_NUMBER_VALUE;\n");
			fprintf(output, "\tp->stroke_miterlimit.value = 4*FIX_ONE;\n");
		} else if (!strcmp("stroke-opacity", att->svg_name)) {
			fprintf(output, "\tp->stroke_opacity.type = SVG_NUMBER_VALUE;\n");
			fprintf(output, "\tp->stroke_opacity.value = FIX_ONE;\n");
		} else if (!strcmp("stroke-width", att->svg_name)) {
			fprintf(output, "\tp->stroke_width.type = SVG_NUMBER_VALUE;\n");
			fprintf(output, "\tp->stroke_width.value = FIX_ONE;\n");
		} else if (!strcmp("text-align", att->svg_name)) {
			fprintf(output, "\tp->text_align = SVG_TEXTALIGN_START;\n");
		} else if (!strcmp("text-anchor", att->svg_name)) {
			fprintf(output, "\tp->text_anchor = SVG_TEXTANCHOR_START;\n");
		} else if (!strcmp("vector-effect", att->svg_name)) {
			fprintf(output, "\tp->vector_effect = SVG_VECTOREFFECT_NONE;\n");
		} else if (!strcmp("viewport-fill", att->svg_name)) {
			fprintf(output, "\tp->viewport_fill.type = SVG_PAINT_NONE;\n");
		} else if (!strcmp("viewport-fill-opacity", att->svg_name)) {
			fprintf(output, "\tp->viewport_fill_opacity.type = SVG_NUMBER_VALUE;\n");
			fprintf(output, "\tp->viewport_fill_opacity.value = FIX_ONE;\n");
		} else if (!strcmp("visibility", att->svg_name)) {
			fprintf(output, "\tp->visibility = SVG_VISIBILITY_VISIBLE;\n");
		}

		/* Initialization of complex types */
		if ( !strcmp("SVG_Points", att->impl_type) || 
			 !strcmp("SVG_Coordinates", att->impl_type) ||
			 !strcmp("SMIL_KeyPoints", att->impl_type)) {
			fprintf(output, "\tp->%s = gf_list_new();\n", att->implementation_name);
		} else if (!strcmp("SVG_PathData", att->impl_type) && !strcmp(svg_elt->svg_name, "animateMotion")) {
			fprintf(output, "#ifdef USE_GF_PATH\n");
			fprintf(output, "\tgf_path_reset(&p->path);\n");
			fprintf(output, "#else\n");
			fprintf(output, "\tp->path.commands = gf_list_new();\n");
			fprintf(output, "\tp->path.points = gf_list_new();\n");
			fprintf(output, "#endif\n");
		} else if (!strcmp("SVG_PathData", att->impl_type)) {
			fprintf(output, "#ifdef USE_GF_PATH\n");
			fprintf(output, "\tgf_path_reset(&p->d);\n");
			fprintf(output, "#else\n");
			fprintf(output, "\tp->d.commands = gf_list_new();\n");
			fprintf(output, "\tp->d.points = gf_list_new();\n");
			fprintf(output, "#endif\n");
		} else if (!strcmp(att->svg_name, "lsr:enabled")) {
			fprintf(output, "\tp->lsr_enabled = 1;\n");
		} 
	}
	/*some default values*/
	if (!strcmp(svg_elt->svg_name, "svg")) {
		fprintf(output, "\tp->width.type = SVG_NUMBER_PERCENTAGE;\n");
		fprintf(output, "\tp->width.value = INT2FIX(100);\n");
		fprintf(output, "\tp->height.type = SVG_NUMBER_PERCENTAGE;\n");
		fprintf(output, "\tp->height.value = INT2FIX(100);\n");
	}
	else if (!strcmp(svg_elt->svg_name, "linearGradient")) {
		fprintf(output, "\tp->x2.value = FIX_ONE;\n");
		fprintf(output, "\tgf_mx2d_init(p->gradientTransform.mat);\n");
	}
	else if (!strcmp(svg_elt->svg_name, "radialGradient")) {
		fprintf(output, "\tp->cx.value = FIX_ONE/2;\n");
		fprintf(output, "\tp->cy.value = FIX_ONE/2;\n");
		fprintf(output, "\tp->r.value = FIX_ONE/2;\n");
		fprintf(output, "\tgf_mx2d_init(p->gradientTransform.mat);\n");
		fprintf(output, "\tp->fx.value = FIX_ONE/2;\n");
		fprintf(output, "\tp->fy.value = FIX_ONE/2;\n");
	}
	else if (!strcmp(svg_elt->svg_name, "video") || !strcmp(svg_elt->svg_name, "audio") || !strcmp(svg_elt->svg_name, "animation")) {
		fprintf(output, "\tp->timing->dur.type = SMIL_DURATION_MEDIA;\n");
	}
	fprintf(output, "\treturn p;\n}\n\n");

	/* Destructor */
	fprintf(output, "static void gf_svg_sani_%s_del(GF_Node *node)\n{\n", svg_elt->implementation_name);
	fprintf(output, "\tSVG_SANI_%sElement *p = (SVG_SANI_%sElement *)node;\n", svg_elt->implementation_name, svg_elt->implementation_name);
	fprintf(output, "\tgf_svg_sani_reset_base_element((SVG_SANI_Element *)p);\n");

	if (!strcmp(svg_elt->implementation_name, "conditional")) {
		fprintf(output, "\tgf_svg_sa_reset_lsr_conditional(&p->updates);\n");
	} 
	else if (!strcmp(svg_elt->implementation_name, "a")) {
		fprintf(output, "\tif (p->target) free(p->target);\n");
	} 

	for (i = 0; i < gf_list_count(svg_elt->attributes); i++) {
		SVGGenAttribute *att = gf_list_get(svg_elt->attributes, i);
		if (!strcmp("SMIL_KeyPoints", att->impl_type)) {
			fprintf(output, "\tgf_smil_delete_key_types(p->%s);\n", att->implementation_name);
		} else if (!strcmp("SVG_Coordinates", att->impl_type)) {
			fprintf(output, "\tgf_svg_delete_coordinates(p->%s);\n", att->implementation_name);
		} else if (!strcmp("SVG_Points", att->impl_type)) {
			fprintf(output, "\tgf_svg_delete_points(p->%s);\n", att->implementation_name);
		} else if (!strcmp("SVG_PathData", att->impl_type)) {
			if (!strcmp(svg_elt->svg_name, "animateMotion")) {
				fprintf(output, "\tgf_svg_reset_path(p->path);\n");
			} else {
				fprintf(output, "\tgf_svg_reset_path(p->d);\n");
			}
		} else if (!strcmp("XMLRI", att->impl_type)) {
			fprintf(output, "\tgf_svg_reset_iri(node->sgprivate->scenegraph, &p->%s);\n", att->implementation_name);
		} else if (!strcmp("SVG_FontFamily", att->impl_type)) {
			fprintf(output, "\tif (p->%s.value) free(p->%s.value);\n", att->implementation_name, att->implementation_name);
		} else if (!strcmp("SVG_String", att->impl_type) || !strcmp("SVG_ContentType", att->impl_type)) {
			fprintf(output, "\tfree(p->%s);\n", att->implementation_name);
		}
	}
	if (svg_elt->has_transform) {
		fprintf(output, "\tif (p->motionTransform) free(p->motionTransform);\n");
	} 

	fprintf(output, "\tgf_sg_parent_reset((GF_Node *) p);\n");
	fprintf(output, "\tgf_node_free((GF_Node *)p);\n");
	fprintf(output, "}\n\n");

	/* Attribute Access */
	fprintf(output, "static GF_Err gf_svg_sani_%s_get_attribute(GF_Node *node, GF_FieldInfo *info)\n{\n", svg_elt->implementation_name);
	fprintf(output, "\tswitch (info->fieldIndex) {\n");
	svg_elt->nb_atts = 0;
	svg_elt->nb_atts = generateCoreInfo(output, svg_elt, svg_elt->nb_atts);

	if (svg_elt->has_focus) 
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 4, "((SVG_SANI_Element *)node)->focus->", svg_elt->nb_atts);
	if (svg_elt->has_xlink) 
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 5, "((SVG_SANI_Element *)node)->xlink->", svg_elt->nb_atts);
	if (svg_elt->has_timing) 
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 6, "((SVG_SANI_Element *)node)->timing->", svg_elt->nb_atts);
	if (svg_elt->has_sync) 
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 7, "((SVG_SANI_Element *)node)->sync->", svg_elt->nb_atts);
	if (svg_elt->has_animation) 
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 8, "((SVG_SANI_Element *)node)->anim->", svg_elt->nb_atts);
	if (svg_elt->has_conditional) 
		svg_elt->nb_atts = generateGenericInfo(output, svg_elt, 9, "((SVG_SANI_Element *)node)->conditional->", svg_elt->nb_atts);
	if (svg_elt->has_transform) {
		svg_elt->nb_atts = generateTransformInfo2(output, svg_elt, svg_elt->nb_atts);
		svg_elt->nb_atts = generateMotionTransformInfo2(output, svg_elt, svg_elt->nb_atts);
	}
	if (svg_elt->has_xy) 
		svg_elt->nb_atts = generateXYInfo2(output, svg_elt, svg_elt->nb_atts);

	for (i = 0; i < gf_list_count(svg_elt->attributes); i++) {
		SVGGenAttribute *att = gf_list_get(svg_elt->attributes, i);
		generateAttributeInfo2(output, svg_elt->implementation_name, att, svg_elt->nb_atts++);
	}
	fprintf(output, "\t\tdefault: return GF_BAD_PARAM;\n\t}\n}\n\n");

}