merge r3_define.h into r3.h

This commit is contained in:
c9s 2014-05-20 23:33:51 +08:00
parent ee190bc030
commit 5183e9a052
8 changed files with 32 additions and 43 deletions

View file

@ -5,8 +5,6 @@ ACLOCAL_AMFLAGS=-I m4
r3_includedir = $(includedir)/r3
r3_include_HEADERS = \
include/r3.h \
include/r3_define.h \
include/r3_list.h \
include/r3_str.h \
include/str_array.h \
$(NULL)

View file

@ -14,8 +14,36 @@
#include <assert.h>
#include <pcre.h>
#ifndef bool
typedef unsigned char bool;
#endif
#ifndef FALSE
# define FALSE 0
#endif
#ifndef TRUE
# define TRUE 1
#endif
// #define DEBUG 1
#ifdef DEBUG
#define info(fmt, ...) \
do { fprintf(stderr, fmt, __VA_ARGS__); } while (0)
#define debug(fmt, ...) \
do { fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
__LINE__, __func__, __VA_ARGS__); } while (0)
#else
#define info(...);
#define debug(...);
#endif
#include "str_array.h"
#define node_edge_pattern(node,i) node->edges[i]->pattern
#define node_edge_pattern_len(node,i) node->edges[i]->pattern_len

View file

@ -1,36 +0,0 @@
/*
* r3_define.h
* Copyright (C) 2014 c9s <c9s@c9smba.local>
*
* Distributed under terms of the MIT license.
*/
#ifndef DEFINE_H
#define DEFINE_H
#ifndef bool
typedef unsigned char bool;
#endif
#ifndef FALSE
# define FALSE 0
#endif
#ifndef TRUE
# define TRUE 1
#endif
// #define DEBUG 1
#ifdef DEBUG
#define info(fmt, ...) \
do { fprintf(stderr, fmt, __VA_ARGS__); } while (0)
#define debug(fmt, ...) \
do { fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
__LINE__, __func__, __VA_ARGS__); } while (0)
#else
#define info(...);
#define debug(...);
#endif
#endif /* !DEFINE_H */

View file

@ -1,6 +1,7 @@
lib_LTLIBRARIES = libr3.la
# lib_LIBRARIES = libr3.a
libr3_la_SOURCES = node.c edge.c str.c token.c
# libr3_la_LDFLAGS = -export-symbols-regex '^r3_|^match_'
libr3_la_LIBADD=$(DEPS_LIBS)

View file

@ -19,9 +19,8 @@
// #include <Judy.h>
#include <config.h>
#include "r3_define.h"
#include "r3_str.h"
#include "r3.h"
#include "r3_str.h"
#include "str_array.h"
edge * r3_edge_create(char * pattern, int pattern_len, node * child) {

View file

@ -13,9 +13,8 @@
// Judy array
// #include <Judy.h>
#include "r3_define.h"
#include "r3_str.h"
#include "r3.h"
#include "r3_str.h"
#include "str_array.h"
// String value as the index http://judy.sourceforge.net/doc/JudySL_3x.htm

View file

@ -387,3 +387,4 @@
1400599508,13991454.07
1400599553,13826120.84
1400599756,12099437.82
1400599972,13982492.37

1 1400242718 5649455.80
387 1400599508 13991454.07
388 1400599553 13826120.84
389 1400599756 12099437.82
390 1400599972 13982492.37

View file

@ -4,7 +4,6 @@
#include <stdlib.h>
#include "r3.h"
#include "r3_str.h"
#include "r3_define.h"
#include "str_array.h"
#include "bench.h"