1 /* Id */ 2 /* $NetBSD: driver.h,v 1.1.1.1 2016/02/09 20:29:13 plunky Exp $ */ 3 4 /*- 5 * Copyright (c) 2014 Iain Hibbert. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to deal 9 * in the Software without restriction, including without limitation the rights 10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 * copies of the Software, and to permit persons to whom the Software is 12 * furnished to do so, subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice shall be included in 15 * all copies or substantial portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 * THE SOFTWARE. 24 */ 25 26 #include "config.h" 27 28 typedef struct list list_t; 29 30 struct options { 31 const char * cpp; 32 const char * ccom; 33 const char * cxxcom; 34 const char * fcom; 35 const char * as; 36 const char * ld; 37 38 const char * sysroot; 39 40 int version; 41 list_t * prefix; 42 int C; 43 list_t * DIU; 44 int E; 45 list_t * ldargs; 46 int M; 47 int m32; 48 int P; 49 int S; 50 list_t * Wa; 51 list_t * Wl; 52 list_t * Wp; 53 int savetemps; 54 int c; 55 int dynamiclib; 56 int hosted; 57 int uchar; 58 int pic; 59 int ssp; 60 int idirafter; 61 const char * isystem; 62 list_t * include; 63 const char * isysroot; 64 int stdinc; 65 int cxxinc; 66 int stdlib; 67 int startfiles; 68 int defaultlibs; 69 const char * outfile; 70 int pedantic; 71 int profile; 72 int pipe; 73 int print; 74 int pthread; 75 int r; 76 int shared; 77 int ldstatic; 78 int symbolic; 79 int traditional; 80 int stddef; 81 int verbose; 82 83 int debug; /* -g */ 84 int optim; /* -O */ 85 }; 86 87 #define ARRAYLEN(a) (sizeof(a)/sizeof((a)[0])) 88 89 extern struct options opt; 90 91 /* "Warns" flags */ 92 #define W_SET (1<<0) 93 #define W_ERR (1<<1) 94 #define W_ALL (1<<2) 95 #define W_EXTRA (1<<3) 96 #define W_CPP (1<<4) 97 #define W_CCOM (1<<5) 98 #define W_CXXCOM (1<<6) 99 #define W_FCOM (1<<7) 100 #define W_AS (1<<8) 101 #define W_LD (1<<9) 102 103 /* driver.c */ 104 void error(const char *fmt, ...); 105 void warning(const char *fmt, ...); 106 int callsys(int, char **); 107 108 /* list.c */ 109 const char **list_array(const list_t *); 110 size_t list_count(const list_t *); 111 list_t *list_alloc(void); 112 void list_free(list_t *); 113 void list_print(const list_t *); 114 void list_add_nocopy(list_t *, const char *); 115 void list_add(list_t *, const char *, ...); 116 void list_add_array(list_t *, const char **); 117 void list_add_list(list_t *, const list_t *); 118 119 /* options.c */ 120 int add_option(char *, char *); 121 122 /* prog_asm.c */ 123 int prog_asm(const char *, const char *); 124 125 /* prog_ccom.c */ 126 int prog_ccom(const char *, const char *); 127 128 /* prog_cpp.c */ 129 int prog_cpp(const char *, const char *); 130 131 /* prog_cxxcom.c */ 132 int prog_cxxcom(const char *, const char *); 133 134 /* prog_fcom.c */ 135 int prog_fcom(const char *, const char *); 136 137 /* prog_link.c */ 138 int prog_link(const char *, const char *); 139 140 /* wflag.c */ 141 int Wflag(const char *); 142 void Wflag_add(list_t *, unsigned int); 143 144 /* xalloc.c */ 145 void *xcalloc(size_t, size_t); 146 void *xmalloc(size_t); 147 void *xrealloc(void *, size_t); 148 char *xstrdup(const char *); 149