mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 00:22:51 -06:00
another attempt to port the robust parser to MacOS
This commit is contained in:
@@ -7,7 +7,6 @@ pkgconfigdir = $(libdir)/pkgconfig
|
|||||||
pkgconfig_DATA = libgu.pc libpgf.pc
|
pkgconfig_DATA = libgu.pc libpgf.pc
|
||||||
|
|
||||||
configincludedir = $(libdir)/libgu/include
|
configincludedir = $(libdir)/libgu/include
|
||||||
nodist_configinclude_HEADERS = guconfig.h
|
|
||||||
|
|
||||||
guincludedir=$(includedir)/gu
|
guincludedir=$(includedir)/gu
|
||||||
guinclude_HEADERS = \
|
guinclude_HEADERS = \
|
||||||
@@ -119,5 +118,4 @@ EXTRA_DIST = \
|
|||||||
Doxyfile \
|
Doxyfile \
|
||||||
DoxygenLayout.xml \
|
DoxygenLayout.xml \
|
||||||
libgu.pc.in \
|
libgu.pc.in \
|
||||||
libpgf.pc.in \
|
libpgf.pc.in
|
||||||
guconfig.h.in
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
|||||||
|
|
||||||
PKG_PROG_PKG_CONFIG
|
PKG_PROG_PKG_CONFIG
|
||||||
|
|
||||||
AC_CONFIG_HEADERS([config.h guconfig.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
|
|
||||||
AM_MAINTAINER_MODE([enable])
|
AM_MAINTAINER_MODE([enable])
|
||||||
AC_CHECK_LIB(m,nan)
|
AC_CHECK_LIB(m,nan)
|
||||||
@@ -35,12 +35,7 @@ fi]
|
|||||||
AC_C_ALIGNOF
|
AC_C_ALIGNOF
|
||||||
AC_C_FAM_IN_MEM
|
AC_C_FAM_IN_MEM
|
||||||
AC_C_STATEMENT_EXPRESSIONS
|
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
|
AC_C_ASCII
|
||||||
m4_popdef([AC_DEFINE])
|
|
||||||
|
|
||||||
dnl Doxygen support
|
dnl Doxygen support
|
||||||
DX_PS_FEATURE(OFF)
|
DX_PS_FEATURE(OFF)
|
||||||
|
|||||||
@@ -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, ...) \
|
#define gu_new_i(pool, type, ...) \
|
||||||
({ \
|
({ \
|
||||||
type *gu_new_p_ = gu_new(type, pool); \
|
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)); \
|
sizeof(type)); \
|
||||||
gu_new_p_; \
|
gu_new_p_; \
|
||||||
})
|
})
|
||||||
#else // GU_HAVE_STATEMENT_EXPRESSIONS
|
#else // HAVE_STATEMENT_EXPRESSIONS
|
||||||
#define gu_new_i(pool, type, ...) \
|
#define gu_new_i(pool, type, ...) \
|
||||||
((type*)gu_malloc_init_aligned((pool), sizeof(type), \
|
((type*)gu_malloc_init_aligned((pool), sizeof(type), \
|
||||||
gu_alignof(type), \
|
gu_alignof(type), \
|
||||||
&(type){ __VA_ARGS__ }))
|
&(type){ __VA_ARGS__ }))
|
||||||
#endif // GU_HAVE_STATEMENT_EXPRESSIONS
|
#endif // HAVE_STATEMENT_EXPRESSIONS
|
||||||
|
|
||||||
/** @def gu_new_i(pool, type, ...)
|
/** @def gu_new_i(pool, type, ...)
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -304,6 +304,7 @@ gu_buf_out(GuBuf* buf, GuPool* pool)
|
|||||||
bout->stream.output = gu_buf_out_output;
|
bout->stream.output = gu_buf_out_output;
|
||||||
bout->stream.begin_buf = gu_buf_outbuf_begin;
|
bout->stream.begin_buf = gu_buf_outbuf_begin;
|
||||||
bout->stream.end_buf = gu_buf_outbuf_end;
|
bout->stream.end_buf = gu_buf_outbuf_end;
|
||||||
|
bout->stream.flush = NULL;
|
||||||
bout->buf = buf;
|
bout->buf = buf;
|
||||||
return gu_new_out(&bout->stream, pool);
|
return gu_new_out(&bout->stream, pool);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ gu_format_string(GuPool* pool, const char* fmt, ...)
|
|||||||
GuString
|
GuString
|
||||||
gu_str_string(const char* str, GuPool* pool)
|
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);
|
return gu_utf8_string((const uint8_t*) str, strlen(str), pool);
|
||||||
#else
|
#else
|
||||||
GuPool* tmp_pool = gu_local_pool();
|
GuPool* tmp_pool = gu_local_pool();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef GU_SYSDEPS_H_
|
#ifndef GU_SYSDEPS_H_
|
||||||
#define GU_SYSDEPS_H_
|
#define GU_SYSDEPS_H_
|
||||||
|
|
||||||
#include <guconfig.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||||
# define GU_GNUC
|
# define GU_GNUC
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
#ifdef GU_GNUC
|
#ifdef GU_GNUC
|
||||||
# define GU_ALIGNOF __alignof
|
# define GU_ALIGNOF __alignof
|
||||||
# define GU_HAVE_STATEMENT_EXPRESSIONS
|
|
||||||
# define GU_GNUC_ATTR(x) __attribute__(( x ))
|
# define GU_GNUC_ATTR(x) __attribute__(( x ))
|
||||||
# if defined(__OPTIMIZE_SIZE__)
|
# if defined(__OPTIMIZE_SIZE__)
|
||||||
# define GU_OPTIMIZE_SIZE
|
# define GU_OPTIMIZE_SIZE
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
#include <gu/ucs.h>
|
#include <gu/ucs.h>
|
||||||
#include <gu/assert.h>
|
#include <gu/assert.h>
|
||||||
#include <guconfig.h>
|
#include <config.h>
|
||||||
|
|
||||||
GU_DEFINE_TYPE(GuUCSExn, abstract, _);
|
GU_DEFINE_TYPE(GuUCSExn, abstract, _);
|
||||||
|
|
||||||
|
|
||||||
#ifdef GU_CHAR_ASCII
|
#ifdef CHAR_ASCII
|
||||||
|
|
||||||
bool
|
bool
|
||||||
gu_char_is_valid(char c)
|
gu_char_is_valid(char c)
|
||||||
@@ -36,7 +36,7 @@ gu_ucs_char(GuUCS uc, GuExn* err)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else // defined(GU_CHAR_ASCII)
|
#else // defined(CHAR_ASCII)
|
||||||
|
|
||||||
static const char gu_ucs_ascii[128] =
|
static const char gu_ucs_ascii[128] =
|
||||||
"\0\0\0\0\0\0\0\a\b\t\n\v\f\r\0\0"
|
"\0\0\0\0\0\0\0\a\b\t\n\v\f\r\0\0"
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ inline GuUCS
|
|||||||
gu_char_ucs(char c)
|
gu_char_ucs(char c)
|
||||||
{
|
{
|
||||||
gu_require(gu_char_is_valid(c));
|
gu_require(gu_char_is_valid(c));
|
||||||
#ifdef GU_CHAR_ASCII
|
#ifdef CHAR_ASCII
|
||||||
GuUCS u = (GuUCS) c;
|
GuUCS u = (GuUCS) c;
|
||||||
#else
|
#else
|
||||||
extern const uint8_t gu_ucs_ascii_reverse_[CHAR_MAX];
|
extern const uint8_t gu_ucs_ascii_reverse_[CHAR_MAX];
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include <gu/assert.h>
|
#include <gu/assert.h>
|
||||||
#include <gu/utf8.h>
|
#include <gu/utf8.h>
|
||||||
#include <guconfig.h>
|
#include <config.h>
|
||||||
|
|
||||||
GuUCS
|
GuUCS
|
||||||
gu_utf8_decode(const uint8_t** src_inout)
|
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)
|
void gu_str_out_utf8_(const char* str, GuOut* out, GuExn* err)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ gu_in_utf8(GuIn* in, GuExn* err)
|
|||||||
inline char
|
inline char
|
||||||
gu_in_utf8_char(GuIn* in, GuExn* err)
|
gu_in_utf8_char(GuIn* in, GuExn* err)
|
||||||
{
|
{
|
||||||
#ifdef GU_CHAR_ASCII
|
#ifdef CHAR_ASCII
|
||||||
int i = gu_in_peek_u8(in);
|
int i = gu_in_peek_u8(in);
|
||||||
if (i >= 0 && i < 0x80) {
|
if (i >= 0 && i < 0x80) {
|
||||||
gu_in_consume(in, 1);
|
gu_in_consume(in, 1);
|
||||||
@@ -55,7 +55,7 @@ gu_utf8_decode(const uint8_t** utf8);
|
|||||||
inline void
|
inline void
|
||||||
gu_str_out_utf8(const char* str, GuOut* out, GuExn* err)
|
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);
|
gu_out_bytes(out, (const uint8_t*) str, strlen(str), err);
|
||||||
#else
|
#else
|
||||||
extern void
|
extern void
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
/* Define to 1 if character literals use ASCII encoding */
|
|
||||||
#undef GU_CHAR_ASCII
|
|
||||||
@@ -297,11 +297,11 @@ struct PgfPArg {
|
|||||||
PgfCCatIds* hypos;
|
PgfCCatIds* hypos;
|
||||||
};
|
};
|
||||||
|
|
||||||
GU_DECLARE_TYPE(PgfPArg, struct);
|
extern GU_DECLARE_TYPE(PgfPArg, struct);
|
||||||
|
|
||||||
typedef GuSeq PgfPArgs;
|
typedef GuSeq PgfPArgs;
|
||||||
|
|
||||||
GU_DECLARE_TYPE(PgfPArgs, GuSeq);
|
extern GU_DECLARE_TYPE(PgfPArgs, GuSeq);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PgfFunId fun;
|
PgfFunId fun;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
/// An abstract syntax tree
|
/// An abstract syntax tree
|
||||||
typedef GuVariant PgfExpr;
|
typedef GuVariant PgfExpr;
|
||||||
|
|
||||||
GU_DECLARE_TYPE(PgfExpr, GuVariant);
|
extern GU_DECLARE_TYPE(PgfExpr, GuVariant);
|
||||||
|
|
||||||
typedef GuList(PgfExpr) PgfExprs;
|
typedef GuList(PgfExpr) PgfExprs;
|
||||||
|
|
||||||
|
|||||||
@@ -110,13 +110,11 @@ static GU_DEFINE_TYPE(PgfCFCat, struct,
|
|||||||
|
|
||||||
extern GuHasher pgf_cfcat_hasher;
|
extern GuHasher pgf_cfcat_hasher;
|
||||||
|
|
||||||
typedef GuMap PgfEpsilonIdx;
|
|
||||||
GU_DEFINE_TYPE(PgfEpsilonIdx, GuMap,
|
GU_DEFINE_TYPE(PgfEpsilonIdx, GuMap,
|
||||||
gu_type(PgfCFCat), &pgf_cfcat_hasher,
|
gu_type(PgfCFCat), &pgf_cfcat_hasher,
|
||||||
gu_ptr_type(PgfCCat), &gu_null_struct);
|
gu_ptr_type(PgfCCat), &gu_null_struct);
|
||||||
|
|
||||||
// GuString -> PgfItemBuf*
|
// GuString -> PgfItemBuf*
|
||||||
typedef GuStringMap PgfTransitions;
|
|
||||||
GU_DEFINE_TYPE(PgfTransitions, GuStringMap,
|
GU_DEFINE_TYPE(PgfTransitions, GuStringMap,
|
||||||
gu_ptr_type(PgfItemBuf), &gu_null_struct);
|
gu_ptr_type(PgfItemBuf), &gu_null_struct);
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ pgf_read(GuIn* in, GuPool* pool, GuExn* err);
|
|||||||
|
|
||||||
|
|
||||||
#include <gu/type.h>
|
#include <gu/type.h>
|
||||||
GU_DECLARE_TYPE(PgfPGF, struct);
|
extern GU_DECLARE_TYPE(PgfPGF, struct);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user