.\" $Id: namefind.3,v 1.1 2002/03/08 13:51:03 fred Exp $ .\" @(#)namefind.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot .if t \{\ .XS \n% .ti 0.2i namefind .XE .XS4 \n% .ti 0.2i namefind .XE4 \} .TH namefind 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" .SH NAME namefind \- hash table for strings .so jessie/alliance/alc_origin.1.en.gz .SH SYNOPSYS .nf .if n \{\ .ft B \} .if t \{\ .ft CR \} #include "mut.h" char \(**namefind(inputname) char \(**inputname; .ft R .fi .SH PARAMETER .TP 20 \fIinputname\fP Pointer to a string of characters .SH DESCRIPTION The \fBnamefind\fP function search the mbk dictionnary of names. If the string has already been inserted in the dictionnary, then a pointer to this string is return, else \fBnamefind\fP returns NULL. .br The case of the letters do not matter. All names are changed to lower case before beeing searched in the symbol table. This is needed because most of the file format do not check case. .br \fBnamefind\fP is used by all mbk utility function using names, so its use should be needed only when directly filling or modifing the structure, or when having to compare an external string to mbk internal ones. This should speed up string comparisons. .br One shall never modify the contains of a string pointed to by a result of \fBnamefind\fP, since all the field that points to this name would have there values modified, and that there is no chance that the new hash code will be the same as the old one, so pointer comparison would be meaningless. All string used by \fBnamefind\fP are constants string, and therefore must be left alone. .SH RETURN VALUE \fBnamefind\fP returns a string pointer if the \fIinputname\fP is already in the hash table, else NULL. .SH EXAMPLE .ta 3n 6n 9n 12n 15n 18n 21n .nf .if n \{\ .ft B \} .if t \{\ .ft CR \} #include "mut.h" #include "mlo.h" lofig_list \(**find_fig(name) char \(**name; { lofig_list \(**p; name = namefind(name); if (name == NULL) return NULL; for (p = HEAD_LOFIG; p; p = p\->NEXT) if (p\->NAME == name) /\(** pointer equality \(**/ return p; return NULL; } .ft R .fi .SH DIAGNOSTICS \fBnamefind\fP can be used only after a call to \fBmbkenv\fP(3). .SH SEE ALSO .BR mbk (1) .BR namealloc(3). .so jessie/alliance/alc_bug_report.1.en.gz