Is FreeBasic still continued to develop?
-
- Posts: 453
- Joined: Dec 24, 2005 2:32
- Location: WA - USA
- Contact:
Just to make it clear, FB won't just translate BASIC to C. Gcc is used as a high-level assembler, not a single C header is ever included - you can also use OOP that's ABI-compatible with g++ (a C++ compiler) using gcc to compile (a C-only compiler).
The gcc emitter doesn't change anything in the front- and the middle-end of the compiler, so syntax and semantic checks continue to be done.
The gcc emitter doesn't change anything in the front- and the middle-end of the compiler, so syntax and semantic checks continue to be done.
-
- Posts: 453
- Joined: Dec 24, 2005 2:32
- Location: WA - USA
- Contact:
No, inline C isn't and won't be supported.
Most C libraries can already be used in FB, including those listed. To support syntax and semantic checks and debugging (what a simple translator won't do), the headers must be in the FB language. The tool: SWIG.
Most C libraries can already be used in FB, including those listed. To support syntax and semantic checks and debugging (what a simple translator won't do), the headers must be in the FB language. The tool: SWIG.
-
- Posts: 206
- Joined: Aug 27, 2005 2:02
- Location: Istanbul, Turkey
This is so cool!v1ctor wrote:Just to make it clear, FB won't just translate BASIC to C. Gcc is used as a high-level assembler, not a single C header is ever included - you can also use OOP that's ABI-compatible with g++ (a C++ compiler) using gcc to compile (a C-only compiler).
The gcc emitter doesn't change anything in the front- and the middle-end of the compiler, so syntax and semantic checks continue to be done.
@v1ctor
I have some questions concerning the gcc emitter.
I'm not sure to understand "Gcc is used as a high-level assembler". Could you explain a bit more ?
About the stabs informations what changes ? Are they always stored in the same way ?
Currently is it possible to do tests of debugging ? And how ?
Thanks for the done job and for your answers.
I have some questions concerning the gcc emitter.
I'm not sure to understand "Gcc is used as a high-level assembler". Could you explain a bit more ?
About the stabs informations what changes ? Are they always stored in the same way ?
Currently is it possible to do tests of debugging ? And how ?
Thanks for the done job and for your answers.
Like this:
Becomes:
About stabs, the current implementation is based on the debugging info that gcc 3.x generates, so i think that they are compatible. I've no idea if they added anything new to gcc 4.x.
Yeap, but i wouldn't do any big tests atm. I committed the fixes to allow debugging in -gen gcc today, they are in the gengcc branch.
Code: Select all
var a = 1, b = 2
print a + b
Code: Select all
A$ = (integer)1;
B$ = (integer)2;
#define vr$1 ((integer)(A$ + B$))
fb_PrintInt( (integer)0, vr$1, (integer)1 );
Yeap, but i wouldn't do any big tests atm. I committed the fixes to allow debugging in -gen gcc today, they are in the gengcc branch.
-
- Posts: 8609
- Joined: May 28, 2005 3:28
- Contact:
Joshy versus GCC :lol:
hi v1ctor nice to see you have time for your baby FB :-)
FB versus GCC :lol:
FB versus GCC :lol:
Code: Select all
' The Lord of the Julia Rings
' The Fellowship of the Julia Ring
' Free Basic
' Relsoft
' Rel.BetterWebber.com
'#define USE_PTC
#ifdef USE_PTC
#define PTC_WIN
#include once "tinyptc.bi"
#endif
const SCR_WIDTH = 320
const SCR_HEIGHT = 240
const SCR_SIZE = SCR_WIDTH*SCR_HEIGHT
const SCR_MIDX = SCR_WIDTH \ 2
const SCR_MIDY = SCR_HEIGHT \ 2
const as single PI = 3.141593
const MAXITER = 20
dim shared as single Lx(SCR_WIDTH -1)
dim shared as single Ly(SCR_HEIGHT-1)
dim as uinteger ptr pBuffer
dim shared as uinteger Buffer(SCR_SIZE-1)
#ifdef USE_PTC
if ptc_open( "Julia (Relsoft) TinyPTC", SCR_WIDTH, SCR_HEIGHT ) = 0 then
print "error: ptc_open() !"
beep:sleep:end
end if
pBuffer = @Buffer(0)
#else
screenres SCR_WIDTH,SCR_HEIGHT,32
if screenptr = 0 then
print "error: screenres !"
beep:sleep:end
end if
WindowTitle "Julia (Relsoft) FBGfx"
pBuffer = ScreenPtr()
#endif
dim as uinteger ptr pTop,pBottom
dim as single xmin, xmax,ymin,ymax
dim as single theta,ty,p,q
dim as single x,y,x2,y2
dim as integer px,py,i,i_last,ii
dim as integer frames
dim as integer red,grn,blu
dim as double sTime,nTime
dim as single cmag,cmag2,zmag,zTot
dim as single drad,drad_L,drad_H
xmin = -2.0:xmax = 2.0
ymin = -1.5:ymax = 1.5
for i = 0 to SCR_WIDTH - 1
lx(i) = xmin + i * (xmax - xmin) / (SCR_WIDTH - 1)
next i
for i = 0 to SCR_HEIGHT - 1
ly(i) = ymax - i * (ymax - ymin) / (SCR_HEIGHT - 1)
next i
sleep 1000,1
' start time
sTime = Timer()
do
pTop = pBuffer
pBottom = pBuffer + (SCR_SIZE-1)
frames = (frames + 1) and &H7fffffff
theta = frames * PI / 180
p = cos(theta) * sin(theta * .7)
q = sin(theta) + sin(theta )
p = p * .6
q = q * .6
cmag2 = (p*p + q*q)
cmag = sqr(cmag2)
drad = 0.04
drad_L = cmag - drad
drad_L = drad_L * drad_L
drad_H = cmag + drad
drad_H = drad_H * drad_H
#ifndef USE_PTC
ScreenLock
#endif
for py = 0 to SCR_HEIGHT\2 -1
ty = ly(py)
for px = 0 to SCR_WIDTH - 1
x = Lx(px)
y = ty
ztot =0
i = 0
while (i < MAXITER)
x2 = x * x
y2 = y * y
zmag = (x2 + y2)
if zmag > 4.0 then exit while
if (i > 0) then
if (zmag > drad_L) then
if (zmag < drad_H) then
ztot = ztot + ( 1 - (abs(zmag - cmag2) / drad))
i_last = i
end if
end if
end if
i = i + 1
y = x * y
y = y + y + q
x = x2-y2 + p
wend
if ztot > 0 then
i = cint(sqr(ztot) * 500)
if i>0 then
if i<256 then
red=i: i=i * 0.33
red=(red+i) * 0.33
grn= i * 0.33
blu=(red+i) * 0.33
else
i-=256
if i<256 then
grn=i:i=(255+i) * 0.33
red=(255+grn+i) * 0.33
grn=(grn+ i) * 0.33
blu=(red+ i) * 0.33
else
i-=256
if i<256 then
blu=i:ii=(510+i) * 0.33
red=(510+ ii) * 0.33
grn=(255+i +ii) * 0.33
blu=(i +red+ii) * 0.33
else
red=254 '= (255+255+(255+255+255)*0.33)*0.33
grn=254 '= " "
blu=254 '= (255+red+(255+255+255)*0.33)*0.33
end if
end if
end if
select case as const (i_last and 3)
case 1 :*pTop = rgb( grn, blu, red )
case 2 :*pTop = rgb( blu, red, grn )
case else:*pTop = rgb( red, grn, blu )
end select
*pBottom=*pTop
else
*pTop =0
*pBottom=0
end if
else
*pTop =0
*pBottom=0
end if
pTop +=1
pBottom-=1
next
next
if (frames mod 100)=0 then
if len(inkey) then exit do
end if
#ifdef USE_PTC
ptc_update pBuffer
#else
screenunlock
#endif
loop
' now time
nTime=Timer()
#ifdef USE_PTC
ptc_close
#endif
screen 0
' clear key buffer for next sleep
while len(inkey):wend
#ifdef USE_PTC
print "TinyPTC benchmark"
#else
print "FBGfx benchmark"
#endif
print "-----------------------------------"
print "counted " & frames & " frames total"
print "frames per seconds = " & frames/(nTime-sTime)
sleep
marcov: FB only supports include files so, that's not a problem.
------
Well, the gcc emitter was just merged into the trunk, you can updated the SVN sources now.
To use it, set an environment variable GCC pointing to your gcc executable (full path + file name).
There are a couple of warning messages that gcc will show, that can be fixed later.
I didn't run the test suite against it (the gcc emitter) yet, neither tried to rebuilt the compiler using it, so, try to build your application that builds fine with 0.21 using it (just add the "-gen gcc" option) and see what happens ;).
------
Well, the gcc emitter was just merged into the trunk, you can updated the SVN sources now.
To use it, set an environment variable GCC pointing to your gcc executable (full path + file name).
There are a couple of warning messages that gcc will show, that can be fixed later.
I didn't run the test suite against it (the gcc emitter) yet, neither tried to rebuilt the compiler using it, so, try to build your application that builds fine with 0.21 using it (just add the "-gen gcc" option) and see what happens ;).
I updated fbc on ubuntu and tested a couple of examples and all worked fine. I did not set an environment variable.
Well, the gcc emitter was just merged into the trunk, you can updated the SVN sources now.
To use it, set an environment variable GCC pointing to your gcc executable (full path + file name).
There are a couple of warning messages that gcc will show, that can be fixed later.
I didn't run the test suite against it (the gcc emitter) yet, neither tried to rebuilt the compiler using it, so, try to build your application that builds fine with 0.21 using it (just add the "-gen gcc" option) and see what happens ;).
I ran first with -R -c -gen gcc so I could see the files created and all looked fine with a *.c instead of an *.asm file.
James