Commit Graph

205 Commits

Author SHA1 Message Date
Johann Rudloff
1ac28921df Merge remote-tracking branch 'origin/master' into mkdoc-rework 2021-04-28 18:45:24 +02:00
Stefan Höck
bbea929cf3
[ refactor ] Cleanup integral primops (#1211) 2021-04-28 09:32:46 +01:00
Johann Rudloff
3dd5878e22 [ wip ] Improve HTML docs with better annotations 2021-04-26 23:02:25 +02:00
Johann Rudloff
ae9da0e8ce Reformat docs CSS file to comply with code style guide (and make the linter happy) 2021-04-26 22:48:24 +02:00
Johann Rudloff
68a5f1f1b7 Copy styles.css from support into generated docs/ folder 2021-04-26 22:45:14 +02:00
Niklas Larsson
473b8ee740 Windows test fixes
Translate node error codes
Strip 'b' from flags
Simplify directory wrangling in chez016
2021-04-12 18:47:57 +02:00
Niklas Larsson
b32a2593ff Node fixes
Don't assume that errno exists. There might never have been an error.

Quote executable path to handle path with spaces.
2021-04-12 16:43:54 +02:00
Raoul Hidalgo Charman
1211f860b6
Fix issues with use of unix sockets (#1284)
This change adds logic to set up sockaddr correctly for connect and
bind, handles the AF_UNIX case for getSockAddr and expands the existing
test to cover unix sockets.
2021-04-12 11:22:45 +01:00
Niklas Larsson
f81ccec40a Fix Racket blodwen-arg for real 2021-04-10 11:16:14 +02:00
Niklas Larsson
e117ab1c1c Add back the exe as first arg on Racket 2021-04-09 22:46:32 +02:00
Niklas Larsson
084997a880 Replace prim__getArgs with prim__getArgsCount and prim__getArg
This spares us from having to build Idris data structures in the foreign
code.
2021-04-03 10:45:02 +02:00
Niklas Larsson
e49916cea9 Fixes from trying to compile idris with the refc backend
* fix doublequoting in constArray
* substitute tildes in names
* Add negate functions
* Add string comparisons

Several things remain, notably missing _argList functions.
2021-04-02 15:02:40 +02:00
CodingCellist
ec77ad21ab
[ re #1185 ] Add primitive for obtaining number of processors (#1209)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-03-26 18:27:25 +00:00
CodingCellist
89a84a34a4
Patch CVs and sleep in Racket (#1059) 2021-03-15 13:43:12 +00:00
Stefan Höck
8d4321eb9a
Add Data.Bits to base (#1033) 2021-03-04 20:59:56 +00:00
Niklas Larsson
da2ad89252
Merge pull request #910 from cypheon/createdir-permissions
Better default permissions for created directories
2021-02-28 17:04:53 +01:00
Mathew Polzin
9f8a8b5d76
Add a total way of reading files in. (#1070) 2021-02-18 11:13:25 +00:00
Stefan Hoeck
f721281bdc
[ re #1043 ] Fix typo in support.scm (#1047) 2021-02-10 01:00:42 +00:00
Wen Kokke
bd683938bf
Overhaul of concurrency primitives (#968)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-02-05 16:16:20 +00:00
vfrinken
d04b28b62d
Update stringOps.c (#848)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-02-02 14:01:19 +00:00
stefan-hoeck
8b96614454 fixed whitespace for *.c and *.h files 2021-01-22 15:08:49 +00:00
Edwin Brady
efae2682bd
Merge pull request #896 from Russoul/toString-iterators
Add withIteratorString
2021-01-16 15:47:45 +00:00
Fabián Heredia Montiel
d712ea288a Implement Racket Futures Support 2021-01-15 18:58:51 +00:00
Johann Rudloff
65e36fc20f Better default permissions for created directories
Change the support code for directory creation so that it sets all
permission bits (ugo=rwx). The process's currently active umask will be
subtracted from these permissions, which leads to the result that (for a
standard umask of "022") directories are created with a mode of "0755".

So by default, directories created with `prim__createDir` are now also
group-executable and other-executable by default.

Previous behaviour was to create the directories readable for group and
other, but not executable (mode "744"), and thus inaccessible to anyone
except the owner.
2021-01-10 11:54:15 +01:00
russoul
79d0cd1ba6 Add withIteratorString 2020-12-31 20:36:07 +03:00
Fabián Heredia Montiel
57a8ef4609
Implement Futures as a Parallelism Primitive (#753)
Co-authored-by: Christian Rasmussen <christian.rasmussen@me.com>
2020-12-04 10:58:26 +00:00
Edwin Brady
2e6aa126a4
Merge pull request #750 from ska80/refc-sysos
[refc] Update 'sysOS' to recognize more BSD flavors
2020-12-03 11:59:33 +00:00
Kamil Shakirov
544208ec92 [refc] Update 'sysOS' to recognize more BSD flavors 2020-10-21 17:20:51 +06:00
Kamil Shakirov
0b36a5fe3b [refc] Remove 'schemeCall' as it is not used anymore 2020-10-21 16:57:05 +06:00
Niklas Larsson
604e7ea99e Make it build on windows 2020-10-11 23:36:52 +02:00
Edwin Brady
97e5f04c34 Add believe_me and crash primitives to refc 2020-10-11 18:51:45 +01:00
Edwin Brady
2a39a6461a Merge github.com:idris-lang/Idris2 into refcount-c 2020-10-11 15:12:18 +01:00
Edwin Brady
a76a1322eb Initial merge of reference counting C back end
Written by Volkmar Frinken (@vfrinken). This is intended as a
lightweight (i.e. minimal dependencies) code generator that can be
ported to multiple platforms, especially those with memory constraints.

It shouldn't be expected to be anywhere near as fast as the Scheme back
end, for lots of reasons. The main goal is portability.
2020-10-11 15:05:00 +01:00
Matúš Tejiščák
1a58075a54
Merge pull request #716 from sysvinit/fix-network-constants
Retrieve network address family preprocessor constants from C runtime code
2020-10-11 08:37:44 +02:00
Matus Tejiscak
f64163de1f Merge branch 'unscheme' into master 2020-10-11 08:20:01 +02:00
Molly Miller
dff0f1da43 network: Retrieve AF_* magic constants from C support code.
The Network.Socket.Data code previously used hardcoded constants manually read
from auto-generated C source code, however these constants are specific to
Linux. The original code looked like this:

    export
    ToCode SocketFamily where
      -- Don't know how to read a constant value from C code in idris2...
      -- gotta to hardcode those for now
      toCode AF_UNSPEC = 0 -- unsafePerformIO (cMacro "#AF_UNSPEC" Int)
      toCode AF_UNIX   = 1
      toCode AF_INET   = 2
      toCode AF_INET6  = 10

The AF_INET6 constant is correct on my Debian 10 laptop:

    molly on flywheel ~> grep -rE '^#define AF_INET6' /usr/include
    /usr/include/x86_64-linux-gnu/bits/socket.h:#define AF_INET6	PF_INET6
    molly on flywheel ~> grep -rE '^#define PF_INET6' /usr/include
    /usr/include/x86_64-linux-gnu/bits/socket.h:#define PF_INET6    10  /* IP version 6.  */

However, this is not the case on an OpenBSD machine:

    spanner# grep -rE '^#define[[:space:]]+AF_INET6' /usr/include
    /usr/include/sys/socket.h:#define	AF_INET6	24		/* IPv6 */

This commit adds accessor functions to the C runtime support library for
retrieving the values of these macros as they appear in the system libc header
files, which can then be invoked using the normal C FFI machinery.
2020-10-01 12:05:42 +01:00
russoul
883a8df429 Fix String->Int cast on Scheme backends 2020-09-23 19:48:58 +01:00
Matus Tejiscak
cf45f43f4e Move the Buffer struct back into the .c file. 2020-09-20 17:49:25 +02:00
Matus Tejiscak
d26a9c55bf Tune Data.String.Iterator. 2020-09-20 10:02:18 +02:00
Matus Tejiscak
74f592053e Make StringIterator abstract. 2020-09-19 21:54:34 +02:00
Matus Tejiscak
bdcb2551b2 Change the way of creating directories. 2020-09-19 15:09:26 +02:00
Matus Tejiscak
76c3c3f8e8 Update the Scheme support code. 2020-09-19 14:36:57 +02:00
Matus Tejiscak
38a3145e8e Make the C code more explicit. 2020-09-19 14:32:45 +02:00
Matus Tejiscak
cf6530b387 Install headers for libidris2_support, use the right mode. 2020-09-19 14:11:12 +02:00
foss-mc
e0e883a890
remove a reference to a function of racket/string 2020-08-28 19:23:30 +08:00
foss-mc
979424c8e4
Improve Racket supporting code 2020-08-28 19:02:04 +08:00
russoul
3a9b1ac656 Add supporting code 2020-08-25 14:30:57 +03:00
Matus Tejiscak
362d2204ab Make fastAppend a foreign call. 2020-08-24 19:51:22 +02:00
karroffel
7d046652d8
add support for more casts from and to BitsN types (#548)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2020-08-20 15:01:09 +01:00
Thomas Dziedzic
5d1b937035
add prim__getNullAnyPtr and prim__castPtr (#525) 2020-08-20 11:52:51 +01:00
Giuseppe Lomurno
21524da0a0 Windows color fix 2020-08-19 11:30:12 +02:00
Giuseppe Lomurno
42404c2d9d Automatic console width detection 2020-08-18 19:25:36 +01:00
Rui Barreiro
3acc30599e Merge branch 'master' of github.com:idris-lang/Idris2 into javascript 2020-07-06 17:09:11 +01:00
Rui Barreiro
68c9990c8a moved big foreign functions to support and added outputDir 2020-07-06 16:58:02 +01:00
Markus Pfeiffer
0b32bf8a2f Fix forward declaration of idris_closeDir 2020-07-06 13:56:36 +01:00
Edwin Brady
5ed27947cb Small concurrency fixes
Conditional variables with timeout in Chez didn't work, so changed to a
consistent meaning of the timeout (microseconds). Also fix linearity of
unsafePerformIO.
2020-06-23 19:06:30 +01:00
Niklas Larsson
4c6670966d
Merge pull request #312 from ska80/support-chez
Update Chez support for *BSD operating systems
2020-06-16 14:40:45 +02:00
Niklas Larsson
0c7fc9b73c simplify win32_modenv 2020-06-16 14:09:12 +02:00
Niklas Larsson
2e8f618f00 Apparently overwrite should report success 2020-06-16 14:02:04 +02:00
Niklas Larsson
8540728202 Handle overwrite on windows
Expand test to test overwrite
2020-06-16 13:44:10 +02:00
Niklas Larsson
8633dde240 Add stdlib include 2020-06-16 12:53:36 +02:00
Niklas Larsson
6974b318a3 Add test for setenv and unsetenv 2020-06-16 12:36:39 +02:00
Niklas Larsson
630e4219fc Fix unsetenv
implement Windows support
2020-06-16 12:09:22 +02:00
Kamil Shakirov
24226edc83 Update Chez support for *BSD operating systems 2020-06-16 16:03:38 +06:00
Tim Süberkrüb
e9a80891b7 Extend Control.App.FileIO 2020-06-12 17:30:54 +02:00
Niklas Larsson
aea0c1fd15 Remove unused functions from idris_buffer.c 2020-06-11 17:35:29 +02:00
Edwin Brady
0a246af449 Make Buffer more primitive
Meaning that the FFI is aware of it, so you can send arbitrary byte data
to foreign calls. Fixes #209

This means that we no longer need the hacky way of reading and writing
binary data via scheme, so can have a more general interface for reading
and writing buffer data in files.

It will also enable more interesting high level interfaces to binary
data, with C calls being used where necessary.

Note that the Buffer primitive are unsafe! They always have been, of
course... so perhaps (later) they should have 'unsafe' as part of their
name and better high level safe interfaces on top.

This requires updating the scheme to support Buffer as an FFI primitive,
but shouldn't affect Idris2-boot which loads buffers its own way.
2020-06-11 14:05:52 +01:00
Edwin Brady
ca28dab1d7 Add finalisers for Racket back end
Like Chez, we also need an explicit call to the garbage collector at the
end to ensure that all the finalisers get run on exit.
2020-06-08 22:13:24 +01:00
Edwin Brady
d60feaace0 Add finalisers to Chez back end
This involves new primitives GCPtr and GCAnyPtr which are pointer types
that have finalisers attached. The finalisers are run when the
associated pointer goes out of scope.

In the test, I am assuming that the GC will only be called once, right
at the end. Otherwise, the output isn't guaranteed to be deterministic!
Let's see how this assumption holds...

This is currently Chez only. I think it'll be easy enough to add to
the Racket and Gambit back ends too.
2020-06-08 20:34:23 +01:00
Thomas Lin
fc8e6b1fef Use GetSystemTimeAsFileTime on older Windows 2020-06-02 10:30:44 +08:00
Edwin Brady
d0021f7e48
Merge pull request #212 from normalcoder/gambit-ffi-callbacks
Gambit ffi callbacks
2020-06-01 12:41:58 +01:00
Edwin Brady
2eb2ce6097 Add Bits primitives
Including appropriate casts, and Num/Eq/Ord/Show implementations.
Also includes new primitives in Data.Buffer, and calls to foreign
functions in C as 'unsigned'.
2020-06-01 11:48:03 +01:00
normalcoder
e001d266fe Add sys/time.h to satisfy xcode.
It seems relevant to all BSD systems.

In xcode the option -Wno-error-implicit-function-declaration is enabled. So the following error occured:
Idris2/support/c/idris_file.c:76:13: Missing '#include <sys/time.h>'; declaration of 'select' must be imported from module 'Darwin.POSIX.sys.time' before it is required

I hope it won't break anything on linux.
2020-06-01 00:48:19 +03:00
Tim Süberkrüb
46f7b78b0e Try to fix pclose for Windows
Co-authored-by: Niklas Larsson <metaniklas@gmail.com>
2020-05-28 16:12:26 +02:00
Tim Süberkrüb
c2dfe7de7f Add popen and pclose from Idris 1 2020-05-28 12:58:03 +02:00
Marek Labos
9160d2772a Fix typo in backends/index.rst and racket/support.rkt 2020-05-25 14:02:49 +01:00
Edwin Brady
c3d13d0854
Merge pull request #93 from ska80/better-names
Rename some file/dir manipulation functions for consistency
2020-05-24 20:16:01 +01:00
Niklas Larsson
8d16980b81 Remove dependency on pthreads on Windows 2020-05-24 19:56:26 +02:00
Kamil Shakirov
80344b5435 Merge branch 'master' into better-names 2020-05-24 07:59:25 +06:00
Edwin Brady
ad9a2a187f Fix Char casting
For the same behaviour as Idris 1, the primitive cast should return 0 if
the integer is out of bounds. (We should probably drop the Cast
implementation though, since ideally they won't be lossy in general, but
that's an issue for another time...)

All the tests pass in racket now, for me.
2020-05-23 22:19:10 +01:00
Edwin Brady
cff5fc2625 Workaround for byte vectors in Racket
Racket appears to have a different notion of current directory than the
system does, so we need to tell it which directory we think we're in
when reading and writing bytevectors using the scheme file functions.
2020-05-23 21:37:31 +01:00
Kamil Shakirov
307265aaab Update C support header files 2020-05-24 00:41:53 +06:00
Kamil Shakirov
e61e44205b Merge branch 'master' into better-names 2020-05-24 00:26:52 +06:00
Niklas Larsson
a92fb3a3b0
Merge pull request #120 from idris-lang/fix_build
Fix Windows build
2020-05-23 19:12:19 +02:00
Tim Süberkrüb
5dde7063f8 Add popen and pclose from Idris 1 2020-05-23 18:42:05 +02:00
Edwin Brady
ae81e9140a Fix Racket buffer loading code
Should return #f on failure, not an empty buffer, for consistency with
Chez
2020-05-23 17:39:07 +01:00
Niklas Larsson
81c59fd5d1
Fix Windows build 2020-05-23 18:05:55 +02:00
Edwin Brady
1857e4b3fe Add flag for windows in support Makefile 2020-05-23 16:47:10 +01:00
Edwin Brady
e17f66244a Move network support to libidris2_support
This makes the support stuff much simpler, and also makes the racket
bootstrap process easier
2020-05-23 15:52:33 +01:00
Marek Labos
9108410c1e Define blodwen-os in Gambit support.scm 2020-05-21 23:09:02 +01:00
Niklas Larsson
d50bb099ea Windows support 2020-05-21 15:13:06 +02:00
Kamil Shakirov
f696335f2d Rename some file/dir manipulation functions
Renamed:

fileRemove -> removeFile

dirOpen -> openDir
dirClose -> closeDir
rmDir -> removeDir
2020-05-21 18:32:35 +06:00
Edwin Brady
5b88afb3ef Add racket bootstrap script 2020-05-19 22:56:27 +01:00
Edwin Brady
48c6c4aa81 Write Ints as 64 bit
Since they might be... This is especially likely for module hashes, and
if we don't get it right, the Racket runtime might fail to write the
buffer. This makes the code buildable with the Racket back end.
2020-05-19 16:25:58 +01:00
Edwin Brady
8380a6fa9e
Merge pull request #4 from ska80/refactor-makefiles
Refactor makefiles
2020-05-19 16:23:06 +01:00
Edwin Brady
953e8f4913
Merge pull request #3 from ska80/ignore-files
Update .gitignore files
2020-05-19 16:22:41 +01:00
Kamil Shakirov
b801b97fcc Refactor makefiles 2020-05-19 18:50:47 +06:00
Kamil Shakirov
47e943cc7d Update .gitignore files 2020-05-19 17:49:21 +06:00
Edwin Brady
f749f3e277
Merge pull request #2 from melted/fix_win
Windows fixes
2020-05-19 12:30:54 +01:00
Edwin Brady
6bbb914fca
Merge pull request #1 from edwinb/remove-directory-system
Add rmDir to System.Directory
2020-05-19 12:24:35 +01:00
Niklas Larsson
1bebd7d070 Windows fixes 2020-05-19 13:13:01 +02:00
Edwin Brady
456414cffd Generate IdrisPaths 2020-05-18 20:24:48 +01:00
André Videla
3321dc6be3 Add rmDir to System.Directory 2020-05-18 18:28:33 +01:00
Edwin Brady
052713b645 Adding missing scheme support
Sorry!
2020-05-18 14:55:43 +01:00
Edwin Brady
80450bbc8e Add missing C support 2020-05-18 14:51:28 +01:00