From 3a0056848974d85bbe5817bb63582c17c86ca0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Mon, 6 Jul 2015 11:51:24 +0100 Subject: [PATCH] warnings + some work on naming funnctions --- C/errors.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/C/errors.c b/C/errors.c index 892b4e2af..0bd571b41 100755 --- a/C/errors.c +++ b/C/errors.c @@ -99,6 +99,31 @@ Yap_Warning( const char *s, ... ) return true; } +bool +Yap_PrintWarning( Term twarning ) +{ + CACHE_REGS + PredEntry * pred = RepPredProp(PredPropByFunc(FunctorPrintMessage,PROLOG_MODULE)); //PROCEDURE_print_message2; + bool rc; + Term ts[2]; + + if (LOCAL_within_print_message) + return false; + LOCAL_within_print_message = true; + if (pred->OpcodeOfPred == UNDEF_OPCODE) { + fprintf(stderr, "warning message:\n"); + Yap_DebugPlWrite( twarning ); + fprintf(stderr, "\n"); + LOCAL_within_print_message = false; + return true; + } + ts[0] = MkAtomTerm( AtomWarning ); + ts[1] = twarning; + rc = Yap_execute_pred( pred, ts , true PASS_REGS); + LOCAL_within_print_message = false; + return rc; +} + int Yap_HandleError( const char *s, ... ) { CACHE_REGS yap_error_number err = LOCAL_Error_TYPE; @@ -598,6 +623,7 @@ Yap_NilError(yap_error_number type, const char *format,...) return res; } + yamop * Yap_Error(yap_error_number type, Term where, const char *format,...) {