summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2015-12-17 21:38:37 +0000
committerFreeArtMan <dos21h@gmail.com>2015-12-17 21:38:37 +0000
commit02496faab558fa758adf3a24006201cf5ab557fb (patch)
treeb6249838b3a9d5044bedcb8f1978a55d0ed4181c
parenta61ad1cef9ef77f9afd67230df5470b6b55525be (diff)
downloaddm-02496faab558fa758adf3a24006201cf5ab557fb.tar.gz
dm-02496faab558fa758adf3a24006201cf5ab557fb.zip
Fixed structure order in syntax.h to compile on NetBSD
-rw-r--r--Makefile2
-rw-r--r--darray.c4
-rw-r--r--darray.h14
-rw-r--r--syntax.h69
4 files changed, 43 insertions, 46 deletions
diff --git a/Makefile b/Makefile
index 11b00bd..ea7c840 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
PROJECT=dm
CC=gcc
-CFLAGS=-std=c1x
+CFLAGS=-std=c99
SOURCES=$(PROJECT)_parser.c darray.c tokenizer.c syntax.c mtable.c
OBJECTS=$(SOURCES:.c=.o)
diff --git a/darray.c b/darray.c
index eb9886f..08fdea0 100644
--- a/darray.c
+++ b/darray.c
@@ -3,7 +3,7 @@
/*****************************************************************************/
darray* darr_create(ssize_t data_size, ssize_t init_size)
{
- //PRINT("\n");
+ /* PRINT("\n"); */
int i = 0;
darray *arr = NULL;
@@ -45,7 +45,7 @@ error:
free( arr );
arr = NULL;
}
- //ERROR("\n");
+ /* ERROR("\n"); */
return NULL;
}
diff --git a/darray.h b/darray.h
index 8d8f9e9..0ed64e2 100644
--- a/darray.h
+++ b/darray.h
@@ -8,16 +8,18 @@
#include <string.h>
#include <sys/types.h>
-//#include "debug.h"
-//#include "mmm.h"
+/*
+#include "debug.h"
+#include "mmm.h"
+*/
#define DEFAULT_EXPAND_RATE 10
typedef struct darray {
- int end; //element amount. end <= max
- int max; //maximal element number
- size_t size; //single element size
- size_t expand; //expand size
+ int end; /*element amount. end <= max */
+ int max; /*maximal element number */
+ size_t size; /*single element size */
+ size_t expand; /*expand size */
void **data;
} darray;
diff --git a/syntax.h b/syntax.h
index 9f2d224..1bdf984 100644
--- a/syntax.h
+++ b/syntax.h
@@ -13,13 +13,6 @@
#define ALLOC_MEMSET(T,VAL) {VAL=malloc(sizeof(T));memset(VAL,0,sizeof(T));}
-typedef struct ast_range ast_range;
-typedef struct ast_if ast_if;
-typedef struct ast_value ast_value;
-typedef struct ast_expr ast_expr;
-typedef struct ast_expr_bit ast_expr_bit;
-typedef struct ast_expr_cmp ast_expr_cmp;
-
//welcome to 90's
//[TYPE]_[SET/GET/ADD/INIT]_[VALUE]
//G -get
@@ -30,33 +23,14 @@ typedef struct ast_expr_cmp ast_expr_cmp;
//S - start
//E - end
-//ATRT
-typedef struct ast_root
-{
- int size;
- int total_tokens;
- ast_range **range;
-} ast_root;
-
-//ATRN
-typedef struct ast_range
-{
- int range_type;
- unsigned long start;
- unsigned long end;
- int next_type;
- int size_iff;
- ast_if **iff;
- ast_value *val;
-} ast_range;
-//ATI
-typedef struct ast_if
+//ATV
+typedef struct ast_value
{
- int eval;
- ast_expr *expr;
- ast_value *val;
-} ast_if;
+ int size;
+ char *note;
+
+} ast_value;
//ATEB
typedef struct ast_expr_bit
@@ -80,13 +54,34 @@ typedef struct ast_expr
ast_expr_bit **bit;
} ast_expr;
-//ATV
-typedef struct ast_value
+//ATI
+typedef struct ast_if
+{
+ int eval;
+ ast_expr *expr;
+ ast_value *val;
+} ast_if;
+
+//ATRN
+typedef struct ast_range
+{
+ int range_type;
+ unsigned long start;
+ unsigned long end;
+ int next_type;
+ int size_iff;
+ ast_if **iff;
+ ast_value *val;
+} ast_range;
+
+//ATRT
+typedef struct ast_root
{
int size;
- char *note;
-
-} ast_value;
+ int total_tokens;
+ ast_range **range;
+} ast_root;
+
static int tk_pos = 0;