[sane-devel] OS/2 version of Sane

Oliver Schwartz Oliver.Schwartz@gmx.de
Thu, 22 Nov 2001 22:38:45 +0100


Hi, 

> snapscan isn't compiled at all if ipc/semphore headers aren't found.
> At least that's the intention.
>
> > My fix for this is to do something like
> >
> > #ifdef OS2
> > #include "snapscan-usb-stubs.c"
> > #else
> > #include "snapscan-usb.c"
> > #endif
> >
> > where the 'stubs' version doesn't include the offending header file, but
> > it does have empty function bodies to keep the linker happy.

Not a very nice solution in my opinion. 

> To the snapscan developers: can this be implemented? Or something
> similar, e.g. #ifdefing everything that uses ipc.h and sem.h? Is
> sem.h/ipc.h needed at all?

The usb part uses semaphores to provide atomic commands. It may be possible 
to replace the semaphore code by something similar, it's only used at one 
place. But then, I'm quite sure that the OS/2 API also supports semaphores 
(DosSemGet() etc., if my memory serves me right). So I'd suggest to map the 
semaphore operations on OS/2 semaphores. 

For a start we can use separate functions for the semaphore operations (and  
maybe bundle them in a separate file), e.g. snapscani_semaphore_open(), 
snapscani_semaphore_close(), snapscani_semaphore_wait(), 
snapscani_semaphore_signal. Until an OS/2 implementation is provided the OS/2 
version of the functions may be left empty (maybe issuing a warning message). 
However, the OS/2 implementation should be simple.

Regards,

Oliver