Idris2 icon indicating copy to clipboard operation
Idris2 copied to clipboard

Node is missing some FFI functions from base

Open Z-snails opened this issue 3 years ago • 6 comments

If possible, please include complete self contained source files (for example by uploading to https://gist.github.com) that exhibit the issue in addition to quoting from them here. The smaller the example the better!

Steps to Reproduce

Try to compile various System.* functions with node codegen

Expected Behavior

Works

Observed Behavior

Fails with

Uncaught error: INTERNAL ERROR: No supported backend found in the definition of System.Errno.prim__getErrno. Supported backends: "node","javascript". Backends in definition: "C".

Here's every FFI function in base that's missing a node version if someone wants to implement these:

  • [ ] System
    • [ ] prim__sleep
    • [ ] prim__usleep
    • [ ] prim__getEnvPair
    • [x] prim__setEnv
    • [x] prim__unsetEnv
    • [x] prim__system
    • [x] prim__getPID
  • [x] Data.Buffer
    • [x] prim__setBits64
    • [x] prim__getBits64
    • [x] stringByteLength
  • [x] System.Clock
    • [x] prim__clockTimeMonotonic
    • [x] prim__clockTimeUtc
    • [x] prim__clockTimeProcess
    • [x] prim__clockTimeThread
    • [x] prim__clockTimeGcCpu
    • [x] prim__clockTimeGcReal
    • [x] prim__osClockValid
    • [x] prim__osClockSecond
    • [x] prim__osClockNanosecond
  • [ ] System.Concurrency
    • Not all these can be implemented
  • [x] System.Directory
    • [x] prim__openDir
    • [x] prim__closeDir
    • [x] prim__removeDir
    • [x] prim__dirEntry
  • [ ] System.Errno
    • [ ] prim__getErrno
    • [x] prim__strerror
  • [ ] System.FFI
    • [ ] prim__malloc
    • [x] prim__free
  • [x] System.Info
    • [x] prim__getNProcessors
  • [x] System.Signal
    • [x] prim__sighup
    • [x] prim__sigint
    • [x] prim__sigabrt
    • [x] prim__sigquit
    • [x] prim__sigill
    • [x] prim__sigsegv
    • [x] prim__sigtrap
    • [x] prim__sigfpe
    • [x] prim__sigusr1
    • [x] prim__sigusr2
    • [x] prim__ignoreSignal
    • [x] prim__defaultSignal
    • [x] prim__collectSignal
    • [x] prim__handleNextCollectedSignal
    • [x] prim__sendSignal
    • [x] prim__raiseSignal
  • [ ] System.File.Meta
    • [ ] prim__fPoll
    • [ ] prim__fileAcccessTime
    • [ ] prim__fileStatusTime
  • [ ] System.File.Process
    • [ ] prim__flush
    • [x] prim__popen
    • [x] prim__pclose
  • [ ] System.File.ReadWrite
    • [ ] prim__readChars
    • [ ] prim__readChar
    • [x] prim__removeFile

Z-snails avatar Dec 19 '21 12:12 Z-snails

~~I just ran into this when attempting to compile idris2 for javascript. In my case it was prim__os that is missing, and I don't see it on the list above. Would you be able to add it?~~

Ignore me. I see that prim__os isn't supported on JavaScript, and so idris2 can't be compiled for it.

iamrecursion avatar Jun 03 '22 16:06 iamrecursion

#2427 completed Data.Buffer and System.Directory. Let's check those off :)

ProofOfKeags avatar Jun 24 '22 20:06 ProofOfKeags

System.Clock added by #2829

Z-snails avatar Dec 23 '22 16:12 Z-snails

popen/pclose added by #2866

Z-snails avatar Jan 30 '23 17:01 Z-snails

I added free in #2606

dunhamsteve avatar May 17 '23 21:05 dunhamsteve

I'm implementing some here https://github.com/idris-lang/Idris2/pull/2981

Feel free to copy paste over

freddi301 avatar May 19 '23 14:05 freddi301