*** empty log message ***

This commit is contained in:
hyung-hwan 2007-02-23 08:28:39 +00:00
parent 8c4383a64f
commit 89e66ed7aa
7 changed files with 217 additions and 165 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: jni.c,v 1.67 2007-02-23 08:17:49 bacon Exp $
* $Id: jni.c,v 1.68 2007-02-23 08:28:39 bacon Exp $
*
* {License}
*/
@ -16,17 +16,14 @@
#include <ase/awk/awk.h>
#include <ase/awk/val.h>
#include "../etc/printf.c"
#include <ase/utl/stdio.h>
#include <ase/utl/ctype.h>
#ifdef _WIN32
#include <windows.h>
#include <tchar.h>
#endif
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
#ifndef ASE_CHAR_IS_WCHAR
#error this module supports ASE_CHAR_IS_WCHAR only
#endif
@ -99,17 +96,17 @@ struct run_data_t
jmethodID double_value;
};
static void* awk_malloc (ase_size_t n, void* custom_data)
static void* awk_malloc (ase_mmgr_t* mmgr, ase_size_t n)
{
return malloc (n);
}
static void* awk_realloc (void* ptr, ase_size_t n, void* custom_data)
static void* awk_realloc (ase_mmgr_t* mmgr, void* ptr, ase_size_t n)
{
return realloc (ptr, n);
}
static void awk_free (void* ptr, void* custom_data)
static void awk_free (ase_mmgr_t* mmgr, void* ptr)
{
free (ptr);
}
@ -124,26 +121,6 @@ static void awk_abort (void* custom_data)
abort ();
}
static int awk_sprintf (
ase_char_t* buf, ase_size_t len, const ase_char_t* fmt, ...)
{
int n;
va_list ap;
va_start (ap, fmt);
n = ase_vsprintf (buf, len, fmt, ap);
va_end (ap);
return n;
}
static void awk_aprintf (const ase_char_t* fmt, ...)
{
va_list ap;
va_start (ap, fmt);
ase_vprintf (fmt, ap);
va_end (ap);
}
static void awk_dprintf (const ase_char_t* fmt, ...)
{
va_list ap;
@ -246,31 +223,33 @@ JNIEXPORT void JNICALL Java_ase_awk_Awk_open (JNIEnv* env, jobject obj)
int opt, errnum;
memset (&prmfns, 0, sizeof(prmfns));
prmfns.malloc = awk_malloc;
prmfns.realloc = awk_realloc;
prmfns.free = awk_free;
prmfns.is_upper = iswupper;
prmfns.is_lower = iswlower;
prmfns.is_alpha = iswalpha;
prmfns.is_digit = iswdigit;
prmfns.is_xdigit = iswxdigit;
prmfns.is_alnum = iswalnum;
prmfns.is_space = iswspace;
prmfns.is_print = iswprint;
prmfns.is_graph = iswgraph;
prmfns.is_cntrl = iswcntrl;
prmfns.is_punct = iswpunct;
prmfns.to_upper = towupper;
prmfns.to_lower = towlower;
prmfns.mmgr.malloc = awk_malloc;
prmfns.mmgr.realloc = awk_realloc;
prmfns.mmgr.free = awk_free;
prmfns.mmgr.custom_data = NULL;
prmfns.memcpy = memcpy;
prmfns.memset = memset;
prmfns.pow = awk_pow;
prmfns.sprintf = awk_sprintf;
prmfns.aprintf = awk_aprintf;
prmfns.dprintf = awk_dprintf;
prmfns.abort = awk_abort;
prmfns.ccls.is_upper = ase_isupper;
prmfns.ccls.is_lower = ase_islower;
prmfns.ccls.is_alpha = ase_isalpha;
prmfns.ccls.is_digit = ase_isdigit;
prmfns.ccls.is_xdigit = ase_isxdigit;
prmfns.ccls.is_alnum = ase_isalnum;
prmfns.ccls.is_space = ase_isspace;
prmfns.ccls.is_print = ase_isprint;
prmfns.ccls.is_graph = ase_isgraph;
prmfns.ccls.is_cntrl = ase_iscntrl;
prmfns.ccls.is_punct = ase_ispunct;
prmfns.ccls.to_upper = ase_toupper;
prmfns.ccls.to_lower = ase_tolower;
prmfns.ccls.custom_data = NULL;
prmfns.misc.pow = awk_pow;
prmfns.misc.sprintf = ase_sprintf;
prmfns.misc.aprintf = ase_printf;
prmfns.misc.dprintf = awk_dprintf;
prmfns.misc.abort = awk_abort;
prmfns.misc.custom_data = NULL;
awk_data = (awk_data_t*) malloc (sizeof(awk_data_t));
if (awk_data == NULL)
@ -1365,7 +1344,7 @@ static int __handle_bfn (
env = run_data->env;
obj = run_data->obj;
awk_sprintf (
ase_sprintf (
msg_nomem, ASE_COUNTOF(msg_nomem),
ASE_T("out of memory in handling %.*s"),
fnl, fnm);

View File

@ -1,4 +1,4 @@
SUBDIRS=cmn awk lsp utl
SUBDIRS=cmn utl awk lsp
all:
@for i in $(SUBDIRS); \

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c,v 1.175 2007-02-23 08:17:51 bacon Exp $
* $Id: awk.c,v 1.176 2007-02-23 08:21:35 bacon Exp $
*/
#include <ase/awk/awk.h>
@ -755,6 +755,18 @@ static int awk_main (int argc, ase_char_t* argv[])
prmfns.mmgr.malloc = awk_malloc;
prmfns.mmgr.realloc = awk_realloc;
prmfns.mmgr.free = awk_free;
#ifdef _WIN32
prmfns_data.heap = HeapCreate (0, 1000000, 1000000);
if (prmfns_data.heap == NULL)
{
ase_printf (ASE_T("Error: cannot create an awk heap\n"));
return -1;
}
prmfns.mmgr.custom_data = &prmfns_data;
#else
prmfns.mmgr.custom_data = NULL;
#endif
prmfns.ccls.is_upper = ase_isupper;
prmfns.ccls.is_lower = ase_islower;
@ -769,6 +781,7 @@ static int awk_main (int argc, ase_char_t* argv[])
prmfns.ccls.is_punct = ase_ispunct;
prmfns.ccls.to_upper = ase_toupper;
prmfns.ccls.to_lower = ase_tolower;
prmfns.ccls.custom_data = NULL;
prmfns.misc.pow = awk_pow;
prmfns.misc.sprintf = ase_sprintf;
@ -777,17 +790,7 @@ static int awk_main (int argc, ase_char_t* argv[])
prmfns.misc.abort = awk_abort;
prmfns.misc.lock = NULL;
prmfns.misc.unlock = NULL;
#ifdef _WIN32
prmfns_data.heap = HeapCreate (0, 1000000, 1000000);
if (prmfns_data.heap == NULL)
{
ase_printf (ASE_T("Error: cannot create an awk heap\n"));
return -1;
}
prmfns.mmgr.custom_data = &prmfns_data;
#endif
prmfns.misc.custom_data = NULL;
if ((awk = ase_awk_open(&prmfns, ASE_NULL, &errnum)) == ASE_NULL)
{

View File

@ -3,8 +3,8 @@ OBJS = $(SRCS:.c=.o)
CC = @CC@
CFLAGS = @CFLAGS@ -I@abs_top_builddir@/..
LDFLAGS = @LDFLAGS@ -L@abs_top_builddir@/awk -L@abs_top_builddir@/utl
LIBS = @LIBS@ -laseawk -laseutl -lm
LDFLAGS = @LDFLAGS@ -L@abs_top_builddir@/cmn -L@abs_top_builddir@/awk -L@abs_top_builddir@/utl
LIBS = @LIBS@ -lasecmn -laseawk -laseutl -lm
all: aseawk

View File

@ -1,5 +1,5 @@
/*
* $Id: types.h,v 1.72 2007-02-23 08:17:48 bacon Exp $
* $Id: types.h,v 1.73 2007-02-23 08:22:35 bacon Exp $
*
* {License}
*/
@ -230,7 +230,6 @@ typedef int ase_mcint_t;
#endif
#endif
typedef struct ase_cstr_t ase_cstr_t;
typedef struct ase_mmgr_t ase_mmgr_t;
typedef struct ase_ccls_t ase_ccls_t;
@ -241,12 +240,6 @@ typedef void (*ase_free_t) (ase_mmgr_t* mmgr, void* ptr);
typedef ase_bool_t (*ase_isccls_t) (ase_ccls_t* ccls, ase_cint_t c);
typedef ase_cint_t (*ase_toccls_t) (ase_ccls_t* ccls, ase_cint_t c);
struct ase_cstr_t
{
ase_char_t* ptr;
ase_size_t len;
};
struct ase_mmgr_t
{
ase_malloc_t malloc;

View File

@ -1,27 +1,149 @@
/*
* $Id: ctype.c,v 1.1 2007-02-20 14:47:33 bacon Exp $
* $Id: ctype.c,v 1.2 2007-02-23 08:17:51 bacon Exp $
*/
#include <ase/utl/ctype.h>
#if defined(ASE_CHAR_IS_MCHAR) && defined(isupper)
#if defined(ASE_CHAR_IS_MCHAR)
int ase_isupper (int c) { return isupper (c); }
int ase_islower (int c) { return islower (c); }
int ase_isalpha (int c) { return isalpha (c); }
int ase_isdigit (int c) { return isdigit (c); }
int ase_isxdigit (int c) { return isxdigit (c); }
int ase_isalnum (int c) { return isalnum (c); }
int ase_isspace (int c) { return isspace (c); }
int ase_isprint (int c) { return isprint (c); }
int ase_isgraph (int c) { return isgraph (c); }
int ase_iscntrl (int c) { return iscntrl (c); }
int ase_ispunct (int c) { return ispunct (c); }
#include <ctype.h>
ase_bool_t ase_isupper (ase_ccls_t* ccls, ase_cint_t c)
{
return isupper (c);
}
ase_bool_t ase_islower (ase_ccls_t* ccls, ase_cint_t c)
{
return islower (c);
}
ase_bool_t ase_isalpha (ase_ccls_t* ccls, ase_cint_t c)
{
return isalpha (c);
}
ase_bool_t ase_isdigit (ase_ccls_t* ccls, ase_cint_t c)
{
return isdigit (c);
}
ase_bool_t ase_isxdigit (ase_ccls_t* ccls, ase_cint_t c)
{
return isxdigit (c);
}
ase_bool_t ase_isalnum (ase_ccls_t* ccls, ase_cint_t c)
{
return isalnum (c);
}
ase_bool_t ase_isspace (ase_ccls_t* ccls, ase_cint_t c)
{
return isspace (c);
}
ase_bool_t ase_isprint (ase_ccls_t* ccls, ase_cint_t c)
{
return isprint (c);
}
ase_bool_t ase_isgraph (ase_ccls_t* ccls, ase_cint_t c)
{
return isgraph (c);
}
ase_bool_t ase_iscntrl (ase_ccls_t* ccls, ase_cint_t c)
{
return iscntrl (c);
}
ase_bool_t ase_ispunct (ase_ccls_t* ccls, ase_cint_t c)
{
return ispunct (c);
}
ase_cint_t ase_toupper (ase_ccls_t* ccls, ase_cint_t c)
{
return toupper (c);
}
ase_cint_t ase_tolower (ase_ccls_t* ccls, ase_cint_t c)
{
return tolower (c);
}
#elif defined(ASE_CHAR_IS_WCHAR)
#include <wctype.h>
ase_bool_t ase_isupper (ase_ccls_t* ccls, ase_cint_t c)
{
return iswupper (c);
}
ase_bool_t ase_islower (ase_ccls_t* ccls, ase_cint_t c)
{
return iswlower (c);
}
ase_bool_t ase_isalpha (ase_ccls_t* ccls, ase_cint_t c)
{
return iswalpha (c);
}
ase_bool_t ase_isdigit (ase_ccls_t* ccls, ase_cint_t c)
{
return iswdigit (c);
}
ase_bool_t ase_isxdigit (ase_ccls_t* ccls, ase_cint_t c)
{
return iswxdigit (c);
}
ase_bool_t ase_isalnum (ase_ccls_t* ccls, ase_cint_t c)
{
return iswalnum (c);
}
ase_bool_t ase_isspace (ase_ccls_t* ccls, ase_cint_t c)
{
return iswspace (c);
}
ase_bool_t ase_isprint (ase_ccls_t* ccls, ase_cint_t c)
{
return iswprint (c);
}
ase_bool_t ase_isgraph (ase_ccls_t* ccls, ase_cint_t c)
{
return iswgraph (c);
}
ase_bool_t ase_iscntrl (ase_ccls_t* ccls, ase_cint_t c)
{
return iswcntrl (c);
}
ase_bool_t ase_ispunct (ase_ccls_t* ccls, ase_cint_t c)
{
return iswpunct (c);
}
ase_cint_t ase_toupper (ase_ccls_t* ccls, ase_cint_t c)
{
return towupper (c);
}
ase_cint_t ase_tolower (ase_ccls_t* ccls, ase_cint_t c)
{
return towlower (c);
}
#else
#error unsupported character type
#endif
#if defined(ASE_CHAR_IS_MCHAR) && defined(toupper)
int ase_toupper (int c) { return toupper (c); }
int ase_tolower (int c) { return tolower (c); }
#endif

View File

@ -8,69 +8,24 @@
#include <ase/types.h>
#include <ase/macros.h>
#if defined(ASE_CHAR_IS_MCHAR)
#include <ctype.h>
#if !defined(isupper)
#define ase_isupper isupper
#define ase_islower islower
#define ase_isalpha isalpha
#define ase_isdigit isdigit
#define ase_isxdigit isxdigit
#define ase_isalnum isalnum
#define ase_isspace isspace
#define ase_isprint isprint
#define ase_isgraph isgraph
#define ase_iscntrl iscntrl
#define ase_ispunct ispunct
#endif
#if !defined(toupper)
#define ase_toupper toupper
#define ase_tolower tolower
#endif
#else
#include <wctype.h>
#define ase_isupper iswupper
#define ase_islower iswlower
#define ase_isalpha iswalpha
#define ase_isdigit iswdigit
#define ase_isxdigit iswxdigit
#define ase_isalnum iswalnum
#define ase_isspace iswspace
#define ase_isprint iswprint
#define ase_isgraph iswgraph
#define ase_iscntrl iswcntrl
#define ase_ispunct iswpunct
#define ase_toupper towupper
#define ase_tolower towlower
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined(ASE_CHAR_IS_MCHAR) && defined(isupper)
int ase_isupper (int c);
int ase_islower (int c);
int ase_isalpha (int c);
int ase_isdigit (int c);
int ase_isxdigit (int c);
int ase_isalnum (int c);
int ase_isspace (int c);
int ase_isprint (int c);
int ase_isgraph (int c);
int ase_iscntrl (int c);
int ase_ispunct (int c);
#endif
ase_bool_t ase_isupper (ase_ccls_t* ccls, ase_cint_t c);
ase_bool_t ase_islower (ase_ccls_t* ccls, ase_cint_t c);
ase_bool_t ase_isalpha (ase_ccls_t* ccls, ase_cint_t c);
ase_bool_t ase_isdigit (ase_ccls_t* ccls, ase_cint_t c);
ase_bool_t ase_isxdigit (ase_ccls_t* ccls, ase_cint_t c);
ase_bool_t ase_isalnum (ase_ccls_t* ccls, ase_cint_t c);
ase_bool_t ase_isspace (ase_ccls_t* ccls, ase_cint_t c);
ase_bool_t ase_isprint (ase_ccls_t* ccls, ase_cint_t c);
ase_bool_t ase_isgraph (ase_ccls_t* ccls, ase_cint_t c);
ase_bool_t ase_iscntrl (ase_ccls_t* ccls, ase_cint_t c);
ase_bool_t ase_ispunct (ase_ccls_t* ccls, ase_cint_t c);
#if defined(ASE_CHAR_IS_MCHAR) && defined(toupper)
int ase_toupper (int c);
int ase_tolower (int c);
#endif
ase_cint_t ase_toupper (ase_ccls_t* ccls, ase_cint_t c);
ase_cint_t ase_tolower (ase_ccls_t* ccls, ase_cint_t c);
#ifdef __cplusplus
}