relsoft
|
 |
« Reply #30 on: October 28, 2004, 09:51:54 AM » |
|
Women? :*) 
|
|
|
Logged
|
|
|
|
Jofers
|
 |
« Reply #31 on: October 28, 2004, 10:24:21 AM » |
|
Nah, they don't exist here. But much in the same manner as a nagging women, schoolwork and social responsibilities never end  .
|
|
|
Logged
|
|
|
|
Neo
|
 |
« Reply #32 on: October 28, 2004, 12:09:36 PM » |
|
a = b + c b = a - d c = a d = b If you change b, then c <> a (because c = b + c). 
|
|
|
Logged
|
|
|
|
Blitz
|
 |
« Reply #33 on: October 28, 2004, 12:17:14 PM » |
|
My fault, i wrote the code wrong.
|
|
|
Logged
|
oship me and i will give you lots of guurrls and beeea
|
|
|
Neo
|
 |
« Reply #34 on: October 28, 2004, 12:20:03 PM » |
|
No problem, I know what the idea behind it is.  I just had to point out that mistake, sorry.
|
|
|
Logged
|
|
|
|
v3cz0r
|
 |
« Reply #35 on: October 28, 2004, 06:38:14 PM » |
|
And heres my simple question... Will the compiled exes be faster than they are currently? When the DAG module begins to be used (only after the compiler compiles itself), any common sub-expression will be eliminated inside a basic block, for example, there are loads of reloads when accessing arrays, that is easily "detected" when using Graphs to link the nodes. But FB is not an optimizing compiler, speed will be enough to beat other BASIC commercial compilers like PB - that is the BASIC compiler that gens the best code (and i checked ALL them, believe me), but PB doesn't seem to do any kind of expression optimization, it does a bunch of hacks that are completely non-portable.. no wonder PB is just for Windows. Anyways v1c im impressed with the code output for the math, very nice. There are some simple optimizations to be added before the 1st release, like converting muls by power of 2 immediates to shifts, load after store and such.. i didn't add that yet as i was getting functions/subs to work in the last days and that took me a lot of time. Hey, GNU can do Intel syntax? So I could use intel syntax in mingw? Hmm, i really don't know, GCC will optimize even the inline asm block (saving or not the registers, etc), dunno if it's not dependent of AT&T syntax.. or you would have to switch back the syntax when closing the inline block, using the .att_syntax directive. And DJGPP aint that fast in zooming the mendel!!! Heh, not that much, GCC is awesome doing optimizations, even DJGPP using an outdated version, i guess.. bad thing about DJ is that it's does not run in flat-mode, segment overriding kills the performance on modern CPUs. If you'd ever like to discuss language or compiler issues I'd be glad to chat. Sure, when the first release gets done it will be fully open-source, any contributions will be welcome. I started this project coz i was tired of seeing each year new problems appearing when trying to code anything in QB.. bad DOS emulation, hardware less and less backward compatible and so on - i guess the next release of Windows will be even less suitable for DOS coding, but i don't blame M$.. more than a decade is over, ow.. I waited for somebody to make a free and *really* QB-compatible compiler, but as that didn't happen i thought.. hell, lets try it myself, heh.. i didn't think it would be at this stage so early, lets hope it will continue this way until the first public release. And about the name.. call it just "FB", acronyms can be anything you want ;).
|
|
|
Logged
|
|
|
|
relsoft
|
 |
« Reply #36 on: October 29, 2004, 01:34:27 AM » |
|
Pete: FB express. :*)
|
|
|
Logged
|
|
|
|
Blitz
|
 |
