summaryrefslogtreecommitdiffhomepage
path: root/include/stc
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2023-05-21 23:30:25 +0200
committerTyge Lovset <[email protected]>2023-05-21 23:30:25 +0200
commit0b34cadda2bc4da1cb0904989c8a5f2fe0236358 (patch)
tree038335539ecd9363fbfc70a850a340b291a10888 /include/stc
parent56b0884044610861866a1a27fb64276411604986 (diff)
downloadSTC-modified-0b34cadda2bc4da1cb0904989c8a5f2fe0236358.tar.gz
STC-modified-0b34cadda2bc4da1cb0904989c8a5f2fe0236358.zip
NB! Made cstr.h header-only by default. Now requires #define i_static, i_implement or i_extern (includes utf8code.c) to implement non-inline functions (or link with libstc).
Diffstat (limited to 'include/stc')
-rw-r--r--include/stc/ccommon.h2
-rw-r--r--include/stc/cregex.h6
-rw-r--r--include/stc/cstack.h6
-rw-r--r--include/stc/cstr.h1
-rw-r--r--include/stc/csview.h1
5 files changed, 9 insertions, 7 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h
index e9d97d4b..eb3a6601 100644
--- a/include/stc/ccommon.h
+++ b/include/stc/ccommon.h
@@ -253,6 +253,6 @@ STC_INLINE intptr_t cnextpow2(intptr_t n) {
#if defined(STC_EXTERN)
#define i_extern
#endif
-#if defined(i_static) || defined(STC_IMPLEMENT)
+#if defined(i_static) || defined(STC_IMPLEMENT) || defined(i_extern)
#define i_implement
#endif
diff --git a/include/stc/cregex.h b/include/stc/cregex.h
index f90acbf4..bf239ff6 100644
--- a/include/stc/cregex.h
+++ b/include/stc/cregex.h
@@ -160,12 +160,14 @@ cstr cregex_replace_pattern_6(const char* pattern, const char* input, const char
void cregex_drop(cregex* re);
#endif // CREGEX_H_INCLUDED
-#if defined(i_extern)
+#if defined i_extern || defined i_implement
# include "../../src/cregex.c"
+#endif
+#if defined i_extern
# include "../../src/utf8code.c"
-# undef i_extern
#endif
#undef i_opt
#undef i_header
#undef i_static
#undef i_implement
+#undef i_extern
diff --git a/include/stc/cstack.h b/include/stc/cstack.h
index eb6ccb58..ae8b3c40 100644
--- a/include/stc/cstack.h
+++ b/include/stc/cstack.h
@@ -175,12 +175,12 @@ STC_INLINE i_keyraw _cx_memb(_value_toraw)(const _cx_value* val)
#endif // !i_no_clone
STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) {
- return c_LITERAL(_cx_iter){self->_len ? self->data : NULL,
- self->data + self->_len};
+ return c_LITERAL(_cx_iter){self->_len ? (_cx_value*)self->data : NULL,
+ (_cx_value*)self->data + self->_len};
}
STC_INLINE _cx_iter _cx_memb(_end)(const _cx_self* self)
- { return c_LITERAL(_cx_iter){NULL, self->data + self->_len}; }
+ { return c_LITERAL(_cx_iter){NULL, (_cx_value*)self->data + self->_len}; }
STC_INLINE void _cx_memb(_next)(_cx_iter* it)
{ if (++it->ref == it->end) it->ref = NULL; }
diff --git a/include/stc/cstr.h b/include/stc/cstr.h
index 244b0a91..d496b85e 100644
--- a/include/stc/cstr.h
+++ b/include/stc/cstr.h
@@ -27,6 +27,7 @@
#ifndef CSTR_H_INCLUDED
#define CSTR_H_INCLUDED
+#define i_header
#if defined i_extern || defined STC_EXTERN
# define _i_extern
#endif
diff --git a/include/stc/csview.h b/include/stc/csview.h
index bba3aea3..571bb278 100644
--- a/include/stc/csview.h
+++ b/include/stc/csview.h
@@ -24,7 +24,6 @@
#define CSVIEW_H_INCLUDED
#include "ccommon.h"
-#include "forward.h"
#include "utf8.h"
#define csview_NULL c_sv_1("")