|
1071 | 1071 | nonvar(F),atom(F), |
1072 | 1072 | ast_to_prolog_aux(no_caller,fn_impl(F,Args,Res),Head), |
1073 | 1073 | ast_to_prolog_aux(Head,Body,Body1), |
1074 | | - print_tree_nl(Head:-Body1)))). |
| 1074 | + ppt(Head:-Body1)))). |
1075 | 1075 |
|
1076 | 1076 |
|
1077 | 1077 | is_like_eval_20(E20):- atom(E20),atom_concat(eval,_,E20), |
|
1124 | 1124 | maplist(println_impl,Out), |
1125 | 1125 | make_nop(RetType,[],Res),check_returnval(Eq,RetType,Res). |
1126 | 1126 |
|
1127 | | -println_impl(X):- ttyflush,user_io((format("~N~@~N",[write_sln(X)]))),!,flush_output,ttyflush. |
| 1127 | +println_impl(X):- ttyflush, |
| 1128 | + user_io((format("~N"),write_sln(X),format("~N"))),flush_output,ttyflush. |
1128 | 1129 | %println_impl(X):- user_io((ansi_format(fg('#c7ea46'),"~N~@~N",[write_sln(X)]))),flush_output. |
1129 | 1130 | %println_impl(X):- ((ansi_format(fg('#c7ea46'),"~N~@~N",[write_sln(X)]))),flush_output. |
1130 | 1131 |
|
1131 | | -princ_impl(X):- format("~@",[write_sln(X)]),!,flush_output. |
| 1132 | +princ_impl(X):- user_io((write_sln(X))),flush_output,ttyflush. |
1132 | 1133 |
|
1133 | 1134 | write_sln(X):- string(X), !, write(X),flush_output. |
1134 | 1135 | write_sln(X):- write_src_woi(X),flush_output. |
|
1946 | 1947 | eval_20(_Eq,_RetType,_Depth,_Self,['decons',OneArg],[H,T]):- !, must_unify(OneArg,[H|T]). |
1947 | 1948 | eval_20(_Eq,_RetType,_Depth,_Self,['cons'|TwoArgs],[H|T]):-!, must_unify(TwoArgs,[H,T]). |
1948 | 1949 |
|
| 1950 | +should_be(P1,Term):- call(P1,Term)-> true ; (debug_info(porting,hyperon_throws_error(should_be(P1,Term))),fail). |
1949 | 1951 |
|
1950 | 1952 | %eval_20(Eq,RetType,Depth,Self,['get-doc'|Args],Res):- !,with_all_spaces(eval_args(Eq,RetType,Depth,Self,['metta-get-doc'|Args],Res)),!. |
1951 | 1953 | %eval_20(Eq,RetType,Depth,Self,['help!'|Args],Res):-!,with_all_spaces(eval_args(Eq,RetType,Depth,Self,['metta-help!'|Args],Res)),!. |
|
3112 | 3114 |
|
3113 | 3115 |
|
3114 | 3116 | eval_20(_Eq,_RetType,_Depth,_Self,['call-string!',Str],NoResult):- !,'call-string!'(Str,NoResult). |
| 3117 | +eval_40(_Eq,_RetType,_Depth,_Self,['call-string',Str],NoResult):- !,'call-string!'(Str,NoResult). |
3115 | 3118 |
|
3116 | 3119 | 'call-string!'(Str,NoResult):- |
3117 | 3120 | read_term_from_atom(Str,Term,[variables(Vars)]),!, |
3118 | | - call(Term),NoResult=Vars. |
| 3121 | + stream_property(Err, file_no(2)), |
| 3122 | + user_io(with_output_to(Err,(format('~N'),call(Term),format('~N')))), |
| 3123 | + NoResult=Vars. |
3119 | 3124 |
|
3120 | 3125 |
|
3121 | 3126 | /* |
|
3422 | 3427 | % Constructs a compound term for the Python function call with adjusted arguments. |
3423 | 3428 | compound_name_arguments(Call, PyFun, Adjusted), |
3424 | 3429 | % Optionally prints a debug tree of the Python call if tracing is enabled. |
3425 | | - if_trace(host;python, print_tree(py_call(PyModule:Call, RetVal))), |
| 3430 | + if_trace(host;python, ppt(py_call(PyModule:Call, RetVal))), |
3426 | 3431 | % Executes the Python function call and captures the result in MVal which propagates to RetVal. |
3427 | 3432 | py_call(PyModule:Call, MVal), |
3428 | 3433 | % Checks the return value against the expected type and criteria. |
|
3444 | 3449 | %fake_notrace( \+ is_user_defined_goal(Self,[AE|More])),!, |
3445 | 3450 | % adjust_args(Depth,Self,AE,More,Adjusted), |
3446 | 3451 | maplist(as_prolog_x(Depth,Self), More , Adjusted), |
3447 | | - if_trace(host;prolog;e,print_tree(apply(Pred,Adjusted))), |
| 3452 | + if_trace(host;prolog;e,ppt(apply(Pred,Adjusted))), |
3448 | 3453 | with_metta_ctx(Eq,RetType,Depth,Self,[AE|More],catch_warn(efbug(show_call,eval_call(apply(Pred,Adjusted),TF)))), |
3449 | 3454 | check_returnval(Eq,RetType,TF). |
3450 | 3455 |
|
|
3519 | 3524 | %current_predicate(Pred/Len1), |
3520 | 3525 | maplist(as_prolog_x(Depth,Self),More,Adjusted), |
3521 | 3526 | append(Adjusted,[Res],Args),!, |
3522 | | - if_trace(host;prolog,print_tree(apply(Pred,Args))), |
| 3527 | + if_trace(host;prolog,ppt(apply(Pred,Args))), |
3523 | 3528 | with_metta_ctx(Eq,RetType,Depth,Self,[AE|More],efbug(show_call,catch_warn(apply(Pred,Args)))), |
3524 | 3529 | check_returnval(Eq,RetType,Res). |
3525 | 3530 |
|
|
0 commit comments