Assists music production by grouping standalone programs into sessions. Community version of "Non Session Manager".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.6KB

  1. /*******************************************************************************/
  2. /* Copyright (C) 2008-2020 Jonathan Moore Liles (as "Non-Session-Manager") */
  3. /* Copyright (C) 2020- Nils Hilbricht */
  4. /* */
  5. /* This file is part of New-Session-Manager */
  6. /* */
  7. /* New-Session-Manager is free software: you can redistribute it and/or modify */
  8. /* it under the terms of the GNU General Public License as published by */
  9. /* the Free Software Foundation, either version 3 of the License, or */
  10. /* (at your option) any later version. */
  11. /* */
  12. /* New-Session-Manager is distributed in the hope that it will be useful, */
  13. /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
  14. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
  15. /* GNU General Public License for more details. */
  16. /* */
  17. /* You should have received a copy of the GNU General Public License */
  18. /* along with New-Session-Manager. If not, see <https://www.gnu.org/licenses/>.*/
  19. /*******************************************************************************/
  20. #include "debug.h"
  21. #include <string.h>
  22. #include <stdio.h>
  23. #include <stdarg.h>
  24. extern char * program_invocation_short_name;
  25. bool quietMessages = false;
  26. void
  27. warnf ( warning_t level,
  28. const char *module,
  29. const char *file,
  30. const char *function, int line, const char *fmt, ... )
  31. {
  32. va_list args;
  33. static const char *level_tab[] = {
  34. "message", "",
  35. "warning", "",
  36. "assertion", ""
  37. };
  38. module = program_invocation_short_name;
  39. if ( module )
  40. fprintf( stderr, "[%s] ", module );
  41. #ifndef NDEBUG
  42. if ( file )
  43. fprintf( stderr, "%s", file );
  44. if ( line )
  45. fprintf( stderr, ":%i", line );
  46. if ( function )
  47. fprintf( stderr, " %s()", function );
  48. fprintf( stderr, ": " );
  49. #endif
  50. if ( unsigned( ( level << 1 ) + 1 ) <
  51. ( sizeof( level_tab ) / sizeof( level_tab[0] ) ) )
  52. fprintf( stderr, "%s", level_tab[( level << 1 ) + 1] );
  53. if ( fmt )
  54. {
  55. va_start( args, fmt );
  56. vfprintf( stderr, fmt, args );
  57. va_end( args );
  58. }
  59. fprintf( stderr, "\n" );
  60. }