summaryrefslogtreecommitdiffhomepage
path: root/include/stc/csview.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-06-11 14:03:16 +0200
committerTyge Løvset <[email protected]>2023-06-11 14:59:06 +0200
commitb564ef6bdfcd2437f1b4997f42054c45ccdedbb1 (patch)
treeb6c5458b8bc47279d18408f25e79eb6118808d78 /include/stc/csview.h
parentf3529a2600141dc7f84c734ea3bf5db8f7090e56 (diff)
downloadSTC-modified-b564ef6bdfcd2437f1b4997f42054c45ccdedbb1.tar.gz
STC-modified-b564ef6bdfcd2437f1b4997f42054c45ccdedbb1.zip
Added priv/linkage.h and renamed priv/template2.h => priv/template_undef.h.
Make all examples c++ compatible, except those using cspan.h Removed: crange_obj() Renamed: crange_make() => crange_init() Renamed: cspan_make() => cspan_init() Renamed: cstr_NULL => cstr_null Renamed: csview_NULL => csview_null
Diffstat (limited to 'include/stc/csview.h')
-rw-r--r--include/stc/csview.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/include/stc/csview.h b/include/stc/csview.h
index a1893063..c16f58bc 100644
--- a/include/stc/csview.h
+++ b/include/stc/csview.h
@@ -20,14 +20,14 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#define _i_no_undef
+#define _i_nested
#include "utf8.h"
#ifndef CSVIEW_H_INCLUDED
#define CSVIEW_H_INCLUDED
-#define csview_NULL c_sv_1("")
-#define csview_init() csview_NULL
+#define csview_null c_sv_1("")
+#define csview_init() csview_null
#define csview_drop(p) c_default_drop(p)
#define csview_clone(sv) c_default_clone(sv)
#define csview_lit(literal) c_sv_1(literal)
@@ -42,7 +42,7 @@ extern csview csview_token(csview sv, const char* sep, intptr_t* start);
STC_INLINE csview csview_from(const char* str)
{ return c_LITERAL(csview){str, c_strlen(str)}; }
-STC_INLINE void csview_clear(csview* self) { *self = csview_NULL; }
+STC_INLINE void csview_clear(csview* self) { *self = csview_null; }
STC_INLINE intptr_t csview_size(csview sv) { return sv.size; }
STC_INLINE bool csview_empty(csview sv) { return sv.size == 0; }
@@ -150,8 +150,8 @@ STC_INLINE csview cstr_u8_substr(const cstr* self , intptr_t bytepos, intptr_t u
#endif
/* -------------------------- IMPLEMENTATION ------------------------- */
+#if defined i_import || (defined i_implement && !defined _i_nested)
#ifndef CSVIEW_C_INCLUDED
-#if defined i_import || (defined i_implement && !defined _i_no_undef)
#define CSVIEW_C_INCLUDED
csview_iter csview_advance(csview_iter it, intptr_t pos) {
@@ -201,13 +201,13 @@ csview csview_token(csview sv, const char* sep, intptr_t* start) {
*start += tok.size + sep_size;
return tok;
}
-#endif
-#endif
-#ifndef _i_no_undef
+#endif // CSVIEW_C_INCLUDED
+#endif // i_implement
+#ifndef _i_nested
#undef i_static
#undef i_header
#undef i_implement
#undef i_import
#undef i_opt
#endif
-#undef _i_no_undef
+#undef _i_nested