experimented a bit for building on classic mac os

This commit is contained in:
hyung-hwan 2013-01-20 14:03:36 +00:00
parent 164b85a6f9
commit d671443442
12 changed files with 131 additions and 27 deletions

View File

@ -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

View File

@ -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

View File

@ -21,20 +21,25 @@
#ifndef _QSE_ALG_H_
#define _QSE_ALG_H_
/** @file
/** \file
* This file provides functions for commonly used algorithms.
*/
#include <qse/types.h>
#include <qse/macros.h>
#if defined(macintosh)
# include <:qse:types.h>
# include <:qse:macros.h>
#else
# include <qse/types.h>
# include <qse/macros.h>
#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,

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
/* 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>

View File

@ -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.

View File

@ -21,7 +21,11 @@
#ifndef _QSE_MACROS_H_
#define _QSE_MACROS_H_
#include <qse/types.h>
#if defined(macintosh)
# include <:qse:types.h>
#else
# include <qse/types.h>
#endif
/** @file
* This file contains various useful macro definitions.

View File

@ -40,6 +40,8 @@
# include <qse/conf-dos.h>
#elif defined(vms) || defined(__vms)
# include <qse/conf-vms.h>
#elif defined(macintosh)
# include <:qse:conf-mac.h> /* class mac os */
#else
# error Unsupported operating system
#endif

View File

@ -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);
}
}

View File

@ -18,7 +18,11 @@
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
*/
#include <qse/cmn/alg.h>
#if defined(macintosh)
# include <:qse:cmn:alg.h>
#else
# include <qse/cmn/alg.h>
#endif
#define ENC(x) \
((x < 26)? (QSE_MT('A') + x): \

View File

@ -18,7 +18,11 @@
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
*/
#include <qse/cmn/alg.h>
#if defined(macintosh)
# include <:qse:cmn:alg.h>
#else
# include <qse/cmn/alg.h>
#endif
/* Park-Miller "minimal standard" 31 bit
* pseudo-random number generator, implemented

View File

@ -18,7 +18,11 @@
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
*/
#include <qse/cmn/alg.h>
#if defined(macintosh)
# include <:qse:cmn:alg.h>
#else
# include <qse/cmn/alg.h>
#endif
void* qse_bsearch (
const void *key, const void *base, qse_size_t nmemb,

View File

@ -47,7 +47,11 @@
* SUCH DAMAGE.
*/
#if defined(macintosh)
#include <:qse:cmn:alg.h>
#else
#include <qse/cmn/alg.h>
#endif
#define qsort_min(a,b) (((a)<(b))? a: b)