<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. </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] <ml-node+s1294792n4644572h5@n4.nabble.com><br> <b><span style="font-weight: bold;">To:</span></b> kilon <thekilon@yahoo.co.uk> <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> world -> 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>> 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>>
<br>>
<br>> ________________________________
<br>> From: David T. Lewis [via Smalltalk] <<a rel="nofollow" href="">[hidden email]</a>>
<br>> To: kilon <<a rel="nofollow" href="">[hidden email]</a>>
<br>> Sent: Sunday, 19 August 2012, 0:53
<br>> Subject: How to build plugins and VMs (was: Opengl and Squeak)
<br>>
<br>>
<br>> On Sat, Aug 18, 2012 at 08:19:34AM +0100, dimitris chloupis wrote:
<br>>
<br>> Hi Dimitris,
<br>>
<br>> Skip to the bottom for the important part, how to build plugins.
<br>>
<br>> But first I will try to answer your questions.
<br>>
<br>> > Why coders prefer FFIs ??
<br>> >
<br>>
<br>> Some people prefer FFIs because it allows the interface to be done
<br>> without using compilers or building VMs, and because it is not necessary
<br>> to distribute a compiled plugin to provide the platform interface.
<br>>
<br>> Some people may prefer using an FFI because they think it will save
<br>> time. They are usually wrong. Unfortunately, by the time they figure
<br>> this out, they will have wasted a lot of time trying to do things the
<br>> "easy way", and never bothered to invest a few hours to learn how to
<br>> do it more reliably with a plugin.
<br>>
<br>> > 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>> >
<br>>
<br>> Yes, an FFI is very adaptable because all changes can be done in the image,
<br>> and that is a good thing. However, relying on the compiler is only a
<br>> problem if you are waiting for someone *else* to compile it for you.
<br>> If you are willing to learn to do it for yourself, it is actually very
<br>> fast and easy to make updates. And if you do most of your work in Smalltalk
<br>> (aka "slang"), you will manage it with the same version control and tools
<br>> that you use for all the rest of your Smalltalk work.
<br>>
<br>> You will find that you have far better support for debugging and profiling
<br>> when you use a plugin, because you can use the platform debuggers and other
<br>> tools directly. Also (and this is a really big thing in practice), you
<br>> have the benefits of strong type checking provided by the C compiler when
<br>> you build the interface as a plugin rather than directing your calls through
<br>> an FFI interface.
<br>>
<br>> > 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>> >
<br>>
<br>> Yes, that's right.
<br>>
<br>> > 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>> >
<br>>
<br>> See below for instructions that should help get you started. My explanation
<br>> assumes you are using unix/Linux, so please let me know if you are on
<br>> Windows or Mac or something else.
<br>>
<br>> > 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>> >
<br>> > If VM plugins are more stable, reliable and what the squeak community prefers I have no issues going down that route.?
<br>> >
<br>>
<br>> You will probably not get a consensus from the community. I am giving you
<br>> an opinion based on my own personal experience.
<br>>
<br>> OK, with that out of the way, here is what you should do:
<br>>
<br>> Allow about two hours to work through these instructions for the first time.
<br>> If you are using Linux or Unix, you can follow the steps exactly. If you
<br>> use another platform, just do the things you can, and you will still be able
<br>> to get an idea of how things works. Here are the steps to follow:
<br>>
<br>> Prepare tools. On Linux, install dev tools, libraries of interest, and Subversion.
<br>>
<br>> Get a copy of the platform sources. Do this in the same directory in which
<br>> you will be running your Squeak image. On Linux:
<br>>
<br>> ? $ svn co <a rel="nofollow" target="_blank" href="http://squeakvm.org/svn/squeak/trunk/platforms">http://squeakvm.org/svn/squeak/trunk/platforms</a><br>>
<br>> Any recent Squeak image will work for building VMs, but I like to work with
<br>> an updated trunk image, like this:
<br>>
<br>> ? world -> open... -> morphic project
<br>> ? (enter the project)
<br>> ? [menu bar] Tools -> Preferences
<br>> ? (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> <a rel="nofollow" target="_blank" href="http://source.squeak.org/trunk">http://source.squeak.org/trunk</a>.
<br>> ? ? accept the change (<ctl> s). click save button)
<br>> ? world -> help... -> update code from server
<br>> ? (wait for update process to complete, then save your image)
<br>>
<br>> Install VMMaker. This is the trunk version for an interpreter VM. Do it this way
<br>> to get started so that you will be able to see your generated C code in a browser.
<br>>
<br>> ? world -> open... Squeak Map Catalog
<br>> ? in the Squeak Map browser, click Update
<br>> ? select package VMMaker, version "head"
<br>> ? click Install
<br>> ? (wait for installation to complete)
<br>>
<br>> ? In a workspace, evaluate "VMMaker initialize". This will activate the Slang browsing tools.
<br>> ? (note: in the future, you can evaluate "VMMaker updateFromServer" to keep your VMMaker up to date)
<br>>
<br>> Now have a look at some plugins.
<br>>
<br>> Open a browser on UnixOSProcessPlugin>>primitiveGetUid. This is a simple
<br>> primitive call that links to the getuid() function in the C runtime library,
<br>> and answers your uid when the primitive is called. This is how the primitive
<br>> looks in Smalltalk. There is no C support code required, just the Smalltalk
<br>> code that you see here.
<br>>
<br>> While looking at the primitiveGetUid method, click the "source" button on
<br>> the browser, then select either "translate inlined C". You will now see
<br>> the C code for the primitive.
<br>>
<br>> Explore a few more primitives and other methods, and have a look at other
<br>> plugins, looking at both the Smalltalk source code and the generated C code.
<br>>
<br>> Now point your browser at B3DAcceleratorPlugin. This is a 3D graphics support
<br>> plugin that uses GL. It was written by Andreas Raab, a distinguished Squeak
<br>> guru and expert in graphics and VM programming. Andreas is less active on the
<br>> list that he once was, but I'm sure he will chime it and offer some guidance
<br>> once in a while. For now though, just treat this as a non-trivial example of
<br>> interfacing to GL with a plugin.
<br>>
<br>> Last but not least: Build a VM. This will be a minimal configuration with
<br>> only a few plugins, but it is enough to get you started. If you are able to
<br>> do this successfully, then you have everything you need in order to start
<br>> making your own plugins.
<br>>
<br>> ? world -> open... -> VMMaker
<br>> ? click the the "Help" button and spend a few minutes reading it.
<br>> ? click the "Entire" button to generate VM source code.
<br>> ? This will translate the Smalltalk VM and plugin source code into C source
<br>> ? ? files, which will be stored in the directory src along side your platforms
<br>> ? ? directory. The platforms directory should contain all of the sources that
<br>> ? ? you downloaded with Subversion, the the src directory will contain the generated sources from Smalltalk.
<br>>
<br>> Now open a terminal window. Compile your VM as follows:
<br>>
<br>> ? $ mkdir build
<br>> ? $ cd build
<br>> ? $ ../platforms/unix/cmake/configure --src=../src --without-gl
<br>> ? $ make
<br>>
<br>> If you want to install your new VM, do a "make install".
<br>>
<br>> HTH,
<br>> Dave
<br>>
<br>>
<br>>
<br>>
<br>> ________________________________
<br>>
<br>> 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>
<br>> To unsubscribe from Opengl and Squeak, click here.
<br>> NAML
<br>>
</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&node=4644265&code=dGhla2lsb25AeWFob28uY28udWt8NDY0NDI2NXwtMTEzNTM4MTMyMg==">click here</a>.<br>
                <a rel="nofollow" target="_blank" href="http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&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>