*** empty log message ***

This commit is contained in:
hyung-hwan 2007-04-22 13:55:18 +00:00
parent 62a00b8e00
commit 802fba7853
6 changed files with 135 additions and 16 deletions

35
ase/awk/Awk.cpp Normal file
View File

@ -0,0 +1,35 @@
/*
* $Id: Awk.cpp,v 1.1 2007-04-22 13:51:44 bacon Exp $
*/
#include <ase/awk/Awk.hpp>
namespace ASE
{
Awk::Awk (): awk (ASE_NULL)
{
}
Awk::~Awk ()
{
if (awk != ASE_NULL)
{
ase_awk_close (awk);
awk = ASE_NULL;
}
}
int Awk::parse ()
{
return ase_awk_parse (awk, ASE_NULL);
}
int Awk::run (/*const ase_char_t* main*/)
{
//return ase_awk_parse (awk, main);
return 0;
}
}

28
ase/awk/Awk.hpp Normal file
View File

@ -0,0 +1,28 @@
/*
* $Id: Awk.hpp,v 1.1 2007-04-22 13:51:44 bacon Exp $
*/
#ifndef _ASE_AWK_AWK_HPP_
#define _ASE_AWK_AWK_HPP_
#include <ase/awk/awk.h>
namespace ASE
{
class Awk
{
public:
Awk ();
~Awk ();
int parse ();
int run ();
private:
ase_awk_t* awk;
};
}
#endif

View File

