1
0
Fork 0

finally make printf() globally available

This commit is contained in:
mfranz 2008-07-23 15:43:45 +00:00
parent 93bc59c9a3
commit de1aa4c56e
3 changed files with 9 additions and 4 deletions

View file

@ -327,9 +327,9 @@ var printerror = func(err) {
if (!size(err))
return;
print(sprintf("%s at %s line %d", err[0], err[1], err[2]));
printf("%s at %s line %d", err[0], err[1], err[2]);
for (var i = 3; i < size(err); i += 2)
print(sprintf(" called from %s line %d", err[i], err[i + 1]));
printf(" called from %s line %d", err[i], err[i + 1]);
}

View file

@ -57,7 +57,6 @@ var FT2M = 0.3048;
var M2FT = 3.28083989501312335958;
var printf = func { print(call(sprintf, arg)) }
var floor = func(v) { v < 0.0 ? -int(-v) - 1 : int(v) }
var sin = nil;
var cos = nil;

View file

@ -77,7 +77,7 @@ var setlistener = func(node, fun, init = 0, runtime = 1) {
}, init, runtime);
if(__.log_level <= 2) {
var c = caller(1);
print(sprintf("setting listener #%d in %s, line %s", id, c[2], c[3]));
printf("setting listener #%d in %s, line %s", id, c[2], c[3]);
}
return id;
}
@ -107,6 +107,12 @@ var defined = func(sym) {
var thisfunc = func caller(1)[1];
##
# Just what it says it is.
#
var printf = func print(call(sprintf, arg));
##
# Print log messages in appropriate --log-level.
# Usage: printlog("warn", "...");