Amiga.org

Operating System Specific Discussions => AROS Research Operating System => Topic started by: Rodney on November 27, 2003, 02:34:42 AM

Title: AROS ports + How to get back into C/C++
Post by: Rodney on November 27, 2003, 02:34:42 AM
I've been looking at getting back into some coding. Haven't done any C/C++ for, well, a long time... since my algorithyms and data structures subject at uni, which was a bout 1+ ago. I've done some PHP since, but even that was 7+ months ago... The most recent i've done is Java 4+ months ago and Javascript 2+ months ago...

Any Ideas about how to get back into the swing of things and maybe re-learn a lot of stuff. I was thinking of porting the DOM to AROS. But thats a pretty big task, and not only would i have to learn C/C++ and get used to it, but also understand IDL and the mapping to C++. It took me several hours or days to work out the C++ mapping of a sequence and "port" the idl deffinition to C++. What a pain. I think i may just use a compiler instead next time..

Anyway, i thought the best way might be to port some simple or complex applications to AROS. Such as xpat? Which if i was to write the DOM, it would sit ontop of it. Has Xpat been ported to AROS?

I was thinking that porting may be a little less difficult in comparison to writing a program from scratch. Any ideas would be welcome on how to get back into C/C++ coding.

This thread was inspried by a reply on an AW thread :).

Quote

jahc wrote:
http://www.cplusplus.com/doc/tutorial/
http://www.cprogramming.com/


I was going to reply to it there, but i asked a lot of questions and thought it'd screw the thread up and take it somewhere the original poster didnt want it to go. Also, AW doesnt have any topics that cover my questions. Neither does AO but i though AROS dev was close enough :)

Also, on a side note, i've been getting buffer overflows on every contrib program in AROS. At least everyone i tried, except for the chess game which didnt do anything. I dont believe this woudl have anything to do with the problems the AROS team where having with the nightlys would it? Also, could this have something to do with the stack - im guess it could be, but i didnt know how to enlarge it... havnt looked into it yet?
Title: Re: AROS ports + How to get back into C/C++
Post by: jahc on November 27, 2003, 02:45:14 AM
Quote
This thread was inspried by a reply on an AW thread :).

I'm glad it inspired someone. Whenever someone asks on an amiga forum how to get into programming, I always paste those links, because those two sites got me started, and I found them very easy to follow. I'm still learning as I go with AmigaOS, but yeah.. I'm well on my way I think.
Title: Re: AROS ports + How to get back into C/C++
Post by: Rodney on November 27, 2003, 06:06:31 AM
so would porting programs, possibly small to start of with, be a good way of getting my skills up to scratch? I figured doing is better than reading a heap of crap, because its likly whilst doing i'll come across something that'll require me to read it and i should just do it then! In comparison to reading a heap of stuff front up, and then doing some dev work...
Title: Re: AROS ports + How to get back into C/C++
Post by: bloodline on November 27, 2003, 11:17:39 AM
I think the buffer overflows are due to a recent change in our c lib... this is one of those things that needs some one to go throught the Contrib and make sure everything is correct... Time consuming and Time best spent on the OS rather than the contributed programs. :-(

As for Porting, I suggest you join the AROS-Dev mailign list, the guys on there would be happy to tell you have to port your software to AROS/AmigaOS :-)
Title: Re: AROS ports + How to get back into C/C++
Post by: falemagn on November 27, 2003, 01:16:25 PM
Hey Rodney,

Yes, libexpat has been ported already, you can find it in the contrib dir, indeed.

About the buffer overflow... what exactly do you mean? Is it an error the shell report? If so, then it must be because our shell doesn't handle paths longer than 256 characters (I know, this is a limitation which I always forget we have... need to find the time to fix it), and it might be that the current pathname lenght is longer than the maximum. Try renaming the contrib dir from its name to just "contrib", and see if things change.
Title: Re: AROS ports + How to get back into C/C++
Post by: Rodney on November 27, 2003, 02:38:25 PM
Quote

falemagn wrote:
Hey Rodney,

Yes, libexpat has been ported already, you can find it in the contrib dir, indeed.


Hrmm, that woulda been a good project and good ramp up for a C++ DOM implementation. Im pretty damn sure there is NO C++ DOM implementation in the world. I nearly came close but i saw a guy who was looking for one and hadnt found one of the the 25 parsers he had found!

So my idea is still go, but a long way off happening! :)

Quote

About the buffer overflow... what exactly do you mean? Is it an error the shell report? If so, then it must be because our shell doesn't handle paths longer than 256 characters (I know, this is a limitation which I always forget we have... need to find the time to fix it), and it might be that the current pathname lenght is longer than the maximum. Try renaming the contrib dir from its name to just "contrib", and see if things change.

[/quote]

