From: cuz Date: Sat, 10 Mar 2001 10:04:42 +0000 (+0000) Subject: Added module for program output. X-Git-Tag: V2.12.0~2939 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d10079ccdca7b1b75ff61c3c80b0da9d20b632b4;p=cc65 Added module for program output. git-svn-id: svn://svn.cc65.org/cc65/trunk@618 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/common/make/gcc.mak b/src/common/make/gcc.mak index 7ae5818b3..45f3940f5 100644 --- a/src/common/make/gcc.mak +++ b/src/common/make/gcc.mak @@ -19,6 +19,7 @@ OBJS = abend.o \ filepos.o \ fname.o \ hashstr.o \ + print.o \ target.o \ tgttrans.o \ xmalloc.o \ diff --git a/src/common/make/watcom.mak b/src/common/make/watcom.mak index 65b18eff8..b122be10a 100644 --- a/src/common/make/watcom.mak +++ b/src/common/make/watcom.mak @@ -61,7 +61,7 @@ CCCFG = -bt=$(TARGET) -d1 -onatx -zp4 -5 -zq -w2 .c.obj: $(CC) $(CCCFG) $< - + # ------------------------------------------------------------------------------ # All library OBJ files @@ -75,9 +75,10 @@ OBJS = abend.obj \ filepos.obj \ fname.obj \ hashstr.obj \ - wildargv.obj \ + print.obj \ target.obj \ tgttrans.obj \ + wildargv.obj \ xmalloc.obj \ xsprintf.obj diff --git a/src/common/print.c b/src/common/print.c new file mode 100644 index 000000000..52080e7b0 --- /dev/null +++ b/src/common/print.c @@ -0,0 +1,78 @@ +/*****************************************************************************/ +/* */ +/* print.c */ +/* */ +/* Program output */ +/* */ +/* */ +/* */ +/* (C) 2001 Ullrich von Bassewitz */ +/* Wacholderweg 14 */ +/* D-70597 Stuttgart */ +/* EMail: uz@musoftware.de */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ +/* warranty. In no event will the authors be held liable for any damages */ +/* arising from the use of this software. */ +/* */ +/* Permission is granted to anyone to use this software for any purpose, */ +/* including commercial applications, and to alter it and redistribute it */ +/* freely, subject to the following restrictions: */ +/* */ +/* 1. The origin of this software must not be misrepresented; you must not */ +/* claim that you wrote the original software. If you use this software */ +/* in a product, an acknowledgment in the product documentation would be */ +/* appreciated but is not required. */ +/* 2. Altered source versions must be plainly marked as such, and must not */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ +/*****************************************************************************/ + + + +#include +#include + +/* common */ +#include "print.h" + + + +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +unsigned char Verbosity = 0; /* Verbose operation flag */ + + + +/*****************************************************************************/ +/* Code */ +/*****************************************************************************/ + + + +void Print (unsigned V, const char* Format, ...) +/* Output according to Verbosity */ +{ + va_list ap; + + /* Check the verbosity */ + if (V > Verbosity) { + /* Don't output this message */ + return; + } + + /* Output */ + va_start (ap, Format); + vprintf (Format, ap); + va_end (ap); +} + + + diff --git a/src/common/print.h b/src/common/print.h new file mode 100644 index 000000000..4def4c90d --- /dev/null +++ b/src/common/print.h @@ -0,0 +1,73 @@ +/*****************************************************************************/ +/* */ +/* print.h */ +/* */ +/* Program output */ +/* */ +/* */ +/* */ +/* (C) 2001 Ullrich von Bassewitz */ +/* Wacholderweg 14 */ +/* D-70597 Stuttgart */ +/* EMail: uz@musoftware.de */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ +/* warranty. In no event will the authors be held liable for any damages */ +/* arising from the use of this software. */ +/* */ +/* Permission is granted to anyone to use this software for any purpose, */ +/* including commercial applications, and to alter it and redistribute it */ +/* freely, subject to the following restrictions: */ +/* */ +/* 1. The origin of this software must not be misrepresented; you must not */ +/* claim that you wrote the original software. If you use this software */ +/* in a product, an acknowledgment in the product documentation would be */ +/* appreciated but is not required. */ +/* 2. Altered source versions must be plainly marked as such, and must not */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ +/*****************************************************************************/ + + + +#ifndef PRINT_H +#define PRINT_H + + + +/* common */ +#include "attrib.h" + + + +/*****************************************************************************/ +/* Data */ +/*****************************************************************************/ + + + +extern unsigned char Verbosity; /* Verbose operation flag */ + + + +/*****************************************************************************/ +/* Code */ +/*****************************************************************************/ + + + +void Print (unsigned V, const char* Format, ...) attribute ((format (printf, 2, 3))); +/* Output according to Verbosity */ + + + +/* End of print.h */ + +#endif + + + +