<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>Please, avoid C wrappers wherever possible.</div><div><br></div><div><font class="Apple-style-span" color="#0000FF"><font class="Apple-style-span" face="Gill Sans"><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Gill Sans; "><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Gill Sans; ">Antony Hosking</span></span></font></font><font class="Apple-style-span" face="Gill Sans"><span class="Apple-style-span" style="font-family: Gill Sans; "><span class="Apple-style-span" style="font-family: Gill Sans; "> | </span></span><span class="Apple-style-span" style="font-family: Gill Sans; "><span class="Apple-style-span" style="font-family: Gill Sans; ">Associate Professor</span></span><span class="Apple-style-span" style="font-family: Gill Sans; "><span class="Apple-style-span" style="font-family: Gill Sans; "> | Computer Science | Purdue University</span></span></font></div><div><font class="Apple-style-span" face="GillSans-Light"><span class="Apple-style-span" style="font-family: GillSans-Light; ">305 N. University Street | West Lafayette | IN 47907 | USA</span></font></div><div><font class="Apple-style-span" color="#0000FF" face="Gill Sans"><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Gill Sans; "><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Gill Sans; ">Office</span></span></font><font class="Apple-style-span" face="GillSans-Light"><span class="Apple-style-span" style="font-family: GillSans-Light; "><span class="Apple-style-span" style="font-family: GillSans-Light; "> +1 765 494 6001 | </span></span></font><font class="Apple-style-span" color="#0000FF" face="Gill Sans"><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Gill Sans; "><span class="Apple-style-span" style="color: rgb(0, 0, 255); font-family: Gill Sans; ">Mobile</span></span></font><font class="Apple-style-span" face="GillSans-Light"><span class="Apple-style-span" style="font-family: GillSans-Light; "><span class="Apple-style-span" style="font-family: GillSans-Light; "> +1 765 427 5484</span></span></font></div><div><font class="Apple-style-span" face="GillSans-Light"><br class="khtml-block-placeholder"></font></div></span></span></span></span></span></span></span><br class="Apple-interchange-newline"></span></div></span> </div><br><div><div>On Apr 24, 2008, at 6:58 AM, Jay wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>Um..I have spent quite some time reading stat.h. At least 5 minutes. :)<br><br>I must say, I really really really like the copyout method.<br><br>Obviously, it goes something like this:<br><br>  struct_stat = RECORD<br>    st_dev : uint64_t;<br>    st_ino : uint64_t;<br>    st_mode : uint64_t;<br>    st_nlink : uint64_t;<br>    st_uid : uint64_t;<br>    st_gid : uint64_t;<br>    st_rdev : uint64_t;<br>    st_size : uint64_t;<br>    st_blksize: uint64_t;<br>    st_blocks : uint64_t;<br>    st_atime : uint64_t;<br>    st_mtime : uint64_t;<br>    st_ctime : uint64_t;<br>  END;<br>  struct_stat_star = UNTRACED REF struct_stat;<br><br><br>void copyout(const stat_t* s, m3_stat_t* m)<br>{<br>    m->st_ctime = s.st_stime;<br>    ...<br>}<br>int m3_stat(const char* path, m3_stat_t* m)<br>{<br>    int result;<br>    struct stat s;<br><br>    result = m3_stat(path, &s);<br>    copyout(&s, m);<br>    return result;<br>}<br><br>and this one type definition and wrapper function is, like, arbitrarily portable to all systems.<br>Quite simple. A little inefficient -- but it's not like the stat call itself won't dwarf the copying.<br><br>I think I agree merging the files into Umachine.i3.<br><br>However consider the part of Ustat.i3 other than the struct.<br>The bit masks are probably identical across ALL platforms.<br>The function declarations are.<br>Actually even the struct can often be factored just by giving types like gid_t, ino_t, but I don't think that's worth it.<br>I'd rather uint16_t, uint32_t, uint64_t.<br><br>So I think moving just the struct into its own file, or using copyout, not a bad idea.<br><br>Ustat.i3 is not quite the best example.<br>I think a much better one is Upthread.i3.<br>The file is very large and basically I think varies by 3-5 lines per variation.<br><br>Lastly, you know, I do work to generate the headers kind of, and/or to derive them somewhat automatically.<br>This work should probably be fully automated, at least for test cases, so assert the correctness.<br>You know, write Modula-3 and C code to print field offsets and sizes and verify they are identical.<br>This should aid maintenability. I assert the current system, no matter how the files are laid out, is overly fragile.<br>I assert that transcribing .h files into .i3 files is a very dubious practise.<br>It has an upside of easier cross building -- don't need the platform-specific headers.<br>And it has the upside of not needing to worry about parsing .h files.<br>But it is obviously bad maintainability.<br><br>Better would be do wrappers like the above, except where perf is critical.<br>Or at least actively (daily) assert the sizes/offsets.<br><br><blockquote type="cite">Another argument to keep the structure is that is has proven to be<br></blockquote><blockquote type="cite">easily portable; and we should be very careful to change it.<br></blockquote><br>I think the current structure has proven easily copied around and then not fixed and bugs lurking..<br>This is not really my original point, but I have to harp a bit, it's been simmering in my brain a long time.<br>Any time I see header cloning I cringe significantly. Visual Basic and C# have this same problem.<br><br> - Jay<br><br><br><br><br><blockquote type="cite">Date: Wed, 23 Apr 2008 23:32:43 +0200<br></blockquote><blockquote type="cite">From: <a href="mailto:wagner@elegosoft.com">wagner@elegosoft.com</a><br></blockquote><blockquote type="cite">To: <a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br></blockquote><blockquote type="cite">Subject: Re: [M3devel] naming conventions for split/composed interfaces?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Quoting Tony Hosking <<a href="mailto:hosking@cs.purdue.edu">hosking@cs.purdue.edu</a>>:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Basically, I hate the idea of tangling together multiple machine-<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">dependent systems in the same files.  Yes, it is verbose with<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">duplicated functionality, but it *is* separable.  I can delete one set<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">of files without breaking builds on other targets.  I hate the idea of<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">C wrappers even more!<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">So, my position remains that while it is verbose having separate<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">target-specific directories, at least they are independent and isolated</blockquote></blockquote></div></blockquote></div><br></body></html>