mirror of
http://mpg123.de/trunk/.git
synced 2025-08-06 10:02:38 +03:00
now also warnings and error messages as macro
git-svn-id: svn://scm.orgis.org/mpg123/trunk@337 35dc7657-300d-0410-a2e5-dc2837fedb53
This commit is contained in:
@@ -38,18 +38,27 @@ print "#else\n";
|
||||
printdefs(0);
|
||||
print "#endif\n";
|
||||
|
||||
for('warning', 'error')
|
||||
{
|
||||
print "\n/* $_ macros also here... */\n";
|
||||
printdefs(1, $_);
|
||||
}
|
||||
|
||||
sub printdefs
|
||||
{
|
||||
my $forreal = shift;
|
||||
my $type = shift;
|
||||
$type = 'debug' unless defined $type;
|
||||
my $i;
|
||||
while(++$i <= $num+1)
|
||||
{
|
||||
my @args, my $j;
|
||||
while(++$j < $i){ push(@args, chr(ord('a')+$j-1)); }
|
||||
unshift(@args, '') if(@args);
|
||||
print ' #define debug'.($i > 1 ? ($i-1) : '').'(s';
|
||||
print ' #define '.$type.($i > 1 ? ($i-1) : '').'(s';
|
||||
print join(', ', @args).') ';
|
||||
if($forreal){ print 'fprintf(stderr, "[" __FILE__ ":%i] " s "\n", __LINE__'.join(', ', @args).")\n"; }
|
||||
if($forreal){ print 'fprintf(stderr, "[" __FILE__ ":%i] '.$type.': " s "\n", __LINE__'.join(', ', @args).")\n"; }
|
||||
else{ print "{}\n"; }
|
||||
}
|
||||
}
|
||||
|
||||
|
48
src/debug.h
48
src/debug.h
@@ -26,17 +26,17 @@
|
||||
|
||||
#ifdef DEBUG
|
||||
#include <stdio.h>
|
||||
#define debug(s) fprintf(stderr, "[" __FILE__ ":%i] " s "\n", __LINE__)
|
||||
#define debug1(s, a) fprintf(stderr, "[" __FILE__ ":%i] " s "\n", __LINE__, a)
|
||||
#define debug2(s, a, b) fprintf(stderr, "[" __FILE__ ":%i] " s "\n", __LINE__, a, b)
|
||||
#define debug3(s, a, b, c) fprintf(stderr, "[" __FILE__ ":%i] " s "\n", __LINE__, a, b, c)
|
||||
#define debug4(s, a, b, c, d) fprintf(stderr, "[" __FILE__ ":%i] " s "\n", __LINE__, a, b, c, d)
|
||||
#define debug5(s, a, b, c, d, e) fprintf(stderr, "[" __FILE__ ":%i] " s "\n", __LINE__, a, b, c, d, e)
|
||||
#define debug6(s, a, b, c, d, e, f) fprintf(stderr, "[" __FILE__ ":%i] " s "\n", __LINE__, a, b, c, d, e, f)
|
||||
#define debug7(s, a, b, c, d, e, f, g) fprintf(stderr, "[" __FILE__ ":%i] " s "\n", __LINE__, a, b, c, d, e, f, g)
|
||||
#define debug8(s, a, b, c, d, e, f, g, h) fprintf(stderr, "[" __FILE__ ":%i] " s "\n", __LINE__, a, b, c, d, e, f, g, h)
|
||||
#define debug9(s, a, b, c, d, e, f, g, h, i) fprintf(stderr, "[" __FILE__ ":%i] " s "\n", __LINE__, a, b, c, d, e, f, g, h, i)
|
||||
#define debug10(s, a, b, c, d, e, f, g, h, i, j) fprintf(stderr, "[" __FILE__ ":%i] " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j)
|
||||
#define debug(s) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__)
|
||||
#define debug1(s, a) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a)
|
||||
#define debug2(s, a, b) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b)
|
||||
#define debug3(s, a, b, c) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c)
|
||||
#define debug4(s, a, b, c, d) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d)
|
||||
#define debug5(s, a, b, c, d, e) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e)
|
||||
#define debug6(s, a, b, c, d, e, f) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f)
|
||||
#define debug7(s, a, b, c, d, e, f, g) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g)
|
||||
#define debug8(s, a, b, c, d, e, f, g, h) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h)
|
||||
#define debug9(s, a, b, c, d, e, f, g, h, i) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i)
|
||||
#define debug10(s, a, b, c, d, e, f, g, h, i, j) fprintf(stderr, "[" __FILE__ ":%i] debug: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j)
|
||||
#else
|
||||
#define debug(s) {}
|
||||
#define debug1(s, a) {}
|
||||
@@ -50,3 +50,29 @@
|
||||
#define debug9(s, a, b, c, d, e, f, g, h, i) {}
|
||||
#define debug10(s, a, b, c, d, e, f, g, h, i, j) {}
|
||||
#endif
|
||||
|
||||
/* warning macros also here... */
|
||||
#define warning(s) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__)
|
||||
#define warning1(s, a) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a)
|
||||
#define warning2(s, a, b) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b)
|
||||
#define warning3(s, a, b, c) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c)
|
||||
#define warning4(s, a, b, c, d) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d)
|
||||
#define warning5(s, a, b, c, d, e) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e)
|
||||
#define warning6(s, a, b, c, d, e, f) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f)
|
||||
#define warning7(s, a, b, c, d, e, f, g) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g)
|
||||
#define warning8(s, a, b, c, d, e, f, g, h) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h)
|
||||
#define warning9(s, a, b, c, d, e, f, g, h, i) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i)
|
||||
#define warning10(s, a, b, c, d, e, f, g, h, i, j) fprintf(stderr, "[" __FILE__ ":%i] warning: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j)
|
||||
|
||||
/* error macros also here... */
|
||||
#define error(s) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__)
|
||||
#define error1(s, a) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a)
|
||||
#define error2(s, a, b) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b)
|
||||
#define error3(s, a, b, c) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c)
|
||||
#define error4(s, a, b, c, d) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d)
|
||||
#define error5(s, a, b, c, d, e) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e)
|
||||
#define error6(s, a, b, c, d, e, f) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f)
|
||||
#define error7(s, a, b, c, d, e, f, g) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g)
|
||||
#define error8(s, a, b, c, d, e, f, g, h) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h)
|
||||
#define error9(s, a, b, c, d, e, f, g, h, i) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i)
|
||||
#define error10(s, a, b, c, d, e, f, g, h, i, j) fprintf(stderr, "[" __FILE__ ":%i] error: " s "\n", __LINE__, a, b, c, d, e, f, g, h, i, j)
|
||||
|
Reference in New Issue
Block a user