Skip to content
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

Convert lisp stream dispatch to virtual methods #1531

Merged
merged 2 commits into from
Dec 19, 2023
Merged

Convert lisp stream dispatch to virtual methods #1531

merged 2 commits into from
Dec 19, 2023

Conversation

yitzchak
Copy link
Member

No description provided.

@yitzchak yitzchak marked this pull request as ready for review December 18, 2023 20:30
Copy link
Member

@Bike Bike left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work.

claspCharacter decode_passthrough(unsigned char** buffer, unsigned char* buffer_end);
int encode_passthrough(unsigned char* buffer, claspCharacter c);

claspCharacter decode_ascii(unsigned char** buffer, unsigned char* buffer_end);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be good to move out all these methods to some general class rather than FileStream. (something for the later changes, of course)

l = compute_char_size(string.unsafe_character());
} else if (cl__stringp(string)) {
Fixnum iEnd;
String_sp sb = string.asOrNull<String_O>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously this is just code you're copying and so fixing it is a bit out of scope, but just to mention (you probably already know):

  1. asOrNull is to be avoided. we have gc::As etc
  2. this conditional is pointless, since cl__length will return the fill pointer
  3. ditto StringFillp and SetStringFillp. they should be on the chopping block

unlikely_if(!AnsiStreamP(strm)) ERROR_WRONG_TYPE_ONLY_ARG(cl::_sym_open_stream_p, strm, cl::_sym_Stream_O);
return (StreamClosed(strm) ? nil<T_O>() : _lisp->_true());
AnsiStream_sp ansi_stream = strm.asOrNull<AnsiStream_O>();
return ansi_stream ? (ansi_stream->_Closed ? nil<T_O>() : _lisp->_true()) : eval::funcall(gray::_sym_open_stream_p, strm);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe oughta have a reader rather than using a field directly

@yitzchak yitzchak merged commit 5e6312e into main Dec 19, 2023
8 checks passed
@yitzchak yitzchak deleted the stream branch December 19, 2023 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants