Browse Source

Make TokBuf and Types work with standard C

master
Marrub 5 years ago
parent
commit
55c2edf9c3
  1. 4
      src/m_tokbuf.c
  2. 2
      src/m_tokbuf.h
  3. 5
      src/m_types.h

4
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;

2
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;

5
src/m_types.h

@ -5,16 +5,21 @@
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#if __GDCC__
#include <stdfix.h>
#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

Loading…
Cancel
Save