<div dir="ltr">Hi Laura,<div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 26, 2016 at 7:00 AM, Laura Perez Cerrato <span dir="ltr">&lt;<a href="mailto:lauraperezcerrato@gmail.com" target="_blank">lauraperezcerrato@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> <br>Elliot, Dave,<br>
<br>
Thanks for your feedback! I didn&#39;t realise the differences between the<br>
coding practices of JPEGReadWriter2Plugin and other plugins since I<br>
didn&#39;t look at the code of the others. I&#39;ll try to get the code of<br>
JPEGReadWriter2Plugin to bear more resemblance to the rest of the<br>
codebase. I&#39;ve taken a brief look at RePlugin&#39;s code and the way the C<br>
code should be placed into external files is still a bit confusing to<br>
me. Any guidance in this aspect would be greatly appreciated.<br></blockquote><div><br></div><div>So the scheme is</div><div>a) the generated C source for the Smalltalk plugin class is generated in src/plugins/PluginName/PluginName.c, and it includes a PluginName.h</div><div>b) the PluginName.h lives in platforms/Cross/plugins/PluginName/PluginName.h.  It should define the functions and types exported by any C sport for the PluginName.c file to use.</div><div>c) if the C support code is cross-platform it should live in platforms/Cross/plugins/PluginName/sqPluginName.c, which also includes PluginName.c.  That&#39;s the case here, so refactor the bodies of all plugin methods so that the C code tat is in cCode: &#39;...here...&#39; strings gets moved to functions in platforms/Cross/plugins/PluginName/sqPluginName.c.  These functions can be called anything you like but there&#39;s a convention to prepend &quot;sq&quot; or &quot;io&quot;.  For example in the FilePlugin names like sqFileFlush.  &quot;io&quot; tends to be for more GUI and OS related functionality.</div><div>d) if the C code is not cross p;at form, or part of it is not cross platform, that code goes in platforms/platformName/plugins/PluginName/sqPlatPluginName.c, e.g. platforms/win32/plugins/UUIDPlugin/sqWin32UUID.c</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
As I mentioned earlier, I&#39;ve been working on handling non-even width<br>
16-bit Forms and non-0 modulo 4 width 8 bit Forms. Here are two<br>
changesets with the implementation of that feature.<br></blockquote><div><br></div><div>Thanks!!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Cheers!<br>
-Laura Perez Cerrato<br>
<br>
<br>
On 19 May 2016 at 23:05, David T. Lewis &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi Laura,<br>
&gt;<br>
&gt; Thanks very much for posting this. I took a quick look at it and will<br>
&gt; try to follow up later.<br>
&gt;<br>
&gt; To clarify one point: Eliot is using the word &quot;horrible&quot; to refer to<br>
&gt; some coding practices in the existing JPEGReadWriter2Plugin, and it does<br>
&gt; not mean that your patches are &quot;horrible&quot;.<br>
&gt;<br>
&gt;<br>
&gt; Eliot,<br>
&gt;<br>
&gt; Indeed, those giant blocks of #cCode are bad, and somebody (tm) should<br>
&gt; do something about it. It may not be obvious from looking at the change<br>
&gt; set, but Laura&#39;s updates are are patches against that existing code.<br>
&gt; So your suggestion is good - either rewrite those portions in proper<br>
&gt; Smalltalk slang, or just move them out to C code in the platforms support.<br>
&gt;<br>
&gt; I think that this is probably beyond the scope of what Laura is trying to<br>
&gt; do here, although I would encourage anyone with an interest in improving<br>
&gt; the plugins to take a look at reworking the #cCode portions of<br>
&gt; JPEGReadWriter2Plugin.<br>
&gt;<br>
&gt; Dave<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Thu, May 19, 2016 at 04:29:15PM -0700, Eliot Miranda wrote:<br>
&gt;&gt;<br>
&gt;&gt; Hi Laura,<br>
&gt;&gt;<br>
&gt;&gt;     this isn&#39;t your fault, but looking at the body of the plugin methods,<br>
&gt;&gt; the code is horrible.  It&#39;s essentially 100% C.  The code should really be<br>
&gt;&gt; written in C files, not in Smalltalk methods, following the pattern of<br>
&gt;&gt; separating plugin code into a Smalltalk plugin larger calling platform<br>
&gt;&gt; functions written in a C layer.  For example, look at the REPlugin which<br>
&gt;&gt; does regular expressions.  The source to the machinery is in<br>
&gt;&gt; platforms/Cross/plugins/RePlugin.  The plugin methods, e.g.<br>
&gt;&gt; REPlugin&gt;&gt;primPCREExecfromto, do marshalling of Smalltalk objects into C<br>
&gt;&gt; parameters and then invoke function implemented in<br>
&gt;&gt; platforms/Cross/plugins/RePlugin, e.g. pcre_exec.  This approach means that<br>
&gt;&gt; there&#39;s onlyas much cCode:inSmalltalk: as necessary.  This is far nicer<br>
&gt;&gt; code to read and fix.<br>
&gt;&gt;<br>
&gt;&gt; Do you have energy to rewrite the JPEG plain code to follow this pattern?<br>
&gt;&gt; If so, let me encourage you.  It will improve the code hugely.<br>
&gt;&gt;<br>
&gt;&gt; On Thu, May 19, 2016 at 7:06 AM, Laura Perez Cerrato &lt;<br>
&gt;&gt; <a href="mailto:lauraperezcerrato@gmail.com">lauraperezcerrato@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Elliot, Dave,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Thanks for your answers! Here go both the changesets requested. The<br>
&gt;&gt; &gt; JPEGReadWriter2Plugin changeset was generated using a Squeak Spur<br>
&gt;&gt; &gt; trunk image, whilst the Graphics changeset was generated using the<br>
&gt;&gt; &gt; latest stable version of Squeak non-Spur (4.6-15102). However, It<br>
&gt;&gt; &gt; should also work well with a Squeak Spur trunk image, though I haven&#39;t<br>
&gt;&gt; &gt; tested it&#39;s functioning there thoroughly. I haven&#39;t yet implemented a<br>
&gt;&gt; &gt; graceful way for the new primitive to fail if the new version of the<br>
&gt;&gt; &gt; plugin is absent, so keep that in mind.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I&#39;m currently working on handling non-even width 16-bit Forms and<br>
&gt;&gt; &gt; non-0 modulo 4 width 8 bit Forms, so I&#39;ll hopefully send that to you<br>
&gt;&gt; &gt; too within this week.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; -Laura Perez Cerrato<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On 18 May 2016 at 22:00, David T. Lewis &lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt; wrote:<br>
&gt;&gt; &gt; &gt;<br>
&gt;&gt; &gt; &gt; On Wed, May 18, 2016 at 03:56:11PM -0700, Eliot Miranda wrote:<br>
&gt;&gt; &gt; &gt;&gt;<br>
&gt;&gt; &gt; &gt;&gt; Hi Laura,<br>
&gt;&gt; &gt; &gt;&gt;<br>
&gt;&gt; &gt; &gt;&gt; &gt; On May 18, 2016, at 1:04 PM, Laura Perez Cerrato &lt;<br>
&gt;&gt; &gt; <a href="mailto:lauraperezcerrato@gmail.com">lauraperezcerrato@gmail.com</a>&gt; wrote:<br>
&gt;&gt; &gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt; &gt;&gt; &gt; Hello, everyone,<br>
&gt;&gt; &gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt; &gt;&gt; &gt; During the past few days I&#39;ve been working on adding support for<br>
&gt;&gt; &gt; &gt;&gt; &gt; reading and writing reading and writing JPEGs to/from -32, -16, -8<br>
&gt;&gt; &gt; &gt;&gt; &gt; grayscale and 8 grayscale bit deep forms to JPEGReadWriter2Plugin for<br>
&gt;&gt; &gt; &gt;&gt; &gt; the Squeak Cog V3 VM. Just chiming in to tell you that the work is<br>
&gt;&gt; &gt; &gt;&gt; &gt; done and I&#39;d like to share it with you all. :) I believe this changes<br>
&gt;&gt; &gt; &gt;&gt; &gt; should work on Spur VMs too, but haven&#39;t tested thoroughly enough to<br>
&gt;&gt; &gt; &gt;&gt; &gt; ensure that.<br>
&gt;&gt; &gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt; &gt;&gt; &gt; How do you handle contributions to the codebase? I assume I&#39;d have to<br>
&gt;&gt; &gt; &gt;&gt; &gt; upload the corresponding changeset to the repository but I&#39;m not sure<br>
&gt;&gt; &gt; &gt;&gt; &gt; if there&#39;s anything I should do before.<br>
&gt;&gt; &gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt; &gt;&gt; &gt; I have also been working on a few changes to the latest non-Spur<br>
&gt;&gt; &gt; &gt;&gt; &gt; version of Squeak in order to take advantage of the changes to the<br>
&gt;&gt; &gt; &gt;&gt; &gt; plugin but, since I added a primitive to it and these changes use it,<br>
&gt;&gt; &gt; &gt;&gt; &gt; I think it&#39;s prudent to ask you too how those contributions are<br>
&gt;&gt; &gt; &gt;&gt; &gt; handled. Should I refer to the Squeak-dev mailing list?<br>
&gt;&gt; &gt; &gt;&gt;<br>
&gt;&gt; &gt; &gt;&gt; This is indeed a problem.  Talking for myself, until VMs have been<br>
&gt;&gt; &gt; built that include the code and are generally available one can&#39;t really<br>
&gt;&gt; &gt; deploy the behaviour to trunk.  But again waiting for the next release<br>
&gt;&gt; &gt; feels far too slow.<br>
&gt;&gt; &gt; &gt;&gt;<br>
&gt;&gt; &gt; &gt;&gt; One approach is to make the behaviour optional, depending on what the<br>
&gt;&gt; &gt; VM provides, eg checking for primitive failure or a plugin version number,<br>
&gt;&gt; &gt; or simply making the code fail gracefully.<br>
&gt;&gt; &gt; &gt;&gt;<br>
&gt;&gt; &gt; &gt;&gt; Another approach is to provide the functionality in an extension<br>
&gt;&gt; &gt; package, and merging that extension into trunk at the next release.<br>
&gt;&gt; &gt; &gt;&gt;<br>
&gt;&gt; &gt; &gt;&gt; Other suggestions folks?<br>
&gt;&gt; &gt; &gt;&gt;<br>
&gt;&gt; &gt; &gt;<br>
&gt;&gt; &gt; &gt; We should take a look at the image side code too. Laura, perhaps you can<br>
&gt;&gt; &gt; &gt; post a change set for that also?<br>
&gt;&gt; &gt; &gt;<br>
&gt;&gt; &gt; &gt; Very often a new optional primitive can be handled simply by providing<br>
&gt;&gt; &gt; &gt; some suitable fallback code. That provides a smooth transition, because<br>
&gt;&gt; &gt; &gt; the new feature is immediately available and the system continues to work<br>
&gt;&gt; &gt; &gt; for people who do not yet have the new primitive in their VM.<br>
&gt;&gt; &gt; &gt;<br>
&gt;&gt; &gt; &gt; Dave<br>
&gt;&gt; &gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; _,,,^..^,,,_<br>
&gt;&gt; best, Eliot<br>
&gt;<br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>