chiark / gitweb /
@@@ work in progress
[runlisp] / common.h
1 /* -*-c-*-
2  *
3  * Common functionality of a less principled nature
4  *
5  * (c) 2020 Mark Wooding
6  */
7
8 /*----- Licensing notice --------------------------------------------------*
9  *
10  * This file is part of Runlisp, a tool for invoking Common Lisp scripts.
11  *
12  * Runlisp is free software: you can redistribute it and/or modify it
13  * under the terms of the GNU General Public License as published by the
14  * Free Software Foundation; either version 3 of the License, or (at your
15  * option) any later version.
16  *
17  * Runlisp is distributed in the hope that it will be useful, but WITHOUT
18  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20  * for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with Runlisp.  If not, see <https://www.gnu.org/licenses/>.
24  */
25
26 #ifndef COMMON_H
27 #define COMMON_H
28
29 #ifdef __cplusplus
30   extern "C" {
31 #endif
32
33 /*----- Externally defined types ------------------------------------------*/
34
35 struct dstr;
36 struct argv;
37
38 /*----- Public variables --------------------------------------------------*/
39
40 extern struct config config;
41 extern struct config_section *toplevel, *builtin, *common, *env;
42 extern unsigned verbose;
43
44 /*----- Functions provided ------------------------------------------------*/
45
46 extern const char *my_getenv(const char */*name*/, const char */*dflt*/);
47 extern long parse_int(const char */*what*/, const char */*p*/,
48                       long /*min*/, long /*max*/);
49 extern void argv_string(struct dstr */*d*/, const struct argv */*av*/);
50
51 #define FEF_EXEC 1u
52 #define FEF_VERBOSE 2u
53 extern int file_exists_p(const char */*path*/, unsigned /*f*/);
54 extern int found_in_path_p(const char */*prog*/, unsigned /*f*/);
55
56 #define TEF_DRYRUN 1u
57 #define TEF_VERBOSE 2u
58 extern int try_exec(struct argv */*av*/, unsigned /*f*/);
59
60 extern void read_config_file(const char */*what*/,
61                              const char */*file*/, unsigned /*f*/);
62 extern void read_config_dir(const char */*what*/,
63                             const char */*path*/, unsigned /*f*/);
64 extern void read_config_path(const char */*path*/, unsigned /*f*/);
65 extern int set_config_var(const char */*assign*/);
66 extern void init_config(void);
67 extern void load_default_config(void);
68 extern void dump_config(void);
69
70 /*----- That's all, folks -------------------------------------------------*/
71
72 #ifdef __cplusplus
73   }
74 #endif
75
76 #endif