diff --git a/qse/include/qse/Makefile.am b/qse/include/qse/Makefile.am index a54d7335..6704f320 100644 --- a/qse/include/qse/Makefile.am +++ b/qse/include/qse/Makefile.am @@ -3,7 +3,7 @@ SUBDIRS = cmn awk sed net pkgincludedir = $(includedir)/qse pkginclude_HEADERS = \ - conf-msw.h conf-os2.h conf-dos.h conf-vms.h conf-inf.h \ + conf-msw.h conf-os2.h conf-dos.h conf-vms.h conf-mac.h conf-inf.h \ types.h macros.h pack1.h unpack.h if ENABLE_CXX diff --git a/qse/include/qse/Makefile.in b/qse/include/qse/Makefile.in index e67e25c9..e703c7dc 100644 --- a/qse/include/qse/Makefile.in +++ b/qse/include/qse/Makefile.in @@ -60,8 +60,8 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__pkginclude_HEADERS_DIST = conf-msw.h conf-os2.h conf-dos.h \ - conf-vms.h conf-inf.h types.h macros.h pack1.h unpack.h \ - Types.hpp + conf-vms.h conf-mac.h conf-inf.h types.h macros.h pack1.h \ + unpack.h Types.hpp am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -301,7 +301,8 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = cmn awk sed net pkginclude_HEADERS = conf-msw.h conf-os2.h conf-dos.h conf-vms.h \ - conf-inf.h types.h macros.h pack1.h unpack.h $(am__append_1) + conf-mac.h conf-inf.h types.h macros.h pack1.h unpack.h \ + $(am__append_1) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive diff --git a/qse/include/qse/cmn/alg.h b/qse/include/qse/cmn/alg.h index 43079944..dd9d560e 100644 --- a/qse/include/qse/cmn/alg.h +++ b/qse/include/qse/cmn/alg.h @@ -21,20 +21,25 @@ #ifndef _QSE_ALG_H_ #define _QSE_ALG_H_ -/** @file +/** \file * This file provides functions for commonly used algorithms. */ -#include -#include +#if defined(macintosh) +# include <:qse:types.h> +# include <:qse:macros.h> +#else +# include +# include +#endif /** * The qse_search_comper_t type defines a search callback function. * The callback function is called by search functions for each comparison - * performed. It should return 0 if @a ptr1 and @a ptr2 are - * euqal, a positive integer if @a ptr1 is greater than @a ptr2, a negative - * if @a ptr2 is greater than @a ptr1. Both @a ptr1 and @a ptr2 are - * pointers to any two items in the array. @a ctx which is a pointer to + * performed. It should return 0 if \a ptr1 and \a ptr2 are + * euqal, a positive integer if \a ptr1 is greater than \a ptr2, a negative + * if \a ptr2 is greater than \a ptr1. Both \a ptr1 and \a ptr2 are + * pointers to any two items in the array. \a ctx which is a pointer to * user-defined data passed to a search function is passed to the callback * with no modification. */ @@ -55,14 +60,14 @@ extern "C" { /** * The qse_bsearch() function performs binary search over a sorted array. - * It looks for an item matching @a key in an array @a base containing - * @a nmemb items each of which is as large as @a size. The comparison - * function @a comper is invoked with @a key as the first parameter and - * an item being tested as the second parameter. The @a ctx parameter is - * passed to @a comper as the third parameter. + * It looks for an item matching \a key in an array \a base containing + * \a nmemb items each of which is as large as \a size. The comparison + * function \a comper is invoked with \a key as the first parameter and + * an item being tested as the second parameter. The \a ctx parameter is + * passed to \a comper as the third parameter. * * See the example below: - * @code + * \code * static int compstr (const void* s1, const void* s2, void* ctx) * { * return qse_strcmp ((const qse_char_t*)s1, *(const qse_char_t**)s2); @@ -88,7 +93,7 @@ extern "C" { * ); * return ptr? (ptr - tgtnames): -1; * } - * @endcode + * \endcode */ QSE_EXPORT void* qse_bsearch ( const void* key, diff --git a/qse/include/qse/conf-mac.h b/qse/include/qse/conf-mac.h new file mode 100644 index 00000000..191c1c45 --- /dev/null +++ b/qse/include/qse/conf-mac.h @@ -0,0 +1,72 @@ +/* + * $Id$ + * + Copyright 2006-2012 Chung, Hyung-Hwan. + This file is part of QSE. + + QSE is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of + the License, or (at your option) any later version. + + QSE is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with QSE. If not, see . + */ + +/* This file is for class Mac OS */ + +/* Mac OS on PPC and m68k uses the big endian mode */ +#define QSE_ENDIAN_BIG + +/* + * You must define which character type to use as a default character here. + * + * #define QSE_CHAR_IS_WCHAR + * #define QSE_CHAR_IS_MCHAR + */ + +#if defined(__MWERKS__) +# define QSE_SIZEOF_CHAR 1 +# define QSE_SIZEOF_SHORT 2 +# define QSE_SIZEOF_INT 4 +# define QSE_SIZEOF_LONG 4 +# define QSE_SIZEOF_LONG_LONG 8 +# define QSE_SIZEOF_VOID_P 4 +# define QSE_SIZEOF_FLOAT 4 +# define QSE_SIZEOF_DOUBLE 8 +# define QSE_SIZEOF_LONG_DOUBLE 8 +# define QSE_SIZEOF_WCHAR_T 2 + +# define QSE_SIZEOF___INT8 1 +# define QSE_SIZEOF___INT16 2 +# define QSE_SIZEOF___INT32 4 +# define QSE_SIZEOF___INT64 8 +# define QSE_SIZEOF___INT128 0 + +# define QSE_SIZEOF_OFF64_T 0 +# define QSE_SIZEOF_OFF_T 8 + +# define QSE_SIZEOF_MBSTATE_T QSE_SIZEOF_LONG +# define QSE_MBLEN_MAX 16 + + /* these two have only to be large enough */ +# define QSE_SIZEOF_STRUCT_SOCKADDR_IN 32 +# define QSE_SIZEOF_STRUCT_SOCKADDR_IN6 64 + +# if !defined(QSE_CHAR_IS_WCHAR) && !defined(QSE_CHAR_IS_MCHAR) +# define QSE_CHAR_IS_WCHAR 1 +# endif + +# undef QSE_ENABLE_BUNDLED_UNICODE +# define QSE_ENABLE_BUNDLED_UNICODE 1 + +#else +# error Define the size of various data types. +#endif + +#include <:qse:conf-inf.h> diff --git a/qse/include/qse/conf-msw.h b/qse/include/qse/conf-msw.h index 9277bf55..a5b72e79 100644 --- a/qse/include/qse/conf-msw.h +++ b/qse/include/qse/conf-msw.h @@ -1,5 +1,5 @@ /* - * $Id: conf_msw.h 561 2011-09-07 07:17:05Z hyunghwan.chung $ + * $Id$ * Copyright 2006-2012 Chung, Hyung-Hwan. This file is part of QSE. diff --git a/qse/include/qse/macros.h b/qse/include/qse/macros.h index 4354c6c6..657a7985 100644 --- a/qse/include/qse/macros.h +++ b/qse/include/qse/macros.h @@ -21,7 +21,11 @@ #ifndef _QSE_MACROS_H_ #define _QSE_MACROS_H_ -#include +#if defined(macintosh) +# include <:qse:types.h> +#else +# include +#endif /** @file * This file contains various useful macro definitions. diff --git a/qse/include/qse/types.h b/qse/include/qse/types.h index 487c7032..6617c85f 100644 --- a/qse/include/qse/types.h +++ b/qse/include/qse/types.h @@ -40,6 +40,8 @@ # include #elif defined(vms) || defined(__vms) # include +#elif defined(macintosh) +# include <:qse:conf-mac.h> /* class mac os */ #else # error Unsupported operating system #endif diff --git a/qse/lib/awk/parse.c b/qse/lib/awk/parse.c index 1f4f16da..214acf31 100644 --- a/qse/lib/awk/parse.c +++ b/qse/lib/awk/parse.c @@ -5557,6 +5557,11 @@ static int get_string ( #endif else if (keep_esc_char) { + /* if the following character doesn't compose a proper + * escape sequence, keep the escape character. + * an unhandled escape sequence can be handled + * outside this function since the escape character + * is preserved.*/ ADD_TOKEN_CHAR (awk, tok, esc_char); } @@ -5597,13 +5602,13 @@ static int get_rexstr (qse_awk_t* awk, qse_awk_tok_t* tok) } else { - int escaped = 0; + qse_size_t preescaped = 0; if (awk->sio.last.c == QSE_T('\\')) { /* for input like /\//, this condition is met. * the initial escape character is added when the * second charater is handled in get_string() */ - escaped = 1; + preescaped = 1; } else { @@ -5611,8 +5616,7 @@ static int get_rexstr (qse_awk_t* awk, qse_awk_tok_t* tok) * begins with reading the next character */ ADD_TOKEN_CHAR (awk, tok, awk->sio.last.c); } - return get_string ( - awk, QSE_T('/'), QSE_T('\\'), 1, escaped, tok); + return get_string (awk, QSE_T('/'), QSE_T('\\'), 1, preescaped, tok); } } diff --git a/qse/lib/cmn/alg-base64.c b/qse/lib/cmn/alg-base64.c index e5ffff33..7eb5274d 100644 --- a/qse/lib/cmn/alg-base64.c +++ b/qse/lib/cmn/alg-base64.c @@ -18,7 +18,11 @@ License along with QSE. If not, see . */ -#include +#if defined(macintosh) +# include <:qse:cmn:alg.h> +#else +# include +#endif #define ENC(x) \ ((x < 26)? (QSE_MT('A') + x): \ diff --git a/qse/lib/cmn/alg-rand.c b/qse/lib/cmn/alg-rand.c index 6babeaf3..0bf8ec74 100644 --- a/qse/lib/cmn/alg-rand.c +++ b/qse/lib/cmn/alg-rand.c @@ -18,7 +18,11 @@ License along with QSE. If not, see . */ -#include +#if defined(macintosh) +# include <:qse:cmn:alg.h> +#else +# include +#endif /* Park-Miller "minimal standard" 31 bit * pseudo-random number generator, implemented diff --git a/qse/lib/cmn/alg-search.c b/qse/lib/cmn/alg-search.c index 0bec1c87..cbad9e5b 100644 --- a/qse/lib/cmn/alg-search.c +++ b/qse/lib/cmn/alg-search.c @@ -18,7 +18,11 @@ License along with QSE. If not, see . */ -#include +#if defined(macintosh) +# include <:qse:cmn:alg.h> +#else +# include +#endif void* qse_bsearch ( const void *key, const void *base, qse_size_t nmemb, diff --git a/qse/lib/cmn/alg-sort.c b/qse/lib/cmn/alg-sort.c index 85cad674..31482eed 100644 --- a/qse/lib/cmn/alg-sort.c +++ b/qse/lib/cmn/alg-sort.c @@ -47,7 +47,11 @@ * SUCH DAMAGE. */ +#if defined(macintosh) +#include <:qse:cmn:alg.h> +#else #include +#endif #define qsort_min(a,b) (((a)<(b))? a: b)