Official repository for the programming language Squirrel

Overview
The programming language SQUIRREL 3.1 stable

--------------------------------------------------
This project has successfully been compiled and run on
 * Windows (x86 and amd64)
 * Linux (x86, amd64 and ARM)
 * Illumos (x86 and amd64)
 * FreeBSD (x86 and ARM)

The following compilers have been confirmed to be working:
    MS Visual C++  6.0 (all on x86 and amd64)
                   7.0   |
                   7.1   v
                   8.0
                   9.0
                  10.0
                  12.0  ---
    MinGW gcc 3.2 (mingw special 20020817-1)
    Cygnus gcc 3.2
    Linux gcc 3.2.3
              4.0.0 (x86 and amd64)
              5.3.1 (amd64)
    Illumos gcc 4.0.0 (x86 and amd64)
    ARM Linux gcc 4.6.3 (Raspberry Pi Model B)


Feedback and suggestions are appreciated
project page - http://www.squirrel-lang.org
community forums - http://forum.squirrel-lang.org
wiki - http://wiki.squirrel-lang.org
author - [email protected]

END OF README
Comments
  • Various improvements of the build system

    Various improvements of the build system

    • I rewrote the CMake files so that they work under Windows using Visual Studio. I also improved their Linux behavior. My files are confirmed to work with MSVC12 (Windows), gcc5.3 and ARMgcc4.6 (both Linux, see README). Under Windows, you need the quite recent version 3.4 of CMake to build the shared libraries, though, because Squirrel does not export any DLL symbols by default, and the CMake option to export everything into the DLL has just been adopted into v3.4. As long as you don't use MSVC, it only asks for CMake v2.8.
    • I tested Squirrel on a few more platforms and added them to the README. Most notably, I confirmed that Squirrel can run on ARM.
    • I fixed every warning gcc 5.3.1 generates if the flags -Wall and -Wextra are specified. It now compiles cleanly on my system (amd64).
    opened by FabianWolff 15
  • Pointer overflow in SQVM::IsFalse() function

    Pointer overflow in SQVM::IsFalse() function

    Sometimes SQVM::IsFalse() hangs our app and when I print the content of &o it returns 0xFFFFFFFFFFFFFF0 Seems like a pointer overflow to me. It's completely random, and only happens when the application starts. it crashes in 20% of cases, sometimes more often.

    opened by oomek 14
  • Unexpected closure error

    Unexpected closure error

    Hello ! I'm converting tests from lua 5.1 ( http://www.inf.puc-rio.br/~roberto/lua/lua5.1-tests.tar.gz ) to SquiLu/Squirrel and found several unexpected errors. Like this one for closures:

    print( "testing closures and coroutines\n" )
    
    // testing closures with 'for' control variable
    local a = []
    for(local i=0; i < 10; ++i)
    {
      a.append({set = function(x){ i=x; }, get = function (){ return i; }})
      if( i == 2 ) break;
    }
    assert(a.len() == 3)
    //code to debug start
    a[0].set(10)
    print("get")
    print(a[0].get)
    print("\n")
    print("get")
    print(a[0].get())
    print("\n")
    print("get")
    print(a[1].get())
    print("\n")
    print("get")
    print(a[1].get)
    print("\n")
    print("get")
    print(a[2].get())
    print("\n")
    print("get")
    print(a[2].get)
    print("\n")
    //code to debug end
    assert(a[1].get() == 1)
    a[1].set('a')
    assert(a[2].get() == 2)
    assert(a[1].get() == 'a')
    
    

    Result:

    testing closures and coroutines
    get(function : 0x0x9cfd50)
    get(function : 0x0x9c5e50)
    get(function : 0x0x9c5e50)
    get(function : 0x0x9d0c30)
    get(function : 0x0x9c5e50)
    get(function : 0x0x9ce060)
    
    AN ERROR HAS OCCURRED [assertion failed]
    
    CALLSTACK
    *FUNCTION [main()] closure.nut line [32]
    
    LOCALS
    [a] ARRAY
    [vargv] ARRAY
    [this] TABLE
    

    Here is the original lua 5.1 code (that works):

    -- testing closures with 'for' control variable
    a = {}
    for i=1,10 do
      a[i] = {set = function(x) i=x end, get = function () return i end}
      if i == 3 then break end
    end
    assert(a[4] == nil)
    a[1].set(10)
    assert(a[2].get() == 2)
    a[2].set('a')
    assert(a[3].get() == 3)
    assert(a[2].get() == 'a')
    

    Here is another simple variation that also fails:

    // testing closures with 'for' control variable x break
    
    local f
    
    for(local i=1; i <= 3; ++i)
    {
      f = function () { return i;}
      break
    }
    assert(f() == 1)
    

    Output:

    AN ERROR HAS OCCURRED [assertion failed]
    
    CALLSTACK
    *FUNCTION [main()] closure.nut line [10]
    
    LOCALS
    [f] CLOSURE
    [vargv] ARRAY
    [this] TABLE
    
    opened by mingodad 14
  • Introduce null-coalescing and null propagation operators

    Introduce null-coalescing and null propagation operators

    Add new operator ?? such that a ?? b works as (a!=null) ? a : b

    C#-like ?? syntax was chosen over Elvis operator ?: which is common in other languages because it is not equivalent to visually similar ternary ? : operator (which checks for falsiness, not null).

    It evaluates expressions until the first non-null value (just like || operators for the first 'true' one)

    Operator precendence is also follows C# design, so that ?? has lower priority than ||

    Null propagation operators ?. and ?[] are similar to ones in C# 6.0 or Kotlin

    local tbl = {bar=123}
    tbl.bar     // returns 123
    tbl.baz     // throws an error
    tbl?.bar    // returns 123
    tbl?.baz    // returns null
    null.bar    // throws an error
    null?.bar   // returns null
    tbl?["bar"] // returns 123
    tbl?[4567]  // returns null
    

    This works for any type (internally done via SQVM::Get(), like an 'in' operator), including null.

    This adds new opcodes: _OP_NULLGET and _OP_NULLCOALESCE.

    opened by VasiliyRyabtsev 10
  • Strange crash when exporting subtable

    Strange crash when exporting subtable

    I embedded Squirrel interpreter in my C application and I try to export to Squirrel a table (named KSR) with functions, some of them grouped in subtables, so in Squirrel should be like:

    KSR = {
      f1 = fp1,
      f2 = fp2,
      m1 = {
        f3 = fp3,
        f4 = fp4,
      },
      m2 = {
        f5 = fp5,
        f6 = fp6,
      },
      m3 = ...
    }
    

    I got a crash that I couldn't find a reason for it, which happens when exporting a subtable (like m1 or m2).

    Let's say exporting m2 is causing the crash, the odd things:

    • I use same code to export each of the subtables
    • if m2 is exported, but more at the beginning, it is not crashing. When it crashes is like the 20th exported subtable, if it is among the firsts, then no crash.

    It looks like the crash happens when there is a collision on the table hash slot, but wonder why is not happening when m2 is loaded earlier, maybe someone can spot faster where the issue resides -- the backtrace from gdb is:

    #0  0x00007f198411f067 in __GI_raise ([email protected]=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
    #1  0x00007f1984120448 in __GI_abort () at abort.c:89
    #2  0x00007f1984118266 in __assert_fail_base (fmt=0x7f1984250f18 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
        [email protected]=0x7f197e4a3ef9 "othern->next != __null", [email protected]=0x7f197e4a3ed4 "sqtable.cpp", 
        [email protected]=143, 
        [email protected]=0x7f197e4a3f20 <SQTable::NewSlot(SQObjectPtr const&, SQObjectPtr const&)::__PRETTY_FUNCTION__> "bool SQTable::NewSlot(const SQObjectPtr&, const SQObjectPtr&)") at assert.c:92
    #3  0x00007f1984118312 in __GI___assert_fail (assertion=0x7f197e4a3ef9 "othern->next != __null", 
        file=0x7f197e4a3ed4 "sqtable.cpp", line=143, 
        function=0x7f197e4a3f20 <SQTable::NewSlot(SQObjectPtr const&, SQObjectPtr const&)::__PRETTY_FUNCTION__> "bool SQTable::NewSlot(const SQObjectPtr&, const SQObjectPtr&)") at assert.c:101
    #4  0x00007f197e485041 in SQTable::NewSlot (this=0x14137e0, key=..., val=...) at sqtable.cpp:143
    #5  0x00007f197e48e91b in SQVM::NewSlot ([email protected]=0x13fc7f0, self=..., key=..., val=..., bstatic=<optimized out>)
        at sqvm.cpp:1461
    #6  0x00007f197e463934 in sq_newslot (v=0x13fc7f0, idx=<optimized out>, bstatic=0) at sqapi.cpp:860
    

    Squirrel version is 3.1 downloaded from sourceforge. Tested on Debian Jessie, Squirrel compiled with extra flags -g -fPIC (for debugging symbols and to allow linking with a shared object).

    opened by miconda 10
  • How hard to add

    How hard to add "include" to the compiler ?

    Hello ! How hard it'll be to add "include" capability in the compiler ? I did a look at it, but it was clear to me where the better place to change the code.

    Would be nice to have a standard way to use several scripts with something like "require" in lua.

    I did a script to mimic "require" from lua (but it need to be loaded first):

    local globals = getroottable();
    globals.rawset("SQ_LIB", os.getenv("SQ_LIB"));
    //SQ_LIB <- os.getenv("SQ_LIB");
    //print("Preload", SQ_LIB);
    
    function sq_require(fn, env=globals)
    {
        if(!env) env = globals;
        env.dofile(format("%s/%s", SQ_LIB, fn));
    }
    

    I also did a change to sq.c to allow preload a script:

    void PrintUsage()
    {
        scfprintf(stderr,_SC("usage: sq <options> <scriptpath [args]>.\n")
            _SC("Available options are:\n")
            _SC("   -s              compiles the file to bytecode(default output 'out.cnut')\n")
            _SC("   -o              specifies output file for the -c option\n")
            _SC("   -c              compiles only\n")
            _SC("   -d              generates debug infos\n")
            _SC("   -v              displays version infos\n")
            _SC("   -p              preload given script file\n")
            _SC("   -h              prints help\n"));
    }
    
    void loadDefaultScript(HSQUIRRELVM v, const char *script)
    {
        FILE *fb = fopen(script, "rb");
        if (!fb) return;
        fclose(fb);
    
        SQChar srcBoot[256];
        scsnprintf(srcBoot, sizeof(srcBoot), _SC("dofile(\"%s\", false);"), script);
    
        if(SQ_SUCCEEDED(sq_compilebuffer(v,srcBoot, strlen(srcBoot), _SC("defaultScript"), SQTrue, SQTrue))) {
            int callargs = 1;
            sq_pushroottable(v);
            callargs += push_program_args(v, 0, sq_main_argc, sq_main_argv);
            sq_call(v, callargs,SQFalse, SQTrue);
        }
    }
    
    int getargs(HSQUIRRELVM v,int argc, char* argv[],SQInteger *retval)
    {
    ...
                    case 'p':
                        if(arg < argc) {
                            arg++;
                            preload = argv[arg];
                            loadDefaultScript(v, preload);
                        }
                        break;
                    case 'v':
    
    

    But it would be better to have it builtin in the compiler/language itself.

    This repository implemented "import" and dynamic loading https://github.com/pfalcon/squirrel-lang . Why not have it on squirrel ? Cheers !

    opened by mingodad 10
  • Update of sqstdlib

    Update of sqstdlib

    Hello,

    There is my proposal to update sqstdlib. Documentation is updated also.

    API changes:

    • SQFILE now represents a SQSTREAM to file, not FILE*. SQFILE is created by sqstd_fopen() and is released by sqstd_fclose(). Functions sqstd_createfile() and sqstd_getfile() still use FILE*. Two new functions sqstd_createsqfile() and sqstd_getsqfile() to create/get SQFILE object to/from instance of file class.

    • SQSTREAM is base clas of blob, file, streamreader, textreader and textwriter. SQSTREAM adds new API functions: sqstd_sread, sqstd_swrite, sqstd_sseek, sqstd_stell, sqstd_sflush, sqstd_seof, sqstd_sclose and sqstd_srelease.

    • Two more methods are added to SQStream to help generalization of stream: Close and _Release. Method _Release is called by sqstd_srelease() and by stream release hooh.

    • The pointer to SQRegClass structure is used as type tag.

    API added:

    • Three function are added to iteract with streams - sqstd_loadstream, sqstd_compilestream, sqstd_readclosurestream and sqstd_writeclosuretostream.

    • New SQTStreamReader is implemented based on SQStream. Stream reader gives ability to virtualy 'mark' and 'reset' position of readed SQStream. Functions added: sqstd_streamreader, sqstd_srdrmark, sqstd_srdrreset

    • Text reader/writter based on SQStream with support for ASCII, UTF-8, UTF-16BE, UTF-16LE. Two functions to create streams sqstd_textreader and sqstd_textwriter.

    • Declaration helpers: sqstd_registerclass, sqstd_registermembers and sqstd_registerfunctions. Also structures to describe class/members declarations - SQRegMember and SQRegClass.

    From scripting side:

    • Added loadstream, dostream and writeclosuretostream.
    • 'stream' class has two new methods - print and readline
    • Added 'streamreader' calss.
    • Added 'textreader' and 'textwriter' calss.
    opened by atanasovdaniel 9
  • feature: light explicit

    feature: light explicit "thiscall"

    In my servers I make heavy use of coroutines, occasionally I need to invoke a function forcing a specific "this". Currently the options are:

    function doSomething(a,b,c,d) 
    {
    ... something here
    }
    
    // existing option 1
    // requires to clone the closure(it's good for stuff like UI callbacks etc) 
    // more expensive in terms of memory compared to vanilla closure
    
    local _mydosomething = dosomething.bindenv(mythis);
    _mydosomething(1,2,3,4);
    
    // existing option 2
    // this inject a "C" stack frame, prevents "susepends" and is less efficient than option 1
    
    doSomething.call(mythis,1,2,3,4)
    

    I was thinking of adding a new built in syntax that allows to preform a "raw call" what specifies the "this". It doesn't require any change in the VM; just compiler work, so It easy enough.

    something like:

    // idea 1
    // add special character($ is ugly but most characters are already taken)
    doSomething$(mythis,1,2,3,4)
    
    // idea 2
    // or add new keyword "thiscall"
    thiscall(doSomething,mythis,1,2,3,4);
    
    

    any better option regarding syntax? any thought?

    opened by albertodemichelis 9
  • Class declaration do not check for duplicates

    Class declaration do not check for duplicates

    Hello ! Squirrel do not check for duplicates in class declarations see example bellow that compiles without errors:

    class K
    {
        v1 = 0;
        v1 = 0;
        v2 = 0;
    
        function f1(){}
        function f1(){}
    }
    
    opened by mingodad 9
  • Weakref question ?

    Weakref question ?

    Hello ! I we insert a weakref on the registry table it's removed automatically when the object is released ? Example:

    static SQRESULT sq_obj_releasehook(SQUserPointer p, SQInteger size)
    {
        if(p)
        {
                sq_free(p, size); //no need to do anything with registrytable ?
        }
        return 0;
    }
    
    static SQRESULT sq_obj_constructor(HSQUIRRELVM v)
    {
        void *obj = sq_malloc(sizeof(obj_size));
        memset(obj, 0, sizeof(obj_size));
        //setup obj
       ...
        sq_setinstanceup(v, 1, obj);
        sq_setreleasehook(v,1, sq_obj_releasehook);
    
        //save a weakref to allow statement return it's db
        sq_pushstring(v, _SC("obj_key") );
        sq_weakref(v, 1);
        sq_setonregistrytable(v);
        return 1;
    }
    

    Cheers !

    opened by mingodad 8
  • Failed to compile in macOS Sierra 10.12.4 and later...

    Failed to compile in macOS Sierra 10.12.4 and later...

    Problem

    Can't compile on macOS Sierra 10.12.4 and later using Xcode's Toolchain

    Build Enviroment

    My main build enviroment is as of now beta version of macOS High Sierra 10.13 Beta 2: OS: macOS High Sierra 10.13 Beta 2 (17A291m) Xcode: 9.0 Beta 2 (9M137d) Clang:

    MacBook-Pro:build user$ clang --version
    Apple LLVM version 9.0.0 (clang-900.0.26)
    Target: x86_64-apple-darwin17.0.0
    Thread model: posix
    InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    

    It doesn't worked in stable macOS 10.12.4 too...

    Related

    This issue is pretty same as mine: https://github.com/JGRennison/OpenTTD-patches/issues/17

    Console output

    MacBook-Pro:squirrel_source user$ mkdir build
    MacBook-Pro:squirrel_source user$ cd build
    MacBook-Pro:build user$ pwd
    /Users/user/sources/squirrel/build
    MacBook-Pro:build user$ cmake ..
    -- The C compiler identification is AppleClang 9.0.0.9000026
    -- The CXX compiler identification is AppleClang 9.0.0.9000026
    -- Check for working C compiler: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
    -- Check for working C compiler: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
    -- Check for working CXX compiler: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Configuring done
    CMake Warning (dev):
      Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
      --help-policy CMP0042" for policy details.  Use the cmake_policy command to
      set the policy and suppress this warning.
    
      MACOSX_RPATH is not specified for the following targets:
    
       sqstdlib
       squirrel
    
    This warning is for project developers.  Use -Wno-dev to suppress it.
    
    -- Generating done
    -- Build files have been written to: /Users/user/sources/squirrel/build
    MacBook-Pro:build user$ make
    Scanning dependencies of target squirrel_static
    [  2%] Building CXX object squirrel/CMakeFiles/squirrel_static.dir/sqapi.cpp.o
    [  4%] Building CXX object squirrel/CMakeFiles/squirrel_static.dir/sqbaselib.cpp.o
    [  6%] Building CXX object squirrel/CMakeFiles/squirrel_static.dir/sqclass.cpp.o
    [  8%] Building CXX object squirrel/CMakeFiles/squirrel_static.dir/sqcompiler.cpp.o
    [ 10%] Building CXX object squirrel/CMakeFiles/squirrel_static.dir/sqdebug.cpp.o
    [ 12%] Building CXX object squirrel/CMakeFiles/squirrel_static.dir/sqfuncstate.cpp.o
    [ 14%] Building CXX object squirrel/CMakeFiles/squirrel_static.dir/sqlexer.cpp.o
    [ 16%] Building CXX object squirrel/CMakeFiles/squirrel_static.dir/sqmem.cpp.o
    [ 18%] Building CXX object squirrel/CMakeFiles/squirrel_static.dir/sqobject.cpp.o
    [ 20%] Building CXX object squirrel/CMakeFiles/squirrel_static.dir/sqstate.cpp.o
    [ 22%] Building CXX object squirrel/CMakeFiles/squirrel_static.dir/sqtable.cpp.o
    [ 25%] Building CXX object squirrel/CMakeFiles/squirrel_static.dir/sqvm.cpp.o
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:147:85: error: expected expression
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type min() _NOEXCEPT {return type();}
                                                                                        ^
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:24: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                           ^
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:148:85: error: expected expression
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type max() _NOEXCEPT {return type();}
                                                                                        ^
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:24: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                           ^
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:149:88: error: expected expression
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT {return type();}
                                                                                           ^
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:24: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                           ^
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:158:89: error: expected expression
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type();}
                                                                                            ^
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:24: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                           ^
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:159:93: error: expected expression
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type();}
                                                                                                ^
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:24: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                           ^
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:171:90: error: expected expression
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type();}
                                                                                             ^
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:24: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                           ^
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:172:91: error: expected expression
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type();}
                                                                                              ^
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:24: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                           ^
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:173:95: error: expected expression
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type();}
                                                                                                  ^
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:24: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                           ^
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:174:92: error: expected expression
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type();}
                                                                                               ^
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:24: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                           ^
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:205:53: error: member reference base type 'int' is not a structure or
          union
        static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0);
                                                        ^~~~~~~~
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:25: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                       ~~~~~^~~~~~
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:205:64: error: member reference base type 'int' is not a structure or
          union
        static _LIBCPP_CONSTEXPR const bool is_signed = type(-1) < type(0);
                                                                   ^~~~~~~
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:25: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                       ~~~~~^~~~~~
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:210:66: error: member reference base type 'int' is not a structure or
          union
        static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
                                                                ~~~~~^~~~~~~~~~~~~~~~~
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:25: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                            ^~~~~~
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:21: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                        ^~~
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:210:86: error: member reference base type 'int' is not a structure or
          union
        static _LIBCPP_CONSTEXPR const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
                                                                                         ^~~~~~~~
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:25: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                       ~~~~~^~~~~~
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:218:89: error: member reference base type 'int' is not a structure or
          union
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type epsilon() _NOEXCEPT {return type(0);}
                                                                                            ^~~~~~~
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:25: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                       ~~~~~^~~~~~
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:219:93: error: member reference base type 'int' is not a structure or
          union
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type round_error() _NOEXCEPT {return type(0);}
                                                                                                ^~~~~~~
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:25: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                       ~~~~~^~~~~~
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:231:90: error: member reference base type 'int' is not a structure or
          union
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type infinity() _NOEXCEPT {return type(0);}
                                                                                             ^~~~~~~
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:25: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                       ~~~~~^~~~~~
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:232:91: error: member reference base type 'int' is not a structure or
          union
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type quiet_NaN() _NOEXCEPT {return type(0);}
                                                                                              ^~~~~~~
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:25: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                       ~~~~~^~~~~~
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:233:95: error: member reference base type 'int' is not a structure or
          union
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return type(0);}
                                                                                                  ^~~~~~~
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:25: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                       ~~~~~^~~~~~
    In file included from /Users/user/sources/squirrel/squirrel/sqvm.cpp:5:
    In file included from /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/math.h:310:
    /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/limits:234:92: error: member reference base type 'int' is not a structure or
          union
        _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return type(0);}
                                                                                               ^~~~~~~
    /Users/user/sources/squirrel/squirrel/sqobject.h:131:25: note: expanded from macro 'type'
    #define type(obj) ((obj)._type)
                       ~~~~~^~~~~~
    fatal error: too many errors emitted, stopping now [-ferror-limit=]
    20 errors generated.
    make[2]: *** [squirrel/CMakeFiles/squirrel_static.dir/sqvm.cpp.o] Error 1
    make[1]: *** [squirrel/CMakeFiles/squirrel_static.dir/all] Error 2
    make: *** [all] Error 2
    MacBook-Pro:build user$ clang --version
    Apple LLVM version 9.0.0 (clang-900.0.26)
    Target: x86_64-apple-darwin17.0.0
    Thread model: posix
    InstalledDir: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    

    Let me know if you need more info.

    opened by hrubymar10 7
  • Sqirrel compiler crashes on these one-liners

    Sqirrel compiler crashes on these one-liners

    --base Assertion failed: npos < _vlocals.size(), file D:\src\squirrel\squirrel\sqfuncstate.cpp, line 291

    delete base Assertion failed: npos < _vlocals.size(), file D:\src\squirrel\squirrel\sqfuncstate.cpp, line 291

    x-- = 1 Assertion failed: npos < _vlocals.size(), file D:\src\squirrel\squirrel\sqfuncstate.cpp, line 291

    local x; @() !x = 1 Exception thrown: read access violation. sqvector<__int64>::back(...) returned 0xFFFFFFFFFFFFFFF8

    opened by imp5imp5 2
  • Added option to disable the interpreter

    Added option to disable the interpreter

    This allows compiling the Squirrel library from source to link it against a program without building the interpreter. It's useful mostly for project including the Squirrel source code in their own.

    I did not know whether it was best to add an option() call or not; I did not put any for consistency with SQ_DISABLE_INSTALLER, but I can add one if wanted.

    opened by Semphriss 0
  • The next version of squirrel,Can you add integrated binding to C + + 20 ranges syntax?

    The next version of squirrel,Can you add integrated binding to C + + 20 ranges syntax?

    Squirrel is very easy to use~~~

    Thanks for the development of @albertodemichelis ! Only after version 3.1 was updated in 2016, there was no news again?

    Recently, the new features of C + + 23 standard have been added a lot? Ranges has the most features, and ranges has become the biggest winner. Our question is, can we integrate and bind the ranges syntax above C + + 20 in squirrel? Because it's so convenient to write business code with ranges!

    Ranges realizes a variety of parallel combined filtering operations and other operations through pipeline symbols, which should also be the core functional goal of the next generation of squirrel. It not only saves a lot of code, but also greatly increases the flexibility of the algorithm!

    In addition, can squirrel support the isolation of multi sub table data and operations? We hope that on the basis of the root table, there can be completely independent sub tables, which can support the same name of objects, and the algorithm can be limited to a certain sub table. C + + 20 provides modules, realizes a high degree of isolation, and even isolates Hongdu? Is there a similar feature in JS? For example, if we declare in the root table and instantiate in different sub tables, the algorithm and object will not be afraid of the problem of duplicate names, and the data will be effectively isolated? In this way, it is convenient to write a large amount of business code.

    We are highly optimistic about squirrel and hope @albertodemichelis can give an answer!

    thank! thank! thank!

    opened by D22699 4