That worked :) It was in Zune, actualy, but i guess it all comes down to the shell! It was the AROS-Contrib-all path that was getting me! Thanx... That solution does sound oddly familiar thought, i prolly had to do a similar things last time i installed AROS :)

EDIT - wow - this message was a mess :)
Title: Re: AROS ports + How to get back into C/C++
Post by: falemagn on November 27, 2003, 02:48:32 PM
Quote

It was in Zune, actualy, but i guess it all comes down to the shell!


Zune? Could you please tell me in detail what happened, then?

Thanks a lot.
Title: Re: AROS ports + How to get back into C/C++
Post by: Rodney on November 27, 2003, 03:40:14 PM
Quote

falemagn wrote:
Quote

It was in Zune, actualy, but i guess it all comes down to the shell!


Zune? Could you please tell me in detail what happened, then?

Thanks a lot.


Well i hope i said that right :)

Basicly i extracted the AROS-contrib-all bz2 archive under the AROS-linux directory. Once AROS loaded, which was damn fast! I'd open the system "drive" by double clicking it on the desktop/workbench and proceed to AROS-blablalbla-contib-all (this was before i renamed it) and double click on some of the demos. All of the ones i tried said "buffer overflow". That message was presented in a small window, possibly with an OK button or something.

But i renamed the folder to "aros-contrib" (as to not conflict with the contrib folder AROS puts there by default (i know i could have put the stuff in there, but i wanted to keep it seperate)) and it all works :)

This is under linux, with root user too, if that would make a difference.

Also, note, any port i'll do will most likly take me years :) as i've only one 1st and 2nd year uni projects. But im keen. Has libXpm been ported? I was thinking of porting Xevil, a great game i like to play on debian. I think i'd have to do most of the graphix all by my wee self, which means learning all the aROS stuff  which should be fun, otherwise i'd have to port Xlibs as well or something nasty and thats not going to happen. But one thing that will ease the pain if is libXpm is ported. If not, i may have a go at the first which should give me some experience for the xevil port and working with graphix... I feel as thought i should start with much more simpler things, but i think throughing myself in the depend could also be good for me :)... Any thoughts?
Title: Re: AROS ports + How to get back into C/C++
Post by: falemagn on November 27, 2003, 05:29:03 PM
Quote
Basicly i extracted the AROS-contrib-all bz2 archive under the AROS-linux directory. Once AROS loaded, which was damn fast! I'd open the system "drive" by double clicking it on the desktop/workbench and proceed to AROS-blablalbla-contib-all (this was before i renamed it) and double click on some of the demos. All of the ones i tried said "buffer overflow". That message was presented in a small window, possibly with an OK button or something.


Aaah, ok, then it was Wanderer... I'll have a look.

And no, libXpm has not been ported, AFAIK.
Title: Re: AROS ports + How to get back into C/C++
Post by: Rodney on November 28, 2003, 02:51:33 AM
Quote

And no, libXpm has not been ported, AFAIK.


Well i was thinking there would be a similar AROS way of doing it anyway :) libxpm is for Unix. Anyway i've got a lot of reading to do i would think. The archetectural document developers document for both xevil and aros... Ohhh yer, gota download gcc :) unless its already in the AROS archive, but i dont think it is.
Title: Re: AROS ports + How to get back into C/C++
Post by: Karlos on November 28, 2003, 02:56:44 AM
Get back into C/C++ ? My dear boy, one never left!
Title: Re: AROS ports + How to get back into C/C++
Post by: Rodney on November 28, 2003, 03:08:36 AM
Quote

Karlos wrote:
Get back into C/C++ ? My dear boy, one never left!


Well its not that i've left :) its just that i've only done pissy uni projects and i havnt coded in it for about a year or more.

I dont need to re-learn the basics, such as classes, functions, pointers, conditionals etc I think i just wanna learn about real platform issues such as portability, that i havnt had a great chance to learn about. I think thats what really interests me. I believe the best way to go about it would be to jump into a project of somekind and learn on the way. But im not sure. You'r comments woudl be highly helpful :)
Title: Re: AROS ports + How to get back into C/C++
Post by: Karlos on November 28, 2003, 03:39:14 AM


Hmmmm. You could be the perfect guinea pig for something I've been working on (but currently on hold)....

Title: Re: AROS ports + How to get back into C/C++
Post by: Rodney on November 28, 2003, 06:12:27 AM
Quote

Karlos wrote:


Hmmmm. You could be the perfect guinea pig for something I've been working on (but currently on hold)....



That does sound evil... Im interested :)

Well i've got my AROS dev environment set up, im gunna unpack the xevil source and hopfuly get to read some stuff. Maybe i'll start by reading all the comments in the source.
Title: Re: AROS ports + How to get back into C/C++
Post by: Emufreak on November 28, 2003, 08:50:06 AM
Quote

