[c]代码库
int Create ( GList *ls, char * S )
{
Glist p;
char *sub;
if StrEmpty ( S ) *ls = NULL;
else
{
if ( ! ( *ls = ( GList ) malloc ( sizeof ( GLNode ) ) ) ) return 0;
if ( StrLength ( S ) = = 1 )
{
( *ls )->tag = 0;
( *ls )->data = S;
}
else
{
( *ls )->tag = 1;
p = *ls;
hsub =SubStr ( S,2,StrLength ( S )-2 );
do
{
sever ( sub,hsub );
Create ( & ( p->ptr.hp ), sub );
q = p;
if ( !StrEmpty ( sub ) )
{
if ( ! ( p = ( GList ) malloc ( sizeof ( GLNode ) ) ) ) return 0;;
p->tag = 1;
q->ptr.tp = p;
}
}
while ( !StrEmpty ( sub ) );
q->ptr.tp = NULL;
}
}
return 1;
}