+ else
+ return 0;
+}
+
+int gedcom_parse_file(const char* file_name)
+{
+ Encoding enc;
+ int result = 1;
+ FILE* file;
+
+ if (!init_called) {
+ gedcom_error(_("Internal error: GEDCOM parser not initialized"));
+ }
+ else {
+ file = fopen(file_name, "r");
+ if (!file) {
+ gedcom_error(_("Could not open file '%s': %s"),
+ file_name, strerror(errno));
+ }
+ else {
+ line_no = 1;
+ enc = determine_encoding(file);
+
+ if (lexer_init(enc, file)) {
+ line_no = 0;
+ make_xref_table();
+ result = gedcom_parse();
+ line_no = 0;
+ if (result == 0)
+ result = check_xref_table();
+ }
+ lexer_close();
+ fclose(file);
+ }