reformatting

This commit is contained in:
Vítor Santos Costa 2016-02-14 04:15:28 +00:00
parent ae65bb0265
commit 0a9f37710c

View File

@ -183,8 +183,7 @@ static int parse_quasi_quotations(ReadData _PL_rd ARG_LD) {
#define READ_DEFS() \
PAR("comments", list_filler, READ_COMMENTS), \
PAR("module", isatom, READ_MODULE), \
PAR("priority", nat, READ_PRIORITY), \
PAR("module", isatom, READ_MODULE), PAR("priority", nat, READ_PRIORITY), \
PAR("quasi_quotations", filler, READ_QUASI_QUOTATIONS), \
PAR("term_position", filler, READ_TERM_POSITION), \
PAR("syntax_errors", isatom, READ_SYNTAX_ERRORS), \
@ -524,9 +523,7 @@ static void reset_regs(TokEntry *tokstart, FEnv *fe) {
POPFET(qq);
}
static Term
get_variables(FEnv *fe, TokEntry *tokstart)
{
static Term get_variables(FEnv *fe, TokEntry *tokstart) {
Term v;
if (fe->vp) {
while (true) {
@ -545,10 +542,7 @@ get_variables(FEnv *fe, TokEntry *tokstart)
return 0;
}
static Term
get_varnames(FEnv *fe, TokEntry *tokstart)
{
static Term get_varnames(FEnv *fe, TokEntry *tokstart) {
Term v;
if (fe->np) {
while (true) {
@ -567,10 +561,7 @@ get_varnames(FEnv *fe, TokEntry *tokstart)
return 0;
}
static Term
get_singletons(FEnv *fe, TokEntry *tokstart)
{
static Term get_singletons(FEnv *fe, TokEntry *tokstart) {
Term v;
if (fe->sp) {
while (TRUE) {
@ -587,9 +578,7 @@ get_singletons(FEnv *fe, TokEntry *tokstart)
return 0;
}
static void
warn_singletons(FEnv *fe, TokEntry *tokstart)
{
static void warn_singletons(FEnv *fe, TokEntry *tokstart) {
Term v;
fe->sp = TermNil;
v = get_singletons(fe, tokstart);
@ -610,10 +599,7 @@ warn_singletons(FEnv *fe, TokEntry *tokstart)
}
}
static Term
get_stream_position(FEnv *fe, TokEntry *tokstart)
{
static Term get_stream_position(FEnv *fe, TokEntry *tokstart) {
Term v;
if (fe->tp) {
while (true) {
@ -630,8 +616,6 @@ get_stream_position(FEnv *fe, TokEntry *tokstart)
return 0;
}
static bool complete_processing(FEnv *fe, TokEntry *tokstart) {
CACHE_REGS
Term v1, v2, v3, vc, tp;
@ -662,17 +646,15 @@ static bool complete_processing(FEnv *fe, TokEntry *tokstart) {
Yap_clean_tokenizer(tokstart, LOCAL_VarTable, LOCAL_AnonVarTable);
// trail must be ok by now.]
if ( ( !v1 || Yap_unify(v1, fe->vp) ) &&
( !v2 || Yap_unify(v2, fe->np)) &&
( !v3 || Yap_unify(v3, fe->sp)) &&
( !tp || Yap_unify(tp, fe->tp)) &&
( !vc || Yap_unify(vc, fe->tcomms)))
return fe->t;
return 0;
if (fe->t) {
return (!v1 || Yap_unify(v1, fe->vp)) && (!v2 || Yap_unify(v2, fe->np)) &&
(!v3 || Yap_unify(v3, fe->sp)) && (!tp || Yap_unify(tp, fe->tp)) &&
(!vc || Yap_unify(vc, fe->tcomms));
}
return true;
}
static bool complete_clause_processing(FEnv *fe, TokEntry
*tokstart) {
static bool complete_clause_processing(FEnv *fe, TokEntry *tokstart) {
CACHE_REGS
Term v_vp, v_vnames, v_comments, v_pos;
@ -701,12 +683,13 @@ static bool complete_clause_processing(FEnv *fe, TokEntry
Yap_clean_tokenizer(tokstart, LOCAL_VarTable, LOCAL_AnonVarTable);
// trail must be ok by now.]
if ( ( !v_vp || Yap_unify(v_vp, fe->vp) ) &&
if (fe->t) {
return (!v_vp || Yap_unify(v_vp, fe->vp)) &&
(!v_vnames || Yap_unify(v_vnames, fe->np)) &&
(!v_pos || Yap_unify(v_pos, fe->tp)) &&
( !v_comments || Yap_unify(v_comments, fe->tcomms)))
return fe->t;
return 0;
(!v_comments || Yap_unify(v_comments, fe->tcomms));
}
return true;
}
static parser_state_t initParser(Term opts, FEnv *fe, REnv *re, int inp_stream,
@ -780,7 +763,7 @@ static parser_state_t initParser(Term opts, FEnv *fe, REnv *re, int inp_stream,
fe->args = setReadEnv(opts, fe, re, inp_stream);
}
if (fe->args == NULL) {
if (LOCAL_Error_TYPE == DOMAIN_ERROR_OUT_OF_RANGE)
if (LOCAL_Error_TYPE == DOMAIN_ERROR_READ_OPTION)
LOCAL_Error_TYPE = DOMAIN_ERROR_READ_OPTION;
if (LOCAL_Error_TYPE)
Yap_Error(LOCAL_Error_TYPE, LOCAL_Error_Term, NULL);
@ -940,6 +923,8 @@ Term Yap_read_term(int inp_stream, Term opts, int nargs) {
switch (state) {
case YAP_START_PARSING:
state = initParser(opts, &fe, &re, inp_stream, nargs);
if (state == YAP_PARSING_FINISHED)
return 0;
break;
case YAP_SCANNING:
state = scan(&re, &fe, inp_stream);
@ -953,8 +938,7 @@ Term Yap_read_term(int inp_stream, Term opts, int nargs) {
case YAP_PARSING_ERROR:
state = parseError(&re, &fe, inp_stream);
break;
case YAP_PARSING_FINISHED:
{
case YAP_PARSING_FINISHED: {
CACHE_REGS
bool done;
if (fe.reading_clause)
@ -996,7 +980,6 @@ static Int read_term(
inp_stream = Yap_CheckTextStream(ARG1, Input_Stream_f, "read/3");
if (inp_stream == -1) {
return (FALSE);
}
out = Yap_read_term(inp_stream, ARG3, 3);
UNLOCK(GLOBAL_Stream[inp_stream].streamlock);
@ -1105,7 +1088,6 @@ static Int read_clause2(USES_REGS1) {
return rc && Yap_unify(tf, rc);
}
/**
* @pred read_clause( +_Stream_, -_Clause_, ?_Opts) is det
*
@ -1144,7 +1126,6 @@ static Int read_clause(
return out && Yap_unify(tf, out);
}
/**
* @pred source_location( - _File_ , _Line_ )
*
@ -1299,8 +1280,6 @@ Term Yap_StringToTerm(const char *s, size_t len, encoding_t *encp, int prio,
return rval;
}
/**
* @pred read_term_from_atom( +_Atom_ , - _T_ , + _VarNames_
*
@ -1457,7 +1436,6 @@ static Term readFromBuffer(const char *s, Term opts) {
return rval;
}
/**
* @pred read_term_from_string( +_String_ , - _T_ , + _Options_
*