<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span>Thank you very much for your Help David.I will most certainly use save as new version for backups and monticello repository. &nbsp;</span></div><div><br></div>  <div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; "> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> David T. Lewis [via Smalltalk] &lt;ml-node+s1294792n4644572h5@n4.nabble.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> kilon &lt;thekilon@yahoo.co.uk&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Sunday, 19 August 2012, 13:37<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: How to build plugins and VMs (was: Opengl and Squeak)<br> </font> </div> <br><div
 id="yiv2074422661">

        An image update is safe, and it will not erase your work. But you
<br>should get into the habit of making periodic backup copies of your
<br>image and changes files. For example, you should make a backup copy
<br>of your image and changes files before you begin to try my instructions
<br>for loading VMMaker. This will protect you if anything goes wrong, or
<br>if you just decide you do not really want all of that stuff in your
<br>image after all.
<br><br>By the way, a convenient way to make a "backup" of your image is
<br>with this:
<br><br>&nbsp; world -&gt; save as new version
<br><br>You do not need to upload to squeaksource to save your work. You
<br>can use Montecello to save your work and do version control, and
<br>with this you can make a local repository in a directory on your
<br>hard drive. You can save versions of your work in that repository.
<br><br>Dave
<br><br><br>On Sun, Aug 19, 2012 at 10:16:14AM +0100, dimitris chloupis wrote:
<div class="yiv2074422661shrinkable-quote"><br>&gt; thank you very much , I have stored your instructions as pdf and will take a look at the plugin tutorials again. Will try your instructions when my computer has wifi internet again. Will an image update erase my work ? is it safe ? I will first upload to squeaksource my work just to be sure.?
<br>&gt; 
<br>&gt; 
<br>&gt; ________________________________
<br>&gt; &nbsp;From: David T. Lewis [via Smalltalk] &lt;<a rel="nofollow" href="">[hidden email]</a>&gt;
<br>&gt; To: kilon &lt;<a rel="nofollow" href="">[hidden email]</a>&gt; 
<br>&gt; Sent: Sunday, 19 August 2012, 0:53
<br>&gt; Subject: How to build plugins and VMs (was: Opengl and Squeak)
<br>&gt; &nbsp;
<br>&gt; 
<br>&gt; On Sat, Aug 18, 2012 at 08:19:34AM +0100, dimitris chloupis wrote: 
<br>&gt; 
<br>&gt; Hi Dimitris, 
<br>&gt; 
<br>&gt; Skip to the bottom for the important part, how to build plugins. 
<br>&gt; 
<br>&gt; But first I will try to answer your questions. 
<br>&gt; 
<br>&gt; &gt; Why coders prefer FFIs ?? 
<br>&gt; &gt; 
<br>&gt; 
<br>&gt; Some people prefer FFIs because it allows the interface to be done 
<br>&gt; without using compilers or building VMs, and because it is not necessary 
<br>&gt; to distribute a compiled plugin to provide the platform interface. 
<br>&gt; 
<br>&gt; Some people may prefer using an FFI because they think it will save 
<br>&gt; time. They are usually wrong. Unfortunately, by the time they figure 
<br>&gt; this out, they will have wasted a lot of time trying to do things the 
<br>&gt; "easy way", and never bothered to invest a few hours to learn how to 
<br>&gt; do it more reliably with a plugin. 
<br>&gt; 
<br>&gt; &gt; For example I am a python coder, ctypes which is the FFI cpython comes with has seen an explosion the last years . The most suprising is the conversion of pyOpeng from C extenstion to ctypes libraries even though that has slow down the library 2-3x times. The reason behind that move is not hard to guess. Much easier to maintain. FFIs remove one importan element from the equation and pretty much why people avoid using C in the first place. Compiling and building. Thus making FFIs ideals for the fast changing libraries , be able to change things on the fly and not have to suffer the slow downs of the C compiler.? 
<br>&gt; &gt; 
<br>&gt; 
<br>&gt; Yes, an FFI is very adaptable because all changes can be done in the image, 
<br>&gt; and that is a good thing. However, relying on the compiler is only a 
<br>&gt; problem if you are waiting for someone *else* to compile it for you. 
<br>&gt; If you are willing to learn to do it for yourself, it is actually very 
<br>&gt; fast and easy to make updates. And if you do most of your work in Smalltalk 
<br>&gt; (aka "slang"), you will manage it with the same version control and tools 
<br>&gt; that you use for all the rest of your Smalltalk work. 
<br>&gt; 
<br>&gt; You will find that you have far better support for debugging and profiling 
<br>&gt; when you use a plugin, because you can use the platform debuggers and other 
<br>&gt; tools directly. Also (and this is a really big thing in practice), you 
<br>&gt; have the benefits of strong type checking provided by the C compiler when 
<br>&gt; you build the interface as a plugin rather than directing your calls through 
<br>&gt; an FFI interface. 
<br>&gt; 
<br>&gt; &gt; I have taken a look at VM plugins, glanced through some tutorials, if I am not mistaken Slang is used to produce C code that then is compiled in a form that can be loaded by the VM is a primitive. The like an FFI call , you just use the primitive to execute the action.? 
<br>&gt; &gt; 
<br>&gt; 
<br>&gt; Yes, that's right. 
<br>&gt; 
<br>&gt; &gt; I am definetly interested , and if you have any link I am more than welcome them, my only hesitation is buidling C files . I am the type of coder that likes to moves one line of code (or several ) per time and always make sure by testing that I dont code garbage. One of the reason I decided to convert from python to squeak was because I felt that it was easier to "live code" in this enviroment. I fear that a VM plugin might cut short this experience. Please correct me If I am mistaken.? 
<br>&gt; &gt; 
<br>&gt; 
<br>&gt; See below for instructions that should help get you started. My explanation 
<br>&gt; assumes you are using unix/Linux, so please let me know if you are on 
<br>&gt; Windows or Mac or something else. 
<br>&gt; 
<br>&gt; &gt; Saying that I have installed with ease CroquetGL and the opengl example seems to run fine, (exampletex fails but that is to be expected , have not tried the fix yet).? 
<br>&gt; &gt; 
<br>&gt; &gt; If VM plugins are more stable, reliable and what the squeak community prefers I have no issues going down that route.? 
<br>&gt; &gt; 
<br>&gt; 
<br>&gt; You will probably not get a consensus from the community. I am giving you 
<br>&gt; an opinion based on my own personal experience. 
<br>&gt; 
<br>&gt; OK, with that out of the way, here is what you should do: 
<br>&gt; 
<br>&gt; Allow about two hours to work through these instructions for the first time. 
<br>&gt; If you are using Linux or Unix, you can follow the steps exactly. If you 
<br>&gt; use another platform, just do the things you can, and you will still be able 
<br>&gt; to get an idea of how things works. Here are the steps to follow: 
<br>&gt; 
<br>&gt; Prepare tools. On Linux, install dev tools, libraries of interest, and Subversion. 
<br>&gt; 
<br>&gt; Get a copy of the platform sources. Do this in the same directory in which 
<br>&gt; you will be running your Squeak image. On Linux: 
<br>&gt; 
<br>&gt; ? $ svn co <a rel="nofollow" target="_blank" href="http://squeakvm.org/svn/squeak/trunk/platforms">http://squeakvm.org/svn/squeak/trunk/platforms</a><br>&gt; 
<br>&gt; Any recent Squeak image will work for building VMs, but I like to work with 
<br>&gt; an updated trunk image, like this: 
<br>&gt; 
<br>&gt; ? world -&gt; open... -&gt; morphic project 
<br>&gt; ? (enter the project) 
<br>&gt; ? [menu bar] Tools -&gt; Preferences 
<br>&gt; ? (select category Monticello. change Update URL from <a rel="nofollow" target="_blank" href="http://source.squeak.org/squeak43?to">http://source.squeak.org/squeak43?to</a>&nbsp;<a rel="nofollow" target="_blank" href="http://source.squeak.org/trunk">http://source.squeak.org/trunk</a>. 
<br>&gt; ? ? accept the change (&lt;ctl&gt; s). click save button) 
<br>&gt; ? world -&gt; help... -&gt; update code from server 
<br>&gt; ? (wait for update process to complete, then save your image) 
<br>&gt; 
<br>&gt; Install VMMaker. This is the trunk version for an interpreter VM. Do it this way 
<br>&gt; to get started so that you will be able to see your generated C code in a browser. 
<br>&gt; 
<br>&gt; ? world -&gt; open... Squeak Map Catalog 
<br>&gt; ? in the Squeak Map browser, click Update 
<br>&gt; ? select package VMMaker, version "head" 
<br>&gt; ? click Install 
<br>&gt; ? (wait for installation to complete) 
<br>&gt; 
<br>&gt; ? In a workspace, evaluate "VMMaker initialize". This will activate the Slang browsing tools. 
<br>&gt; ? (note: in the future, you can evaluate "VMMaker updateFromServer" to keep your VMMaker up to date) 
<br>&gt; 
<br>&gt; Now have a look at some plugins. 
<br>&gt; 
<br>&gt; Open a browser on UnixOSProcessPlugin&gt;&gt;primitiveGetUid. This is a simple 
<br>&gt; primitive call that links to the getuid() function in the C runtime library, 
<br>&gt; and answers your uid when the primitive is called. This is how the primitive 
<br>&gt; looks in Smalltalk. There is no C support code required, just the Smalltalk 
<br>&gt; code that you see here. 
<br>&gt; 
<br>&gt; While looking at the primitiveGetUid method, click the "source" button on 
<br>&gt; the browser, then select either "translate inlined C". You will now see 
<br>&gt; the C code for the primitive. 
<br>&gt; 
<br>&gt; Explore a few more primitives and other methods, and have a look at other 
<br>&gt; plugins, looking at both the Smalltalk source code and the generated C code. 
<br>&gt; 
<br>&gt; Now point your browser at B3DAcceleratorPlugin. This is a 3D graphics support 
<br>&gt; plugin that uses GL. It was written by Andreas Raab, a distinguished Squeak 
<br>&gt; guru and expert in graphics and VM programming. Andreas is less active on the 
<br>&gt; list that he once was, but I'm sure he will chime it and offer some guidance 
<br>&gt; once in a while. For now though, just treat this as a non-trivial example of 
<br>&gt; interfacing to GL with a plugin. 
<br>&gt; 
<br>&gt; Last but not least: Build a VM. This will be a minimal configuration with 
<br>&gt; only a few plugins, but it is enough to get you started. If you are able to 
<br>&gt; do this successfully, then you have everything you need in order to start 
<br>&gt; making your own plugins. 
<br>&gt; 
<br>&gt; ? world -&gt; open... -&gt; VMMaker 
<br>&gt; ? click the the "Help" button and spend a few minutes reading it. 
<br>&gt; ? click the "Entire" button to generate VM source code. 
<br>&gt; ? This will translate the Smalltalk VM and plugin source code into C source 
<br>&gt; ? ? files, which will be stored in the directory src along side your platforms 
<br>&gt; ? ? directory. The platforms directory should contain all of the sources that 
<br>&gt; ? ? you downloaded with Subversion, the the src directory will contain the generated sources from Smalltalk. 
<br>&gt; 
<br>&gt; Now open a terminal window. Compile your VM as follows: 
<br>&gt; 
<br>&gt; ? $ mkdir build 
<br>&gt; ? $ cd build 
<br>&gt; ? $ ../platforms/unix/cmake/configure --src=../src --without-gl 
<br>&gt; ? $ make 
<br>&gt; 
<br>&gt; If you want to install your new VM, do a "make install". 
<br>&gt; 
<br>&gt; HTH, 
<br>&gt; Dave 
<br>&gt; 
<br>&gt; 
<br>&gt; 
<br>&gt; 
<br>&gt; ________________________________
<br>&gt; &nbsp;
<br>&gt; If you reply to this email, your message will be added to the discussion below:<a rel="nofollow" target="_blank" href="http://forum.world.st/Opengl-and-Squeak-tp4644265p4644557.html">http://forum.world.st/Opengl-and-Squeak-tp4644265p4644557.html</a>&nbsp;
<br>&gt; To unsubscribe from Opengl and Squeak, click here.
<br>&gt; NAML
<br>&gt; 
</div><br><br>

        
        
        
        <br>
        <br>
        <hr noshade="" size="1" color="#cccccc">
        <div style="color: rgb(68, 68, 68); font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: normal; font-family: tahoma, geneva, helvetica, arial, sans-serif; ">
                <div style="font-weight:bold;">If you reply to this email, your message will be added to the discussion below:</div>
                <a rel="nofollow" target="_blank" href="http://forum.world.st/Opengl-and-Squeak-tp4644265p4644572.html">http://forum.world.st/Opengl-and-Squeak-tp4644265p4644572.html</a>
        </div>
        <div style="color: rgb(102, 102, 102); font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: 1.5em; font-family: tahoma, geneva, helvetica, arial, sans-serif; margin-top: 0.4em; ">
                
                To unsubscribe from Opengl and Squeak, <a rel="nofollow" target="_blank" href="http://forum.world.st/template/NamlServlet.jtp?macro=unsubscribe_by_code&amp;node=4644265&amp;code=dGhla2lsb25AeWFob28uY28udWt8NDY0NDI2NXwtMTEzNTM4MTMyMg==">click here</a>.<br>
                <a rel="nofollow" target="_blank" href="http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 9px; line-height: normal; font-family: serif; ">NAML</a>
        </div></div><br><br> </div> </div>  </div></body></html>