⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 一个用于智能手机的多媒体库适合S60 WinCE的跨平台开发库
💻 C
📖 第 1 页 / 共 3 页
字号:
/* *			GPAC - Multimedia Framework C SDK * *			Copyright (c) Cyril Concolato 2004-2005 *					All rights reserved * *  This file is part of GPAC / SVG Scene Graph Generator sub-project * *  GPAC is free software; you can redistribute it and/or modify *  it under the terms of the GNU Lesser General Public License as published by *  the Free Software Foundation; either version 2, or (at your option) *  any later version. *    *  GPAC is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU Lesser General Public License for more details. *    *  You should have received a copy of the GNU Lesser General Public *  License along with this library; see the file COPYING.  If not, write to *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  * */#include "svggen.h"SVGGenAttribute *NewSVGGenAttribute(){	SVGGenAttribute *att;	GF_SAFEALLOC(att, SVGGenAttribute)	return att;}void deleteSVGGenAttribute(SVGGenAttribute **p){	xmlFree((*p)->svg_name);	xmlFree((*p)->svg_type);	free(*p);	*p = NULL;}SVGGenAttrGrp *NewSVGGenAttrGrp(){	SVGGenAttrGrp *tmp;	GF_SAFEALLOC(tmp, SVGGenAttrGrp)	tmp->attrs = gf_list_new();	tmp->attrgrps = gf_list_new();	return tmp;}SVGGenElement *NewSVGGenElement() {	SVGGenElement *elt;	GF_SAFEALLOC(elt, SVGGenElement);	if (elt) {		elt->attributes = gf_list_new();		elt->generic_attributes = gf_list_new();	}	return elt;}void deleteSVGGenElement(SVGGenElement **p){	u32 i;	xmlFree((*p)->svg_name);	for (i = 0; i < gf_list_count((*p)->attributes); i++) {		SVGGenAttribute *a = gf_list_get((*p)->attributes, i);		deleteSVGGenAttribute(&a);	}	gf_list_del((*p)->attributes);	free(*p);	*p = NULL;}static GF_List *sortElements(GF_List *elements){	u32 i, j;	GF_List *sorted_elements = gf_list_new();	for (i = 0; i< gf_list_count(elements); i++) {		u8 is_added = 0;		SVGGenElement *elt = gf_list_get(elements, i);		for (j = 0; j < gf_list_count(sorted_elements); j++) {			SVGGenElement *selt = gf_list_get(sorted_elements, j);			if (strcmp(elt->svg_name, selt->svg_name) < 0) {				gf_list_insert(sorted_elements, elt, j);				is_added = 1;				break;			}		}		if (!is_added) gf_list_add(sorted_elements, elt);	}	gf_list_del(elements);	return sorted_elements;}static GF_List *sortAttrGrp(GF_List *attgrps){	u32 i, j;	GF_List *sorted_attgrps = gf_list_new();	for (i = 0; i< gf_list_count(attgrps); i++) {		u8 is_added = 0;		SVGGenAttrGrp *grp = gf_list_get(attgrps, i);		for (j = 0; j < gf_list_count(sorted_attgrps); j++) {			SVGGenAttrGrp *sgrp = gf_list_get(sorted_attgrps, j);			if (strcmp(grp->name, sgrp->name) < 0) {				gf_list_insert(sorted_attgrps, grp, j);				is_added = 1;				break;			}		}		if (!is_added) gf_list_add(sorted_attgrps, grp);	}	gf_list_del(attgrps);	return sorted_attgrps;}static GF_List *sortAttr(GF_List *atts){	u32 i, j;	GF_List *sorted_atts = gf_list_new();	for (i = 0; i< gf_list_count(atts); i++) {		u8 is_added = 0;		SVGGenAttribute *att = gf_list_get(atts, i);		for (j = 0; j < gf_list_count(sorted_atts); j++) {			SVGGenAttribute *satt = gf_list_get(sorted_atts, j);			if (strcmp(att->svg_name, satt->svg_name) < 0) {				gf_list_insert(sorted_atts, att, j);				is_added = 1;				break;			}		}		if (!is_added) gf_list_add(sorted_atts, att);	}	gf_list_del(atts);	return sorted_atts;}void svgNameToImplementationName(xmlChar *svg_name, char implementation_name[50]) {	char *tmp;	strcpy(implementation_name, svg_name);	tmp = implementation_name;	while ( (tmp = strchr(tmp, '.')) ) { *tmp='_'; tmp++; }	tmp = implementation_name;	while ( (tmp = strchr(tmp, '-')) ) { *tmp='_'; tmp++; }	tmp = implementation_name;	while ( (tmp = strchr(tmp, ':')) ) { *tmp='_'; tmp++; }}static Bool isGenericAttributesGroup(char *name) {	if (!strcmp(name, "svg.Core.attr") ||		!strcmp(name, "svg.CorePreserve.attr") ||		!strcmp(name, "svg.External.attr") ||		!strcmp(name, "svg.Properties.attr") ||		!strcmp(name, "svg.Media.attr") ||		!strcmp(name, "svg.MediaClip.attr") ||		!strcmp(name, "svg.Opacity.attr") ||		!strcmp(name, "svg.FocusHighlight.attr") || 		!strcmp(name, "svg.Focus.attr") ||		!strcmp(name, "svg.AnimateCommon.attr") ||		!strcmp(name, "svg.XLinkEmbed.attr") ||		!strcmp(name, "svg.XLinkRequired.attr") ||		!strcmp(name, "svg.XLinkReplace.attr") ||//		!strcmp(name, "svg.ContentType.attr") ||		!strcmp(name, "svg.AnimateTiming.attr") ||		!strcmp(name, "svg.AnimateTimingNoMinMax.attr") ||		!strcmp(name, "svg.AnimateBegin.attr") || 		!strcmp(name, "svg.AnimateTimingNoFillNoMinMax.attr") ||		!strcmp(name, "svg.AnimateSync.attr") ||		!strcmp(name, "svg.AnimateSyncDefault.attr") ||		!strcmp(name, "svg.AnimateAttributeCommon.attr") ||		!strcmp(name, "svg.AnimateToCommon.attr") ||		!strcmp(name, "svg.AnimateValueCommon.attr") ||		!strcmp(name, "svg.AnimateAdditionCommon.attr") ||		!strcmp(name, "svg.AnimateTypeCommon.attr") ||		!strcmp(name, "svg.Conditional.attr") ||//		!strcmp(name, "svg.XY.attr") ||		!strcmp(name, "svg.Transform.attr")) {		return 1;	} else {		return 0;	}}static Bool setGenericAttributesFlags(char *name, SVGGenElement *e) {	Bool ret = 1;	if (!strcmp(name, "svg.Core.attr") ||		!strcmp(name, "svg.CorePreserve.attr") ||		!strcmp(name, "svg.External.attr")) {		e->has_svg_generic = 1; 		e->has_xml_generic = 1;	} else if (!strcmp(name, "svg.Properties.attr")) {		e->has_properties = 1;		e->has_media_properties = 1;	} else if (!strcmp(name, "svg.Media.attr")) {		e->has_media_properties = 1;	} else if (!strcmp(name, "svg.Opacity.attr")) {		e->has_opacity_properties = 1;	} else if (!strcmp(name, "svg.FocusHighlight.attr") || 		       !strcmp(name, "svg.Focus.attr")) {		e->has_focus = 1;	} else if (!strcmp(name, "svg.AnimateCommon.attr") ||			   !strcmp(name, "svg.XLinkEmbed.attr") ||			   !strcmp(name, "svg.XLinkRequired.attr") ||			   !strcmp(name, "svg.XLinkReplace.attr")) { //||//			   !strcmp(name, "svg.ContentType.attr")) {		e->has_xlink = 1;	} else if (!strcmp(name, "svg.AnimateTiming.attr") ||			   !strcmp(name, "svg.AnimateTimingNoMinMax.attr") ||			   !strcmp(name, "svg.AnimateBegin.attr") || 			   !strcmp(name, "svg.AnimateTimingNoFillNoMinMax.attr")) {		e->has_timing = 1;	} else if (!strcmp(name, "svg.AnimateSync.attr") ||		       !strcmp(name, "svg.AnimateSyncDefault.attr")) {		e->has_sync= 1;	} else if (!strcmp(name, "svg.AnimateAttributeCommon.attr") ||			   !strcmp(name, "svg.AnimateToCommon.attr") ||			   !strcmp(name, "svg.AnimateValueCommon.attr") ||			   !strcmp(name, "svg.AnimateAdditionCommon.attr") ||			   !strcmp(name, "svg.AnimateTypeCommon.attr")) {		e->has_animation = 1;	} else if (!strcmp(name, "svg.Conditional.attr")) {		e->has_conditional = 1;	} else if (!strcmp(name, "svg.Transform.attr")) {		e->has_transform = 1;	} else if (!strcmp(name, "svg.XY.attr")) {		e->has_xy = 1;	} else {		ret = 0;	}	return ret;}static void flattenAttributeGroup(SVGGenAttrGrp attgrp, SVGGenElement *e, Bool all);static void flattenAttributeGroups(GF_List *attrgrps, SVGGenElement *e, Bool all) {	u32 i;	for (i = 0; i < gf_list_count(attrgrps); i ++) {		SVGGenAttrGrp *ag = gf_list_get(attrgrps, i);		flattenAttributeGroup(*ag, e, all);	} }static void flattenAttributeGroup(SVGGenAttrGrp attgrp, SVGGenElement *e, Bool all) {	u32 i;	if (isGenericAttributesGroup(attgrp.name) && !all) {		setGenericAttributesFlags(attgrp.name, e);		flattenAttributeGroups(attgrp.attrgrps, e, 1);		for (i = 0; i < gf_list_count(attgrp.attrs); i++) {			gf_list_add(e->generic_attributes, gf_list_get(attgrp.attrs, i));		}	} else {		flattenAttributeGroups(attgrp.attrgrps, e, all);		for (i = 0; i < gf_list_count(attgrp.attrs); i++) {			if (all) 				gf_list_add(e->generic_attributes, gf_list_get(attgrp.attrs, i));			else 				gf_list_add(e->attributes, gf_list_get(attgrp.attrs, i));		}	}}SVGGenAttribute *findAttribute(SVGGenElement *e, char *name) {	u32 i;	for (i = 0; i < gf_list_count(e->attributes); i++) {		SVGGenAttribute *a = gf_list_get(e->attributes, i);		if (!strcmp(a->svg_name, name)) return a;	}	for (i = 0; i < gf_list_count(e->generic_attributes); i++) {		SVGGenAttribute *a = gf_list_get(e->generic_attributes, i);		if (!strcmp(a->svg_name, name)) return a;	}	return NULL;}static u32 countAttributesAllInGroup(SVGGenAttrGrp *ag){	u32 i, ret = 0;	for (i = 0; i < gf_list_count(ag->attrgrps); i ++) {		SVGGenAttrGrp *agtmp = gf_list_get(ag->attrgrps, i);		ret += countAttributesAllInGroup(agtmp);	} 	ret += gf_list_count(ag->attrs);	return ret;}/* XML related functions */xmlNodeSetPtr findNodes( xmlXPathContextPtr ctxt, xmlChar * path ) {    xmlXPathObjectPtr res = NULL;      if ( ctxt->node != NULL && path != NULL ) {        xmlXPathCompExprPtr comp;        xmlDocPtr tdoc = NULL;        xmlNodePtr froot = ctxt->node;        comp = xmlXPathCompile( path );        if ( comp == NULL ) {            return NULL;        }        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -