nanogui: usage of posix functions in src/engine/ and src/drivers/
Subject:
Re: [nanogui] usage of posix functions in src/engine/ and src/drivers/
From:
"Greg Haerr" ####@####.####
Date:
7 Jun 2005 05:03:06 +0100
Message-Id: <215201c56b15$a3d7a0b0$6401a8c0@winXP>
: I'd like to try to use the microwindows graphics engine directly (GdXXX(),
: i.e. without nanox or microwindows) under ecos.
Cool
: There are some places in this code where abort(), fprintf() and maybe some
: more functions like this are called.
: While ecos has packages which provide these functions, it can also run
very
: well without these packages and has a slightly smaller memory footprint
then.
Agreed
:
: I'd like to replace the abort(), fprintf() and similar calls in drivers/
and
: engine/ with macros in order to make it more portable:
:
: #ifdef __ECOS
: #define ABORT() CYG_FAIL("aborted");
: #define DEBUG_PRINTF(args...) diag_printf(args...)
: #else
: #define ABORT() abort()
: #define DEBUG_PRINTF(args...) fprintf(stderr, args...)
: #endif
There shouldn't be any places where printf or fprintf are used
directly, just for the reasons you've stated above. In device.h,
the EPRINTF and DPRINTF macros were created to allow
testing output (where stdout is used) and production output
(where a GdError routine is called) without changing source.
So, the same should follow for your eCos port where you'd
use DPRINTF or EPRINTF instead of DEBUG_PRINTF
above.
For the abort() case, I suggest a patch where an ABORT() macro
is created, and included in device.h.
Regards,
Greg