Marcos Roriz $:

Pessoal, Geek, Anime, Jogos, Ciência da Computação e Open Source…

Archive for the ‘GNU Classpath’ Category

Delete or keep is the question.

leave a comment »

Hello guys, I’ve stumbled up on some tricky code here in Escher. More exactly theres a lot of parts that are *important* but are not used on the code, like this one:

 // Can be removed
 public static float [] linearize (float [] [] src) {
   int s1 = src [0].length;
   int s2 = src.length;
   float [] dst = new float [s1 * s2];

   for (int i=0; i<s2; i++) {
     int offset = i * s1;
     System.arraycopy (src [i], 0, dst, offset, s1);
   return dst;

  // Can't be removed
  public static float [] linearize (float [] [] [] src) {
    int s1 = src [0] [0].length;
    int s2 = src [0].length;
    int s3 = src.length;
    float [] dst = new float [s1 * s2 * s3];

    for (int i=0; i<s3; i++)
      for (int j=0; j<s2; j++) {
        int offset = s1 * (j + s2 * i);
        System.arraycopy (src [i] [j], 0, dst, offset, s1);
    return dst;

This method is part of the Misc class (which contains ‘handy’ methods for vector/graphic manipulation). So the question is, while this method does have it’s meaning in the program it’s not used anywhere on it. And to complicate it more the ‘same’ method with a different argument (3 dimension array) is used in the code. Should I remove it the unused??? I’m not totally sure but I think if they are not used we should remove it >_<‘. And that what I’ll probably do on my next commit. What you guys think? Should I keep or delete? :3

Other problems is that in general the classes uses a lot of public and static variables/methods, I’m doing some basic encapsulation on it. Also my next commit will include a revision/refactoring of the glorious gnu.x11.Display class with it’s > 1.4k lines of code. After I finish it’s refactoring the other classes will be easier, since they are usually < 200 lines of code. After classes refactoring is done is time to start going for the parser to generate automatic X11 code, the coolest part!

To sum it up I also received the confirmation that I can now commit oficially to GNU Classpath, so now I can submit code to XPeer there ^_^. Mr. Donald R. Robertson, III, J.D. sended me the confirmation. I’m honored to be able to contribute to a GNU project :]

Accepted by FSF =D~

PDF of the agreement

Written by marcosroriz

June 17, 2010 at 10:37 pm

GSoC Updates

with 2 comments

First of all I would like to apologize for my lack of attention with GSoC this week it was basically because my university (UFG) sent us to a coding week in other one (UFPB). To make that time lost up I’ll work double until the program end. I’ll everyday post here about what I’m refactoring and how I’m doing this stuff, and how I’m applying the corrections that Mario Torre is giving me. So to not lose some time I’ll post today some basic AWT Relationship (which explains Escher) and the class refactoring that I’m working right know (gnu.x11.Display).

AWT Relationship

Java has by default at least one AWT (Abstract Window Toolkit) implementation, which enables various ways to manipulate GUI in general (graphics/events). Everything starts with Toolkit which is a abstract class that defines the basic functionality of a rendering kit, that is a AWT. To add extra functionality GNU Classpath subclass the Toolkit into ClasspathToolkit which basically add extra methods for extra information, such as, getting all truetype fonts available on the system. The same process, sub-classing and adding extra methods, happens on OpenJDK but is called SunToolkit.

Now we need peers to make the communication with the toolkit (Gtk, Qt, X11) and Java. We basically have a bunch of implementation making calls to their respective peer, usually using JNI to call the C/C++ code. The X11 toolkit is special in a sense that it doesn’t need a full desktop environment to run, it needs only a X11 Server. Escher is the implementation of the X11 peer written totally in Java. It send and receive requests from the X11 Server and repass to Java. Since Escher is written totally in Java and the X11 peer don’t need a full desktop environment it makes perfect sense to use it on a embedded device that needs a low memory footprint. To sum up Escher like any X client can handle extension, in fact it already implemented the famous GLX extension which allow a client (application) to use OpenGL inside a X11 window.

AWT <--> Escher Relationship

Tomorrow I’ll bring some of the refactoring that I’m doing…

Sleeeeep ZZZZzzzZZ

Written by marcosroriz

June 14, 2010 at 1:27 am