fix_boot
This commit is contained in:
parent
0bfc4d4525
commit
0ca40875db
@ -2105,7 +2105,7 @@ X_API int YAP_InitConsult(int mode, const char *fname, char **full, int *osnop)
|
||||
CACHE_REGS
|
||||
int sno;
|
||||
BACKUP_MACHINE_REGS();
|
||||
char *fl = NULL;
|
||||
const char *fl = NULL;
|
||||
int lvl = push_text_stack();
|
||||
if (mode == YAP_BOOT_MODE) {
|
||||
mode = YAP_CONSULT_MODE; }
|
||||
@ -2126,10 +2126,12 @@ X_API int YAP_InitConsult(int mode, const char *fname, char **full, int *osnop)
|
||||
}
|
||||
|
||||
lvl = push_text_stack();
|
||||
bool consulted = (mode == YAP_CONSULT_MODE);
|
||||
char *d = Malloc(strlen(fl)+1);
|
||||
strcpy(d,fl);
|
||||
bool consulted = (mode == YAP_CONSULT_MODE);
|
||||
sno = Yap_OpenStream(MkStringTerm(fl), "r", MkAtomTerm(Yap_LookupAtom(fl)), LOCAL_encoding);
|
||||
if (sno < 0 ||
|
||||
!Yap_ChDir(dirname((char *)fl))) {
|
||||
if (sno < 0 ||
|
||||
!Yap_ChDir(dirname((char *)d))) {
|
||||
pop_text_stack(lvl);
|
||||
*full = NULL;
|
||||
return -1;
|
||||
@ -2167,12 +2169,16 @@ X_API FILE *YAP_TermToStream(Term t) {
|
||||
X_API void YAP_EndConsult(int sno, int *osnop, const char *full) {
|
||||
BACKUP_MACHINE_REGS();
|
||||
Yap_CloseStream(sno);
|
||||
Yap_ChDir(dirname(full));
|
||||
int lvl = push_text_stack();
|
||||
char *d = Malloc(strlen(full)+1);
|
||||
strcpy(d,full);
|
||||
Yap_ChDir(dirname(d));
|
||||
if (osnop >= 0)
|
||||
Yap_AddAlias(AtomLoopStream, *osnop);
|
||||
Yap_end_consult();
|
||||
__android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " closing %s(%d), %d", full, *osnop, sno);
|
||||
// LOCAL_CurSlot);
|
||||
pop_text_stack(lvl);
|
||||
RECOVER_MACHINE_REGS();
|
||||
}
|
||||
|
||||
|
@ -3575,7 +3575,7 @@ yamop *Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod,
|
||||
cglobs.space_op->rnd1 = cglobs.space_used;
|
||||
|
||||
#ifdef DEBUG
|
||||
if (GLOBAL_Option['g' - 96] || true)
|
||||
if (GLOBAL_Option['g' - 96] )
|
||||
Yap_ShowCode(&cglobs.cint);
|
||||
#endif
|
||||
} else {
|
||||
@ -3609,7 +3609,7 @@ yamop *Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod,
|
||||
if (LOCAL_ErrorMessage)
|
||||
return (0);
|
||||
#ifdef DEBUG
|
||||
if (GLOBAL_Option['g' - 96]||true)
|
||||
if (GLOBAL_Option['g' - 96])
|
||||
Yap_ShowCode(&cglobs.cint);
|
||||
#endif
|
||||
/* phase 2: classify variables and optimize temporaries */
|
||||
@ -3625,7 +3625,7 @@ yamop *Yap_cclause(volatile Term inp_clause, Int NOfArgs, Term mod,
|
||||
/* eliminate superfluous pop's and unify_var's */
|
||||
c_optimize(cglobs.cint.CodeStart);
|
||||
#ifdef DEBUG
|
||||
if (GLOBAL_Option['f' - 96]||true)
|
||||
if (GLOBAL_Option['f' - 96])
|
||||
Yap_ShowCode(&cglobs.cint);
|
||||
#endif
|
||||
|
||||
|
@ -969,6 +969,7 @@ bool Yap_RaiseException(void) {
|
||||
LOCAL_ActiveError->errorNo == YAP_NO_ERROR)
|
||||
return false;
|
||||
Yap_RestartYap(5);
|
||||
return false;
|
||||
//return Yap_JumpToEnv();
|
||||
}
|
||||
|
||||
|
4
C/exec.c
4
C/exec.c
@ -2115,8 +2115,8 @@ static Int jump_env(USES_REGS1) {
|
||||
"throw/1 must be called instantiated");
|
||||
}
|
||||
// Yap_DebugPlWriteln(t);
|
||||
char *buf = Yap_TermToBuffer(t, ENC_ISO_UTF8,
|
||||
Quote_illegal_f | Ignore_ops_f | Unfold_cyclics_f);
|
||||
// char *buf = Yap_TermToBuffer(t, ENC_ISO_UTF8,
|
||||
// Quote_illegal_f | Ignore_ops_f | Unfold_cyclics_f);
|
||||
// __android_log_print(ANDROID_LOG_INFO, "YAPDroid ", " throw(%s)", buf);
|
||||
LOCAL_ActiveError = Yap_UserError(t0, LOCAL_ActiveError);
|
||||
bool out = JumpToEnv(PASS_REGS1);
|
||||
|
2
C/text.c
2
C/text.c
@ -437,7 +437,7 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
|
||||
LOCAL_Error_TYPE = TYPE_ERROR_TEXT;
|
||||
}
|
||||
}
|
||||
LOCAL_ActiveError->errorRawTerm = MkStringTerm(inp->val.uc);
|
||||
LOCAL_ActiveError->errorRawTerm = MkUStringTerm(inp->val.uc);
|
||||
}
|
||||
if (LOCAL_Error_TYPE != YAP_NO_ERROR) {
|
||||
Yap_ThrowError(LOCAL_Error_TYPE, LOCAL_ActiveError->errorRawTerm, "Converting to text from term ");
|
||||
|
@ -1169,7 +1169,8 @@ bool Yap_initStream(int sno, FILE *fd, const char *name, const char *io_mode,
|
||||
st->user_name = file_name;
|
||||
st->file = fd;
|
||||
st->linepos = 0;
|
||||
return true;
|
||||
Yap_DefaultStreamOps(st);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool open_header(int sno, Atom open_mode) {
|
||||
@ -1667,7 +1668,7 @@ int Yap_OpenStream(Term tin, const char *io_mode, Term user_name,
|
||||
// fname = Yap_VF(fname);
|
||||
|
||||
|
||||
if (fill_stream(sno, st, tin,io_mode,user_name,enc))
|
||||
if (fill_stream(sno, st, tin,io_mode,user_name,enc))
|
||||
return sno;
|
||||
return -1;
|
||||
}
|
||||
|
@ -672,7 +672,7 @@ static void Yap_InitBackMYDDAS_SQLITE3Preds(void) {
|
||||
}
|
||||
|
||||
X_API void init_sqlite3(void) {
|
||||
Term cm = CurrentModule;
|
||||
//Term cm = CurrentModule;
|
||||
//CurrentModule = MkAtomTerm(Yap_LookupAtom("myddas_sqlite3"));
|
||||
|
||||
Yap_InitMYDDAS_SQLITE3Preds();
|
||||
|
Reference in New Issue
Block a user