« Reply #37 on: October 29, 2004, 10:07:57 PM » |
|
Check this out, simple gui program with freebasic. It took us a long time to get it to work becuase we both suck at gui coding and v1ctor thought it was the compiler that was messing up. Turns out it wasn't. Sure, looks messy. Windows guis are messy. But look at the same code in C, it's even worse. Anyways, if you really look at it carefully it's not that bad. http://freebasic.bad-logic.com/downloads/winhello.zip'' '' winhello.bas - Windows Gui example with freebasic '' '' defint a-z option explicit option private
'$include:'kernel32.bi' '$include:'user32.bi' '$include:'gdi32.bi'
const null = 0 const true = -1 const false = 0
declare function WinMain ( byval hInstance as long, _ byval hPrevInstance as long, _ szCmdLine as string, _ byval iCmdShow as integer ) as integer
dim res as integer
'' '' Entry point '' res = WinMain( GetModuleHandle( null ), null, command$, SW_NORMAL ) end res
'' :::::::: '' name: WndProc '' desc: Processes windows messages '' '' :::::::: defint a-z function WndProc ( byval hWnd as long, _ byval message as long, _ byval wParam as long, _ byval lParam as long ) as integer dim rct as RECT dim pnt as PAINTSTRUCT dim hDC as long WndProc = 0 '' '' Process message '' select case ( message ) case WM_CREATE exit function '' '' Windows is being repainted '' case WM_PAINT hDC = BeginPaint( hWnd, pnt ) GetClientRect hWnd, rct DrawText hDC,"Hello Windows from FreeBasic!", -1, _ rct, DT_SINGLELINE or DT_CENTER or DT_VCENTER EndPaint hWnd, pnt exit function '' '' Window was closed '' case WM_DESTROY PostQuitMessage 0 exit function end select '' '' Message doesn't concern us, send it to the default handler '' and get result '' WndProc = DefWindowProc( hWnd, message, wParam, lParam ) end function
'' :::::::: '' name: WinMain '' desc: A win2 gui program entry point '' '' :::::::: defint a-z function WinMain ( byval hInstance as long, _ byval hPrevInstance as long, _ szCmdLine as string, _ byval iCmdShow as integer ) as integer dim wMsg as MSG dim wcls as WNDCLASS dim szAppName as string dim hWnd as long
WinMain = 0 '' '' Setup window class '' szAppName = "HelloWin" wcls.style = CS_HREDRAW or CS_VREDRAW wcls.lpfnWndProc = procptr( WndProc() ) wcls.cbClsExtra = 0 wcls.cbWndExtra = 0 wcls.hInstance = hInstance wcls.hIcon = LoadIcon( null, IDI_APPLICATION ) wcls.hCursor = LoadCursor( null, IDC_ARROW ) wcls.hbrBackground = GetStockObject( WHITE_BRUSH ) wcls.lpszMenuName = null wcls.lpszClassName = sadd( szAppName ) '' '' Register the window class '' if ( RegisterClass( wcls ) = false ) then MessageBox null, "This program requires Windows NT!", szAppName, MB_ICONERROR exit function end if
'' '' Create the window and show it '' hWnd = CreateWindowEx( 0, _ szAppName, _ "The Hello Program", _ WS_OVERLAPPEDWINDOW, _ CW_USEDEFAULT, _ CW_USEDEFAULT, _ CW_USEDEFAULT, _ CW_USEDEFAULT, _ null, _ null, _ hInstance, _ null )
ShowWindow hWnd, iCmdShow UpdateWindow hWnd
'' '' Process windows messages '' while ( GetMessage( wMsg, null, 0, 0 ) <> false ) TranslateMessage wMsg DispatchMessage wMsg wend '' '' Program has ended '' WinMain = wMsg.wParam
end function
|
|
|
Logged
|
oship me and i will give you lots of guurrls and beeea
|
|
|
relsoft
|
 |
« Reply #38 on: October 30, 2004, 01:07:26 AM » |
|
Man we need templates for FB. So I would assume you can do something like this? pixelWidth=surface.ddpfPixelFormat.dwRGBBitCount\8 offset= x*pixelWidth + y*surface.lPitch Poke(((BYTE *)surface.lpSurface)+offset, &colour, pixelWidth) Woot!!! DX here I come!!!!
|
|
|
Logged
|
|
|
|
VonGodric
|
 |
