-
-
Notifications
You must be signed in to change notification settings - Fork 546
Ruby scripting support #1726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ruby scripting support #1726
Conversation
* Mention Ruby in features * Attribution
Current behavior assumes that comments comprise exactly two characters, such as "--" or "//". Many languages, such as Ruby and Python, use a single character, such as the pound sign or the ASCII quotation mark to signal a single-line comment.
Github Actions seems to also prefer the UNIX-native prefix on Windows CMake
Created a gembox containing only useful gems
This reverts commit 1a8bf83. It turns out that wrapping CMake's poor cross build support was not a good idea after all.
CMake's env helper is broken on Windows OS :/
* Genericize cross compilation * Clean mruby build artifacts with make/ninja clean
CMakeLists.txt
Outdated
${TIC80CORE_DIR}/api/lua.c | ||
${TIC80CORE_DIR}/api/moonscript.c | ||
${TIC80CORE_DIR}/api/fennel.c | ||
${TIC80CORE_DIR}/api/wren.c | ||
${TIC80CORE_DIR}/api/squirrel.c | ||
${TIC80CORE_DIR}/api/mrb.c |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we name this mruby
since that seems to be the name used everywhere else?
@@ -18,6 +18,7 @@ To make a retro styled game, the whole process of creation and execution takes p | |||
- Multiple programming languages: [Lua](https://www.lua.org), | |||
[Moonscript](https://moonscript.org), | |||
[Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript), | |||
[Ruby](https://www.ruby-lang.org/en/), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be https://mruby.org
MRuby and Ruby are NOT quite the same project. It's certainly possible to embed Ruby also, but since we're not doing that we should be clear that we're using MRuby, at the very least the link here should point to MRuby I'd think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I've been thinking of that too, there is some source-level incompatibility between the two, but at the same time we shouldn't create any more confusion to the end users.
IMO it's something worth mentioning in the documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we shouldn't create any more confusion to the end users.
I think [Ruby](https://mruby.org)
would solve the issue, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Ruby would solve the issue, no?
Ruby is the language, MRuby is just one of the available implementations.
Just like with Javascript (or should I say ECMAscript); duktape isn't perfectly compliant either:
[Javascript](https://developer.mozilla.org/en-US/docs/Web/JavaScript),
This is MUCH cleaner PR. :) Nice! |
@remi6397 I see N3DS is fixed, how did you do it? |
That's because I got rid of IO-related gems, I think. |
This reverts commit 6164e0b.
More consistent with the rest of the project tree
Please try to add LIBS := \
$(TIC80LIB)/libtic80studio.a \
$(TIC80LIB)/libtic80core.a \
$(TIC80LIB)/libgiflib.a \
$(TIC80LIB)/liblpeg.a \
$(TIC80LIB)/liblua.a \
$(TIC80LIB)/libzip.a \
$(TIC80LIB)/libblipbuf.a \
$(TIC80LIB)/libsquirrel.a \
$(TIC80LIB)/libwren.a \
$(TIC80LIB)/libargparse.a \
$(TIC80LIB)/libwave_writer.a \
$(TIC80LIB)/libduktape.a \
$(TIC80LIB)/libzlib.a \
$(TIC80LIB)/libpng.a \
$(NEWLIBDIR)/lib/libc.a \
$(NEWLIBDIR)/lib/libcirclenewlib.a \
$(CIRCLEHOME)/addon/vc4/sound/libvchiqsound.a \
$(CIRCLEHOME)/addon/vc4/vchiq/libvchiq.a \
$(CIRCLEHOME)/addon/linux/liblinuxemu.a \
$(CIRCLEHOME)/addon/SDCard/libsdcard.a \
$(CIRCLEHOME)/addon/fatfs/libfatfs.a \
$(CIRCLEHOME)/lib/usb/libusb.a \
$(CIRCLEHOME)/lib/input/libinput.a \
$(CIRCLEHOME)/lib/fs/fat/libfatfs.a \
$(CIRCLEHOME)/lib/fs/libfs.a \
$(CIRCLEHOME)/lib/net/libnet.a \
$(CIRCLEHOME)/lib/sched/libsched.a \
$(CIRCLEHOME)/lib/libcircle.a \
$(NEWLIBDIR)/lib/libm.a This will possibly fix the rpi-baremetal build. |
e96224c
to
2189e34
Compare
2189e34
to
375ca37
Compare
Would love to keep backwards compatibility when Rake isn't available. Here's a Pull Request that disables mruby if Rake isn't there: remi6397#6 |
Awesome, so we're ready to merge :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, the job well done 👍
for ARCH in arm arm64 x86 x86_64; do \ | ||
API=24; \ | ||
SYSROOT=$ANDROID_NDK_HOME/platforms/android-$API/arch-$ARCH; \ | ||
python3 "$ANDROID_NDK_HOME/build/tools/make_standalone_toolchain.py" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to move this part to the Docker initialization part after merging the PR
@@ -588,7 +678,7 @@ jobs: | |||
runs-on: ubuntu-latest | |||
strategy: | |||
matrix: | |||
script: [lua, moon, fennel, js, wren, squirrel] | |||
script: [lua, moon, fennel, mruby, js, wren, squirrel] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to rename it to ruby
here or the export ruby %name%
command won't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, we can use export mruby
as a variant.
Any thoughts?
mrb_funcall(mrb, mrb_top_self(mrb), TicFunc, 0); | ||
catcherr(machine); | ||
|
||
if (mrb_respond_to(mrb, mrb_top_self(mrb), mrb_intern_cstr(mrb, OvrFunc))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to call OVR()
here for new languages, it's for compatibility, so we can remove this callback here.
Replaces #1006
This PR adds support for the Ruby programming language, or to be precise a lightweight implementation of Ruby called MRuby.
Resources
pre-0.90 Description
This PR adds basic support for [Ruby](https://www.ruby-lang.org) scripting via [MRuby](https://mruby.org/).I thought it'd be nice to have Ruby as an option for scripting, because it's widely used in WebDev (Rails, Sinatra, etc.), DevOps (Puppet, Chef, Vagrant), ITSec (Logstash, Metasploit) and probably in many more applications beyond my field of expertise (SketchUp being the first one to come to my mind).
If you decided to merge, Ruby would make the second most popular language of those available in TIC (right after JavaScript).
I've already tested this on Windows (10, x64) and Linux (openSUSE Tumbleweed) and it compiles without any problems. There are still
macOS, Emscripten and Android left to test, but:1) I'd have to install XCode my Mac;2) I don't know how to x-compile for Emscripten; 3) I don't own any Android device.Apart from that, everything seems to work flawlessly. 😉
EDIT: Ran build on my Mac, it works there too.