/alps/pcitool

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to pcilib/xml.c

  • Committer: Vasilii Chernov
  • Date: 2016-02-12 13:43:20 UTC
  • mto: This revision was merged to the branch mainline in revision 353.
  • Revision ID: vchernov@inr.ru-20160212134320-qj1oj1v4g6ixn9c8
1. Cmakelists - move copy xml folder command to root file
2. - Move set python paths code to python module init funtction
     - pci.c move python module init block code after checking model
       to get paths before it runs.
   - Fix set python path code to work with PYTHONPATH
   - Update pci run script to work with PYTHONPATH
   - Fix python finalize code
3. Change pcilib_script_s interacting method. Now it stores in hash.
4. Change names of some fucntions to more unified ones
5. Remove old unused function pcilib_xml_create_script_or_transform_view
6. cli - disable reading register after set if write_verification flag is off
7. Remove uninformative error messages fro Python wrap.
8. - Server.py - add read/write property/register command handling
   - Add help message
   - Correcting paths

Show diffs side-by-side

added added

removed removed

Lines of Context:
569
569
    desc.base.api = &pcilib_transform_view_api;
570
570
    desc.base.type = PCILIB_TYPE_DOUBLE;
571
571
    desc.base.mode = PCILIB_ACCESS_RW;
572
 
    desc.script = NULL;
573
572
 
574
573
    err = pcilib_xml_parse_view(ctx, xpath, doc, node, (pcilib_view_description_t*)&desc);
575
574
    if (err) return err;
601
600
            desc.write_to_reg = value;
602
601
            if ((value)&&(*value)) mode |= PCILIB_ACCESS_W;
603
602
        } else if (!strcasecmp(name, "script")) {
604
 
                        char* script_name = malloc(strlen(value));
605
 
                        sprintf(script_name, "%s", value);
 
603
                        desc.module = malloc(strlen(value));
 
604
                        sprintf(desc.module, "%s", value);
606
605
                        
607
 
                        err = pcilib_init_py_script(ctx, script_name, &(desc.script), &mode);
 
606
                        err = pcilib_py_init_script(ctx, desc.module, &mode);
608
607
                        if(err) return err;
609
608
                        mode |= PCILIB_REGISTER_INCONSISTENT;
610
609
                        break;
620
619
    return 0;
621
620
}
622
621
 
623
 
static int pcilib_xml_create_script_or_transform_view(pcilib_t *ctx, xmlXPathContextPtr xpath, xmlDocPtr doc, xmlNodePtr node) {
624
 
    /*
625
 
    int err;
626
 
    xmlAttrPtr cur;
627
 
    const char *name;
628
 
 
629
 
    int has_read_from_register = 0;
630
 
    int has_write_to_register = 0;
631
 
    int has_script = 0;
632
 
 
633
 
    //getting transform name in case of error
634
 
    pcilib_view_description_t desc = {0};
635
 
    err = pcilib_xml_parse_view(ctx, xpath, doc, node, &desc);
636
 
 
637
 
    for (cur = node->properties; cur != NULL; cur = cur->next) {
638
 
        if (!cur->children) continue;
639
 
        if (!xmlNodeIsText(cur->children)) continue;
640
 
 
641
 
        name = (char*)cur->name;
642
 
 
643
 
        if (!strcasecmp(name, "read_from_register"))
644
 
            has_read_from_register = 1;
645
 
        if (!strcasecmp(name, "write_to_register"))
646
 
            has_write_to_register = 1;
647
 
        if (!strcasecmp(name, "script"))
648
 
            has_script = 1;
649
 
    }
650
 
 
651
 
    if (has_script && (has_read_from_register || has_write_to_register)) {
652
 
        pcilib_error("Invalid transform group attributes specified in XML property (%s)."
653
 
                     "Transform could not contains both script and read_from_register"
654
 
                     " or write_to_register attributes at same time.", desc.name);
655
 
        return PCILIB_ERROR_INVALID_DATA;
656
 
    }
657
 
 
658
 
    if(has_script)
659
 
    
660
 
        return pcilib_xml_create_script_view(ctx, xpath, doc, node);
661
 
    else
662
 
    */
663
 
       return pcilib_xml_create_transform_view(ctx, xpath, doc, node);
664
 
}
665
 
 
666
 
 
667
622
static int pcilib_xml_parse_value_name(pcilib_t *ctx, xmlXPathContextPtr xpath, xmlDocPtr doc, xmlNodePtr node, pcilib_register_value_name_t *desc) {
668
623
    xmlAttr *cur;
669
624
    char *value, *name;
921
876
    nodeset = transform_nodes->nodesetval;
922
877
    if (!xmlXPathNodeSetIsEmpty(nodeset)) {
923
878
        for(i=0; i < nodeset->nodeNr; i++) {
924
 
            err = pcilib_xml_create_script_or_transform_view(ctx, xpath, doc, nodeset->nodeTab[i]);
 
879
            err = pcilib_xml_create_transform_view(ctx, xpath, doc, nodeset->nodeTab[i]);
925
880
            if (err) pcilib_error("Error (%i) creating register transform", err);
926
881
        }
927
882
    }