<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-01-06 22:37 GMT+08:00 Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca" target="_blank">feeley@iro.umontreal.ca</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Of course one way would be to return a double (which has 53 bits of precision) and use NaN to encode “missing tag”.  I’m not kidding!<br>
<br>
If you don’t like this approach, and I can understand why you wouldn’t, then you have to do the conversion to ___SCMOBJ by directly calling the conversion macros.  Something like this:<br>
<br>
(define uint32_tag<br>
  (c-lambda<br>
   (TIFF* ttag_t)<br>
   scheme-object<br>
   "<br>
    ___U32 val;<br>
    if (TIFFGetField(___arg1, ___arg2, &val) == 1) {<br>
      if ((___err = ___U32_to_SCMOBJ (___PSTATE, val, &___result, ___RETURN_POS)) == ___FIX(___NO_ERR)) {<br>
        ___release_scmobj (___result);<br>
      }<br>
    } else {<br>
      ___result = ___FAL;<br>
    }<br>
   "))<br></blockquote><div><br></div><div>Neat! What is the risk involved with this one - I mean, the Scheme object allocation on the Gambit heap could fail under certain circumstances. But would that only be on malloc() failure?</div><div><br></div><div> </div></div></div></div>