Giter Site home page Giter Site logo

alemart / surgescript Goto Github PK

View Code? Open in Web Editor NEW
47.0 47.0 7.0 9.25 MB

SurgeScript: a scripting language for games.

Home Page: https://docs.opensurge2d.org

License: Apache License 2.0

C 97.91% CMake 1.71% Shell 0.38%
game-engine gamedev opensurge scripting-engine scripting-games scripting-language surgescript

surgescript's Introduction

Hi ๐Ÿ‘‹ My name is Alexandre.

I'm the creator of: ๐Ÿง™โ€โ™‚๏ธ

My work is quite innovative and requires a lot of skill, time and effort to do. Showing your support is the best way to help me continue it.

๐Ÿ“ฌ How to reach me: ale


Short bio

I'm from Brazil ๐Ÿ‡ง๐Ÿ‡ท and I've been creating computer games and programs since forever. I studied at the University of Sรฃo Paulo, where I received solid foundations in computer science. Now I apply this knowledge in creative ways. My intention is to create joy - and boy, I do! ๐Ÿ˜Ž

If you find my work useful and would like to see more of it, become my sponsor!

If you would like to see less of it, don't! ๐Ÿ˜ฎ

surgescript's People

Contributors

alemart avatar codylico avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

surgescript's Issues

Hardcoded /lib

Hi, I'm a package maintainer in Fedora and I'm currently in the process of packaging OpenSurge (and thus, SurgeScript) for Fedora.

In Fedora, we stick with /lib on 32-bit architectures, but on 64-bit architectures, we use /lib64. This allows users to install both 64-bit and 32-bit versions of libraries, should they have a need to do so.

SurgeScript has $PREFIX/lib harcoded in three places:

  • CMakeLists.txt:142 - the dynamic library destination directory
  • CMakeLists.txt:151 - the static library destination directory
  • src/surgescript/misc/surgescript.pc.in:3 - the libdir as specified in the pkgconfig file

It would be nice if those places could be edited so they respect -DLIB_INSTALL_DIR or -DLIB_SUFFIX.

Sorry for not attaching a patch, but I have very little experience with CMake.

Compiler errors: No return in non-void functions

When building on openSUSE the build will fail because there are some non-void functions without a return (switch-case has no default).
This warnings / errors can be fixed with this patch:

diff -Nur surgescript-0.5.5/src/surgescript/runtime/variable.c new/src/surgescript/runtime/variable.c
--- surgescript-0.5.5/src/surgescript/runtime/variable.c        2021-01-22 19:42:07.000000000 +0100
+++ new/src/surgescript/runtime/variable.c      2021-03-12 16:57:05.862373112 +0100
@@ -323,6 +323,8 @@
         case SSVAR_RAW:
             return ssstrdup("<raw>");
     }
+    // May not be reached
+    return NULL;
 }
 
 /*
@@ -346,6 +348,8 @@
         case SSVAR_RAW:
             return surgescript_objectmanager_null(NULL);
     }
+    // May not be reached
+    return 0;
 }
 
 
@@ -563,6 +567,8 @@
         else
             return 0; /* this shouldn't happen */
     }
+    // May not be reached
+    return 0;
 }
 
 /*

Log:

/home/abuild/rpmbuild/BUILD/surgescript-0.5.5/src/surgescript/runtime/variable.c: In function 'surgescript_var_get_string':
/home/abuild/rpmbuild/BUILD/surgescript-0.5.5/src/surgescript/runtime/variable.c:326:1: error: control reaches end of non-void function [-Werror=return-type]
   326 | }
       | ^
 /home/abuild/rpmbuild/BUILD/surgescript-0.5.5/src/surgescript/runtime/variable.c: In function 'surgescript_var_get_objecthandle':
 /home/abuild/rpmbuild/BUILD/surgescript-0.5.5/src/surgescript/runtime/variable.c:349:1: error: control reaches end of non-void function [-Werror=return-type]
   349 | }
       | ^
 /home/abuild/rpmbuild/BUILD/surgescript-0.5.5/src/surgescript/runtime/variable.c: In function 'surgescript_var_compare':
 /home/abuild/rpmbuild/BUILD/surgescript-0.5.5/src/surgescript/runtime/variable.c:566:1: error: control reaches end of non-void function [-Werror=return-type]
   566 | }
       | ^
 cc1: some warnings being treated as errors

Add SONAMEs to libsurgescript

SurgeScript can now be compiled as a shared library, libsurgescript. However, the produced .so contains only one SONAME, which means that an application using SurgeScript is bound to a specific version of SurgeScript and must be rebuilt when SurgeScript is updated (e.g. if I build an application using SS 0.5.4.3, and update SS to 0.5.4.4, then the application won't run anymore since it specifically requires 0.5.4.3).

Adding SONAMEs would allow applications to specify that they need e.g. SurgeScript 0.5, and then be able to use 0.5.0, 0.5.1, 0.5.1.1, etc. Of course, this necessitates keeping some degree of backwards compatibility within the library (looking at the release log, there already is some).

Error while compiling with cmake: missing source file "src/surgescript/runtime/sslib/plugin.c" required by CMakeLists

user@user:~/surgescript/build$ cmake ..
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /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: /usr/bin/c++
-- Check for working CXX compiler: /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 Error at CMakeLists.txt:88 (add_library):
Cannot find source file:

src/surgescript/runtime/sslib/plugin.c

Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx

CMake Error: Cannot determine link language for target "surgescript".
CMake Error: CMake can not determine linker language for target: surgescript
-- Generating done
-- Build files have been written to: /home/user/surgescript/build

Also make command failed due to the above.

If in CMakeLists.txt is commented line 35 (missing plugin.c)
# src/surgescript/runtime/sslib/plugin.c
then cmake gives an error about lookup3.c missing. After commented line 47 (missing lookup3.c),
# src/surgescript/util/lookup3.c
cmake exits successfully, but make throws an error about undefined references.

This issue seems to be a regression from one of the commits which introduced "Plugins (WIP)".

It seems there is a use-after-free bug

Reproducing steps:

  1. I built it with my Stensal SDK (https://stensal.com), the C++ compiler should be released soon.
  2. ./surgescript examples/arguments.ss
  3. Then I saw this error message.

DTS_MSG: Stensal DTS detected a fatal program error!
DTS_MSG: Continuing the execution will cause unexpected behaviors, abort!
DTS_MSG: Access the memory block that is freed.
DTS_MSG: Diagnostic information:

  • Caution: the allocation info is correct only if the freed memory is not reused.
  • the memory block (start:0x95c9000, size:512 bytes) was allocated at
    file:/home/sbuilder/workspace/surgescript/src/surgescript/util/util.c::72, 15
  • Stack trace (most recent call first):
    -[1] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/lexer.c::451, 5
    -[2] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/parser.c::306, 28
    -[3] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/parser.c::766, 13
    -[4] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/parser.c::727, 9
    -[5] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/parser.c::1233, 9
    -[6] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/parser.c::1215, 9
    -[7] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/parser.c::1179, 11
    -[8] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/parser.c::651, 5
    -[9] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/parser.c::621, 9
    -[10] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/parser.c::529, 5
    -[11] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/parser.c::500, 5
    -[12] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/parser.c::468, 9
    -[13] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/parser.c::260, 5
    -[14] file:/home/sbuilder/workspace/surgescript/src/surgescript/compiler/parser.c::201, 9
    -[15] file:/home/sbuilder/workspace/surgescript/src/surgescript/runtime/vm.c::145, 12
    -[16] file:/home/sbuilder/workspace/surgescript/src/main.c::103, 9
    -[17] file:/home/sbuilder/workspace/surgescript/src/main.c::41, 32
    -[18] file:/musl-1.1.10/src/env/__libc_start_main.c::180, 11

Compiling Instructions?

I recently found this project and i'm loving but i'm currently having issues to compile this since under Visual studio 2022 it fails to find threads.h

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.