📄 getgenhd.3
字号:
.\" Copyright (c) 1987-1990 Entropic Speech, Inc..\" Copyright (c) 1997 Entropic Research Laboratory, Inc. All rights reserved..\" @(#)getgenhd.3 1.18 18 Apr 1997 ESI/ERL.ds ]W (c) 1997 Entropic Research Laboratory, Inc..TH GET_GENHD 3\-ESPSu 18 Apr 1997.SH "NAME".nfget_genhd \- get a pointer to a generic header itemget_genhd_c \- get a pointer to generic header item of type charget_genhd_s \- get a pointer to generic header item of type short or codedget_genhd_l \- get a pointer to generic header item of type longget_genhd_f \- get a pointer to generic header item of type floatget_genhd_d \- get a pointer to generic header item of type doubleget_genhd_coded \- get a pointer to string representations of coded generic header itemsget_genhd_val \- get the value of a numeric scalar generic header itemget_genhd_efile \- get a pointer to the header of an external ESPS EFILEget_genhd_efile_name \- get a pointer to the name of an external ESPS EFILEget_genhd_afile \- get a stream pointer to an AFILE generic header itemget_genhd_afile_name \- get a pointer to the name of an external ESPS AFILE.fi.SH "SYNOPSIS".ft B#include <esps/esps.h>.PP.ft B.nfchar *get_genhd(name, hd)char *name;struct header *hd;.spchar *get_genhd_c(name, hd)char *name;struct header *hd;.spshort *get_genhd_s(name, hd)char *name;struct header *hd;.splong *get_genhd_l(name, hd)char *name;struct header *hd;.spfloat *get_genhd_f(name, hd)char *name;struct header *hd;.spdouble *get_genhd_d(name, hd)char *name;struct header *hd;.spchar **get_genhd_coded(name, hd)char *name;struct header *hd;.spdoubleget_genhd_val(name, hd, default)char *name;struct header *hd;double default;.spstruct header *get_genhd_efile(name, hd)char *name;struct header *hd;.spchar *get_genhd_efile_name(name, hd)char *name;struct header *hd;.spFILE *get_genhd_afile(name, hd)char *name;struct header *hd;.spchar *get_genhd_afile_name(name, hd)char *name;struct header *hd;.fi.ft R.SH "DESCRIPTION".I Get_genhdreturns a pointer to the data associated with thegeneric header item \fIname\fR. It is a "bare" form of these functionsand should rarely be used in normal programs. Programs should usuallyuse one of these type\-specific versions.The functions \fIget_genhd_s\fR, \fIget_gehd_l\fR, \fIget_genhd_f\fR,\fIget_genhd_d\fR, and \fIget_genhd_c\fR call \fIget_genhd\fR and returna pointer value of the correct type..PPThe function \fIget_genhd_coded\fR returns a pointer to alist of character strings that represent the textvalues of the coded item (if the size of the coded item is greater than 1,there is one string for each element). This is most often needed when it isdesired to print a coded value.For a list of all possible values, use \fIgenhd_codes\fR.Note that when using a coded valuefor program control (as in a \fIswitch\fR statement), its numericmust be used, and \fIget_genhd_s\fR should be used in this case..PPThe value returned by.I get_genhd_valis the value of the header item.I nameconverted to DOUBLE,provided that the itemhas one of the numeric typesDOUBLE, FLOAT, LONG, SHORT, and CHAR (or BYTE).If.I nameis not defined as a generic header item in.I hd,or its data type is not numericthe returned value is that of the argument.I default.If .I nameis not a scaler (i.e. its size is greater than 1) the the value returnedis the value of the first element of.I name..PP.I Get_genhd_efileattempts to open the filename stored in the header item \fIname\fR andreturns a pointer to the header of that file. If the file cannot beopened, or it is not a valid ESPS file, or \fIname\fR is not of typeEFILE, then the function returns NULL. Note that since this functionopens and processes file referenced by the header item each time it iscalled, the function should not be called more than once for a givenvalue of \fIname\fR. The function does not keep the external ESPSfile open and no provision is made for reading the data in this file.Note that this call can be expensive in the current implementation incases where the EFILE is on a remote host, as \fIrcp\fP is used toobtain a local copy..PP.I Get_genhd_afileattempts to open the filename stored in the header item \fIname\fR andreturns a file stream pointer (FILE *) to that file. If the file cannotbe opened or \fIname\fR is not of type AFILE the function returns NULL.Note that this call can be expensive in the current implementation incases where the AFILE is on a remote host, as \fIrcp\fP is used toobtain a local copy. .PP.I Get_genhd_efile_nameand.I get_genhd_afile_namereturn the name of the file referenced by the generic header item\fIname\fR. (Do not confuse the name of the generic header item, withthat of the referenced filename.) If \fIname\fR is not of type EFILE or AFILE,then NULL is returned..PPThese functions can only be called when the value of.I hdis a non-NULL header pointer such as the result returned by.IR read_header (3\-ESPSu)(or possibly.IR new_header (3\-ESPSu)or.IR copy_header (3\-ESPSu))..PPAll these functions except.I get_genhd_valreturn NULL if \fIname\fR does not exist in the header..SH EXAMPLE.PP.nffloat *p_zeta;\fI/* read in the header */\fRhd = read_header(file);\fI/* get generic header item zeta, assume you already know its type */\fRp_zeta = get_genhd_f("zeta", hd);\fI/* use its value */\fRy = *p_zeta*45.6;\fI/* instead of using a pointer variable, you could do this */\fRy = *get_genhd_f("zeta", hd)*45.6;\fI/* print value (in ASCII) of generic header item spec_rep */\fRfprintf (stdout, "spec_rep = %S", *get_genhd_coded("spec_rep", hd));.fi.SH DIAGNOSTICS.PPIf \fIname\fR or \fIhd\fR is NULL,an assertion failure occurs (see.IR spsassert (3-ESPSu))and a message is printed..SH "SPECIAL NOTE".PPIn earlier versions of ESPS, only \fIget_genhd\fR existed. Since itis typed (char *) the function return type should be coerced into thecorrect type. Plain \fIget_genhd\fR should not be used in newprograms..SH "SEE ALSO".nfadd_genhd(3\-ESPSu), genhd_list(3\-ESPSu),genhd_type(3\-ESPSu), genhd_codes(3\-ESPSu),copy_genhd(3\-ESPSu), read_header(3\-ESPSu),new_header(3\-ESPSu), copy_header(3\-ESPSu),spsassert(3\-ESPSu).fi.PP.SH "AUTHOR".PPAlan Parker
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -