From 04b33df0407e03175a56096cb7ff79a56bea9e88 Mon Sep 17 00:00:00 2001 From: zilio nicolas Date: Thu, 27 Aug 2015 16:26:48 +0200 Subject: some cleaning --- pcilib/xml.c | 36 ------------------------------------ pcilib/xml.h | 39 ++++----------------------------------- 2 files changed, 4 insertions(+), 71 deletions(-) (limited to 'pcilib') diff --git a/pcilib/xml.c b/pcilib/xml.c index 203b147..482ab25 100644 --- a/pcilib/xml.c +++ b/pcilib/xml.c @@ -111,7 +111,6 @@ xmlSchemaFreeValidCtxt(ctxt); xmlFreeDoc(doc); } -//! free the resource if(schema != NULL) xmlSchemaFree(schema); xmlSchemaCleanupTypes(); @@ -654,41 +653,6 @@ while(docs[count]!=NULL){ } } - - - -/** pcilib_xml_read_config - * - * function to get the config we want at line j, in order to be able to have a configuration file with pwd to files we want -* @param[in,out] xmlfile the string representating a pwd to a file we want to access in:uninitilized out: the pwd. -* @param[in] i the line at which the function should read the file to get the pwd. - */ -void pcilib_xml_read_config(char** xmlfile, int j){ - FILE *fp; - - fp=fopen("config.txt","r"); - char line[60]; - memset(line,'\0',60); - int i=0,k; - char *temp1; - if(fp==NULL) pcilib_error("can't find the configuration file: it must be near the executable"); - - while(fgets(line,60,fp)!=NULL){ - if(i==j) { - k=0; - temp1=calloc((strlen(line)),sizeof(char)); - while(line[k]!='\n'){ - temp1[k]=line[k]; - k++; - } - temp1[k]='\0'; - *xmlfile=temp1; - } - i++; - memset(line,'\0',60); - } -} - #ifdef VIEW_OK /* pcilib_xml_getnumberformulaviews * diff --git a/pcilib/xml.h b/pcilib/xml.h index ee7fdbd..00d2374 100644 --- a/pcilib/xml.h +++ b/pcilib/xml.h @@ -85,22 +85,6 @@ */ #define TRANSFORM_UNIT_PATH ((char*)"/units/unit[@name=\"%s\"]/convert_unit") - -/** -* this function takes a string and will create an abtract syntax tree from the xml file represented by the string. -* @param[in] filename the name of the xml file containing registers and banks. -* @return an AST corresponding to the xml file. -*/ -xmlDocPtr pcilib_xml_getdoc(char* filename); - -/** -* this function takes a context from an AST and an XPath expression, to produce a XPath object containing the nodes corresponding to the xpath expression. -* @param[in] doc the xpath context of the xml file. -* @param[in] xpath the value of the xpath expression that will be computed against the context. -* @return the Xpath object with the nodes we wanted. -*/ -xmlXPathObjectPtr pcilib_xml_getsetproperty(xmlXPathContextPtr doc, xmlChar *xpath); - /** * this function create the list of registers structures, that are manipulated during execution, from the xml file. * @param[in] doc the xpath context of the xml file. @@ -117,24 +101,9 @@ void pcilib_xml_initialize_registers(pcilib_t* pci, xmlDocPtr* doc); void pcilib_xml_initialize_banks(pcilib_t* pci,xmlDocPtr* doc); /** -* this function read the config file of the pcitool tool to give back the pwd of diverse files like the xml file to treat, the xsd file, the pythonscript file, the units xml file, the units xsd file. -* @param[in,out] xmlfile the string representating a pwd to a file we want to access in:uninitilized out: the pwd. -* @param[in] i the line at which the function should read the file to get the pwd. -*/ -void pcilib_xml_read_config(char** xmlfile, int i); - -/** -* this function validates the xml file against the xsd schema defined as the reference. -* @todo change the name of the function if accepted. -* @todo validation of unit file too? -*/ -void validation(); - - -/** -* this function create an XPath context (ie some sort of special AST only for XPath) from the AST of the xml file. -* @param[in] doc the AST of the xml file. -*/ -xmlXPathContextPtr pcilib_xml_getcontext(xmlDocPtr doc); + * this function gets the xml files and validates them, before returning pre-AST of them to initialize functions + *@param[out] docs the list of pre-AST of xml files parsed + */ +void pcilib_init_xml(xmlDocPtr* docs); #endif /*_XML_*/ -- cgit v1.2.3