« Reply #39 on: October 30, 2004, 07:09:43 AM » |
|
It's nice. Have a question though, will there be FB version for dos too? That would be awesome
|
|
|
Logged
|
url]http://fbide.sourceforge.net/[/url]
|
|
|
Blitz
|
 |
« Reply #40 on: October 30, 2004, 07:44:27 AM » |
|
Why use poke when you have real pointers? FB already has real pointers, C style.  I don't think v1ctor will ever release a FB for dos. But since it's open source anyone can do that. It's just a matter of coding a runtime lib for dos. Shouldn't be anymore to it i think.
|
|
|
Logged
|
oship me and i will give you lots of guurrls and beeea
|
|
|
Blitz
|
 |
« Reply #41 on: October 30, 2004, 08:59:51 AM » |
|
Linked list example with pointers defint a-z '$include: 'user32.bi'
const MAXNODES = 10 const NULL = 0
type TNODE id as short prv as TNODE ptr nxt as TNODE ptr end type
type TLIST head as TNODE ptr tail as TNODE ptr end type
dim list as TLIST dim nodeTB(0 to MAXNODES-1) as TNODE dim p as TNODE ptr '' init list list.head = varptr( nodeTB(0) ) list.tail = varptr( nodeTB(MAXNODES-1) ) p = NULL for i = 0 to (MAXNODES-1)-1 nodeTB(i).id = i nodeTB(i).prv = p nodeTB(i).nxt = varptr( nodeTB(i+1) ) p = varptr( nodeTB(i) ) next i nodeTB(MAXNODES-1).id = MAXNODES-1 nodeTB(MAXNODES-1).prv = p nodeTB(MAXNODES-1).nxt = NULL '' test it dim res as string p = list.head do while( p <> NULL ) res = res + str$( p->id ) p = p->nxt loop MessageBox 0, res, "Result", MB_ICONASTERISK
|
|
|
Logged
|
oship me and i will give you lots of guurrls and beeea
|
|
|
adosorken
|
 |
« Reply #42 on: October 30, 2004, 10:51:49 AM » |
|
With Windows XP now being the dominant OS and having mediocre-at-best support for DOS, I think the smart thing to do would be to abandon the old DOS-based QB and take up something like this instead. If its syntactic compatability is 100% on-par with QB, then there's no need to suffer with DOS anymore. If it were 5 years ago, I'd say great, do a DOS version as well, but as Microsoft is seeking to suffocate all DOS users, it's wiser to adapt to the changing times. I was hoping to have OBDS out by this time of the year, but oh well. :-?
|
|
|
Logged
|
I'd knock on wood, but my desk is particle board.
|
|
|
barok
|
 |
« Reply #43 on: October 30, 2004, 02:59:01 PM » |
|
Like Adosorken said: If you can't beat'em, join'em. All i want is it to be 100% compatible with qb syntax. If that's done i'll be very happy.
|
|
|
Logged
|
Jumping Jahoolipers!
|
|
|
Blitz
|
 |
« Reply #44 on: October 31, 2004, 12:41:25 AM » |
|
Another freebasic example, this time a simple opengl application. For anyone who might be interested. http://freebasic.bad-logic.com/downloads/gltest.zip'' '' gltest.bas - Freebasic opengl example, uses glut for simplicity '' '' defint a-z option explicit
'$include: 'gl.bi' '$include: 'glu.bi' '$include: 'glut.bi'
declare sub doMain ( )
'' '' Entry point '' doMain
'' :::::::::::: '' name: doRender '' desc: Is called by glut to render scene. cdecl is used becuase glut '' callbacks expect the cdecl calling convention '' '' :::::::::::: defint a-z sub doRender cdecl static rtri as single static rqud as single glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT glPushMatrix glLoadIdentity glTranslatef -1.5, 0.0, -6.0 glRotatef rtri, 0.0, 1.0, 0.0 glBegin GL_TRIANGLES glColor3f 1.0, 0.0, 0.0 glVertex3f 0.0, 1.0, 0.0 glColor3f 0.0, 1.0, 0.0 glVertex3f -1.0,-1.0, 1.0 glColor3f 0.0, 0.0, 1.0 glVertex3f 1.0,-1.0, 1.0 glColor3f 1.0, 0.0, 0.0 glVertex3f 0.0, 1.0, 0.0 glColor3f 0.0, 0.0, 1.0 glVertex3f 1.0,-1.0, 1.0 glColor3f 0.0, 1.0, 0.0 glVertex3f 1.0,-1.0,-1.0 glColor3f 1.0, 0.0, 0.0 glVertex3f 0.0, 1.0, 0.0 glColor3f 0.0, 1.0, 0.0 glVertex3f 1.0,-1.0,-1.0 glColor3f 0.0, 0.0, 1.0 glVertex3f -1.0,-1.0,-1.0 glColor3f 1.0, 0.0, 0.0 glVertex3f 0.0, 1.0, 0.0 glColor3f 0.0, 0.0, 1.0 glVertex3f -1.0,-1.0,-1.0 glColor3f 0.0, 1.0, 0.0 glVertex3f -1.0,-1.0, 1.0 glEnd glColor3f 0.5, 0.5, 1.0 glLoadIdentity glTranslatef -1.5, 0.0, -6.0 glTranslatef 3.0,0.0,0.0 glRotatef rqud, 1.0, 0.0, 0.0 glBegin GL_QUADS glVertex3f -1.0, 1.0, 0.0 glVertex3f 1.0, 1.0, 0.0 glVertex3f 1.0,-1.0, 0.0 glVertex3f -1.0,-1.0, 0.0 glEnd
glPopMatrix glutSwapBuffers rtri = rtri + 2.0 rqud = rqud + 1.5 end sub
'' :::::::::::: '' name: doInput '' desc: Handles input. cdecl is used becuase glut callbacks expect the '' cdecl calling convention '' '' :::::::::::: defint a-z sub doInput cdecl ( byval kbcode as unsigned byte, _ byval mousex as integer, _ byval mousey as integer ) if ( kbcode = 27 ) then end 0 end if
end sub
'' :::::::::::: '' name: doInitGL '' desc: Inits OpenGL '' '' :::::::::::: defint a-z sub doInitGL '' '' Rendering stuff '' glShadeModel GL_SMOOTH glClearColor 0.0, 0.0, 0.0, 0.5 glClearDepth 1.0 glEnable GL_DEPTH_TEST glDepthFunc GL_LEQUAL glEnable GL_COLOR_MATERIAL glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
end sub
'' :::::::::::: '' name: doReshapeGL '' desc: Reshapes GL window. cdecl is used becuase glut callbacks expect ' the cdecl calling convention '' '' :::::::::::: defint a-z sub doReshapeGL cdecl ( byval w as integer, _ byval h as integer ) glViewport 0, 0, w, h glMatrixMode GL_PROJECTION glLoadIdentity if ( h = 0 ) then gluPerspective 80, w, 1.0, 5000.0 else gluPerspective 80, w / h , 1.0, 5000.0 end if glMatrixMode GL_MODELVIEW glLoadIdentity
end sub
'' :::::::::::: '' name: doMain '' desc: Main routine '' '' :::::::::::: defint a-z sub doMain '' '' Setup glut '' glutInit 1, sadd( " " ) glutInitWindowPosition 0, 0 glutInitWindowSize 640, 480 glutInitDisplayMode GLUT_RGBA or GLUT_DOUBLE or GLUT_DEPTH glutCreateWindow "Freebasic <3 OpenGL" doInitGL glutDisplayFunc procptr( doRender ) glutIdleFunc procptr( doRender ) glutReshapeFunc procptr( doReshapeGL ) glutKeyboardFunc procptr( doInput ) glutMainLoop end sub
|
|
|
Logged
|
oship me and i will give you lots of guurrls and beeea
|
|
|
|