Sync up with r21-4-14-chise-0_21-17.
[chise/xemacs-chise.git] / info / lispref.info-42
1 This is ../info/lispref.info, produced by makeinfo version 4.0b from
2 lispref/lispref.texi.
3
4 INFO-DIR-SECTION XEmacs Editor
5 START-INFO-DIR-ENTRY
6 * Lispref: (lispref).           XEmacs Lisp Reference Manual.
7 END-INFO-DIR-ENTRY
8
9    Edition History:
10
11    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
12 Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
13 Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
14 XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
15 GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
16 Programmer's Manual (for 19.13) Third Edition, July 1995 XEmacs Lisp
17 Reference Manual (for 19.14 and 20.0) v3.1, March 1996 XEmacs Lisp
18 Reference Manual (for 19.15 and 20.1, 20.2, 20.3) v3.2, April, May,
19 November 1997 XEmacs Lisp Reference Manual (for 21.0) v3.3, April 1998
20
21    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
22 Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
23 Copyright (C) 1995, 1996 Ben Wing.
24
25    Permission is granted to make and distribute verbatim copies of this
26 manual provided the copyright notice and this permission notice are
27 preserved on all copies.
28
29    Permission is granted to copy and distribute modified versions of
30 this manual under the conditions for verbatim copying, provided that the
31 entire resulting derived work is distributed under the terms of a
32 permission notice identical to this one.
33
34    Permission is granted to copy and distribute translations of this
35 manual into another language, under the above conditions for modified
36 versions, except that this permission notice may be stated in a
37 translation approved by the Foundation.
38
39    Permission is granted to copy and distribute modified versions of
40 this manual under the conditions for verbatim copying, provided also
41 that the section entitled "GNU General Public License" is included
42 exactly as in the original, and provided that the entire resulting
43 derived work is distributed under the terms of a permission notice
44 identical to this one.
45
46    Permission is granted to copy and distribute translations of this
47 manual into another language, under the above conditions for modified
48 versions, except that the section entitled "GNU General Public License"
49 may be included in a translation approved by the Free Software
50 Foundation instead of in the original English.
51
52 \1f
53 File: lispref.info,  Node: Grabs,  Prev: Server Data,  Up: X Server
54
55 Restricting Access to the Server by Other Apps
56 ----------------------------------------------
57
58  - Function: x-grab-keyboard &optional device
59      This function grabs the keyboard on the given device (defaulting
60      to the selected one).  So long as the keyboard is grabbed, all
61      keyboard events will be delivered to XEmacs--it is not possible
62      for other X clients to eavesdrop on them.  Ungrab the keyboard
63      with `x-ungrab-keyboard' (use an `unwind-protect').  Returns `t'
64      if the grab was successful; `nil' otherwise.
65
66  - Function: x-ungrab-keyboard &optional device
67      This function releases a keyboard grab made with `x-grab-keyboard'.
68
69  - Function: x-grab-pointer &optional device cursor ignore-keyboard
70      This function grabs the pointer and restricts it to its current
71      window.  If optional DEVICE argument is `nil', the selected device
72      will be used.  If optional CURSOR argument is non-`nil', change
73      the pointer shape to that until `x-ungrab-pointer' is called (it
74      should be an object returned by the `make-cursor' function).  If
75      the second optional argument IGNORE-KEYBOARD is non-`nil', ignore
76      all keyboard events during the grab.  Returns `t' if the grab is
77      successful, `nil' otherwise.
78
79  - Function: x-ungrab-pointer &optional device
80      This function releases a pointer grab made with `x-grab-pointer'.
81      If optional first arg DEVICE is `nil' the selected device is used.
82      If it is `t' the pointer will be released on all X devices.
83
84 \1f
85 File: lispref.info,  Node: X Miscellaneous,  Prev: X Server,  Up: X-Windows
86
87 Miscellaneous X Functions and Variables
88 =======================================
89
90  - Variable: x-bitmap-file-path
91      This variable holds a list of the directories in which X bitmap
92      files may be found.  If `nil', this is initialized from the
93      `"*bitmapFilePath"' resource.  This is used by the
94      `make-image-instance' function (however, note that if the
95      environment variable `XBMLANGPATH' is set, it is consulted first).
96
97  - Variable: x-library-search-path
98      This variable holds the search path used by `read-color' to find
99      `rgb.txt'.
100
101  - Function: x-valid-keysym-name-p keysym
102      This function returns true if KEYSYM names a keysym that the X
103      library knows about.  Valid keysyms are listed in the files
104      `/usr/include/X11/keysymdef.h' and in `/usr/lib/X11/XKeysymDB', or
105      whatever the equivalents are on your system.
106
107  - Function: x-window-id &optional frame
108      This function returns the ID of the X11 window.  This gives us a
109      chance to manipulate the Emacs window from within a different
110      program.  Since the ID is an unsigned long, we return it as a
111      string.
112
113  - Variable: x-allow-sendevents
114      If non-`nil', synthetic events are allowed.  `nil' means they are
115      ignored.  Beware: allowing XEmacs to process SendEvents opens a
116      big security hole.
117
118  - Function: x-debug-mode arg &optional device
119      With a true arg, make the connection to the X server synchronous.
120      With false, make it asynchronous.  Synchronous connections are
121      much slower, but are useful for debugging. (If you get X errors,
122      make the connection synchronous, and use a debugger to set a
123      breakpoint on `x_error_handler'.  Your backtrace of the C stack
124      will now be useful.  In asynchronous mode, the stack above
125      `x_error_handler' isn't helpful because of buffering.)  If DEVICE
126      is not specified, the selected device is assumed.
127
128      Calling this function is the same as calling the C function
129      `XSynchronize', or starting the program with the `-sync' command
130      line argument.
131
132  - Variable: x-debug-events
133      If non-zero, debug information about events that XEmacs sees is
134      displayed.  Information is displayed on stderr.  Currently defined
135      values are:
136
137         * 1 == non-verbose output
138
139         * 2 == verbose output
140
141 \1f
142 File: lispref.info,  Node: ToolTalk Support,  Next: LDAP Support,  Prev: X-Windows,  Up: Top
143
144 ToolTalk Support
145 ****************
146
147 * Menu:
148
149 * XEmacs ToolTalk API Summary::
150 * Sending Messages::
151 * Receiving Messages::
152
153 \1f
154 File: lispref.info,  Node: XEmacs ToolTalk API Summary,  Next: Sending Messages,  Up: ToolTalk Support
155
156 XEmacs ToolTalk API Summary
157 ===========================
158
159    The XEmacs Lisp interface to ToolTalk is similar, at least in spirit,
160 to the standard C ToolTalk API.  Only the message and pattern parts of
161 the API are supported at present; more of the API could be added if
162 needed.  The Lisp interface departs from the C API in a few ways:
163
164    * ToolTalk is initialized automatically at XEmacs startup-time.
165      Messages can only be sent other ToolTalk applications connected to
166      the same X11 server that XEmacs is running on.
167
168    * There are fewer entry points; polymorphic functions with keyword
169      arguments are used instead.
170
171    * The callback interface is simpler and marginally less functional.
172      A single callback may be associated with a message or a pattern;
173      the callback is specified with a Lisp symbol (the symbol should
174      have a function binding).
175
176    * The session attribute for messages and patterns is always
177      initialized to the default session.
178
179    * Anywhere a ToolTalk enum constant, e.g. `TT_SESSION', is valid, one
180      can substitute the corresponding symbol, e.g. `'TT_SESSION'.  This
181      simplifies building lists that represent messages and patterns.
182
183 \1f
184 File: lispref.info,  Node: Sending Messages,  Next: Receiving Messages,  Prev: XEmacs ToolTalk API Summary,  Up: ToolTalk Support
185
186 Sending Messages
187 ================
188
189 * Menu:
190
191 * Example of Sending Messages::
192 * Elisp Interface for Sending Messages::
193
194 \1f
195 File: lispref.info,  Node: Example of Sending Messages,  Next: Elisp Interface for Sending Messages,  Up: Sending Messages
196
197 Example of Sending Messages
198 ---------------------------
199
200    Here's a simple example that sends a query to another application
201 and then displays its reply.  Both the query and the reply are stored
202 in the first argument of the message.
203
204      (defun tooltalk-random-query-handler (msg)
205        (let ((state (get-tooltalk-message-attribute msg 'state)))
206          (cond
207            ((eq state 'TT_HANDLED)
208             (message (get-tooltalk-message-attribute msg arg_val 0)))
209            ((memq state '(TT_FAILED TT_REJECTED))
210             (message "Random query turns up nothing")))))
211      
212      (defvar random-query-message
213        '(   class TT_REQUEST
214             scope TT_SESSION
215           address TT_PROCEDURE
216                op "random-query"
217              args '((TT_INOUT "?" "string"))
218          callback tooltalk-random-query-handler))
219      
220      (let ((m (make-tooltalk-message random-query-message)))
221        (send-tooltalk-message m))
222
223 \1f
224 File: lispref.info,  Node: Elisp Interface for Sending Messages,  Prev: Example of Sending Messages,  Up: Sending Messages
225
226 Elisp Interface for Sending Messages
227 ------------------------------------
228
229  - Function: make-tooltalk-message attributes
230      Create a ToolTalk message and initialize its attributes.  The
231      value of ATTRIBUTES must be a list of alternating keyword/values,
232      where keywords are symbols that name valid message attributes.
233      For example:
234
235             (make-tooltalk-message
236               '(class TT_NOTICE
237                 scope TT_SESSION
238                 address TT_PROCEDURE
239                 op "do-something"
240                 args ("arg1" 12345 (TT_INOUT "arg3" "string"))))
241
242      Values must always be strings, integers, or symbols that represent
243      ToolTalk constants.  Attribute names are the same as those
244      supported by `set-tooltalk-message-attribute', plus `args'.
245
246      The value of `args' should be a list of message arguments where
247      each message argument has the following form:
248
249              `(mode [value [type]])' or just `value'
250
251      Where MODE is one of `TT_IN', `TT_OUT', or `TT_INOUT' and TYPE is
252      a string.  If TYPE isn't specified then `int' is used if VALUE is
253      a number; otherwise `string' is used.  If TYPE is `string' then
254      VALUE is converted to a string (if it isn't a string already) with
255      `prin1-to-string'.  If only a value is specified then MODE
256      defaults to `TT_IN'.  If MODE is `TT_OUT' then VALUE and TYPE
257      don't need to be specified.  You can find out more about the
258      semantics and uses of ToolTalk message arguments in chapter 4 of
259      the `ToolTalk Programmer's Guide'.
260
261
262  - Function: send-tooltalk-message msg
263      Send the message on its way.  Once the message has been sent it's
264      almost always a good idea to get rid of it with
265      `destroy-tooltalk-message'.
266
267
268  - Function: return-tooltalk-message msg &optional mode
269      Send a reply to this message.  The second argument can be `reply',
270      `reject' or `fail'; the default is `reply'.  Before sending a
271      reply, all message arguments whose mode is `TT_INOUT' or `TT_OUT'
272      should have been filled in--see `set-tooltalk-message-attribute'.
273
274
275  - Function: get-tooltalk-message-attribute msg attribute &optional argn
276      Returns the indicated ToolTalk message attribute.  Attributes are
277      identified by symbols with the same name (underscores and all) as
278      the suffix of the ToolTalk `tt_message_<attribute>' function that
279      extracts the value.  String attribute values are copied and
280      enumerated type values (except disposition) are converted to
281      symbols; e.g. `TT_HANDLER' is `'TT_HANDLER', `uid' and `gid' are
282      represented by fixnums (small integers), `opnum' is converted to a
283      string, and `disposition' is converted to a fixnum.  We convert
284      `opnum' (a C int) to a string (e.g. `123' => `"123"') because
285      there's no guarantee that opnums will fit within the range of
286      XEmacs Lisp integers.
287
288      [TBD] Use the `plist' attribute instead of C API `user' attribute
289      for user-defined message data.  To retrieve the value of a message
290      property, specify the indicator for ARGN.  For example, to get the
291      value of a property called `rflag', use
292
293              (get-tooltalk-message-attribute msg 'plist 'rflag)
294
295      To get the value of a message argument use one of the `arg_val'
296      (strings), `arg_ival' (integers), or `arg_bval' (strings with
297      embedded nulls), attributes.  For example, to get the integer
298      value of the third argument:
299
300              (get-tooltalk-message-attribute msg 'arg_ival 2)
301
302      As you can see, argument numbers are zero-based.  The type of each
303      arguments can be retrieved with the `arg_type' attribute; however
304      ToolTalk doesn't define any semantics for the string value of
305      `arg_type'.  Conventionally `string' is used for strings and `int'
306      for 32 bit integers.  Note that XEmacs Lisp stores the lengths of
307      strings explicitly (unlike C) so treating the value returned by
308      `arg_bval' like a string is fine.
309
310
311  - Function: set-tooltalk-message-attribute value msg attribute
312           &optional argn
313      Initialize one ToolTalk message attribute.
314
315      Attribute names and values are the same as for
316      `get-tooltalk-message-attribute'.  A property list is provided for
317      user data (instead of the `user' message attribute); see
318      `get-tooltalk-message-attribute'.
319
320      Callbacks are handled slightly differently than in the C ToolTalk
321      API.  The value of CALLBACK should be the name of a function of one
322      argument.  It will be called each time the state of the message
323      changes.  This is usually used to notice when the message's state
324      has changed to `TT_HANDLED' (or `TT_FAILED'), so that reply
325      argument values can be used.
326
327      If one of the argument attributes is specified as `arg_val',
328      `arg_ival', or `arg_bval', then ARGN must be the number of an
329      already created argument.  Arguments can be added to a message
330      with `add-tooltalk-message-arg'.
331
332
333  - Function: add-tooltalk-message-arg msg mode type &optional value
334      Append one new argument to the message.  MODE must be one of
335      `TT_IN', `TT_INOUT', or `TT_OUT', TYPE must be a string, and VALUE
336      can be a string or an integer.  ToolTalk doesn't define any
337      semantics for TYPE, so only the participants in the protocol
338      you're using need to agree what types mean (if anything).
339      Conventionally `string' is used for strings and `int' for 32 bit
340      integers.  Arguments can initialized by providing a value or with
341      `set-tooltalk-message-attribute'; the latter is necessary if you
342      want to initialize the argument with a string that can contain
343      embedded nulls (use `arg_bval').
344
345
346  - Function: create-tooltalk-message &optional no-callback
347      Create a new ToolTalk message.  The message's session attribute is
348      initialized to the default session.  Other attributes can be
349      initialized with `set-tooltalk-message-attribute'.
350      `make-tooltalk-message' is the preferred way to create and
351      initialize a message.
352
353      Optional arg NO-CALLBACK says don't add a C-level callback at all.
354      Normally don't do that; just don't specify the Lisp callback when
355      calling `make-tooltalk-message'.
356
357
358  - Function: destroy-tooltalk-message msg
359      Apply `tt_message_destroy' to the message.  It's not necessary to
360      destroy messages after they've been processed by a message or
361      pattern callback, the Lisp/ToolTalk callback machinery does this
362      for you.
363
364 \1f
365 File: lispref.info,  Node: Receiving Messages,  Prev: Sending Messages,  Up: ToolTalk Support
366
367 Receiving Messages
368 ==================
369
370 * Menu:
371
372 * Example of Receiving Messages::
373 * Elisp Interface for Receiving Messages::
374
375 \1f
376 File: lispref.info,  Node: Example of Receiving Messages,  Next: Elisp Interface for Receiving Messages,  Up: Receiving Messages
377
378 Example of Receiving Messages
379 -----------------------------
380
381    Here's a simple example of a handler for a message that tells XEmacs
382 to display a string in the mini-buffer area.  The message operation is
383 called `emacs-display-string'.  Its first (0th) argument is the string
384 to display.
385
386      (defun tooltalk-display-string-handler (msg)
387        (message (get-tooltalk-message-attribute msg 'arg_val 0)))
388      
389      (defvar display-string-pattern
390        '(category TT_HANDLE
391             scope TT_SESSION
392                op "emacs-display-string"
393          callback tooltalk-display-string-handler))
394      
395      (let ((p (make-tooltalk-pattern display-string-pattern)))
396        (register-tooltalk-pattern p))
397
398 \1f
399 File: lispref.info,  Node: Elisp Interface for Receiving Messages,  Prev: Example of Receiving Messages,  Up: Receiving Messages
400
401 Elisp Interface for Receiving Messages
402 --------------------------------------
403
404  - Function: make-tooltalk-pattern attributes
405      Create a ToolTalk pattern and initialize its attributes.  The
406      value of attributes must be a list of alternating keyword/values,
407      where keywords are symbols that name valid pattern attributes or
408      lists of valid attributes.  For example:
409
410             (make-tooltalk-pattern
411               '(category TT_OBSERVE
412                    scope TT_SESSION
413                       op ("operation1" "operation2")
414                     args ("arg1" 12345 (TT_INOUT "arg3" "string"))))
415
416      Attribute names are the same as those supported by
417      `add-tooltalk-pattern-attribute', plus `'args'.
418
419      Values must always be strings, integers, or symbols that represent
420      ToolTalk constants or lists of same.  When a list of values is
421      provided all of the list elements are added to the attribute.  In
422      the example above, messages whose `op' attribute is `"operation1"'
423      or `"operation2"' would match the pattern.
424
425      The value of ARGS should be a list of pattern arguments where each
426      pattern argument has the following form:
427
428              `(mode [value [type]])' or just `value'
429
430      Where MODE is one of `TT_IN', `TT_OUT', or `TT_INOUT' and TYPE is
431      a string.  If TYPE isn't specified then `int' is used if VALUE is
432      a number; otherwise `string' is used.  If TYPE is `string' then
433      VALUE is converted to a string (if it isn't a string already) with
434      `prin1-to-string'.  If only a value is specified then MODE
435      defaults to `TT_IN'.  If MODE is `TT_OUT' then VALUE and TYPE
436      don't need to be specified.  You can find out more about the
437      semantics and uses of ToolTalk pattern arguments in chapter 3 of
438      the `ToolTalk Programmer's Guide'.
439
440
441  - Function: register-tooltalk-pattern pattern
442      XEmacs will begin receiving messages that match this pattern.
443
444  - Function: unregister-tooltalk-pattern pattern
445      XEmacs will stop receiving messages that match this pattern.
446
447  - Function: add-tooltalk-pattern-attribute value pattern indicator
448      Add one value to the indicated pattern attribute. The names of
449      attributes are the same as the ToolTalk accessors used to set them
450      less the `tooltalk_pattern_' prefix and the `_add' suffix.  For
451      example, the name of the attribute for the
452      `tt_pattern_disposition_add' attribute is `disposition'.  The
453      `category' attribute is handled specially, since a pattern can only
454      be a member of one category (`TT_OBSERVE' or `TT_HANDLE').
455
456      Callbacks are handled slightly differently than in the C ToolTalk
457      API.  The value of CALLBACK should be the name of a function of one
458      argument.  It will be called each time the pattern matches an
459      incoming message.
460
461  - Function: add-tooltalk-pattern-arg pattern mode vtype &optional value
462      Add one fully-specified argument to a ToolTalk pattern.  MODE must
463      be one of `TT_IN', `TT_INOUT', or `TT_OUT'.  VTYPE must be a
464      string.  VALUE can be an integer, string or `nil'.  If VALUE is an
465      integer then an integer argument (`tt_pattern_iarg_add') is added;
466      otherwise a string argument is added.  At present there's no way
467      to add a binary data argument.
468
469
470  - Function: create-tooltalk-pattern
471      Create a new ToolTalk pattern and initialize its session attribute
472      to be the default session.
473
474  - Function: destroy-tooltalk-pattern pattern
475      Apply `tt_pattern_destroy' to the pattern.  This effectively
476      unregisters the pattern.
477
478  - Function: describe-tooltalk-message msg &optional stream
479      Print the message's attributes and arguments to STREAM.  This is
480      often useful for debugging.
481
482 \1f
483 File: lispref.info,  Node: LDAP Support,  Next: PostgreSQL Support,  Prev: ToolTalk Support,  Up: Top
484
485 LDAP Support
486 ************
487
488    XEmacs can be linked with a LDAP client library to provide Elisp
489 primitives to access directory servers using the Lightweight Directory
490 Access Protocol.
491
492 * Menu:
493
494 * Building XEmacs with LDAP support::  How to add LDAP support to XEmacs
495 * XEmacs LDAP API::             Lisp access to LDAP functions
496 * Syntax of Search Filters::    A brief summary of RFC 1558
497
498 \1f
499 File: lispref.info,  Node: Building XEmacs with LDAP support,  Next: XEmacs LDAP API,  Prev: LDAP Support,  Up: LDAP Support
500
501 Building XEmacs with LDAP support
502 =================================
503
504    LDAP support must be added to XEmacs at build time since it requires
505 linking to an external LDAP client library.  As of 21.2, XEmacs has been
506 successfully built and tested with
507
508    * OpenLDAP 1.2 (<http://www.openldap.org/>)
509
510    * University of Michigan's LDAP 3.3
511      (<http://www.umich.edu/~dirsvcs/ldap/>)
512
513    * LDAP SDK 1.0 from Netscape Corp. (<http://developer.netscape.com/>)
514
515    Other libraries conforming to RFC 1823 will probably work also but
516 may require some minor tweaking at C level.
517
518    The standard XEmacs configure script auto-detects an installed LDAP
519 library provided the library itself and the corresponding header files
520 can be found in the library and include paths.  A successful detection
521 will be signalled in the final output of the configure script.
522
523 \1f
524 File: lispref.info,  Node: XEmacs LDAP API,  Next: Syntax of Search Filters,  Prev: Building XEmacs with LDAP support,  Up: LDAP Support
525
526 XEmacs LDAP API
527 ===============
528
529    XEmacs LDAP API consists of two layers:  a low-level layer which
530 tries to stay as close as possible to the C API (where practical) and a
531 higher-level layer which provides more convenient primitives to
532 effectively use LDAP.
533
534    The low-level API should be used directly for very specific purposes
535 (such as multiple operations on a connection) only.  The higher-level
536 functions provide a more convenient way to access LDAP directories
537 hiding the subtleties of handling the connection, translating arguments
538 and ensuring compliance with LDAP internationalization rules and formats
539 (currently partly implemented only).
540
541 * Menu:
542
543 * LDAP Variables::              Lisp variables related to LDAP
544 * The High-Level LDAP API::     High-level LDAP lisp functions
545 * The Low-Level LDAP API::      Low-level LDAP lisp primitives
546 * LDAP Internationalization::   I18n variables and functions
547
548 \1f
549 File: lispref.info,  Node: LDAP Variables,  Next: The High-Level LDAP API,  Prev: XEmacs LDAP API,  Up: XEmacs LDAP API
550
551 LDAP Variables
552 --------------
553
554  - Variable: ldap-default-host
555      The default LDAP server hostname.  A TCP port number can be
556      appended to that name using a colon as a separator.
557
558  - Variable: ldap-default-port
559      Default TCP port for LDAP connections.  Initialized from the LDAP
560      library. Default value is 389.
561
562  - Variable: ldap-default-base
563      Default base for LDAP searches.  This is a string using the syntax
564      of RFC 1779.  For instance, "o=ACME, c=US" limits the search to the
565      Acme organization in the United States.
566
567  - Variable: ldap-host-parameters-alist
568      An alist of per host options for LDAP transactions.  The list
569      elements look like `(HOST PROP1 VAL1 PROP2 VAL2 ...)' HOST is the
570      name of an LDAP server. A TCP port number can be appended to that
571      name using a colon as a separator.  PROPN and VALN are
572      property/value pairs describing parameters for the server.  Valid
573      properties:
574     `binddn'
575           The distinguished name of the user to bind as.  This may look
576           like `cn=Babs Jensen,o=ACME,c=US', see RFC 1779 for details.
577
578     `passwd'
579           The password to use for authentication.
580
581     `auth'
582           The authentication method to use, possible values depend on
583           the LDAP library XEmacs was compiled with, they may include
584           `simple', `krbv41' and `krbv42'.
585
586     `base'
587           The base for the search. This may look like `cÿ, o¬me', see
588           RFC 1779 for syntax details.
589
590     `scope'
591           One of the symbols `base', `onelevel' or `subtree' indicating
592           the scope of the search limited to a base object, to a single
593           level or to the whole subtree.
594
595     `deref'
596           The dereference policy is one of the symbols `never',
597           `always', `search' or `find' and defines how aliases are
598           dereferenced.
599          `never'
600                Aliases are never dereferenced
601
602          `always'
603                Aliases are always dereferenced
604
605          `search'
606                Aliases are dereferenced when searching
607
608          `find'
609                Aliases are dereferenced when locating the base object
610                for the search
611
612     `timelimit'
613           The timeout limit for the connection in seconds.
614
615     `sizelimit'
616           The maximum number of matches to return for searches
617           performed on this connection.
618
619  - Variable: ldap-verbose
620      If non-`nil', LDAP operations will echo progress messages.
621      Defaults to `nil'.
622
623 \1f
624 File: lispref.info,  Node: The High-Level LDAP API,  Next: The Low-Level LDAP API,  Prev: LDAP Variables,  Up: XEmacs LDAP API
625
626 The High-Level LDAP API
627 -----------------------
628
629    The following functions provide the most convenient interface to
630 perform LDAP operations.  All of them open a connection to a host,
631 perform an operation (add/search/modify/delete) on one or several
632 entries and cleanly close the connection thus insulating the user from
633 all the details of the low-level interface such as LDAP Lisp objects
634 *note The Low-Level LDAP API::.
635
636    Note that `ldap-search' which used to be the name of the high-level
637 search function in XEmacs 21.1 is now obsolete.  For consistency  in the
638 naming as well as backward compatibility, that function now acts as a
639 wrapper that calls either `ldap-search-basic' (low-level search
640 function) or `ldap-search-entries' (high-level search function)
641 according to the actual parameters.  A direct call to one of these two
642 functions is preferred since it is faster and unambiguous.
643
644  - Command: ldap-search-entries filter &optional host attributes
645           attrsonly withdn
646      Perform an LDAP search.  FILTER is the search filter *note Syntax
647      of Search Filters:: HOST is the LDAP host on which to perform the
648      search.  ATTRIBUTES is the specific attributes to retrieve, `nil'
649      means retrieve all.  ATTRSONLY if non-`nil' retrieves the
650      attributes only without their associated values.  If WITHDN is
651      non-`nil' each entry in the result will be prepended with its
652      distinguished name DN.  Additional search parameters can be
653      specified through `ldap-host-parameters-alist'.  The function
654      returns a list of matching entries.  Each entry is itself an alist
655      of attribute/value pairs optionally preceded by the DN of the
656      entry according to the value of WITHDN.
657
658  - Function: ldap-add-entries entries &optional host binddn passwd
659      Add entries to an LDAP directory.  ENTRIES is a list of entry
660      specifications of the form `(DN (ATTR . VALUE) (ATTR . VALUE) ...)'
661      where DN the distinguished name of an entry to add, the following
662      are cons cells containing attribute/value string pairs.  HOST is
663      the LDAP host, defaulting to `ldap-default-host'.  BINDDN is the
664      DN to bind as to the server.  PASSWD is the corresponding password.
665
666  - Function: ldap-modify-entries entry-mods &optional host binddn passwd
667      Modify entries of an LDAP directory.  ENTRY_MODS is a list of
668      entry modifications of the form `(DN MOD-SPEC1 MOD-SPEC2 ...)'
669      where DN is the distinguished name of the entry to modify, the
670      following are modification specifications.  A modification
671      specification is itself a list of the form `(MOD-OP ATTR VALUE1
672      VALUE2 ...)' MOD-OP and ATTR are mandatory, VALUES are optional
673      depending on MOD-OP.  MOD-OP is the type of modification, one of
674      the symbols `add', `delete' or `replace'. ATTR is the LDAP
675      attribute type to modify.  HOST is the LDAP host, defaulting to
676      `ldap-default-host'.  BINDDN is the DN to bind as to the server.
677      PASSWD is the corresponding password.
678
679  - Function: ldap-delete-entries dn &optional host binddn passwd
680      Delete an entry from an LDAP directory.  DN is the distinguished
681      name of an entry to delete or a list of those.  HOST is the LDAP
682      host, defaulting to `ldap-default-host'.  BINDDN is the DN to bind
683      as to the server.  PASSWD is the corresponding password.
684
685 \1f
686 File: lispref.info,  Node: The Low-Level LDAP API,  Next: LDAP Internationalization,  Prev: The High-Level LDAP API,  Up: XEmacs LDAP API
687
688 The Low-Level LDAP API
689 ----------------------
690
691    The low-level API should be used directly for very specific purposes
692 (such as multiple operations on a connection) only.  The higher-level
693 functions provide a more convenient way to access LDAP directories
694 hiding the subtleties of handling the connection, translating arguments
695 and ensuring compliance with LDAP internationalization rules and formats
696 (currently partly implemented only). See *note The High-Level LDAP API::
697
698    Note that the former functions `ldap-*-internal' functions have been
699 renamed in XEmacs 21.2
700
701 * Menu:
702
703 * The LDAP Lisp Object::
704 * Opening and Closing a LDAP Connection::
705 * Low-level Operations on a LDAP Server::
706
707 \1f
708 File: lispref.info,  Node: The LDAP Lisp Object,  Next: Opening and Closing a LDAP Connection,  Prev: The Low-Level LDAP API,  Up: The Low-Level LDAP API
709
710 The LDAP Lisp Object
711 ....................
712
713    An internal built-in `ldap' lisp object represents a LDAP connection.
714
715  - Function: ldapp object
716      This function returns non-`nil' if OBJECT is a `ldap' object.
717
718  - Function: ldap-host ldap
719      Return the server host of the connection represented by LDAP.
720
721  - Function: ldap-live-p ldap
722      Return non-`nil' if LDAP is an active LDAP connection.
723
724 \1f
725 File: lispref.info,  Node: Opening and Closing a LDAP Connection,  Next: Low-level Operations on a LDAP Server,  Prev: The LDAP Lisp Object,  Up: The Low-Level LDAP API
726
727 Opening and Closing a LDAP Connection
728 .....................................
729
730  - Function: ldap-open host &optional plist
731      Open a LDAP connection to HOST.  PLIST is a property list
732      containing additional parameters for the connection.  Valid keys
733      in that list are:
734     `port'
735           The TCP port to use for the connection if different from
736           `ldap-default-port' or the library builtin value
737
738     `auth'
739           The authentication method to use, possible values depend on
740           the LDAP library XEmacs was compiled with, they may include
741           `simple', `krbv41' and `krbv42'.
742
743     `binddn'
744           The distinguished name of the user to bind as.  This may look
745           like `c=com, o=Acme, cn=Babs Jensen', see RFC 1779 for
746           details.
747
748     `passwd'
749           The password to use for authentication.
750
751     `deref'
752           The dereference policy is one of the symbols `never',
753           `always', `search' or `find' and defines how aliases are
754           dereferenced.
755          `never'
756                Aliases are never dereferenced.
757
758          `always'
759                Aliases are always dereferenced.
760
761          `search'
762                Aliases are dereferenced when searching.
763
764          `find'
765                Aliases are dereferenced when locating the base object
766                for the search.  The default is `never'.
767
768     `timelimit'
769           The timeout limit for the connection in seconds.
770
771     `sizelimit'
772           The maximum number of matches to return for searches
773           performed on this connection.
774
775  - Function: ldap-close ldap
776      Close the connection represented by LDAP.
777
778 \1f
779 File: lispref.info,  Node: Low-level Operations on a LDAP Server,  Prev: Opening and Closing a LDAP Connection,  Up: The Low-Level LDAP API
780
781 Low-level Operations on a LDAP Server
782 .....................................
783
784    `ldap-search-basic' is the low-level primitive to perform a search
785 on a LDAP server.  It works directly on an open LDAP connection thus
786 requiring a preliminary call to `ldap-open'.  Multiple searches can be
787 made on the same connection, then the session must be closed with
788 `ldap-close'.
789
790  - Function: ldap-search-basic ldap filter &optional base scope attrs
791           attrsonly withdn verbose
792      Perform a search on an open connection LDAP created with
793      `ldap-open'.  FILTER is a filter string for the search *note
794      Syntax of Search Filters:: BASE is the distinguished name at which
795      to start the search.  SCOPE is one of the symbols `base',
796      `onelevel' or `subtree' indicating the scope of the search limited
797      to a base object, to a single level or to the whole subtree.  The
798      default is `subtree'.  ATTRS is a list of strings indicating which
799      attributes to retrieve for each matching entry. If `nil' all
800      available attributes are returned.  If ATTRSONLY is non-`nil' then
801      only the attributes are retrieved, not their associated values.
802      If WITHDN is non-`nil' then each entry in the result is prepended
803      with its distinguished name DN.  If VERBOSE is non-`nil' then
804      progress messages are echoed The function returns a list of
805      matching entries.  Each entry  is itself an alist of
806      attribute/value pairs optionally preceded by the DN of the entry
807      according to the value of WITHDN.
808
809  - Function: ldap-add ldap dn entry
810      Add ENTRY to a LDAP directory which a connection LDAP has been
811      opened to with `ldap-open'.  DN is the distinguished name of the
812      entry to add.  ENTRY is an entry specification, i.e., a list of
813      cons cells containing attribute/value string pairs.
814
815  - Function: ldap-modify ldap dn mods
816      Modify an entry in an LDAP directory.  LDAP is an LDAP connection
817      object created with `ldap-open'.  DN is the distinguished name of
818      the entry to modify.  MODS is a list of modifications to apply.  A
819      modification is a list of the form `(MOD-OP ATTR VALUE1 VALUE2
820      ...)'  MOD-OP and ATTR are mandatory, VALUES are optional
821      depending on MOD-OP.  MOD-OP is the type of modification, one of
822      the symbols `add', `delete' or `replace'. ATTR is the LDAP
823      attribute type to modify.
824
825  - Function: ldap-delete ldap dn
826      Delete an entry to an LDAP directory.  LDAP is an LDAP connection
827      object created with `ldap-open'.  DN is the distinguished name of
828      the entry to delete.
829
830 \1f
831 File: lispref.info,  Node: LDAP Internationalization,  Prev: The Low-Level LDAP API,  Up: XEmacs LDAP API
832
833 LDAP Internationalization
834 -------------------------
835
836    The XEmacs LDAP API provides basic internationalization features
837 based on the LDAP v3 specification (essentially RFC2252 on "LDAP v3
838 Attribute Syntax Definitions").  Unfortunately since there is currently
839 no free LDAP v3 server software, this part has not received much
840 testing and should be considered experimental.  The framework is in
841 place though.
842
843  - Function: ldap-decode-attribute attr
844      Decode the attribute/value pair ATTR according to LDAP rules.  The
845      attribute name is looked up in `ldap-attribute-syntaxes-alist' and
846      the corresponding decoder is then retrieved from
847      `ldap-attribute-syntax-decoders'' and applied on the value(s).
848
849 * Menu:
850
851 * LDAP Internationalization Variables::
852 * Encoder/Decoder Functions::
853
854 \1f
855 File: lispref.info,  Node: LDAP Internationalization Variables,  Next: Encoder/Decoder Functions,  Prev: LDAP Internationalization,  Up: LDAP Internationalization
856
857 LDAP Internationalization Variables
858 ...................................
859
860  - Variable: ldap-ignore-attribute-codings
861      If non-`nil', no encoding/decoding will be performed LDAP
862      attribute values
863
864  - Variable: ldap-coding-system
865      Coding system of LDAP string values.  LDAP v3 specifies the coding
866      system of strings to be UTF-8.  You need an XEmacs with Mule
867      support for this.
868
869  - Variable: ldap-default-attribute-decoder
870      Decoder function to use for attributes whose syntax is unknown.
871      Such a function receives an encoded attribute value as a string
872      and should return the decoded value as a string.
873
874  - Variable: ldap-attribute-syntax-encoders
875      A vector of functions used to encode LDAP attribute values.  The
876      sequence of functions corresponds to the sequence of LDAP
877      attribute syntax object identifiers of the form
878      1.3.6.1.4.1.1466.1115.121.1.* as defined in RFC2252 section 4.3.2.
879      As of this writing, only a few encoder functions are available.
880
881  - Variable: ldap-attribute-syntax-decoders
882      A vector of functions used to decode LDAP attribute values.  The
883      sequence of functions corresponds to the sequence of LDAP
884      attribute syntax object identifiers of the form
885      1.3.6.1.4.1.1466.1115.121.1.* as defined in RFC2252 section 4.3.2.
886      As of this writing, only a few decoder functions are available.
887
888  - Variable: ldap-attribute-syntaxes-alist
889      A map of LDAP attribute names to their type object id minor number.
890      This table is built from RFC2252 Section 5 and RFC2256 Section 5.
891
892 \1f
893 File: lispref.info,  Node: Encoder/Decoder Functions,  Prev: LDAP Internationalization Variables,  Up: LDAP Internationalization
894
895 Encoder/Decoder Functions
896 .........................
897
898  - Function: ldap-encode-boolean bool
899      A function that encodes an elisp boolean BOOL into a LDAP boolean
900      string representation.
901
902  - Function: ldap-decode-boolean str
903      A function that decodes a LDAP boolean string representation STR
904      into an elisp boolean.
905
906  - Function: ldap-decode-string str
907      Decode a string STR according to LDAP-CODING-SYSTEM.
908
909  - Function: ldap-encode-string str
910      Encode a string STR according to LDAP-CODING-SYSTEM.
911
912  - Function: ldap-decode-address str
913      Decode an address STR according to LDAP-CODING-SYSTEM and
914      replacing $ signs with newlines as specified by LDAP encoding
915      rules for addresses.
916
917  - Function: ldap-encode-address str
918      Encode an address STR according to LDAP-CODING-SYSTEM and
919      replacing newlines with $ signs as specified by LDAP encoding
920      rules for addresses.
921
922 \1f
923 File: lispref.info,  Node: Syntax of Search Filters,  Prev: XEmacs LDAP API,  Up: LDAP Support
924
925 Syntax of Search Filters
926 ========================
927
928    LDAP search functions use RFC1558 syntax to describe the search
929 filter.  In that syntax simple filters have the form:
930
931      (<attr> <filtertype> <value>)
932
933    `<attr>' is an attribute name such as `cn' for Common Name, `o' for
934 Organization, etc...
935
936    `<value>' is the corresponding value.  This is generally an exact
937 string but may also contain `*' characters as wildcards
938
939    `filtertype' is one `=' `~=', `<=', `>=' which respectively describe
940 equality, approximate equality, inferiority and superiority.
941
942    Thus `(cn=John Smith)' matches all records having a canonical name
943 equal to John Smith.
944
945    A special case is the presence filter `(<attr>=*' which matches
946 records containing a particular attribute.  For instance `(mail=*)'
947 matches all records containing a `mail' attribute.
948
949    Simple filters can be connected together with the logical operators
950 `&', `|' and `!' which stand for the usual and, or and not operators.
951
952    `(&(objectClass=Person)(mail=*)(|(sn=Smith)(givenname=John)))'
953 matches records of class `Person' containing a `mail' attribute and
954 corresponding to people whose last name is `Smith' or whose first name
955 is `John'.
956
957 \1f
958 File: lispref.info,  Node: PostgreSQL Support,  Next: Internationalization,  Prev: LDAP Support,  Up: Top
959
960 PostgreSQL Support
961 ******************
962
963    XEmacs can be linked with PostgreSQL libpq run-time support to
964 provide relational database access from Emacs Lisp code.
965
966 * Menu:
967
968 * Building XEmacs with PostgreSQL support::
969 * XEmacs PostgreSQL libpq API::
970 * XEmacs PostgreSQL libpq Examples::
971
972 \1f
973 File: lispref.info,  Node: Building XEmacs with PostgreSQL support,  Next: XEmacs PostgreSQL libpq API,  Up: PostgreSQL Support
974
975 Building XEmacs with PostgreSQL support
976 =======================================
977
978    XEmacs PostgreSQL support requires linking to the PostgreSQL libpq
979 library.  Describing how to build and install PostgreSQL is beyond the
980 scope of this document.  See the PostgreSQL manual for details.
981
982    If you have installed XEmacs from one of the binary kits on
983 (<ftp://ftp.xemacs.org/>), or are using an XEmacs binary from a CD ROM,
984 you may have XEmacs PostgreSQL support by default.  `M-x
985 describe-installation' will tell you if you do.
986
987    If you are building XEmacs from source, you need to install
988 PostgreSQL first.  On some systems, PostgreSQL will come pre-installed
989 in /usr.  In this case, it should be autodetected when you run
990 configure.  If PostgreSQL is installed into its default location,
991 `/usr/local/pgsql', you must specify `--site-prefixes=/usr/local/pgsql'
992 when you run configure.  If PostgreSQL is installed into another
993 location, use that instead of `/usr/local/pgsql' when specifying
994 `--site-prefixes'.
995
996    As of XEmacs 21.2, PostgreSQL versions 6.5.3 and 7.0 are supported.
997 XEmacs Lisp support for V7.0 is somewhat more extensive than support for
998 V6.5.  In particular, asynchronous queries are supported.
999
1000 \1f
1001 File: lispref.info,  Node: XEmacs PostgreSQL libpq API,  Next: XEmacs PostgreSQL libpq Examples,  Prev: Building XEmacs with PostgreSQL support,  Up: PostgreSQL Support
1002
1003 XEmacs PostgreSQL libpq API
1004 ===========================
1005
1006    The XEmacs PostgreSQL API is intended to be a policy-free, low-level
1007 binding to libpq.  The intent is to provide all the basic functionality
1008 and then let high level Lisp code decide its own policies.
1009
1010    This documentation assumes that the reader has knowledge of SQL, but
1011 requires no prior knowledge of libpq.
1012
1013    There are many examples in this manual and some setup will be
1014 required.  In order to run most of the following examples, the
1015 following code needs to be executed.  In addition to the data is in
1016 this table, nearly all of the examples will assume that the free
1017 variable `P' refers to this database connection.  The examples in the
1018 original edition of this manual were run against Postgres 7.0beta1.
1019
1020      (progn
1021        (setq P (pq-connectdb ""))
1022        ;; id is the primary key, shikona is a Japanese word that
1023        ;; means `the professional name of a Sumo wrestler', and
1024        ;; rank is the Sumo rank name.
1025        (pq-exec P (concat "CREATE TABLE xemacs_test"
1026                           " (id int, shikona text, rank text);"))
1027        (pq-exec P "COPY xemacs_test FROM stdin;")
1028        (pq-put-line P "1\tMusashimaru\tYokuzuna\n")
1029        (pq-put-line P "2\tDejima\tOozeki\n")
1030        (pq-put-line P "3\tMusoyama\tSekiwake\n")
1031        (pq-put-line P "4\tMiyabiyama\tSekiwake\n")
1032        (pq-put-line P "5\tWakanoyama\tMaegashira\n")
1033        (pq-put-line P "\\.\n")
1034        (pq-end-copy P))
1035           => nil
1036
1037 * Menu:
1038
1039 * libpq Lisp Variables::
1040 * libpq Lisp Symbols and DataTypes::
1041 * Synchronous Interface Functions::
1042 * Asynchronous Interface Functions::
1043 * Large Object Support::
1044 * Other libpq Functions::
1045 * Unimplemented libpq Functions::
1046
1047 \1f
1048 File: lispref.info,  Node: libpq Lisp Variables,  Next: libpq Lisp Symbols and DataTypes,  Prev: XEmacs PostgreSQL libpq API,  Up: XEmacs PostgreSQL libpq API
1049
1050 libpq Lisp Variables
1051 --------------------
1052
1053    Various Unix environment variables are used by libpq to provide
1054 defaults to the many different parameters.  In the XEmacs Lisp API,
1055 these environment variables are bound to Lisp variables to provide more
1056 convenient access to Lisp Code.  These variables are passed to the
1057 backend database server during the establishment of a database
1058 connection and when the `pq-setenv' call is made.
1059
1060  - Variable: pg:host
1061      Initialized from the PGHOST environment variable.  The default
1062      host to connect to.
1063
1064  - Variable: pg:user
1065      Initialized from the PGUSER environment variable.  The default
1066      database user name.
1067
1068  - Variable: pg:options
1069      Initialized from the PGOPTIONS environment variable.  Default
1070      additional server options.
1071
1072  - Variable: pg:port
1073      Initialized from the PGPORT environment variable.  The default TCP
1074      port to connect to.
1075
1076  - Variable: pg:tty
1077      Initialized from the PGTTY environment variable.  The default
1078      debugging TTY.
1079
1080      Compatibility note:  Debugging TTYs are turned off in the XEmacs
1081      Lisp binding.
1082
1083  - Variable: pg:database
1084      Initialized from the PGDATABASE environment variable.  The default
1085      database to connect to.
1086
1087  - Variable: pg:realm
1088      Initialized from the PGREALM environment variable.  The default
1089      Kerberos realm.
1090
1091  - Variable: pg:client-encoding
1092      Initialized from the PGCLIENTENCODING environment variable.  The
1093      default client encoding.
1094
1095      Compatibility note:  This variable is not present in non-Mule
1096      XEmacsen.  This variable is not present in versions of libpq prior
1097      to 7.0.  In the current implementation, client encoding is
1098      equivalent to the `file-name-coding-system' format.
1099
1100  - Variable: pg:authtype
1101      Initialized from the PGAUTHTYPE environment variable.  The default
1102      authentication scheme used.
1103
1104      Compatibility note:  This variable is unused in versions of libpq
1105      after 6.5.  It is not implemented at all in the XEmacs Lisp
1106      binding.
1107
1108  - Variable: pg:geqo
1109      Initialized from the PGGEQO environment variable.  Genetic
1110      optimizer options.
1111
1112  - Variable: pg:cost-index
1113      Initialized from the PGCOSTINDEX environment variable.  Cost index
1114      options.
1115
1116  - Variable: pg:cost-heap
1117      Initialized from the PGCOSTHEAP environment variable.  Cost heap
1118      options.
1119
1120  - Variable: pg:tz
1121      Initialized from the PGTZ environment variable.  Default timezone.
1122
1123  - Variable: pg:date-style
1124      Initialized from the PGDATESTYLE environment variable.  Default
1125      date style in returned date objects.
1126
1127  - Variable: pg-coding-system
1128      This is a variable controlling which coding system is used to
1129      encode non-ASCII strings sent to the database.
1130
1131      Compatibility Note: This variable is not present in InfoDock.
1132