/[ascend]/trunk/base/generic/utilities/readln.h
ViewVC logotype

Contents of /trunk/base/generic/utilities/readln.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 593 - (show annotations) (download) (as text)
Fri May 12 10:03:59 2006 UTC (13 years, 10 months ago) by johnpye
File MIME type: text/x-chdr
File size: 4498 byte(s)
Bumped version to 0.9.5.91.
Changed WITH_CUNIT_TESTS to WITH_CUNIT.
Added GCOV scons option.
Fixed up 'test' target for SCons.
Added lots of export symbols to libascend.so.

1 /*
2 * Read line module
3 * by Karl Westerberg
4 * Created: 6/90
5 * Version: $Revision: 1.3 $
6 * Version control file: $RCSfile: readln.h,v $
7 * Date last modified: $Date: 1997/07/18 12:04:27 $
8 * Last modified by: $Author: mthomas $
9 *
10 * This file is part of the Ascend Language Interpreter.
11 *
12 * Copyright (C) 1997 Carnegie Mellon University
13 *
14 * The Ascend Language Interpreter is free software; you can redistribute
15 * it and/or modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of the
17 * License, or (at your option) any later version.
18 *
19 * The Ascend Language Interpreter is distributed in hope that it will be
20 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with the program; if not, write to the Free Software Foundation,
26 * Inc., 675 Mass Ave, Cambridge, MA 02139 USA. Check the file named
27 * COPYING. COPYING is in ../compiler.
28 */
29
30 /** @file
31 * Read line module.
32 * <pre>
33 * Contents: Read line module
34 *
35 * Authors: Karl Westerberg
36 *
37 * Dates: 06/90 - original version
38 *
39 * Description: When possible, use [a]readln instead of [a]freadln,
40 * since [a]readln will provide a better interface to the
41 * terminal.
42 *
43 * Requires: #include "utilities/ascConfig.h"
44 * #include "ascMalloc.h"
45 * </pre>
46 */
47
48 #ifndef _READLN_H
49 #define _READLN_H
50
51 ASC_DLLSPEC(int ) readln(char *str, int max);
52 /**<
53 * Reads a line from standard input to a target string having a
54 * specified capacity. If the line read is too long, the remainder of
55 * the line is bypassed. The number of characters read is returned
56 * (excluding newline, which is removed from str), or -1 if EOF was
57 * encountered. If str is NULL, -1 is returned.
58 *
59 * @param str The char buffer to receive the input.
60 * @param max Capacity of str, or the max chars to read.
61 * @return Returns the number of chars read (not including newline),
62 * or -1 on error.
63 */
64
65 ASC_DLLSPEC(int ) freadln(char *str, int max, FILE *input);
66 /**<
67 * Reads a line from a file stream to a target string having a
68 * specified capacity. If the line read is too long, the remainder of
69 * the line is bypassed. The number of characters read is returned
70 * (excluding newline, which is removed from str), or -1 if EOF was
71 * encountered. If str or input is NULL, -1 is returned.
72 *
73 * @param str The char buffer to receive the input.
74 * @param max Capacity of str, or the max chars to read.
75 * @param input File stream to read from.
76 * @return Returns the number of chars read (not including newline),
77 * or -1 on error.
78 */
79
80 ASC_DLLSPEC(char *) areadln(void);
81 /**<
82 * Reads a line from standard input and returns a newly-allocated
83 * string containing all that was read. NULL is returned if EOF
84 * is encountered or memory cannot be allocated. The returned
85 * string should be destroyed with ascfree() when no longer in use.
86 *
87 * @return A new string containing the input chars, of NULL on error.
88 */
89
90 ASC_DLLSPEC(char *) afreadln(FILE *fp);
91 /**<
92 * Reads a line from a file stream and returns a newly-allocated
93 * string containing all that was read. NULL is returned if EOF
94 * is encountered or memory cannot be allocated. The returned
95 * string should be destroyed ith ascfree() when no longer in use.
96 *
97 * @param fp The file stream to read from.
98 * @return A new string containing the input chars, of NULL on error.
99 */
100
101 ASC_DLLSPEC(long ) readlong(long number_default);
102 /**<
103 * Reads in a line from standard input and extracts a long integer
104 * from that line. If none is found, then the default is returned.
105 *
106 * @param number_default The default value to return if a long
107 * cannot be read.
108 * @return The input long integer or number_default if none is found.
109 */
110
111 ASC_DLLSPEC(double ) readdouble(double value_default);
112 /**<
113 * Reads in a line from standard input and extracts a double from
114 * that line. If none is found, then the default is returned.
115 *
116 * @param value_default The default value to return if a double
117 * cannot be read.
118 * @return The input double or value_default if none is found.
119 */
120
121 #endif /* _READLN_H */
122

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22