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

📄 d1_expout.c

📁 harvest是一个下载html网页得机器人
💻 C
📖 第 1 页 / 共 3 页
字号:
    for (c = n->child; c; c = c->next)    {	int i = 0;	switch (is_numeric_tag (eh, c))	{	case 102: res->name = f_string (eh, c); break;	case 113: res->description = f_humstring (eh, c); break;	case 704: res->attributeType = f_integer (eh, c); break;	case 708:	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 709)		    continue;		(res->num_attributeValues)++;	    }	    if (res->num_attributeValues)		res->attributeValues = (Z_AttributeDescription **)		    odr_malloc (eh->o, res->num_attributeValues				* sizeof(*res->attributeValues));	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 709)		    continue;		res->attributeValues[i++] = f_attributeDescription (eh, n);	    }	    break;	}    }    return res;}Z_AttributeSetInfo *f_attributeSetInfo (ExpHandle *eh, data1_node *n){    Z_AttributeSetInfo *res = (Z_AttributeSetInfo *)	odr_malloc(eh->o, sizeof(*res));    data1_node *c;    res->commonInfo = 0;    res->attributeSet = 0;    res->name = 0;    res->num_attributes = 0;    res->attributes = 0;    res->description = 0;    for (c = n->child; c; c = c->next)    {	int i = 0;	switch (is_numeric_tag (eh, c))	{	case 600: res->commonInfo = f_commonInfo (eh, c); break;	case 1000: res->attributeSet = f_oid (eh, c, CLASS_ATTSET); break;	case 102: res->name = f_string (eh, c); break;	case 750:	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 751)		    continue;		(res->num_attributes)++;	    }	    if (res->num_attributes)		res->attributes = (Z_AttributeType **)		    odr_malloc (eh->o, res->num_attributes				* sizeof(*res->attributes));	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 751)		    continue;		res->attributes[i++] = f_attributeType (eh, n);	    }	    break;	case 113: res->description = f_humstring (eh, c); break;	}    }    return res;}Z_OmittedAttributeInterpretation *f_omittedAttributeInterpretation (    ExpHandle *eh, data1_node *n){    Z_OmittedAttributeInterpretation *res = (Z_OmittedAttributeInterpretation*)	odr_malloc (eh->o, sizeof(*res));    data1_node *c;    res->defaultValue = 0;    res->defaultDescription = 0;    for (c = n->child; c; c = c->next)    {	switch (is_numeric_tag (eh, c))	{	case 706:	    res->defaultValue = f_stringOrNumeric (eh, c);	    break;	case 113:	    res->defaultDescription = f_humstring(eh, c);	    break;	}    }    return res;}Z_AttributeValue *f_attributeValue (ExpHandle *eh, data1_node *n){    Z_AttributeValue *res = (Z_AttributeValue *)	odr_malloc (eh->o, sizeof(*res));    data1_node *c;    res->value = 0;    res->description = 0;    res->num_subAttributes = 0;    res->subAttributes = 0;    res->num_superAttributes = 0;    res->superAttributes = 0;    res->partialSupport = 0;    for (c = n->child; c; c = c->next)    {	int i = 0;	switch (is_numeric_tag (eh, c))	{	case 710:	    res->value = f_stringOrNumeric (eh, c);  break;	case 113:	    res->description = f_humstring (eh, c); break;	case 712:	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 713)		    continue;		(res->num_subAttributes)++;	    }	    if (res->num_subAttributes)		res->subAttributes =		    (Z_StringOrNumeric **)		    odr_malloc (eh->o, res->num_subAttributes				* sizeof(*res->subAttributes));	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 713)		    continue;		res->subAttributes[i++] = f_stringOrNumeric (eh, n);	    }	    break;	case 714:	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 715)		    continue;		(res->num_superAttributes)++;	    }	    if (res->num_superAttributes)		res->superAttributes =		    (Z_StringOrNumeric **)		    odr_malloc (eh->o, res->num_superAttributes				* sizeof(*res->superAttributes));	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 715)		    continue;		res->superAttributes[i++] = f_stringOrNumeric (eh, n);	    }	    break;	case 711:	    res->partialSupport = odr_nullval ();	    break;	}    }    return res;}Z_AttributeTypeDetails *f_attributeTypeDetails (ExpHandle *eh, data1_node *n){    Z_AttributeTypeDetails *res = (Z_AttributeTypeDetails *)	odr_malloc(eh->o, sizeof(*res));    data1_node *c;    res->attributeType = 0;    res->defaultIfOmitted = 0;    res->num_attributeValues = 0;    res->attributeValues = 0;    for (c = n->child; c; c = c->next)    {	int i = 0;	switch (is_numeric_tag (eh, c))	{	case 704: res->attributeType = f_integer (eh, c); break;	case 705:	    res->defaultIfOmitted = f_omittedAttributeInterpretation (eh, c);	    break;	case 708:	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 709)		    continue;		(res->num_attributeValues)++;	    }	    if (res->num_attributeValues)		res->attributeValues =		    (Z_AttributeValue **)		    odr_malloc (eh->o, res->num_attributeValues				* sizeof(*res->attributeValues));	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 709)		    continue;		res->attributeValues[i++] = f_attributeValue (eh, n);	    }	    break;	}    }    return res;}Z_AttributeSetDetails *f_attributeSetDetails (ExpHandle *eh, data1_node *n){    Z_AttributeSetDetails *res = (Z_AttributeSetDetails *)	odr_malloc(eh->o, sizeof(*res));    data1_node *c;        res->attributeSet = 0;    res->num_attributesByType = 0;    res->attributesByType = 0;    for (c = n->child; c; c = c->next)    {	int i = 0;	switch (is_numeric_tag (eh, c))	{	case 1000: res->attributeSet = f_oid(eh, c, CLASS_ATTSET); break;	case 702:	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 703)		    continue;		(res->num_attributesByType)++;	    }	    if (res->num_attributesByType)		res->attributesByType =		    (Z_AttributeTypeDetails **)		    odr_malloc (eh->o, res->num_attributesByType				* sizeof(*res->attributesByType));	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 703)		    continue;		res->attributesByType[i++] = f_attributeTypeDetails (eh, n);	    }	    break;	}    }    return res;}Z_AttributeValueList *f_attributeValueList (ExpHandle *eh, data1_node *n){    Z_AttributeValueList *res = (Z_AttributeValueList *)	odr_malloc (eh->o, sizeof(*res));    data1_node *c;    int i = 0;    res->num_attributes = 0;    res->attributes = 0;    for (c = n->child; c; c = c->next)	if (is_numeric_tag (eh, c) == 710)	    (res->num_attributes)++;    if (res->num_attributes)    {	res->attributes = (Z_StringOrNumeric **)	    odr_malloc (eh->o, res->num_attributes * sizeof(*res->attributes));    }    for (c = n->child; c; c = c->next)	if (is_numeric_tag(eh, c) == 710)	    res->attributes[i++] = f_stringOrNumeric (eh, c);    return res;}Z_AttributeOccurrence *f_attributeOccurrence (ExpHandle *eh, data1_node *n){    Z_AttributeOccurrence *res = (Z_AttributeOccurrence *)	odr_malloc (eh->o, sizeof(*res));    data1_node *c;    res->attributeSet = 0;    res->attributeType = 0;    res->mustBeSupplied = 0;    res->which = Z_AttributeOcc_any_or_none;    res->attributeValues.any_or_none = odr_nullval ();    for (c = n->child; c; c = c->next)    {	switch (is_numeric_tag (eh, c))	{	case 1000:	    res->attributeSet = f_oid (eh, c, CLASS_ATTSET); break;	case 704:	    res->attributeType = f_integer (eh, c); break;	case 720:	    res->mustBeSupplied = odr_nullval (); break;	case 721:	    res->which = Z_AttributeOcc_any_or_none;	    res->attributeValues.any_or_none = odr_nullval ();	    break;	case 722:	    res->which = Z_AttributeOcc_specific;	    res->attributeValues.specific = f_attributeValueList (eh, c);	    break;	}    }    return res;}Z_AttributeCombination *f_attributeCombination (ExpHandle *eh, data1_node *n){    Z_AttributeCombination *res = (Z_AttributeCombination *)	odr_malloc (eh->o, sizeof(*res));    data1_node *c;    int i = 0;    res->num_occurrences = 0;    res->occurrences = 0;    for (c = n->child; c; c = c->next)	if (is_numeric_tag (eh, c) == 719)	    (res->num_occurrences)++;    if (res->num_occurrences)    {	res->occurrences = (Z_AttributeOccurrence **)	    odr_malloc (eh->o, res->num_occurrences * sizeof(*res->occurrences));    }    for (c = n->child; c; c = c->next)	if (is_numeric_tag(eh, c) == 719)	    res->occurrences[i++] = f_attributeOccurrence (eh, c);    assert (res->num_occurrences);    return res;}Z_AttributeCombinations *f_attributeCombinations (ExpHandle *eh, data1_node *n){    Z_AttributeCombinations *res = (Z_AttributeCombinations *)	odr_malloc (eh->o, sizeof(*res));    data1_node *c;    res->defaultAttributeSet = 0;    res->num_legalCombinations = 0;    res->legalCombinations = 0;    for (c = n->child; c; c = c->next)    {	int i = 0;	switch (is_numeric_tag (eh, c))	{	case 1000:	    res->defaultAttributeSet = f_oid (eh, c, CLASS_ATTSET);	    break;	case 717:	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 718)		    continue;		(res->num_legalCombinations)++;	    }	    if (res->num_legalCombinations)		res->legalCombinations =		    (Z_AttributeCombination **)		    odr_malloc (eh->o, res->num_legalCombinations				* sizeof(*res->legalCombinations));	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 718)		    continue;		res->legalCombinations[i++] = f_attributeCombination (eh, n);	    }	    break;	}    }    assert (res->num_legalCombinations);    return res;}Z_AttributeDetails *f_attributeDetails (ExpHandle *eh, data1_node *n){    Z_AttributeDetails *res = (Z_AttributeDetails *)	odr_malloc(eh->o, sizeof(*res));    data1_node *c;    res->commonInfo = 0;    res->databaseName = 0;    res->num_attributesBySet = 0;    res->attributesBySet = NULL;    res->attributeCombinations = NULL;    for (c = n->child; c; c = c->next)    {	int i = 0;	switch (is_numeric_tag (eh, c))	{	case 600: res->commonInfo = f_commonInfo(eh, c); break;	case 102: res->databaseName = f_string (eh, c); break;	case 700:	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 701)		    continue;		(res->num_attributesBySet)++;	    }	    if (res->num_attributesBySet)		res->attributesBySet =		    (Z_AttributeSetDetails **)		    odr_malloc (eh->o, res->num_attributesBySet				* sizeof(*res->attributesBySet));	    for (n = c->child; n; n = n->next)	    {		if (is_numeric_tag(eh, n) != 701)		    continue;		res->attributesBySet[i++] = f_attributeSetDetails (eh, n);	    }	    break;	case 716:	    res->attributeCombinations = f_attributeCombinations (eh, c);	    break;	}    }    return res;}Z_ExplainRecord *data1_nodetoexplain (data1_handle dh, data1_node *n,				      int select, ODR o){    ExpHandle eh;    Z_ExplainRecord *res = (Z_ExplainRecord *)odr_malloc(o, sizeof(*res));    eh.dh = dh;    eh.select = select;    eh.o = o;    eh.false_value = (int *)odr_malloc(eh.o, sizeof(eh.false_value));    *eh.false_value = 0;    eh.true_value = (int *)odr_malloc(eh.o, sizeof(eh.true_value));    *eh.true_value = 1;    assert(n->which == DATA1N_root);    if (strcmp(n->u.root.type, "explain"))    {	yaz_log(LOG_WARN, "Attempt to convert a non-Explain record");	return 0;    }    for (n = n->child; n; n = n->next)    {	switch (is_numeric_tag (&eh, n))	{	case 1:	    res->which = Z_Explain_categoryList;	    if (!(res->u.categoryList = f_categoryList(&eh, n)))		return 0;	    return res;	    	case 2:	    res->which = Z_Explain_targetInfo;	    if (!(res->u.targetInfo = f_targetInfo(&eh, n)))		return 0;	    return res;	case 3:	    res->which = Z_Explain_databaseInfo;	    if (!(res->u.databaseInfo = f_databaseInfo(&eh, n)))		return 0;	    return res;	case 7:	    res->which = Z_Explain_attributeSetInfo;	    if (!(res->u.attributeSetInfo = f_attributeSetInfo(&eh, n)))		return 0;	    return res;	    	case 10:	    res->which = Z_Explain_attributeDetails;	    if (!(res->u.attributeDetails = f_attributeDetails(&eh, n)))		return 0;	    return res;	}    }    yaz_log(LOG_WARN, "No category in Explain record");    return 0;}

⌨️ 快捷键说明

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