Pure FB Runtime Library (in progress)

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

Re: Pure FB Runtime Library (in progress)

Postby counting_pine » Jan 25, 2018 13:10

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

Re: Pure FB Runtime Library (in progress)

Postby Imortis » Jan 25, 2018 15:19

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
Posts: 1576
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Postby Imortis » Jan 29, 2018 17:28

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
Posts: 1576
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Postby Imortis » Jan 31, 2018 17:23

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: 1403
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Pure FB Runtime Library (in progress)

Postby St_W » Jan 31, 2018 18:26

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
Posts: 1576
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Postby Imortis » Jan 31, 2018 18:42

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

Re: Pure FB Runtime Library (in progress)

Postby St_W » Jan 31, 2018 19:30

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
Posts: 1576
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Postby Imortis » Jan 31, 2018 19:31

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

Code: Select all

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

Re: Pure FB Runtime Library (in progress)

Postby St_W » Jan 31, 2018 19:46

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
Posts: 1576
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Postby Imortis » Jan 31, 2018 19:49

St_W wrote:https://repl.it/repls/WorriedFrenchAurochs


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

Re: Pure FB Runtime Library (in progress)

Postby Imortis » Jan 31, 2018 23:17

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/fbrtLib/tree/master/darwin

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

Re: Pure FB Runtime Library (in progress)

Postby PaulSquires » Feb 01, 2018 3:44

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
Posts: 1576
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: Pure FB Runtime Library (in progress)

Postby Imortis » Feb 01, 2018 18:34

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: 2643
Joined: Jun 16, 2005 9:45
Location: Eindhoven, NL
Contact:

Re: Pure FB Runtime Library (in progress)

Postby marcov » Feb 01, 2018 19:53

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: 1403
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Pure FB Runtime Library (in progress)

Postby St_W » Feb 02, 2018 1:16

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.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 1 guest