I was thinking of porting Xevil, a great game i like to play on debian.


Well I try to port that at the moment. So we should probably try to coordinate that a bit. I have to be honest here too. My problem is I can't make too much promises. Because I have just very little time and very little experience in C/C++. What I wan't to say with that is, that I'm motivated right now but I might give up realizing that it's a bit too difficult or that I just don't have enough time for it.
Title: Re: AROS ports + How to get back into C/C++
Post by: Rodney on November 28, 2003, 11:49:37 AM
Quote

Emufreak wrote:
Well I try to port that at the moment. So we should probably try to coordinate that a bit. I have to be honest here too. My problem is I can't make too much promises. Because I have just very little time and very little experience in C/C++. What I wan't to say with that is, that I'm motivated right now but I might give up realizing that it's a bit too difficult or that I just don't have enough time for it.


Thats fantastic :) So you'r porting it to AROS atm? You'r concerns about skill level are echoed in my mind as well. Although, theres no telling, and once i "truly" get started on a project, i know i'll find it hard to stop, and i've played the R&D role in a few projects before, so im used to "digging" for information.

ATM im reading the xevil archetectural document. It goes throught he modules and their relationships, duties etc. Its not a bad read. Have you read  it? How far through are you in you'r efforts?

Also, where are you from? country etc!?
Title: Re: AROS ports + How to get back into C/C++
Post by: Emufreak on November 28, 2003, 12:35:49 PM
I just did some stuff to prepare for the porting

I read this paper too. I didn't quiet get everything in it. But it's a good start anyway.

I also looked at the directory structure of the source code. Right now its divided into 3 parts.
The cmn directory with the code that is used in all versions. We might have to make some changes in this part to so.  There's stuff like #IFDEF Win32 and #IFDEF X11 in it.

Then there is an X11 directory for linux and a win directory for windows. Well at least if you look at the amount of code I think the linuxversion is probably easier to port. The GUI of the Linuxversion isn't quite as good as the GUI for the Windowsversion. I would still take the Linuxversion because we have to rewrite the GUI anyway. I would start with a simple GUI and then we can improve it later.

I really don't quite now where to start with porting. At first I thought I could start with the graphic functions in X11/draw.cpp or something like that. But they depend so heavily on the other objects that this could be difficult. Right now I think we should start with main and port function for function. We should probably have a talk with the guys who ported it for windows first.

I also tried to write a small programm that opens a cybergraphicsscreen. But StormC seems to have some problems with the pragmas in the includefiles. You can find out more about this in the following threat.

]thread (http://[url=http://www.amiga.org/forums/showthread.php?t=5338)

I think Xevil should run on the following Amiga- and Amigalike systems:

Classic Amigas with 68x or PPC and Graphiccard
Pegasos
AROS

PS: I'm from Switzerland
Title: Re: AROS ports + How to get back into C/C++
Post by: Rodney on November 28, 2003, 12:52:23 PM
Yup here what i've figured so far. I may even be tempted to write up a document describing how i think i should go about it ect. It also may be helpful to get others in on the project. That is, others who know what to do when it comes to creating Amiga interfaces and playing around with Amiga specific functions for drawing ect...

Having said that, i dont believe anything from the X11 or Win32 directorys should be ported. It may be easier to do so , but it may be harder. For example, if we wanna port the unix stuff, there's gunna have to be a port of libXPM which is the X pixmap library they use to draw the images... or something like that.

I also believe that starting from Main could be a bad idea. Although its prolly more intuitive to start from the start, its going to have the most dependancies. When i say dependancies, i mean included C++ files. So i think it may be smart to start at the other end, then when we get to the main function, all the other stuff would have been done and it should be trivial from there :)... However, it may be a good idea to start from main when initialy reading through the code to get an idea of the system.

But maybe a good place to start would be utils.cpp ? Or something like that. I think it may have some include files, but im not sure how it uses them, because it was explained to be a C runtime wrapper.

Also, i already know of stuff we should NOT touch for the moment. Such as Role and the streams files. That is, the client server stuff. I hope, we dont have to port those unless we want a client/server game. I dont have to start a server to run Xevil so im guessing that stuff is not neccessary. Althoug having said that, Role has three things (interfaces/objects?) called Client, Sever and Standalone... Im guessing then we may have to port Role, but only the standalone thingo, for the moment :)

As i may or may not have mentioned, i read the document now, but i'll have to go over some of the diagrams again to get a good feel for the module hierarchy.

Anyway, theres still a lot of reading to do. Also, i noticed on the AROS dev manual (if it infact was that) that ViM would be nice to be ported... I know these pages are old, but maybe that'd be a nice project as well? It might be a little easier too... although now i remember its not JUST a text editor, its pretty powerful :)

Well, im gunna relax a little, surf, maybe read some more, i'll cya later :)