Releases(v3.2)
Owner
Alberto Demichelis
Alberto Demichelis
PLP Project Programming Language | Programming for projects and computer science and research on computer and programming.

PLPv2b PLP Project Programming Language Programming Language for projects and computer science and research on computer and programming. What is PLP L

PLP Language 5 Aug 20, 2022
StarkScript - or the Stark programming language - is a compiled C-based programming language that aims to offer the same usability as that of JavaScript's and TypeScript's

StarkScript StarkScript - or the Stark programming language - is a compiled C-based programming language that aims to offer the same usability as that

EnderCommunity 5 May 10, 2022
This is official repository of the course Industrial Informatics LT, Year 2021/22, at University of Modena and Reggio Emilia, held at Fondazione Universitaria di Mantova

Industrial informatics LT - Mantova - 2021/22 This is official repository of the course Industrial Informatics LT, Year 2020/21, at University of Mode

High-Performance Real-Time Lab 4 Jun 27, 2022
Notepad++ official repository

What is Notepad++ ? Notepad++ is a free (free as in both "free speech" and "free beer") source code editor and Notepad replacement that supports sever

Notepad++ 17.1k Oct 3, 2022
📦 An official xmake package repository

xmake-repo An official xmake package repository Supporting the project Support this project by becoming a sponsor. Your logo will show up here with a

