1 /* 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Copyright (C) Scilab Enterprises - 2015 - Pierre-Aime Agnel 4 * 5 * Copyright (C) 2012 - 2016 - Scilab Enterprises 6 * 7 * This file is hereby licensed under the terms of the GNU GPL v2.0, 8 * pursuant to article 5.3.4 of the CeCILL v.2.1. 9 * This file was originally licensed under the terms of the CeCILL v2.1, 10 * and continues to be available under such terms. 11 * For more information, see the COPYING file which you should have received 12 * along with this program. 13 * 14 */ 15 16 #include "scilabexception.hxx" 17 18 extern "C" 19 { 20 #include "sciprint.h" 21 #include "Sciwarning.h" 22 #include "configvariable_interface.h" 23 } 24 25 Sciwarning(const char * msg,...)26int Sciwarning(const char *msg, ...) 27 { 28 int retval = 0; 29 if (getWarningMode()) 30 { 31 //print warning message 32 va_list ap; 33 va_start(ap, msg); 34 scivprint(msg, ap); 35 va_end(ap); 36 37 if (getWarningStop()) 38 { 39 // Configuration variable WarningStop is set to true 40 // Warning becomes an error and throws the ast exception 41 // to retrieve the line the error was generated at 42 throw ast::InternalError(_("*** Execution stopped after a warning. ***\nSet warning(\"on\") to continue execution after a warning.\n")); 43 } 44 } 45 return retval; 46 } 47