Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

open? opened? close? closed? for schemes and ports

 [1/6] from: rebolinth::nodep::dds::nl at: 20-Aug-2002 16:52


Hello All/RT, How can I check from within Rebol/core what scheme's/ports have an opened session??? Its irritating not to be able to use a command that summerices all the 'words that are used as port! and are opened, so im not able to check which word! is opened or closed.. Like a simple: server: open tcp://:4444 it would be nice to have commands like-> open? server == true close? server == false opened? == [ .. .. server .. .. closed? == none Anyway..its a feature request if it does not exist, but if someone has already taken his headoff to build a check like this i would be pleased to see a short example how to check... Im also willing to build one, as long as someone can hand me a hand how to check which words! are used as a port in a simple check during a running Rebol session... (Including Console ports by the way..) Thanks in advance.... (R)egards, Norman. -- Conversation/lunch: "How do you Eat your Rebol in the Morning?"

 [2/6] from: petr:krenzelok:trz:cz at: 20-Aug-2002 17:34


Rebolinth wrote:
>Hello All/RT, >How can I check from within Rebol/core what scheme's/ports
<<quoted lines omitted: 23>>
>(R)egards, >Norman.
Not all that easy IIRC. Here's answer from Rebol TCP master Yoda - Holger :-) http://www.escribe.com/internet/rebol/m15313.html -pekr-

 [3/6] from: greggirwin:mindspring at: 20-Aug-2002 10:28


Hi Norman, Paul Tretter came up with a way to see if a port is open I think. Paul, you around? As far as checking which words are ports (if I understand your request), you can iterate over the global words to find them, but that won't find them if they live inside a context. You can also find objects and iterate into them, but the best approach will depend on what you actually want to accomplish. Try: "help tuple!" at the console and you will see that it finds all the tuple! values. You can use SOURCE on HELP as well to see how it works. Here's a basic example: find-words: func [test-fn words /local result] [ result: make block! 50 foreach w words [ if test-fn try [get to-lit-word :w] [append result :w] ] sort result ] find-words :tuple? first system/words find-words :integer? first system/words find-words :object? first system/words HTH! --Gregg

 [4/6] from: rebolinth:nodep:dds:nl at: 20-Aug-2002 23:18


Hello Gregg, So when I understand correclty then Rebol does not have a function that displays all the extra words created after boot-up, which is by itself currious because i would expect that Rebol is using a buffer where it keeps its extra added words! objects! etc... Yes, as you say, that leaves me searching all the words but then again how do i know what was opened or closed or created befor I entered the console...Or even..when i execute a script from within the console i would love to see a summery of what it all created on words! objects! etc... I cant emagine this does not exist because this way you take out the control ...MMmm... Right now im trying to discover the meaning of the state: object! when a port is opened, I see some differences in flags and func when a port is closed or opened.. Perhaps a rebol guru could explain me the details of the state object! ? Ill keep on rebolstrugling... thanks for the reply.. (R)egards, Norman. -- Conversation/lunch: "How do you Eat your Rebol in the Morning?" Citeren Gregg Irwin <[greggirwin--mindspring--com]>: -> Hi Norman, -> -> Paul Tretter came up with a way to see if a port is open I think. Paul, -> you -> around? -> -> As far as checking which words are ports (if I understand your request), -> you -> can iterate over the global words to find them, but that won't find them -> if -> they live inside a context. You can also find objects and iterate into -> them, -> but the best approach will depend on what you actually want to accomplish. -> -> Try: "help tuple!" at the console and you will see that it finds all the -> tuple! values. You can use SOURCE on HELP as well to see how it works. -> Here's a basic example: -> -> find-words: func [test-fn words /local result] [ -> result: make block! 50 -> foreach w words [ -> if test-fn try [get to-lit-word :w] [append result :w] -> ] -> sort result -> ] -> find-words :tuple? first system/words -> find-words :integer? first system/words -> find-words :object? first system/words -> -> HTH! -> -> --Gregg -> -> -- -> To unsubscribe from this list, please send an email to -> [rebol-request--rebol--com] with "unsubscribe" in the -> subject, without the quotes. -> ->

 [5/6] from: greggirwin:mindspring at: 20-Aug-2002 17:29


Hi Norman, << So when I understand correclty then Rebol does not have a function that displays all the extra words created after boot-up, which is by itself currious because i would expect that Rebol is using a buffer where it keeps its extra added words! objects! etc... >> Only the global context can grow. Other contexts cannot have words added to them, but the global context does allow that. << Yes, as you say, that leaves me searching all the words but then again how do i know what was opened or closed or created befor I entered the console...Or even..when i execute a script from within the console i would love to see a summery of what it all created on words! objects! etc... I cant emagine this does not exist because this way you take out the control ...MMmm... >> Check out QUERY. People have used it to find which words were created by a script. << Right now im trying to discover the meaning of the state: object! when a port is opened, I see some differences in flags and func when a port is closed or opened.. Perhaps a rebol guru could explain me the details of the state object! ? >> I think the details are meant for internal use only as they may change between versions. Here is what Paul Tretter came up with for checking to see if a port is open. open?: func [port][either port/state/flags = 1024 [false][true]]

 [6/6] from: g:santilli:tiscalinet:it at: 21-Aug-2002 3:16


Hi Norman, On Tuesday, August 20, 2002, 11:18:49 PM, you wrote: R> So when I understand correclty then Rebol does not have a function R> that displays all the extra words created after boot-up, which is R> by itself currious because i would expect that Rebol is using a R> buffer where it keeps its extra added words! objects! etc... The QUERY function called on an object gives a block of the word that have been changed since the last time QUERY/CLEAR was called on that object. HTH, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted