Blog
Page: 0 ... 5 ... 10 ... 15 ... 20 ... 25 ... 30 ... 35 40 41 42 43 44 45 46 47 48 ... 50 ... 55 ... 60 ... 65
Lgi Mac Port
Date: 4/1/2007
I took great delight in implementing LgiGetOs and LgiGetOsName this morning. Given the 2 variables for version and revision are ints I went with ver = "10" and revision = "48" to represent Mac OS X 10.4.8, it seems that the OS is limiting itself somewhat in the way it returns the version numbers. If it ever goes beyond 10.4.9 then I'll be in trouble. I wonder what Apple would do given that the version number is reserving just 4 bits for the 2nd and 3rd number. I guess they'll use 0x104a for 10.4.10. Maybe I should just add a third parameter, or make it an array.

I also implemented key up events. There is no direct corralation between key down's and key up's because the system converts the raw key down's into unicode via various input methods, and that is what I give to the application. The key up is just a massaged virtual keycode. But seems to work really well, except that I can't tab between controls. I must've broken the default handler for that. I'll probably just implement my own handler so I can get an initial release out the door.

So now all thats left to acheive an i.Ftp beta is menus, threading, timers and the socket layer. How hard can that be? ;)
(0) Comments | Add Comment

Five(ish) Things
Date: 1/1/2007
In the spirit of new year introspectiveness I present fiveish things.
  1. Recording music with/for friends.
  2. a) Drawing, although I still dable, b) Drifting a RWD car.
  3. a) Perfect pitch for writing and playing music more fluently and getting myself fit and healthy, because without energy and stamina I'll never get anywhere great. b) I would love to imbibe some of the mental state that Nuno was/is in when he plays and writes. I've probably been playing the same amount of time that he had when he recorded his seminal works, and yet I'm not even close to being able to pull off those sorts of songs. (Apparently he lives less than 100km away from me right now!?! Who knows it could actually happen)
  4. a) Creative, Geeky, Independant. b) Generous, Prolific.
  5. If someone summed up your entire life in one paragraph do you think you'd be happy with what it would say?
(0) Comments | Add Comment

Mac Porting
Date: 31/12/2006
Things that I got working this week:
  • Mouse input, mapping of mouse co-ordinates, all click meta-data
  • PostEvent and the associated OnEvent handler
  • Get/Set Focus and OnFocus events
  • Modal dialogs
  • Loading images
  • Some pixel conversion issues (e.g. Intel porting)
Things that need to be fixed for a alpha release:
  • Keyboard input
  • Menus
  • Sockets


I will be posting something in Janurary come what may. i.Ftp is actually responding and working like an actual application. A Scribe release will follow shortly after.

Update: Text input is working. Still need to get some of the other keys sorted out via the raw keyboard events.
(0) Comments | Add Comment

Why We Reinvent The Wheel
Date: 22/12/2006
The issue of creating a new scripting language for Scribe has been on my mind lately, and as Ben simply points out in his comment here: "didn't you think about using an already existing scripting language to do the job?", it's clearly on the mind of my users and readers as well. And I thought I'd talk about how I got to become one of those geeky language types that talk about lexing and parse trees and so on.

The decision to roll my own language was in part a natural progression from i.Mage's scripting that just got a bit out of control. I started with an ultra simple syntax that I could parse in 3 lines of code: <command> <argument>[ <argument>] <crlf>. Pretty simple eh? Well then I thought about that and wanted to add some variables so I could do some simple expressions in the command's arugments. At this point spending weeks trying to intergrate a fully fledged scripting language seemed stupid, I only wanted some basic expressions. How long could it take? So a few hours later I had a basic expression evaluator and bing I was done. So I seemed to have staved off a good amount of work and still had the feature I wanted. Still I did think about it, considered the trade off and it was simpler to do it myself.

Now sometime later I decided that a loop command might be useful. So I add the "for" command which looped over a set of commands. This proved to be a little harder but not overly difficult, another few hours passed and I had loops in my language. Still I was convinced it was much easier than intergrating someone elses code. I had already suffered with the ICI scripting language for a Scribe plugin, and it was been painful to intergrate. It just didn't want to map to the internal object addressing method I wanted. So in fact I had tried to intergrate a script language with my code before and KNEW how much work was involved.

Sometime later again someone bugged me about writing some complicated filter in Scribe and I thought to myself "that ICI stuff was a pain, maybe I should look at bringing i.Mage's scripting language over into Scribe". So I did, it was trivial, with some changes here and there both apps could reuse the compiler/executor. In the meantime I had refined the syntax a lot to make it very Javascript like in an effort to stave off having to talk people into learning a new script syntax. It seemed like a good way to justify the language.

Still over the months it's existed I guess I've now spent about the same amount of time I would've had to spend to intergrate a external language. However I still have very tight binding to native C++ code, and some features that wouldn't map well to external languages, and I can change the language to suit my needs at any point. Because I understand it from a core level.

For instance I love being able to define a method that exists in a different DLL and call it through script. VB did this from very early on and it's brilliant. It means that you can glue different bits of your code in different langauges together very easily. This clearly rubbed off on me because I added it to my language fairly early on. I seriously looked into Python at one point and I wasn't happy with the work required to call external C libraries. I even thought about hacking Python's interpreter to do my bidding. But it was clearly a scary proposition.

I'm not sure I did the right thing in writing my own. But I'm certainly happy with the results, and the code base will be very valuable in a lot of the software I'm writing. The expression evaluator will most likely end up in i.Hex and so on. And I feel that compilers aren't so scary anymore. So there is a lot of first hand knowledge that I've gained from the process.
(2) Comments | Add Comment

Scripting Documentation
Date: 21/12/2006
I've started documenting the scripting language in the latest build of Scribe. It's probably not much more than you can glean from all the blog posts about it, but now it's all in one place instead of scattered throughout my blog. Also I've at least made a list of all the built in functions that you can call and their parameters, which is a nice start.

I'm sure the requests for more functionality will come thick and fast once people start writing scripts. So I await your questions and requests.
(0) Comments | Add Comment

The Franken-Scriptor Lives!
Date: 20/12/2006
Well after a fair bit of hacking and QA I've got the script engine in Scribe running some non-trivial scripts. In test11 you'll be able to create scripts and have them hang off the tools menu of the main window. Just put a ".script" file in "./Scripts" under Scribe.exe and it'll get inserted in the Tools menu. Inside the script you need to define a "Main" function in LGI script (see i.Mage's help for documentation) which will get run when you select the menu item that corrasponds to the script.

I'm initially converting the existing bottom 3 "utility" style commands on Tools menu to script to test the system. So far the first one looks like this:
//
// Deletes all the attachments in the current folder after asking the user.
//
// MenuText = Delete all attachments in current folder
// MenuStrRef = 1266
//
function Main(App)
{
    Folder = App.CurrentFolder;

    Print("Folder='" + Folder.Path + "'\n");

    if (Folder)
    {
        if (Folder.Type == 0xAAFF0001)
        {
            Load(Folder);

            Bytes = 0;
            Count = 0;
            Len = Folder.Length;
            
            for (i=0; i<Len; i++)
            {
                t = Folder.Item[i];
                if (t)
                {
                    Attachments = t.Attachments;
                    for (n=0; n<Attachments; n++)
                    {
                        a = t.Attachment[n];
                        if (a)
                        {
                            Bytes += a.Length;
                            Count++;
                        }
                    }
                }
            }

            if (MsgBox( App,
                        "Do you want to delete " + Bytes + " bytes in " + Count + " attachments?",
                        Name,
                        4) == 6)
            {
                for (i=0; i<Len; i++)
                {
                    t = Folder.Item[i];
                    if (t)
                    {
                        Attachments = t.Attachments;
                        for (n=0; n<Attachments; n++)
                        {
                            a = t.Attachment[n];
                            Delete(a);
                        }
                    }
                }
            }
        }
        else
        {
            MsgBox(App, "Folder doesn't contain mail.", "Delete Attachments");
        }
    }
    else
    {
        MsgBox(App, "No current folder?", "Delete Attachments");
    }
}


And that works fine. It's a little rough around the edges but it works as advertised. I had to fix a few things in the script engine and also add some more functions and fields in to the objects.

I hope to convert the other 2 tools into script before I release test11. Sometime after the release I'll document the language and commands here. As the old scripting plugin is deprecated, I may as well use that page from something useful.
(2) Comments | Add Comment