The C VOTable Parser Library.

[Introduction]- [Download]- [Tutorial]- [Reference]

Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

Initialization and memory management


Functions

xmlTextReaderPtr Init_VO_Parser (const char *filename, VOTable *votablePtr)
 Parser initialization
PURPOSE : Initializing of VOTable structure and creating xmlTextReader pointer.

int Free_VO_Parser (xmlTextReaderPtr reader, VOTable *votablePtr, int **column)
 VO_Parser memory free
PURPOSE : Free VOTable structure, column and xmlTextReader.


Detailed Description

Parser initializing and free memory

Function Documentation

int Free_VO_Parser xmlTextReaderPtr  reader,
VOTable votablePtr,
int **  column
 

VO_Parser memory free
PURPOSE : Free VOTable structure, column and xmlTextReader.

Parameters:
reader Pointer on xmlTextReader
votablePtr Pointer on VOTable structure
column Array representing the columns position to extract embedded in TABLEDATA
Returns:
RETURN_OK : free successed
RETURN_ERROR : xmlTextReaderClose failed

00425                                  {
00426   list_tabledata *vtabledata_move, *tmpPtr_tabledata;
00427 
00428   /* Cleanup memory */
00429    if (votablePtr->field != NULL)
00430     Free_VO_Fields(votablePtr->field,column);
00431   if (votablePtr->table != NULL)
00432     Free_VO_Table(votablePtr->table);
00433   if (votablePtr->tabledata != NULL)
00434     Free_VO_Tabledata(votablePtr->tabledata);
00435 
00436   xmlFreeTextReader(reader);
00437   
00438   /*
00439    * Cleanup function for the XML library.
00440    */
00441   xmlCleanupParser();
00442   /*
00443    * this is to debug memory for regression tests
00444    */
00445   xmlMemoryDump();
00446 
00447   return(RETURN_OK);
00448 }

xmlTextReaderPtr Init_VO_Parser const char *  filename,
VOTable votablePtr
 

Parser initialization
PURPOSE : Initializing of VOTable structure and creating xmlTextReader pointer.

Parameters:
filename VOTABLE filename
votablePtr Pointer on VOTable structure
Exceptions:
EXIT_READING can't read filename and exit program
Returns:
xmlTextReaderPtr Pointer on xmlTextReader
_VOTable structure initialized

00320                                                      {
00321 
00322   xmlTextReaderPtr reader;
00323 
00324   /* Initialisation linking lists */
00325   votablePtr->field = NULL;
00326   votablePtr->tabledata = NULL;
00327   votablePtr->table = NULL;
00328 
00329   /* Init xml Memory */
00330   xmlInitMemory();
00331 
00332   /* Reading file */
00333   if ((reader = xmlReaderForFile(filename, NULL, 0)) == NULL) {
00334     fprintf(stderr,"xmlReaderForFile failed\n");
00335     exit(EXIT_READING);
00336   }
00337 
00338   return(reader);
00339 }