sane-project-website/old-archive/2001-05/0276.html

152 wiersze
5.1 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>sane-devel: Re: Polaroid SprintScan 35 LE</TITLE>
<META NAME="Author" CONTENT="Henning Meier-Geinitz (henning@meier-geinitz.de)">
<META NAME="Subject" CONTENT="Re: Polaroid SprintScan 35 LE">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Re: Polaroid SprintScan 35 LE</H1>
<!-- received="Mon May 21 12:43:26 2001" -->
<!-- isoreceived="20010521194326" -->
<!-- sent="Mon, 21 May 2001 21:43:53 +0200" -->
<!-- isosent="20010521194353" -->
<!-- name="Henning Meier-Geinitz" -->
<!-- email="henning@meier-geinitz.de" -->
<!-- subject="Re: Polaroid SprintScan 35 LE" -->
<!-- id="20010521214353.A26495@vortex.swb.de" -->
<!-- inreplyto="E151uJq-0007tc-00@yoo-hoo.ai.mit.edu" -->
<STRONG>From:</STRONG> Henning Meier-Geinitz (<A HREF="mailto:henning@meier-geinitz.de?Subject=Re:%20Polaroid%20SprintScan%2035%20LE&In-Reply-To=&lt;20010521214353.A26495@vortex.swb.de&gt;"><EM>henning@meier-geinitz.de</EM></A>)<BR>
<STRONG>Date:</STRONG> Mon May 21 2001 - 12:43:53 PDT
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0277.html">Jonathan Buzzard: "Re: Linux-compliant USB scanner"</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0275.html">Henning Meier-Geinitz: "Re: PNM device configuration"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0272.html">Matto Marjanovic: "Re: Polaroid SprintScan 35 LE"</A>
<!-- nextthread="start" -->
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#276">[ date ]</A>
<A HREF="index.html#276">[ thread ]</A>
<A HREF="subject.html#276">[ subject ]</A>
<A HREF="author.html#276">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
Hi,
<BR>
<P>On Mon, May 21, 2001 at 02:22:14PM -0400, Matto Marjanovic wrote:
<BR>
<EM>&gt; * Use DBG(...) instead of fprintf(stderr, ...) or printf
</EM><BR>
<EM>&gt; - microtek
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; --&gt; this is not so simple.
</EM><BR>
<EM>&gt; There are a lot of places where I used 'fprintf(stderr, ...)'
</EM><BR>
<EM>&gt; in order to produce readable output; usually, such code is
</EM><BR>
<EM>&gt; conditioned off of DBG_LEVEL like so (per an early discussion
</EM><BR>
<EM>&gt; with David Mosberger-Tang on the right way to do this):
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; if (DBG_LEVEL &gt;= 192) {
</EM><BR>
<EM>&gt; int i;
</EM><BR>
<EM>&gt; fprintf(stderr, &quot;MSL: &quot;);
</EM><BR>
<EM>&gt; for (i=0;i&lt;6+comm[4];i++) fprintf(stderr, &quot;%2x &quot;, comm[i]);
</EM><BR>
<EM>&gt; fprintf(stderr, &quot;\n&quot;);
</EM><BR>
<EM>&gt; }
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; There is no way to produce readable output using DBG(...) in a
</EM><BR>
<EM>&gt; situation like this, because of all the stuff that DBG() prepends
</EM><BR>
<EM>&gt; and appends to its arguments.
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; Any suggestions?
</EM><BR>
<EM>&gt; Perhaps an additional, raw form of DBG(...) ?
</EM><BR>
<P>I'm using strings together with sprintf and strcat and after creation
<BR>
of the output string I print it with DBG(level, &quot;%s&quot;, string). It's
<BR>
one or two more lines of code but I think it's worth it because we
<BR>
don't get problems with saned this way. So in your example:
<BR>
<P>int i;
<BR>
char *dbg_buffer[enough_mem];
<BR>
char *tmp_buffer[not_so_much_mem];
<BR>
sprintf(tmp_buffer, &quot;MSL: &quot;);
<BR>
strcat(dbg_buffer, tmp_buffer);
<BR>
for (i=0;i&lt;6+comm[4];i++)
<BR>
&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sprintf(tmp_buffer, &quot;%2x &quot;, comm[i]);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strcat(dbg_buffer, tmp_buffer);
<BR>
&nbsp;&nbsp;}
<BR>
<P>(untested and ugly but you may get the idea).
<BR>
<P>Bye,
<BR>
&nbsp;&nbsp;Henning
<BR>
<P><P><PRE>
--
Source code, list archive, and docs: <A HREF="http://www.mostang.com/sane/">http://www.mostang.com/sane/</A>
To unsubscribe: echo unsubscribe sane-devel | mail <A HREF="mailto:majordomo@mostang.com?Subject=Re:%20Polaroid%20SprintScan%2035%20LE&In-Reply-To=&lt;20010521214353.A26495@vortex.swb.de&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0277.html">Jonathan Buzzard: "Re: Linux-compliant USB scanner"</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0275.html">Henning Meier-Geinitz: "Re: PNM device configuration"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0272.html">Matto Marjanovic: "Re: Polaroid SprintScan 35 LE"</A>
<!-- nextthread="start" -->
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#276">[ date ]</A>
<A HREF="index.html#276">[ thread ]</A>
<A HREF="subject.html#276">[ subject ]</A>
<A HREF="author.html#276">[ author ]</A>
</UL>
<!-- trailer="footer" -->
<HR NOSHADE>
<P>
<SMALL>
<EM>
This archive was generated by <A HREF="http://www.hypermail.org/">hypermail 2b29</A>
: <EM>Mon May 21 2001 - 12:44:33 PDT</EM>
</EM>
</SMALL>
</BODY>
</HTML>