diff --git a/.gitignore b/.gitignore index c26e269cc..0e09e3415 100644 --- a/.gitignore +++ b/.gitignore @@ -140,3 +140,7 @@ xcode Threads mxe caret + +configure + +cmake/cmake-android diff --git a/C/scanner.c b/C/scanner.c index 06c1f9d6f..68e82f4b9 100755 --- a/C/scanner.c +++ b/C/scanner.c @@ -1745,6 +1745,8 @@ TokEntry *Yap_tokenizer(struct stream_desc *inp_stream, bool store_comments, if (ch == '.' && (pch = Yap_peek(inp_stream - GLOBAL_Stream)) && (chtype(pch) == BS || chtype(pch) == EF || pch == '%')) { t->Tok = Ord(kind = eot_tok); + // consume... + ch = getchr(inp_stream); if (chtype(ch) == EF) { mark_eof(inp_stream); t->TokInfo = TermEof; diff --git a/os/iopreds.c b/os/iopreds.c index 967b77424..51de3e943 100644 --- a/os/iopreds.c +++ b/os/iopreds.c @@ -2003,9 +2003,10 @@ case ENC_ISO_UTF32_LE: // check http://unicode.org/faq/utf_bom.html#utf16-3 t[ABSOLUTE_FILE_NAME_EXPAND] = args[ABSOLUTE_FILE_NAME_EXPAND].tvalue; else t[ABSOLUTE_FILE_NAME_EXPAND] = TermFalse; - if (args[ABSOLUTE_FILE_NAME_GLOB].used) + if (args[ABSOLUTE_FILE_NAME_GLOB].used) { t[ABSOLUTE_FILE_NAME_GLOB] = args[ABSOLUTE_FILE_NAME_GLOB].tvalue; - else + t[ABSOLUTE_FILE_NAME_EXPAND] = TermTrue; + } else t[ABSOLUTE_FILE_NAME_GLOB] = TermEmptyAtom; if (args[ABSOLUTE_FILE_NAME_VERBOSE_FILE_SEARCH].used) t[ABSOLUTE_FILE_NAME_VERBOSE_FILE_SEARCH] = diff --git a/os/sysbits.c b/os/sysbits.c index 6507ce078..b1020cb90 100644 --- a/os/sysbits.c +++ b/os/sysbits.c @@ -946,10 +946,24 @@ do_expand_file_name(Term t1, Term opts USES_REGS) return tf; } +/* @pred expand_file_name( +Pattern, -ListOfPaths) is det + +This builtin receives a pattern and expands it into a list of files. + In Unix-like systems, YAP applies glob to expand patterns such as '*', '.', and '?'. Further variable expansion +may also happen. glob is shell-dependent: som Yap_InitCPred ("absolute_file_system_path", 2, absolute_file_system_path, 0); + Yap_InitCPred ("real_path", 2, prolog_realpath, 0); + Yap_InitCPred ("true_file_name", 2, + true_file_name, SyncPredFlag); + Yap_InitCPred ("true_file_name", 3, true_file_name3, SyncPredFlag); +e shells allow command execution and brace-expansion. + +*/ static Int expand_file_name( USES_REGS1) { Term tf = do_expand_file_name( Deref(ARG1), TermNil PASS_REGS); + if (tf == 0) + return false; return Yap_unify( tf, ARG2); } @@ -2298,16 +2312,15 @@ Yap_InitSysPreds(void) Yap_InitCPred ("expand_file_name", 2, expand_file_name, SyncPredFlag); Yap_InitCPred ("working_directory", 2,working_directory, SyncPredFlag); Yap_InitCPred ("prolog_to_os_filename", 2, prolog_to_os_filename, SyncPredFlag); - Yap_InitCPred ("prolog_to_os_filename", 2, prolog_to_os_filename, SyncPredFlag); -#ifdef _WIN32 - Yap_InitCPred ("win_registry_get_value", 3, p_win_registry_get_value,0); -#endif Yap_InitCPred ("absolute_file_system_path", 2, absolute_file_system_path, 0); Yap_InitCPred ("real_path", 2, prolog_realpath, 0); Yap_InitCPred ("true_file_name", 2, true_file_name, SyncPredFlag); Yap_InitCPred ("true_file_name", 3, true_file_name3, SyncPredFlag); - Yap_InitCPred ("rmdir", 2, p_rmdir, SyncPredFlag); + #ifdef _WIN32 + Yap_InitCPred ("win_registry_get_value", 3, p_win_registry_get_value,0); +#endif + Yap_InitCPred ("rmdir", 2, p_rmdir, SyncPredFlag); Yap_InitCPred ("make_directory", 1, make_directory, SyncPredFlag); } diff --git a/pl/boot.yap b/pl/boot.yap index ea7bd82b2..9e92b859a 100644 --- a/pl/boot.yap +++ b/pl/boot.yap @@ -927,7 +927,7 @@ number of steps. '$sort'(IVs, NVs), '$prep_answer_var_by_var'(NVs, LAnsw, LBlk), '$name_vars_in_goals'(LAnsw, Vs, NLAnsw), - '$write_vars_and_goals'(NLAnsw, first, FLAnsw). + '$write_vars_and_goals'(NLAnsw, first, FLAnsw). '$purge_dontcares'([],[]). '$purge_dontcares'([Name=_|Vs],NVs) :-