mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39:17 +02:00
Add memory-streams to list of features
This commit is contained in:
parent
702451541a
commit
6ffd229dcd
5 changed files with 31 additions and 7 deletions
|
@ -2,6 +2,10 @@
|
|||
|
||||
## 0.35.0 - TBD
|
||||
|
||||
Features
|
||||
|
||||
- Add `memory-streams` to the list of symbols that `(features)` can return, indicating that the current installation supports in-memory streams.
|
||||
|
||||
Bug Fixes
|
||||
|
||||
- Enforce a maximum recursion depth when printing an object via `display` and `write`, and when comparing objects via `equal?`. This prevents segmentation faults when working with circular data structures.
|
||||
|
|
|
@ -375,6 +375,7 @@ object Cyc_io_peek_u8(void *data, object cont, object port);
|
|||
object Cyc_write_bytevector(void *data, object bvec, object port, object start, object end);
|
||||
object Cyc_io_read_line(void *data, object cont, object port);
|
||||
void Cyc_io_read_token(void *data, object cont, object port);
|
||||
int Cyc_have_mstreams();
|
||||
/**@}*/
|
||||
|
||||
|
||||
|
|
|
@ -32,6 +32,15 @@ if (obj_is_not_closure(clo)) { \
|
|||
} \
|
||||
}
|
||||
|
||||
int Cyc_have_mstreams()
|
||||
{
|
||||
#if CYC_HAVE_FMEMOPEN && CYC_HAVE_OPEN_MEMSTREAM
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
object Cyc_heap_alloc_port(void *data, port_type *p);
|
||||
port_type *Cyc_io_open_input_string(void *data, object str)
|
||||
{
|
||||
|
|
|
@ -2942,6 +2942,13 @@ object Cyc_compilation_environment(void *data, object cont, object var)
|
|||
snprintf(buf, sizeof(buf), "%s", CYC_PLATFORM);
|
||||
make_utf8_string(data, str, buf);
|
||||
_return_closcall1(data, cont, &str);
|
||||
} else if (strncmp(((symbol) var)->desc, "memory-streams", 9) == 0) {
|
||||
char buf[] = "memory-streams";
|
||||
if (!Cyc_have_mstreams()) {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
make_utf8_string(data, str, buf);
|
||||
_return_closcall1(data, cont, &str);
|
||||
}
|
||||
}
|
||||
Cyc_rt_raise2(data,
|
||||
|
|
|
@ -235,6 +235,9 @@
|
|||
(begin
|
||||
;; Features implemented by this Scheme
|
||||
(define (features)
|
||||
(let ((feats *other-features*))
|
||||
(if (> (string-length (Cyc-compilation-environment 'memory-streams)) 0)
|
||||
(set! feats (cons 'memory-streams feats)))
|
||||
(cons
|
||||
'cyclone
|
||||
(cons
|
||||
|
@ -242,7 +245,7 @@
|
|||
(string-append "version-" *version-number*))
|
||||
(cons
|
||||
(string->symbol (Cyc-compilation-environment 'platform))
|
||||
*other-features*))))
|
||||
feats)))))
|
||||
|
||||
(define *other-features*
|
||||
'(r7rs
|
||||
|
|
Loading…
Add table
Reference in a new issue