#include "gedcom.h"
#include "output.h"
+#include "portability.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void header_end(Gedcom_rec rec, Gedcom_ctxt self)
{
- output(1, "Header end, context is %d\n", (int)self);
+ output(1, "Header end, context is %ld\n", void_ptr_to_int(self));
}
char family_xreftags[100][255];
struct xref_value *xr = GEDCOM_XREF_PTR(xref);
output(1, "Family start, xref is %s\n", xr->string);
strcpy(family_xreftags[family_nr], xr->string);
- xr->object = (Gedcom_ctxt)family_nr;
- return (Gedcom_ctxt)(family_nr++);
+ xr->object = (Gedcom_ctxt)int_to_void_ptr(family_nr);
+ return (Gedcom_ctxt)int_to_void_ptr(family_nr++);
}
Gedcom_ctxt rec_start(Gedcom_rec rec, int level, Gedcom_val xref, char *tag,
if (! GEDCOM_IS_NULL(xref))
xref_str = GEDCOM_XREF_PTR(xref)->string;
output(1, "Rec %s start, xref is %s\n", tag, xref_str);
- return (Gedcom_ctxt)tag_value;
+ return (Gedcom_ctxt)int_to_void_ptr(tag_value);
}
Gedcom_ctxt note_start(Gedcom_rec rec, int level, Gedcom_val xref, char *tag,
output(1, "== %d %s (%d) %s (xref is %s)\n",
level, tag, tag_value, GEDCOM_STRING(parsed_value),
GEDCOM_XREF_PTR(xref)->string);
- return (Gedcom_ctxt)tag_value;
+ return (Gedcom_ctxt)int_to_void_ptr(tag_value);
}
void family_end(Gedcom_rec rec, Gedcom_ctxt self)
{
- output(1, "Family end, xref is %s\n", family_xreftags[(int)self]);
+ output(1, "Family end, xref is %s\n",
+ family_xreftags[void_ptr_to_int(self)]);
}
Gedcom_ctxt submit_start(Gedcom_rec rec, int level, Gedcom_val xref, char *tag,
char *tag, char* raw_value,
int tag_value, Gedcom_val parsed_value)
{
- Gedcom_ctxt self = (Gedcom_ctxt)((int) parent + 1000);
- output(1, "Source is %s (ctxt is %d, parent is %d)\n",
- GEDCOM_STRING(parsed_value), (int) self, (int) parent);
+ Gedcom_ctxt self = (Gedcom_ctxt)(void_ptr_to_int(parent) + 1000);
+ output(1, "Source is %s (ctxt is %ld, parent is %ld)\n",
+ GEDCOM_STRING(parsed_value), void_ptr_to_int(self),
+ void_ptr_to_int(parent));
return self;
}
void source_end(Gedcom_elt elt, Gedcom_ctxt parent, Gedcom_ctxt self,
Gedcom_val parsed_value)
{
- output(1, "Source context %d in parent %d\n", (int)self, (int)parent);
+ output(1, "Source context %ld in parent %ld\n",
+ void_ptr_to_int(self), void_ptr_to_int(parent));
}
Gedcom_ctxt date_start(Gedcom_elt elt, Gedcom_ctxt parent, int level,
int tag_value, Gedcom_val parsed_value)
{
struct date_value dv;
- Gedcom_ctxt self = (Gedcom_ctxt)((int) parent + 1000);
+ Gedcom_ctxt self = (Gedcom_ctxt)(void_ptr_to_int(parent) + 1000);
dv = GEDCOM_DATE(parsed_value);
output(1, "Contents of the date_value:\n");
output(1, " raw value: %s\n", raw_value);
int tag_value, Gedcom_val parsed_value)
{
struct age_value age;
- Gedcom_ctxt self = (Gedcom_ctxt)((int) parent + 1000);
+ Gedcom_ctxt self = (Gedcom_ctxt)(void_ptr_to_int(parent) + 1000);
age = GEDCOM_AGE(parsed_value);
output(1, "Contents of the age_value:\n");
output(1, " raw value: %s\n", raw_value);
int conv_fails = 0;
if (raw_value)
converted = convert_utf8_to_locale(raw_value, &conv_fails);
- output(0, "== %d %s (%d) %s (ctxt is %d, conversion failures: %d)\n",
- level, tag, tag_value, converted, (int)ctxt, conv_fails);
+ output(0, "== %d %s (%d) %s (ctxt is %ld, conversion failures: %d)\n",
+ level, tag, tag_value, converted, void_ptr_to_int(ctxt), conv_fails);
total_conv_fails += conv_fails;
}