OSDN Git Service

expression.c, stream.c, textfile.txt, token.cの追加
[gleam-language/alpha.git] / expression.c
diff --git a/expression.c b/expression.c
new file mode 100644 (file)
index 0000000..99ad4b0
--- /dev/null
@@ -0,0 +1,27 @@
+#include "common.h"
+
+/*
+* expression.c --manage expressions
+* 
+* Copyright(C) 2013(Heisei 25) ttwilb All rights reserved.
+* 
+* This source code is released on the BSD licensing.
+* 
+*/
+
+#define EXPRESSION_BUF_MAX     100
+
+struct Expression expression_buf[EXPRESSION_BUF_MAX];
+int expression_buf_count = 0;
+
+struct Expression* alloc_expression()
+{
+       if(!expression_buf_count >= EXPRESSION_BUF_MAX)
+       {
+               return &expression_buf[expression_buf_count++];
+       }else
+       {
+               printf("----Fatal: expression allocation error");
+               return (struct Expression *) 0;
+       }
+}