Esempio n. 1
0
static bool
read_triples(SerdReader* reader, ReadContext ctx, bool* ate_dot)
{
	bool      nested  = false;
	const Ref subject = read_subject(reader, ctx, &nested);
	bool      ret     = false;
	if (subject) {
		ctx.subject = subject;
		if (nested) {
			read_ws_star(reader);
			ret = true;
			if (peek_byte(reader) != '.') {
				ret = read_predicateObjectList(reader, ctx, ate_dot);
			}
		} else {
			TRY_RET(read_ws_plus(reader));
			ret = read_predicateObjectList(reader, ctx, ate_dot);
		}
		pop_node(reader, subject);
	} else {
		ret = false;
	}
	ctx.subject = ctx.predicate = 0;
	return ret;
}
int read_all_subjects(FILE *fi,subject **s,int *nsub,par_info *pi)
{
char id[MAX_ID_LENGTH+1];
int found_error;
found_error=0;
*nsub=0;
while (fgets(long_line,LONG_LINE_LENGTH,fi) && sscanf(long_line,"%s",id)==1)
  {
  if (*nsub==MAX_SUB)
    { error("Number of subjects exceeds MAX_SUB",""); return 0; }
  if (!read_subject(long_line,s[(*nsub)++],pi)) found_error=1;
  }
if (found_error)
  error("Error[s] found in data file","");
return !found_error;
}