-
-
Save rgchris/67106926e3005b7308392efaa70025b4 to your computer and use it in GitHub Desktop.
Summarize Port for Ren-C
This file contains 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
Rebol [ | |
Title: "Summarize Port" | |
Date: 17-Feb-2021 | |
Author: "Christopher Ross-Gill" | |
] | |
summarize-port: function [ | |
{Returns a block of information about a port} | |
return: "Block of short lines (fitting in roughly 80 columns)" | |
[<opt> block!] | |
port [port!] | |
][ | |
return collect [ | |
keep join "Kind " port/spec/title | |
keep join "Ref " mold any [match [file! url!] :port/spec/ref [...]] | |
keep join "Mode " pick ["Async" "Sync"] action? :port/awake | |
switch type-of :port/actor [ | |
object! [ | |
keep "Actor " | |
keep summarize-obj port/actor | |
] | |
handle! [ | |
; internal port | |
keep " actor handle! " | |
] | |
] | |
] | |
] | |
help-port: func [ | |
port [port!] | |
][ | |
print delimit newline summarize-port port | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment