| 1 |
# Copyright (c) 1990 The Regents of the University of California. |
| 2 |
# Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 3 |
# See the file "license.terms" for information on usage and redistribution |
| 4 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 5 |
# |
| 6 |
# |
| 7 |
|
| 8 |
=head1 NAME |
| 9 |
|
| 10 |
Tk_GetUid, Tk_Uid - convert from string to unique identifier |
| 11 |
|
| 12 |
=for category C Programming |
| 13 |
|
| 14 |
=head1 SYNOPSIS |
| 15 |
|
| 16 |
B<#include E<lt>tk.hE<gt>> |
| 17 |
|
| 18 |
B<#typedef char *Tk_Uid> |
| 19 |
|
| 20 |
Tk_Uid |
| 21 |
B<Tk_GetUid>(I<string>) |
| 22 |
|
| 23 |
=head1 ARGUMENTS |
| 24 |
|
| 25 |
=over 4 |
| 26 |
|
| 27 |
=item char *string (in) |
| 28 |
|
| 29 |
String for which the corresponding unique identifier is |
| 30 |
desired. |
| 31 |
|
| 32 |
=back |
| 33 |
|
| 34 |
=head1 DESCRIPTION |
| 35 |
|
| 36 |
B<Tk_GetUid> returns the unique identifier corresponding |
| 37 |
to I<string>. |
| 38 |
Unique identifiers are similar to atoms in Lisp, and are used |
| 39 |
in Tk to speed up comparisons and |
| 40 |
searches. A unique identifier (type Tk_Uid) is a string pointer |
| 41 |
and may be used anywhere that a variable of type ``char *'' |
| 42 |
could be used. However, there is guaranteed to be exactly |
| 43 |
one unique identifier for any given string value. If B<Tk_GetUid> |
| 44 |
is called twice, once with string I<a> and once with string |
| 45 |
I<b>, and if I<a> and I<b> have the same string value |
| 46 |
(strcmp(a, b) == 0), then B<Tk_GetUid> will return exactly |
| 47 |
the same Tk_Uid value for each call (Tk_GetUid(a) == Tk_GetUid(b)). |
| 48 |
This means that variables of type |
| 49 |
Tk_Uid may be compared directly (x == y) without having to call |
| 50 |
B<strcmp>. |
| 51 |
In addition, the return value from B<Tk_GetUid> will have the |
| 52 |
same string value as its argument (strcmp(Tk_GetUid(a), a) == 0). |
| 53 |
|
| 54 |
=head1 KEYWORDS |
| 55 |
|
| 56 |
atom, unique identifier |