Jason Cooper wrote:
Antoine ([EMAIL PROTECTED]) scribbled:

Hi,
I can't seem to get any bites on the more appropriate lists I am on...


Have you tried linux-c-programming@vger.kernel.org ?


I am almost finished hacking libtiff into something we can use to make tiff ATA2100 compliant files and am sure that the last hurdle is understanding what the following means:

tif->tif_diroff = (TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;

(from tif_dirwrite.c)

where

TIFFSeekFile is

#define TIFFSeekFile(tif, off, whence) \ ((*(tif)->tif_seekproc)((tif)->tif_clientdata,(toff_t)(off),whence))

basically all I need to know is what the &~ 1 does at the end of the first line


whitespace doesn't matter in C, this is taking the output of
TIFFSeekFile and and'ing (&) it with ~1 == 0xfffe .  The type of '1'
will be determined by the type of TIFFSeekFile.  The end result is that
the output of TIFFSeekFile will always be even.


and what the effect of
((*(tif)->tif_seekproc)((tif)->tif_clientdata,(toff_t)(off),whence))
is. It doesn't look to me much like a function call... but then again, I only started really looking at c a week ago :-).


Sure looks like it to me.  grep through the source for 'tif_seekproc',
it'll be a member of a struct and should be a function pointer (this
should be in an include file).  Then look for some sort of an
initialization routine where 'tif_seekproc' is assigned a function
pointer.  The function it is assigned will be what is used when the
above macro 'TIFFSeekFile' is called.

hth,

Cooper.

Cheers for that... I ended up being given the low down on the likelihood of me being able to do what I wanted and was told it wasn't a starter... I ended up doing something much simpler (accessing the tiffs using binary file access in VB). Wow, now I can see why learning c by oneself is a mission and a half - function pointers... they are scary things...
Thanks heaps, cos I sure wouldn't have got that on my own!
Cheers
Antoine


--
gentoo-user@gentoo.org mailing list



Reply via email to