summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2012-05-16 15:18:44 +0000
committerkr.angelov <kr.angelov@gmail.com>2012-05-16 15:18:44 +0000
commitf4c17cb7aa1517739c5aea5155e17fc9d1b2f05e (patch)
treedaf935713c70a871e9131d2d92eb97e7ac7b6aee /src
parent6f328c9040b394054eff399f26d3b7aea6567206 (diff)
another attempt to port the robust parser to MacOS
Diffstat (limited to 'src')
-rw-r--r--src/runtime/c/Makefile.am6
-rw-r--r--src/runtime/c/configure.ac7
-rw-r--r--src/runtime/c/gu/mem.h6
-rw-r--r--src/runtime/c/gu/seq.c1
-rw-r--r--src/runtime/c/gu/string.c2
-rw-r--r--src/runtime/c/gu/sysdeps.h3
-rw-r--r--src/runtime/c/gu/ucs.c6
-rw-r--r--src/runtime/c/gu/ucs.h2
-rw-r--r--src/runtime/c/gu/utf8.c4
-rw-r--r--src/runtime/c/gu/utf8.h4
-rw-r--r--src/runtime/c/guconfig.h.in2
-rw-r--r--src/runtime/c/pgf/data.h4
-rw-r--r--src/runtime/c/pgf/expr.h2
-rw-r--r--src/runtime/c/pgf/parser.c2
-rw-r--r--src/runtime/c/pgf/pgf.h2
15 files changed, 21 insertions, 32 deletions
diff --git a/src/runtime/c/Makefile.am b/src/runtime/c/Makefile.am
index 3d7353f03..b0cc5ddd1 100644
--- a/src/runtime/c/Makefile.am
+++ b/src/runtime/c/Makefile.am
@@ -7,7 +7,6 @@ pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libgu.pc libpgf.pc
configincludedir = $(libdir)/libgu/include
-nodist_configinclude_HEADERS = guconfig.h
guincludedir=$(includedir)/gu
guinclude_HEADERS = \
@@ -103,7 +102,7 @@ bin_PROGRAMS = \
utils/pgf-translate
utils_pgf2yaml_SOURCES = utils/pgf2yaml.c
-utils_pgf2yaml_LDADD = libpgf.la libgu.la
+utils_pgf2yaml_LDADD = libpgf.la libgu.la
utils_pgf_print_SOURCES = utils/pgf-print.c
utils_pgf_print_LDADD = libpgf.la libgu.la
@@ -119,5 +118,4 @@ EXTRA_DIST = \
Doxyfile \
DoxygenLayout.xml \
libgu.pc.in \
- libpgf.pc.in \
- guconfig.h.in
+ libpgf.pc.in
diff --git a/src/runtime/c/configure.ac b/src/runtime/c/configure.ac
index ade514745..81bc610c9 100644
--- a/src/runtime/c/configure.ac
+++ b/src/runtime/c/configure.ac
@@ -12,7 +12,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
PKG_PROG_PKG_CONFIG
-AC_CONFIG_HEADERS([config.h guconfig.h])
+AC_CONFIG_HEADERS([config.h])
AM_MAINTAINER_MODE([enable])
AC_CHECK_LIB(m,nan)
@@ -35,12 +35,7 @@ fi]
AC_C_ALIGNOF
AC_C_FAM_IN_MEM
AC_C_STATEMENT_EXPRESSIONS
-
-m4_define([ORIG_DEFINE],m4_defn([AC_DEFINE]))
-m4_define([_ORIG_DEFINE],m4_defn([_AC_DEFINE]))
-m4_pushdef([AC_DEFINE],[ORIG_DEFINE([GU_$1],[$2],[$3])])
AC_C_ASCII
-m4_popdef([AC_DEFINE])
dnl Doxygen support
DX_PS_FEATURE(OFF)
diff --git a/src/runtime/c/gu/mem.h b/src/runtime/c/gu/mem.h
index 4369f4036..e389bcc0c 100644
--- a/src/runtime/c/gu/mem.h
+++ b/src/runtime/c/gu/mem.h
@@ -171,7 +171,7 @@ gu_malloc_init(GuPool* pool, size_t size, const void* init)
-#ifdef GU_HAVE_STATEMENT_EXPRESSIONS
+#ifdef HAVE_STATEMENT_EXPRESSIONS
#define gu_new_i(pool, type, ...) \
({ \
type *gu_new_p_ = gu_new(type, pool); \
@@ -179,12 +179,12 @@ gu_malloc_init(GuPool* pool, size_t size, const void* init)
sizeof(type)); \
gu_new_p_; \
})
-#else // GU_HAVE_STATEMENT_EXPRESSIONS
+#else // HAVE_STATEMENT_EXPRESSIONS
#define gu_new_i(pool, type, ...) \
((type*)gu_malloc_init_aligned((pool), sizeof(type), \
gu_alignof(type), \
&(type){ __VA_ARGS__ }))
-#endif // GU_HAVE_STATEMENT_EXPRESSIONS
+#endif // HAVE_STATEMENT_EXPRESSIONS
/** @def gu_new_i(pool, type, ...)
*
diff --git a/src/runtime/c/gu/seq.c b/src/runtime/c/gu/seq.c
index 761d8d945..fda1be99c 100644
--- a/src/runtime/c/gu/seq.c
+++ b/src/runtime/c/gu/seq.c
@@ -304,6 +304,7 @@ gu_buf_out(GuBuf* buf, GuPool* pool)
bout->stream.output = gu_buf_out_output;
bout->stream.begin_buf = gu_buf_outbuf_begin;
bout->stream.end_buf = gu_buf_outbuf_end;
+ bout->stream.flush = NULL;
bout->buf = buf;
return gu_new_out(&bout->stream, pool);
}
diff --git a/src/runtime/c/gu/string.c b/src/runtime/c/gu/string.c
index 0af0ce7be..d7e29fafe 100644
--- a/src/runtime/c/gu/string.c
+++ b/src/runtime/c/gu/string.c
@@ -195,7 +195,7 @@ gu_format_string(GuPool* pool, const char* fmt, ...)
GuString
gu_str_string(const char* str, GuPool* pool)
{
-#ifdef GU_CHAR_ASCII
+#ifdef CHAR_ASCII
return gu_utf8_string((const uint8_t*) str, strlen(str), pool);
#else
GuPool* tmp_pool = gu_local_pool();
diff --git a/src/runtime/c/gu/sysdeps.h b/src/runtime/c/gu/sysdeps.h
index 114e1c40d..c13945b5d 100644
--- a/src/runtime/c/gu/sysdeps.h
+++ b/src/runtime/c/gu/sysdeps.h
@@ -1,7 +1,7 @@
#ifndef GU_SYSDEPS_H_
#define GU_SYSDEPS_H_
-#include <guconfig.h>
+#include <config.h>
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
# define GU_GNUC
@@ -9,7 +9,6 @@
#ifdef GU_GNUC
# define GU_ALIGNOF __alignof
-# define GU_HAVE_STATEMENT_EXPRESSIONS
# define GU_GNUC_ATTR(x) __attribute__(( x ))
# if defined(__OPTIMIZE_SIZE__)
# define GU_OPTIMIZE_SIZE
diff --git a/src/runtime/c/gu/ucs.c b/src/runtime/c/gu/ucs.c
index 34649f36a..dc210b312 100644
--- a/src/runtime/c/gu/ucs.c
+++ b/src/runtime/c/gu/ucs.c
@@ -1,11 +1,11 @@
#include <gu/ucs.h>
#include <gu/assert.h>
-#include <guconfig.h>
+#include <config.h>
GU_DEFINE_TYPE(GuUCSExn, abstract, _);
-#ifdef GU_CHAR_ASCII
+#ifdef CHAR_ASCII
bool
gu_char_is_valid(char c)
@@ -36,7 +36,7 @@ gu_ucs_char(GuUCS uc, GuExn* err)
return 0;
}
-#else // defined(GU_CHAR_ASCII)
+#else // defined(CHAR_ASCII)
static const char gu_ucs_ascii[128] =
"\0\0\0\0\0\0\0\a\b\t\n\v\f\r\0\0"
diff --git a/src/runtime/c/gu/ucs.h b/src/runtime/c/gu/ucs.h
index f1662a602..0c9e7cce0 100644
--- a/src/runtime/c/gu/ucs.h
+++ b/src/runtime/c/gu/ucs.h
@@ -29,7 +29,7 @@ inline GuUCS
gu_char_ucs(char c)
{
gu_require(gu_char_is_valid(c));
-#ifdef GU_CHAR_ASCII
+#ifdef CHAR_ASCII
GuUCS u = (GuUCS) c;
#else
extern const uint8_t gu_ucs_ascii_reverse_[CHAR_MAX];
diff --git a/src/runtime/c/gu/utf8.c b/src/runtime/c/gu/utf8.c
index a416c2dac..b1d5996c2 100644
--- a/src/runtime/c/gu/utf8.c
+++ b/src/runtime/c/gu/utf8.c
@@ -1,6 +1,6 @@
#include <gu/assert.h>
#include <gu/utf8.h>
-#include <guconfig.h>
+#include <config.h>
GuUCS
gu_utf8_decode(const uint8_t** src_inout)
@@ -180,7 +180,7 @@ gu_utf32_out_utf8(const GuUCS* src, size_t len, GuOut* out, GuExn* err)
}
-#ifndef GU_CHAR_ASCII
+#ifndef CHAR_ASCII
void gu_str_out_utf8_(const char* str, GuOut* out, GuExn* err)
{
diff --git a/src/runtime/c/gu/utf8.h b/src/runtime/c/gu/utf8.h
index 053d8664e..c4112b5a5 100644
--- a/src/runtime/c/gu/utf8.h
+++ b/src/runtime/c/gu/utf8.h
@@ -21,7 +21,7 @@ gu_in_utf8(GuIn* in, GuExn* err)
inline char
gu_in_utf8_char(GuIn* in, GuExn* err)
{
-#ifdef GU_CHAR_ASCII
+#ifdef CHAR_ASCII
int i = gu_in_peek_u8(in);
if (i >= 0 && i < 0x80) {
gu_in_consume(in, 1);
@@ -55,7 +55,7 @@ gu_utf8_decode(const uint8_t** utf8);
inline void
gu_str_out_utf8(const char* str, GuOut* out, GuExn* err)
{
-#ifdef GU_CHAR_ASCII
+#ifdef CHAR_ASCII
gu_out_bytes(out, (const uint8_t*) str, strlen(str), err);
#else
extern void
diff --git a/src/runtime/c/guconfig.h.in b/src/runtime/c/guconfig.h.in
deleted file mode 100644
index d323bfbf7..000000000
--- a/src/runtime/c/guconfig.h.in
+++ /dev/null
@@ -1,2 +0,0 @@
-/* Define to 1 if character literals use ASCII encoding */
-#undef GU_CHAR_ASCII
diff --git a/src/runtime/c/pgf/data.h b/src/runtime/c/pgf/data.h
index cdbbf8d6b..63c26d318 100644
--- a/src/runtime/c/pgf/data.h
+++ b/src/runtime/c/pgf/data.h
@@ -297,11 +297,11 @@ struct PgfPArg {
PgfCCatIds* hypos;
};
-GU_DECLARE_TYPE(PgfPArg, struct);
+extern GU_DECLARE_TYPE(PgfPArg, struct);
typedef GuSeq PgfPArgs;
-GU_DECLARE_TYPE(PgfPArgs, GuSeq);
+extern GU_DECLARE_TYPE(PgfPArgs, GuSeq);
typedef struct {
PgfFunId fun;
diff --git a/src/runtime/c/pgf/expr.h b/src/runtime/c/pgf/expr.h
index 003102792..f4d5881c7 100644
--- a/src/runtime/c/pgf/expr.h
+++ b/src/runtime/c/pgf/expr.h
@@ -13,7 +13,7 @@
/// An abstract syntax tree
typedef GuVariant PgfExpr;
-GU_DECLARE_TYPE(PgfExpr, GuVariant);
+extern GU_DECLARE_TYPE(PgfExpr, GuVariant);
typedef GuList(PgfExpr) PgfExprs;
diff --git a/src/runtime/c/pgf/parser.c b/src/runtime/c/pgf/parser.c
index 4cb1c1b4d..864674833 100644
--- a/src/runtime/c/pgf/parser.c
+++ b/src/runtime/c/pgf/parser.c
@@ -110,13 +110,11 @@ static GU_DEFINE_TYPE(PgfCFCat, struct,
extern GuHasher pgf_cfcat_hasher;
-typedef GuMap PgfEpsilonIdx;
GU_DEFINE_TYPE(PgfEpsilonIdx, GuMap,
gu_type(PgfCFCat), &pgf_cfcat_hasher,
gu_ptr_type(PgfCCat), &gu_null_struct);
// GuString -> PgfItemBuf*
-typedef GuStringMap PgfTransitions;
GU_DEFINE_TYPE(PgfTransitions, GuStringMap,
gu_ptr_type(PgfItemBuf), &gu_null_struct);
diff --git a/src/runtime/c/pgf/pgf.h b/src/runtime/c/pgf/pgf.h
index df4904b53..91659d95e 100644
--- a/src/runtime/c/pgf/pgf.h
+++ b/src/runtime/c/pgf/pgf.h
@@ -70,7 +70,7 @@ pgf_read(GuIn* in, GuPool* pool, GuExn* err);
#include <gu/type.h>
-GU_DECLARE_TYPE(PgfPGF, struct);
+extern GU_DECLARE_TYPE(PgfPGF, struct);
/// @}