| ★ wanayoo — archive 1999 http://bigloo-lib.sourceforge.net/ | Nouvelle recherche | Portail wanayoo |
Currently the package includes the following libraries:
Also the following packages are to be included soon :
The current version of bigloo-lib is 0.13, is compatible
with `bigloo2.1b' and `bigloo2.2a'.
http://bigloo-lib.sourceforge.net
Currently the site contents is bigloo-lib documentation,
converted by texi2html.
Maintained automagically by SourceForge software:
http://sourceforge.net/project/?group_id=3455
While the package is in alpha development state, the documentation you
may see at project WEB site may differ from that provided with last
bigloo-lib release. Usually the documentation describes the
development "bleeding edge", some of the features described here will be
visible in the next releases only. Use the documentation
included into the package.
http://sourceforge.net/project/filelist.php?group_id=3455
This project's CVS repository can be checked out through anonymous (pserver) CVS with the following instruction set. When prompted for a password for anonymous, simply press the Enter key.
cvs -d:pserver:anonymous@cvs.bigloo-lib.sourceforge.net:/cvsroot/bigloo-lib login cvs -d:pserver:anonymous@cvs.bigloo-lib.sourceforge.net:/cvsroot/bigloo-lib co .
Also, you can browse the CVS tree with CVSWEB
http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi?cvsroot=bigloo-lib
Daily tarballs of entire project CVS Repository are available at
http://cvs.sourceforge.net/cvstarballs/bigloo-lib-cvsroot.tar.gz
mailto:bigloo-lib-devel@lists.sourceforge.net
https://sourceforge.net/bugs/?group_id=3455
All the libraries are compiled, linked and installed using GNU
libtool. libtool makes its own decision about flags it
send to the linker. As a result, the path to installed libraries
(/usr/local/lib/bigloo by default) is not compiled into the
libraries, so you need to care about it by yourself (set either the
LD_LIBRARY_PATH or LD_RUN_PATH environment variable or
edit /etc/ld.so.conf file). See the messages libtool
prints while it installs the libraries (1).
The Common library is a set of miscellaneous types and procedures. Some
other bigloo-lib's libraries require it. This library
includes:
At the moment, the stuff was selected based only on my own practical needs in course of working on some Web-related projects. By this reason, the library is not (and probably never will be) completed.
Also, though a few Bigloo procedures are re-implemented in this library, in no case this library replaces the Bigloo runtime library.
This section describes the regex module, which provides an
interface to C runtime regex functions.
The regex module is optional, i.e. you can disable its
compilation by using --without-regexp flag for
configure. Or the configure may detect that regexps are
broken on your system and disable this feature automatically.
To let you detect whether you have regexps from inside the
interpreted code, the 'regexp symbol is defined through the
register-eval-srfi! construct, so you can test it with
cond-expand. For example, the common library test script
conditionally includes the regexp-test call:
(cond-expand (regexp (regexp-test)) (else (print "regexps are disabled by configure")))
Procedures described here are direct interfaces to corresponding C runtime calls. You probably do not want to use them in end-user applications.
Compile pattern string into previously allocated preg regexp structure.
Given the error code, returned by regcomp or regexec,
return the error description.
(regerror 'erange (regexp " ")) => "invalid endpoint in range"
Free the memory allocated to the rexp by the regcomp.
The procedures described here, are intended for end-user applications. They are compatible to those implemented in MzScheme.
regexp constructor. Allocate regexp object and compile the
string given in str argument into regular expression object. Raise
an exception if something goes wrong during the compilation.
The optional flags arguments may be any of the
following symbols (see regcomp manual page) :
regex(7) for details.
notbol.
Match-end-of-line operator ($) matches the empty string immediately
before a newline, regardless of whether eflags argument of
matching function contains noteol.
Simple regexp creation example:
(regexp "q") => #<foreign:REGEXP:21490>
(regexp "(") error--> "( ) or \( \) imbalance -- ("
Simple vs. case insensitive match example:
(define rexp(regexp "qwerty")) (regexp-match rexp "QWERTY") => #f (define rexp(regexp "qwerty" 'icase)) (regexp-match rexp "QWERTY") => (QWERTY)
Basic vs. Extended regexp match example:
(define rexp(regexp "a|b" '(basic)))
(regexp-match rexp "a|b")
=> ("a|b")
(define rexp(regexp "a|b")) ;; 'extended flag set by default
(regexp-match rexp "a|b")
=> ("a")
Using of nosub flag example:
(define rexp(regexp "qwerty" 'nosub)) (regexp-match rexp "qwerty") => ()
Return #f if string str does not match
pattern. Otherwise return the list object. Unless the nosub
flag was given, the list has at least one element, the whole match
substring found. The rest elements are partial sub-matches. The
pattern argument must be either regexp or scheme string. In
later case pattern is compiled into temporary regexp object,
which is automatically released.
Example:
(regexp-match "q" "asdf") => #f (regexp-match "q" "qwerty") => (q) (regexp-match "([a-z]+)([0-9]+)" "qwerty1234") => (qwerty1234 qwerty 1234)
The optional argument offset allows to skip first offset characters from the beginning of matched string, for example:
(regexp-match "[a-z]+" "qwerty") ;; offset=0 => (qwerty) (regexp-match "[a-z]+" "qwerty" 2) => (erty)
The optional eflag arguments may be any of the following symbols
:
newline above). This flag may be used when
different portions of a string are passed to regexec and the beginning
of the string should not be interpreted as the beginning of the line.
newline above)
(define rexp(regexp "^qwerty"))
(regexp-match rexp "qwerty") ;; BOL matches as usual
=> ("qwerty")
(regexp-match-positions rexp "qwerty" 0 'notbol)
=> #f ;; BOL match suppressed
Same as regexp-match, but returns the matched substrings position
inside the source string instead of substrings itself, for example:
(regexp-match-positions "q" "asdf") => #f (regexp-match-positions "q" "qwerty") => ((0 . 1)) (regexp-match-positions "([a-z]+)([0-9]+)" "qwerty1234") => ((0 . 10) (0 . 6) (6 . 10))
Return copy of src string where all occurrences of pattern are replaces by insert string.
(regexp-replace* "[a-z]" "1a2b3c" " Letter ") => "1 Letter 2 Letter 3 Letter "
Note: no context replacements are currently implemented. For example:
(regexp-replace* "[a-z]" "1a2b3c" " Letter &") => "Letter &2 Letter &3 Letter &"
but not "1 Letter a2 Letter b3 Letter c", as one may expect.
This section describes the mzcompat module, which provides a few
procedures to reuse the code written for MzScheme interpreter.
The mzcompat module is optional and is disabled by default. To
enable, call configure with --with-compat.
To let you detect whether you have mzcompat module included
from inside the interpreted code, the 'mzscheme-compat symbol is
defined through the register-eval-srfi! construct, so you can
test it with cond-expand. For example, the common library
test script conditionally includes the regexp-test call:
(cond-expand (mzscheme-compat (mzscheme-test)) (else (print "MzScheme compatibility is disabled by configure")))
The simple analog of match-lambda construction. Expands to
lambda-functions with variable number of arguments. The execution flow
depends on number of arguments only only.
Example:
(define print-args
(case-lambda
(()
(print "no args given"))
((a)
(print "one argument only: " a))
(args
(print "a number of arguments is: "(length args)))))
(print-args)
-| no args given
(print-args 'one)
-| one argument only: ONE
(print-args 'one 'two 'three)
-| a number of arguments is: 3
Does nothing in Bigloo
Creates a closure, which being called without arguments returns the
value value, being called with one argument, sets the variable
value to new value. If filter argument of type
procedure is provided, the new value is passed to that procedure,
and procedure return is stored in value variable.
(define my-value (make-parameter 0))
=> #<procedure:400edad0.-1>
(my-value)
=> 0
(my-value 1)
(my-value)
=> 1
;; the following procedure always converts its argument
;; to string before remembering it
(define my-string-value
(make-parameter
""
(lambda(o)
(cond((string? o)
o)
((number? o)
(number->string o))
(else(error "my-string-value" "invalid argument"o))))))
(my-string-value 1)
(pp(my-string-value))
-| #"1"
In MzScheme parameters have their own type and are scoped to execution threads. Since Bigloo does not provide multi-threading, in Bigloo parameters are just procedures.
Alias to Bigloo directory? procedure
Create the new directory path with access mask mask. The default value of mask is #o0777.
Read at most count characters from port. Unlimited number of characters is read from current input port by default.
Get or set the application process current directory.
(current-directory) => /usr/wowa/jet.projects/development/bigloo-lib-0.12/docs
Construct the directory name from path elements chunks. Each chunk may be the path by itself, i.e. include the slash character. Chunk should not start with slash character, i.e. all sub-paths must be relative.
Example:
(build-path "/a/b/c" "d/e/f" "y") => "/a/b/c/d/e/f/y" (build-path "/a/b/c" "/d/e/f" "y") error--> absolute paths cannot be appended: /d/e/f
TBD
Bigloo-lib provides a limited support for string-lib, the
SRFI-13 string library. The limitations are as follows:
string-compare,
string-compare-ci (really I did not understand the specification).
The rest of this chapter is based mostly on original SRFI document, copyrighted by Olin Shivers. The original SRFI documnet copyright statement you will find at the end of the chapter.
In the following procedure specifications:
s parameter is a string.
char parameter is a character.
start and end parameters are half-open string indices
specifying a substring within a string parameter; when optional, they
default to 0 and the length of the string, respectively. When specified,
it must be the case that 0 <= start <= end <=
(string-length S), for the corresponding parameter s. They
typically restrict a procedure's action to the indicated substring.
pred parameter is a unary character predicate procedure, returning a
true/false value when applied to a character.
char/char-set/pred parameter is a value used to select/search for a
character in a string. If it is a character, it is used in an equality
test; if it is a character set, it is used as a membership test; if it
is a procedure, it is applied to the characters as a test predicate.
i parameter is an exact non-negative integers specifying an index
into a string.
len and ncharsparameters are exact non-negative integers specifying a
length of a string or some number of characters.
Passing values to procedures with these parameters that do not satisfy these types is an error.
Is s the empty string?
(string-null? "") => #t
Checks to see if predicate pred is true of every character in S,
proceeding from left (index start) to right (index end).
If STRING-EVERY returns true, the returned true value is the one
produced by the final application of pred to S[end]. If
STRING-EVERY is applied to an empty sequence of characters, it simply
returns #t.
Checks to see if predicate pred is true of any character in S,
proceeding from left (index start) to right (index end).
If STRING-ANY returns true, the returned true value is the one produced
by the application of pred.
(string-every values "qwerty") =>
proc is an integer->char procedure. Construct a string of
size len by applying proc to each index to produce the
corresponding string element. The order in which proc is applied
to the indices is not specified.
Example:
(string-tabulate (lambda(i)(integer->char(+fx i 32))) 20) => " !\"#$%&'()*+,-./0123"
string->list returns a newly allocated list of the characters
that make up the given string. list->string returns a newly
allocated string formed from the characters in the list
char-list, which must be a list of
characters. string->list and list->string are inverses so
far as equal? is concerned.
string->list is extended from the R5RS definition to take optional
start/end arguments.
(string->list "asdf") => (#\a #\s #\d #\f)
An efficient implementation of (compose string->list reverse):
(reverse-list->string '(#\a #\B #\c)) => "cBa"
This is a common idiom in the epilog of string-processing loops
that accumulate an answer in a reverse-order list. (See also
reverse-string-concatenate for the "chunked" variant.)
This procedure is a simple unparser - it pastes strings together using the delimiter string.
The grammar argument is a symbol that determines how the delimiter is used, and defaults to 'infix.
'infix
means an infix or separator grammar: insert the delimiter
between list elements. An empty list will produce an empty string --
note, however, that parsing an empty string with an infix or separator
grammar is ambiguous. Is it an empty list, or a list of one element,
the empty string?
'strict-infix
means the same as 'infix, but will raise an error if given an
empty list.
'suffix
means a suffix or terminator grammar: insert the delimiter
after every list element. This grammar has no ambiguities.
'prefix
means a prefix grammar: insert the delimiter
before every list element. This grammar has no ambiguities.
The delimiter is the string used to delimit elements; it defaults to
a single space " ".
Example:
(join-strings '("foo" "bar" "baz") ":") => "foo:bar:baz"
(join-strings '("foo" "bar" "baz") ":" 'suffix) => "foo:bar:baz:"
;; Infix grammar is ambiguous wrt empty list vs. empty string,
(join-strings '() ":") => ""
(join-strings '("") ":") => ""
;; but suffix & prefix grammars are not.
(join-strings '() ":" 'suffix) => ""
(join-strings '("") ":" 'suffix) => ":"
string-copy is extended from its R5RS definition by the addition of
its optional start/end parameters. In contrast to SUBSTRING/SHARED,
it is guaranteed to produce a freshly-allocated string.
Use string-copy when you want to indicate explicitly in your code that you
wish to allocate new storage; use SUBSTRING/SHARED when you don't care if
you get a fresh copy or share storage with the original string.
Example:
(string-copy "Beta substitution") => "Beta substitution" (string-copy "Beta substitution" 1 10) => "eta subst" (string-copy "Beta substitution" 5) => "substitution"
substring/shared returns a string whose contents are the characters of s
beginning with index start (inclusive) and ending with index end
(exclusive). It differs from the R5RS substring in two ways:
end parameter is optional, not required.
substring/shared may return a value that shares memory with s or
is eq? to s.
Example:
(let((s "Beta substitution")) (eq?(substring/shared s 0)s)) => #t
Copy the sequence of characters from index range
(start,end) in string s to string target,
beginning at index tstart. The characters are copied
left-to-right or right-to-left as needed -- the copy is guaranteed to
work, even if target and s are the same string.
It is an error if the copy operation runs off the end of the target string, e.g.
(string-copy! (string-copy "Microsoft") 0 "Regional Microsoft Operating Companies") error-->
Note: though the result of string-copy! is defined as unspecified
by SRFI document, the implementation always returns the target argument.
Example:
(string-copy! "qwerty" 2 "asdf") => "qwasdf"
string-take returns the first ncharsof s;
If this procedure produces the entire string, it may return either
s or a copy of s; in some implementations, proper
substrings may share memory with s.
Example:
(string-take "Pete Szilagyi" 6) => "Pete S"
It is an error to take more characters than are in the string:
(string-take "foo" 37) error-->
string-drop returns all but the first ncharsof s.
If this procedure produces the entire string, it may return either
s or a copy of s; in some implementations, proper
substrings may share memory with s.
Example:
(string-drop "Pete Szilagyi" 6) => "zilagyi"
It is an error to drop more characters than are in the string:
(string-drop "foo" 37) error-->
string-take-right returns the last ncharsof s.
If this procedure produces the entire string, it may return either
s or a copy of s; in some implementations, proper
substrings may share memory with s.
Example:
(string-take-right "Beta rules" 5) => "rules"
It is an error to take more characters than are in the string:
(string-take-right "foo" 37) error-->
string-drop-right returns all but the last ncharsof s.
If this procedure produces the entire string, it may return either
s or a copy of s; in some implementations, proper
substrings may share memory with s.
Example:
(string-drop-right "Beta rules" 5) => "Beta "
It is an error to drop more characters than are in the string:
(string-drop-right "foo" 37) error-->
Build a string of length len comprised of s padded on the
left by as many occurrences of the character char as needed. If
s has more than len chars, it is truncated on the left to
length len. char defaults to #\space.
If len <= end - start, the returned value is allowed to share
storage with s, or be exactly s (if len = end -
start).
Example:
(string-pad "325" 5) => " 325" (string-pad "71325" 5) => "71325" (string-pad "8871325" 5) => "71325"
Build a string of length len comprised of s padded on the
right by as many occurrences of the character char as needed. If
s has more than len chars, it is truncated on the right to
length len. char defaults to #\space.
If len <= end - start, the returned value is allowed to share
storage with s, or be exactly s (if len = end -
start).
Example:
(string-pad-right "325" 5) => "325 " (string-pad-right "71325" 5) => "71325" (string-pad-right "8871325" 5) => "88713"
The string-trim, string-trim-right,
string-trim-both procedures trim s by skipping over all
characters on the left / on the right / on both sides that satisfy the
second parameter char/char-set/pred:
char are
trimmed;
pred, it is a test predicate that is applied
to the characters in s; a character causing it to return true is
skipped.
char/char/set-pred defaults to the character set
char-set:whitespace defined in SRFI-14.
If no trimming occurs, these functions return s.
Example:
(string-trim #" The outlook wasn't brilliant, \n\r") => #"The outlook wasn't brilliant, \n\r"
See description of string-trim.
Example:
(string-trim-right #" The outlook wasn't brilliant, \n\r") => #" The outlook wasn't brilliant,"
See description of string-trim.
Example:
(string-trim-both #" The outlook wasn't brilliant, \n\r") => #"The outlook wasn't brilliant,"
Stores char in every element of s and returns (in this
implementation only) the s string.
string-fill! is extended from the R5RS definition to take optional
start/end arguments.
Example:
(let((s "12345678")) (string-fill! s #\space 2 4) s) => "12 5678"
These procedures are the lexicographic extensions to strings of the corresponding orderings on characters. For example, STRING< is the lexicographic ordering on strings induced by the ordering CHAR<? on characters. If two strings differ in length but are the same up to the length of the shorter string, the shorter string is considered to be lexicographically less than the longer string.
The optional start/end indices restrict the comparison to the indicated
substrings of s1 and s2.
string-ci=, string-ci<>, string-ci<,
string-ci>, string-ci<= and string-ci>= procedures
are case-insensitive variants of string=, string<>,
string<, string>, string<= and string>=
correspondingly.
Comparison is simply done on individual code-points of the string. True text collation is not handled by this SRFI.
Case-insensitive comparison is done by case-folding characters with the operation (char-downcase (char-upcase c))
Test strings for equality. See notes at the beginning of this section.
Test strings for inequality. See notes at the beginning of this section.
Test if s1 string is less than s2 string. See notes at the
beginning of this section.
Test if s1 string is greater than s2 string. See notes at the
beginning of this section.
Test if s1 string is less than or equal to s2 string. See
notes at the beginning of this section.
Test if s1 string is greater than or equal to s2 string. See
notes at the beginning of this section.
Test strings for equality case-insensitive. See notes at the beginning of this section.
Test strings for inequality case-insensitive. See notes at the beginning of this section.
Test if s1 string is less than s2 string
case-insensitive. See notes at the beginning of this section.
Test if s1 string is greater than s2 string
case-insensitive. See notes at the beginning of this section.
Test if s1 string is less than or equal to s2 string
case-insensitive. See notes at the beginning of this section.
Test if s1 string is greater than or equal to s2 string
case-insensitive. See notes at the beginning of this section.
Compute a hash value for the string s. bound is either
#f or a non-negative exact integer. If an integer, it gives the
target range of the hash function -- the returned value will be in the
range [0,bound].
If bound is either #f or not given, the implementation may use
an implementation-specific default value, which might be chosen,
for instance, to map all strings into the range of integers that
can be efficiently represented.
The optional start/end indices restrict the hash operation to the
indicated substring of s.
Invariants:
(<= 0 (string-hash s b) (- b 1))
(string= s1 s2) => (= (string-hash s1 b) (string-hash s2 b))
string-hash-ci is the case-insensitive variant of string-hash.
Invariants:
(<= 0 (string-hash-ci s b) (- b 1))
(string-ci= s1 s2) => (= (string-hash-ci s1 b) (string-hash-ci s2 b))
Return the length of the longest common prefix of the two strings.
This is equivalent to the "mismatch index" for the strings (modulo
the starti index offsets).
The optional start/end indices restrict the comparison to the indicated
substrings of s1 and s2.
Example:
(string-prefix-length "qwertyasdf" "qwertypoiuy") => 6
Return the length of the longest common suffix of the two strings.
This is equivalent to the "mismatch index" for the strings (modulo
the starti index offsets).
The optional start/end indices restrict the comparison to the indicated
substrings of s1 and s2.
Example:
(string-prefix-length "asdfqwerty" "poiuqwerty") => 6
Case-insensitive variant of string-prefix-length.
Case-insensitive variant of string-suffix-length.
Is s1 a prefix of s2?
Example:
(string-prefix? "qwerty" "qwertyasdf" => #t
Is s1 a suffix of s2?
Example:
(string-prefix? "qwerty" "asdfqwerty" => #t
Case-insensitive variant of string-prefix?.
Case-insensitive variant of string-suffix?.
string-index searches through the string from the left, returning
the index of the first occurrence of a character which
char/char-set/pred (if it is a character);
char/char-set/pred (if it is a character set);
char/char-set/pred (if it is a procedure).
If no match is found, the functions return #f.
The start and end parameters specify the beginning and end
indices of the search; the search includes the start index, but
not the end index. The first index considered is end-1.
Example:
=>
string-index-right searches through the string from the right,
returning the index of the first occurrence of a character which
char/char-set/pred (if it is a character);
char/char-set/pred (if it is a character set);
char/char-set/pred (if it is a procedure).
If no match is found, the functions return #f.
The start and end parameters specify the beginning and end
indices of the search; the search includes the start index, but
not the end index. The first index considered is start.
Example:
=>
The string-skip functions is similar to string-index, but
uses the complement of the criteria: is searches for the first char that
*doesn't* satisfy the test. E.g., to skip over initial whitespace, say
(cond ((string-skip s char-set:whitespace) =>
(lambda (i)
;; (string-ref s i) is not whitespace.
...)))
The string-skip-right functions is similar to
string-index-right, but uses the complement of the criteria: is
searches for the first char that *doesn't* satisfy the test.
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Example:
=>
Small subset of Common Lisp string formatting utilities. The procedures are compatible with such in MzScheme.
fprintf outputs its template argument, using the following substitutions:
display;
write;
print;
write-char;
Example:
(fprintf (current-output-port) "the result was ~s" "unknown") -| the result was "unknown"
printf does the same as fprintf does, but sends all output
to current-output-port
Example:
(printf "the result was ~s" "unknown") -| the result was "unknown"
printf does the same as fprintf does, but sends all output to string
Example:
(format "the result was ~s" "unknown") => "the result was \"unknown\""
Obtain the current environment as a list of name/value pairs. For example:
(pp(environ)) -| ((#"_" . #"/usr/local/bin/bigloo-common") (#"CONFIG_SITE" . #"/home/wowa/.autoconf") (#"HOME" . #"/home/wowa") (#"TERM" . #"emacs") (#"OSTYPE" . #"solaris2.7") ...
Probably you'll need this procedure for debugging only. Use
getenv and putenv Bigloo procedures instead.
putenv procedure makes the value of the environment variable
name equal to value by altering an existing variable or
creating a new one.
Read or set libc errno variable.
(errno) => 0 (open "nonexistentfile") -| *** ERROR:bigloo:open: file opening error -- nonexistentfile (errno) => 2 (errno 0)
The mmap procedure asks to map length bytes starting at
offset offset from the file (or other object) specified by fd into
memory.
length::int
mmap result is returned in
form of Bigloo bstring, the length really passed to libc
mmap() includes the bstring object overhead too.
#!key fd
bstring object, this mmap implementation is practical
useless if you want to map anything but dummy devices such a
/dev/zero.
If fd argument is omitted, the /dev/zero device is used to
get a file descriptor.
#!key prot
exec
read
write
none
#!key flags
mmap options. The valid values are fixed,
shared and private. The values denywrite,
executable and anonymous are also valid but have no effect
on systems other than Linux. See the mmap manual pages for
details.
#!key offset
This procedure may be useful if you want to temporary allocate the huge
amount of memory which should be released and returned to operating
system. Besides, the memory allocated with mmap is not accessed
until you really use it, so the allocation is very fast.
In the following example we will illustrate this feature. First we
measure how much memory the application process consumes, using the
ps command:
bash$ ps u 17012 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COM wowa 17012 2.1 5.7 7108 2236 ttyp4 S 20:32 0:00 /us
Then we mmap 16M of memory:
(define mem (mmap #x1000000))
As we may expect the process virtual memory increases now by 16M:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COM wowa 17012 0.1 5.8 23496 2260 ttyp4 S 20:32 0:00 /us
Now we do the unmap:
(munmap mem)
And measure the process memory again:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COM wowa 17012 0.0 5.7 7108 2252 ttyp4 S 20:32 0:00 /us
Release memory mapped by mmap.
Return information about the specified file. The argument what
should be either the name of the file or open file descriptor.
The result is of type stat, for which the following read accessor procedures are defined:
st-mode
open procedure description.
st-uid
st-gid
st-size
st-atime::double
st-mtime::double
st-ctime::double
(let((st(stat "/etc/passwd"))
(pt(lambda(seconds)(strftime(localtime seconds)))))
(print "User ID: " (stat-st-uid st))
(print "Group ID: " (stat-st-gid st))
(print "Size: " (stat-st-size st))
(print "Accessed: " (pt(stat-st-atime st)))
(print "Data modified: " (pt(stat-st-mtime st)))
(print "Status modified: " (pt(stat-st-ctime st))))
-| User ID: 0
-| Group ID: 0
-| Size: 1071
-| Accessed: 04/22/00 22:20:00
-| Data modified: 03/21/00 21:44:32
-| Status modified: 03/21/00 21:44:32
Test for a terminal device. Argument what should be open file descriptor. Example:
(isatty(open "/dev/tty")) => #t (isatty(open "/etc/passwd")) => #f
Open file name file-name, return the integer file descriptor.
The optional oflag arguments may be any of the following symbols:
rdonly, wronly, rdwr, append,
nonblock, creat, trunc, excl or
noctty. See open(2) manual page for the meaning of the
flag values.
Example:
(let*((fd(open "/etc/passwd"))
(bytes(fdread fd 100)))
(close fd)
bytes)
-| root:XXXXXXXXX:0:0:root:/root:/bin/bash
-| bin:*:1:1:bin:/bin:
-| daemon:*:2:2:daemon:/sbin:
-| adm:*:3:4
Close a file descriptor, so that it no longer refers to any file and may be reused.
Read the specified number of bytes size using the open file
descriptor fd by calling libc read() function.
Try to write the str to specified file descriptor. Return the number of bytes really wrote.
getppid returns the process ID of the parent of the current
process.
getpid returns the process ID of the current process. (This is
often used by routines that generate unique temporary file names.)
The getlogin procedure returns a pointer to the login name as
found in /var/adm/utmp. It may be used in conjunction when the
same user ID is shared by several login names. See getlogin(3c)
manual page for details.
If getlogin is called within a process that is not attached to a
terminal, it returns #f. In later case use the cuserid
procedure instead.
As example of how the getlogin works, we first run the utility
from non-terminal xemacs window, and then from the rlogin
shell:
bigloo-common 1:=> (getlogin) => #f 1:=> bash-2.03$ rlogin localhost Password: Last login: Thu May 4 15:19:55 from localhost bash-2.03$ bigloo-common bigloo-common 1:=> (getlogin) (getlogin) => wowa 1:=> bash-2.03$
The getpwnam procedure is used to obtain password entries. The what arguments controls which entry will be returned by the procedure. The valid values of what are:
string)
integer)
integer)
string)
string)
string)
The optional name argument may be integer user ID or string user
name of the user in question. If omitted, the name of current user as
returned by cuserid is used.
(getpwnam 'shell) => "/usr/bin/bash" (getpwnam 'dir "adm") => "/var/adm"
cuserid procedure generates a character-string representation
of the login name under which the owner of the current process is logged
in.
(cuserid) => wowa
The strxfrm procedure transforms the src string into a
form such that the result of memcmp on two strings that have been
transformed with strxfrm is the same as the result of
locale-sensitive string-comparing procedures (string=?,
string<? etc.) on the two strings before their
transformation. (See setlocale).
(setlocale 'all "ru_RU.KOI8-R") (pp(strxfrm "qwerty")) -| #"\304\210\304\232\303\244" (setlocale 'all "C") (pp(strxfrm "qwerty")) -| #"qwerty"
crypt(3) is the password encryption function. It is based on the Data
Encryption Standard algorithm with variations intended (among other
things) to discourage use of hardware implementations of a key search.
passwd is a user's typed password.
salt is a two-character string chosen from the set [a-zA-Z0-9./]. This string is used to perturb the algorithm in one of 4096 different ways.
See the man pages for crypt(3).
(crypt "my-secret-password" "joe") => "jonhWNi0AD56g"
Calculate digest using md5 algorithm. Return 16-byte long
character string. For example:
(pp(md5 "qwerty")) -| #"\330W\216\337\204X\316\006\373\305\273v\245\214\\\244"
As you may see, the result includes unprinted characters, so usually md5 call result need to be printed in hex with string->hex:
(string->hex(md5 "qwerty")) => "d8578edf8458ce06fbc5bb76a58c5ca4"
char->hex prints character c to hexadecimal string, for
example:
(char->hex #\newline) => "0a"
string->hex prints string str using char->hex
conversion, for example:
(string->hex "Hello") => "48656c6c6f"
This section describes the interface to iconv - a set of
libc functions for character set conversion. See iconv(3)
manual page for details.
The iconv module is optional, i.e. you can disable its
compilation by using --without-iconv flag for
configure. Or the configure may detect that your
libc does not have iconv functions and automatically
disable this feature.
To let you detect whether character conversion is supported by the
library from inside the interpreted code, the 'iconv symbol is
defined through the register-eval-srfi! mechanism, so you can
check it with cond-expand.
The structure holding the information about the source and target character sets and current state of conversion.
The iconv-open procedure returns a conversion descriptor that
describes a conversion from the codeset specified by the fromcode
argument to the codeset specified by the tocode argument. For
state-dependent encodings, the conversion descriptor will be in a
codeset-dependent initial shift state, ready for immediate use with the
iconv procedure.
(iconv-open "KOI8-R" "UTF-8") => #<foreign:ICONV:21410>
The iconv procedure converts the sequence of characters from one code
set, in the array specified by src, into a sequence of corresponding
characters in another code set, in the return string. The
code sets are those specified in the cd argument.
Create codeset conversion procedure.
In the following example my Russian name in KOI8-R (one of
Cyrillic most widely used Russian code sets) is converted into
UTF-8 encoding.
(pp((make-iconv "KOI8-R" "UTF-8")"÷Ï×Á")) => #"\320\222\320\276\320\262\320\260"
Note: The object of iconv type created in course of
make-iconv call is never (and currently cannot be) released.
Release the cd object and all related resources.
This section describes types and procedures, dealing with time. They let you measure calendar and UNIX process time, print time using locale settings, and also do some arithmetics with times and dates.
A wrapper for C library struct tm structure, broken-down time
representation.
The following read accessors are defined:
See also strftime procedure description to print these objects in
human-readable form.
Allocate an uninitialized object of type tm. This procedure is
used internally by other time-manipulation procedures. Perhaps, you do
not want to call it explicitly.
Interface for C runtime gmtime call. Take number of seconds
elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time
(UTC), and convert it to broken-down time representation, expressed in
Coordinated Universal Time (UTC).
(strftime(gmtime(current-seconds))) => 04/16/00 17:56:54
Same as gmtime, but the result is expressed relative to the user's
specified time zone.
The procedure also sets the values returned by tzname and
timezone and daylight.
Return number of seconds west of UTC. For example, here in Moscow:
(timezone) => -10800 (/ (timezone) 3600) => -3
Return names of time zone as two scheme values. See tzset manual
pages for details. The values are also set by localtime. For
example:
(define(tzprint) (multiple-value-bind (name name1) (tzname) (print name ", " name1))) (tzprint) (localtime 0.0) ;; this call for side effects only (tzprint) => GMT, GMT MSK, MSD
A flag that indicates whether daylight saving time is in effect at the time described. Return positive value if daylight saving time is in effect, zero if it is not, and negative value if the information is not available.
The strftime procedure formats the broken-down time tm
according to the format specification. If format argument is
omitted, the "%x %X" string is used to format output. See
strftime manual pages for details.
Examples:
(define now(localtime(current-seconds))) => #<foreign:TM:806dbd0> (strftime now) "04/16/00 23:38:14" (strftime now "%Y%m%d%H%M%S") "20000416233814"
Number of seconds as returned by gettimeofday C runtime call.
The name of procedure chosen to be compatible with analogous procedure
in MzScheme.
Example:
(current-seconds) => 955914618.43757
Defined as:
(define(current-milliseconds::double) (* (current-seconds) 1000.0))
Interface for ctime_r C runtime procedure. Return 26-character
string with fixed-format time representation, for example:
(ctime (current-seconds)) => "Mon Apr 17 12:28:54 2000"
Constructor for objects of tm type. The arguments are:
Example:
(strftime(mktime 1960 12 27)) => "12/27/60 00:00:00"
Read date/time from port port using the specification
fmt. The format of the specification is a subset that of
strftime specification (only %S, %M, %H,
%I, %d, %m, %Y, %p and %%
escape sequences are supported).
Example:
(strftime
(read-date "%Y%m%d%H%M%S"
(open-input-string "20000416233814")))
=> "04/16/00 23:38:14"
The times procedure measures various time-accounting information.
Depending on value of argument which? of symbol type it
returns the following values:
utime
stime
cutime
cstime
If argument which? is absent, the times procedure returns
five scheme values: the number of clock ticks that have elapsed since
the system has been up, and all the values just described,
i.e. utime, stime, cutime and cstime.
All the values are measured in system clock ticks. The length of one
tick is system-dependent. Number of clocks per second may be obtained by
calling clocks-per-second procedure.
Examples:
Here number of system clock ticks from the system start-up is measured:
(times) => 1720216
The same value but now in seconds:
(/(times)(clocks-per-second)) => 17340.09
The following example is a complete utility that measures the external process times.
The initial times are measured and stored in local variables
total, cutime and cstime, external process is spawned
using bigloo run-process procedure See Info file `bigloo', node `Process support'. After the spawned process is finished, the statistics is
printed to standard error port in form similar that of Unix time
utility.
#!/usr/local/bin/bigloo-common
(multiple-value-bind
(total utime stime cutime cstime)
(times)
(apply run-process
(append (cddr(command-line))
'(wait: #t)))
(multiple-value-bind
(ntotal nutime nstime ncutime ncstime)
(times)
(let((ticks(clocks-per-second))
(user-ticks(- ncutime cutime))
(system-ticks(- ncstime cstime))
(elapsed-ticks(- ntotal total)))
(fprintf
(current-error-port)
"~auser ~asystem ~aelapsed ~a%CPU~%"
(/ user-ticks ticks)
(/ system-ticks ticks)
(/ elapsed-ticks ticks)
(inexact->exact
(*(/(+ user-ticks system-ticks) elapsed-ticks)100))))))
The utility usage example (provided the ./time is the script
location):
bash$ ./time gzip -c /vmlinuz > /dev/null 1.17user 0.03system 1.2elapsed 100%CPU
Print time argument in UTC time format.
(tm->utctime(localtime(current-seconds))) => 20000531123949Z
(strftime(utctime->tm "20000531123949Z")) => 05/31/00 12:39:49
This section describes cgen -- the utility for creating bigloo
interfaces to C libraries.
cgen allows you to create wrappers for external C functions and
external C types, such as structures, enums, bit fields and opaque
pointers.
cgen comes to you with bigloo-lib, and is automatically
created before any bigloo-lib library is creates. All the
external C interfaces in bigloo-lib are created with help of
cgen.
In course of evaluation of the foreign interface, I found it not very suitable for the following reasons :
inline, their body is
copied into every module that uses it
cgen is, on the
other hand, quite simple and open-ended. It is not hard to make it to do
anything you like without risk to broke the whole compiler.
cgen is readable scheme text. When something goes
not as expected, you can easily check that's going on. Bigloo, in its
turn, does the same thing in course of compilation: it creates the
low-level scheme type expressions to be compiled, but it never reveals
the generated code to the programmer.
cgen was developed in hope to achieve the following goals :
cgen creates write accessor for C structure
slots only if you specify that directly.
cgen-generated functions.
#f value.
GTK+ interface section GTK+ interface compatible with guile-gtk
(http://www.gtk.org). Using the interface specifications from
guile-gtk saved me much of work. The main idea and specification
file format came from guile-gtk also.
On the other hand, Bigloo has excellent capabilities of creating any new
types, using the type and coerce statements in module
declaration. The only bad thing with it is that these capabilities are
not documented at all (though the documented extern type
interface is based upon that low-level layer).
cgen work is based upon these capabilities and it is alternative
to Bigloo foreign interface.
cgen is a preprocessor for bigloo scheme code. It takes one or
more files with C interface specification as input and produces the
readable scheme file on output. The specification itself is bigloo
scheme text with some special constructs. As result of processing this
constructs the new procedures and bigloo module declarations are
created. All other scheme expressions are printed back into output
without changes.
All the cgen input files have extension .defs in
bigloo-lib, you may use it as cgen usage examples.
TBD
This package includes the advanced version of afile utility
(included into Bigloo bee). The list improvements made is:
-I added. The arguments of each -I
option form file search path. So output of
afile -I ../compat -I ../node compat.scm node.scmnow looks like
;; /jet/tmp/bigloo-lib-0.11/common ;; Wed Apr 12 14:08:55 2000 ((compat #"../compat/compat.scm") (node #"../node/node.scm"))Note that the current directory is automatically added to search path only if no any
-I option is given. Also note the required space
between the -I and filename.
The RDBMS library is a set of miscellaneous types and procedures, allowing to access SQL databases from Bigloo application. The library has two layers: generic RDBMS system interface, implemented as small set of Bigloo classes, and set of back-ends, which provide the implementation in form of concrete class methods.
Usually the end-user application relies on generic API only, thus allowing to use different RDBMS system without changing a line in application code.
Currently the support for MySQL included. ODBC and INFORMIX support will be added in near future.
In this section specific for database driver types of objects are described. These types also are used in Scheme function prototypes declarations.
The objects of connection type describe the database
connections.
The objects of session type hold the data used
in process of executing of SQL statements (the statement
string, input and output bindings and state of execution).
Every session belongs to only one
connection.
Theoretically, transactions are entities, which synchronize changes made in database through one or more connections. At the moment, there is no separate class for transaction objects (5).
This section describes procedures for creating and releasing the database connections, and for transaction management.
This procedure creates and opens new database connection. The
dbname is path to database (system specific string). The
username and password are sometimes optional, if the
underlying implementation allows use default values for them.
Instead every RDBMS implementation should supply its own version of
connection-creation procedure. Prefix RDBMS in
RDBMS-connect states for the name of implementation, for example,
the name of procedure, that opens the MySQL connection, will be
mysql-connect (6).
This destroys the connection, and releases all connection's
resources (7)
Abstract method of error string obtaining. RDBMS connections and sessions may provide their own implementations.
This begins the transaction for connection. If
transaction are not supported by underlying RDBMS, #f is
returned.
This method closes the transaction for connection (8).
This ends the transaction, revert all changes made since transaction's beginning (9).
This creates new session for the given connection.
(10).
Cancel the query answering process, if any, make the
session ready for executing.
This destroys the session object and releases all the
session's resources
This executes previously prepared statement. If the answer set is implied by statement, then the answer stream is opened and #t is returned. Otherwise #f is returned.
This prepares the SQL query text string for execution. The
position of optional parameters is marked up with question
mark sign. Returns same result as has-answer? method.
This supplies the parameter values needed by previously prepared SQL statement. All the `question marks' in statement are subsequently substituted by vector elements.
This answers #t if the answer set is implied by prepared statement (usually if the statement is of SELECT type).
Fetch next record from the query answer stream and return it in form of
scheme list object, or scheme null, if end of answer
stream is reached.
Get result set description as scheme list. Generally the format
of result is system-dependent, but usually each column descriptors
contains the following information:
For details see the documentation, supplied with particular implementation.
In the following example, the connection with MySQL database
named dept is established. Next, the table named person
with columns named id, last_name and first_name is
created and a few records inserted into the table. The contents of the table
is retrieved back then and displayed. After that, the table is
destroyed.
Here is the example :
(define connection (mysql-connect "dept" "me" "mySecretPassword"))
(define session (acquire connection))
(prepare session
"create table person (
id INTEGER PRIMARY KEY,
last_name CHAR(20),
first_name CHAR(20))")
(execute session)
(prepare session "insert into person values(?,?,?)")
(bind! session '(100 "Tsichevski" "Vladimir"))
(execute session)
(bind session '(101 "Taranoff" "Alexander"))
(execute session)
(bind session '(102 "Ananin" "Vladimir"))
(execute session)
(prepare session "select * from person")
(execute session)
(let loop ((answer-record(fetch session)))
(if answer-record
(begin
(write answer-record)
(newline)
(loop (fetch session)))
#f))
(prepare session "drop table person")
(execute session)
(dismiss session)
(dismiss connection)
The output of the program looks like this :
(100 "Tsichevski" "Vladimir") (101 "Taranoff" "Alexander") (102 "Ananin" "Vladimir")
The special class named rdbms-error is created for dealing with
database exceptions. The instances of that class provide the application
with (system-specific) error code and error message (11).
TBD
TBD
Abstract bigloo class, the base class for tree node objects. Each node may have a number of named attributes. The attribute names are symbols, the values are usually strings. All the functionality provided as a set of generic procedures, the base node class objects do not hold any data.
List of node attributes. The generic function returns '().
Add the attribute named attname and value attvalue to node
self. The generic procedure modifies the node attribute list
using the node-atts-set! method.
Return the value of the first attribute of node self with name attname.
Return the list of attributes of node self with name attname.
Remove the attributes of node self with name attname. If optional arguments attvalues are specified, only the attributes which values are within the attvalues list are removed.
Remove the attributes of node self with name attname. If
optional arguments attvalues are specified, add new attributes
with name attname and values attvalues. Otherwise the
procedure effect is equivalent to that of node-remove-attribute!.
Set the value of specified attribute. Add the new attribute if necessary.
Get list of node parents or empty list for top nodes. The generic procedure returns an empty list.
Return first node as returned by node-parents, or self if
node has no parents.
(let((self(make-node))) ;; generic node nether has parents (eq? self(node-parent self))) => #t
Set the node parents list. This method should be redefined in concrete subclasses.
Return the topmost node of the node tree, recursively calling the
node-parent.
Collect all the node-parents and their parents up to root node or
nodes. Node self is also included into the list.
(let*((root(make-node))
(child(make-dl-node (list root))))
(node-ancestors child))
=> (#0=#|NODE| #|DL-NODE [PARENTS: (#0#)]|)
Set the node children list. This method should be redefined in concrete subclasses.
Insert child node child into list of node self children. If
the concrete implementation supports ordering of the children, the
optional after argument may be specified, to define the node
insertion position. The generic procedure uses node-children-set!
to do the insertion.
Insert node self into the tree. The parent node is
registered in self's parent list. The self node prepended
to all parent's children lists using node-add-child!.
No checking for duplicates is performed.
(let*((parent(make-dl-node '()))
(child(make-dl-node '())))
(node-bind! child parent)
parent)
Do node-bind! for all descendants of node self.
Return children list of self.
Return list including node self and all the self's descendants.
Defined as:
(define-generic(node-descendants::pair-nil self::node) (cdr(node-subtree self)))
Remove the node self from the tree. The meaning of this method is
subclass implementation-dependent. The generic procedure does nothing.
Return all the children of node returned by node-parent,
excluding the node self.
Right siblings of node. Return all the children of node returned by
node-parent after the node self in children list.
Left siblings of node. Return all the children of node returned by
node-parent before the node self in children list.
Node that follows the node self or the self node if no node follows.
Node that precedes the node self or the self node if no node precedes.
Return either the node immediately following self in sibling list,
or the node following parent node of self, if self is the
last node in the list of siblings.
Return either the node that immediately precedes self in sibling
list, or the parent node of self, if self is the first
node in the list of siblings.
The concrete tree implementation may supply the mechanism for naming tree nodes to let the node be found given the path string is known. The described here naming scheme is based upon LDAP entries naming and used basically by LDAP library See section Bigloo LDAP interface.
Every node has its own Relative Distinct Name (RDN), which must be unique between node siblings. The node RDN along with RDNs of node ancestors form the full node path, which is called Distinct Name (DN). The DN is result of string concatenation of node RDN and RDNs of node ancestors, delimited by comma character.
This module provides the generic procedures for getting and setting node DNs and RDNs along with useful procedures for parsing DN strings.
Return the RDN (Relative Distinct Name) of node. The RDN must be unique between node siblings. This method should be redefined in concrete subclasses.
Change the RDN of the node self. Using of optional
deleteatt? is specific for LDAP node implementation only.
Get the DN (Distinct Name) if the node self. The generic function constructs DN by concatenating the RDN's of all the ancestors of the node, beginning with the node self itself, delimited by comma character. This procedure is relevant mostly for LDAP nodes.
Parse the DN string, return DN for parent node.
(dn-parent "uid=wowa,dc=jet,dc=msk,dc=ru") => "dc=jet,dc=msk,dc=ru"
(dn-rdn "uid=wowa,dc=jet,dc=msk,dc=ru") => "uid=wowa"
`Subtract' two DNs, return the difference as a list of RDNs. Return
#f if the dn string does not begins with the base
string.
(dn-relative "s=r,cn=wowa,o=jet,c=ru" "o=jet,c=ru") => (#"cn=wowa" #"s=r")
Lookup node with the dn given in same grove as self. Return #f if not found.
Find node in a global node registry.
Some of classes derived from node class are assumed to redefine
this method. The generic implementation concatenates the strings
obtained by applying node-data to all the children of self.
See the examples in sgml-node description.
current-node is parameter procedure See section Bigloo Common Library. Plays the role of global variable to store current position in
any tree of nodes in end user applications. This procedure is defined
for convenience only, none of the library functionality relies on it.
Node printed name. It is assumed that subclasses provide its own
implementation. By default try the value of cn attribute or uses
bigloo class name of the node.
This procedure is called by object-display method for nodes.
The generic procedure displays the string as returned by node-title.
The meaning of this method is subclass implementation-dependent. The
generic procedure returns #t.
This chapter describes the Bigloo interface to expat, the popular
XML parser by James Clark. The original expat library may be
obtained at http://www.jclark.com/xml/expat.html, or you can use
repackaged for use with configure variant from
ftp://bigloo-lib.sourceforge.net/pub/bigloo-lib/expat-1.1.tar.gz
TBD
xml2expat is a tool which converts XML text to Bigloo object file
format. It is useful, for example, when working with XML templates to
produce dynamic HTML pages or in any similar situation when all the XML
files are known at the compilation time, so you do not need to add the
XML support into you application.
TBD
This chapter describes the interface for
The interface is designed after the popular
For generation of multiple interfaces to
Since the main goal of GTK+ is to provide a graphical user interface, it
is practically impossible to test it automatically. Instead, a test
application was derived from analogous program provided with GTK+ (file
gtk/testgtk.c in GTK+ distribution) and guile-gtk.
Also this application may be used as a source of examples how to use
bigloo-gtk.
The
All the original tests
The simplest way to run the
but to make all the tests work, you probably have to compile and run binary
executable:
Currently this reference guide of very far from completeness. Only
selected calls are documented. Look at working tests code in
The
Every type in GTK+ is given an unique identifier. These identifiers have a type named
A few numbers are preassigned to built-in GTK+ types (such an integers,
strings, booleans etc.). All other type ids are allocated along with the
first instance of that type.
Note: the name returned is a GTK+ name, not a Bigloo type name, i.e. the
value
Given the name of an existing GTK+ type, return its type id.
Example: get the type of
Get GTK+ object class reference by instance. The
Get type identifier by GTK+ object class.
o
Any Bigloo procedure with matching prototype may be used as signal or
event handler in Bigloo.
Stop the emission of the signal on object. signal is
the string signal name or the integer identifier for the signal, which
can be determined using the function
Disconnects a signal handler from an object. The signal handler is
identified by the integer id which is returned by the
Example: disable the button action after the first invocation.
Emit the signal specified by the integer or string identifier signal
from object. The signal
definition determines the parameters passed in the arguments list.
For example, if the signal is defined as:
Then a call to emit the "parent_set" signal would look like:
Notice that the
FIXME: signals returning the value are current not implemented!!!
Connects a signal handling function to a signal emitting
object. function is connected to the signal name emitted by
object. The arguments and returns type of func should match
the arguments and return type of the signal name.
Example: connect a click handler to a button. Being invoked, handler
prints a message and disconnects itself.
Create a new signal and give it the character string identifier
name. name needs to be unique in the context of
object-type's branch of the class hierarchy. That is,
object-type cannot create a signal type with the same name as a
signal type created by one of its parent types.
run-type specifies whether the class function should be run before
(
The return-val and the remaining arguments
specify the return value and the arguments to the signal handler
respectively.
Note: There is an implicit first argument to every signal
handler which is the widget the signal has been emitted from.
The variable argument list params specifies the types of the
arguments (use
Note:
Access the object-type of
Access the signal-id of
Access the signal-name of
Access the is-user-signal of
Access the signal-flags of
Access the return-val of
Returns the integer identifier for the signal referenced by name
and type. If type does not define the signal name,
then the signal is looked for in type's parent type recursively.
Lookup a signal by signal identifier signal-id, return signal
name. This procedure is complementary to the
Query signal information.
Create
Note: this procedure obsoletes
Example1: create 3-column
Example1: create 2-column
Append a row to clist. The columns parameter should be a
list strings to form a new row. The length of
Return current color selection as list of four double values (RGB+opacity).
Append a menu item, created by any of
Display the menu onscreen.
Arguments:
In the following example a button is created. Pressing the button pops
up the menu
See
Create new
Example. This creates three items in a group:
Init the GTK and GDK environment. You must call this procedure prior
making any other GTK+ call. The argv is the same list of arguments
that were passed to the application. The procedure process some of list
elements and returns the copy of argv with all processed arguments
removed.
Example: provided that
In this example the "Hello" message is printed only once.
Add a thunk procedure that will be called every interval
milliseconds. Return the timeout identifier suitable for passing to
The thunk must be procedure of no arguments. If this procedure
returns #f, the timeout is removed just after the first thunk
invocation.
Example1: print "Hello" every second.
Example2: print "Hello" only once.
Add a thunk procedure that will be called (as GTK+ tutorial says) "when nothing
else is happening". Return the idle identifier suitable for passing to
The thunk must be procedure of no arguments. If this procedure
returns #f, the idle task is removed just after the first thunk
invocation.
Example1: print "Hello" repeatedly.
Example2: print "Hello" only once.
This chapter describes a scheme interface for client LDAP library. The
interface allows to write LDAP clients with Bigloo scheme. It was tested
with
The chapter includes many verbatim excerpts from corresponding
original manual pages, describing the C interface, which are provided
with the package from http://www.openldap.org
List of attribute names and values.
Opens a connection to an LDAP server and allocates an LDAP structure
Return LDAP connection handle of type
See also
Example
This binds the user with DN
See also
See also
Return #unspecified. Generates exception in case of error. Use
Example :
See also
Example :
See also
Example :
In the following example the value
In the next example the entire attribute
See also
Example :
In the following example the new value
See also
Example :
See also
See example in
See also
Return value
Example :
In this example the total number of entries in LDAP tree is measured :
See also
The following returns root entry in LDAP tree:
See also
return DN of LDAP message
See also
Return list of entry attributes in form of
Example :
See example in
returns values of specific attribute
Return list of attribute values (scheme strings) or
Example :
The following statement returns first value of attribute
See also
frees an LDAP message structure
Example :
This opens LDAP connection, and retrieves all antries in the LDAP tree :
See also
This routine is used to wait for and return the result of an
operation previously initiated by one of the LDAP operation
routines (e.g.,
See example in
See also
Deletes cache contents, but does not effect it in any other way
See also
Turn off caching and completely remove cache from memory
See also
Temporarily disables use of cache (new requests are
not cached and cache is not checked when returning
results). It does not delete the cache contents from memory
See also
Turns on local caching or changes cache parameters
(lifetime of cached requests and memory used).
See also
See
Removes all requests that make reference to the DN from the cache
See also
remove the request indicated by
the LDAP request id msgid from the cache
See also
Result of the last LDAP API call. The value of 0 if no error.
To get a readable error description use
Interface to
See also
Takes a DN as returned by
See also
Example :
Given a result of successful
This example code does essentially same operation as the example code
provided in
This procedure deletes the LDAP entry along with all descendants of that
entry. Return the entry list just deleted in a form described in
Realizes the concept of default LDAP connection. Other procedures use
the result of calling
Realizes the ldap default base concept according to the following rules:
Intellectual LDAP entry update. Reads the LDAP entry, examines the
difference between the old attributes and the new ones. Performs the
appropriate updates: removes the obsolete attributes with the use of
Jump to:
a
-
c
-
l
-
m
-
p
-
r
-
s
Jump to:
a
-
c
-
i
-
l
-
n
-
s
-
t
Jump to:
a
-
b
-
c
-
d
-
e
-
f
-
g
-
h
-
i
-
k
-
l
-
m
-
n
-
o
-
p
-
r
-
s
-
t
-
u
-
x
GTK+ interface
GTK+, the Open Source
Free Software GUI Toolkit, primarily developed for use with the X Window
System. The most detailed information about GTK+ may be found at
http://www.gtk.org.
guile-gtk analog, the
GTK+ interface for using with guile scheme
implementation. My intention was to make the interface as compatible
with that of guile-gtk as possible in order to utilize the
tutorials, examples and other software written for guile-gtk.
GTK+ functions the
cgen utility was developed See section cgen - bigloo preprocessor, which was used to process
the specification of GTK+ interface found in guile-gtk.
guile-gtk may be found at
http://www.ping.de/sites/zagadka/guile-gtk/.
Testing the GTK interface
testgtk program
testgtk is port of testgtk.c provided with GTK+
distribution, to bigloo-gtk. Initially is was derived from
testgtk.scm provided with guile-gtk. Now most of the text
is redesigned, many tests made more up-to-date than the corresponding
guile-gtk analogs.
testgtk.c from latest GTK+ distribution
are listed in main testgtk window, labels for whose that are
still unimplemented are grayed.
testgtk is to process its source code
by bigloo-bgtk driver program:
bigloo-bgtk ./testgtk.defs
make testgtk && ./testgtk
example programs
Bigloo-gtk provides a small set of examples, derived from whose
provided in "GTK+ Tutorial". You'll find the examples in
gtk/examples/ subdirectory. All the examples are shell scripts,
though may be compiled. You need to install the package before running
this examples.
Bigloo-gtk reference
testgtk.defs for example.
GDK Reference Manual
The gdk event object
The gdk color object
gdk-color-parse procedure looks up the string name of a
color, given in spec argument, with respect to the screen
associated with the default colormap. On return it initializes the
object given in a color argument with the exact color value. Use
of uppercase or lowercase does not matter. If the color is not
specified, the new instance of type gdk-color is allocated
through gdk-color-alloc. If the color name is not resolved, an
exception is raised.
(gdk-color-parse "red") => #<foreign:GDK-COLOR:fe471d10>
The gdk font object
The gdk drawing procedures
=>
=>
=>
=>
=>
The gdk pixmap object
=>
The gdk window object
=>
=>
=>
The gdk colormap object
=>
gdk miscellaneous procedures
Types
Introduction to the Type System
gtk-type (they are sequential integers really).
"GtkButton" will be returned for buttons, but not
"gtk-button".
(gtk-type-name 2)
=> "gchar"
(gtk-type-name(gtk-object-type(gtk-button-new)))
=> "GtkButton"
(gtk-type-from-name "gint")
=> 5
(gtk-type-from-name "GtkObject")
=> 21
(gtk-button-new) ;; assure the button type is initialized
(gtk-type-from-name "GtkButton")
=> 40469
gtk-object or any ancestor of gtk-object, ruturn
the object type identifier
gtk-button instance.
(gtk-object-type(gtk-button-new)) => 40469
gtk-object-class
structures may be useful for introspection purposes only (to inspect
object signals etc.).
(gtk-object-klass(gtk-button-new))
=> #<foreign:GTK-OBJECT-CLASS:84b3078>
(gtk-object-class-type(gtk-object-klass(gtk-button-new)))
=> 40469
Basic Concepts
Simple Types
Enumerations and Flags
Callbacks
Composite Types
Objects
gtk-object-destroy?
(define button(gtk-button-new))
(gtk-object-destroyed button)
=> #f
(gtk-object-destroy button)
(gtk-object-destroyed button)
=> #t
Signals Overview
gtk-signal-lookup. Attempting to stop the emission of a signal
that isn't being emitted does nothing.
gtk-signal-connect function.
(letrec((but(gtk-button-new "Hello"))
(signal-id
(gtk-signal-connect
but "clicked"
(lambda args
(print "Hello, World")
(gtk-signal-disconnect but signal-id)))))
...)
void (* parent_set) (GtkWidget *widget, GtkWidget *parent);
(let((button(gtk-button-new)))
(gtk-signal-emit button "parent_set" *window*))
=> #unspecified
widget argument is implicit in that the first
argument to every signal is a type derived from GtkObject.
gtk_signal_emit is normally used internally by widgets which know
the signal identifier.
gtk-signal-connect returns an integer identifier for the
connection which can be used to refer to it in the future. Specifically
it is useful for removing the connection and/or blocking it from being
used.
(letrec((but(gtk-button-new "Hello"))
(signal-id
(gtk-signal-connect
but "clicked"
(lambda(button)
(print "Hello, World")
(gtk-signal-disconnect button signal-id)))))
...)
'first), after ('last) or both before and after normal
signal handlers ('both). Additionally, the 'no-recurse
value can be specified to specify that the signal should not be
recursive. By default, emitting the same signal on the same widget will
cause the signal to be emitted twice. However, if the 'no-recurse
flag is specified, emitting the same signal on the same widget will
cause the current signal emission to be restarted. This allows the
widget programmer to specify the semantics of signal emission on a per
signal basis. (The 'no-recurse flag is used by the
gtk-adjustment widget).
gtk-type-from-name to get gtk type
identifiers). It is OK to use (gtk-type-from-name "none") for
return-val. (This corresponds to not returning a value.
gtk-signal-new returns the integer identifier of the newly
created signal. Signal identifiers start numbering at 1 and increase
upwards.
gtk-signal-new is only needed by widget writers. A
normal user of GTK will never needed to invoke this function.
(define button(gtk-button-new))
button
=> #<foreign:GTK-WIDGET:3e330>
(define guint-type(gtk-type-from-name "guint"))
guint-type => 6
(define button-type(gtk-type-from-name "GtkButton"))
button-type => 40469
(gtk-signal-new-generic "print-sum"
'(both)
button-type ;; signal object type
guint-type ;; signal return type
guint-type ;; signal 1st arg type
guint-type ;; signal 2st arg type
)
(gtk-signal-connect button
"print-sum"
(lambda (button n1 n2) (print (+ n1 n2))))
=> 4
(gtk-signal-emit button "print-sum" 2 3)
-| 5
gtk-signal-query structure. See
gtk-signal-query procedure description for more detail.
(gtk-signal-query-object-type
(gtk-signal-query
(gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject"))))
=> 21
gtk-signal-query structure. See
gtk-signal-query procedure description for more detail.
(gtk-signal-query-signal-id
(gtk-signal-query
(gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject"))))
=> 1
gtk-signal-query structure. See
gtk-signal-query procedure description for more detail.
(gtk-signal-query-signal-name
(gtk-signal-query
(gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject"))))
=> "destroy"
gtk-signal-query structure. See
gtk-signal-query procedure description for more detail.
(gtk-signal-query-is-user-signal
(gtk-signal-query
(gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject"))))
=> #f
gtk-signal-query structure. See
gtk-signal-query procedure description for more detail.
(gtk-signal-query-signal-flags
(gtk-signal-query
(gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject"))))
=> '(no-hooks both last)
gtk-signal-query structure. See
gtk-signal-query procedure description for more detail.
(gtk-type-name
(gtk-signal-query-return-val
(gtk-signal-query
(gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject")))))
=> "void"
(gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject"))
=> 1
gtk-signal-lookup
procedure.
(gtk-signal-name(gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject")))
=> "destroy"
(let*((signal-id(gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject")))
(signal(gtk-signal-query signal-id)))
(print "type: " (gtk-signal-query-object-type signal))
(print "signal-id: " (gtk-signal-query-signal-id signal))
(print "signal-name: " (gtk-signal-query-signal-name signal))
(print "is-user-signal: " (gtk-signal-query-is-user-signal signal))
(print "signal-flags: " (gtk-signal-query-signal-flags signal))
(print "return-val: " (gtk-signal-query-return-val signal)))
-|type: 21
-|signal-id: 1
-|signal-name: destroy
-|is-user-signal: #f
-|signal-flags: (NO-HOOKS BOTH LAST)
-|return-val: 1
-|1
Widget Overview
The accel group object
=>
=>
=>
=>
The accel label widget
=>
The alignment widget
=>
=>
The arg object
The arrow widget
=>
=>
The aspect frame widget
=>
=>
The bin widget
The box widget
=>
=>
=>
=>
The handle box widget
The button box widget
=>
=>
=>
=>
=>
=>
The button widget
The calendar widget
=>
The check button widget
The curve widget
=>
=>
The spin button widget
=>
=>
=>
=>
=>
=>
The check menu item widget
=>
=>
=>
=>
The compound list widget
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
gtk-clist type object with optional titles. There are two methods of calling this procedure.
clist;
string type. In this
case the number of columns in the new clist is equal to the
number of arguments, and their values used as column titles.
guile-gtk
gtk-clist-new-with-titles procedure.
gtk-clist:
(gtk-clist-new 3)
gtk-clist and set the column titles to
"Column1" and "Column2":
(gtk-clist-new "Column1" "Column2")
columns should be
equal to the number of columns in clist.
(gtk-clist-append
(gtk-clist-new "Column1" "Column2")
'("Value1" "Value2"))
columns should be
equal to the number of columns in clist.
(gtk-clist-prepend
(gtk-clist-new "Column1" "Column2")
'("Value1" "Value2"))
The color selector widget
=>
=>
=>
(let* ((window(gtk-color-selection-dialog-new "color selection dialog"))
(selection(gtk-color-selection-dialog-colorsel window)))
(gtk-color-selection-get-color selection))
=> (1.0 1.0 1.0 1.527836969495e-312)
The combo widget
=>
=>
=>
The container widget
=>
=>
=>
=>
=>
=>
=>
The font selector widget
=>
=>
=>
=>
The file selector widget
=>
=>
=>
The multi-column tree widget
The curve widget
The gamma curve widget
The dialog widget
The drawing area widget
=>
The entry widget
=>
The editable widget
=>
=>
=>
=>
=>
The event box widget
The file selection dialog widget
The fixed widget
=>
=>
The frame widget
=>
=>
The gamma widget
The horizontal box widget
The horizontal button box widget
=>
The horizontal paned widget
The horizontal ruler widget
The horizontal scale widget
The vertical scale widget
The horizontal scrollbar widget
The horizontal separator widget
The image widget
The input dialog widget
The item widget
The label widget
=>
The list widget
=>
=>
The list item widget
The menu widget
=>
gtk-menu-item-new,
gtk-check-menu-item-new or gtk-radio-menu-item-new.
=>
menu. Change the callback value from #f to
menu positioning procedure (commented out in this example), the menu
will appear on screen at X=100, Y=300 position.
(let((button(gtk-button-new "Press me")))
(gtk-signal-connect
button "event"
(lambda(button event)
(and(eq?(gdk-event-type event) 'button-press)
(gtk-menu-popup
menu #f #f
#f ;;(lambda (menu)(values 100 300))
(gdk-event-button event)
(gdk-event-time event))))))
menu-popup file in examples catalog for full example text.
The menu bar widget
=>
=>
=>
The menu shell widget
=>
=>
=>
The tearoff menu item widget
The menu item widget
=>
=>
=>
=>
gtk-radio-menu-item. The optional group argument
may be either #f or other object of gtk-radio-menu-item type. In
a later case all chained items form a group, ensuring only one item may
be active at a time.
(let*((one (gtk-radio-menu-item-new #f "One"))
(two (gtk-radio-menu-item-new one "Two"))
(many(gtk-radio-menu-item-new two "Many")))
...)
The menu shell widget
The misc widget
=>
=>
The notebook widget
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
The option menu widget
=>
=>
The paned widget
The pixmap widget
The plug widget
The preview widget
=>
=>
=>
The progress bar widget
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
The radio button widget
=>
The range widget
=>
=>
The ruler widget
=>
=>
The scale widget
=>
=>
The scrollbar widget
The scrolled window widget
=>
=>
=>
=>
=>
The separator widget
The statusbar widget
=>
=>
=>
=>
The table widget
=>
=>
=>
=>
=>
=>
=>
The tips query widget
=>
=>
The text widget
=>
=>
The toggle button widget
=>
The tool bar widget
=>
=>
=>
=>
=>
=>
=>
=>
=>
The tool tips widget
=>
=>
=>
The tree widget
=>
=>
=>
=>
=>
The tree item widget
The vertical box widget
The vertical button box widget
=>
The viewport widget
=>
=>
=>
=>
The vertical paned widget
The vertical ruler widget
The vertical scrollbar widget
The vertical separator widget
The base widget
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
=>
The window widget
=>
=>
=>
=>
=>
=>
Utility objects
The accelerator table object
The adjustment object
=>
=>
=>
The GC object
The data object
The style object
Initialization, exit and other features
Initializing and exiting bigloo-gtk
localhost:0 is valid address of X display:
(gtk-init "my-application" "--display" "localhost:0" "file1" "file2")
=> ("my-application" "file1" "file2")
gtk-timeout-add.
(letrec((id(gtk-timeout-add
1000
(lambda()
(print "Hello")
(gtk-timeout-remove id)))))
...)
gtk-timeout-remove.
(gtk-timeout-add 1000 (lambda()(print "Hello")))
=> 9
(gtk-timeout-add 1000 (lambda()(print "Hello") #f))
=> 9
gtk-idle-add.
In this example the "Hello" message is printed only once.
(letrec((id(gtk-idle-add
(lambda()
(print "Hello")
(gtk-idle-remove id)))))
...)
gtk-idle-remove.
(gtk-idle-add 1000 (lambda()(print "Hello")))
=> 9
(gtk-idle-add 1000 (lambda()(print "Hello") #f))
=> 9
Customization of the library
Simplified menu creation
Simplified tree creation
Pop up help mechanism
Resource Files
Macros defined by all objects
Using bigloo-gtk
The simplest bigloo-gtk program
Hello world in bigloo-gtk
An enhanced hello world
Making Hello World II robust
Object internals
Signal internals
Widget internals
Bigloo LDAP interface
OpenLDAP-1.2.9 package from http://www.openldap.org
(12).
API for C library
LDAP types
ldap-open or ldap-init.
LDAP types is a scheme list,
each element of which is a scheme list itself, the first element of
which is an attribute name (scheme string), and the rest of which is
(possibly empty) list of attribute values (scheme strings). For example :
'(("objectclass" "organizationalPerson")
("telephonenumber" "1234567" "7654321"))
LDAP connection
ldap_init(3) manual page for details.
ldap_init(3) manual page for details.
Allocates an LDAP structure but does not open an initial connection
Return LDAP connection handle of type ldap.
See also ldap_init(3) manual page.
ldap_open(3) manual page for details.
ldap_open(3) manual page for details.
ldap.
ldap_open(3) manual page.
ldap-open or ldap-init
userPassword
attribute value of a LDAP entry corresponding to the user
logging in or other credentials
ldap-bind! provides the connection with authentication
information, and is an interface to ldap_simple_bind C client
library function.
cn=root,o=jet,c=ru and password
secret :
(let((ld(ldap-open)))
(ldap-bind! ld "cn=root,o=jet,c=ru" "secret")
...
)
ldap_simple_bind(3) manual page.
ldap-open or ldap-init
ldap-unbind! unbinds from directory, terminates current
association, closes connection and frees resources contained in the
corresponding LDAP structure
ldap_unbind(3) manual page.
LDAP data modifying
ldap-open or ldap-init
attlist. See section LDAP types.
ldap-add adds new LDAP entry, it is an interface to
ldap_add C library function.
ldap-errno to get LDAP error code.
(let((ld(ldap-open))) ;; open default LDAP connection
(ldap-bind ld "cn=root,o=jet,c=ru" "secret") ;; introduce self to server
;; add new entry
(ldap-add ld
"cn=Tsichevski,o=jet,c=ru"
'(("cn" "Tsichevski Vladimir")
("objectclass" "person")
("organization" "jet"))))
ldap_add(3) manual page.
ldap-open or ldap-init
ldap-modify-add adds new attributes to LDAP entry, it is an
interface to ldap_modify C library function.
(let((ld(ldap-open)))
(ldap-bind ld "cn=root,o=jet,c=ru" "secret")
(ldap-modify-add ld
"cn=Tsichevski,o=jet,c=ru"
'(("cn" "Tsichevski Vladimir")
("objectclass" "person")
("organization" "jet"))))
ldap_modify(3) manual page.
ldap-open or ldap-init
attlist. See section LDAP types.
ldap-modify-delete removes attributes from LDAP entry, and is an
interface to ldap_modify C API function.
jet of attribute
organization will be removed from entry cn=Tsichevski,o=jet,c=ru.
(let((ld(ldap-open)))
(ldap-bind ld "cn=root,o=jet,c=ru" "secret")
(ldap-modify-delete ld
"cn=Tsichevski,o=jet,c=ru"
'(("organization" "jet"))))
organization will be
removed from cn=Tsichevski,o=jet,c=ru entry.
(let((ld(ldap-open)))
(ldap-bind ld "cn=root,o=jet,c=ru" "secret")
(ldap-modify-delete ld
"cn=Tsichevski,o=jet,c=ru"
'(("organization"))))
ldap_modify(3) manual page.
ldap-open or ldap-init
attlist. See section LDAP types.
ldap-modify-replace replaces attributes of LDAP entry, creating
the attribute in necessary, and is an interface to ldap_modify
LDAP client library.
jet of attribute
organization replaces the old value in entry
cn=Tsichevski,o=jet,c=ru.
(let((ld(ldap-open)))
(ldap-bind ld "cn=root,o=jet,c=ru" "secret")
(ldap-modify-replace ld
"cn=Tsichevski,o=jet,c=ru"
'(("organization" "jet"))))
ldap_modify(3) manual page.
ldap-open or ldap-init
ldap-delete removes LDAP entry, and is an interface to
ldap_delete C API function.
(let((ld(ldap-open)))
(ldap-bind ld "cn=root,o=jet,c=ru" "secret")
(ldap-delete ld
"cn=Tsichevski,o=jet,c=ru"))
ldap_delete(3) manual page.
LDAP searching
ldap-open or ldap-init
ldap.conf(5) manual page.
base or integer 0, to search the object itself, symbol
onelevel or integer 1, to search the object's immediate children,
symbol subtree or integer 2 to get all the object subtree. The
default is subtree.
ldap_search(3)
manual page for details. Default is "objectclass=*".
ldap-search returns integer result LDAP message
id or raises an exception in case of error.
ldap-next-entry.
ldap_search(3) manual page.
ldap-open or ldap-init
LDAP message object, resulted from successful invocation of ldap-result
ldap-count-entries returns the number of entries in search result
or raises an exception in case of error.
(let*((ld(ldap-open))
(msgid(ldap-search ld atts: '()));; only DN's, no attributes
(result(ldap-result ld msgid)))
(ldap-count-entries ld result))
ldap_count_entries(3) manual page.
ldap-open or ldap-init
LDAP message object, resulted from successful invocation of ldap-result
ldap-first-entry returns the first result entry or #f if no more
entries available.
(let*((ld(ldap-open))
(msgid(ldap-search ld atts: '()))
(result(ldap-result ld msgid)))
(ldap-first-entry ld result))
ldap_first_entry(3) manual page.
ldap-open or ldap-init
ldap-first-entry or ldap-next-entry
ldap_get_dn(3) manual page.
ldap-open or ldap-init
ldap-first-entry or
ldap-next-entry
attlist. See section LDAP types.
ldap-next-entry.
ldap-open or ldap-init
ldap-first-entry,
ldap-next-entry
#f of entry
has no such attribute.
objectclass of LDAP root entry
(let*((ld(ldap-open))
(msgid(ldap-search ld))
(result(ldap-result ld msgid))
(msg(ldap-first-entry ld result)))
(ldap-get-values ld result "objectclass"))
=> ("organization")
ldap_get_values(3) manual page.
ldap-first-entry, ldap-next-entry
ldap-open or ldap-init
LDAP message object, resulted from successful invocation of ldap-result
ldap-next-entry returns the result entry following given entry
or #f if no more entries available.
(let*((ld(ldap-open))
(msgid(ldap-search ld atts: '()))
(result(ldap-result ld msgid)))
(let loop((msg(ldap-first-entry ld result))
(accu '()))
(if msg
(let((node(cons(ldap-get-dn ld msg)
(ldap-get-attributes ld msg))))
(loop
(ldap-next-entry ld msg)
(cons node accu)))
(begin(ldap-message-free result)
(reverse accu)))))
=>
(("dc=jet,dc=msk,dc=ru"
("cn" "Jet Infosystems Int.")
("objectclass" "dmd"))
("uid=archive,dc=jet,dc=msk,dc=ru"
("uid" "archive")
("objectclass" "documentSeries")
("cn" "Archive of documents"))
...
ldap_first_entry(3) manual page.
ldap-open or ldap-init
ldap-search, ldap-modify).
ldap-search, ldap-modify).
ldap-result returns the result LDAP message or raises an
exception in case of error.
ldap-next-entry.
ldap_result(3) manual page.
LDAP cache control
ldap-open or ldap-init
ldap_flush_cache(3) manual page.
ldap-open or ldap-init
ldap_destroy_cache(3) manual page.
ldap-open or ldap-init
ldap_disable_cache(3) manual page.
ldap-open or ldap-init
ldap_enable_cache(3) manual page.
ldap-open or ldap-init
ldap_set_cache_options(3) manual page for details.
ldap_set_cache_options(3) manual page for details.
ldap-open or ldap-init
ldap_uncache_entry(3) manual page.
ldap-open or ldap-init
ldap-search, ldap-modify).
ldap_uncache_request(3) manual page.
LDAP errors handling
ldap-open or ldap-init
ldap-error-string.
ldap-errno
to get this value from ldap structure.
ldap_err2string() C API call.
ldap_err2string(3) manual page.
LDAP misc utilities
ldap-get-dn
ldap-get-dn and breaks it up into its
component parts. This is an interface to ldap_explode_dn() C
call.
ldap_explode_dn(3) manual page.
(ldap-explode-dn " o=jet, c=ru") => ("c=ru" " o=jet")
ldap-search operation msgid,
returns the list of LDAP entries. Every element of this list is a result
of cons operation on the DN of the entry, and entry attribute
list in a attlist format.
ldap-next-entry section.
(let*((ld(ldap-open))
(msgid(ldap-search ld)))
(ldap-answer ld msgid))
ldap-answer section.
current-ldap procedure as a default LDAP
connection handle.
=>
ldap-search operation without giving a base argument, return the DN of entry returned.
(current-ldap) as a LDAP connection.
(ldap-defbase)
=> "dc=jet,dc=msk,dc=ru"
ldap-modify-delete, adds the new attributes using
ldap-modify-add, replaces the attribute values with the use of
ldap-modify-replace.
Concept Index
a
c
l
m
p
r
s
Type Index
a
c
i
l
n
s
t
Procedure Index
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
x
This document was generated on 2 August 2000 using texi2html 1.56k.