Qbasicnews.com
freeBASIC (a 32-bit QB-syntax compatible compiler) preview.. - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: General (http://qbasicnews.com/newforum/forum-6.html)
+--- Forum: General/Misc (http://qbasicnews.com/newforum/forum-18.html)
+--- Thread: freeBASIC (a 32-bit QB-syntax compatible compiler) preview.. (/thread-4948.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40


freeBASIC (a 32-bit QB-syntax compatible compiler) preview.. - Jofers - 11-06-2004

Well, it would pretty jerk to ask you to put in true java-like objects. Pretty badass as far as the pointers go (and props on translating varptr).

Okay, we'll leave the horse alone. That's kind of mean to the Jesus Crab, though:
[Image: icons3.gif]

But I'm serious about the documentation and/or website markup offer.


freeBASIC (a 32-bit QB-syntax compatible compiler) preview.. - Neo - 11-06-2004

Quote:Btw, do you know how to allocate the torus array inside a function? Like the load_torus func?

According to scorp, this small example should work:
Code:
#include <stdio.h>
#include <windows.h>  
  
void GetPtr(int *inp)                // this looks more like a constructor of a class :P
{  
    void *a=malloc(4*100);            // alloc some space .. for what ever
    for (int i=0;i<400;i++)
    {
        // do your MOJO..
        ((unsigned char*)a)[i]=rand()%0xFF;
        printf("%i",((unsigned char*)a)[i]);
    }

    // hack hack hack -- remember this is very wrong :P
    memcpy(inp,&a,4);
}  
  
void main (void)  
{  
    int        fakeptr;                // place to stash an adress to while the compiler isn't looking
    int*    anewptr;                // the actual pointer that will be used afterwards
    
    GetPtr(&fakeptr);                // a ~Ctor function on a struct ?!?!?!?!?!?!?? ( better use classes next time )
    memcpy(&anewptr,&fakeptr,4);    // copy the adress back into an actual pointer so it can be used as a pointer

    // \/ \/  further checkupsforscrewups :P
    if (IsBadReadPtr(anewptr, 4)) printf("\nfark\n");

    printf("\n",anewptr);

    for (int i=0;i<400;i++)
        printf("%i",((unsigned char*)anewptr)[i]);
    
    if (!IsBadReadPtr(anewptr, 4)) free(anewptr);  
    getchar();  
}



freeBASIC (a 32-bit QB-syntax compatible compiler) preview.. - marzecTM - 11-06-2004

ok,

i just finished to include the define value feature:

'$define A_DEFINE &Ha000

var = A_DEFINE * 324 + 7/A_DEFINE

that would translate into:

var = &Ha000 * 324 + 7/A_DEFINE

i don't know why this would be needed since fb offers the const statement... but oh well. there you have it

if someone encounters a bug or something, post here or on forum.bad-logic.com


freeBASIC (a 32-bit QB-syntax compatible compiler) preview.. - v3cz0r - 11-06-2004

Quote:i don't know why this would be needed since fb offers the const statement... but oh well. there you have it

Er, how about this:

'$define bar integer

dim foo as bar

That could be useful somehow ;)

You can't define types with Const's, that's a sad life's fact.


freeBASIC (a 32-bit QB-syntax compatible compiler) preview.. - relsoft - 11-06-2004

Andre(v1c): Defines would be cool. Macros too.

Neo: I figured the farmalloc allocation with structures with marzec's help. And I'll try to see if I coulf returns a stucture pointer from a fucnction in load_torus.

Let's discuss my probs on the gen. prog forum.


freeBASIC (a 32-bit QB-syntax compatible compiler) preview.. - VonGodric - 11-06-2004

Have a question, will FB support threads? It'be cool.


freeBASIC (a 32-bit QB-syntax compatible compiler) preview.. - ShadowWolf - 11-06-2004

Vongodric i guss it would it can handle Win32 API so registering a thred shoudn't be that.


freeBASIC (a 32-bit QB-syntax compatible compiler) preview.. - Blitz - 11-06-2004

Again, such things is os related.


freeBASIC (a 32-bit QB-syntax compatible compiler) preview.. - Z!re - 11-06-2004

Let's face it, FB would be for Windows and Linux, or you plan on anything else?

Both support threads, and it would really be cool to have threads to work with.



Also, how does memory work?, will i be able to create 16MB Arrays?, and/or will there be things like C's malloc()?


freeBASIC (a 32-bit QB-syntax compatible compiler) preview.. - v3cz0r - 11-06-2004

Threads would be simple to do in Windows, calling 2 or 3 kernel32 functions and it's done, as all subs/functions are STDCALL by default in FB and rt lib doesn't access global vars. Now for other OSes, i've never done that, other than fork() on Linux :P


You can allocate arrays up to 2GB, being them static or dynamic. Even if static, the .exe won't be great than a couple of KB's, as space for non-initialized vars is just reserved at compile-time and allocated by the OS when loading the executable.