Pure FB Runtime Library (in progress)

User projects written in or related to FreeBASIC.
Post Reply
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Re: Pure FB Runtime Library (in progress)

Post by counting_pine »

Yeah, 'for(;;)' is a common idiom for an "endless" loop. Presumably the loop body has a 'break' statement somewhere.
Imortis
Moderator
Posts: 1924
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Post by Imortis »

counting_pine wrote:... Presumably the loop body has a 'break' statement somewhere.
Correct. I was pretty sure that I could just replace it, but wanted to ask someone a bit more knowledgeable.
Imortis
Moderator
Posts: 1924
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Post by Imortis »

signals.c requires a c header called signal.h I am not sure if that can be converted directly or if there should be a different code to replace that.

Any one have some insight on this one?

Also: crt/getopt.bi does not seem to exist in our crt headers, but it is called in crt/win32/unistd.bi. The linux and DOS versions of that file have a whole lot more content in them. Is this a problem with the unistd.bi file for win32 or with the getopt.bi file not existing?
Imortis
Moderator
Posts: 1924
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Post by Imortis »

Also, as a sanity check:

Code: Select all

*--dst
in c is equivilant to

Code: Select all

dst[-1]
in FB right?
St_W
Posts: 1626
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Pure FB Runtime Library (in progress)

Post by St_W »

Imortis wrote:Also, as a sanity check:

Code: Select all

*--dst
in c is equivilant to

Code: Select all

dst[-1]
in FB right?
It also decrements dst.
Imortis
Moderator
Posts: 1924
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Post by Imortis »

dst is a ptr. Is it decrementing the pointer or the value? I thought it was the ptr.
St_W
Posts: 1626
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Pure FB Runtime Library (in progress)

Post by St_W »

Imortis wrote:dst is a ptr. Is it decrementing the pointer or the value? I thought it was the ptr.
The pointer ist decremented first, then the (decremented) pointer is dereferenced.

dst[-1] does not update the pointer.
Imortis
Moderator
Posts: 1924
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Post by Imortis »

Ah! So it would be better to replace it with this:

Code: Select all

dst -= 1
*dst = blah blah blah 
St_W
Posts: 1626
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Pure FB Runtime Library (in progress)

Post by St_W »

Imortis wrote:Ah! So it would be better to replace it with this:

Code: Select all

dst -= 1
*dst = blah blah blah 
Yes.

btw there are nice webservices to test all kinds of code, even including C/C++ or FreeBasic. For the discussed code e.g. try this: https://repl.it/repls/WorriedFrenchAurochs
Imortis
Moderator
Posts: 1924
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Post by Imortis »

I did not know this was a thing. Thanks for the link it will be helpful, indeed.
Imortis
Moderator
Posts: 1924
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Post by Imortis »

I just hit a pretty big milestone:

Every non-OS specific file had been converted! I also got to work on the Darwin files but his a bit of a snag. They include a header for Mach-O stuff, which is mac only. It looks like they only use one function, but I am unsure how much of the headers are required to make that one function work. If anyone wants to take a look, please do.
https://github.com/ImortisInglorian/fbr ... ter/darwin

In the mean time I am going to tackle the other OS-specific files. DOS is up next.
PaulSquires
Posts: 1002
Joined: Jul 14, 2005 23:41

Re: Pure FB Runtime Library (in progress)

Post by PaulSquires »

Great work Imortis, you can be sure that the whole community is rooting for you and great success for this project. It will help move FB forward immensely. Awesome!
Imortis
Moderator
Posts: 1924
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Post by Imortis »

So, there is a file called cpudetect.s It is assembly passed to GCC. Could this be passed directly to GAS or even converted into a bas file using asm...end asm blocks? I tried to find info about what syntax the .s files use, but I could not find anything concrete from a quick google search.
marcov
Posts: 3462
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: Pure FB Runtime Library (in progress)

Post by marcov »

Afaik gcc only processes .S files with a preprocessor so that they become .s files. So if it has #ifdefs, it might need preprocessing
St_W
Posts: 1626
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Pure FB Runtime Library (in progress)

Post by St_W »

Imortis wrote:So, there is a file called cpudetect.s It is assembly passed to GCC. Could this be passed directly to GAS or even converted into a bas file using asm...end asm blocks? I tried to find info about what syntax the .s files use, but I could not find anything concrete from a quick google search.
Just create a BAS file with inline assembly, if needed. As long as the function signature and calling convention matches everything should be fine.
Post Reply