freebasic.net Forum Index
FreeBASIC's Official Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log inLog in

Is FreeBasic still continued to develop?
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
 
Post new topic   Reply to topic    freebasic.net Forum Index -> Community Discussion
View previous topic :: View next topic  
Author Message
Landeel

PostPosted: Jan 19, 2010 20:01    Post subject: Reply with quote

This is great news!!! Thanks v1ctor!!! You're the best!!!
 
Back to top
View user's profile Visit poster's website
John Spikowski
Sr. Member
PostPosted: Jan 19, 2010 21:49    Post subject: Reply with quote

Welcome FreeBASIC to the Basic to C club.

Current Members:

BCX
BaCon
 
Back to top
View user's profile Send e-mail Visit poster's website
v1ctor
Site Admin
PostPosted: Jan 20, 2010 2:33    Post subject: Reply with quote

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.
 
Back to top
View user's profile Visit poster's website MSN Messenger
John Spikowski
Sr. Member
PostPosted: Jan 20, 2010 3:14    Post subject: Reply with quote

Quote:
not a single C header is ever included


Can C headers be included to add other libraries like Gtk, cURL, ...?
 
Back to top
View user's profile Send e-mail Visit poster's website
v1ctor
Site Admin
PostPosted: Jan 20, 2010 3:27    Post subject: Reply with quote

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.
 
Back to top
View user's profile Visit poster's website MSN Messenger
Dr_D
Hero
PostPosted: Jan 20, 2010 3:34    Post subject: Reply with quote

long live fb!
 
Back to top
View user's profile Visit poster's website
joseywales72

PostPosted: Jan 20, 2010 7:47    Post subject: Reply with quote

Great news.... Thank you Victor and all the devs.
 
Back to top
View user's profile
HD_

PostPosted: Jan 20, 2010 8:22    Post subject: Reply with quote

I love you v1ctor :D
 
Back to top
View user's profile
fsw

PostPosted: Jan 20, 2010 18:25    Post subject: Reply with quote

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!
 
Back to top
View user's profile
SARG

PostPosted: Jan 20, 2010 22:13    Post subject: Reply with quote

@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.
 
Back to top
View user's profile
v1ctor
Site Admin
PostPosted: Jan 20, 2010 23:10    Post subject: Reply with quote

Like this:

Code:

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


Becomes:

Code:

        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.
 
Back to top
View user's profile Visit poster's website MSN Messenger
D.J.Peters
Guru
PostPosted: Jan 21, 2010 6:59    Post subject: Joshy versus GCC :lol: Reply with quote

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

FB versus GCC :lol:
Code:
' 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

 
 
Back to top
View user's profile Visit poster's website
marcov
Sr. Member
PostPosted: Jan 21, 2010 17:26    Post subject: Reply with quote

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?
 
Back to top
View user's profile Visit poster's website
v1ctor
Site Admin
PostPosted: Jan 22, 2010 16:17    Post subject: Reply with quote

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 ;).
 
Back to top
View user's profile Visit poster's website MSN Messenger
jcfuller

PostPosted: Jan 22, 2010 20:49    Post subject: Reply with quote

Quote:


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
 
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    freebasic.net Forum Index -> Community Discussion All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9, 10  Next
Page 3 of 10

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



sf.net phatcode