YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

SQFish
MicioMax
#1 Posted : Sunday, November 19, 2017 12:12:56 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 9/16/2017(UTC)
Posts: 9

Thanks: 1 times
Was thanked: 0 time(s) in 0 post(s)
SQFish is another binding engine which I'm developing, aiming to be less ram-hungry than sqrat.
It's still work in progress, by now it can:

Bind tables, classes, variables and constants
Bind member and global functions to classes
Allow both default constructor or more constructors, with different parameters
Allow overloaded functions, also with same number of parameters but different signature

Here a sample binding of some variables, constants and a class with a global and member function:

Code:

SQUIRREL_API SQInteger registerTestLib(HSQUIRRELVM v)
{
    // some values in root table
    RootTable(v)
        .Var("cucu", 10)
        .Var("coco", M_PI)
        .Var("atable", "test for slot overwrite")
        .Func<const char *, const char *>("pippo", pippo)
        .Func<const char *, const char *, const char *>("pippo", pippo)
        .Func<const char *, int, int>("pluto", pluto)
        .Func<const char *, float, float>("pluto", pluto)
        .Func<const char *, int, float>("pluto", pluto)
        .Func("gigi", gigi)
        .Func<int, int>("fact", fact)
        .Func<float, float>("fact", fact)
    ;
    
    // some values in const table
    ConstTable(v)
        .Var("ACONSTANT", 99.999)
        .Var("ANOTHER_CONST", "this is a string constant");
    ;
    
    // nested tables test
    Table("atable", v)
        .Var("aval", "7777")
        .Var("aval2", 8888)
        .Func<const char *, const char *>("pippo", pippo)
        .Table("another")
            .Var("otherval", "myval")
            .Func<int, int>("fact", fact)
            .Table("onemore")
                .Var("lastval", "that's all folks...")
                .Func<float, float>("fact", fact)
                --
            --
        .Class<TestClass>("TestClass")
    ;

    Class<TestClass>("TestClass", v)
        .Constructor<>()
        .Constructor<int>()
        .Func<const char *, const char *>("pippo", pippo)
        .Func("afunc", &TestClass::aFunc)
    ;


    return 1;
}


As you can see, it's quite easy to bind stuffs in nested tables.
When almost ready I'll post on Github along with a modified squirrel version (some RAM optimizations for microcontrollers)

Ciao

Max
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.061 seconds.