From 55c2edf9c36093c59750b187c1e8d058d96ed99d Mon Sep 17 00:00:00 2001 From: Marrub Date: Thu, 21 Sep 2017 23:33:18 -0400 Subject: [PATCH] Make TokBuf and Types work with standard C --- src/m_tokbuf.c | 4 ++-- src/m_tokbuf.h | 2 ++ src/m_types.h | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/m_tokbuf.c b/src/m_tokbuf.c index edc3575..aac7f32 100644 --- a/src/m_tokbuf.c +++ b/src/m_tokbuf.c @@ -103,8 +103,8 @@ M_token *M_TokBuf_ReGet(M_tkbuf *tb) // bool M_TokBuf_Drop(M_tkbuf *tb, M_tokty t) { - if(tb->get()->type != t) { - tb->unget(); + if(M_TokBuf_Get(tb)->type != t) { + M_TokBuf_UnGet(tb); return false; } else { return true; diff --git a/src/m_tokbuf.h b/src/m_tokbuf.h index 44928fe..2a7e1c9 100644 --- a/src/m_tokbuf.h +++ b/src/m_tokbuf.h @@ -24,12 +24,14 @@ enum M_tkprc typedef struct M_tkbuf { +#if __GDCC__ __prop ctor {call: M_TokBuf_Ctor (this)} __prop dtor {call: M_TokBuf_Dtor (this)} __prop get {call: M_TokBuf_Get (this)} __prop unget {call: M_TokBuf_UnGet(this)} __prop reget {call: M_TokBuf_ReGet(this)} __prop drop {call: M_TokBuf_Drop (this)} +#endif FILE *fp; M_token *toks; diff --git a/src/m_types.h b/src/m_types.h index e673c0f..cba8cbc 100644 --- a/src/m_types.h +++ b/src/m_types.h @@ -5,16 +5,21 @@ #include #include #include + +#if __GDCC__ #include #undef fixed +#endif #define M_countof(a) (sizeof(a) / sizeof(*a)) // Types ---------------------------------------------------------------------| +#if __GDCC__ typedef unsigned long fract ulfra; typedef short accum fixed; // Fixed typedef long fract lfrac; // Long Fractional +#endif typedef size_t msize; // Machine Size typedef ptrdiff_t mpdif; // Machine Pointer Difference typedef uint8_t mbyte; // Machine Byte