Make TokBuf and Types work with standard C

master
Marrub 2017-09-21 23:33:18 -04:00
parent 094d7f769a
commit 55c2edf9c3
3 changed files with 9 additions and 2 deletions

View File

@ -103,8 +103,8 @@ M_token *M_TokBuf_ReGet(M_tkbuf *tb)
// //
bool M_TokBuf_Drop(M_tkbuf *tb, M_tokty t) bool M_TokBuf_Drop(M_tkbuf *tb, M_tokty t)
{ {
if(tb->get()->type != t) { if(M_TokBuf_Get(tb)->type != t) {
tb->unget(); M_TokBuf_UnGet(tb);
return false; return false;
} else { } else {
return true; return true;

View File

@ -24,12 +24,14 @@ enum M_tkprc
typedef struct M_tkbuf typedef struct M_tkbuf
{ {
#if __GDCC__
__prop ctor {call: M_TokBuf_Ctor (this)} __prop ctor {call: M_TokBuf_Ctor (this)}
__prop dtor {call: M_TokBuf_Dtor (this)} __prop dtor {call: M_TokBuf_Dtor (this)}
__prop get {call: M_TokBuf_Get (this)} __prop get {call: M_TokBuf_Get (this)}
__prop unget {call: M_TokBuf_UnGet(this)} __prop unget {call: M_TokBuf_UnGet(this)}
__prop reget {call: M_TokBuf_ReGet(this)} __prop reget {call: M_TokBuf_ReGet(this)}
__prop drop {call: M_TokBuf_Drop (this)} __prop drop {call: M_TokBuf_Drop (this)}
#endif
FILE *fp; FILE *fp;
M_token *toks; M_token *toks;

View File

@ -5,16 +5,21 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
#if __GDCC__
#include <stdfix.h> #include <stdfix.h>
#undef fixed #undef fixed
#endif
#define M_countof(a) (sizeof(a) / sizeof(*a)) #define M_countof(a) (sizeof(a) / sizeof(*a))
// Types ---------------------------------------------------------------------| // Types ---------------------------------------------------------------------|
#if __GDCC__
typedef unsigned long fract ulfra; typedef unsigned long fract ulfra;
typedef short accum fixed; // Fixed typedef short accum fixed; // Fixed
typedef long fract lfrac; // Long Fractional typedef long fract lfrac; // Long Fractional
#endif
typedef size_t msize; // Machine Size typedef size_t msize; // Machine Size
typedef ptrdiff_t mpdif; // Machine Pointer Difference typedef ptrdiff_t mpdif; // Machine Pointer Difference
typedef uint8_t mbyte; // Machine Byte typedef uint8_t mbyte; // Machine Byte