FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

forward references

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> DWT
View previous topic :: View next topic  
Author Message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Sun Mar 07, 2004 11:47 pm    Post subject: forward references Reply with quote

I created this topic in the hope it can be forget soon.

I still don't know how the src tree is organized and how to
get the linux version and how to integrate the windows
and linux version (I'll get to that).

To try to understand the forward reference problem I tried
to compile the graphics package by it self - lots of
forward references, as expected.
So I moved the import declarations to the classes
bodies and the forward references seem to be gone.
(can't be cure of that because other erros surfaced...)

Many new errors appeared... :(
but I guess that's this project main job...

Ant
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Mon Mar 08, 2004 2:00 am    Post subject: Reply with quote

Hi Ant,

Nice to here you were able to get somewhere despite the obstacles. I'm still trying to get familiar with the subversion setup myself. And the way we have the directories and build system orgainized currently may not be the most intuitive.

The way I've been building the system is to run the makefile in the .\d\dwt\src directory...that's the one I've been working on. As it was arranged I was already able to get past the forward-reference problems in the graphics directory modules WITHOUT the intra-class imports (I had to arrange the files very carefully, though, to get it to work). I was also to the stage of various other errors stopping the compiles there.

The widget directory modules are where I'm currently stalled at for forward references (rearranging the compile process doesn't work there). I'd like to see if intra-class imports will fix that as you managed to do with the graphics modules (your's obviously is the better solution). If we can manage to fix that, which I'm sure is possible, the porting job does just become a huge hunt and fix the errors game as the compile process continues. That would be a good start since that's how we've been progressing through this in the first place.

Thanks for looking into this, Ant. Perhaps, when you get Subversion figured out, you can upload your changes to the server. As for the Linux version, none currently exists. I've just been working on a Linux makefile that I haven't actually submitted to subversion yet. It works basically in compiling as far as the Windows version, but there is no Linux port made yet.

Take care,

John

PS. What IDE are you using? What DMD version are you using?
Back to top
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Mon Mar 08, 2004 9:54 am    Post subject: Reply with quote

JJR wrote:
Hi Ant,

Nice to here you were able to get somewhere despite the obstacles. I'm still trying to get familiar with the subversion setup myself.


just use the command line interface, could be easier...
JJR wrote:
I was already able to get past the forward-reference problems in the graphics directory modules WITHOUT the intra-class imports (I had to arrange the files very carefully, though, to get it to work).


???
I can compile it again, it was fine last night...

JJR wrote:
I was also to the stage of various other errors stopping the compiles there.

The widget directory modules are where I'm currently stalled at for forward references (rearranging the compile process doesn't work there). I'd like to see if intra-class imports will fix that as you managed to do with the graphics modules (your's obviously is the better solution).


but I think we agree that that shows a problem with the
"private import" on dmd.
however I think having the import on the class bodies
is not a bad idea.

JJR wrote:
PS. What IDE are you using?

What kind of question is that? leds of course! :)
JJR wrote:
What DMD version are you using?

0.81

Ant
PS. I need to fix a bug on DUI I just found,
then publish the new release,
then review leds code browser,
then...
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Mon Mar 08, 2004 11:01 am    Post subject: Reply with quote

Ant,

We have only attempted a port of the Windows side of SWT. You'd probably want to put the Linux stuff that is different in the dwt/internal/??? folder. The main class to differ will probably be os.d.

This will require you doing version (linux) {} and version (Win32) {} blocks at the top of each module for imports. I hadn't given this much thought, but maybe the place to do it is in the os.d module itself. Then we don't have silly imports at the top of each module like:

Code:
import dwt.internal.win32.os;


but rather something like:
Code:

import dwt.internal.os;


and have the compiler version flags in the classes/modules that need it for platform-specific code.

I have worked on Win32 only because I didn't have access to a Linux box until now. It is still easier for me to work on XP as that's my laptop and I can work from home, too. So I'll probably continue on down that path. But whatever you do with version and the changes I talked about above, I'll adapt and make Win32 work, just as you make progress on Linux.

