File: proto.tex

package info (click to toggle)
spooles 2.2-11
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 19,656 kB
  • ctags: 3,690
  • sloc: ansic: 146,836; sh: 7,571; csh: 3,615; makefile: 1,968; perl: 74
file content (550 lines) | stat: -rw-r--r-- 21,198 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
\par
\section{Prototypes and descriptions of {\tt ZV} methods}
\label{section:ZV:proto}
\par
This section contains brief descriptions including prototypes
of all methods that belong to the {\tt ZV} object.
\par
\subsection{Basic methods}
\label{subsection:ZV:proto:basics}
\par
As usual, there are four basic methods to support object creation,
setting default fields, clearing any allocated data, and free'ing
the object.
\par
%=======================================================================
\begin{enumerate}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
ZV * ZV_new ( void ) ;
\end{verbatim}
\index{ZV_new@{\tt ZV\_new()}}
This method simply allocates storage for the {\tt ZV} structure 
and then sets the default fields by a call to 
{\tt ZV\_setDefaultFields()}.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_setDefaultFields ( ZV *zv ) ;
\end{verbatim}
\index{ZV_setDefaultFields@{\tt ZV\_setDefaultFields()}}
This method sets the default fields of the object,
{\tt size = maxsize = owned = 0} and {\tt vec = NULL}.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL}
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_clearData ( ZV *zv ) ;
\end{verbatim}
\index{ZV_clearData@{\tt ZV\_clearData()}}
This method releases any data owned by the object. 
If {\tt vec} is not {\tt NULL} and {\tt owned = 1},
then the storage for {\tt vec} is free'd by a call to
{\tt ZVfree()}.
The structure's default fields are then set 
with a call to {\tt ZV\_setDefaultFields()}.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL}
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_free ( ZV *zv ) ;
\end{verbatim}
\index{ZV_free@{\tt ZV\_free()}}
This method releases any storage by a call to 
{\tt ZV\_clearData()} then free's the storage for the 
structure with a call to {\tt free()}.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL}
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\end{enumerate}
\par
\subsection{Instance methods}
\label{subsection:ZV:proto:Instance}
\par
These method allow access to information in the data fields without
explicitly following pointers.
There is overhead involved with these method due to the function
call and error checking inside the methods.
\par
%=======================================================================
\begin{enumerate}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
int ZV_owned ( ZV *zv ) ;
\end{verbatim}
\index{ZV_owned@{\tt ZV\_owned()}}
This method returns the value of {\tt owned}.
If {\tt owned > 0}, 
then the object owns the data pointed to by {\tt vec}
and will free this data with a call to {\tt ZVfree()} when its data
is cleared by a call to {\tt ZV\_free()} or {\tt ZV\_clearData()}.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL}
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
int ZV_size ( ZV *zv ) ;
\end{verbatim}
\index{ZV_size@{\tt ZV\_size()}}
This method returns the value of {\tt size},
the present size of the vector.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL}
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
int ZV_maxsize ( ZV *zv ) ;
\end{verbatim}
\index{ZV_maxsize@{\tt ZV\_size()}}
This method returns the value of {\tt size},
the maximum size of the vector.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL}
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_entry ( ZV *zv, int loc, double *pReal, double *pImag ) ;
\end{verbatim}
\index{ZV_entry@{\tt ZV\_entry()}}
This method fills {\tt *pReal} with the real part and
{\tt *pImag} with the imaginary part of the {\tt loc}'th entry
in the vector.
If {\tt loc < 0} or {\tt loc >= size}, i.e., if the location is
out of range, we return {\tt 0.0}.
This design {\tt feature} is handy when a list terminates with a
{\tt 0.0} value.
\par \noindent {\it Error checking:}
If {\tt zv}, {\tt pReal} or {\tt pImag} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_pointersToEntry ( ZV *zv, int loc, double **ppReal, double **ppImag ) ;
\end{verbatim}
\index{ZV_pointersToEntry@{\tt ZV\_pointersToEntry()}}
This method fills {\tt **ppReal} with a pointer to the real part and
{\tt **ppImag} with a pointer to the imaginary part 
of the {\tt loc}'th entry in the vector.
If {\tt loc < 0} or {\tt loc >= size}, i.e., if the location is
out of range, we return {\tt 0.0}.
This design {\tt feature} is handy when a list terminates with a
{\tt 0.0} value.
\par \noindent {\it Error checking:}
If {\tt zv}, {\tt pReal} or {\tt pImag} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
double * ZV_entries ( ZV *zv ) ;
\end{verbatim}
\index{ZV_entries@{\tt ZV\_entries()}}
This method returns {\tt vec},
a pointer to the base address of the vector.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_sizeAndEntries ( ZV *zv, int *psize, double **pentries ) ;
\end{verbatim}
\index{ZV_sizeAndEntries@{\tt ZV\_sizeAndEntries()}}
This method fills {\tt *psize} with the size of the vector
and {\tt **pentries} with the base address of the vector.
\par \noindent {\it Error checking:}
If {\tt zv}, {\tt psize} or {\tt pentries} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_setEntry ( ZV *zv, int loc, double real, double imag ) ;
\end{verbatim}
\index{ZV_setEntry@{\tt ZV\_setEntry()}}
This method sets the {\tt loc}'th entry of the vector 
to {\tt (real,imag)}.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL} or {\tt loc < 0},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\end{enumerate}
\par
\subsection{Initializer methods}
\label{subsection:ZV:proto:initializers}
\par
There are three initializer methods.
\par
%=======================================================================
\begin{enumerate}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_init ( ZV *zv, int size, double *entries ) ;
\end{verbatim}
\index{ZV_init@{\tt ZV\_init()}}
This method initializes the object given a size for the vector
and a possible pointer to the vectors' storage.
Any previous data is cleared with a call to {\tt ZV\_clearData()}.
If {\tt entries != NULL} then the {\tt vec} field is set to {\tt
entries}, the {\tt size} and {\tt maxsize} fields are set to 
{\tt size}, and {\tt owned} is set to zero
because the object does not own the entries.
If {\tt entries} is {\tt NULL} and {\tt size > 0} then a vector 
is allocated by the object, and the object owns this storage.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL} or {\tt size < 0},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_init1 ( ZV *zv, int size ) ;
\end{verbatim}
\index{ZV_init1@{\tt ZV\_init1()}}
This method initializes the object given a size size for the vector
via a call to {\tt ZV\_init()}.
\par \noindent {\it Error checking:}
Error checking is done with the call to {\t ZV\_init()}.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_init2 ( ZV *zv, int size, int maxsize, int owned, double *vec ) ;
\end{verbatim}
\index{ZV_init2@{\tt ZV\_init2()}}
This is the total initialization method.
The data is cleared with a call to {\tt ZV\_clearData()}.
If {\tt vec} is {\tt NULL}, the object is initialized via a call
to {\tt ZV\_init1()}.
Otherwise, the objects remaining fields are set to the input
parameters.
and if {\tt owned} is not {\tt 1}, the data is not owned, so the
object cannot grow.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL}, 
or if {\tt size < 0},
or if {\tt maxsize < size},
or if {\tt owned} is not equal to {\tt 0} or {\tt 1},
of if { \tt owned = 1} and {\tt vec = NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_setMaxsize ( ZV *zv, int newmaxsize ) ;
\end{verbatim}
\index{ZV_setMaxsize@{\tt ZV\_setMaxsize()}}
This method sets the maximum size of the vector.
If {\tt maxsize}, the present maximum size of the vector,
is not equal to {\tt newmaxsize}, then new storage is allocated.
Only {\tt size}
entries of the old data are copied into the new
storage, so if {\tt size > newmaxsize} then data will be lost.
The {\tt size} field is set to the minimum of {\tt size} 
and {\tt newmaxsize}.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL} or {\tt newmaxsize < 0},
or if {\tt 0 < maxsize} and {\tt owned == 0},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_setSize ( ZV *zv, int newsize ) ;
\end{verbatim}
\index{ZV_setSize@{\tt ZV\_setSize()}}
This method sets the size of the vector.
If {\tt newsize > maxsize}, the length of the vector is increased
with a call to {\tt ZV\_setMaxsize()}.
The {\tt size} field is set to {\tt newsize}.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL}, or {\tt newsize < 0},
or if {\tt 0 < maxsize < newsize} and {\tt owned = 0},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\end{enumerate}
\par
\subsection{Utility methods}
\label{subsection:ZV:proto:utilities}
\par
\par
%=======================================================================
\begin{enumerate}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_shiftBase ( ZV *zv, int offset ) ;
\end{verbatim}
\index{ZV_shiftBase@{\tt ZV\_shiftBase()}}
This method shifts the base entries of the vector and decrements
the present size and maximum size of the vector by {\tt offset}.
This is a dangerous method to use because the state of the vector
is lost, namely {\tt vec}, the base of the entries, is corrupted.
If the object owns its entries and {\tt ZV\_free()}, 
{\tt ZV\_setSize()} or {\tt ZV\_setMaxsize()} is called before 
the base has been shifted back to
its original position, a segmentation violation will likely result.
This is a very useful method, but use with caution.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL}, 
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_push ( ZV *zv, double val ) ;
\end{verbatim}
\index{ZV_push@{\tt ZV\_push()}}
This method pushes an entry onto the vector.
If the vector is full, i.e., if {\tt size == maxsize - 1},
then the size of the vector is doubled if possible.
If the storage cannot grow, i.e., if the object does not own its
storage, an error message is printed and the program exits.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL}, 
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
double ZV_minabs ( ZV *zv ) ;
double ZV_maxabs ( ZV *zv ) ;
\end{verbatim}
\index{ZV_minabs@{\tt ZV\_minabs()}}
\index{ZV_maxabs@{\tt ZV\_maxabs()}}
This method simply returns the minimum and maximum magnitudes of
entries in the vector.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL}, {\tt size <= 0} or if {\tt vec == NULL}, 
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
int ZV_sizeOf ( ZV *zv ) ;
\end{verbatim}
\index{ZV_sizeOf@{\tt ZV\_sizeOf()}}
This method returns the number of bytes taken by the object.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL}
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_fill ( ZV *zv, double real, double imag ) ;
\end{verbatim}
\index{ZV_fill@{\tt ZV\_fill()}}
This method fills the vector with a scalar value.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_zero ( ZV *zv ) ;
\end{verbatim}
\index{ZV_zero@{\tt ZV\_zero()}}
This method fills the vector with zeros.
\par \noindent {\it Error checking:}
If {\tt zv} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_copy ( ZV *zv1, ZV *zv2 ) ;
\end{verbatim}
\index{ZV_copy@{\tt ZV\_copy()}}
This method fills the {\tt zv1} object with entries in the {\tt
iv2} object.
Note, this is a {\it mapped} copy, {\tt zv1} and {\tt zv2} need not
have the same size.
The number of entries that are copied is the smaller of the two sizes.
\par \noindent {\it Error checking:}
If {\tt zv1} or {\tt zv2} is {\tt NULL},
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
void ZV_log10profile ( ZV *zv, int npts, DV *xDV, DV *yDV, double tausmall, 
                       double taubig, int *pnzero, int *pnsmall, int *pnbig ) ;
