Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 11:06
    andrewchambers commented #337
  • 11:06
    andrewchambers commented #337
  • 11:06
    andrewchambers opened #337
  • 11:06
    andrewchambers opened #337
  • 09:33
    andrewchambers commented #336
  • 09:33
    andrewchambers commented #336
  • 09:24
    andrewchambers edited #336
  • 09:24
    andrewchambers edited #336
  • 09:22
    andrewchambers opened #336
  • 09:22
    andrewchambers opened #336
  • 02:51

    bakpakin on master

    Address #306 - Add unicode esca… Update changelog and bump versi… (compare)

  • 02:51

    bakpakin on master

    Address #306 - Add unicode esca… Update changelog and bump versi… (compare)

  • 02:16
    bakpakin closed #321
  • 02:16
    bakpakin closed #321
  • 02:16

    bakpakin on master

    Address #321 Also improve docs… (compare)

  • 02:16

    bakpakin on master

    Address #321 Also improve docs… (compare)

  • Apr 04 23:32

    bakpakin on master

    Switch to two digit sonames. J… (compare)

  • Apr 04 23:32

    bakpakin on master

    Switch to two digit sonames. J… (compare)

  • Apr 04 23:23
    bakpakin commented #335
  • Apr 04 23:23
    bakpakin commented #335
andrewchambers
@andrewchambers
this would solve that anyway.
and provide more hope for windows support
andrewchambers
@andrewchambers
@bakpakin oh another random question, dunno if you considered
C qsort for the boot.janet sort
I mean, the pure janet one is cool
dunno if there are any tradeoffs
especially around coroutines etc.
Aydar Zarifullin
@iZarif
Is there way to compile Janet as a static library with built-in Janet native module?
andrewchambers
@andrewchambers
You can make your own main
you could also alter the root-env table
and use a regular jpm style build.
so yeah you can, but how depends on what you are trying to do.
andrewchambers
@andrewchambers
My recommendation would be to just link against the normal janet library, and in your application initialization add the module, and add functions to the root table.
Aydar Zarifullin
@iZarif
@andrewchambers Thank you for the answer.
Aydar Zarifullin
@iZarif
@andrewchambers
"add functions to the root table"
How to do it?
If directly call
janet_cfuns(env, "mymod", cfuns)
from the main function and then try to call
janet_dostring(env, "(mymod/myfun)", "main", NULL)
Janet will report an error: compile error in main unknown symbol mymod/myfun
andrewchambers
@andrewchambers
Try
JanetTable *core_env = janet_core_env(NULL);
and add the cfuns to this env
Perhaps
Though im not sure exactly what you are trying to do.
Which env are you passing to cfuns?
Aydar Zarifullin
@iZarif

@andrewchambers

Maybe if I show the code it'll make it clearer what I'm trying to do?

https://pastebin.com/zSrXSp3f

I'm sorry I can't explain it properly I'm not a native English speaker

andrewchambers
@andrewchambers
@iZarif Umm it looks ok to me. I suggest printing the contents of the env, or studying the cfuns function
to make sure its adding the module functions with the correct names.
also try
(myfun) without my-mod
Aydar Zarifullin
@iZarif
@andrewchambers Calling mymod without a prefix works
here is the function, you could try to understand why it doesn't add the prefix.
otherwise we need to see if someone else knows.
Aydar Zarifullin
@iZarif
Thank you for your help.
andrewchambers
@andrewchambers
no problem
andrewchambers
@andrewchambers
Yes i just read that function, im not exactly sure why it is done like this
Aydar Zarifullin
@iZarif
@andrewchambers
Judging by the call
janet_def(env, cfuns->name, fun, cfuns->documentation)
functions are actually added to the environment without the prefix
perhaps the import function (or some other function) is responsible for prefixes
it looks like the builtins here add the prefix themself
core functions are a bit special
as they don't go via import like you said.
So your theory seems right to me.
It makes sense because import is able to change the prefix
via :prefix
Calvin Rose
@bakpakin
Yes, that is the case. The prefix is needed in the janet_cfuns function for the purpose of the registry, which is simply used for printing c functions (the function will print as prefix/name instead of name in the repl).
The registry used to be involved with marshal/unmarshal, but that functionality has been removed
Matthew Carter
@ahungry
got lazy and took a few days off with the effort, but in the swig/janet branch, I have it working with int/float/double/pointer now
swig does some auto-function generate for struct setter/getter functions - I'll probably poke at that next
andrewchambers
@andrewchambers
@ahungry nice! It is super valuable work.
Matthew Carter
@ahungry
thanks :) just for fun I tried it on cairo.h, it worked a lot better than I expected given its heavily WIP state
by default it tries to do the lisp niceties similar to what swig does for guile (convert snake case C names to kebob case janet names etc)
andrewchambers
@andrewchambers
@ahungry did you tackle generating abstract types at all?