-
Notifications
You must be signed in to change notification settings - Fork 150
Add chars_stream/1
and chars_to_stream/{2,3}
#2968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jjtolton
wants to merge
16
commits into
mthom:master
Choose a base branch
from
jjtolton:memory-stream
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2b52d18
WIP: add scaffolding for memory streams
9080dc5
WIP: the dumbest possible way to add memory streams
f8ee873
WIP: revert unintentional change
1e99868
WIP: add tests, add functionality to library(charsio)
4c7bf03
WIP: add cli tests
37f391e
WIP: whitespace
c776def
unhacked the machine, properish implementation now
ed58f7e
char_stream -> chars_to_stream
cd29c73
char_stream -> chars_to_stream
640f39e
char_to_stream -> chars_to_stream
f3d5d8c
chars_to_stream/1 should be char_stream/1
e98dc8a
chars_to_stream/1 should be char_stream/1
69718b3
inline put_chars/2, char_stream/1 -> chars_stream/1
c4c149e
ugly, but does read/write bytes
c6068b4
add validation to `chars_to_stream/3`, cleanup test
e245c69
cleanup parser, add validation logic
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,10 +15,9 @@ | |
read_term_from_chars/3, | ||
write_term_to_chars/3, | ||
chars_base64/3, | ||
char_stream/1, | ||
chars_stream/1, | ||
chars_to_stream/2, | ||
chars_to_stream/3, | ||
put_chars/2]). | ||
chars_to_stream/3]). | ||
|
||
:- use_module(library(dcgs)). | ||
:- use_module(library(iso_ext)). | ||
|
@@ -398,28 +397,10 @@ | |
) | ||
). | ||
|
||
%% put_chars(+Stream, +Chars). % | ||
% | ||
% Writes a list of characters to a stream. | ||
% | ||
% `Stream` is the output stream, and `Chars` is the list of characters to write. | ||
% | ||
% Example: | ||
% | ||
% ``` | ||
% ?- put_chars(current_output, "hello"). | ||
% hello | ||
% true. | ||
% ``` | ||
|
||
put_chars(Stream, Chars) :- | ||
must_be(chars, Chars), | ||
maplist(put_char(Stream), Chars). | ||
|
||
%% char_stream(-Stream) | ||
%% chars_stream(-Stream) | ||
% Stream is a character stream. | ||
|
||
char_stream(Stream) :- | ||
chars_stream(Stream) :- | ||
'$memory_stream'(Stream). | ||
|
||
%% chars_to_stream(+Chars, -Stream) :- | ||
|
@@ -445,4 +426,4 @@ | |
chars_to_stream(Chars, Stream, _) :- | ||
must_be(chars, Chars), | ||
'$memory_stream'(Stream), | ||
put_chars(Stream, Chars). | ||
maplist(put_char(Stream), Chars). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why delete this? The interface should be checked prior to any side-effects.