Porting SANE backends

Svend Daugaard Pedersen (sdp@vip.cybercity.dk)
Thu, 25 Feb 1999 20:34:35 +0100

I'm an Amiga user/programmer. I'm trying to port the SANE
backends to the Amiga. Until now I have been able to port
the backends for Canon, Epson, Microtek and SnapScan.

I have to thank all the backend implementers for the work
they have done.

But during my work with porting the backend I have run into
some problems. Most of these problems are in fact unnecessary
because they are caused by the fact that the ANSI C standard
is not followed.

I have made a "don't" list that I would ask all backend authers
to read (and follow :-))

- don't use 'alloca()'
this routine is not an ANSI routine and it is difficult
(in many cases impossible) to implement in a C system not
having it.

- don't use '#pragma'
pragmas are completely implementation dependant.

- don't make any asumptions about the way variables are stored
in memory a special problem here is that INTEL processors
and M680xx processors stores words and long words in a
different way (use only arrays of SANE_Byte to transfer
data to or from the scanner). If you do not follow this
advice your code can't even be ported between Intel and
68K Linux.

- don't use special/unusual parameter values
a call like 'malloc(0)' is unlikely to be handled in the
same way by all compilers.

- don't use 'fork()' and related routines
if you feel it is necessary, do it in a way that makes it
easy to change the code (snapscan.c is a good example) or
better: make this part of the code conditional.

And here is a single 'do':

- do read and follow the GUIDE in SANE/backend/

The SANE project is a good initiative and it deserves to be
implemented on more than only LINUX platforms

Regards

Svend Daugaard Pedersen

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com