xmake-io 299 Sep 26, 2022
official repository of the muparser fast math parser library

muparser - Fast Math Parser 2.3.3 (Prerelease) To read the full documentation please go to: http://beltoforion.de/en/muparser. See Install.txt for ins

Ingo Berg 288 Oct 2, 2022
SeqAn's official repository.

ATTENTION: SeqAn3 is out and hosted in a different repository: https://github.com/seqan/seqan3 All new applications should be based on SeqAn3 and all

SeqAn 420 Sep 27, 2022
The official Allegro 5 git repository. Pull requests welcome!

Welcome to Allegro! Allegro is a cross-platform library mainly aimed at video game and multimedia programming. It handles common, low-level tasks such

Allegro 1.5k Oct 3, 2022
I made this programming language at 2 AM out of boredom. This is the repository for its interpreter.

Cy Another programming language How to install the interpreter Install the dependencies (git, g++, make and sudo) For Debian and Ubuntu: sudo apt inst

cypress 3 Jan 23, 2022
frost is a programming language with a focus on low-friction systems programming.

❄️ frost frost programming language About frost is a programming language with a focus on low-friction systems programming.

null 4 Nov 12, 2021
The Wren Programming Language. Wren is a small, fast, class-based concurrent scripting language.

Wren is a small, fast, class-based concurrent scripting language Think Smalltalk in a Lua-sized package with a dash of Erlang and wrapped up in a fami

