⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rangeswitc.3

📁 speech signal process tools
💻 3
字号:
.\" Copyright (c) 1986-1990 Entropic Speech, Inc..\" Copyright (c) 1991 Entropic Research Laboratory, Inc.; All rights reserved.\" @(#)rangeswitc.3	1.7 07 Aug 1991 ESI/ERL.ds ]W (c) 1991 Entropic Research Laboratory, Inc..TH RANGE_SWITCH 3\-ESPSu 07 Aug 1991.ds ]W "\fI\s+4\ze\h'0.05'e\s-4\v'-0.4m'\fP\(*p\v'0.4m'\ Entropic Speech, Inc..SH NAME.nfrange_switch \- parse an integer range argumentlrange_switch \- parse a long range argumentfrange_switch \- parse a floating range argumentgrange_switch \- parse a generic range argumentfld_range_switch \- parse a field name and generic subrangetrange_switch \- parse a time (in seconds) range argument.SH SYNOPSIS.ft B.nf#include <stdio.h>extern int debug_level;voidrange_switch (text, startp, endp, us)char *text;int *startp, *endp;int us;voidlrange_switch (text, startp, endp, us)char *text;long *startp, *endp;int us;voidfrange_switch (text, startp, endp)char *text;double *startp, *endp;long *grange_switch (text, array_len)char *text;long *array_len;long *fld_range_switch(text, name, array_len, hd)char *text;char **name;long *array_len;struct header *hd;voidtrange_switch (text, hd, startp, endp)char *text;struct header *hd;long *startp, *endp;.ft.sp.fi.SH DESCRIPTION.PPThese functions are used to parse range arguments..PPFor the functions \fIrange_switch\fP, \fIlrange_switch\fP,\fIfrange_switch\fP, and \fItrange_switch\fP, the \fItext\fP argumentmay have any of the forms a:b, a:+b, a:, :b, :, blank, or null. In thecase of \fIrange_switch\fP and \fIlrange_switch\fP, a and b areintegers.  In the case of \fIfrange_switch\fP and \fItrange_switch\fP,a and b are floating point numbers.  If the agument \fIus\fP isnonzero (indicating unsigned ranges) in \fIrange_switch\fP and\fIlrange_switch\fP, then the minus sign is considered a fieldseparator (it can replace the colon) and only unsigned values arereturned (thus we can have a-b, a-, -b, or -)..PPThe values of a and b specify the start and end of a desired range.The functions \fIrange_switch\fP, \fIlrange_switch\fP, and\fIfrange_switch\fP return these values.  If If the start is specified(the input is in the form a:b or a:), then the corresponding value isreturned via \fIstartp\fP.  If the end of the range is specified (theinput is in the form a:b or :b) then the corresponding value isreturned via \fIendp\fP.  For a null text argument, or one containinginvalid characters, neither endpoint is set.  In the case of\fItrange_switch\fP, a and b are interpreted as time offsets into anESPS file described by the header \fIhd\fP; the function obtains the\fIstart_time\fP and \fIrecord_freq\fP generics from \fIhd\fP,converts a and b into record numbers, and returns them via\fIstartp\fP and \fIendp\fP..PPThe form a:+b is equivalent to a:a+b for all functions..PP.I Grange_switchis used to parse integer range arguments seperated by commas. Eachfield in the.I textargument is seperated by a ``,'' and may have any of the followingforms, where a and b are integers: ``a:b'', ``a:+b'', or ``a''.  Theminus sign is considered a field separator (it can replace the colon)and only unsigned values are returned (thus we can have a-b)..PP.I Grange_switchallocates memory for and returns a pointer to an array containing theelements selected.  The length of the array is returned in\fI*array_len\fP..PP.I Fld_range_switchparses a range specification given in terms of a feature-file fieldname and an optional bracketed generic subrange specification.  Theargument.I textmust point to the beginning of a string, which may be of one of two forms:.TP.IB field_name \^[\^ grange \^]\^.TP.I field_name.LPwhere.I field_namehas the form of a field name.RI ( i.e.the same as a C identifier)and.I grangeis a general range specification acceptable to the function.IR grange_switch (3-ESPSu).Such strings are accepted on the command line by various programs andalso occur in the.I srcfieldsarrays in feature-file headersand in the Ascii ``fieldfiles'' accepted by fea_deriv(1-ESPS)..PPThe bracketed.I grange,if present, specifies a set of integers that refer to positions withinthe named field, counting the first as position zero.  The returnedvalue of the function and the value assigned to.I *array_lenare the same as for the function.I grange_switch()applied to the.I grangepart of the.I textstring.A copy of the.I field_namepart of the.I textstring is assigned to the string variable.I *name..PPThe argument.I hdis ignored unless the bracketed.I grangespecification is omitted.In that case.I hdmust point to a feature-file header containing a definition of the named field,and all positions in the field are implied..SH EXAMPLES.I lrange_switchor.I range_switchmay be used as follows:.sp.nf    start = default_start;    end = default_end;    range_switch (text, &start, &end, us);or    lrange_switch (text, &start, &end, us);.fi.sp.I Grange_switchmay be used as follows:.sp.nf   char text[] = "1,3,5:+2,11";	   /* usually obtained from command line */   long	array_len;   long	*array;   array = grange_switch (text, &array_len);.fi.sp.I array_lenwill be set to 6 and on return,.I arraywill contain the following elements:.sp.nf	array[0] = 1	array[1] = 3	array[2] = 5	array[3] = 6	array[4] = 7	array[5] = 11.fi.sp.I Fld_range_switchmay be used as follows..sp.nf   char text[] = "spec_param[3,5:7]";   char *name;   long array_len;   long *array;   array = fld_range_switch(text, &name, &array_len, (struct header *) NULL);.fi.spOn return,.I namepoints to the beginning of a string containing "spec_param",.I array_lenis set to 4, and.I arraycontains the elements.sp.nf	array[0] = 3	array[1] = 5	array[2] = 6	array[3] = 7.fi.spHere is a second example for.I fld_range_switch..sp.nf   char text[] = "spec_param";   char *name;   long array_len;   struct header *hd = read_header(input_file);   long *array;   array = fld_range_switch(text, &name, &array_len, hd);.fi.spSuppose.I hdpoints to a feature-file header in which.I spec_paramis defined as a field of size 10.Then on return.I nameis as before,.I array_lenis set to 10, and.I arraycontains the integers 0 through 9 in order..SH SEE ALSOget_deriv_vec(3-ESPSu), FEA(5-ESPS), .SH DIAGNOSTICS.PPIf the bracketed .I grangespecification is omitted from the input stringand the named field is not defined in the header,.I fld_range_switchreturns (long *) NULL and assigns 0 to.RI * array_len.If.I fld_range_switchcannot allocate memory, it prints a message and the program exits.  If\fItrange_switch\fP is passed a null ESPS header, a warning is printedif \fIdebug_level\fP is positive.  In this case, or if the\fIstart_time\fP and \fIrecord_freq\fP generics are not present, values of 0 and 1 are used respectively.  .SH BUGSNone known..SH FUTURE CHANGESAllow for negative values to be used in \fIgrange_switch\fP..SH AUTHORMan page by Ajaipal S. Virdy.Fld_range_switch added by Rodney Johnson.trange_switch by John Shore. 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -