enum block position;
enum outtype output_type;
-} parseData;
+} revisionData;
/* free_data and clean_data
* Also, frees memory dynamically allocated to store data.
*/
static void
-clean_data(parseData *data, int title)
+clean_data(revisionData *data, int title)
{
if (title) {
data->rev.title = NULL;
}
static void
-free_data(parseData *data, int title)
+free_data(revisionData *data, int title)
{
if (title) {
//printf("freeing article\n");
free(data->rev.text);
}
-cleanup_revision(parseData *data) {
+cleanup_revision(revisionData *data) {
free_data(data, 0);
clean_data(data, 0);
}
-cleanup_article(parseData *data) {
+cleanup_article(revisionData *data) {
free_data(data, 1);
clean_data(data, 1);
}
static void
-init_data(parseData *data, char *dropstr, int output_type)
+init_data(revisionData *data, char *dropstr, int output_type)
{
clean_data(data, 1); // sets every element to null...
data->dropstr = dropstr;
/* for debugging only, prints out the state of the data struct
*/
static void
-print_state(parseData *data)
+print_state(revisionData *data)
{
printf("element = %i\n", data->element);
printf("output_type = %i\n", data->output_type);
* it is called right before cleanup_revision() and cleanup_article()
*/
static void
-write_row(parseData *data)
+write_row(revisionData *data)
{
// define temporary variables to hold output values:
char *title, *articleid;
}
void
-split_timestamp(parseData *data)
+split_timestamp(revisionData *data)
{
char *t = data->rev.timestamp;
char date_buffer[DATE_LENGTH+1];
}
static void
-charhndl(parseData *data, char *s, int len)
+charhndl(revisionData *data, char *s, int len)
{
if (data->element != UNUSED && data->position != SKIP) {
char t[len];
}
static void
-start(parseData *data, const char *name, const char **attr)
+start(revisionData *data, const char *name, const char **attr)
{
if (strcmp(name,"title") == 0) {
static void
-end(parseData *data, const char *name)
+end(revisionData *data, const char *name)
{
if (strcmp(name, "revision") == 0 && data->position != SKIP) {
write_row(data); // crucial... :)
XML_Parser parser = XML_ParserCreate(NULL);
// initialize the user data struct which is passed to callback functions
- parseData data;
+ revisionData data;
// initialize the elements of the struct to default values
init_data(&data, dropstr, output_type);