\end{verbatim}
\index{ZV_log10profile@{\tt ZV\_log10profile()}}
This method scans the entries in the {\tt ZV} object and fills {\tt
xDV} and {\tt yDV} with data that allows a simple $\log_{10}$ 
distribution plot.
Only entries whose magnitudes lie in the range {\tt [tausmall, taubig]}
contribute to the distribution.
The number of entries whose magnitudes are zero, 
smaller than {\tt tausmall},
or larger than {\tt taubig} 
are placed into {\tt pnzero}, {\tt *pnsmall} and {\tt *pnbig},
respectively.
On return, the size of the {\tt xDV} and {\tt yDV} objects 
is {\tt npts}.
\par \noindent {\it Error checking:}
If {\tt zv}, {\tt xDV}, {\tt yDV}, {\tt pnsmall} or {\tt pnbig} are
{\tt NULL}, or if ${\tt npts} \le 0$, 
or if ${\tt taubig} < 0.0$
or if ${\tt tausmall} > {\tt taubig}$,
an error message is printed and the program exits.
%-----------------------------------------------------------------------
\end{enumerate}
\par
\subsection{IO methods}
\label{subsection:ZV:proto:IO}
\par
There are the usual eight IO routines.
The file structure of a {\tt ZV} object is simple:
the first entry is {\tt size}, followed by the {\tt size} entries
found in {\tt vec[]}.
\par
%=======================================================================
\begin{enumerate}
%-----------------------------------------------------------------------
\item
\begin{verbatim}
int ZV_readFromFile ( ZV *zv, char *fn ) ;
\end{verbatim}
\index{ZV_readFromFile@{\tt ZV\_readFromFile()}}
\par
This method reads a {\tt ZV} object from a file.
It tries to open the file and if it is successful, 
it then calls {\tt ZV\_readFromFormattedFile()} or
{\tt ZV\_readFromBinaryFile()}, 
closes the file
and returns the value returned from the called routine.
\par \noindent {\it Error checking:}
If {\tt zv} or {\tt fn} are {\tt NULL}, 
or if {\tt fn} is not of the form
{\tt *.zvf} (for a formatted file) 
or {\tt *.zvb} (for a binary file),
an error message is printed and the method returns zero.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
int ZV_readFromFormattedFile ( ZV *zv, FILE *fp ) ;
\end{verbatim}
\index{ZV_readFromFormattedFile@{\tt ZV\_readFromFormattedFile()}}
\par
This method reads in a {\tt ZV} object from a formatted file.
If there are no errors in reading the data, 
the value {\tt 1} is returned.
If an IO error is encountered from {\tt fscanf}, zero is returned.
\par \noindent {\it Error checking:}
If {\tt zv} or {\tt fp} are {\tt NULL},
an error message is printed and zero is returned.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
int ZV_readFromBinaryFile ( ZV *zv, FILE *fp ) ;
\end{verbatim}
\index{ZV_readFromBinaryFile@{\tt ZV\_readFromBinaryFile()}}
\par
This method reads in a {\tt ZV} object from a binary file.
If there are no errors in reading the data, 
the value {\tt 1} is returned.
If an IO error is encountered from {\tt fread}, zero is returned.
\par \noindent {\it Error checking:}
If {\tt zv} or {\tt fp} are {\tt NULL},
an error message is printed and zero is returned.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
int ZV_writeToFile ( ZV *zv, char *fn ) ;
\end{verbatim}
\index{ZV_writeToFile@{\tt ZV\_writeToFile()}}
\par
This method writes a {\tt ZV} object from a file.
It tries to open the file and if it is successful, 
it then calls {\tt ZV\_writeFromFormattedFile()} or
{\tt ZV\_writeFromBinaryFile()},
closes the file
and returns the value returned from the called routine.
\par \noindent {\it Error checking:}
If {\tt zv} or {\tt fn} are {\tt NULL}, 
or if {\tt fn} is not of the form
{\tt *.zvf} (for a formatted file) 
or {\tt *.zvb} (for a binary file),
an error message is printed and the method returns zero.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
int ZV_writeToFormattedFile ( ZV *zv, FILE *fp ) ;
\end{verbatim}
\index{ZV_writeToFormattedFile@{\tt ZV\_writeToFormattedFile()}}
\par
This method writes a {\tt ZV} object to a formatted file.
If there are no errors in writing the data, 
the value {\tt 1} is returned.
If an IO error is encountered from {\tt fprintf}, zero is returned.
\par \noindent {\it Error checking:}
If {\tt zv} or {\tt fp} are {\tt NULL},
an error message is printed and zero is returned.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
int ZV_writeToBinaryFile ( ZV *zv, FILE *fp ) ;
\end{verbatim}
\index{ZV_writeToBinaryFile@{\tt ZV\_writeToBinaryFile()}}
\par
This method writes a {\tt ZV} object to a binary file.
If there are no errors in writing the data, 
the value {\tt 1} is returned.
If an IO error is encountered from {\tt fwrite}, zero is returned.
\par \noindent {\it Error checking:}
If {\tt zv} or {\tt fp} are {\tt NULL},
an error message is printed and zero is returned.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
int ZV_writeForHumanEye ( ZV *zv, FILE *fp ) ;
\end{verbatim}
\index{ZV_writeForHumanEye@{\tt ZV\_writeForHumanEye()}}
\par
This method writes a {\tt ZV} object to a file in a human
readable format.
is called to write out the
header and statistics. 
The entries of the vector then follow in eighty column format
using the {\tt ZVfprintf()} method.
The value {\tt 1} is returned.
\par \noindent {\it Error checking:}
If {\tt zv} or {\tt fp} are {\tt NULL},
an error message is printed and zero is returned.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
int ZV_writeStats ( ZV *zv, FILE *fp ) ;
\end{verbatim}
\index{ZV_writeStats@{\tt ZV\_writeStats()}}
\par
This method writes the header and statistics to a file.
The value {\tt 1} is returned.
\par \noindent {\it Error checking:}
If {\tt zv} or {\tt fp} are {\tt NULL},
an error message is printed and zero is returned.
%-----------------------------------------------------------------------
\item
\begin{verbatim}
int ZV_writeForMatlab ( ZV *zv, char *name, FILE *fp ) ;
\end{verbatim}
\index{ZV_writeForMatlab@{\tt ZV\_writeForMatlab()}}
\par
This method writes the entries of the vector to a file
suitable to be read by Matlab.
The character string {\tt name} is the name of the vector,
e.g, if {\tt name = "A"}, then we have lines of the form
\begin{verbatim}
A(1) = 1.000000000000e0 + 2.000000000000e0*i;
A(2) = 3.463738459493e0 + 2.728482384840e0*i;
\end{verbatim}
for each entry in the vector.
Note, the output indexing is 1-based, not 0-based.
The value {\tt 1} is returned.
\par \noindent {\it Error checking:}
If {\tt zv} or {\tt fp} are {\tt NULL},
an error message is printed and zero is returned.
%-----------------------------------------------------------------------
\end{enumerate}