X.org, Ecere Chess, Linux release patch (0.41.17.3)

November 1st, 2007

Yesterday I finally got around to building and installing the latest stable release of X.org (X11R7.3). They somehow decided that everything was to be split in many little packages. It discouraged me last time and made me choose to keep using XFree86. But since everyone seems to be moving to X.org, this time I went through the tedious task of downloading every packages. They don’t come with any makefiles or scripts with the proper make order either, and they have a lot of dependencies on other stuff as well (fontconfig, expat, …). I therefore had to figure out the proper build older and all this made me miss the simplicity of XFree86′s make world.

I had to call invoke X with “xinit — -ignoreABI” for my nVidia driver to work. Supposedly nVidia will come up with a new driver to fix that.

There was an issue with the ButtonPress/ButtonRelease mouse events which would cause multiple ButtonDown to be generated in Ecere applications. I addressed this issue, and went on to figure out why the Chess AI was taking so long to play his move. I learned that usleep in Linux will make the entire process sleep, not only the thread. I also reworked the X event loop to use select on the X display socket.

This should make Ecere Chess a lot more playable on Linux. I played a few games, I had a rook and a knight and he managed to fork my rook with his only knight for a stalemate :( Another game, he had a terrible start moving his king all around, all the way to my side of the board (I was going right for his king courageously with a lone pawn to pester him). I still ended up checkmate. My chess skills definitely need sharpening.

Download

Linux: Problems with panels fixed, Debugger working

October 31st, 2007

This little Linux update resolves the panels issue. You would have had the problem if your desktop environment such as GNOME had a panel in the top or left edge of the screen.

The debugger is now working under Linux. You can now run the application through F5 / Debug, Start, place breakpoints, step through and watch eC expressions. Please keep in mind the debugger (like everything else in this early alpha SDK) is work in progress.

Download

New Linux SDK Release

October 29th, 2007

An updated version of the Linux SDK is now available:

Ecere SDK 0.41 – Build 17 (Experimental)

It resolves among other things a threading bug which caused the Chess and Fractals samples to segfault on some system.

It also includes those additional samples.

Unicode text display support will work with this release in OpenGL mode, X support is on the way.

I am currently working on a solution to the mouse positioning problem with some window managers setups.

Join us in #ecere on irc.freenode.net

October 25th, 2007

I would like to welcome everyone to join us in #ecere on irc.freenode.net.

I hope a dedicated IRC channel will help to slowly build a strong community of contributors, developers and end-users of Ecere technologies.

On eC Properties and Automatic Conversions

October 25th, 2007

Today I want to talk to you about eC properties, as well as conversions properties which reveal their true power… As you may know, eC places a lot of emphasis on properties. Properties are sort of half-way between methods and data members. They provide methods to “set” or “get” the property of an object, which is often stored internally in a data member. eC has one of the cleanest syntax for defining properties:

class Pen
{
   Color color;
   public property Color color
   {
      get { return color; }
      set { color = value; }
   }
}

In eC, class constructors never take in any parameters. Instead, eC relies on the initializers passed through instantiation. These can either be data members or properties. Here is how one could set the color property for a Pen object:

Pen pen { red };
Pen pen { color = red };

Although functionally equivalent to Set and Get methods, properties behave exactly like data members (with some limitations, such as not being able to obtain their address). For example,

pen.color = ~pen.color;
pen.color += 10;
pen.color.r = 255;
pen.color = 0xFF0000;
pen.color = { 255, 0, 0 };

These all go through the Set/Get methods to do their work. Notice here that the Color class is an eC Bit Class, which allows to be accessed both as a “unit type”, such as setting it to 0xFF0000, and as a “structure type”, when accessing the r member or using the curly brackets initializers.

The advantages of properties are multiple. First, they allow for instant visual feedback, for example in the case of the Ecere IDE’s Object Designer. The IDE has a property sheet in which you can visualize and change the values of properties, and get instant feedback in the visual designer window. The IDE’s Object Designer is extremely powerful and versatile. Currently, it is only used for the Form Designer, which is itself bundled inside the Window class of the runtime library. However, third parties could easily integrate into it to enable to visually represent and edit their own classes. The property editor as well as the code generation & parsing system will automatically be usable to those ends. This system all relies on the properties and was the original reason for designing eC and the Ecere Component Object Model.

Second, properties present this layer of protection over the data members. A property can be made public whereas the data member actually used to store the property can remain private. Properties can also only contain a Set or a Get method, therefore making it write-only or read-only. A property can also return or set a value which is not stored exactly as such in the class. This brings us to a special case of eC properties, the Conversion Properties.

Conversion properties are specified with only a data type, and no “name”. For example, a Radians property in the Degrees class allows to set a Radians value to a Degrees angle. eC will resolve cascading conversions to convert from one type to another. This is what enables the following magic:

pen.color = ColorHSV { 0, 100, 100 };
pen.color = ColorLab { 53, 79, 66 };
pen.color = ColorCMYK { 0, 100, 100, 0 };

Beautiful isn’t it? But what is really wonderful is that all this is done at compile time. Therefore this is not any slower than providing the color in RGB format, as the eC compiler will do all conversions and store the proper hexadecimal value here for the color. Like most class constructs, properties (including conversions) can be used in any kind of eC data types (structs, classes, units, enums…). However, they play a major role in the Units, to establish the relation between different compatible units, often allowing to perform the same functionality as overloaded operators would in other languages such as C++. It is therefore a very powerful tool which can save considerable amounts of code, since you don’t need to provide the implementation for any operator.

Dynamic Arrays (Similar to C++ std::vector)

October 22nd, 2007

Here is an early implementation of a dynamic array for Ecere…

It is most likely a interim solution until truer “templates” make an apparition in eC.

Download Array.ec

(Please don’t mind the obscurity of the internals. Like all things, it’s impermanent.)

You would use it as such:

import “Array”

public class ArrayPoint : Array
{
type = class(Point);
public Point * points;
};
void Test()
{
ArrayPoint points { size = 10 };
points.points[0] = { 10, 10 };
points.size = 20;
points.points[19] = { 5, 5 };
delete points;
}

Ecere Chess Source Code

October 22nd, 2007

3D Chess Here I just decided to share the source code for Ecere Chess with the world…

The 3D chess set is looking quite good, modeled by my friend Gaetan Loyer.
Ecere Chess has a very simple AI, seeing 2 moves of each players ahead…

It doesn’t know anything about openings or endings.

But it will probably still kick your a**.

Here’s the source code.

Linux Executable

Windows Executable

Ecere Communicator

October 21st, 2007

Communicator

Here’s a very early version of Ecere Communicator for you to try it out.

(Download Windows Executable – zip’ed / Linux Executable – tar’ed)

Communicator can now let you do instant messaging across the Jabber (including Google Talk), AIM/ICQ and MSN protocols.

For some strange reasons a few people were unable to connect to the MSN network, and an error 923 was returned.

Error 923 is said to be an unauthorized .NET kid passport… If anyone has any insight on what that is? :)

Acovel Update

October 21st, 2007

Here’s a screenshot of the Acovel Music Player showcasing Unicode support:

Unicode in Acovel

(Download Acovel 0.01 for Windows / Download Acovel 0.01 for Linux )

Unicode Support

October 21st, 2007

Sample Unicode Text Output I am currently implementing Unicode support throughout the SDK. I decided to adopt UTF-8 as the standard encoding for all Ecere API calls as well as the encoding for string literals inside eC files. UTF-8 is wonderfully transparent as it is fully compatible with ASCII. This avoids the nightmare of having two copies of every API such as in the Windows API which decided to adopt UTF-16. String literals in eC can be written without any prefix such as T”string” or L”string”, a fact I really appreciate.

Unicode on Windows is now fully functional, including:

  • Text output
  • International text entry
  • Complex scripts such as Devanagari
  • Right to left such as Arabic and Hebrew
  • Support in 3D video modes (OpenGL / Direct3D)

Now moving on to making Unicode work on Linux, as well as improving general support for the OS.