Common Lisp Package: ORG.DAVEP.DICT

RFC 2229 client classes, functions and macros

README:

FUNCTION

Public

MAKE-DICT-CLIENT (&KEY (HOST *DEFAULT-DICT-HOST*) (PORT *DEFAULT-DICT-PORT*))

Create a dictionary client.

Private

CAP-STRING->KEYWORD-LIST (CAP-STRING)

Convert CAP-STRING to a list of keywords.

END-OF-DATA-P (LINE)

Is LINE an end of data marker?

KEYWORD->DICT-STRING (KEYWORD)

Convert KEYWORD into a dict string constant.

READ-STRING-AS-LIST (STRING)

Take STRING and read it as a list.

READ-STRING-AS-LIST-PRESERVING-CASE (STRING)

Take STRING and read it as a list while preserving case.

MACRO

Public

WITH-DICT-CLIENT ((CLIENT &KEY (HOST *DEFAULT-DICT-HOST*) (PORT *DEFAULT-DICT-PORT*)) &BODY BODY)

Create a dictionary client called CLIENT and evaluate BODY.

Private

Undocumented

WITH-SAFE-READING (&BODY BODY)

GENERIC-FUNCTION

Public

Undocumented

CONNECT (DICT-CLIENT)

CONNECTEDP (DICT-CLIENT)

DATABASES (DICT-CLIENT)

DEFINE (DICT-CLIENT WORD &KEY (DATABASE ALL))

DEFINITION-AS-STRING (DEFINITION &KEY (STRIP-LEADING-WHITESPACE NIL))

DISCONNECT (DICT-CLIENT)

INFO (DICT-CLIENT DATABASE)

MATCH (DICT-CLIENT WORD &KEY (DATABASE ALL) (STRATEGY DEFAULT))

SEE-ALSO (DEFINITION)

SERVER-HELP (DICT-CLIENT)

SERVER-INFO (DICT-CLIENT)

STRATEGIES (DICT-CLIENT)

Private

Undocumented

COMPLETION-REPLY-P (RESPONSE)

CONNECTED-CHECK (DICT-CLIENT)

ERRORP (RESPONSE)

GET-LINE (DICT-CLIENT)

GET-LONG-RESPONSE (DICT-CLIENT)

GET-SHORT-RESPONSE (DICT-CLIENT)

INFO-COMMAND (DICT-CLIENT COMMAND)

INTERMEDIATE-REPLY-P (RESPONSE)

LONG-COMMAND (DICT-CLIENT COMMAND)

PERMANENT-ERROR-P (RESPONSE)

POPULATE-SLOTS-FROM-BANNER (DICT-CLIENT)

PRELIMINARY-REPLY-P (RESPONSE)

PUT-LINE (DICT-CLIENT LINE)

READ-DEFINITION (DEFINITION DICT-CLIENT)

READ-INFO (INFO TEXT)

READ-RESPONSE (RESPONSE TEXT)

READ-WORD (DEFINITION HEADER)

SHORT-COMMAND (DICT-CLIENT COMMAND)

TEMPORARY-ERROR-P (RESPONSE)

SLOT-ACCESSOR

Public

SETFBANNER (NEW-VALUE OBJECT)

The banner message we got when connected to the host. This slot, when populated, is a `DICT-CLIENT-RESPONSE' object.

CAPABILITIES (OBJECT)

Server's capability list. A list of keywords.

SETFCAPABILITIES (NEW-VALUE OBJECT)

Server's capability list. A list of keywords.

CODE (OBJECT)

The numeric code associated with the response.

SETFCODE (NEW-VALUE OBJECT)

The numeric code associated with the response.

DATA (OBJECT)

Any data associated with the response.

SETFDATA (NEW-VALUE OBJECT)

Any data associated with the response.

DATABASE (OBJECT)

The name of the database that the definition came from.

SETFDATABASE (NEW-VALUE OBJECT)

The name of the database that the definition came from.

DEFINITION (OBJECT)

The definition of the word. This is a list of strings, each item in the list is a line from the definition.

SETFDEFINITION (NEW-VALUE OBJECT)

The definition of the word. This is a list of strings, each item in the list is a line from the definition.

DESCRIPTION (OBJECT)

The description attribute of the information item.

SETFDESCRIPTION (NEW-VALUE OBJECT)

The description attribute of the information item.

HOST (OBJECT)

The name of the dictionary host that the client will connect to. The default value for this slot is the value of `*DEFAULT-DICT-HOST*'.