@ -1,5 +1,5 @@
# #
# $Id: makefile.in,v 1.41 2007-04-10 11:58:08 bacon Exp $ # $Id: makefile.in,v 1.42 2007-04-22 13:51:44 bacon Exp $
# #
NAME = aseawk NAME = aseawk
@ -8,9 +8,11 @@ TOP_BUILDDIR = @abs_top_builddir@
TOP_INSTALLDIR = @prefix@/ase TOP_INSTALLDIR = @prefix@/ase
CC = @CC@ CC = @CC@
CXX = @CXX@
AR = ar AR = ar
RANLIB = @RANLIB@ RANLIB = @RANLIB@
CFLAGS = @CFLAGS@ -I@abs_top_builddir@/.. CFLAGS = @CFLAGS@ -I@abs_top_builddir@/..
CXXFLAGS = @CXXFLAGS@ -I@abs_top_builddir@/..
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@ LIBS = @LIBS@
MODE = @BUILDMODE@ MODE = @BUILDMODE@
@ -26,9 +28,11 @@ LIBTOOL_LINK = ../libtool --mode=link
OUT_DIR = ../$(MODE)/lib OUT_DIR = ../$(MODE)/lib
OUT_FILE_LIB = $(OUT_DIR)/lib$(NAME).a OUT_FILE_LIB = $(OUT_DIR)/lib$(NAME).a
OUT_FILE_JNI = $(OUT_DIR)/lib$(NAME)_jni.la OUT_FILE_JNI = $(OUT_DIR)/lib$(NAME)_jni.la
OUT_FILE_LIB_CXX = $(OUT_DIR)/lib$(NAME)++.a
OUT_FILE_JAR = $(OUT_DIR)/$(NAME).jar OUT_FILE_JAR = $(OUT_DIR)/$(NAME).jar
TMP_DIR = $(MODE) TMP_DIR = $(MODE)
TMP_DIR_CXX = $(TMP_DIR)/cxx
OBJ_FILES_LIB = \ OBJ_FILES_LIB = \
$(TMP_DIR)/awk.o \ $(TMP_DIR)/awk.o \
@ -47,6 +51,10 @@ OBJ_FILES_LIB = \
OBJ_FILES_JNI = $(TMP_DIR)/jni.o OBJ_FILES_JNI = $(TMP_DIR)/jni.o
OBJ_FILES_LIB_CXX = \
$(OBJ_FILES_LIB) \
$(TMP_DIR)/cxx/Awk.o
OBJ_FILES_SO = $(OBJ_FILES_LIB:.o=.lo) $(OBJ_FILES_JNI:.o=.lo) OBJ_FILES_SO = $(OBJ_FILES_LIB:.o=.lo) $(OBJ_FILES_JNI:.o=.lo)
OBJ_FILES_JAR = \ OBJ_FILES_JAR = \
@ -57,11 +65,11 @@ OBJ_FILES_JAR = \
lib: build$(JNI) lib: build$(JNI)
build: $(OUT_FILE_LIB) build: $(OUT_FILE_LIB) $(OUT_FILE_LIB_CXX)
buildjni: build $(OUT_FILE_JNI) buildjni: build $(OUT_FILE_JNI)
$(OUT_FILE_LIB): $(TMP_DIR) $(OBJ_FILES_LIB) $(OUT_DIR) $(OUT_FILE_LIB): $(TMP_DIR) $(OUT_DIR) $(OBJ_FILES_LIB)
$(AR) cr $(OUT_FILE_LIB) $(OBJ_FILES_LIB) $(AR) cr $(OUT_FILE_LIB) $(OBJ_FILES_LIB)
if [ "$(RANLIB)" = "ranlib" ]; then ranlib $(OUT_FILE_LIB); fi if [ "$(RANLIB)" = "ranlib" ]; then ranlib $(OUT_FILE_LIB); fi
@ -69,6 +77,10 @@ $(OUT_FILE_JNI): $(TMP_DIR) $(OBJ_FILES_JNI) $(OBJ_FILES_JAR) $(OUT_FILE_LIB)
$(LIBTOOL_LINK) $(CC) -rpath $(TOP_INSTALLDIR)/lib -version-info 1:0:0 -o $(OUT_FILE_JNI) $(OBJ_FILES_SO) -lm -L$(OUT_DIR) -l$(NAME) -lasecmn -laseutl $(LIBTOOL_LINK) $(CC) -rpath $(TOP_INSTALLDIR)/lib -version-info 1:0:0 -o $(OUT_FILE_JNI) $(OBJ_FILES_SO) -lm -L$(OUT_DIR) -l$(NAME) -lasecmn -laseutl
$(JAR) -Mcvf $(OUT_FILE_JAR) -C $(TMP_DIR) ase $(JAR) -Mcvf $(OUT_FILE_JAR) -C $(TMP_DIR) ase
$(OUT_FILE_LIB_CXX): $(TMP_DIR_CXX) $(OUT_DIR) $(OBJ_FILES_LIB_CXX)
$(AR) cr $(OUT_FILE_LIB_CXX) $(OBJ_FILES_LIB_CXX)
if [ "$(RANLIB)" = "ranlib" ]; then ranlib $(OUT_FILE_LIB_CXX); fi
$(TMP_DIR)/awk.o: awk.c $(TMP_DIR)/awk.o: awk.c
$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) -o $@ -c awk.c $(LIBTOOL_COMPILE) $(CC) $(CFLAGS) -o $@ -c awk.c
@ -123,12 +135,18 @@ $(TMP_DIR)/ase/awk/Extio.class:
$(TMP_DIR)/ase/awk/Exception.class: $(TMP_DIR)/ase/awk/Exception.class:
$(JAVAC) -classpath ../.. -d $(TMP_DIR) Exception.java $(JAVAC) -classpath ../.. -d $(TMP_DIR) Exception.java
$(TMP_DIR)/cxx/Awk.o:
$(CXX) $(CXXFLAGS) -o $@ -c Awk.cpp
$(OUT_DIR): $(OUT_DIR):
mkdir -p $(OUT_DIR) mkdir -p $(OUT_DIR)
$(TMP_DIR): $(TMP_DIR):
mkdir -p $(TMP_DIR) mkdir -p $(TMP_DIR)
clean: $(TMP_DIR_CXX): $(TMP_DIR)
rm -rf $(OUT_FILE_LIB) $(OUT_FILE_JNI) $(OUT_FILE_JAR) $(OBJ_FILES_LIB) $(OBJ_FILES_JNI) $(OBJ_FILES_JAR) mkdir -p $(TMP_DIR)/cxx
clean:
rm -rf $(OUT_FILE_LIB) $(OUT_FILE_JNI) $(OUT_FILE_JAR) $(OUT_FILE_LIB_CXX) $(OBJ_FILES_LIB) $(OBJ_FILES_JNI) $(OBJ_FILES_JAR) $(OBJ_FILES_LIB_CXX)

15
ase/configure vendored
View File

@ -18452,6 +18452,18 @@ else
fi fi
fi fi
if test "$ac_test_CXXFLAGS" = "set"
then
CXXFLAGS=$ac_save_CXXFLAGS
else
if test "$GCC" = "yes"
then
CXXFLAGS="-O2"
else
CXXFLAGS=
fi
fi
# Checks for header files. # Checks for header files.
echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo "$as_me:$LINENO: checking for ANSI C header files" >&5
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
@ -25710,10 +25722,12 @@ fi;
if test "$enable_debug_is" = "yes" if test "$enable_debug_is" = "yes"
then then
CFLAGS="$CFLAGS -g -D_DEBUG -UNDEBUG" CFLAGS="$CFLAGS -g -D_DEBUG -UNDEBUG"
CXXFLAGS="$CXXFLAGS -g -D_DEBUG -UNDEBUG"
BUILDMODE="debug" BUILDMODE="debug"
else else
CFLAGS="$CFLAGS -DNDEBUG -U_DEBUG" CFLAGS="$CFLAGS -DNDEBUG -U_DEBUG"
CXXFLAGS="$CXXFLAGS -DNDEBUG -U_DEBUG"
BUILDMODE="release" BUILDMODE="release"
fi fi
@ -25729,6 +25743,7 @@ fi;
if test "$enable_reentrant_is" = "yes" if test "$enable_reentrant_is" = "yes"
then then
CFLAGS="$CFLAGS -D_REENTRANT -D_THREAD_SAFE" CFLAGS="$CFLAGS -D_REENTRANT -D_THREAD_SAFE"
CXXFLAGS="$CXXFLAGS -D_REENTRANT -D_THREAD_SAFE"
fi fi
# Java & JNI Configuration # Java & JNI Configuration

View File

