Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
zmap
Commits
f8d2171d
Commit
f8d2171d
authored
19 years ago
by
rds
Browse files
Options
Downloads
Patches
Plain Diff
fix a couple of problems and names
parent
268cee40
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/zmapXML/zmapXMLElement.c
+45
-8
45 additions, 8 deletions
src/zmapXML/zmapXMLElement.c
src/zmapXML/zmapXMLFactory.c
+27
-24
27 additions, 24 deletions
src/zmapXML/zmapXMLFactory.c
with
72 additions
and
32 deletions
src/zmapXML/zmapXMLElement.c
+
45
−
8
View file @
f8d2171d
...
...
@@ -27,9 +27,9 @@
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited: Sep
2
1
7
:0
2
2005 (rds)
* Last edited: Sep
8
1
2
:0
9
2005 (rds)
* Created: Fri Aug 5 14:33:49 2005 (rds)
* CVS info: $Id: zmapXMLElement.c,v 1.
1
2005-09-0
5
17:
28:2
2 rds Exp $
* CVS info: $Id: zmapXMLElement.c,v 1.
2
2005-09-0
8
17:
49:5
2 rds Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -41,10 +41,12 @@ static void freeElement(gpointer data, gpointer unused);
zmapXMLElement
zmapXMLElement_create
(
const
XML_Char
*
name
)
{
zmapXMLElement
ele
=
NULL
;
int
len
=
100
;
ele
=
g_new0
(
zmapXMLElementStruct
,
1
);
ele
->
name
=
g_quark_from_string
(
g_ascii_strdown
((
char
*
)
name
,
-
1
));
ele
->
contents
=
g_string_sized_new
(
len
);
return
ele
;
}
...
...
@@ -82,9 +84,6 @@ void zmapXMLElement_add_content(zmapXMLElement ele,
const
XML_Char
*
content
,
int
len
)
{
if
(
ele
->
contents
==
NULL
)
ele
->
contents
=
g_string_sized_new
(
2
*
len
);
/* N.B. we _only_ get away with this because XML_Char == char at the moment,
* this will need to be fixed in the future to support UNICODE/UTF-16 etc...
* See expat docs & expat_external.h for further info. SCEW's str.h uses
...
...
@@ -121,13 +120,51 @@ zmapXMLElement zMapXMLElement_previousSibling(zmapXMLElement ele)
return
(
sibling
?
sibling
->
data
:
NULL
);
}
/* This can only get first Child path. Probably not commonly used, but
* here in case.
*/
zmapXMLElement
zMapXMLElement_getChildByPath
(
zmapXMLElement
parent
,
char
*
path
)
{
zmapXMLElement
ele
=
NULL
,
pele
=
NULL
;
gchar
**
names
=
NULL
;
gboolean
exist
=
TRUE
;
names
=
g_strsplit_set
(
path
,
"."
,
-
1
);
int
i
=
0
;
pele
=
parent
;
while
(
exist
)
{
if
(
names
[
i
]
==
NULL
)
break
;
/* We're finished */
if
(
strlen
(
names
[
i
])
==
0
)
{
/* path looked like 'elementa..elementb' */
i
++
;
continue
;
}
if
((
ele
=
zMapXMLElement_getChildByName
(
pele
,
names
[
i
]))
==
NULL
)
exist
=
FALSE
;
/* Search failed, ele = NULL */
pele
=
ele
;
i
++
;
}
return
ele
;
}
zmapXMLElement
zMapXMLElement_getChildByName
(
zmapXMLElement
parent
,
char
*
name
)
{
if
(
name
&&
*
name
)
return
zMapXMLElement_getChildByName1
(
parent
,
g_quark_from_string
(
g_ascii_strdown
(
name
,
-
1
)));
else
return
NULL
;
}
/* These two could provide use when converting the tree to users'
* objects and basically allow slow hash style access to the GList
* which is implemented as a list for the reason mentioned below.
*/
zmapXMLElement
zMapXMLElement_getChildByName
(
zmapXMLElement
parent
,
GQuark
name
)
zmapXMLElement
zMapXMLElement_getChildByName
1
(
zmapXMLElement
parent
,
GQuark
name
)
{
GList
*
list
;
...
...
This diff is collapsed.
Click to expand it.
src/zmapXML/zmapXMLFactory.c
+
27
−
24
View file @
f8d2171d
...
...
@@ -27,9 +27,9 @@
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited:
Aug 26 16:08
2005 (rds)
* Last edited:
Sep 8 17:12
2005 (rds)
* Created: Tue Aug 16 14:40:59 2005 (rds)
* CVS info: $Id: zmapXMLFactory.c,v 1.
1
2005-09-0
5
17:
28:2
2 rds Exp $
* CVS info: $Id: zmapXMLFactory.c,v 1.
2
2005-09-0
8
17:
49:5
2 rds Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -41,26 +41,12 @@ int zMapXMLFactoryDecodeElement(GHashTable *userTypesTable,
zmapXMLElement
element
,
GList
**
listout
)
{
return
zMapXMLFactoryListFromNameQuark
(
userTypesTable
,
element
->
name
,
listout
);
zmapXMLFactoryItem
ptype
=
NULL
;
int
type
=
-
1
;
ptype
=
g_hash_table_lookup
(
userTypesTable
,
GINT_TO_POINTER
(
element
->
name
));
if
(
ptype
)
{
type
=
ptype
->
type
;
if
(
listout
)
*
listout
=
ptype
->
list
;
}
return
type
;
return
zMapXMLFactoryDecodeNameQuark
(
userTypesTable
,
element
->
name
,
listout
);
}
int
zMapXMLFactory
ListFrom
NameQuark
(
GHashTable
*
userTypesTable
,
GQuark
name
,
GList
**
listout
)
int
zMapXMLFactory
Decode
NameQuark
(
GHashTable
*
userTypesTable
,
GQuark
name
,
GList
**
listout
)
{
zmapXMLFactoryItem
ptype
=
NULL
;
int
type
=
-
1
;
...
...
@@ -77,9 +63,7 @@ int zMapXMLFactoryListFromNameQuark(GHashTable *userTypesTable,
return
type
;
}
void
zMapXMLFactory_listAppend
(
GHashTable
*
userTypesTable
,
void
zMapXMLFactoryListAddItem
(
GHashTable
*
userTypesTable
,
zmapXMLElement
element
,
void
*
listItem
)
{
...
...
@@ -91,7 +75,26 @@ void zMapXMLFactory_listAppend(GHashTable *userTypesTable,
ptype
=
g_hash_table_lookup
(
userTypesTable
,
GINT_TO_POINTER
(
element
->
name
));
if
(
ptype
)
ptype
->
list
=
g_list_append
(
ptype
->
list
,
listItem
);
ptype
->
list
=
g_list_prepend
(
ptype
->
list
,
listItem
);
return
;
}
void
zMapXMLFactoryFreeListComplete
(
GHashTable
*
userTypesTable
,
GQuark
name
,
GFunc
func
,
gpointer
userData
)
{
zmapXMLFactoryItem
ptype
=
NULL
;
ptype
=
g_hash_table_lookup
(
userTypesTable
,
GINT_TO_POINTER
(
name
));
g_list_foreach
(
ptype
->
list
,
func
,
userData
);
g_list_free
(
ptype
->
list
);
ptype
->
list
=
NULL
;
return
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment