droid
This commit is contained in:
parent
86c71b6da7
commit
52d69d3c06
2
C/text.c
2
C/text.c
@ -550,10 +550,8 @@ unsigned char *Yap_readText(seq_tv_t *inp USES_REGS) {
|
|||||||
POPRET( (char*)latin2utf8(inp));
|
POPRET( (char*)latin2utf8(inp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inp->enc == ENC_ISO_UTF8) {
|
|
||||||
pop_text_stack(lvl);
|
pop_text_stack(lvl);
|
||||||
return inp->val.c;
|
return inp->val.c;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (inp->type & YAP_STRING_WCHARS) {
|
if (inp->type & YAP_STRING_WCHARS) {
|
||||||
// printf("%S\n",inp->val.w);
|
// printf("%S\n",inp->val.w);
|
||||||
|
61
CXX/yapi.cpp
61
CXX/yapi.cpp
@ -125,6 +125,7 @@ YAPAtomTerm::YAPAtomTerm(char s[]) { // build string
|
|||||||
|
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
|
inp.enc = LOCAL_encoding;
|
||||||
inp.val.c = s;
|
inp.val.c = s;
|
||||||
inp.type = YAP_STRING_CHARS;
|
inp.type = YAP_STRING_CHARS;
|
||||||
out.type = YAP_STRING_ATOM;
|
out.type = YAP_STRING_ATOM;
|
||||||
@ -142,7 +143,8 @@ YAPAtomTerm::YAPAtomTerm(char *s, size_t len) { // build string
|
|||||||
seq_tv_t inp, out;
|
seq_tv_t inp, out;
|
||||||
inp.val.c = s;
|
inp.val.c = s;
|
||||||
inp.type = YAP_STRING_CHARS;
|
inp.type = YAP_STRING_CHARS;
|
||||||
out.type = YAP_STRING_ATOM | YAP_STRING_NCHARS | YAP_STRING_TRUNC;
|
inp.enc = LOCAL_encoding;
|
||||||
|
out.type = YAP_STRING_ATOM | YAP_STRING_NCHARS | YAP_STRING_TRUNC;
|
||||||
out.max = len;
|
out.max = len;
|
||||||
if (Yap_CVT_Text(&inp, &out PASS_REGS))
|
if (Yap_CVT_Text(&inp, &out PASS_REGS))
|
||||||
mk(MkAtomTerm(out.val.a));
|
mk(MkAtomTerm(out.val.a));
|
||||||
@ -253,15 +255,66 @@ YAPApplTerm::YAPApplTerm(YAPFunctor f, YAPTerm ts[]) {
|
|||||||
RECOVER_H();
|
RECOVER_H();
|
||||||
}
|
}
|
||||||
|
|
||||||
YAPApplTerm::YAPApplTerm(std::string f, std::vector<YAPTerm> ts) {
|
YAPApplTerm::YAPApplTerm(std::string f, std::vector<Term> ts) {
|
||||||
BACKUP_H();
|
BACKUP_H();
|
||||||
arity_t arity = ts.size();
|
arity_t arity = ts.size();
|
||||||
Functor ff = Yap_MkFunctor(Yap_LookupAtom(f.c_str()), arity);
|
Functor ff = Yap_MkFunctor(Yap_LookupAtom(f.c_str()), arity);
|
||||||
Term o = Yap_MkNewApplTerm(ff, arity);
|
Term o = Yap_MkNewApplTerm(ff, arity);
|
||||||
Term *tt = RepAppl(o) + 1;
|
Term *tt = RepAppl(o) + 1;
|
||||||
for (arity_t i = 0; i < arity; i++)
|
for (arity_t i = 0; i < arity; i++)
|
||||||
tt[i] = ts[i].term();
|
tt[i] = ts[i];
|
||||||
mk(o);
|
mk(o);
|
||||||
|
RECOVER_H();
|
||||||
|
}
|
||||||
|
|
||||||
|
YAPApplTerm::YAPApplTerm(std::string f, YAPTerm a1) {
|
||||||
|
BACKUP_H();
|
||||||
|
arity_t arity = 1;
|
||||||
|
Functor ff = Yap_MkFunctor(Yap_LookupAtom(f.c_str()), arity);
|
||||||
|
Term o = Yap_MkNewApplTerm(ff, arity);
|
||||||
|
Term *tt = RepAppl(o) + 1;
|
||||||
|
tt[0] = a1.term();
|
||||||
|
mk(o);
|
||||||
|
RECOVER_H();
|
||||||
|
}
|
||||||
|
|
||||||
|
YAPApplTerm::YAPApplTerm(std::string f, YAPTerm a1, YAPTerm a2) {
|
||||||
|
BACKUP_H();
|
||||||
|
arity_t arity = 2;
|
||||||
|
Functor ff = Yap_MkFunctor(Yap_LookupAtom(f.c_str()), arity);
|
||||||
|
Term o = Yap_MkNewApplTerm(ff, arity);
|
||||||
|
Term *tt = RepAppl(o) + 1;
|
||||||
|
tt[0] = a1.term();
|
||||||
|
tt[1] = a2.term();
|
||||||
|
mk(o);
|
||||||
|
RECOVER_H();
|
||||||
|
}
|
||||||
|
|
||||||
|
YAPApplTerm::YAPApplTerm(std::string f, YAPTerm a1, YAPTerm a2, YAPTerm a3) {
|
||||||
|
BACKUP_H();
|
||||||
|
arity_t arity = 3;
|
||||||
|
Functor ff = Yap_MkFunctor(Yap_LookupAtom(f.c_str()), arity);
|
||||||
|
Term o = Yap_MkNewApplTerm(ff, arity);
|
||||||
|
Term *tt = RepAppl(o) + 1;
|
||||||
|
tt[0] = a1.term();
|
||||||
|
tt[2] = a2.term();
|
||||||
|
tt[3] = a3.term();
|
||||||
|
mk(o);
|
||||||
|
RECOVER_H();
|
||||||
|
}
|
||||||
|
|
||||||
|
YAPApplTerm::YAPApplTerm(std::string f, YAPTerm a1, YAPTerm a2, YAPTerm a3, YAPTerm a4) {
|
||||||
|
BACKUP_H();
|
||||||
|
arity_t arity = 4;
|
||||||
|
Functor ff = Yap_MkFunctor(Yap_LookupAtom(f.c_str()), arity);
|
||||||
|
Term o = Yap_MkNewApplTerm(ff, arity);
|
||||||
|
Term *tt = RepAppl(o) + 1;
|
||||||
|
tt[0] = a1.term();
|
||||||
|
tt[2] = a2.term();
|
||||||
|
tt[3] = a3.term();
|
||||||
|
tt[4] = a4.term();
|
||||||
|
mk(o);
|
||||||
|
RECOVER_H();
|
||||||
}
|
}
|
||||||
|
|
||||||
YAPApplTerm::YAPApplTerm(YAPFunctor f) : YAPTerm() {
|
YAPApplTerm::YAPApplTerm(YAPFunctor f) : YAPTerm() {
|
||||||
@ -524,7 +577,7 @@ bool YAPEngine::mgoal(Term t, Term tmod, bool release) {
|
|||||||
#endif
|
#endif
|
||||||
CACHE_REGS
|
CACHE_REGS
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
Term *ts = nullptr;
|
Term *ts = nullptr;
|
||||||
q.CurSlot = Yap_StartSlots();
|
q.CurSlot = Yap_StartSlots();
|
||||||
q.p = P;
|
q.p = P;
|
||||||
q.cp = CP;
|
q.cp = CP;
|
||||||
|
22
CXX/yapt.hh
22
CXX/yapt.hh
@ -297,15 +297,19 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
YAPApplTerm(Term t0) { mk(t0); }
|
YAPApplTerm(Term t0) { mk(t0); }
|
||||||
YAPApplTerm(Functor f, Term ts[]) {
|
YAPApplTerm(Functor f, Term ts[]) {
|
||||||
BACKUP_MACHINE_REGS();
|
BACKUP_MACHINE_REGS();
|
||||||
Term t0 = Yap_MkApplTerm(f, f->ArityOfFE, ts);
|
Term t0 = Yap_MkApplTerm(f, f->ArityOfFE, ts);
|
||||||
mk(t0);
|
mk(t0);
|
||||||
RECOVER_MACHINE_REGS();
|
RECOVER_MACHINE_REGS();
|
||||||
};
|
};
|
||||||
YAPApplTerm(YAPFunctor f, YAPTerm ts[]);
|
YAPApplTerm(YAPFunctor f, YAPTerm ts[]);
|
||||||
YAPApplTerm(const std::string s, unsigned int arity) { mk(Yap_MkNewApplTerm(Yap_MkFunctor(Yap_LookupAtom(s.c_str()), arity), arity)); };
|
YAPApplTerm( std::string s, unsigned int arity) { mk(Yap_MkNewApplTerm(Yap_MkFunctor(Yap_LookupAtom(s.c_str()), arity), arity)); };
|
||||||
YAPApplTerm(const std::string s, std::vector<YAPTerm> ts);
|
YAPApplTerm( std::string s, std::vector<Term> v);
|
||||||
|
YAPApplTerm( std::string s, YAPTerm a1);
|
||||||
|
YAPApplTerm( std::string s, YAPTerm a1, YAPTerm a2);
|
||||||
|
YAPApplTerm( std::string s, YAPTerm a1, YAPTerm a2, YAPTerm a3);
|
||||||
|
YAPApplTerm( std::string s, YAPTerm a1, YAPTerm a2, YAPTerm a3, YAPTerm a4);
|
||||||
YAPApplTerm(YAPFunctor f);
|
YAPApplTerm(YAPFunctor f);
|
||||||
inline Functor functor() { return FunctorOfTerm(gt()); }
|
inline Functor functor() { return FunctorOfTerm(gt()); }
|
||||||
inline YAPFunctor getFunctor() { return YAPFunctor(FunctorOfTerm(gt())); }
|
inline YAPFunctor getFunctor() { return YAPFunctor(FunctorOfTerm(gt())); }
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
:- stop_low_level_trace.
|
|
||||||
|
|
||||||
|
|
||||||
:- use_module(library(lists)).
|
:- use_module(library(lists)).
|
||||||
@ -14,10 +13,17 @@ main_ :-
|
|||||||
fail.
|
fail.
|
||||||
main_ .
|
main_ .
|
||||||
|
|
||||||
|
:- if yap_flag(android,true).
|
||||||
init :-
|
init :-
|
||||||
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
|
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
|
||||||
% db_open(sqlite3, 'chinook.db', _, _),
|
% db_open(sqlite3, 'chinook.db', _, _),
|
||||||
writeln('chinook has landed').
|
writeln('chinook has landed').
|
||||||
|
:- else.
|
||||||
|
init :-
|
||||||
|
db_open(sqlite3, '/data/user/0/pt.up.yap.yapdroid/files/Yap/chinook.db', _, _),
|
||||||
|
% db_open(sqlite3, 'chinook.db', _, _),
|
||||||
|
writeln('chinook has landed').
|
||||||
|
:-endif
|
||||||
|
|
||||||
go :-
|
go :-
|
||||||
writeln(('db_import')),
|
writeln(('db_import')),
|
||||||
|
@ -36,12 +36,12 @@ DEPENDS pllibpl ${pl_os_library}
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command (OUTPUT ${CMAKE_SWIG_OUTPUT}/swig_streamer.cpp
|
add_custom_command (OUTPUT ${CMAKE_SWIG_OUTPUT}/swig_streamer.cpp
|
||||||
COMMAND ${SWIG_EXECUTABLE} -c++ -java -package ${SWIG_MODULE_NAME} -outdir ${CMAKE_SWIG_OUTDIR} -addextern -I${CMAKE_CURRENT_SOURCE_DIR} -o ${CMAKE_SWIG_OUTPUT}/swig_streamer.cpp -oh ${CMAKE_SWIG_OUTPUT}/swig_streamer.hh streamer.i
|
COMMAND ${SWIG_EXECUTABLE} -c++ -java -package ${SWIG_MODULE_NAME} -O -outdir ${CMAKE_SWIG_OUTDIR} -addextern -I${CMAKE_CURRENT_SOURCE_DIR} -o ${CMAKE_SWIG_OUTPUT}/swig_streamer.cpp -oh ${CMAKE_SWIG_OUTPUT}/swig_streamer.hh streamer.i
|
||||||
DEPENDS streamer.i
|
DEPENDS streamer.i
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command (OUTPUT ${CMAKE_SWIG_OUTPUT}/yap_swig.cpp
|
add_custom_command (OUTPUT ${CMAKE_SWIG_OUTPUT}/yap_swig.cpp
|
||||||
COMMAND ${SWIG_EXECUTABLE} -c++ -java -package ${SWIG_MODULE_NAME} -outdir ${CMAKE_SWIG_OUTDIR} -addextern -I${CMAKE_SOURCE_DIR}/CXX -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/H -I${CMAKE_SOURCE_DIR}/os -I${CMAKE_SOURCE_DIR}/OPTYap -I${CMAKE_BINARY_DIR} -I${GMP_INCLUDE_DIRS} -DX_API="" -o ${CMAKE_SWIG_OUTPUT}/yap_swig.cpp -oh ${CMAKE_SWIG_OUTPUT}/yap_swig.hh ${SWIG_SOURCES}
|
COMMAND ${SWIG_EXECUTABLE} -c++ -java -package ${SWIG_MODULE_NAME} -O -outdir ${CMAKE_SWIG_OUTDIR} -addextern -I${CMAKE_SOURCE_DIR}/CXX -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/H -I${CMAKE_SOURCE_DIR}/os -I${CMAKE_SOURCE_DIR}/OPTYap -I${CMAKE_BINARY_DIR} -I${GMP_INCLUDE_DIRS} -DX_API="" -o ${CMAKE_SWIG_OUTPUT}/yap_swig.cpp -oh ${CMAKE_SWIG_OUTPUT}/yap_swig.hh ${SWIG_SOURCES}
|
||||||
DEPENDS pllibos ${SWIG_SOURCES} YAP++)
|
DEPENDS pllibos ${SWIG_SOURCES} YAP++)
|
||||||
|
|
||||||
|
|
||||||
|
@ -478,4 +478,8 @@ If this hook preodicate succeeds it must instantiate the _Action_ argument to t
|
|||||||
:- ensure_loaded('../pl/pathconf.yap').
|
:- ensure_loaded('../pl/pathconf.yap').
|
||||||
|
|
||||||
:- yap_flag(user:unknown,error).
|
:- yap_flag(user:unknown,error).
|
||||||
|
|
||||||
|
:- ensure_loaded('../android.yap').
|
||||||
|
|
||||||
|
|
||||||
%% @}
|
%% @}
|
||||||
|
Reference in New Issue
Block a user