Thanks again for your help... I hope 0.81 is cooperating...

BA
_________________
I really like the vest!
Back to top
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Mon Mar 08, 2004 1:05 pm    Post subject: Reply with quote

brad wrote:
Ant,

We have only attempted a port of the Windows side of SWT. You'd probably want to put the Linux stuff that is different in the dwt/internal/??? folder. The main class to differ will probably be os.d.


unfortunatly seems that the 2 versions are very different...

Doesn't look like merge them is a good idea.

Ant
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Mon Mar 08, 2004 4:45 pm    Post subject: Reply with quote

What about:

dwt/internal/os.d that has versions that import dwt/internal/win32/os.d and dwt/internal/linux/os.d?

That way they're different files and yet the compiler version() {} still handles one piece of source code for all platforms.

I'm sure there are other files that will be different from platform to platform, but do you agree that we want to keep all of the code together in one big block for maintainability? We'd reuse heavily what we could.

BA
_________________
I really like the vest!
Back to top
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Mon Mar 08, 2004 5:11 pm    Post subject: Reply with quote

brad wrote:
What about:

dwt/internal/os.d that has versions that import dwt/internal/win32/os.d and dwt/internal/linux/os.d?

That way they're different files and yet the compiler version() {} still handles one piece of source code for all platforms.

I'm sure there are other files that will be different from platform to platform, but do you agree that we want to keep all of the code together in one big block for maintainability? We'd reuse heavily what we could.

BA


it's only my first impression.
I cannot find the dwt/internal/linux package.
I compared 3 or 4 classes from widgets and they seemed very
different to me (of course the public API has a common set).

On the other hand the layout package is identical for both versions.

We could do, where necessary:
version(windows)
{
import widgets.windows.button;
}
version(linux)
{
import widgets.linux.button;
}
we'll have to look at it in more details.

Ant
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Mon Mar 08, 2004 6:55 pm    Post subject: Reply with quote

okay, I'll pull the Linux version and take a look.
_________________
I really like the vest!
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Mon Mar 08, 2004 7:11 pm    Post subject: Reply with quote

There is actually no internal/linux package. If you download the linux port of SWT you'll see that for the Linux platform they create a package to interface to the gtk toolkit (ring any bells Wink . That's in the internal/gtk directory.

The linux src is called:

swt-3.0M6-linux-gtk.zip

Within the package you'll find:

swt-pisrc.zip

which contains the "org\eclipse\swt\internal\gtk" package. This package maps the swt calls to gtk interface calls much like the win32 version thus allowing the use of a common high level interface. This was the whole benefit of swt, I thought.

If we follow the same structure, we should be able to integrate the linux and win32 source together since they don't reference the same directories. One uses internal/win32 and the other uses internal/gtk. The higher level interfaces seem to share the same code as long as the proper interface can be activated (with version control?). So I think it's still possible without making a whole separate linux version.

But maybe I'm over-simplifying it all. Ah back to my studies before I get to caught up in this....

Take care,

John
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Mon Mar 08, 2004 8:27 pm    Post subject: Reply with quote

That's what I was talking about. We need to port dwt.internal.* to whatever platform we choose. If we don't want to bother with motif, then we can just call the version(linux) {} stuff dwt.internal.gtk. If there's another linux library to port to (I don't know what KDE uses), then maybe we don't have version(linux) but rather version(gtk). I don't think we're limited to the reserved win32 and linux, are we?

BA
_________________
I really like the vest!
Back to top
View user's profile Send private message
brad
Site Admin


Joined: 22 Feb 2004
Posts: 490
Location: Atlanta, GA USA

PostPosted: Sun Mar 14, 2004 11:02 pm    Post subject: Reply with quote

From Andy Friesen, who reworked dwt.internal.win32 a bit recently. I will attempt to get that code into Subversion tonight...

Quote:

Brad Anderson wrote:

