From 02496faab558fa758adf3a24006201cf5ab557fb Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Thu, 17 Dec 2015 21:38:37 +0000 Subject: Fixed structure order in syntax.h to compile on NetBSD --- Makefile | 2 +- darray.c | 4 ++-- darray.h | 14 +++++++------ syntax.h | 69 ++++++++++++++++++++++++++++++---------------------------------- 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 #include -//#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; -- cgit v1.2.3