Wren 6k Oct 1, 2022
This repository is for everyone for Hacktoberfest 2021. Anyone can contribute anything for your Swags (T- Shirt), must be relevant that can add some value to this repository.

Hacktober Fest 2021 For Everyone! Upload Projects or Different Types of Programs in any Language Use this project to make your first contribution to a

Mahesh Jain 121 Oct 4, 2022
This Repository is created to help fellow coders learn open source contributions. This Repository is created for Hacktoberfest 2021

Hacktoberfest 2021 Follow the README below to get started! This Repository is created to help fellow coders learn open source contributions This Repos

Somesh Debnath 6 Aug 11, 2022
This repository is a study repository to implement the LCD 16x2 in my project below

This repository is a study repository to implement the LCD 16x2 in my project below. Index ?? About ?? Functionalities ?? Deploy ?? Requirements ?? Pi

Rickelme Dias 3 Jun 7, 2022
Experimental telegram client based on official Android sources

Catogram Experimental telegram client based on official Android sources Catogram features: Message translator TGX Style of context menu VKUI Icons and

null 184 Sep 27, 2022
Official Vanguard Anti-Cheat source code.

Vanguard Official Vanguard Anti-Cheat source code. Using the compiled binary For ease, an unprotected compiled version of Vanguard is available. Downl

Riot Vanguard 429 Sep 24, 2022
Inoki's NB1 kernel source tree based on Nokia official tarball

Inoki's NB1 kernel source tree based on Nokia official tarball

Inoki 2 Aug 31, 2022
Arduino official Library

Arduino official Library library extension Meaning print h Serial.print(println) cpp Servo .h サーボにPWM送るやつ binary .h 脳筋二進数定義ファイル Arduino.h #define HIGH

Casey_Nelson 1 Dec 1, 2021
Official Go implementation of the Fixcoin protocol

XFSGO Official Go implementation of the XFS protocol. Usage To learn more about the available xfsgo commands, use xfsgo help or type a command followe

XFS Network 0 May 18, 2022