@ -1,10 +1,10 @@
# #
# $Id: configure.ac,v 1.87 2007-04-06 14:31:31 bacon Exp $ # $Id: configure.ac,v 1.88 2007-04-22 13:51:44 bacon Exp $
# #
AC_PREREQ(2.53) AC_PREREQ(2.53)
AC_INIT([ase], [deb-0.1.0]) AC_INIT([ase], [deb-0.1.0])
AC_REVISION([$Revision: 1.87 $]) AC_REVISION([$Revision: 1.88 $])
AC_CONFIG_HEADER([cmn/conf_unx.h]) AC_CONFIG_HEADER([cmn/conf_unx.h])
AC_CONFIG_AUX_DIR(config) AC_CONFIG_AUX_DIR(config)
@ -28,6 +28,18 @@ else
fi fi
fi fi
if test "$ac_test_CXXFLAGS" = "set"
then
CXXFLAGS=$ac_save_CXXFLAGS
else
if test "$GCC" = "yes"
then
CXXFLAGS="-O2"
else
CXXFLAGS=
fi
fi
# Checks for header files. # Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
@ -93,9 +105,11 @@ AC_ARG_ENABLE([mode], [AC_HELP_STRING([--enable-debug],
if test "$enable_debug_is" = "yes" if test "$enable_debug_is" = "yes"
then then
[CFLAGS="$CFLAGS -g -D_DEBUG -UNDEBUG"] [CFLAGS="$CFLAGS -g -D_DEBUG -UNDEBUG"]
[CXXFLAGS="$CXXFLAGS -g -D_DEBUG -UNDEBUG"]
AC_SUBST(BUILDMODE, "debug") AC_SUBST(BUILDMODE, "debug")
else else
[CFLAGS="$CFLAGS -DNDEBUG -U_DEBUG"] [CFLAGS="$CFLAGS -DNDEBUG -U_DEBUG"]
[CXXFLAGS="$CXXFLAGS -DNDEBUG -U_DEBUG"]
AC_SUBST(BUILDMODE, "release") AC_SUBST(BUILDMODE, "release")
fi fi
@ -106,6 +120,7 @@ AC_ARG_ENABLE([reentrant], [AC_HELP_STRING([--enable-reentrant],
if test "$enable_reentrant_is" = "yes" if test "$enable_reentrant_is" = "yes"
then then
[CFLAGS="$CFLAGS -D_REENTRANT -D_THREAD_SAFE"] [CFLAGS="$CFLAGS -D_REENTRANT -D_THREAD_SAFE"]
[CXXFLAGS="$CXXFLAGS -D_REENTRANT -D_THREAD_SAFE"]
fi fi
# Java & JNI Configuration # Java & JNI Configuration

View File

@ -1,5 +1,5 @@
/* /*
* $Id: symbol.c,v 1.22 2007-03-22 11:19:28 bacon Exp $ * $Id: symbol.c,v 1.23 2007-04-22 13:55:18 bacon Exp $
*/ */
#include <ase/stx/symbol.h> #include <ase/stx/symbol.h>
@ -15,19 +15,23 @@ static void __grow_symtab (ase_stx_t* stx)
ncapa = capa << 1; ncapa = capa << 1;
nspace = (ase_word_t*)ase_malloc(ase_sizeof(ase_word_t) * ncapa); nspace = (ase_word_t*)ase_malloc(ase_sizeof(ase_word_t) * ncapa);
if (nspace == ASE_NULL) { if (nspace == ASE_NULL)
{
/* TODO: handle memory error */ /* TODO: handle memory error */
} }
for (i = 0; i < capa; i++) { for (i = 0; i < capa; i++)
{
ase_word_t x = stx->symtab.datum[i]; ase_word_t x = stx->symtab.datum[i];
if (x == stx->nil) continue; if (x == stx->nil) continue;
j = ase_stx_strxhash ( j = ase_stx_strxhash (
ASE_STX_DATA(stx,x), ASE_STX_SIZE(stx,x)) % ncapa; ASE_STX_DATA(stx,x), ASE_STX_SIZE(stx,x)) % ncapa;
while (1) { while (1)
if (nspace[j] == stx->nil) { {
if (nspace[j] == stx->nil)
{
nspace[j] = x; nspace[j] = x;
break; break;
} }
@ -53,7 +57,8 @@ ase_word_t ase_stx_new_symbolx (
capa = stx->symtab.capacity; capa = stx->symtab.capacity;
size = stx->symtab.size; size = stx->symtab.size;
if (capa <= size + 1) { if (capa <= size + 1)
{
__grow_symtab (stx); __grow_symtab (stx);
capa = stx->symtab.capacity; capa = stx->symtab.capacity;
} }
@ -61,9 +66,11 @@ ase_word_t ase_stx_new_symbolx (
hash = ase_stx_strxhash(name,len); hash = ase_stx_strxhash(name,len);
index = hash % stx->symtab.capacity; index = hash % stx->symtab.capacity;
while (1) { while (1)
{
x = stx->symtab.datum[index]; x = stx->symtab.datum[index];
if (x == stx->nil) { if (x == stx->nil)
{
/* insert a new item into an empty slot */ /* insert a new item into an empty slot */
x = ase_stx_alloc_char_objectx (stx, name, len); x = ase_stx_alloc_char_objectx (stx, name, len);
ASE_STX_CLASS(stx,x) = stx->class_symbol; ASE_STX_CLASS(stx,x) = stx->class_symbol;
@ -86,7 +93,8 @@ void ase_stx_traverse_symbol_table (
{ {
ase_word_t index, x; ase_word_t index, x;
for (index = 0; index < stx->symtab.capacity; index++) { for (index = 0; index < stx->symtab.capacity; index++)
{
x = stx->symtab.datum[index]; x = stx->symtab.datum[index];
if (x != stx->nil) func (stx, x, data); if (x != stx->nil) func (stx, x, data);
} }