>Andy,
>
>Sorry for the late reply. I did take a brief look at this and compared to
>the classes we've been working on. Do you have a rough explanation of what
>you did? I saw that some of the java "struct" classes were turned into
>structs, and a bunch of changes in os.d.
>
>
Sure. No problem.

The most notable thing is forward.d, which has abstract base classes for
most everything that was causing circular dependancies. Other modules
now depend on it instead of each other. (this is an awful, silly hack,
but it's the best I can come up with until the compiler deals with
interdependant modules correctly)

As you said, classes became structs. Java only really used classes to
begin with because it didn't have this option; I thought it the simplest
way to go about things.

I changed char[] to wchar[] and byte[] to char[] all over the place to
reflect D's string semantics correctly. (Java chars are 16 bits)

A lot of the extern(C) overloads for SendMessageA/W and MoveMemory (some
others too) had to be removed, since D doesn't allow this.

'public static final int' was replaced with 'public const int' for the
constants defined in os.d

lresult was changed from a class to an alias. (go Java)

>For the most part, did you just convert from Java to D whatever way made
>sense, and got it to compile? In any case, I'm swamped, but I'll try to use
>it while compiling the entire project to see if it helps any of the upstream
>forward references.
>
>
More or less, yeah. The forward.d pattern tends to work well, though
I'm not quite sure how to deal with dwt.internal.graphics. I'll have to
fiddle with it some more when I have some time.

-- andy

_________________
I really like the vest!
Back to top
View user's profile Send private message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Mon Mar 15, 2004 12:45 am    Post subject: Reply with quote

This is good, I guess. So nobody was able to just use intra-class imports to fix the problem? I thought Ant had made some of it work by doing it the import way. If Andy's method fixes the problem thoroughly, I guess we should go with it. It will be intereseting to look over his changes. Good to see someone is able to some work on the project, nonetheless. I've been swamped too.

Concerning other interfaces on Linux, Qt is the one used on KDE. I doubt it would be easily portable since I believe the interface is mostly C++. GTK is actually a pretty safe bet for most Unix-like platforms. Someday someone may like to consider a direct port to Mac OS X, but I don't know how that would work. It's not important for now anyway.

By the way, why hasn't Andy signed up on this BBS? Smile

Later,

John
Back to top
View user's profile Send private message
andy



Joined: 15 Mar 2004
Posts: 71

PostPosted: Mon Mar 15, 2004 9:22 pm    Post subject: Reply with quote

yo.

SWT doesn't work quite the same way as other toolkits of the same sort, as I understand it. The interface is consistent across platforms, but the implementation is not. IBM basically rewrote it for every platform.

Edit: Or not. Looks like Ant has already looked into this.
_________________
"Complacency is a far more dangerous attitude than outrage." - Naomi Littlebear
Back to top
View user's profile Send private message
Ant



Joined: 06 Mar 2004
Posts: 306
Location: Canada

PostPosted: Mon Mar 15, 2004 9:59 pm    Post subject: Reply with quote

andy wrote:
yo.

SWT doesn't work quite the same way as other toolkits of the same sort, as I understand it. The interface is consistent across platforms, but the implementation is not. IBM basically rewrote it for every platform.

Edit: Or not. Looks like Ant has already looked into this.


Many source files are common.
Do you agree we shouls have only one source tree
and use version to import the correct version (like your dfbth)?

That seems the best way to have the independent versions
but also propagate the common conversion to every version.

Ant
PS
I got distracted with leds.
I'm trying to include some conversion tasks into leds.
Back to top
View user's profile Send private message
andy



Joined: 15 Mar 2004
Posts: 71

PostPosted: Mon Mar 15, 2004 10:06 pm    Post subject: Reply with quote

I think it's more important that the separate source trees actually work first. One problem at a time.

Once that's out of the way, though, consolidating the commonality does seem like the best approach. Duplicated code is rarely the Right Thing.
_________________
"Complacency is a far more dangerous attitude than outrage." - Naomi Littlebear
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.     Forum Index -> DWT All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group