Commit Graph

36 Commits

Author SHA1 Message Date
John Mager
9b2811f263 Make RefC search for files in data dirs
Previously, the RefC files were located in IDRIS2_PREFIX. This is
decoupled to allow users to change the prefix (for ad-hoc library
install locations, for example).
2021-12-10 14:30:46 +00:00
Kamil Shakirov
08d9e7d82c [ install ] Install non-executable files with the executable flag off 2021-08-31 13:21:19 +01:00
Ben Hormann
74db7714d4
[fix] Loading libidris2_support.dll with Racket (#1583) 2021-07-21 14:35:21 +01:00
Stiopa Koltsov
41c20ddf6a Assertions in RefC runtime
Better crash explicitly than debug memory violation.

The most important part of this is in `Buffer` implementation.
2021-07-17 03:59:32 +01:00
Edwin Brady
66217b6fa6
Merge branch 'master' into refc-buffer 2021-07-16 09:44:40 +01:00
Edwin Brady
69663735f4
Merge pull request #1680 from stepancheg/buffer-buffer
Remove Value_Buffer.len field
2021-07-16 09:22:48 +01:00
Stiopa Koltsov
f81c37ea3a Pass Buffer as char* when using C functions in RefC
To be able to use `C` functions for both Scheme and RefC: it was
not possible for `Buffer` before this PR.

As an example, `writeBufferData` and `readBufferData` functions are
removed: generic C backend implementations are used instead.
2021-07-13 23:04:36 +01:00
Stiopa Koltsov
1fac812435 In RefC, allocate the exact size of value subtype
* remove `Value.payload` field
* `IDRIS2_NEW_VALUE` macro now allocates the size needed for the struct
2021-07-12 16:27:09 +01:00
Stiopa Koltsov
c292437a28 Remove Value_Buffer.len field
It is not used.

Also change `buffer` field type to avoid confusion.
2021-07-11 12:00:01 +01:00
Stiopa Koltsov
60d597fccd Use pragma once instead of include guard
Pragma once is supported by all compilers for the last ten years.
Better use it instead of include guards (which use different styles
in different files).
2021-06-28 12:05:22 +01:00
Robert Wright
a8264f8f05 Add ability to extend RefC backend to create further backends 2021-06-18 16:59:35 +01:00
Robert Wright
e9b42cc55e Guarantee Ref C Buffer 0 initialization 2021-06-14 15:06:44 +01:00
Robert Wright
1875f62248 Remove freeBuffer function
Each backend is now responsible for freeing Buffers in the same way as other objects
2021-06-14 15:06:44 +01:00
Robert Wright
195e690ddc Fix RefC Buffer getInt function to work with large values 2021-06-14 15:06:44 +01:00
Robert Wright
c6a5827319 Add RefC readBufferData/writeBufferData support 2021-06-14 15:06:44 +01:00
Robert Wright
d202139171 Distinguish common C and RefC Buffer functions 2021-06-14 15:06:44 +01:00
Robert Wright
aa94dd2351 Add RefC Char pattern matching support 2021-06-07 15:15:37 +01:00
Johann Rudloff
18e15e2261 [ fix ] Cast CLOCKS_PER_SEC to float before division
The cast to float needs to happen before the division, otherwise integer
division will be performed, and as a result `CLOCKS_PER_NSEC` will
always be 0 if `CLOCKS_PER_SEC` < `NSEC_PER_SEC`.
2021-06-03 17:36:11 +01:00
madman-bob
98d67499db
RefC Integer Support (#1480)
* Add utility functions to treat All as a heterogeneous container
* Distinguish RefC Int and Bits types
* Change RefC Integers to be arbitrary precision
* Add RefC Bits maths operations
* Make RefC div and mod Euclidean
* Add RefC bit-ops tests
* Add RefC integer comparison tests
* Add RefC IntN support
2021-06-03 10:44:42 +01:00
Kamiλ Shakirov
ad656a8d47
Remove realpath (#1457) 2021-05-25 11:01:28 +01:00
Robert Wright
5aef7a2dff fixup! 04dfba03 2021-05-20 14:25:16 +01:00
Robert Wright
c57bb5a65f Add RefC StringIterator support 2021-05-20 14:25:16 +01:00
Robert Wright
f3aae06b28 Add RefC Clock support 2021-05-20 14:25:16 +01:00
Robert Wright
cf2b05ce02 Add RefC Buffer support 2021-05-20 14:25:16 +01:00
Robert Wright
ecde887d7a Add RefC external type support
The external type must be a Value object for garbage collection reasons.

For completely custom types, use a GCPointer, with appropriate GC function for clearing up your data type.
2021-05-20 14:25:16 +01:00
Robert Wright
c34c6e0959 Complete RefC standard String support
- Fix off-by-one error in String reverse
- Correct order of arguments in strSubstr
- Actually use start index of strSubstr
- Reduce memory usage of strSubstr in case of overrunning string end
- Add fastPack/fastUnpack/fastConcat
- Use unsigned chars for character comparisons
- Fix generated C character encodings
2021-05-20 14:25:16 +01:00
Robert Wright
978d86f28d Fix RefC identity functions memory management 2021-05-20 14:25:16 +01:00
Robert Wright
06ca4bed5d Refactor C codegen
- Remove commented out code
- Remove unused showEitherStringInt and toIntEitherStringInt functions
- Make cTypeOfCFType pure
- Merge identical case branches of createCFunctions
- Remove unused C support functions
2021-05-20 14:25:16 +01: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
vfrinken
d04b28b62d
Update stringOps.c (#848)
Co-authored-by: Guillaume ALLAIS <guillaume.allais@ens-lyon.org>
2021-02-02 14:01:19 +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
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