SETFHOST (NEW-VALUE OBJECT)

The name of the dictionary host that the client will connect to. The default value for this slot is the value of `*DEFAULT-DICT-HOST*'.

MESSAGE-ID (OBJECT)

The message ID given to us after a successful connection.

SETFMESSAGE-ID (NEW-VALUE OBJECT)

The message ID given to us after a successful connection.

NAME (OBJECT)

The long name of the database that the definition came from.

SETFNAME (NEW-VALUE OBJECT)

The long name of the database that the definition came from.

PORT (OBJECT)

The number of the port that the client will connect to. The default value for this slot is the value of `*DEFAULT-DICT-PORT*'.

SETFPORT (NEW-VALUE OBJECT)

The number of the port that the client will connect to. The default value for this slot is the value of `*DEFAULT-DICT-PORT*'.

RESPONSE (OBJECT)

The text of the response received from the server.

SETFRESPONSE (NEW-VALUE OBJECT)

The text of the response received from the server.

SERVER-DETAILS (OBJECT)

The server details as pulled from the banner after a successful connection.

SETFSERVER-DETAILS (NEW-VALUE OBJECT)

The server details as pulled from the banner after a successful connection.

WORD (OBJECT)

The word that is being defined.

SETFWORD (NEW-VALUE OBJECT)

The word that is being defined.

Private

SOCKET (OBJECT)

The socket used to talk to the host.

SETFSOCKET (NEW-VALUE OBJECT)

The socket used to talk to the host.

VARIABLE

Public

*DEFAULT-CLIENT-ID*

The default client ID that will be announced to the dictionary server. If you would prefer that your application announces itself in a different way then you should modify the value of this variable.

*DEFAULT-DICT-HOST*

Host name to use when a default host is required.

*DEFAULT-DICT-PORT*

Port to use when a default port is required.

CLASS

Private

DICT-CLIENT

RFC2229 client class. This class has the following slots: HOST - The name of the dictionary host. PORT - The dictionary port on the host. SOCKET - When connected this is the socket stream that is being used. BANNER - An instance of `DICT-CLIENT-RESPONSE' that contains the banner we got from the dictionary server when we connected. SERVER-DETAILS - The server details as pulled from the BANNER. CAPABILITIES - List of server capabilities as pulled from the BANNER. MESSAGE-ID - The message-ID for this connection as pulled from the BANNER. Methods associated with this class are: CONNECTEDP - Check if the client is connected. CONNECT - Connect to the server. DISCONNECT - Disconnect from the server. DEFINE - Get the defintions for a word. MATCH - Get a list of matches for a word. DATABASES - Get a list of databases on the server. STRATAGIES - Get a list of matching stratagies supported by the server. INFO - Get information about a database. SERVER-HELP - Get the help text of the server. SERVER-INFO - Get information about the server. Functions associted with this class are: MAKE-DICT-CLIENT - Create a dictionary client object.

DICT-CLIENT-RESPONSE

Class to hold a response from a dictionary server. This class has three slots: CODE - The numeric code associated with the response. RESPONSE - The text of the response received from the server. DATA - Any data associated with the response.

DICT-GENERAL-INFO

Class to hold general information returned from the server. This class is used for holding general information that is returned from the dictionary server, this includes things like items in the list of databases or the list of match stratagies. This class has two slots: NAME - The name attribute of the information item. DESCRIPTION - The description attribute of the information item.

DICT-WORD-DEFINITION

Class to hold a word definition. This class is used to hold a word definition, it has the following slots: WORD - The word that is being defined. DATABASE - The name of the database that the definition came from. NAME - The long name of the database that the definition came from. DEFINITION - The definition of the word. This is a list of strings, each item in the list is a line from the definition. Methods associated with this class are: SEE-ALSO - Get a list of links found in the defintion.

CONSTANT

Public

+ALL-DB+

Database name to use when all definitions/matches are required.

+DEFAULT-MATCH-STRATEGY+

Match strategy name meaning "the server's default".

+EXACT-MATCH-STRATEGY+

Match strategy name for an exact match.

+FIRST-DB+

Database name to use when the first definition/match is required.

+PREFIX-MATCH-STRATEGY+

Match strategy name for a prefix match.