Skip to content

Instantly share code, notes, and snippets.

@rgchris
Last active February 18, 2021 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgchris/67106926e3005b7308392efaa70025b4 to your computer and use it in GitHub Desktop.
Save rgchris/67106926e3005b7308392efaa70025b4 to your computer and use it in GitHub Desktop.
Summarize Port for Ren-C
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