/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to pcilib/xml.c

  • Committer: Vasilii Chernov
  • Date: 2016-02-11 11:28:37 UTC
  • mto: This revision was merged to the branch mainline in revision 353.
  • Revision ID: vchernov@inr.ru-20160211112837-vg7wezhh0cs51hvq
Solve errors in serialing register_info function. Clear unused code

Show diffs side-by-side

added added

removed removed

Lines of Context:
554
554
    return 0;
555
555
}
556
556
 
557
 
static int pcilib_xml_create_script_view(pcilib_t *ctx, xmlXPathContextPtr xpath, xmlDocPtr doc, xmlNodePtr node) {
558
 
    int err;
559
 
    xmlAttrPtr cur;
560
 
    const char *value, *name;
561
 
    pcilib_view_context_t *view_ctx;
562
 
    
563
 
 
564
 
    pcilib_access_mode_t mode = 0;
565
 
    pcilib_transform_view_description_t desc = {{0}};
566
 
 
567
 
    desc.base.api = &pcilib_transform_view_api;
568
 
    desc.base.type = PCILIB_TYPE_DOUBLE;
569
 
    desc.base.mode = PCILIB_ACCESS_RW;
570
 
    desc.script = NULL;
571
 
 
572
 
    err = pcilib_xml_parse_view(ctx, xpath, doc, node, (pcilib_view_description_t*)&desc);
573
 
    if (err) return err;
574
 
 
575
 
    for (cur = node->properties; cur != NULL; cur = cur->next) {
576
 
        if (!cur->children) continue;
577
 
        if (!xmlNodeIsText(cur->children)) continue;
578
 
 
579
 
        name = (char*)cur->name;
580
 
        value = (char*)cur->children->content;
581
 
        if (!value) continue;
582
 
 
583
 
        if (!strcasecmp(name, "script")) 
584
 
        {
585
 
                        //write script name to struct
586
 
                        char* script_name = malloc(strlen(value));
587
 
                        sprintf(script_name, "%s", value);
588
 
                        
589
 
                        err = pcilib_init_py_script(ctx, script_name, &(desc.script), &mode);
590
 
                        if(err) return err;
591
 
                        mode |= PCILIB_REGISTER_NO_CHK;
592
 
        }
593
 
    }
594
 
    
595
 
    desc.base.mode &= mode;
596
 
 
597
 
    err = pcilib_add_views_custom(ctx, 1, (pcilib_view_description_t*)&desc, &view_ctx);
598
 
    if (err) return err;
599
 
 
600
 
    view_ctx->xml = node;
601
 
    return 0;
602
 
}
603
 
 
604
557
static int pcilib_xml_create_transform_view(pcilib_t *ctx, xmlXPathContextPtr xpath, xmlDocPtr doc, xmlNodePtr node) {
605
558
    int err;
606
559
    xmlAttrPtr cur;