linsearch.3
来自「speech signal process tools」· 3 代码 · 共 110 行
3
110 行
.\" Copyright (c) 1987-1990 Entropic Speech, Inc..\" Copyright (c) 1997 Entropic Research Laboratory, Inc. All rights reserved..\" @(#)linsearch.3 1.6 18 Apr 1997 ESI/ERL.ds ]W (c) 1997 Entropic Research Laboratory, Inc..TH LIN_SEARCH 3\-ESPSu 18 Apr 1997.SH NAME.nflin_search \- case-insensitive search on a NULL-terminated array of stringslin_search2 \- case-sensitive search on a NULL-terminated array of strings.SH SYNOPSIS.ft Bint.brlin_search(array, text).brchar *text, *array[];.brint.brlin_search2(array, text).brchar *text, *array[];.ft.SH DESCRIPTION.I lin_searchand.I lin_search2search.I array,which is assumed to be a NULL-terminated array of character pointers.The functions return the index of the string in.I arraythat matches the string.I text.If there is no match, \-1 is returned..I lin_searchignores the case of letters in.I text,but the strings in.I arraymust all be upper-case..I lin_search2requires the string in.I arrayto match.I textexactly..PP.I lin_searchis intended to be used to get the numeric valuesassociated with compile time.BR #define sused for analysis methods and codes.For each header item defined in \fI<esps/header.h>\fR that takes a numeric value associated with a compile time \fB#define\fR,there is a NULL terminated array of strings that contains the stringrepresentations of those compile time values. This array provides arun-time mapping between the \fB#define\fR names and the values..PP.I lin_search2is suitable for searching for field names in the array.IR hd.fea \-> namesin a FEA-file header,searching for CODED values in the arrays.IR hd.fea \-> enums [ i ]in a FEA-file header,and searching for CODED values in the array.I codesin a generic-header.RI ( gen_hd )structure..SH EXAMPLEFor the header item \fIequip\fR the possible values are (from\fI<esps/header.h>\fR):.nf\fB#define\fR EF12M 1\fB#define\fR AD12F 2\fB#define\fR DSC 3\fB#define\fR LPA11 4.fi.PPThe following statement in the library defines the array\fIequip_codes\fR:.nf\fBstatic char\fR *equip_codes[] = {"NONE", "EF12M", "AD12F", "DSC", "LPA11", NULL};.fi.PPIf the application program reads a string into \fItext\fR that should containan equipment type, the the program can get the numeric code by:.nf\fI/* say text is "EF12M" */\fRequip_type = lin_search(equip_codes,text);\fI/* the function will return 1 */\fR.fi.PPThe programmer must consult \fI<esps/header.h>\fR to get the validvalues and the name of the array associated with each header item.The required \fBextern\fR declarations are in \fI<esps/header.h>\fR..SH DIAGNOSTICSNone..SH BUGSNone known..SH SEE ALSO.nfESPS(5\-ESPS), FEA(5\-ESPS).fi.SH AUTHORAlan Parker
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?