-
Notifications
You must be signed in to change notification settings - Fork 410
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
add open, close, read, write #363
Conversation
src/hvm.c
Outdated
@@ -1240,7 +1235,7 @@ Port expand(Net* net, Book* book, Port port) { | |||
|
|||
// Reads back a λ-Encoded constructor from device to host. | |||
// Encoding: λt ((((t TAG) arg0) arg1) ...) | |||
Ctr read_ctr(Net* net, Book* book, Port port) { | |||
Ctr port_to_ctr(Net* net, Book* book, Port port) { |
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.
let's keep the readback functions prefixed by read_
as a convention
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.
What about functions that are inverses of readback functions? I named it port_to_ctr
b/c I also created a ctr_to_port
. What do you think we should call the functions that convert Ctr
to Port
?
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.
I prefer readback_x
and inject_x
or create_x
for the inverses, because it is consistent with how it is in other codes of the past.
Is that example right? Isn't it |
@VictorTaelin That example was fixed in #369, it should be correct now |
oh sure, my bad |
Adds
OPEN_FILE
,CLOSE_FILE
,READ_LINE
,READ_CHAR
, andWRITE
IO functions. Since the read and write operations take in a file descriptor, I've also reserved numbers0
1
and2
to have their usual FD meaning, so users can print to stderr, read from stdin, etc.Here's an example: