[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: specifying protocol for service



    Date: Fri, 20 Apr 90 12:08:31 EST
    From: bouma@cs.purdue.edu

       You write:
       I think this will work:

    Id 
[Good typo. -- rsl]
       does, except for the last line should read:
    (apply #'net:invoke-service-on-host (cons service (cons host service-args)))

Sorry, I should have specified that I was using CL:APPLY, which works
the way I wrote it (I had actually tested the code, a non-trivial trick
since I work at a stand-alone site!  I tested it using Dialnet...).  If
you feel you must use ZL:APPLY for some reason, you might find this
cliche slightly more perspicuous:

   (apply #'net:invoke-service-on-host (list* service host service-args))

However, you can just say CL:APPLY (or LISP:APPLY) in the code directly,
even if you're using a ZL-based package.

-----------------------------------------------------------------

Here is how I tracked down the information I wanted in a reasonably
quick manner, in case that's interesting.  I caused the error you saw,
and DESCRIBEd the value of the variable DBG:*ERROR*.  Its slots included
the following:

#<NET:HOST-DOES-NOT-SUPPORT-SERVICE 104137655>, an object of flavor NET:HOST-DOES-NOT-SUPPORT-SERVICE,
 has instance variable values:
  DBG:SPECIAL-COMMANDS:    (:SPECIFY-PATH)
  ZL:STATUS:               :SIGNALLED
  DBG:PROCEED-TYPES:       NIL
  NETI:SERVICE:            :DOMAIN
  NETI:PROTOCOL:           NIL
  NET:HOST:                #<FS:LISPM-HOST OTHER-HOST 12202732>
  NETI:POSSIBILITIES:      NIL
  NETI:POSSIBLE-PATHS:     ((:DOMAIN :DIAL :DOMAIN))
  NETI:HOST-PROTOCOLS:     NIL
  NETI:LOCAL-PROTOCOLS:    (#<NETI:PROTOCOL DOMAIN 115012311>)

I noted that there were no proceed types (so I didn't look at whether
proceeding would be useful), but that there were special commands.
Next, I did the following:

  Show Flavor Methods NET:HOST-DOES-NOT-SUPPORT-SERVICE :Match special

This displayed the following:

  DBG:DOCUMENT-SPECIAL-COMMAND method: NET:HOST-DOES-NOT-SUPPORT-SERVICE case :SPECIFY-PATH
  DBG:INITIALIZE-SPECIAL-COMMANDS method: NET:HOST-DOES-NOT-SUPPORT-SERVICE
  DBG:SPECIAL-COMMAND method: NET:HOST-DOES-NOT-SUPPORT-SERVICE case :SPECIFY-PATH

Clicking Meta-Left on the name of the method for DBG:SPECIAL-COMMAND took me
to the source of that function.  A bit of poking around at nearby
definitions told me that I had to invoke the INITIALIZE-SPECIAL-COMMANDS 
method before I would be able to use the special command of interest.

This is a general method of research which will work for many of the
conditions signalled by the Genera system innards.  Much user code just uses
the ERROR function with a string, so it's not very easy to write interesting
handlers.

  1.  Proceed past the error point (use SYS:PROCEED on the condition
      object, and return the values it returns).
  2.  Invoke a special command (use DBG:SPECIAL-COMMAND)
  3.  Throw to some convenient tag (which is what some special command
      handlers actually do).
  4.  Decline to handle the condition (return NIL).

A subcategory of 3 is invoking a restart handler, which is complicated.
In the new Common Lisp error system (not yet implemented under Genera)
invoking restarts is simple.  Also in category 3 is what CONDITION-CASE
handlers do, since by the time your handler is invoked the error is no
longer being signalled.

There is a (very!) brief tutorial on using the condition system in my
book, @I[Lisp Lore], which is only slightly out of date after almost
three years.  In the second edition of @I[Common Lisp: The Language] is
a longish (~60 pages) description of the new Common Lisp condition
system, with lots of prose describing how and why you write condition-
related programs in various styles; while the names of a few functions
are different, the principles are pretty much the same.