Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Daniel Munch
@Dmunch04
Yeah. Indeed it is. Does that still count for working
Daniel Munch
@Dmunch04
munchii@pop-os:~/Dokumenter/Languages/gravity$ echo "export PATH=$PATH:$(cwd)" >> ~/.profile

Command 'cwd' not found, did you mean:

  command 'cbd' from deb centreon-broker (18.10.0-4)
  command 'cwm' from deb swap-cwm (1.2.1-7)
  command 'xwd' from deb x11-apps (7.7+7)
  command 'cbwd' from deb centreon-broker (18.10.0-4)
  command 'xcwd' from deb xcwd (0~2.gbpe2c777c-1)
  command 'pwd' from deb coreutils (8.30-1ubuntu1)
  command 'cw' from deb cw (3.5.1-3)
  command 'gwd' from deb geneweb (6.08+git20181019+dfsg-2)
  command 'cdw' from deb cdw (0.8.1-1build4)

Try: sudo apt install <deb name>
夜莺
@killop
hello! is there any benchmark vs lua v8 or quickjs ?
Ingwie Phoenix
@IngwiePhoenix
None that im aware of.
夜莺
@killop
any body?
Marco Bambini
@marcobambini
Official benchmarks are not available, users did some simple benchmarks in the past, for example: https://twitter.com/kazzkiq/status/839005291647807489
夜莺
@killop
above benchmark is simple ,let me do some benchmark vs lua quickjs
Daniel Munch
@Dmunch04
Does anyone know if there's any plans to include an i/o lib? Mostly just wanna be able to read/write files
Daniel Munch
@Dmunch04
Hey. I'm back again. Besides my earlier question, I also wanna ask about the plans for importing. I know you can do #include but what about real imports?
Dario
@darltrash
Hi everyone!
Daniel Munch
@Dmunch04
@marcobambini
Airbus5717
@Airbus5717
Can We have a discord server ? for gravity language
Knuffen
@Knuffen
Hello everyone! I get some issues on when attempting to use gravity.dll as compiled by Visual Studio. For some reason the error claims that gravity_vm_loadclosure can't be found in the dll. I''ve been trying to get Gravity.NET working, but it does feel like it's dll relates. Gravity.NET implements the last embedding example from the documentation page but in C#. If I remove the closure part and just use gravity_vm_runmain it works fine. Any ideas?
Marco Bambini
@marcobambini
@Knuffen it seems strange because gravity_vm_loadclosure is declared like any other API. Can you please share some more information? How have you compiled the DLL?
Knuffen
@Knuffen
@marcobambini Yeah, I think it's looks like it shouldn't be any issue either. I have to say that I'm quite new to this so I might be lacking in knowledge as well.
I cloned the latest gravity-master. Open up the project in Visual Studio 2019. Retarget Windows SDK in project from v8.1 to v10.0.18362.0 and upgrade Platform toolset to v142. Build solution with x64 as target.
After that I just open the Gravity.NET project and build it pretty much.
Here is a more exact error message:
System.EntryPointNotFoundException: 'Unable to find an entry point named 'gravity_vm_loadclosure' in DLL 'gravity'.'
Knuffen
@Knuffen
Also noticed something. I assume that the exports.def file in the gravity_visualstudio folder should contain all entry points but gravity_loadclosure isn't written in that file..
Knuffen
@Knuffen
Hm, the src\opt folder is not included... Feels a bit fishy
Knuffen
@Knuffen
Forget the last comment.. I got ahead of myself..
Marco Bambini
@marcobambini
@Knuffen I just updated and fixes some Windows related code and the VC project itself. I also added the missing gravity_vm_loadclosure prototype in the exports.def file. Please try again and let me know how it works.
Knuffen
@Knuffen
@marcobambini Perfect, that solved that little issue. Unfortunately now I got the same problem with gravity_value_from_int. I tried adding all the gravity_valuefrom* to the exports.def file but then I instead get the error message: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Marco Bambini
@marcobambini
@Knuffen when did you receive that error message? During compilation? During unit-test execution? Please let me know.
Knuffen
@Knuffen
@marcobambini During debug. It's when trying to run (C#):
gravity_value_t n1 = Native.gravity_value_from_int(30);
Native is the Gravity.NET dll which implements the gravity.dll
Marco Bambini
@marcobambini
@Knuffen I think you need to "enable unmanaged code debugging" as suggested here https://stackoverflow.com/questions/4074585/attempted-to-read-or-write-protected-memory-this-is-often-an-indication-that-ot
Knuffen
@Knuffen
@marcobambini Indeed that did bump it in the right directionm however I still get pretty much the same error. When I debug it looks like gravity_int_t is set to __int64 eventhough I've compiled everything as Win32/x86. Could this be the cause?
Exception thrown at 0x0F9F32D2 (gravity.dll) in TestThingie.exe: 0xC0000005: Access violation writing location 0x00000003.
Knuffen
@Knuffen
ah GRAVITY_ENABLE_INT64 and GRAVITY_ENABLE_DOUBLE are both set to one. I suppose then that I need shoud compile this as x64 and not x86/Win32.. x64 is preferable anyway..
Knuffen
@Knuffen
That's better! Still some issues but atleast the functions work. Just need to figure out why editing the gravity file crashes.. what text encoding should it be? ANSI, Unicode, UTF8?
Knuffen
@Knuffen
.. or rather running an edited gravity file..
Marco Bambini
@marcobambini
@Knuffen does it work now?
What do you mean by "editing the gravity file crashes", which app is crashing?
BTW encoding could be ANSI or UTF8
Knuffen
@Knuffen
@marcobambini it was when I tried to run the script after editing. I added a function, saved it and then it kept crashing. Didn't have time to check it out, maybe I get some time in the evening. Meanwhile, thanks for the encoding info!
Knuffen
@Knuffen
@marcobambini I finally got the Gravity.NET implementation working. My god... there's most likely some work to do to get Gravity.NET up to speed... Most of the issues were on the .NET side except for the missing variables in the exports.def and a crappy developer (that's me). For instance the mapping of the gravity_value_t struct was wrong in Gravity.NET causing read/write violations. Also the implementation wasn't exactly like the last embedding example, don't know if that caused any issues though but I rewrote it to be pretty much the same as the example now.
Knuffen
@Knuffen
I think the developer of Gravity.NET might not have had the time to implement VALUE_ISA_CLOSURE.. Is it possible to dllexport macros somehow? Do you have an approximate estimation of how many of the gravity.dll functions etc are exported and available from .NET?
Marco Bambini
@marcobambini
VALUE_ISA_CLOSURE is a very simple macro defined as:
#define VALUE_ISA_CLOSURE(v) (v.isa == gravity_class_closure)
Unfortunately I do not know too much about the Gravity.NET project but it seems to me that it should be updated and synced with the latest changes
Knuffen
@Knuffen
@marcobambini I'll check if I have access to gravity_class_closure.
Sorry, my question was a bit unclear. I'll see if I can dig something up.
I can also put some effort in to making new .NET bindings, I think that I'd like to simplify it a bit and have fewer arguments. I can't figure out why for instance gravity_vm_runclosure needs to have nparams in the .NET implementation when the function itself can handle that etc..
Would you mind explaining a use case for fileid in gravity_compiler_run?
Knuffen
@Knuffen
@marcobambini I'm having some issues accessing gravity_class_closure from C#. I tried adding it to exports.def and some modifications to the gravity source files, maybe I need to wrap it in a function.. Any ideas?
Knuffen
@Knuffen
Yeah, wrapping it in a function works fine!
Marco Bambini
@marcobambini
fileid in gravity_compiler_run is a way to uniquely identify a file for better error reporting, you can safely ignore it at the moment
Knuffen
@Knuffen
@marcobambini ok, thank you. The example returns the closure with gravity_value_dump, how should I do to get the value out as json instead? Lists (and maps I guess) return without any type information, it would be nice if I could get it out as json and then handle that in .NET.
Marco Bambini
@marcobambini
You do not need to call gravity_value_dump because the you already have the gravity_value_t from gravity_value_t result = gravity_vm_result(vm);
There is no built-in way to get result as JSON (even if I agree that it would be nice). Take a look at JSON_stringify in gravity_opt_json.c to have an idea of the code that should be executed.
Knuffen
@Knuffen
But how does gravity_vm_result return lists and maps? It contains a float value, an int value, type via isa and a pointer to what I guess is where the value is locatrd? How can I get the full list with all the items and corresponding type from that?
I'll look into the json stuff, thanks
Marco Bambini
@marcobambini
take a look at list_loop in gravity_core.c