Is FreeBasic still continued to develop?

For other topics related to the FreeBASIC project or its community.
Landeel
Posts: 749
Joined: Jan 25, 2007 10:32
Location: Brazil
Contact:

Postby Landeel » Jan 19, 2010 20:01

This is great news!!! Thanks v1ctor!!! You're the best!!!
John Spikowski
Posts: 453
Joined: Dec 24, 2005 2:32
Location: WA - USA
Contact:

Postby John Spikowski » Jan 19, 2010 21:49

Welcome FreeBASIC to the Basic to C club.

Current Members:

BCX
BaCon
v1ctor
Site Admin
Posts: 3801
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Postby v1ctor » Jan 20, 2010 2:33

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.
John Spikowski
Posts: 453
Joined: Dec 24, 2005 2:32
Location: WA - USA
Contact:

Postby John Spikowski » Jan 20, 2010 3:14

not a single C header is ever included


Can C headers be included to add other libraries like Gtk, cURL, ...?
v1ctor
Site Admin
Posts: 3801
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Postby v1ctor » Jan 20, 2010 3:27

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.
Dr_D
Posts: 2398
Joined: May 27, 2005 4:59
Contact:

Postby Dr_D » Jan 20, 2010 3:34

long live fb!
joseywales72
Posts: 206
Joined: Aug 27, 2005 2:02
Location: Istanbul, Turkey

Postby joseywales72 » Jan 20, 2010 7:47

Great news.... Thank you Victor and all the devs.
HD_
Posts: 215
Joined: Jun 10, 2006 12:15
Contact:

Postby HD_ » Jan 20, 2010 8:22

I love you v1ctor :D
fsw
Posts: 260
Joined: May 27, 2005 6:02

Postby fsw » Jan 20, 2010 18:25

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.


This is so cool!
SARG
Posts: 1143
Joined: May 27, 2005 7:15
Location: FRANCE

Postby SARG » Jan 20, 2010 22:13

@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.
v1ctor
Site Admin
Posts: 3801
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Postby v1ctor » Jan 20, 2010 23:10

Like this:

Code: Select all

   var a = 1, b = 2
   print a + b


Becomes:

Code: Select all

   A$ = (integer)1;
   B$ = (integer)2;
   #define vr$1 ((integer)(A$ + B$))
   fb_PrintInt( (integer)0, vr$1, (integer)1 );


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.
D.J.Peters
Posts: 8176
Joined: May 28, 2005 3:28
Contact:

Joshy versus GCC :lol:

Postby D.J.Peters » Jan 21, 2010 6:59

hi v1ctor nice to see you have time for your baby FB :-)

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

Postby marcov » Jan 21, 2010 17:26

V1ctor: wrt debug info, do you replicate type information if you import it into a compilation unit?

IOW does a compilation unit contain all info for all types?
v1ctor
Site Admin
Posts: 3801
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Postby v1ctor » Jan 22, 2010 16:17

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 ;).
jcfuller
Posts: 324
Joined: Sep 03, 2007 18:40

Postby jcfuller » Jan 22, 2010 20:49


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.
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

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests