- Optification is done by auto builder now
[gnuplot] / src / util.h
1 /*
2  * $Id: util.h,v 1.27 2005/10/22 05:50:13 sfeam Exp $
3  */
4
5 /* GNUPLOT - util.h */
6
7 /*[
8  * Copyright 1986 - 1993, 1998, 2004   Thomas Williams, Colin Kelley
9  *
10  * Permission to use, copy, and distribute this software and its
11  * documentation for any purpose with or without fee is hereby granted,
12  * provided that the above copyright notice appear in all copies and
13  * that both that copyright notice and this permission notice appear
14  * in supporting documentation.
15  *
16  * Permission to modify the software is granted, but not the right to
17  * distribute the complete modified source code.  Modifications are to
18  * be distributed as patches to the released version.  Permission to
19  * distribute binaries produced by compiling modified sources is granted,
20  * provided you
21  *   1. distribute the corresponding source modifications from the
22  *    released version in the form of a patch file along with the binaries,
23  *   2. add special version identification to distinguish your version
24  *    in addition to the base release version number,
25  *   3. provide your name and address as the primary contact for the
26  *    support of your modified version, and
27  *   4. retain our contact information in regard to use of the base
28  *    software.
29  * Permission to distribute the released version of the source code along
30  * with corresponding source modifications in the form of a patch file is
31  * granted with same provisions 2 through 4 for binary distributions.
32  *
33  * This software is provided "as is" without express or implied warranty
34  * to the extent permitted by applicable law.
35 ]*/
36
37 #ifndef GNUPLOT_UTIL_H
38 # define GNUPLOT_UTIL_H
39
40 #include "gp_types.h"
41 #include "stdfn.h"              /* for size_t */
42
43 /* special token number meaning 'do not draw the "caret"', for
44  * int_error and friends: */
45 #define NO_CARET (-1)
46
47 /* token number meaning 'the error was in the datafile, not the
48    command line' */
49 #define DATAFILE (-2)
50
51 /* TRUE if command just typed; becomes FALSE whenever we
52  * send some other output to screen.  If FALSE, the command line
53  * will be echoed to the screen before the ^ error message.
54  */
55 extern TBOOLEAN screen_ok;
56
57 /* decimal sign */
58 extern char *decimalsign;
59
60 extern const char *current_prompt; /* needed by is_error() and friends */
61
62 /* Functions exported by util.c: */
63
64 /* Command parsing helpers: */
65 #if 0 /* UNUSED */
66 int chr_in_str __PROTO((int, int));
67 #endif
68 int equals __PROTO((int, const char *));
69 int almost_equals __PROTO((int, const char *));
70 int isstring __PROTO((int));
71 int isanumber __PROTO((int));
72 int isletter __PROTO((int));
73 int is_definition __PROTO((int));
74 void copy_str __PROTO((char *, int, int));
75 size_t token_len __PROTO((int));
76 void quote_str __PROTO((char *, int, int));
77 void capture __PROTO((char *, int, int, int));
78 void m_capture __PROTO((char **, int, int));
79 void m_quote_capture __PROTO((char **, int, int));
80 char *try_to_get_string __PROTO((void));
81 void parse_esc __PROTO((char *));
82 int type_udv __PROTO((int));
83
84 #ifdef GP_STRING_VARS
85 char *gp_stradd __PROTO((const char *, const char *));
86 #define isstringvalue(c_token) (isstring(c_token) || type_udv(c_token)==STRING)
87 #else
88 #define isstringvalue(c_token) isstring(c_token)
89 #endif
90
91 /* HBB 20010726: IMHO this one belongs into alloc.c: */
92 char *gp_strdup __PROTO((const char *));
93
94 /* HBB 20020405: moved this here, from axis.[ch] */
95 void gprintf __PROTO((char *, size_t, char *, double, double));
96
97 /* Error message handling */
98 #if defined(VA_START) && defined(STDC_HEADERS)
99 void os_error __PROTO((int, const char *, ...));
100 void int_error __PROTO((int, const char *, ...));
101 void int_warn __PROTO((int, const char *, ...));
102 void graph_error __PROTO((const char *, ...));
103 #else
104 void os_error __PROTO(());
105 void int_error __PROTO(());
106 void int_warn __PROTO(());
107 void graph_error __PROTO(());
108 #endif
109
110 /* Helper functions for help_command() */
111 /* FIXME HBB 20010726: should be moved to where help_comamnd() is, and
112  * made static. Currently, that's command.c, but it should probably
113  * move to help.c, instead. */
114 void lower_case __PROTO((char *));
115 void squash_spaces __PROTO((char *));
116
117 TBOOLEAN existdir __PROTO((const char *));
118
119 char *getusername __PROTO((void));
120
121 #endif /* GNUPLOT_UTIL_H */