<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 10 (filtered)">
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {font-family:Arial;
        color:windowtext;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-GB link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I have added a header file “napiu.h” to CVS (see
<a
href="http://nexus.isis.rl.ac.uk/cgi-bin/viewcvs.cgi/include/napiu.h?rev=1.1&content-type=text/vnd.viewcvs-markup">http://nexus.isis.rl.ac.uk/cgi-bin/viewcvs.cgi/include/napiu.h?rev=1.1&content-type=text/vnd.viewcvs-markup</a>)
containing the C declarations for NXU routines – I have taken as a basis
the F90 implementation as detailed at <a
href="http://www.nexus.anl.gov/nexus_f90.html#NXUwriteglobals">http://www.nexus.anl.gov/nexus_f90.html#NXUwriteglobals</a>
This page mentions NXUwritehistogram and NXUreadhistogram functions, though
these are not currently implemented in NXUmodule.f90; are they still required?</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Though the C signature of the functions can be the same as
the F90 ones in most cases, there are a few exceptions. The C NXUwritedata
cannot follow the F90 one exactly as F90 arrays know their size and so do not
require such parameters; also F90 allows several functions for different array
types/dimensionality to be written and a general “interface” to be
defined that will map to the correct function at compile time. I have thus
added additional size, rank and type parameters to NXUwritedata and NXUreaddata</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>A general question concerns memory allocation: should the
NXU functions allocate memory for the caller or rely on being provided with a
buffer of at least the correct size; if the latter, then should extra size
parameters be added so that buffer overruns are detected? The functions concerned
are:</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>NXUreadhistogram and NXUreaddata – allocate space for
returned data or assume this will be provided?</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>NXUfindgroup – allocate space for group_class output
variable or assume this will be provided?</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>NXUfindclass – allocate space for group_name output
variable or assume this will be provided?</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>NXUfindsignal – allocate space for data_name and data_dimensions
output variables or assume this will be provided?</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>NXUfindaxis – allocate space for data_name and data_dimensions
output variables or assume this will be provided?</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>If we were to prototype as e.g. (char** value), we could
only allocate memory if we are passed (*value == NULL) which would allows both
memory options, but does not address the buffer overrun issue.</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Regards,</span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Freddie </span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'> </span></font></p>
</div>
</body>
</html>