aboutsummaryrefslogtreecommitdiff
path: root/tcc.h
diff options
context:
space:
mode:
authorgrischka <grischka>2011-08-01 01:10:36 +0200
committergrischka <grischka>2011-08-01 01:10:36 +0200
commitdf9cce24a87442079d878978e56caa0787f37e1a (patch)
tree9758c048385bdf2181f67ce835fa140ce8119a95 /tcc.h
parent626a9074512c6c6ba060dc8a4a0d1caa49db76c1 (diff)
downloadtinycc-df9cce24a87442079d878978e56caa0787f37e1a.tar.gz
tinycc-df9cce24a87442079d878978e56caa0787f37e1a.tar.bz2
Accept colon separated paths with -L and -I
This allows passing colon separated paths to tcc_add_library_path tcc_add_sysinclude_path tcc_add_include_path Also there are new configure variables CONFIG_TCC_LIBPATH CONFIG_TCC_SYSINCLUDE_PATHS which define the lib/sysinclude paths all in one and can be overridden from configure/make For TCC_TARGET_PE semicolons (;) are used as separators Also, \b in the path string is replaced by s->tcc_lib_path (CONFIG_TCCDIR rsp. -B option)
Diffstat (limited to 'tcc.h')
-rw-r--r--tcc.h47
1 files changed, 35 insertions, 12 deletions
diff --git a/tcc.h b/tcc.h
index c2a69ca..636822b 100644
--- a/tcc.h
+++ b/tcc.h
@@ -139,9 +139,6 @@
#define true 1
typedef int BOOL;
-/* path to find crt1.o, crti.o and crtn.o. Only needed when generating
- executables or dlls */
-
#ifndef CONFIG_TCC_LDDIR
#if defined(TCC_TARGET_X86_64_CENTOS)
#define CONFIG_TCC_LDDIR "/lib64"
@@ -149,9 +146,29 @@ typedef int BOOL;
#define CONFIG_TCC_LDDIR "/lib"
#endif
#endif
-#define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr" CONFIG_TCC_LDDIR
-#ifndef CONFIG_TCC_INCSUBDIR
- #define CONFIG_TCC_INCSUBDIR ""
+
+/* path to find crt1.o, crti.o and crtn.o */
+#ifndef CONFIG_TCC_CRT_PREFIX
+# define CONFIG_TCC_CRT_PREFIX CONFIG_SYSROOT "/usr" CONFIG_TCC_LDDIR
+#endif
+
+#ifndef CONFIG_TCC_SYSINCLUDE_PATHS
+# ifdef TCC_TARGET_PE
+# define CONFIG_TCC_SYSINCLUDE_PATHS "\b/include;\b/include/winapi"
+# else
+# define CONFIG_TCC_SYSINCLUDE_PATHS "/usr/local/include:/usr/include:\b/include"
+# endif
+#endif
+
+#ifndef CONFIG_TCC_LIBPATH
+# ifdef TCC_TARGET_PE
+# define CONFIG_TCC_LIBPATH "\b/lib"
+# else
+# define CONFIG_TCC_LIBPATH \
+ CONFIG_TCC_CRT_PREFIX \
+ ":" CONFIG_SYSROOT CONFIG_TCC_LDDIR \
+ ":" CONFIG_SYSROOT "/usr/local" CONFIG_TCC_LDDIR
+# endif
#endif
#define INCLUDE_STACK_SIZE 32
@@ -843,15 +860,21 @@ extern long double strtold (const char *__nptr, char **__endptr);
#endif
#ifdef _WIN32
-#define IS_PATHSEP(c) (c == '/' || c == '\\')
-#define IS_ABSPATH(p) (IS_PATHSEP(p[0]) || (p[0] && p[1] == ':' && IS_PATHSEP(p[2])))
+#define IS_DIRSEP(c) (c == '/' || c == '\\')
+#define IS_ABSPATH(p) (IS_DIRSEP(p[0]) || (p[0] && p[1] == ':' && IS_DIRSEP(p[2])))
#define PATHCMP stricmp
#else
-#define IS_PATHSEP(c) (c == '/')
-#define IS_ABSPATH(p) IS_PATHSEP(p[0])
+#define IS_DIRSEP(c) (c == '/')
+#define IS_ABSPATH(p) IS_DIRSEP(p[0])
#define PATHCMP strcmp
#endif
+#ifdef TCC_TARGET_PE
+#define PATHSEP ';'
+#else
+#define PATHSEP ':'
+#endif
+
/* space exlcuding newline */
static inline int is_space(int ch)
{
@@ -912,6 +935,7 @@ ST_DATA void *rt_prog_main;
/* public functions currently used by the tcc main function */
PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s);
PUB_FUNC char *pstrcat(char *buf, int buf_size, const char *s);
+PUB_FUNC char *pstrncpy(char *out, const char *in, size_t num);
PUB_FUNC char *tcc_basename(const char *name);
PUB_FUNC char *tcc_fileextension (const char *name);
PUB_FUNC void tcc_free(void *ptr);
@@ -970,8 +994,6 @@ PUB_FUNC int tcc_set_flag(TCCState *s, const char *flag_name, int value);
PUB_FUNC void tcc_print_stats(TCCState *s, int64_t total_time);
PUB_FUNC void set_num_callers(int n);
-ST_FUNC int ieee_finite(double d);
-
/* ------------ tccpp.c ------------ */
ST_DATA struct BufferedFile *file;
@@ -1066,6 +1088,7 @@ ST_DATA int last_line_num, last_ind, func_ind; /* debug last line number and pc
ST_DATA char *funcname;
ST_INLN int is_float(int t);
+ST_FUNC int ieee_finite(double d);
ST_FUNC void test_lvalue(void);
ST_FUNC void swap(int *p, int *q);
ST_FUNC void vpushi(int v);