deleted stx directories

This commit is contained in:
hyung-hwan 2013-08-24 14:04:12 +00:00
parent d841c9f62f
commit 035a4329bd
51 changed files with 0 additions and 10804 deletions

View File

@ -1,15 +0,0 @@
AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include
bin_PROGRAMS = qsestx
qsestx_SOURCES = stx.c
qsestx_LDFLAGS = -L../../lib/stx -L../../lib/cmn
qsestx_LDADD = -lqsestx -lqsecmn $(LIBM)
if WIN32
qsestx_LDADD += $(UNICOWS_LIBS)
endif

View File

@ -1,585 +0,0 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = qsestx$(EXEEXT)
@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
subdir = cmd/stx
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_qsestx_OBJECTS = stx.$(OBJEXT)
qsestx_OBJECTS = $(am_qsestx_OBJECTS)
am__DEPENDENCIES_1 =
@WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
qsestx_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
qsestx_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(qsestx_LDFLAGS) \
$(LDFLAGS) -o $@
DEFAULT_INCLUDES =
depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(qsestx_SOURCES)
DIST_SOURCES = $(qsestx_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ARGZ_H = @ARGZ_H@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_MODE = @BUILD_MODE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHAR_MODE = @CHAR_MODE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_CXX = @HAVE_CXX@
INCLTDL = @INCLTDL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBADD_DL = @LIBADD_DL@
LIBADD_DLD_LINK = @LIBADD_DLD_LINK@
LIBADD_DLOPEN = @LIBADD_DLOPEN@
LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@
LIBLTDL = @LIBLTDL@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
LN_S = @LN_S@
LTDLDEPS = @LTDLDEPS@
LTDLINCL = @LTDLINCL@
LTDLOPEN = @LTDLOPEN@
LTLIBOBJS = @LTLIBOBJS@
LT_CONFIG_H = @LT_CONFIG_H@
LT_DLLOADERS = @LT_DLLOADERS@
LT_DLPREOPEN = @LT_DLPREOPEN@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPICC = @MPICC@
MPI_CFLAGS = @MPI_CFLAGS@
MPI_CLDFLAGS = @MPI_CLDFLAGS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
PACKAGE_VERSION_PATCH = @PACKAGE_VERSION_PATCH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
QSE_PROJECT_AUTHOR = @QSE_PROJECT_AUTHOR@
QSE_PROJECT_URL = @QSE_PROJECT_URL@
QSE_SIZEOF_CHAR = @QSE_SIZEOF_CHAR@
QSE_SIZEOF_DOUBLE = @QSE_SIZEOF_DOUBLE@
QSE_SIZEOF_FLOAT = @QSE_SIZEOF_FLOAT@
QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@
SED = @SED@
SENDFILE_LIBS = @SENDFILE_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOCKET_LIBS = @SOCKET_LIBS@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
TRUE = @TRUE@
UNICOWS_LIBS = @UNICOWS_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
ltdl_LIBOBJS = @ltdl_LIBOBJS@
ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(includedir)
qsestx_SOURCES = stx.c
qsestx_LDFLAGS = -L../../lib/stx -L../../lib/cmn -L$(libdir)
qsestx_LDADD = -lqsestx -lqsecmn $(LIBM) $(am__append_1)
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign cmd/stx/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign cmd/stx/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p || test -f $$p1; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
} \
; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
qsestx$(EXEEXT): $(qsestx_OBJECTS) $(qsestx_DEPENDENCIES) $(EXTRA_qsestx_DEPENDENCIES)
@rm -f qsestx$(EXEEXT)
$(qsestx_LINK) $(qsestx_OBJECTS) $(qsestx_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stx.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-binPROGRAMS
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-binPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,13 +0,0 @@
| x |
"print the reverse hierarchy of a class"
x := Class.
[x isNil] whileFalse: [
Transcript show: x printString; cr.
x := x superclass].
| x |
"print the reverse hierarchy of a metaclass"
x := Class class.
[x isNil] whileFalse: [
Transcript show: x printString; cr.
x := x superclass].

View File

@ -1,230 +0,0 @@
#include <xp/stx/stx.h>
#ifdef _DOS
#include <stdio.h>
#define xp_printf printf
#else
#include <xp/bas/stdio.h>
#include <xp/bas/locale.h>
#endif
#include <xp/stx/parser.h>
#include <xp/stx/bootstrp.h>
#include <xp/stx/class.h>
#include <xp/stx/bytecode.h>
#include <xp/stx/interp.h>
#ifdef __linux
#include <mcheck.h>
#endif
struct ss_t
{
const xp_char_t* text;
xp_size_t index;
};
typedef struct ss_t ss_t;
int ss_func (int cmd, void* owner, void* arg)
{
if (cmd == XP_STX_PARSER_INPUT_OPEN) {
ss_t* ss = *(ss_t**)owner;
ss->text = (const xp_char_t*)arg;
ss->index = 0;
return 0;
}
else if (cmd == XP_STX_PARSER_INPUT_CLOSE) {
/*ss_t* ss = (ss_t*)owner; */
return 0;
}
else if (cmd == XP_STX_PARSER_INPUT_CONSUME) {
ss_t* ss = (ss_t*)owner;
xp_cint_t* c = (xp_cint_t*)arg;
if (ss->text[ss->index] == XP_CHAR('\0')) {
*c = XP_CHAR_EOF;
}
else *c = ss->text[ss->index++];
return 0;
}
else if (cmd == XP_STX_PARSER_INPUT_REWIND) {
return 0;
}
return -1;
}
struct stdio_t
{
XP_FILE* stdio;
};
typedef struct stdio_t stdio_t;
int stdio_func (int cmd, void* owner, void* arg)
{
if (cmd == XP_STX_PARSER_INPUT_OPEN) {
stdio_t* p = *(stdio_t**)owner;
p->stdio = xp_fopen ((const xp_char_t*)arg, XP_TEXT("r"));
if (p->stdio == XP_NULL) return -1;
return 0;
}
else if (cmd == XP_STX_PARSER_INPUT_CLOSE) {
stdio_t* p = (stdio_t*)owner;
xp_fclose (p->stdio);
return 0;
}
else if (cmd == XP_STX_PARSER_INPUT_CONSUME) {
stdio_t* p = (stdio_t*)owner;
xp_cint_t* c = (xp_cint_t*)arg;
xp_cint_t t = xp_fgetc (p->stdio);
if (t == XP_CHAR_EOF) {
if (xp_ferror (p->stdio)) return -1;
*c = XP_CHAR_EOF;
}
else *c = t;
return 0;
}
else if (cmd == XP_STX_PARSER_INPUT_REWIND) {
return 0;
}
return -1;
}
int xp_main (int argc, xp_char_t* argv[])
{
xp_stx_t stx;
xp_stx_parser_t parser;
#ifdef __linux
mtrace ();
#endif
/*
#ifndef _DOS
if (xp_setlocale () == -1) {
printf ("cannot set locale\n");
return -1;
}
#endif
*/
if (argc != 2) {
xp_printf (XP_TEXT("usage: %s class_name\n"), argv[0]);
return -1;
}
if (xp_stx_open (&stx, 10000) == XP_NULL) {
xp_printf (XP_TEXT("cannot open stx\n"));
return -1;
}
if (xp_stx_bootstrap(&stx) == -1) {
xp_stx_close (&stx);
xp_printf (XP_TEXT("cannot bootstrap\n"));
return -1;
}
if (xp_stx_parser_open(&parser, &stx) == XP_NULL) {
xp_printf (XP_TEXT("cannot open parser\n"));
return -1;
}
{
/*
ss_t ss;
parser.input_owner = (void*)&ss;
parser.input_func = ss_func;
xp_stx_parser_parse_method (&parser, 0,
XP_TEXT("isNil\n^true"));
*/
stdio_t stdio;
xp_word_t n = xp_stx_lookup_class (&stx, argv[1]);
xp_word_t m;
parser.input_owner = (void*)&stdio;
parser.input_func = stdio_func;
if (n == stx.nil) {
xp_printf (XP_TEXT("Cannot find class - %s\n"), argv[1]);
goto exit_program;
}
/* compile the method to n's class */
if (xp_stx_parser_parse_method (&parser, XP_STX_CLASS(&stx,n),
(void*)XP_TEXT("test.st")) == -1) {
xp_printf (XP_TEXT("parser error <%s>\n"),
xp_stx_parser_error_string (&parser));
}
if (xp_stx_parser_parse_method (&parser, stx.class_symbol,
(void*)XP_TEXT("test1.st")) == -1) {
xp_printf (XP_TEXT("parser error <%s>\n"),
xp_stx_parser_error_string (&parser));
}
if (xp_stx_parser_parse_method (&parser, stx.class_symbol,
(void*)XP_TEXT("test2.st")) == -1) {
xp_printf (XP_TEXT("parser error <%s>\n"),
xp_stx_parser_error_string (&parser));
}
if (xp_stx_parser_parse_method (&parser, stx.class_string,
(void*)XP_TEXT("test3.st")) == -1) {
xp_printf (XP_TEXT("parser error <%s>\n"),
xp_stx_parser_error_string (&parser));
}
xp_printf (XP_TEXT("\n== Decoded Methods ==\n"));
if (xp_stx_decode(&stx, XP_STX_CLASS(&stx,n)) == -1) {
xp_printf (XP_TEXT("parser error <%s>\n"),
xp_stx_parser_error_string (&parser));
}
xp_printf (XP_TEXT("\n== Decoded Methods for Symbol ==\n"));
if (xp_stx_decode(&stx, stx.class_symbol) == -1) {
xp_printf (XP_TEXT("parser error <%s>\n"),
xp_stx_parser_error_string (&parser));
}
xp_printf (XP_TEXT("\n== Decoded Methods for String ==\n"));
if (xp_stx_decode(&stx, stx.class_string) == -1) {
xp_printf (XP_TEXT("parser error <%s>\n"),
xp_stx_parser_error_string (&parser));
}
xp_printf (XP_TEXT("== Running the main method ==\n"));
m = xp_stx_lookup_method (
&stx, XP_STX_CLASS(&stx,n), XP_TEXT("main"), xp_false);
if (m == stx.nil) {
xp_printf (XP_TEXT("cannot lookup method main\n"));
}
else {
xp_stx_interp (&stx, n, m);
}
}
exit_program:
xp_stx_parser_close (&parser);
xp_stx_close (&stx);
xp_printf (XP_TEXT("== End of program ==\n"));
#ifdef __linux
muntrace ();
#endif
/*
#ifdef __linux
{
char buf[1000];
snprintf (buf, sizeof(buf), "ls -l /proc/%u/fd", getpid());
system (buf);
}
#endif
*/
return 0;
}

View File

@ -1,293 +0,0 @@
/*#include <qse/stx/stx.h>*/
#include "../../lib/stx/stx.h"
#include <qse/cmn/mem.h>
#include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
void print_class_name (qse_stx_t* stx, qse_word_t class, int tabs);
void print_metaclass_name (qse_stx_t* stx, qse_word_t class, int tabs);
void print_system_symbol_table (qse_stx_t* stx)
{
qse_word_t ref = stx->ref.symtab;
qse_word_t capa, i;
capa = QSE_STX_OBJSIZE(stx,ref) - 1;
qse_printf (QSE_T("TALLY = %d\n"), QSE_STX_REFTOINT(stx,QSE_STX_WORDAT(stx,ref,QSE_STX_SYSTEMSYMBOLTABLE_TALLY)));
for (i = 1; i <= capa; i++)
{
qse_word_t symref = QSE_STX_WORDAT(stx,ref,i);
if (symref != stx->ref.nil)
{
qse_printf (QSE_T("%lu [%s]\n"), (unsigned long)symref, QSE_STX_CHARPTR(stx,symref));
}
}
}
void print_system_dictionary (qse_stx_t* stx)
{
qse_word_t ref = stx->ref.sysdic;
qse_word_t capa, i;
capa = QSE_STX_OBJSIZE(stx,ref) - 1;
qse_printf (QSE_T("TALLY = %d\n"), QSE_STX_REFTOINT(stx,QSE_STX_WORDAT(stx,ref,QSE_STX_SYSTEMSYMBOLTABLE_TALLY)));
for (i = 1; i <= capa; i++)
{
qse_word_t assref = QSE_STX_WORDAT(stx,ref,i);
if (assref != stx->ref.nil)
{
qse_word_t keyref = QSE_STX_WORDAT(stx,assref,QSE_STX_ASSOCIATION_KEY);
qse_word_t valref = QSE_STX_WORDAT(stx,assref,QSE_STX_ASSOCIATION_VALUE);
qse_char_t value[128] = QSE_T("");
qse_word_t vcref = QSE_STX_OBJCLASS(stx,valref);
if (QSE_STX_OBJCLASS(stx,vcref) == stx->ref.class_metaclass)
{
qse_word_t nameref = QSE_STX_WORDAT(stx,valref,QSE_STX_CLASS_NAME);
qse_sprintf (value, QSE_COUNTOF(value),
QSE_T("<<%s>>"), QSE_STX_CHARPTR(stx,nameref));
}
else
{
qse_word_t nameref = QSE_STX_WORDAT(stx,vcref,QSE_STX_CLASS_NAME);
qse_sprintf (value, QSE_COUNTOF(value),
QSE_T("instance of <<%s>>"), QSE_STX_CHARPTR(stx,nameref));
}
/* i dind't use other object types for a key... so keys must be symbols */
QSE_ASSERT (QSE_STX_OBJCLASS(stx,keyref) == stx->ref.class_symbol);
qse_printf (QSE_T("%lu [%s] => %s\n"),
(unsigned long)keyref, QSE_STX_CHARPTR(stx,keyref), value
);
}
}
}
void print_superclasses (qse_stx_t* stx, const qse_char_t* name)
{
qse_word_t n;
qse_stx_class_t* obj;
n = qse_stx_findclass (stx, name);
qse_printf (QSE_T("Class hierarchy for the class '%s'\n"), name);
while (n != stx->ref.nil)
{
obj = (qse_stx_class_t*)PTRBYREF(stx,n);
qse_printf (QSE_T("%lu, %s\n"), (unsigned long)obj->name, CHARPTR(stx, obj->name));
n = obj->superclass;
}
}
void print_metaclass_superclasses (qse_stx_t* stx, const qse_char_t* name)
{
qse_word_t n, x;
qse_stx_metaclass_t* obj;
qse_stx_class_t* xobj;
n = qse_stx_findclass (stx, name);
n = QSE_STX_OBJCLASS(stx,n);
qse_printf (QSE_T("Class hierarchy for the metaclass '%s class'\n"), name);
while (n != stx->ref.nil)
{
/*if (n == stx->class_class) break; */
if (QSE_STX_OBJCLASS(stx,n) != stx->ref.class_metaclass)
{
/* probably reached the superclass of
* 'Object class' which is 'Class' * */
break;
}
obj = (qse_stx_metaclass_t*)QSE_STX_PTRBYREF(stx,n);
x = obj->instance_class;
xobj = (qse_stx_class_t*)QSE_STX_PTRBYREF(stx,x);
qse_printf (QSE_T("%lu, %s class\n"),
(unsigned long)xobj->name,
CHARPTR(stx, xobj->name));
n = obj->superclass;
}
while (n != stx->ref.nil)
{
xobj = (qse_stx_class_t*)QSE_STX_PTRBYREF(stx,n);
qse_printf (QSE_T("%lu, %s\n"),
(unsigned long)xobj->name,
CHARPTR(stx, xobj->name));
n = xobj->superclass;
}
}
void print_class_name (qse_stx_t* stx, qse_word_t class, int tabs)
{
qse_stx_class_t* xobj;
xobj = (qse_stx_class_t*)QSE_STX_PTRBYREF(stx,class);
while (tabs-- > 0) qse_printf (QSE_T(" "));
qse_printf (QSE_T("%s [%lu]\n"),
CHARPTR(stx, xobj->name),
(unsigned long)class);
}
void print_metaclass_name (qse_stx_t* stx, qse_word_t class, int tabs)
{
qse_stx_metaclass_t* obj;
qse_stx_class_t* xobj;
obj = (qse_stx_metaclass_t*)QSE_STX_PTRBYREF(stx,class);
xobj = (qse_stx_class_t*)QSE_STX_PTRBYREF(stx,obj->instance_class);
while (tabs-- > 0) qse_printf (QSE_T(" "));
qse_printf (QSE_T("%s class [%lu]\n"),
CHARPTR(stx, xobj->name),
(unsigned long)class);
}
void print_subclass_names (qse_stx_t* stx, qse_word_t class, int tabs)
{
qse_stx_class_t* obj;
if (QSE_STX_OBJCLASS(stx,class) == stx->ref.class_metaclass)
{
print_metaclass_name (stx, class, tabs);
}
else
{
print_class_name (stx, class, tabs);
}
obj = (qse_stx_class_t*)QSE_STX_PTRBYREF(stx,class);
if (obj->subclasses != stx->ref.nil)
{
qse_word_t count = QSE_STX_OBJSIZE(stx, obj->subclasses);
while (count-- > 0)
{
print_subclass_names (stx,
QSE_STX_WORDAT(stx,obj->subclasses,count), tabs + 1);
}
}
}
void print_subclasses (qse_stx_t* stx, const qse_char_t* name)
{
qse_word_t class;
class = qse_stx_findclass (stx, name);
qse_printf (QSE_T("== NORMAL == \n"));
print_subclass_names (stx, class, 0);
qse_printf (QSE_T("== META == \n"));
print_subclass_names (stx, QSE_STX_OBJCLASS(stx,class), 0);
}
static int stx_main (int argc, qse_char_t* argv[])
{
qse_stx_t* stx;
//qse_word_t i;
#if 0
if (argc != 2) { /* TODO: argument processing */
qse_printf (QSE_T("Usage: %s [-f imageFile] MainClass\n"), argv[0]);
return -1;
}
#endif
stx = qse_stx_open (QSE_MMGR_GETDFL(), 0, 10000);
if (stx == QSE_NULL)
{
qse_printf (QSE_T("cannot open stx\n"));
return -1;
}
if (qse_stx_boot(stx) <= -1)
{
qse_stx_close (stx);
qse_printf (QSE_T("cannot bootstrap\n"));
return -1;
}
qse_printf (QSE_T("stx.nil %lu %lu\n"), (unsigned long)stx->ref.nil, (unsigned long)QSE_STX_REFTOIDX(stx,stx->ref.nil));
qse_printf (QSE_T("stx.true %lu %lu\n"), (unsigned long)stx->ref.true, (unsigned long)QSE_STX_REFTOIDX(stx,stx->ref.true));
qse_printf (QSE_T("stx.false %lu %lu\n"), (unsigned long)stx->ref.false, (unsigned long)QSE_STX_REFTOIDX(stx,stx->ref.false));
qse_printf (QSE_T("-------------\n"));
qse_printf (QSE_T(">> SYSTEM_SYMBOL_TABLE\n"));
print_system_symbol_table (stx);
qse_printf (QSE_T("-------------\n"));
qse_printf (QSE_T(">> SYSTEM_DICTIONARY\n"));
print_system_dictionary (stx);
qse_printf (QSE_T("-------------\n"));
print_superclasses (stx, QSE_T("Array"));
qse_printf (QSE_T("-------------\n"));
print_metaclass_superclasses (stx, QSE_T("Array"));
qse_printf (QSE_T("-------------\n"));
print_superclasses (stx, QSE_T("False"));
qse_printf (QSE_T("-------------\n"));
print_metaclass_superclasses (stx, QSE_T("False"));
qse_printf (QSE_T("-------------\n"));
print_superclasses (stx, QSE_T("Metaclass"));
qse_printf (QSE_T("-------------\n"));
print_metaclass_superclasses (stx, QSE_T("Metaclass"));
qse_printf (QSE_T("-------------\n"));
print_superclasses (stx, QSE_T("Class"));
qse_printf (QSE_T("-------------\n"));
print_metaclass_superclasses (stx, QSE_T("Class"));
qse_printf (QSE_T("-------------\n"));
print_subclasses (stx, QSE_T("Object"));
qse_printf (QSE_T("-------------\n"));
#if 0
{
qse_word_t method_name;
qse_word_t main_class;
qse_word_t method, context;
method_name = qse_stx_new_symbol (stx,QSE_T("main"));
main_class = qse_stx_findclass (stx,argv[1]);
if (main_class == stx.nil) {
qse_printf (QSE_T("non-existent class: %s\n"), argv[1]);
return -1;
}
/*
method = qse_stx_alloc_byte_object (stx,100);
QSE_STX_CLASS(stx,method) = stx.class_method;
*/
method = qse_stx_instantiate (stx, QSE_T("Method"));
QSE_STX_BYTEAT(stx,method,0) = PUSH_OBJECT;
QSE_STX_BYTEAT(stx,method,1) = main_class;
QSE_STX_BYTEAT(stx,method,2) = SEND_UNARY_MESSAGE;
QSE_STX_BYTEAT(stx,method,3) = method_name;
QSE_STX_BYTEAT(stx,method,4) = HALT;
/*
context = qse_stx_new_context (stx, method, stx.nil, stx.nil);
*/
context = qse_stx_instantiate (stx, QSE_T("Context"));
qse_stx_runcontext (stx, context);
}
#endif
qse_stx_close (stx);
qse_printf (QSE_T("== End of program ==\n"));
return 0;
}
int qse_main (int argc, qse_achar_t* argv[])
{
return qse_runmain (argc, argv, stx_main);
}

View File

@ -1,13 +0,0 @@
main
| a |
<primitive: 0>
"a := 10.
#abc xxx.
#abc xxx: 1.
^nil "
a := #abc print: 123 and: 2345.
#abc print: a and: a.
1234567.
^nil.

View File

@ -1,10 +0,0 @@
print: a1 and: a2
| t1 t2 |
<primitive: 3>
t1 := #abcdefg.
"a1 := 2341 arguments are not assignable"
t2 := a2.
t1 prim2: t2.
super prim2: 999999.
self prim2: 999999.
^67891.

View File

@ -1,2 +0,0 @@
prim2: n
<primitive: 2>

View File

@ -1,2 +0,0 @@
prim2: n
<primitive: 20>

View File

@ -1,2 +0,0 @@
pkgincludedir= $(includedir)/qse/stx
pkginclude_HEADERS = stx.h

View File

@ -1,519 +0,0 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = include/qse/stx
DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(pkgincludedir)"
HEADERS = $(pkginclude_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
pkgincludedir = $(includedir)/qse/stx
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ARGZ_H = @ARGZ_H@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_MODE = @BUILD_MODE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHAR_MODE = @CHAR_MODE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_CXX = @HAVE_CXX@
INCLTDL = @INCLTDL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBADD_DL = @LIBADD_DL@
LIBADD_DLD_LINK = @LIBADD_DLD_LINK@
LIBADD_DLOPEN = @LIBADD_DLOPEN@
LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@
LIBLTDL = @LIBLTDL@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
LN_S = @LN_S@
LTDLDEPS = @LTDLDEPS@
LTDLINCL = @LTDLINCL@
LTDLOPEN = @LTDLOPEN@
LTLIBOBJS = @LTLIBOBJS@
LT_CONFIG_H = @LT_CONFIG_H@
LT_DLLOADERS = @LT_DLLOADERS@
LT_DLPREOPEN = @LT_DLPREOPEN@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPICC = @MPICC@
MPI_CFLAGS = @MPI_CFLAGS@
MPI_CLDFLAGS = @MPI_CLDFLAGS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
PACKAGE_VERSION_PATCH = @PACKAGE_VERSION_PATCH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
QSE_PROJECT_AUTHOR = @QSE_PROJECT_AUTHOR@
QSE_PROJECT_URL = @QSE_PROJECT_URL@
QSE_SIZEOF_CHAR = @QSE_SIZEOF_CHAR@
QSE_SIZEOF_DOUBLE = @QSE_SIZEOF_DOUBLE@
QSE_SIZEOF_FLOAT = @QSE_SIZEOF_FLOAT@
QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@
SED = @SED@
SENDFILE_LIBS = @SENDFILE_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOCKET_LIBS = @SOCKET_LIBS@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
TRUE = @TRUE@
UNICOWS_LIBS = @UNICOWS_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
ltdl_LIBOBJS = @ltdl_LIBOBJS@
ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pkginclude_HEADERS = stx.h
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/qse/stx/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign include/qse/stx/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
done
uninstall-pkgincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(pkgincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-pkgincludeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-pkgincludeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-pkgincludeHEADERS install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-pkgincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,183 +0,0 @@
/*
* $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/>.
*/
#ifndef _QSE_STX_STX_H_
#define _QSE_STX_STX_H_
#include <qse/types.h>
#include <qse/macros.h>
typedef struct qse_stx_t qse_stx_t;
struct qse_stx_loc_t
{
const qse_char_t* file; /**< file */
qse_size_t line; /**< line */
qse_size_t colm; /**< column */
};
typedef struct qse_stx_loc_t qse_stx_loc_t;
enum qse_stx_io_cmd_t
{
QSE_STX_IO_OPEN = 0,
QSE_STX_IO_CLOSE = 1,
QSE_STX_IO_READ = 2,
QSE_STX_IO_WRITE = 3
};
typedef enum qse_stx_io_cmd_t qse_stx_io_cmd_t;
struct qse_stx_io_arg_t
{
void* handle;
const qse_char_t* path;
};
typedef struct qse_stx_io_arg_t qse_stx_io_arg_t;
typedef qse_ssize_t (*qse_stx_io_impl_t) (
qse_stx_t* stx,
qse_stx_io_cmd_t cmd,
qse_stx_io_arg_t* arg,
qse_char_t* data,
qse_size_t count
);
struct qse_stx_io_t
{
qse_stx_io_impl_t in;
qse_stx_io_impl_t out;
};
typedef struct qse_stx_io_t qse_stx_io_t;
enum qse_stx_errnum_t
{
QSE_STX_ENOERR,
QSE_STX_ENOMEM,
QSE_STX_EINTERN,
QSE_STX_EEXIT,
QSE_STX_EEND,
QSE_STX_EIO,
QSE_STX_EENDSTR,
QSE_STX_ESHARP,
QSE_STX_EDOT,
QSE_STX_ELPAREN,
QSE_STX_ERPAREN,
QSE_STX_ELSTDEEP,
QSE_STX_EVARBAD,
QSE_STX_EARGBAD,
QSE_STX_EARGFEW,
QSE_STX_EARGMANY,
QSE_STX_EUNDEFFN,
QSE_STX_EBADFN,
QSE_STX_EDUPFML,
QSE_STX_EBADSYM,
QSE_STX_EUNDEFSYM,
QSE_STX_EEMPBDY,
QSE_STX_EVALBAD,
QSE_STX_EDIVBY0
};
typedef enum qse_stx_errnum_t qse_stx_errnum_t;
typedef const qse_char_t* (*qse_stx_errstr_t) (
qse_stx_t* stx, /**< stx */
qse_stx_errnum_t num /**< error number */
);
#ifdef __cplusplus
extern "C" {
#endif
QSE_DEFINE_COMMON_FUNCTIONS (stx)
qse_stx_t* qse_stx_open (
qse_mmgr_t* mmgr,
qse_size_t xtnsize,
qse_size_t memcapa
);
void qse_stx_close (
qse_stx_t* stx /**< stx */
);
qse_stx_errstr_t qse_stx_geterrstr (
qse_stx_t* stx /**< stx */
);
void qse_stx_seterrstr (
qse_stx_t* stx, /**< stx */
qse_stx_errstr_t errstr /**< an error string getter */
);
qse_stx_errnum_t qse_stx_geterrnum (
qse_stx_t* stx /**< stx */
);
const qse_stx_loc_t* qse_stx_geterrloc (
qse_stx_t* stx /**< stx */
);
const qse_char_t* qse_stx_geterrmsg (
qse_stx_t* stx /**< stx */
);
void qse_stx_geterror (
qse_stx_t* stx, /**< stx */
qse_stx_errnum_t* errnum, /**< error number */
const qse_char_t** errmsg, /**< error message */
qse_stx_loc_t* errloc /**< error location */
);
void qse_stx_seterrnum (
qse_stx_t* stx, /**< stx */
qse_stx_errnum_t errnum, /**< error number */
const qse_cstr_t* errarg /**< argument for formatting error message */
);
void qse_stx_seterrmsg (
qse_stx_t* stx, /**< stx */
qse_stx_errnum_t errnum, /**< error number */
const qse_char_t* errmsg, /**< error message */
const qse_stx_loc_t* errloc /**< error location */
);
void qse_stx_seterror (
qse_stx_t* stx, /**< stx */
qse_stx_errnum_t errnum, /**< error number */
const qse_cstr_t* errarg, /**< array of arguments for formatting
* an error message */
const qse_stx_loc_t* errloc /**< error location */
);
int qse_stx_attachio (
qse_stx_t* stx, /**< stx */
qse_stx_io_t* io /**< I/O handler set */
);
void qse_stx_detachio (
qse_stx_t* stx /**< stx */
);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,14 +0,0 @@
AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include
lib_LTLIBRARIES = libqsestx.la
libqsestx_la_SOURCES = \
stx.h hash.h mem.h obj.h sym.h dic.h cls.h boot.h \
stx.c err.c hash.c mem.c obj.c sym.c dic.c cls.c boot.c par.c
libqsestx_la_LDFLAGS = -L../cmn -version-info 1:0:0 -no-undefined
libqsestx_la_LIBADD = -lqsecmn

View File

@ -1,610 +0,0 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = lib/stx
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
$(top_srcdir)/m4/ax_numval.m4 $(top_srcdir)/m4/ax_pthread.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltdl.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/lx_find_mpi.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(libdir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libqsestx_la_DEPENDENCIES =
am_libqsestx_la_OBJECTS = stx.lo err.lo hash.lo mem.lo obj.lo sym.lo \
dic.lo cls.lo boot.lo par.lo
libqsestx_la_OBJECTS = $(am_libqsestx_la_OBJECTS)
libqsestx_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libqsestx_la_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES =
depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libqsestx_la_SOURCES)
DIST_SOURCES = $(libqsestx_la_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ARGZ_H = @ARGZ_H@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BUILD_MODE = @BUILD_MODE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CHAR_MODE = @CHAR_MODE@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GREP = @GREP@
HAVE_CXX = @HAVE_CXX@
INCLTDL = @INCLTDL@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBADD_DL = @LIBADD_DL@
LIBADD_DLD_LINK = @LIBADD_DLD_LINK@
LIBADD_DLOPEN = @LIBADD_DLOPEN@
LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@
LIBLTDL = @LIBLTDL@
LIBM = @LIBM@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
LIPO = @LIPO@
LN_S = @LN_S@
LTDLDEPS = @LTDLDEPS@
LTDLINCL = @LTDLINCL@
LTDLOPEN = @LTDLOPEN@
LTLIBOBJS = @LTLIBOBJS@
LT_CONFIG_H = @LT_CONFIG_H@
LT_DLLOADERS = @LT_DLLOADERS@
LT_DLPREOPEN = @LT_DLPREOPEN@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MPICC = @MPICC@
MPI_CFLAGS = @MPI_CFLAGS@
MPI_CLDFLAGS = @MPI_CLDFLAGS@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKAGE_VERSION_MAJOR = @PACKAGE_VERSION_MAJOR@
PACKAGE_VERSION_MINOR = @PACKAGE_VERSION_MINOR@
PACKAGE_VERSION_PATCH = @PACKAGE_VERSION_PATCH@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
QSE_PROJECT_AUTHOR = @QSE_PROJECT_AUTHOR@
QSE_PROJECT_URL = @QSE_PROJECT_URL@
QSE_SIZEOF_CHAR = @QSE_SIZEOF_CHAR@
QSE_SIZEOF_DOUBLE = @QSE_SIZEOF_DOUBLE@
QSE_SIZEOF_FLOAT = @QSE_SIZEOF_FLOAT@
QSE_SIZEOF_INT = @QSE_SIZEOF_INT@
QSE_SIZEOF_LONG = @QSE_SIZEOF_LONG@
QSE_SIZEOF_LONG_DOUBLE = @QSE_SIZEOF_LONG_DOUBLE@
QSE_SIZEOF_LONG_LONG = @QSE_SIZEOF_LONG_LONG@
QSE_SIZEOF_SHORT = @QSE_SIZEOF_SHORT@
QSE_SIZEOF_VOID_P = @QSE_SIZEOF_VOID_P@
QSE_SIZEOF_WCHAR_T = @QSE_SIZEOF_WCHAR_T@
RANLIB = @RANLIB@
RM = @RM@
RMDIR = @RMDIR@
SED = @SED@
SENDFILE_LIBS = @SENDFILE_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SOCKET_LIBS = @SOCKET_LIBS@
SSL_LIBS = @SSL_LIBS@
STRIP = @STRIP@
TRUE = @TRUE@
UNICOWS_LIBS = @UNICOWS_LIBS@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
ax_pthread_config = @ax_pthread_config@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
ltdl_LIBOBJS = @ltdl_LIBOBJS@
ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = nostdinc
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(includedir)
lib_LTLIBRARIES = libqsestx.la
libqsestx_la_SOURCES = \
stx.h hash.h mem.h obj.h sym.h dic.h cls.h boot.h \
stx.c err.c hash.c mem.c obj.c sym.c dic.c cls.c boot.c par.c
libqsestx_la_LDFLAGS = -L../cmn -L$(libdir) -version-info 1:0:0 -no-undefined
libqsestx_la_LIBADD = -lqsecmn
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/stx/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign lib/stx/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libqsestx.la: $(libqsestx_la_OBJECTS) $(libqsestx_la_DEPENDENCIES) $(EXTRA_libqsestx_la_DEPENDENCIES)
$(libqsestx_la_LINK) -rpath $(libdir) $(libqsestx_la_OBJECTS) $(libqsestx_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/boot.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cls.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dic.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mem.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obj.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/par.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stx.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sym.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
for dir in "$(DESTDIR)$(libdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-libLTLIBRARIES
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,905 +0,0 @@
/*
* $Id$
*/
#include "stx.h"
#include <qse/cmn/str.h>
struct class_info_t
{
const qse_char_t* name;
const qse_char_t* superclass;
const qse_char_t* instance_variables;
const qse_char_t* class_variables;
const qse_char_t* pool_dictionaries;
const int spec;
};
typedef struct class_info_t class_info_t;
static class_info_t class_info[] =
{
{
QSE_T("Object"),
QSE_NULL,
QSE_NULL,
QSE_T("classvar1 classvar2")/*QSE_NULL TODO: delete this.....*/,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("UndefinedObject"),
QSE_T("Object"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("Behavior"),
QSE_T("Object"),
QSE_T("spec methods superclass subclasses"),
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("Class"),
QSE_T("Behavior"),
QSE_T("name variables classVariables poolDictionaries"),
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("Metaclass"),
QSE_T("Behavior"),
QSE_T("instanceClass"),
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("Block"),
QSE_T("Object"),
QSE_T("context argCount argLoc bytePointer"),
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("Boolean"),
QSE_T("Object"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("True"),
QSE_T("Boolean"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("False"),
QSE_T("Boolean"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("Context"),
QSE_T("Object"),
QSE_T("stack stackTop receiver pc method"),
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("Method"),
QSE_T("Object"),
QSE_T("text selector bytecodes tmpCount argCount"),
QSE_NULL,
QSE_NULL,
SPEC_VARIABLE_WORD
},
{
QSE_T("Magnitude"),
QSE_T("Object"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("Association"),
QSE_T("Magnitude"),
QSE_T("key value"),
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("Character"),
QSE_T("Magnitude"),
QSE_T("value"),
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("Number"),
QSE_T("Magnitude"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("Integer"),
QSE_T("Number"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("SmallInteger"),
QSE_T("Integer"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("LargeInteger"),
QSE_T("Integer"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_VARIABLE_BYTE
},
{
QSE_T("Collection"),
QSE_T("Magnitude"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("IndexedCollection"),
QSE_T("Collection"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_T("Array"),
QSE_T("IndexedCollection"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_VARIABLE_WORD
},
{
QSE_T("ByteArray"),
QSE_T("IndexedCollection"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_VARIABLE_BYTE
},
{
QSE_T("SystemSymbolTable"),
QSE_T("IndexedCollection"),
QSE_T("tally"),
QSE_NULL,
QSE_NULL,
SPEC_VARIABLE_WORD
},
{
QSE_T("Dictionary"),
QSE_T("IndexedCollection"),
QSE_T("tally"),
QSE_NULL,
QSE_NULL,
SPEC_VARIABLE_WORD
},
{
QSE_T("SystemDictionary"),
QSE_T("Dictionary"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_VARIABLE_WORD
},
{
QSE_T("PoolDictionary"),
QSE_T("Dictionary"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_VARIABLE_WORD
},
{
QSE_T("String"),
QSE_T("IndexedCollection"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_VARIABLE_CHAR
},
{
QSE_T("Symbol"),
QSE_T("String"),
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_VARIABLE_CHAR
},
{
QSE_T("Link"),
QSE_T("Object"),
QSE_T("link"),
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
},
{
QSE_NULL,
QSE_NULL,
QSE_NULL,
QSE_NULL,
QSE_NULL,
SPEC_FIXED_WORD
}
};
qse_word_t QSE_INLINE new_string (qse_stx_t* stx, const qse_char_t* str)
{
QSE_ASSERT (REFISIDX(stx,stx->ref.class_string));
QSE_ASSERT (!ISNIL(stx,stx->ref.class_string));
return qse_stx_instantiate (
stx, stx->ref.class_string, QSE_NULL, str, qse_strlen(str));
}
qse_word_t QSE_INLINE new_array (qse_stx_t* stx, qse_word_t capa)
{
QSE_ASSERT (REFISIDX(stx,stx->ref.class_array));
QSE_ASSERT (!ISNIL(stx,stx->ref.class_array));
return qse_stx_instantiate (
stx, stx->ref.class_array, QSE_NULL, QSE_NULL, capa);
}
qse_word_t QSE_INLINE new_systemdictionary (qse_stx_t* stx, qse_word_t capa)
{
QSE_ASSERT (REFISIDX(stx,stx->ref.class_systemdictionary));
QSE_ASSERT (!ISNIL(stx,stx->ref.class_systemdictionary));
/* the system dictionary uses 1 slot dedicated for nil.
* so we request to allocate 1 more slot than the given */
return qse_stx_instantiate (
stx, stx->ref.class_systemdictionary,
QSE_NULL, QSE_NULL, capa + 1);
}
qse_word_t new_class (qse_stx_t* stx, const qse_char_t* name)
{
qse_word_t meta, class, assoc;
qse_word_t class_name;
QSE_ASSERT (REFISIDX(stx,stx->ref.class_metaclass));
meta = qse_stx_allocwordobj (
stx, QSE_NULL, QSE_STX_METACLASS_SIZE, QSE_NULL, 0);
if (ISNIL(stx,meta)) return stx->ref.nil;
OBJCLASS(stx,meta) = stx->ref.class_metaclass;
/* the spec of the metaclass must be the spec of its
* instance. so the QSE_STX_CLASS_SIZE is set */
WORDAT(stx,meta,QSE_STX_METACLASS_SPEC) =
INTTOREF(stx,SPEC_MAKE(QSE_STX_CLASS_SIZE,SPEC_FIXED_WORD));
/* the spec of the class is set later in __create_builtin_classes */
class = qse_stx_allocwordobj (
stx, QSE_NULL, QSE_STX_CLASS_SIZE, QSE_NULL, 0);
OBJCLASS(stx,class) = meta;
class_name = qse_stx_newsymbol (stx, name);
if (ISNIL(stx,class_name)) return stx->ref.nil;
WORDAT(stx,class,QSE_STX_CLASS_NAME) = class_name;
WORDAT(stx,class,QSE_STX_CLASS_SPEC) = stx->ref.nil;
assoc = qse_stx_putdic (stx, stx->ref.sysdic, class_name, class);
return (ISNIL(stx,assoc))? stx->ref.nil: class;
}
qse_word_t find_class (qse_stx_t* stx, const qse_char_t* name)
{
qse_word_t assoc, meta, value;
/* look up the system dictionary for the name given */
assoc = qse_stx_lookupdic (stx, stx->ref.sysdic, name);
if (ISNIL(stx,assoc))
{
/*qse_stx_seterrnum (stx, QSE_STX_ENOCLASS, QSE_NULL);*/
return stx->ref.nil;
}
/* get the value part in the association for the name */
value = WORDAT(stx,assoc,QSE_STX_ASSOCIATION_VALUE);
/* check if its class is Metaclass because the class of
* a class object must be Metaclass. */
meta = OBJCLASS(stx,value);
if (OBJCLASS(stx,meta) != stx->ref.class_metaclass)
{
/*qse_stx_seterrnum (stx, QSE_STX_ENOTCLASS, QSE_NULL);*/
return stx->ref.nil;
}
return value;
}
static qse_word_t count_names (const qse_char_t* str)
{
qse_word_t n = 0;
const qse_char_t* p = str;
do
{
while (*p == QSE_T(' ') ||
*p == QSE_T('\t')) p++;
if (*p == QSE_T('\0')) break;
n++;
while (*p != QSE_T(' ') &&
*p != QSE_T('\t') &&
*p != QSE_T('\0')) p++;
}
while (1);
return n;
}
static qse_word_t count_subclasses (const qse_char_t* str)
{
class_info_t* p;
qse_word_t n = 0;
for (p = class_info; p->name != QSE_NULL; p++)
{
if (p->superclass == QSE_NULL) continue;
if (qse_strcmp (str, p->superclass) == 0) n++;
}
return n;
}
static void set_subclasses (
qse_stx_t* stx, qse_word_t* array, const qse_char_t* str)
{
class_info_t* p;
qse_word_t n = 0, class;
for (p = class_info; p->name != QSE_NULL; p++)
{
if (p->superclass == QSE_NULL) continue;
if (qse_strcmp (str, p->superclass) != 0) continue;
class = find_class (stx, p->name);
QSE_ASSERT (!ISNIL(stx,class));
array[n++] = class;
}
}
static void set_metaclass_subclasses (
qse_stx_t* stx, qse_word_t* array, const qse_char_t* str)
{
class_info_t* p;
qse_word_t n = 0, class;
for (p = class_info; p->name != QSE_NULL; p++)
{
if (p->superclass == QSE_NULL) continue;
if (qse_strcmp (str, p->superclass) != 0) continue;
class = find_class (stx, p->name);
QSE_ASSERT (!ISNIL(stx,class));
array[n++] = OBJCLASS(stx,class);
}
}
static qse_word_t make_classvar_dic (
qse_stx_t* stx, qse_word_t class, const qse_char_t* names)
{
qse_word_t dic, symbol, assoc;
const qse_char_t* p = names;
const qse_char_t* name;
/* TODO: how to implement temporary GC prevention....???? */
dic = new_systemdictionary (stx, count_names(names));
if (ISNIL(stx,dic)) return stx->ref.nil;
do
{
while (*p == QSE_T(' ') ||
*p == QSE_T('\t')) p++;
if (*p == QSE_T('\0')) break;
name = p;
while (*p != QSE_T(' ') &&
*p != QSE_T('\t') &&
*p != QSE_T('\0')) p++;
symbol = qse_stx_newsymbolx (stx, name, p - name);
if (ISNIL(stx,symbol)) return stx->ref.nil;
assoc = qse_stx_putdic (stx, dic, symbol, stx->ref.nil);
if (ISNIL(stx,assoc)) return stx->ref.nil;
}
while (1);
return dic;
}
static int sketch_nil (qse_stx_t* stx)
{
qse_stx_objidx_t idx;
qse_word_t ref;
qse_stx_wordobj_t* ptr;
/* nil contains no member fields. allocate space for
* an object header */
idx = qse_stx_allocmem (stx, QSE_SIZEOF(qse_stx_objhdr_t));
if (idx == QSE_STX_OBJIDX_INVALID) return -1;
ref = IDXTOREF(stx,idx);
ptr = (qse_stx_wordobj_t*)PTRBYIDX(stx,idx);
/* store the nil reference first */
stx->ref.nil = ref;
/* nil is a word object containing no member fields.
* initialize it accordingly */
ptr->h._type = QSE_STX_WORDOBJ;
ptr->h._mark = 0;
ptr->h._refcnt = 0;
ptr->h._size = 0;
ptr->h._class = stx->ref.nil; /* the class is yet to be set */
ptr->h._backref = ref;
return 0;
}
#define ALLOC_WORDOBJ_TO(stx,var,nflds,nvflds) QSE_BLOCK (\
var = qse_stx_allocwordobj ((stx), QSE_NULL, (nflds), QSE_NULL, nvflds); \
if (ISNIL(stx,(var))) return -1; \
)
#define ADD_TO_SYSDIC(stx,key,value) QSE_BLOCK (\
if (qse_stx_putdic ((stx), (stx)->ref.sysdic, (key), (value)) == (stx)->ref.nil) return -1; \
)
#define NEW_SYMBOL_TO(stx,var,name) QSE_BLOCK (\
var = qse_stx_newsymbol ((stx), name); \
if (ISNIL(stx,(var))) return -1; \
)
#define NEW_CLASS_TO(stx,var,name) QSE_BLOCK (\
var = new_class ((stx), name); \
if (ISNIL(stx,(var))) return -1; \
)
static int sketch_key_objects (qse_stx_t* stx)
{
qse_word_t class_SymbolMeta;
qse_word_t class_MetaclassMeta;
qse_word_t class_AssociationMeta;
qse_word_t symbol_symbol;
qse_word_t symbol_metaclass;
qse_word_t symbol_association;
QSE_ASSERT (REFISIDX(stx,stx->ref.nil));
/* Create a symbol table partially initialized.
* Especially, the class of the symbol table is not set yet.
* It must be corrected later */
/* TODO: initial symbol table size */
ALLOC_WORDOBJ_TO (stx, stx->ref.symtab, 1, SYMTAB_INIT_CAPA);
/* Set tally to 0. */
WORDAT(stx,stx->ref.symtab,QSE_STX_SYSTEMSYMBOLTABLE_TALLY) = INTTOREF(stx,0);
/* Create a global system dictionary partially initialized.
* Especially, the class of the system dictionary is not set yet.
* It must be corrected later */
/* TODO: initial dictionary size */
ALLOC_WORDOBJ_TO (stx, stx->ref.sysdic, 1, SYSDIC_INIT_CAPA);
/* Set tally to 0 */
WORDAT(stx,stx->ref.sysdic,QSE_STX_SYSTEMDICTIONARY_TALLY) = INTTOREF(stx,0);
/* Create a few critical class objects needed for maintaining
* the symbol table and the system dictionary. At this point,
* new_class() cannot be used yet. So the process is
* pretty mundane as shown below. */
/* Symbol */
ALLOC_WORDOBJ_TO (stx, stx->ref.class_symbol, QSE_STX_CLASS_SIZE, 0);
/* Metaclass */
ALLOC_WORDOBJ_TO (stx, stx->ref.class_metaclass, QSE_STX_CLASS_SIZE, 0);
/* Association */
ALLOC_WORDOBJ_TO (stx, stx->ref.class_association, QSE_STX_CLASS_SIZE, 0);
/* Metaclass is a class so it has the same structure
* as a normal class. "Metaclass class" is an instance of
* Metaclass. */
/* Symbol class */
ALLOC_WORDOBJ_TO (stx, class_SymbolMeta, QSE_STX_METACLASS_SIZE, 0);
/* Metaclass class */
ALLOC_WORDOBJ_TO (stx, class_MetaclassMeta, QSE_STX_METACLASS_SIZE, 0);
/* Association class */
ALLOC_WORDOBJ_TO (stx, class_AssociationMeta, QSE_STX_METACLASS_SIZE, 0);
/* (Symbol class) setClass: Metaclass */
OBJCLASS(stx,class_SymbolMeta) = stx->ref.class_metaclass;
/* (Metaclass class) setClass: Metaclass */
OBJCLASS(stx,class_MetaclassMeta) = stx->ref.class_metaclass;
/* (Association class) setClass: Metaclass */
OBJCLASS(stx,class_AssociationMeta) = stx->ref.class_metaclass;
/* Symbol setClass: (Symbol class) */
OBJCLASS(stx,stx->ref.class_symbol) = class_SymbolMeta;
/* Metaclass setClass: (Metaclass class) */
OBJCLASS(stx,stx->ref.class_metaclass) = class_MetaclassMeta;
/* Association setClass: (Association class) */
OBJCLASS(stx,stx->ref.class_association) = class_AssociationMeta;
/* (Symbol class) setSpec: CLASS_SIZE */
WORDAT(stx,class_SymbolMeta,QSE_STX_CLASS_SPEC) =
INTTOREF (stx, SPEC_MAKE(QSE_STX_CLASS_SIZE,SPEC_FIXED_WORD));
/* (Metaclass class) setSpec: CLASS_SIZE */
WORDAT(stx,class_MetaclassMeta,QSE_STX_CLASS_SPEC) =
INTTOREF (stx, SPEC_MAKE(QSE_STX_CLASS_SIZE,SPEC_FIXED_WORD));
/* (Association class) setSpec: CLASS_SIZE */
WORDAT(stx,class_AssociationMeta,QSE_STX_CLASS_SPEC) =
INTTOREF (stx, SPEC_MAKE(QSE_STX_CLASS_SIZE,SPEC_FIXED_WORD));
/* specs for class_metaclass, class_association,
* class_symbol are set later in make_intrinsic_classes */
/* #Symbol */
NEW_SYMBOL_TO (stx, symbol_symbol, QSE_T("Symbol"));
/* #Metaclass */
NEW_SYMBOL_TO (stx, symbol_metaclass, QSE_T("Metaclass"));
/* #Association */
NEW_SYMBOL_TO (stx, symbol_association, QSE_T("Association"));
/* Symbol setName: #Symbol */
WORDAT(stx,stx->ref.class_symbol,QSE_STX_CLASS_NAME) = symbol_symbol;
/* Metaclass setName: #Metaclass */
WORDAT(stx,stx->ref.class_metaclass,QSE_STX_CLASS_NAME) = symbol_metaclass;
/* Association setName: #Association */
WORDAT(stx,stx->ref.class_association,QSE_STX_CLASS_NAME) = symbol_association;
/* propagte the spec field in advance */
WORDAT(stx,stx->ref.class_symbol,QSE_STX_CLASS_SPEC) =
INTTOREF (stx, SPEC_MAKE(0,SPEC_VARIABLE_CHAR));
WORDAT(stx,stx->ref.class_metaclass,QSE_STX_CLASS_SPEC) =
INTTOREF (stx, SPEC_MAKE(QSE_STX_METACLASS_SIZE,SPEC_FIXED_WORD));
WORDAT(stx,stx->ref.class_association,QSE_STX_CLASS_SPEC) =
INTTOREF (stx, SPEC_MAKE(QSE_STX_ASSOCIATION_SIZE,SPEC_FIXED_WORD));
/* register class names into the system dictionary */
ADD_TO_SYSDIC (stx, symbol_symbol, stx->ref.class_symbol);
ADD_TO_SYSDIC (stx, symbol_metaclass, stx->ref.class_metaclass);
ADD_TO_SYSDIC (stx, symbol_association, stx->ref.class_association);
return 0;
}
static int make_key_classes (qse_stx_t* stx)
{
/* object, class, and array are precreated for easier instantiation
* of intrinsic classes. */
NEW_CLASS_TO (stx, stx->ref.class_object, QSE_T("Object"));
NEW_CLASS_TO (stx, stx->ref.class_undefinedobject, QSE_T("UndefinedObject"));
NEW_CLASS_TO (stx, stx->ref.class_class, QSE_T("Class"));
NEW_CLASS_TO (stx, stx->ref.class_array, QSE_T("Array"));
NEW_CLASS_TO (stx, stx->ref.class_bytearray, QSE_T("ByteArray"));
NEW_CLASS_TO (stx, stx->ref.class_string, QSE_T("String"));
NEW_CLASS_TO (stx, stx->ref.class_character, QSE_T("Character"));
NEW_CLASS_TO (stx, stx->ref.class_context, QSE_T("Context"));
NEW_CLASS_TO (stx, stx->ref.class_systemsymboltable, QSE_T("SystemSymbolTable"));
NEW_CLASS_TO (stx, stx->ref.class_systemdictionary, QSE_T("SystemDictionary"));
NEW_CLASS_TO (stx, stx->ref.class_method, QSE_T("Method"));
NEW_CLASS_TO (stx, stx->ref.class_smallinteger, QSE_T("SmallInteger"));
/* set the spec field in advance so that new_string() and new_array()
* can call qse_stx_instantiate() from this point onwards */
WORDAT(stx,stx->ref.class_string,QSE_STX_CLASS_SPEC) =
INTTOREF (stx, SPEC_MAKE(0,SPEC_VARIABLE_CHAR));
WORDAT(stx,stx->ref.class_array,QSE_STX_CLASS_SPEC) =
INTTOREF (stx, SPEC_MAKE(0,SPEC_VARIABLE_WORD));
return 0;
}
static void set_class_of_more_key_objects (qse_stx_t* stx)
{
/* nil setClass: UndefinedObject */
OBJCLASS(stx,stx->ref.nil) = stx->ref.class_undefinedobject;
/* sysdic(Smalltalk) setClass: SystemDictionary */
OBJCLASS(stx,stx->ref.sysdic) = stx->ref.class_systemdictionary;
/* symtab setClass: SystemSymbolTable */
OBJCLASS(stx,stx->ref.symtab) = stx->ref.class_systemsymboltable;
}
static int make_intrinsic_classes (qse_stx_t* stx)
{
class_info_t* p;
QSE_ASSERT (!ISNIL(stx,stx->ref.class_array));
for (p = class_info; p->name != QSE_NULL; p++)
{
qse_word_t classref;
qse_stx_class_t* classptr;
qse_word_t nfixed;
qse_word_t spec;
classref = find_class(stx, p->name);
if (ISNIL(stx,classref))
{
classref = new_class (stx, p->name);
if (ISNIL(stx,classref)) return stx->ref.nil;
}
classptr = (qse_stx_class_t*)PTRBYREF(stx,classref);
if (p->superclass)
{
classptr->superclass = find_class(stx,p->superclass);
QSE_ASSERT (!ISNIL(stx,classptr->superclass));
}
nfixed = 0;
/* resolve the number of fixed fields in the superclass chain */
if (p->superclass)
{
qse_word_t superref;
qse_stx_class_t* superptr;
qse_word_t metaref;
qse_stx_metaclass_t* metaptr;
superref = find_class (stx, p->superclass);
QSE_ASSERT (!ISNIL(stx,superref));
metaref = OBJCLASS(stx,classref);
metaptr = (qse_stx_metaclass_t*)PTRBYREF(stx,metaref);
metaptr->superclass = OBJCLASS(stx,superref);
metaptr->instance_class = classref;
do
{
superptr = (qse_stx_class_t*)PTRBYREF(stx,superref);
nfixed += SPEC_GETFIXED(REFTOINT(stx,superptr->spec));
superref = superptr->superclass;
}
while (!ISNIL(stx,superref));
}
/* add the number of instance variables to the number of
* fixed fields */
if (p->instance_variables)
{
nfixed += count_names (p->instance_variables);
classptr->variables =
new_string (stx, p->instance_variables);
if (ISNIL(stx,classptr->variables)) return -1;
}
QSE_ASSERT (
nfixed <= 0 ||
(nfixed > 0 && (p->spec == SPEC_FIXED_WORD ||
p->spec == SPEC_VARIABLE_WORD)));
spec = INTTOREF (stx, SPEC_MAKE (nfixed, p->spec));
QSE_ASSERTX (ISNIL(stx,classptr->spec) || classptr->spec == spec,
"If the specfication field is already set before this function, "
"the specification in the class information table must match it. "
"Otherwise, something is very wrong");
classptr->spec = spec;
}
/* make class variable dictionaries and pool dictionaries */
for (p = class_info; p->name; p++)
{
qse_word_t classref;
qse_stx_class_t* classptr;
classref = find_class (stx, p->name);
QSE_ASSERT (!ISNIL(stx,classref));
classptr = (qse_stx_class_t*)PTRBYREF(stx,classref);
if (p->class_variables)
{
classptr->class_variables =
make_classvar_dic(stx, classref, p->class_variables);
if (ISNIL(stx,classptr->class_variables)) return stx->ref.nil;
}
/*
TODO:
if (p->pool_dictionaries != QSE_NULL) {
classptr->pool_dictionaries =
__make_pool_dictionary(stx, class, p->pool_dictionaries);
}
*/
}
/* fill subclasses */
for (p = class_info; p->name != QSE_NULL; p++)
{
qse_word_t classref;
qse_stx_class_t* classptr;
qse_word_t array;
qse_word_t n;
n = count_subclasses (p->name);
array = new_array (stx, n);
if (ISNIL(stx,array)) return -1;
set_subclasses (stx, &WORDAT(stx,array,0), p->name);
classref = find_class (stx, p->name);
QSE_ASSERT (!ISNIL(stx,classref));
classptr = (qse_stx_class_t*)PTRBYREF(stx,classref);
classptr->subclasses = array;
}
/* fill subclasses for metaclasses */
for (p = class_info; p->name != QSE_NULL; p++)
{
qse_word_t classref;
qse_word_t metaref;
qse_stx_metaclass_t* metaptr;
qse_word_t array;
qse_word_t n;
n = count_subclasses (p->name);
array = new_array (stx, n);
if (ISNIL(stx,array)) return -1;
set_metaclass_subclasses (stx, &WORDAT(stx,array,0), p->name);
classref = find_class (stx, p->name);
QSE_ASSERT (!ISNIL(stx,classref));
metaref = OBJCLASS(stx,classref);
metaptr = (qse_stx_metaclass_t*)PTRBYREF(stx,metaref);
metaptr->subclasses = array;
}
return 0;
}
static void make_metaclass_top_hierarchy (qse_stx_t* stx)
{
qse_word_t metaclass_of_object;
/* make the superclass of Object class to be Class */
/* metaclass_of_object := Object class */
metaclass_of_object = OBJCLASS (stx, stx->ref.class_object);
/* (Object class) setSuperclass: Class */
WORDAT(stx,metaclass_of_object,QSE_STX_METACLASS_SUPERCLASS) = stx->ref.class_class;
/* Set the instance class for Object here as it is not
* set in make_intrisic_classes */
WORDAT(stx,metaclass_of_object,QSE_STX_METACLASS_INSTANCE_CLASS) = stx->ref.class_object;
}
static int make_key_objects_accessible_by_name (qse_stx_t* stx)
{
qse_word_t tmp;
#if 0
/* create #nil, #true, #false */
NEW_SYMBOL_TO (stx, tmp, QSE_T("nil"));
NEW_SYMBOL_TO (stx, tmp, QSE_T("true"));
NEW_SYMBOL_TO (stx, tmp, QSE_T("false"));
#endif
NEW_SYMBOL_TO (stx, tmp, QSE_T("Smalltalk"));
/* Smalltalk at: #Smalltalk put: stx->ref.sysdic */
ADD_TO_SYSDIC (stx, tmp, stx->ref.sysdic);
NEW_SYMBOL_TO (stx, tmp, QSE_T("SymbolTable"));
/* Smalltalk at: #SymbolTable put: stx->ref.sysdic */
ADD_TO_SYSDIC (stx, tmp, stx->ref.symtab);
return 0;
}
static int make_true_and_false (qse_stx_t* stx)
{
stx->ref.true = qse_stx_instantiate (
stx, find_class(stx,QSE_T("True")),
QSE_NULL, QSE_NULL, 0
);
if (ISNIL(stx,stx->ref.true)) return -1;
stx->ref.false = qse_stx_instantiate (
stx, find_class(stx,QSE_T("False")),
QSE_NULL, QSE_NULL, 0
);
if (ISNIL(stx,stx->ref.false)) return -1;
return 0;
}
static void filein_kernel_source (qse_stx_t* stx)
{
class_info_t* p;
for (p = class_info; p->name != QSE_NULL; p++)
{
/* TODO: */
}
}
int qse_stx_boot (qse_stx_t* stx)
{
/* you must not call this function more than once... */
QSE_ASSERTX (
stx->ref.nil == 0 &&
stx->ref.true == 0 &&
stx->ref.false == 0,
"You must not call qse_stx_boot() more than once"
);
if (sketch_nil (stx) <= -1) return -1;
if (sketch_key_objects (stx) <= -1) return -1;
if (make_key_classes (stx) <= -1) return -1;
set_class_of_more_key_objects (stx);
if (make_intrinsic_classes (stx) <= -1) return -1;
make_metaclass_top_hierarchy (stx);
if (make_key_objects_accessible_by_name (stx) <= -1) return -1;
if (make_true_and_false (stx) <= -1) return -1;
return 0;
}
/* for debugging for the time begin ... */
qse_word_t qse_stx_findclass (qse_stx_t* stx, const qse_char_t* name)
{
return find_class (stx, name);
}

View File

@ -1,22 +0,0 @@
/*
* $Id$
*/
#ifndef _QSE_LIB_STX_BOOT_H_
#define _QSE_LIB_STX_BOOT_H_
#ifdef __cplusplus
extern "C" {
#endif
int qse_stx_boot (
qse_stx_t* stx
);
qse_word_t qse_stx_findclass (qse_stx_t* stx, const qse_char_t* name);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,193 +0,0 @@
/*
* $Id: bytecode.c 118 2008-03-03 11:21:33Z baconevi $
*/
#include <qse/stx/bytecode.h>
#include <qse/stx/class.h>
#include <qse/stx/method.h>
#include <qse/stx/dict.h>
static void __decode1 (qse_stx_t* stx, qse_word_t idx, void* data);
static int __decode2 (qse_stx_t* stx,
qse_stx_class_t* class_obj, qse_stx_method_t* method_obj);
int qse_stx_decode (qse_stx_t* stx, qse_word_t class)
{
qse_stx_class_t* class_obj;
class_obj = (qse_stx_class_t*)QSE_STX_OBJPTR(stx, class);
if (class_obj->methods == stx->nil) return 0;
/* TODO */
qse_stx_dict_traverse (stx, class_obj->methods, __decode1, class_obj);
return 0;
}
#include <qse/bas/stdio.h>
static void __dump_object (qse_stx_t* stx, qse_word_t obj)
{
if (QSE_STX_ISSMALLINT(obj)) {
qse_printf (QSE_T("%d"), QSE_STX_FROMSMALLINT(obj));
}
else if (QSE_STX_CLASS(stx,obj) == stx->class_character) {
qse_printf (QSE_T("$%c"), QSE_STX_WORD_AT(stx,obj,0));
}
else if (QSE_STX_CLASS(stx,obj) == stx->class_string) {
qse_printf (QSE_T("'%s'"), QSE_STX_DATA(stx,obj));
}
else if (QSE_STX_CLASS(stx,obj) == stx->class_symbol) {
qse_printf (QSE_T("#%s"), QSE_STX_DATA(stx,obj));
}
else if (QSE_STX_ISCHAROBJECT(stx, obj)) {
qse_printf (QSE_T("unknow char object [%s]"), QSE_STX_DATA(stx,obj));
}
else if (QSE_STX_ISBYTEOBJECT(stx, obj)) {
qse_printf (QSE_T("unknown byte object"), QSE_STX_DATA(stx,obj));
}
else if (QSE_STX_ISWORDOBJECT(stx, obj)) {
qse_printf (QSE_T("unknown word object"), QSE_STX_DATA(stx,obj));
}
else {
qse_printf (QSE_T("invalid object type"));
}
}
static void __decode1 (qse_stx_t* stx, qse_word_t idx, void* data)
{
qse_stx_method_t* method_obj;
qse_stx_class_t* class_obj;
qse_word_t key = QSE_STX_WORD_AT(stx,idx,QSE_STX_ASSOCIATION_KEY);
qse_word_t value = QSE_STX_WORD_AT(stx,idx,QSE_STX_ASSOCIATION_VALUE);
qse_word_t* literals;
qse_word_t literal_count, i;
qse_word_t method_class;
qse_stx_class_t* method_class_obj;
class_obj = (qse_stx_class_t*)data;
qse_printf (QSE_T("* Method: %s\n"), QSE_STX_DATA(stx, key));
method_obj = (qse_stx_method_t*)QSE_STX_OBJPTR(stx, value);
literals = method_obj->literals;
/*
literal_count = QSE_STX_SIZE(stx, value) -
(QSE_STX_FROMSMALLINT(class_obj->spec) >> QSE_STX_SPEC_INDEXABLE_BITS);
*/
method_class = QSE_STX_CLASS(stx,value);
method_class_obj = QSE_STX_OBJPTR(stx, method_class);
literal_count = QSE_STX_SIZE(stx,value) -
(QSE_STX_FROMSMALLINT(method_class_obj->spec) >> QSE_STX_SPEC_INDEXABLE_BITS);
qse_printf (QSE_T("* Literal Count: %d, Temporary Count: %d, Argument Count: %d\n"),
literal_count,
QSE_STX_FROMSMALLINT(method_obj->tmpcount),
QSE_STX_FROMSMALLINT(method_obj->argcount));
for (i = 0; i < literal_count; i++) {
qse_printf (QSE_T("%d. ["), i);
__dump_object (stx, literals[i]);
qse_printf (QSE_T("]\n"));
}
__decode2 (stx, data, method_obj);
}
static int __decode2 (qse_stx_t* stx,
qse_stx_class_t* class_obj, qse_stx_method_t* method_obj)
{
qse_stx_byte_object_t* bytecodes;
qse_word_t bytecode_size, pc = 0;
int code, next, next2;
static const qse_char_t* stack_opcode_names[] =
{
QSE_T("push_receiver_variable"),
QSE_T("push_temporary_location"),
QSE_T("push_literal_constant"),
QSE_T("push_literal_variable"),
QSE_T("store_receiver_variable"),
QSE_T("store_temporary_location")
};
static const qse_char_t* send_opcode_names[] =
{
QSE_T("send_to_self"),
QSE_T("send_to_super")
};
static const qse_char_t* stack_special_opcode_names[] =
{
QSE_T("pop_stack_top"),
QSE_T("duplicate_pop_stack_top"),
QSE_T("push_active_context"),
QSE_T("push_nil"),
QSE_T("push_true"),
QSE_T("push_false"),
QSE_T("push_receiver")
};
static const qse_char_t* return_opcode_names[] =
{
QSE_T("return_receiver"),
QSE_T("return_true"),
QSE_T("return_false"),
QSE_T("return_nil"),
QSE_T("return_from_message"),
QSE_T("return_from_block")
};
bytecodes = QSE_STX_BYTE_OBJECT(stx, method_obj->bytecodes);
bytecode_size = QSE_STX_SIZE(stx, method_obj->bytecodes);
while (pc < bytecode_size) {
code = bytecodes->data[pc++];
if (code >= 0x00 && code <= 0x5F) {
/* stack */
qse_printf (QSE_T("%s %d\n"),
stack_opcode_names[code >> 4], code & 0x0F);
}
else if (code >= 0x60 && code <= 0x65) {
/* stack extended */
next = bytecodes->data[pc++];
qse_printf (QSE_T("%s %d\n"),
stack_opcode_names[code & 0x0F], next);
}
else if (code >= 0x67 && code <= 0x6D) {
/* stack special */
qse_printf (QSE_T("%s\n"),
stack_special_opcode_names[code - 0x67]);
}
else if (code >= 0x70 && code <= 0x71 ) {
/* send message */
next = bytecodes->data[pc++];
qse_printf (QSE_T("%s nargs(%d) selector(%d)\n"),
send_opcode_names[code - 0x70], next >> 5, next & 0x1F);
}
else if (code >= 0x72 && code <= 0x73 ) {
/* send message extended */
next = bytecodes->data[pc++];
next2 = bytecodes->data[pc++];
qse_printf (QSE_T("%s %d %d\n"),
send_opcode_names[code - 0x72], next, next2);
}
else if (code >= 0x78 && code <= 0x7D) {
qse_printf (QSE_T("%s\n"),
return_opcode_names[code - 0x78]);
}
else if (code >= 0x80 && code <= 0x8F) {
// jump
}
else if (code >= 0xF0 && code <= 0xFF) {
// primitive
next = bytecodes->data[pc++];
qse_printf (QSE_T("do_primitive %d\n"), ((code & 0x0F) << 8) | next);
}
else {
qse_printf (QSE_T("unknown byte code 0x%x\n"), code);
}
}
return 0;
}

View File

@ -1,56 +0,0 @@
/*
* $Id: bytecode.h 118 2008-03-03 11:21:33Z baconevi $
*/
#ifndef _QSE_STX_BYTECODE_H_
#define _QSE_STX_BYTECODE_H_
#include <qse/stx/stx.h>
#define PUSH_RECEIVER_VARIABLE 0x00
#define PUSH_TEMPORARY_LOCATION 0x10
#define PUSH_LITERAL_CONSTANT 0x20
#define PUSH_LITERAL_VARIABLE 0x30
#define STORE_RECEIVER_VARIABLE 0x40
#define STORE_TEMPORARY_LOCATION 0x50
#define PUSH_RECEIVER_VARIABLE_EXTENDED 0x60
#define PUSH_TEMPORARY_LOCATION_EXTENDED 0x61
#define PUSH_LITERAL_CONSTANT_EXTENDED 0x62
#define PUSH_LITERAL_VARIABLE_EXTENDED 0x63
#define STORE_RECEIVER_VARIABLE_EXTENDED 0x64
#define STORE_TEMPORARY_LOCATION_EXTENDED 0x65
#define POP_STACK_TOP 0x67
#define DUPLICATE_POP_STACK_TOP 0x68
#define PUSH_ACTIVE_CONTEXT 0x69
#define PUSH_NIL 0x6A
#define PUSH_TRUE 0x6B
#define PUSH_FALSE 0x6C
#define PUSH_RECEIVER 0x6D
#define SEND_TO_SELF 0x70
#define SEND_TO_SUPER 0x71
#define SEND_TO_SELF_EXTENDED 0x72
#define SEND_TO_SUPER_EXTENDED 0x73
#define RETURN_RECEIVER 0x78
#define RETURN_TRUE 0x79
#define RETURN_FALSE 0x7A
#define RETURN_NIL 0x7B
#define RETURN_FROM_MESSAGE 0x7C
#define RETURN_FROM_BLOCK 0x7D
#define DO_PRIMITIVE 0xF0
#ifdef __cplusplus
extern "C" {
#endif
int qse_stx_decode (qse_stx_t* stx, qse_word_t class_idx);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,256 +0,0 @@
/*
* $Id: class.c 118 2008-03-03 11:21:33Z baconevi $
*/
#include <qse/stx/class.h>
#include <qse/stx/symbol.h>
#include <qse/stx/object.h>
#include <qse/stx/dict.h>
#include <qse/stx/misc.h>
qse_char_t* qse_stx_strword (
const qse_char_t* str, const qse_char_t* word, qse_word_t* word_index)
{
qse_char_t* p = (qse_char_t*)str;
qse_char_t* tok;
qse_size_t len;
qse_word_t index = 0;
while (p != QSE_NULL)
{
p = qse_strtok (p, QSE_T(""), &tok, &len);
if (qse_strxcmp (tok, len, word) == 0)
{
*word_index = index;
return tok;
}
index++;
}
*word_index = index;
return QSE_NULL;
}
qse_word_t qse_stx_newclass (qse_stx_t* stx, const qse_char_t* name)
{
qse_word_t meta, class;
qse_word_t class_name;
meta = qse_stx_alloc_word_object (
stx, QSE_NULL, QSE_STX_METACLASS_SIZE, QSE_NULL, 0);
QSE_STX_CLASS(stx,meta) = stx->class_metaclass;
/* the spec of the metaclass must be the spec of its
* instance. so the QSE_STX_CLASS_SIZE is set */
QSE_STX_WORD_AT(stx,meta,QSE_STX_METACLASS_SPEC) =
QSE_STX_TO_SMALLINT((QSE_STX_CLASS_SIZE << QSE_STX_SPEC_INDEXABLE_BITS) | QSE_STX_SPEC_NOT_INDEXABLE);
/* the spec of the class is set later in __create_builtin_classes */
class = qse_stx_alloc_word_object (
stx, QSE_NULL, QSE_STX_CLASS_SIZE, QSE_NULL, 0);
QSE_STX_CLASS(stx,class) = meta;
class_name = qse_stx_new_symbol (stx, name);
QSE_STX_WORD_AT(stx,class,QSE_STX_CLASS_NAME) = class_name;
qse_stx_dict_put (stx, stx->smalltalk, class_name, class);
return class;
}
qse_word_t qse_stx_findclass (qse_stx_t* stx, const qse_char_t* name)
{
qse_word_t assoc, meta, value;
assoc = qse_stx_dict_lookup (stx, stx->ref.sysdic, name);
if (assoc == stx->nil)
{
return stx->nil;
}
value = QSE_STX_WORD_AT(stx,assoc,QSE_STX_ASSOCIATION_VALUE);
meta = QSE_STX_CLASS(stx,value);
if (QSE_STX_CLASS(stx,meta) != stx->ref.class_metaclass) return stx->nil;
return value;
}
int qse_stx_get_instance_variable_index (
qse_stx_t* stx, qse_word_t class_index,
const qse_char_t* name, qse_word_t* index)
{
qse_word_t index_super = 0;
qse_stx_class_t* class_obj;
qse_stx_char_object_t* string;
class_obj = (qse_stx_class_t*)QSE_STX_OBJPTR(stx, class_index);
qse_assert (class_obj != QSE_NULL);
if (class_obj->superclass != stx->nil) {
if (qse_stx_get_instance_variable_index (
stx, class_obj->superclass, name, &index_super) == 0) {
*index = index_super;
return 0;
}
}
if (class_obj->header.class == stx->class_metaclass) {
/* metaclass */
/* TODO: can a metaclas have instance variables? */
*index = index_super;
}
else {
if (class_obj->variables == stx->nil) *index = 0;
else {
string = QSE_STX_CHAR_OBJECT(stx, class_obj->variables);
if (qse_stx_strword(string->data, name, index) != QSE_NULL) {
*index += index_super;
return 0;
}
}
*index += index_super;
}
return -1;
}
qse_word_t qse_stx_lookup_class_variable (
qse_stx_t* stx, qse_word_t class_index, const qse_char_t* name)
{
qse_stx_class_t* class_obj;
class_obj = (qse_stx_class_t*)QSE_STX_OBJPTR(stx, class_index);
qse_assert (class_obj != QSE_NULL);
if (class_obj->superclass != stx->nil) {
qse_word_t tmp;
tmp = qse_stx_lookup_class_variable (
stx, class_obj->superclass, name);
if (tmp != stx->nil) return tmp;
}
/* TODO: can a metaclas have class variables? */
if (class_obj->header.class != stx->class_metaclass &&
class_obj->class_variables != stx->nil) {
if (qse_stx_dict_lookup(stx,
class_obj->class_variables,name) != stx->nil) return class_index;
}
return stx->nil;
}
qse_word_t qse_stx_lookup_method (qse_stx_t* stx,
qse_word_t class_index, const qse_char_t* name, qse_bool_t from_super)
{
qse_stx_class_t* class_obj;
class_obj = (qse_stx_class_t*)QSE_STX_OBJPTR(stx, class_index);
qse_assert (class_obj != QSE_NULL);
#if 0
if (class_obj->header.class != stx->class_metaclass &&
class_obj->methods != stx->nil) {
qse_word_t assoc;
assoc = qse_stx_dict_lookup(stx, class_obj->methods, name);
if (assoc != stx->nil) {
qse_assert (QSE_STX_CLASS(stx,assoc) == stx->class_association);
return QSE_STX_WORD_AT(stx, assoc, QSE_STX_ASSOCIATION_VALUE);
}
}
if (class_obj->superclass != stx->nil) {
qse_word_t tmp;
tmp = qse_stx_lookup_method (
stx, class_obj->superclass, name);
if (tmp != stx->nil) return tmp;
}
#endif
while (class_index != stx->nil) {
class_obj = (qse_stx_class_t*)QSE_STX_OBJPTR(stx, class_index);
qse_assert (class_obj != QSE_NULL);
qse_assert (
class_obj->header.class == stx->class_metaclass ||
QSE_STX_CLASS(stx,class_obj->header.class) == stx->class_metaclass);
if (from_super) {
from_super = qse_false;
}
else if (class_obj->methods != stx->nil) {
qse_word_t assoc;
assoc = qse_stx_dict_lookup(stx, class_obj->methods, name);
if (assoc != stx->nil) {
qse_assert (QSE_STX_CLASS(stx,assoc) == stx->class_association);
return QSE_STX_WORD_AT(stx, assoc, QSE_STX_ASSOCIATION_VALUE);
}
}
class_index = class_obj->superclass;
}
return stx->nil;
}
qse_word_t qse_stx_instantiate (
qse_stx_t* stx, qse_word_t classref, void* data,
const void* variable_data, qse_word_t variable_nflds)
{
qse_stx_class_t* classptr;
qse_word_t spec, nflds, inst;
int variable;
QSE_ASSERT (REFISIDX(stx,classref));
/* don't instantiate a metaclass whose instance must be
created in a different way */
QSE_ASSERT (OBJCLASS(stx,classref) != stx->ref.class_metaclass);
classptr = (qse_stx_class_t*) PTRBYRFF (stx, classref);
/* TODO: maybe delete the following line */
QSE_ASSERT (QSE_STX_CLASS(class) != stx->class_metaclass);
QSE_ASSERT (REFISINT(stx,classptr->spec));
spec = REFTOINT(classptr->spec);
nflds = (spec >> SPEC_VARIABLE_BITS);
variable = spec & SPEC_VARIABLE_MASK;
switch (variable)
{
case SPEC_VARIABLE_BYTE:
/* variable-size byte class */
QSE_ASSERT (nflds == 0 && data == QSE_NULL);
inst = qse_stx_allocbyteobj(
stx, variable_data, variable_nflds);
break;
case SPEC_VARIABLE_CHAR:
/* variable-size char class */
QSE_ASSERT (nflds == 0 && data == QSE_NULL);
inst = qse_stx_alloccharobj (
stx, variable_data, variable_nflds);
break;
case SPEC_VARIABLE_WORD:
/* variable-size class */
inst = qse_stx_allocwordobj (
stx, data, nflds, variable_data, variable_nflds);
break;
case SPEC_FIXED_WORD:
/* fixed size */
QSE_ASSERT (variable_nflds == 0 && variable_data == QSE_NULL);
inst = qse_stx_allocwordobj (
stx, data, nflds, QSE_NULL, 0);
break;
default:
/* this should never happen */
QSE_ASSERTX (0, "this should never happen");
qse_stx_seterror
inst = stx->ref.nil;
}
if (inst != stx->ref.nil) OBJCLASS(stx,inst) = classref;
return inst;
}

View File

@ -1,102 +0,0 @@
/*
* $Id: class.h 118 2008-03-03 11:21:33Z baconevi $
*/
#ifndef _QSE_STX_CLASS_H_
#define _QSE_STX_CLASS_H_
#include <qse/stx/stx.h>
/* definitions for common objects */
#define QSE_STX_CLASS_NFLDS 8
#define QSE_STX_CLASS_SPEC 0
#define QSE_STX_CLASS_METHODS 1
#define QSE_STX_CLASS_SUPERCLASS 2
#define QSE_STX_CLASS_SUBCLASSES 3
#define QSE_STX_CLASS_NAME 4
#define QSE_STX_CLASS_VARIABLES 5
#define QSE_STX_CLASS_CLASS_VARIABLES 6
#define QSE_STX_CLASS_POOL_DICTIONARIES 7
#define QSE_STX_METACLASS_NFLDS 5
#define QSE_STX_METACLASS_SPEC 0
#define QSE_STX_METACLASS_METHODS 1
#define QSE_STX_METACLASS_SUPERCLASS 2
#define QSE_STX_METACLASS_SUBCLASSES 3
#define QSE_STX_METACLASS_INSTANCE_CLASS 4
#define SPEC_VARIABLE_BITS 2
#define SPEC_VARIABLE_MASK 0x03
#define SPEC_FIXED_WORD 0x00
#define SPEC_VARIABLE_WORD 0x01
#define SPEC_VARIABLE_BYTE 0x02
#define SPEC_VARIABLE_CHAR 0x03
#define MAKE_SPEC(nflds,variable) \
(((nflds) << SPEC_VARIABLE_BITS) | (variable))
struct qse_stx_class_t
{
qse_stx_objhdr_t header;
qse_word_t spec; /* indexable: 2, nfields: the rest */
qse_word_t methods;
qse_word_t superclass;
qse_word_t subclasses;
qse_word_t name;
qse_word_t variables;
qse_word_t class_variables;
qse_word_t pool_dictonaries;
};
struct qse_stx_metaclass_t
{
qse_stx_objhdr_t header;
qse_word_t spec;
qse_word_t methods;
qse_word_t superclass;
qse_word_t subclasses;
qse_word_t instance_class;
};
typedef struct qse_stx_class_t qse_stx_class_t;
typedef struct qse_stx_metaclass_t qse_stx_metaclass_t;
#ifdef __cplusplus
extern "C" {
#endif
qse_word_t qse_stx_newclass (
qse_stx_t* stx,
const qse_char_t* name
);
qse_word_t qse_stx_lookupclass (
qse_stx_t* stx,
const qse_char_t* name
);
int qse_stx_get_instance_variable_index (
qse_stx_t* stx, qse_word_t class_index,
const qse_char_t* name, qse_word_t* index);
qse_word_t qse_stx_lookup_class_variable (
qse_stx_t* stx, qse_word_t class_index, const qse_char_t* name);
qse_word_t qse_stx_lookup_method (qse_stx_t* stx,
qse_word_t class_index, const qse_char_t* name, qse_bool_t from_super);
qse_word_t qse_stx_instantiate (
qse_stx_t* stx,
qse_word_t classref,
const void* data,
const void* variable_data,
qse_word_t variable_nfields
);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,212 +0,0 @@
/*
* $Id$
*/
#include "stx.h"
#if 0
qse_char_t* qse_stx_strword (
const qse_char_t* str, const qse_char_t* word, qse_word_t* word_index)
{
qse_char_t* p = (qse_char_t*)str;
qse_char_t* tok;
qse_size_t len;
qse_word_t index = 0;
while (p != QSE_NULL)
{
p = qse_strtok (p, QSE_T(""), &tok, &len);
if (qse_strxcmp (tok, len, word) == 0)
{
*word_index = index;
return tok;
}
index++;
}
*word_index = index;
return QSE_NULL;
}
int qse_stx_get_instance_variable_index (
qse_stx_t* stx, qse_word_t class_index,
const qse_char_t* name, qse_word_t* index)
{
qse_word_t index_super = 0;
qse_stx_class_t* class_obj;
qse_stx_char_object_t* string;
class_obj = (qse_stx_class_t*)QSE_STX_OBJPTR(stx, class_index);
qse_assert (class_obj != QSE_NULL);
if (class_obj->superclass != stx->nil) {
if (qse_stx_get_instance_variable_index (
stx, class_obj->superclass, name, &index_super) == 0) {
*index = index_super;
return 0;
}
}
if (class_obj->header.class == stx->class_metaclass) {
/* metaclass */
/* TODO: can a metaclas have instance variables? */
*index = index_super;
}
else {
if (class_obj->variables == stx->nil) *index = 0;
else {
string = QSE_STX_CHAR_OBJECT(stx, class_obj->variables);
if (qse_stx_strword(string->data, name, index) != QSE_NULL) {
*index += index_super;
return 0;
}
}
*index += index_super;
}
return -1;
}
qse_word_t qse_stx_lookup_class_variable (
qse_stx_t* stx, qse_word_t class_index, const qse_char_t* name)
{
qse_stx_class_t* class_obj;
class_obj = (qse_stx_class_t*)QSE_STX_OBJPTR(stx, class_index);
qse_assert (class_obj != QSE_NULL);
if (class_obj->superclass != stx->nil) {
qse_word_t tmp;
tmp = qse_stx_lookup_class_variable (
stx, class_obj->superclass, name);
if (tmp != stx->nil) return tmp;
}
/* TODO: can a metaclas have class variables? */
if (class_obj->header.class != stx->class_metaclass &&
class_obj->class_variables != stx->nil) {
if (qse_stx_dict_lookup(stx,
class_obj->class_variables,name) != stx->nil) return class_index;
}
return stx->nil;
}
qse_word_t qse_stx_lookup_method (qse_stx_t* stx,
qse_word_t class_index, const qse_char_t* name, qse_bool_t from_super)
{
qse_stx_class_t* class_obj;
class_obj = (qse_stx_class_t*)QSE_STX_OBJPTR(stx, class_index);
qse_assert (class_obj != QSE_NULL);
#if 0
if (class_obj->header.class != stx->class_metaclass &&
class_obj->methods != stx->nil) {
qse_word_t assoc;
assoc = qse_stx_dict_lookup(stx, class_obj->methods, name);
if (assoc != stx->nil) {
qse_assert (QSE_STX_CLASS(stx,assoc) == stx->class_association);
return QSE_STX_WORD_AT(stx, assoc, QSE_STX_ASSOCIATION_VALUE);
}
}
if (class_obj->superclass != stx->nil) {
qse_word_t tmp;
tmp = qse_stx_lookup_method (
stx, class_obj->superclass, name);
if (tmp != stx->nil) return tmp;
}
#endif
while (class_index != stx->nil) {
class_obj = (qse_stx_class_t*)QSE_STX_OBJPTR(stx, class_index);
qse_assert (class_obj != QSE_NULL);
qse_assert (
class_obj->header.class == stx->class_metaclass ||
QSE_STX_CLASS(stx,class_obj->header.class) == stx->class_metaclass);
if (from_super) {
from_super = qse_false;
}
else if (class_obj->methods != stx->nil) {
qse_word_t assoc;
assoc = qse_stx_dict_lookup(stx, class_obj->methods, name);
if (assoc != stx->nil) {
qse_assert (QSE_STX_CLASS(stx,assoc) == stx->class_association);
return QSE_STX_WORD_AT(stx, assoc, QSE_STX_ASSOCIATION_VALUE);
}
}
class_index = class_obj->superclass;
}
return stx->nil;
}
#endif
qse_word_t qse_stx_instantiate (
qse_stx_t* stx, qse_word_t classref, const void* data,
const void* variable_data, qse_word_t variable_nflds)
{
qse_stx_class_t* classptr;
qse_word_t spec, nflds, inst;
int variable;
QSE_ASSERT (REFISIDX(stx,classref));
/* don't instantiate a metaclass whose instance must be
created in a different way */
QSE_ASSERT (OBJCLASS(stx,classref) != stx->ref.class_metaclass);
classptr = (qse_stx_class_t*)PTRBYREF(stx,classref);
QSE_ASSERT (REFISINT(stx,classptr->spec));
spec = REFTOINT(stx,classptr->spec);
nflds = (spec >> SPEC_VARIABLE_BITS);
variable = spec & SPEC_VARIABLE_MASK;
switch (variable)
{
case SPEC_VARIABLE_BYTE:
/* variable-size byte class */
QSE_ASSERT (nflds == 0 && data == QSE_NULL);
inst = qse_stx_allocbyteobj (
stx, variable_data, variable_nflds);
break;
case SPEC_VARIABLE_CHAR:
/* variable-size char class */
QSE_ASSERT (nflds == 0 && data == QSE_NULL);
inst = qse_stx_alloccharobj (
stx, variable_data, variable_nflds);
break;
case SPEC_VARIABLE_WORD:
/* variable-size class */
inst = qse_stx_allocwordobj (
stx, data, nflds, variable_data, variable_nflds);
break;
case SPEC_FIXED_WORD:
/* fixed size */
QSE_ASSERT (variable_nflds == 0 && variable_data == QSE_NULL);
inst = qse_stx_allocwordobj (
stx, data, nflds, QSE_NULL, 0);
break;
default:
/* this should never happen */
QSE_ASSERTX (0, "this should never happen");
qse_stx_seterrnum (stx, QSE_STX_EINTERN, QSE_NULL);
return stx->ref.nil;
}
QSE_ASSERT (inst != stx->ref.nil);
OBJCLASS(stx,inst) = classref;
return inst;
}

View File

@ -1,103 +0,0 @@
/*
* $Id$
*/
#ifndef _QSE_LIB_STX_CLS_H_
#define _QSE_LIB_STX_CLS_H_
struct qse_stx_class_t
{
qse_stx_objhdr_t h;
qse_word_t spec; /* indexable: 2, nfields: the rest */
qse_word_t methods;
qse_word_t superclass;
qse_word_t subclasses;
qse_word_t name;
qse_word_t variables;
qse_word_t class_variables;
qse_word_t pool_dictonaries;
};
struct qse_stx_metaclass_t
{
qse_stx_objhdr_t h;
qse_word_t spec;
qse_word_t methods;
qse_word_t superclass;
qse_word_t subclasses;
qse_word_t instance_class;
};
typedef struct qse_stx_class_t qse_stx_class_t;
typedef struct qse_stx_metaclass_t qse_stx_metaclass_t;
#define QSE_STX_CLASS_SIZE 8
#define QSE_STX_CLASS_SPEC 0
#define QSE_STX_CLASS_METHODS 1
#define QSE_STX_CLASS_SUPERCLASS 2
#define QSE_STX_CLASS_SUBCLASSES 3
#define QSE_STX_CLASS_NAME 4
#define QSE_STX_CLASS_VARIABLES 5
#define QSE_STX_CLASS_CLASS_VARIABLES 6
#define QSE_STX_CLASS_POOL_DICTIONARIES 7
#define QSE_STX_METACLASS_SIZE 5
#define QSE_STX_METACLASS_SPEC 0
#define QSE_STX_METACLASS_METHODS 1
#define QSE_STX_METACLASS_SUPERCLASS 2
#define QSE_STX_METACLASS_SUBCLASSES 3
#define QSE_STX_METACLASS_INSTANCE_CLASS 4
#define SPEC_VARIABLE_BITS 2
#define SPEC_VARIABLE_MASK 0x03
#define SPEC_FIXED_WORD 0x00
#define SPEC_VARIABLE_WORD 0x01
#define SPEC_VARIABLE_BYTE 0x02
#define SPEC_VARIABLE_CHAR 0x03
#define SPEC_MAKE(nfixed,variable) \
(((nfixed) << SPEC_VARIABLE_BITS) | (variable))
#define SPEC_GETFIXED(spec) ((spec) >> SPEC_VARIABLE_BITS)
#ifdef __cplusplus
extern "C" {
#endif
qse_word_t qse_stx_newclass (
qse_stx_t* stx,
const qse_char_t* name
);
qse_word_t qse_stx_findclass (
qse_stx_t* stx,
const qse_char_t* name
);
#if 0
int qse_stx_get_instance_variable_index (
qse_stx_t* stx, qse_word_t class_index,
const qse_char_t* name, qse_word_t* index);
qse_word_t qse_stx_lookup_class_variable (
qse_stx_t* stx, qse_word_t class_index, const qse_char_t* name);
qse_word_t qse_stx_lookup_method (qse_stx_t* stx,
qse_word_t class_index, const qse_char_t* name, qse_bool_t from_super);
#endif
qse_word_t qse_stx_instantiate (
qse_stx_t* stx,
qse_word_t classref,
const void* data,
const void* variable_data,
qse_word_t variable_nfields
);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,76 +0,0 @@
/*
* $Id: context.c 118 2008-03-03 11:21:33Z baconevi $
*/
#include <qse/stx/context.h>
#include <qse/stx/object.h>
#include <qse/stx/class.h>
#include <qse/stx/misc.h>
qse_word_t qse_stx_new_context (qse_stx_t* stx,
qse_word_t method, qse_word_t args, qse_word_t temp)
{
qse_word_t context;
qse_stx_context_t* obj;
context = qse_stx_alloc_word_object(
stx, QSE_NULL, QSE_STX_CONTEXT_SIZE, QSE_NULL, 0);
obj = (qse_stx_context_t*)QSE_STX_OBJPTR(stx,context);
obj->header.class = qse_stx_lookup_class(stx,QSE_T("Context"));
obj->ip = QSE_STX_TO_SMALLINT(0);
obj->method = method;
obj->arguments = args;
obj->temporaries = temp;
return context;
}
static qse_byte_t __fetch_byte (
qse_stx_t* stx, qse_stx_context_t* context_obj)
{
qse_word_t ip, method;
QSE_ASSERT (QSE_STX_ISSMALLINT(context_obj->ip));
ip = QSE_STX_FROMSMALLINT(context_obj->ip);
method = context_obj->method;
/* increment instruction pointer */
context_obj->ip = QSE_STX_TO_SMALLINT(ip + 1);
qse_assert (QSE_STX_TYPE(stx,method) == QSE_STX_BYTE_INDEXED);
return QSE_STX_BYTE_AT(stx,method,ip);
}
int qse_stx_run_context (qse_stx_t* stx, qse_word_t context)
{
qse_byte_t byte, operand;
qse_stx_context_t* context_obj;
context_obj = (qse_stx_context_t*)QSE_STX_OBJPTR(stx,context);
while (!stx->__wantabort)
{
/* check_process_switch (); // hopefully */
byte = __fetch_byte (stx, context_obj);
#ifdef _DOS
printf (QSE_T("code: %x\n"), byte);
#else
qse_printf (QSE_T("code: %x\n"), byte);
#endif
switch (byte) {
case PUSH_OBJECT:
operand = __fetch_byte (stx, context_obj);
break;
case SEND_UNARY_MESSAGE:
operand = __fetch_byte (stx, context_obj);
break;
case HALT:
goto exit_run_context;
}
}
exit_run_context:
return 0;
}

View File

@ -1,43 +0,0 @@
/*
* $Id: context.h 118 2008-03-03 11:21:33Z baconevi $
*/
#ifndef _QSE_STX_CONTEXT_H_
#define _QSE_STX_CONTEXT_H_
#include <qse/stx/stx.h>
#define PUSH_OBJECT 0xA0
#define SEND_UNARY_MESSAGE 0xB0
#define HALT 0xFF
#define QSE_STX_CONTEXT_SIZE 4
#define QSE_STX_CONTEXT_IP 0
#define QSE_STX_CONTEXT_METHOD 1
#define QSE_STX_CONTEXT_ARGUMENTS 2
#define QSE_STX_CONTEXT_TEMPORARIES 3
struct qse_stx_context_t
{
qse_stx_objhdr_t header;
qse_word_t ip;
qse_word_t method;
qse_word_t arguments;
qse_word_t temporaries;
};
typedef struct qse_stx_context_t qse_stx_context_t;
#ifdef __cplusplus
extern "C" {
#endif
qse_word_t qse_stx_new_context (qse_stx_t* stx,
qse_word_t method, qse_word_t args, qse_word_t temp);
int qse_stx_run_context (qse_stx_t* stx, qse_word_t context);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,299 +0,0 @@
/*
* $Id$
*/
#include "stx.h"
#include <qse/cmn/str.h>
/* NOTE:
* The code here implements SystemDictionary whose key is always a symbol.
* Dictionary, on the contrary, can accept any object as a key.
*/
struct qse_stx_association_t
{
qse_stx_objhdr_t h;
qse_word_t key;
qse_word_t value;
};
typedef struct qse_stx_association_t qse_stx_association_t;
struct qse_stx_systemdictionary_t
{
qse_stx_objhdr_t h;
qse_word_t tally;
/* variable part begins here */
qse_word_t slot[1];
};
typedef struct qse_stx_systemdictionary_t qse_stx_systemdictionary_t;
static qse_word_t new_association (
qse_stx_t* stx, qse_word_t key, qse_word_t value)
{
#if 0
qse_word_t x;
x = qse_stx_allocwordobj (
stx, QSE_NULL, QSE_STX_ASSOCIATION_SIZE, QSE_NULL, 0);
if (ISNIL(stx,x)) return stx->ref.nil;
OBJCLASS(stx,x) = stx->ref.class_association;
WORDAT(stx,x,QSE_STX_ASSOCIATION_KEY) = key;
WORDAT(stx,x,QSE_STX_ASSOCIATION_VALUE) = value;
return x;
#endif
qse_word_t x;
QSE_ASSERT (REFISIDX(stx,stx->ref.class_association));
QSE_ASSERT (!ISNIL(stx,stx->ref.class_association));
x = qse_stx_instantiate (
stx, stx->ref.class_association, QSE_NULL, QSE_NULL, 0);
if (!ISNIL(stx,x))
{
WORDAT(stx,x,QSE_STX_ASSOCIATION_KEY) = key;
WORDAT(stx,x,QSE_STX_ASSOCIATION_VALUE) = value;
}
return x;
}
static qse_word_t expand (qse_stx_t* stx, qse_word_t dic)
{
qse_word_t oldcapa, newdic, newcapa;
qse_stx_systemdictionary_t* oldptr, * newptr;
QSE_ASSERT (REFISIDX(stx,stx->ref.class_systemdictionary));
QSE_ASSERT (!ISNIL(stx,stx->ref.class_systemdictionary));
QSE_ASSERTX (
REFISIDX(stx,dic),
"The reference is not an object index"
);
/* WARNING:
* if this assertion fails, adjust the initial size of the
* system dicionary. i don't want this function to be called
* during the bootstrapping.
*/
QSE_ASSERT (OBJCLASS(stx,dic) == stx->ref.class_systemdictionary);
/* get the current capacity excluding the tally field */
oldcapa = OBJSIZE(stx,dic) - 1;
/* instantiate a new dictionary with its capacity doubled.
* 1 fixed slot for the tally field is encoded is the class part.
* so 'newcapa' specifies the number of slots to hold associations */
newcapa = oldcapa * 2;
newdic = qse_stx_instantiate (
stx, OBJCLASS(stx,dic),
QSE_NULL, QSE_NULL, newcapa
);
if (ISNIL(stx,newdic)) return stx->ref.nil;
/* get object pointers for easier access without using macros */
oldptr = (qse_stx_systemdictionary_t*)PTRBYREF(stx,dic);
newptr = (qse_stx_systemdictionary_t*)PTRBYREF(stx,newdic);
newptr->tally = INTTOREF(stx,0);
QSE_ASSERT (newcapa == OBJSIZE(stx,newdic)-1);
/* reorganize the dictionary */
while (oldcapa > 0)
{
qse_word_t assoc;
assoc = oldptr->slot[--oldcapa];
if (!ISNIL(stx,assoc))
{
qse_word_t index;
index = qse_stx_hashobj (stx, WORDAT(stx,assoc,QSE_STX_ASSOCIATION_KEY)) % newcapa;
while (!ISNIL(stx,newptr->slot[index]))
index = (index + 1) % newcapa;
newptr->slot[index] = assoc;
}
}
newptr->tally = oldptr->tally;
/* TODO: explore if dic can be immediately destroyed. */
qse_stx_swapmem (stx, REFTOIDX(stx,dic), REFTOIDX(stx,newdic));
return dic;
}
static qse_word_t find_basic_index (
qse_stx_t* stx, qse_word_t dic, qse_word_t key)
{
qse_word_t capa, index;
qse_stx_systemdictionary_t* dicptr;
/* ensure that dic is a system dictionary */
QSE_ASSERT (REFISIDX(stx,dic));
QSE_ASSERT (OBJTYPE(stx,dic) == WORDOBJ);
QSE_ASSERT (dic == stx->ref.sysdic ||
OBJCLASS(stx,dic) == stx->ref.class_systemdictionary);
/* ensure that the key is a symbol */
QSE_ASSERT (REFISIDX(stx,key));
QSE_ASSERT (OBJCLASS(stx,key) == stx->ref.class_symbol);
QSE_ASSERT (OBJTYPE(stx,key) == CHAROBJ);
capa = OBJSIZE(stx,dic) - 1; /* exclude the tally field */
index = qse_stx_hashobj (stx, key) % capa;
dicptr = (qse_stx_systemdictionary_t*)PTRBYREF(stx,dic);
do
{
qse_word_t assoc, sym;
assoc = dicptr->slot[index];
if (ISNIL(stx,assoc)) break; /* not found */
sym = WORDAT (stx, assoc, QSE_STX_ASSOCIATION_KEY);
/* make sure that the key is a symbol */
QSE_ASSERT (REFISIDX(stx,sym));
QSE_ASSERT (OBJCLASS(stx,sym) == stx->ref.class_symbol);
QSE_ASSERT (OBJTYPE(stx,sym) == CHAROBJ);
/* check if the key matches */
if (qse_strxncmp(
&CHARAT(stx,key,0), OBJSIZE(stx,key),
&CHARAT(stx,sym,0), OBJSIZE(stx,sym)) == 0) break;
index = (index + 1) % capa;
}
while (1);
/* Include the tally back when returning the association index.
* you can access the association with WORDAT() by using this index. */
return index + 1;
}
/* look up a system dictionary by a null-terminated string */
qse_word_t qse_stx_lookupdic (
qse_stx_t* stx, qse_word_t dic, const qse_char_t* skey)
{
qse_word_t capa, index;
qse_stx_systemdictionary_t* dicptr;
QSE_ASSERT (REFISIDX(stx,dic));
QSE_ASSERT (OBJTYPE(stx,dic) == WORDOBJ);
QSE_ASSERT (dic == stx->ref.sysdic ||
OBJCLASS(stx,dic) == stx->ref.class_systemdictionary);
capa = OBJSIZE(stx,dic) - 1; /* exclude the tally field */
index = qse_stx_hashstr (stx, skey) % capa;
dicptr = (qse_stx_systemdictionary_t*)PTRBYREF(stx,dic);
do
{
qse_word_t assoc, keyref;
assoc = dicptr->slot[index];
if (ISNIL(stx,assoc)) break; /* not found */
keyref = WORDAT(stx,assoc,QSE_STX_ASSOCIATION_KEY);
QSE_ASSERT (REFISIDX(stx,keyref));
QSE_ASSERT (OBJCLASS(stx,keyref) == stx->ref.class_symbol);
QSE_ASSERT (OBJTYPE(stx,keyref) == CHAROBJ);
if (qse_strxcmp (
&CHARAT(stx,keyref,0), OBJSIZE(stx,keyref),
skey) == 0) break;
index = (index + 1) % capa;
}
while (1);
return dicptr->slot[index];
}
qse_word_t qse_stx_getdic (qse_stx_t* stx, qse_word_t dic, qse_word_t key)
{
/* returns the association for the key. nil if it is not found */
return WORDAT (stx, dic, find_basic_index (stx, dic, key));
}
qse_word_t qse_stx_putdic (
qse_stx_t* stx, qse_word_t dic, qse_word_t key, qse_word_t value)
{
qse_word_t index, capa, tally, assoc;
qse_stx_systemdictionary_t* dicptr;
/* the dicionary must have at least one slot excluding tally */
QSE_ASSERT (OBJSIZE(stx,dic) > 1);
capa = OBJSIZE(stx,dic) - 1;
dicptr = (qse_stx_systemdictionary_t*)PTRBYREF(stx,dic);
tally = REFTOINT(stx,dicptr->tally);
index = find_basic_index (stx, dic, key) - 1;
assoc = dicptr->slot[index];
/*assoc = WORDAT(stx,dic,slot);*/
if (ISNIL(stx,assoc))
{
/* the key is not found */
if (tally + 1 >= capa)
{
/* Enlarge the dictionary if there is one free slot left.
* The last free slot left is always maintained to be nil.
* The nil slot plays multiple roles.
* - make sure that lookup never enters a infinite loop.
* - the slot's index can be returned when no key is found.
*/
if (ISNIL(stx, expand (stx, dic))) return stx->ref.nil;
capa = OBJSIZE(stx,dic) - 1;
dicptr = (qse_stx_systemdictionary_t*)PTRBYREF(stx,dic);
/* tally must remain the same after expansion */
QSE_ASSERT (tally == REFTOINT(stx,dicptr->tally));
/* find the key in the expanded dictionary again */
index = find_basic_index (stx, dic, key) - 1;
/* the basic index returned must point to nil meaning
* the key is not found */
QSE_ASSERT (ISNIL(stx,dicptr->slot[index]));
}
assoc = new_association (stx, key, value);
if (ISNIL(stx,assoc)) return stx->ref.nil;
dicptr->slot[index] = assoc;
dicptr->tally = INTTOREF(stx,tally+1);
}
else
{
/* found the key. change the value */
WORDAT(stx,assoc,QSE_STX_ASSOCIATION_VALUE) = value;
}
return assoc;
}
#if 0
void qse_stx_walkdic (
qse_stx_t* stx, qse_word_t dic,
void (*func) (qse_stx_t*,qse_word_t,void*), void* data)
{
qse_word_t index, assoc;
qse_word_t size = OBJSIZE(stx,dic);
for (index = 1; index < size; index++)
{
assoc = WORDAT (stx, dic, index);
if (assoc == stx->nil) continue;
func (stx, assoc, data);
}
}
#endif

View File

@ -1,51 +0,0 @@
/*
* $Id$
*/
#ifndef _QSE_LIB_STX_DIC_H_
#define _QSE_LIB_STX_DIC_H_
#define QSE_STX_ASSOCIATION_SIZE 2
#define QSE_STX_ASSOCIATION_KEY 0
#define QSE_STX_ASSOCIATION_VALUE 1
/* The SystemDictionary is a variable word class.
* The info below is for the fixed part only */
#define QSE_STX_SYSTEMDICTIONARY_SIZE 1
#define QSE_STX_SYSTEMDICTIONARY_TALLY 0
#ifdef __cplusplus
extern "C"
#endif
qse_word_t qse_stx_lookupdic (
qse_stx_t* stx,
qse_word_t dic,
const qse_char_t* key
);
qse_word_t qse_stx_getdic (
qse_stx_t* stx,
qse_word_t dic,
qse_word_t key
);
qse_word_t qse_stx_putdic (
qse_stx_t* stx,
qse_word_t dic,
qse_word_t key,
qse_word_t value
);
void qse_stx_walkdic (
qse_stx_t* stx,
qse_word_t dic,
void (*func) (qse_stx_t*,qse_word_t,void*),
void* data
);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,134 +0,0 @@
/*
* $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/>.
*/
#include "stx.h"
#include "../cmn/mem.h"
#include <qse/cmn/str.h>
const qse_char_t* qse_stx_dflerrstr (qse_stx_t* stx, qse_stx_errnum_t errnum)
{
static const qse_char_t* errstr[] =
{
QSE_T("no error"),
QSE_T("out of memory"),
QSE_T("internal error"),
QSE_T("exit"),
QSE_T("end of source"),
QSE_T("I/O error"),
QSE_T("unexpected end of string"),
QSE_T("bad sharp expression"),
QSE_T("wrong use of dot"),
QSE_T("left parenthesis expected"),
QSE_T("right parenthesis expected"),
QSE_T("list too deep"),
QSE_T("bad variable"),
QSE_T("bad arguments"),
QSE_T("too few arguments"),
QSE_T("too many arguments"),
QSE_T("undefined function '${0}'"),
QSE_T("bad function"),
QSE_T("duplicate formal"),
QSE_T("bad symbol"),
QSE_T("undefined symbol '${0}'"),
QSE_T("empty body"),
QSE_T("bad value"),
QSE_T("divide by zero")
};
return (errnum >= 0 && errnum < QSE_COUNTOF(errstr))?
errstr[errnum]: QSE_T("unknown error");
}
qse_stx_errstr_t qse_stx_geterrstr (qse_stx_t* stx)
{
return stx->err.str;
}
void qse_stx_seterrstr (qse_stx_t* stx, qse_stx_errstr_t errstr)
{
stx->err.str = errstr;
}
qse_stx_errnum_t qse_stx_geterrnum (qse_stx_t* stx)
{
return stx->err.num;
}
const qse_stx_loc_t* qse_stx_geterrloc (qse_stx_t* stx)
{
return &stx->err.loc;
}
const qse_char_t* qse_stx_geterrmsg (qse_stx_t* stx)
{
return (stx->err.msg[0] == QSE_T('\0'))?
qse_stx_geterrstr(stx)(stx,stx->err.num): stx->err.msg;
}
void qse_stx_geterror (
qse_stx_t* stx, qse_stx_errnum_t* errnum,
const qse_char_t** errmsg, qse_stx_loc_t* errloc)
{
if (errnum != QSE_NULL) *errnum = stx->err.num;
if (errmsg != QSE_NULL)
{
*errmsg = (stx->err.msg[0] == QSE_T('\0'))?
qse_stx_geterrstr(stx)(stx,stx->err.num):
stx->err.msg;
}
if (errloc != QSE_NULL) *errloc = stx->err.loc;
}
void qse_stx_seterrnum (
qse_stx_t* stx, qse_stx_errnum_t errnum, const qse_cstr_t* errarg)
{
qse_stx_seterror (stx, errnum, errarg, QSE_NULL);
}
void qse_stx_seterrmsg (
qse_stx_t* stx, qse_stx_errnum_t errnum,
const qse_char_t* errmsg, const qse_stx_loc_t* errloc)
{
stx->err.num = errnum;
qse_strxcpy (stx->err.msg, QSE_COUNTOF(stx->err.msg), errmsg);
if (errloc != QSE_NULL) stx->err.loc = *errloc;
else QSE_MEMSET (&stx->err.loc, 0, QSE_SIZEOF(stx->err.loc));
}
void qse_stx_seterror (
qse_stx_t* stx, qse_stx_errnum_t errnum,
const qse_cstr_t* errarg, const qse_stx_loc_t* errloc)
{
const qse_char_t* errfmt;
stx->err.num = errnum;
errfmt = qse_stx_geterrstr(stx)(stx,stx->err.num);
QSE_ASSERT (errfmt != QSE_NULL);
qse_strxfncpy (stx->err.msg, QSE_COUNTOF(stx->err.msg), errfmt, errarg);
if (errloc != QSE_NULL) stx->err.loc = *errloc;
else QSE_MEMSET (&stx->err.loc, 0, QSE_SIZEOF(stx->err.loc));
}

View File

@ -1,89 +0,0 @@
/*
* $Id$
*/
#include "stx.h"
#include <qse/cmn/str.h>
qse_word_t qse_stx_hashbytes (qse_stx_t* stx, const void* data, qse_word_t len)
{
qse_word_t h = 0;
qse_byte_t* bp, * be;
bp = (qse_byte_t*)data; be = bp + len;
while (bp < be) h = h * 31 + *bp++;
return h;
}
qse_word_t qse_stx_hashstr (qse_stx_t* stx, const qse_char_t* str)
{
qse_word_t h = 0;
qse_byte_t* bp, * be;
const qse_char_t* p = str;
while (*p != QSE_T('\0'))
{
bp = (qse_byte_t*)p;
be = bp + QSE_SIZEOF(qse_char_t);
while (bp < be) h = h * 31 + *bp++;
p++;
}
return h;
}
qse_word_t qse_stx_hashstrn (
qse_stx_t* stx, const qse_char_t* str, qse_word_t len)
{
return qse_stx_hashbytes (stx, str, len * QSE_SIZEOF(*str));
}
qse_word_t qse_stx_hashobj (qse_stx_t* stx, qse_word_t ref)
{
qse_word_t hv;
if (REFISINT(stx, ref))
{
qse_word_t tmp = REFTOINT(stx, ref);
hv = qse_stx_hashbytes (stx, &tmp, QSE_SIZEOF(tmp));
}
else
{
switch (OBJTYPE(stx,ref))
{
case BYTEOBJ:
hv = qse_stx_hashbytes (
stx,
BYTEPTR(stx,ref),
BYTELEN(stx,ref)
);
break;
case CHAROBJ:
/* the additional null is not taken into account */
hv = qse_stx_hashbytes (
stx,
&CHARAT(stx,ref,0),
OBJSIZE(stx,ref) * QSE_SIZEOF(qse_char_t)
);
break;
case WORDOBJ:
hv = qse_stx_hashbytes (
stx,
&WORDAT(stx,ref,0),
OBJSIZE(stx,ref) * QSE_SIZEOF(qse_word_t)
);
break;
default:
QSE_ASSERT (
!"This must never happen"
);
break;
}
}
return hv;
}

View File

@ -1,40 +0,0 @@
/*
* $Id$
*/
#ifndef _QSE_LIB_STX_MISC_H_
#define _QSE_LIB_STX_MISC_H_
#ifdef __cplusplus
extern "C" {
#endif
qse_word_t qse_stx_hashbytes (
qse_stx_t* stx,
const void* data,
qse_word_t len
);
qse_word_t qse_stx_hashstr (
qse_stx_t* stx,
const qse_char_t* str
);
qse_word_t qse_stx_hashstrn (
qse_stx_t* stx,
const qse_char_t* str,
qse_word_t len
);
qse_word_t qse_stx_hashobj (
qse_stx_t* stx,
qse_word_t ref
);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,380 +0,0 @@
/*
* $Id: interp.c 118 2008-03-03 11:21:33Z baconevi $
*/
#include <qse/stx/interp.h>
#include <qse/stx/method.h>
#include <qse/stx/object.h>
#include <qse/stx/array.h>
#include <qse/stx/class.h>
#include <qse/bas/assert.h>
#include <qse/bas/memory.h>
/*
activation record
....
....
....
-------------------
previous stack_base
-------------------
method
-------------------
pc
-------------------
temporaries
-------------------
arguments
-------------------
receiver
------------------- <----- current stack_base
....
....
....
*/
struct process_t
{
qse_word_t* stack;
qse_word_t stack_size;
qse_word_t stack_base;
qse_word_t stack_top;
qse_word_t receiver;
qse_word_t method;
qse_word_t pc;
/* cached information about the method above */
qse_word_t* literals;
qse_byte_t* bytecodes;
qse_word_t bytecode_size;
qse_size_t argcount;
qse_size_t tmpcount;
};
typedef struct process_t process_t;
static int __run_process (qse_stx_t* stx, process_t* proc);
static int __push_to_stack (qse_stx_t* stx,
process_t* proc, qse_word_t what, qse_word_t index);
static int __store_from_stack (qse_stx_t* stx,
process_t* proc, qse_word_t what, qse_word_t index);
static int __send_message (qse_stx_t* stx, process_t* proc,
qse_word_t nargs, qse_word_t selector, qse_bool_t to_super);
static int __return_from_message (qse_stx_t* stx, process_t* proc);
static int __dispatch_primitive (qse_stx_t* stx, process_t* proc, qse_word_t no);
int qse_stx_interp (qse_stx_t* stx, qse_word_t receiver, qse_word_t method)
{
process_t proc;
qse_stx_method_t* mthobj;
qse_word_t i;
int n;
// TODO: size of process stack.
proc.stack = (qse_word_t*)qse_malloc (10000 * qse_sizeof(qse_word_t));
if (proc.stack == QSE_NULL) {
qse_printf (QSE_T("out of memory in qse_stx_interp\n"));
return -1;
}
proc.stack_size = 10000;
proc.stack_base = 0;
proc.stack_top = 0;
mthobj = (qse_stx_method_t*)QSE_STX_OBJPTR(stx,method);
qse_assert (mthobj != QSE_NULL);
proc.literals = mthobj->literals;
proc.bytecodes = QSE_STX_DATA(stx, mthobj->bytecodes);
proc.bytecode_size = QSE_STX_SIZE(stx, mthobj->bytecodes);
/* TODO: disable the method with arguments for start-up */
proc.argcount = QSE_STX_FROMSMALLINT(mthobj->argcount);
proc.tmpcount = QSE_STX_FROMSMALLINT(mthobj->tmpcount);
proc.receiver = receiver;
proc.method = method;
proc.pc = 0;
proc.stack_base = proc.stack_top;
/* push the receiver */
proc.stack[proc.stack_top++] = receiver;
/* push arguments */
for (i = 0; i < proc.argcount; i++) {
proc.stack[proc.stack_top++] = stx->nil;
}
/* secure space for temporaries */
for (i = 0; i < proc.tmpcount; i++)
proc.stack[proc.stack_top++] = stx->nil;
/* push dummy pc */
proc.stack[proc.stack_top++] = 0;
/* push dummy method */
proc.stack[proc.stack_top++] = stx->nil;
/* push dummy previous stack base */
proc.stack[proc.stack_top++] = 0;
n = __run_process (stx, &proc);
qse_free (proc.stack);
return n;
}
static int __run_process (qse_stx_t* stx, process_t* proc)
{
int code, next, next2;
while (proc->pc < proc->bytecode_size) {
code = proc->bytecodes[proc->pc++];
#ifdef DEBUG
qse_printf (QSE_T("code = 0x%x\n"), code);
#endif
if (code >= 0x00 && code <= 0x3F) {
/* stack - push */
__push_to_stack (stx, proc, code >> 4, code & 0x0F);
}
else if (code >= 0x40 && code <= 0x5F) {
/* stack - store */
int what = code >> 4;
int index = code & 0x0F;
__store_from_stack (stx, proc, code >> 4, code & 0x0F);
}
/* TODO: more here .... */
else if (code == 0x67) {
/* pop stack top */
proc->stack_top--;
}
/* TODO: more here .... */
else if (code == 0x6A) {
proc->stack[proc->stack_top++] = stx->nil;
}
else if (code == 0x6B) {
proc->stack[proc->stack_top++] = stx->true;
}
else if (code == 0x6C) {
proc->stack[proc->stack_top++] = stx->false;
}
else if (code == 0x6D) {
/* push receiver */
proc->stack[proc->stack_top++] = proc->receiver;
}
/* TODO: more here .... */
else if (code == 0x70) {
/* send message to self */
next = proc->bytecodes[proc->pc++];
if (__send_message (stx, proc, next >> 5,
proc->literals[next & 0x1F], qse_false) == -1) break;
}
else if (code == 0x71) {
/* send message to super */
next = proc->bytecodes[proc->pc++];
if (__send_message (stx, proc, next >> 5,
proc->literals[next & 0x1F], qse_true) == -1) break;
}
else if (code == 0x72) {
/* send message to self extended */
next = proc->bytecodes[proc->pc++];
next2 = proc->bytecodes[proc->pc++];
if (__send_message (stx, proc, next >> 5,
proc->literals[next2], qse_false) == -1) break;
}
else if (code == 0x73) {
/* send message to super extended */
next = proc->bytecodes[proc->pc++];
next2 = proc->bytecodes[proc->pc++];
if (__send_message (stx, proc, next >> 5,
proc->literals[next2], qse_true) == -1) break;
}
/* more code .... */
else if (code == 0x78) {
/* return receiver */
proc->stack[proc->stack_top++] = proc->receiver;
if (__return_from_message (stx, proc) == -1) break;
}
else if (code == 0x7C) {
/* return from message */
if (__return_from_message (stx, proc) == -1) break;
}
else if (code >= 0xF0 && code <= 0xFF) {
/* primitive */
next = proc->bytecodes[proc->pc++];
__dispatch_primitive (stx, proc, ((code & 0x0F) << 8) | next);
}
else {
qse_printf (QSE_T("INVALID OPCODE...........\n"));
break;
}
}
return 0;
}
static int __push_to_stack (qse_stx_t* stx,
process_t* proc, qse_word_t what, qse_word_t index)
{
switch (what) {
case 0: /* receiver variable */
proc->stack[proc->stack_top++] =
QSE_STX_WORD_AT(stx, proc->stack[proc->stack_base], index);
break;
case 1: /* temporary variable */
proc->stack[proc->stack_top++] =
proc->stack[proc->stack_base + 1 + index];
break;
case 2: /* literal constant */
proc->stack[proc->stack_top++] = proc->literals[index];
break;
case 3: /* literal variable */
break;
}
return 0;
}
static int __store_from_stack (qse_stx_t* stx,
process_t* proc, qse_word_t what, qse_word_t index)
{
switch (what) {
case 4: /* receiver variable */
QSE_STX_WORD_AT(stx,proc->stack[proc->stack_base],index) = proc->stack[--proc->stack_top];
break;
case 5: /* temporary location */
proc->stack[proc->stack_base + 1 + index] = proc->stack[--proc->stack_top];
break;
}
return 0;
}
static int __send_message (qse_stx_t* stx, process_t* proc,
qse_word_t nargs, qse_word_t selector, qse_bool_t to_super)
{
qse_word_t receiver, method;
qse_word_t i, tmpcount, argcount;
qse_stx_method_t* mthobj;
qse_assert (QSE_STX_CLASS(stx,selector) == stx->class_symbol);
receiver = proc->stack[proc->stack_top - nargs - 1];
method = qse_stx_lookup_method (
stx, QSE_STX_CLASS(stx,receiver),
QSE_STX_DATA(stx,selector), to_super);
if (method == stx->nil) {
qse_printf (QSE_T("cannot find the method....\n"));
return -1;
}
mthobj = (qse_stx_method_t*)QSE_STX_OBJPTR(stx,method);
argcount = QSE_STX_FROMSMALLINT(mthobj->argcount);
tmpcount = QSE_STX_FROMSMALLINT(mthobj->tmpcount);
qse_assert (argcount == nargs);
/* secure space for temporaries */
for (i = 0; i < tmpcount; i++) {
proc->stack[proc->stack_top++] = stx->nil;
}
/* push pc */
proc->stack[proc->stack_top++] = proc->pc;
/* push method */
proc->stack[proc->stack_top++] = proc->method;
/* push previous stack base */
proc->stack[proc->stack_top++] = proc->stack_base;
proc->stack_base = proc->stack_top - 3 - tmpcount - argcount - 1;
qse_assert (proc->stack_base > 0);
proc->receiver = receiver;
proc->method = method;
proc->pc = 0;
proc->literals = mthobj->literals;
proc->bytecodes = QSE_STX_DATA(stx, mthobj->bytecodes);
proc->bytecode_size = QSE_STX_SIZE(stx, mthobj->bytecodes);
proc->argcount = argcount;
proc->tmpcount = tmpcount;
return 0;
}
static int __return_from_message (qse_stx_t* stx, process_t* proc)
{
qse_word_t method, pc, stack_base;
qse_stx_method_t* mthobj;
if (proc->stack_base == 0) {
/* return from the startup method */
return -1;
}
stack_base = proc->stack[proc->stack_base + 1 + proc->tmpcount + proc->argcount + 2];
method = proc->stack[proc->stack_base + 1 + proc->tmpcount + proc->argcount + 1];
pc = proc->stack[proc->stack_base + 1 + proc->tmpcount + proc->argcount];
mthobj = (qse_stx_method_t*)QSE_STX_OBJPTR(stx,method);
qse_assert (mthobj != QSE_NULL);
/* return value is located on top of the previous stack */
proc->stack[proc->stack_base - 1] = proc->stack[proc->stack_top - 1];
/* restore the stack pointers */
proc->stack_top = proc->stack_base;
proc->stack_base = stack_base;
proc->receiver = proc->stack[stack_base];
proc->method = method;
proc->pc = pc;
proc->literals = mthobj->literals;
proc->bytecodes = QSE_STX_DATA(stx, mthobj->bytecodes);
proc->bytecode_size = QSE_STX_SIZE(stx, mthobj->bytecodes);
proc->argcount = QSE_STX_FROMSMALLINT(mthobj->argcount);
proc->tmpcount = QSE_STX_FROMSMALLINT(mthobj->tmpcount);
return 0;
}
static int __dispatch_primitive (qse_stx_t* stx, process_t* proc, qse_word_t no)
{
switch (no) {
case 0:
qse_printf (QSE_T("[[ hello stx smalltalk ]]\n"));
break;
case 1:
qse_printf (QSE_T("<< AMAZING STX SMALLTALK WORLD >>\n"));
break;
case 2:
qse_printf (QSE_T("<< FUNKY STX SMALLTALK >> %d\n"),
QSE_STX_FROMSMALLINT(proc->stack[proc->stack_base + 1]));
break;
case 3:
qse_printf (QSE_T("<< HIGH STX SMALLTALK >> %d, %d\n"),
QSE_STX_FROMSMALLINT(proc->stack[proc->stack_base + 1]),
QSE_STX_FROMSMALLINT(proc->stack[proc->stack_base + 2]));
break;
case 20:
qse_printf (QSE_T("<< PRIMITIVE 20 >>\n"));
break;
}
return 0;
}

View File

@ -1,20 +0,0 @@
/*
* $Id: interp.h 118 2008-03-03 11:21:33Z baconevi $
*/
#ifndef _QSE_STX_INTERP_H_
#define _QSE_STX_INTERP_H_
#include <qse/stx/stx.h>
#ifdef __cplusplus
extern "C" {
#endif
int qse_stx_interp (qse_stx_t* stx, qse_word_t receiver, qse_word_t method);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,31 +0,0 @@
!Object methods!
= aValue
^ self == aValue
!
== aValue
^ <21 self aValue>
!
basicAt: index
^<25 self index>
!
basicAt: index put: value
^<31 self index value>
!
basicSize
^<12 self>
!
isNil
^false.
!
notNil
^false.
!!

View File

@ -1,119 +0,0 @@
/*
* $Id: memory.c 118 2008-03-03 11:21:33Z baconevi $
*/
#include "stx.h"
#include "../cmn/mem.h"
int qse_stx_initmem (qse_stx_t* stx, qse_size_t capa)
{
qse_size_t n;
QSE_ASSERT (capa > 0);
QSE_ASSERTX (
stx->mem.slot == QSE_NULL,
"This function is for internal use. Never call this again after initialization"
);
stx->mem.slot = (qse_stx_objptr_t*) QSE_MMGR_ALLOC (
stx->mmgr,
capa * QSE_SIZEOF(*stx->mem.slot)
);
if (stx->mem.slot == QSE_NULL)
{
qse_stx_seterrnum (stx, QSE_STX_ENOMEM, QSE_NULL);
return -1;
}
stx->mem.capa = capa;
/* weave the free slot list */
stx->mem.free = &stx->mem.slot[0];
for (n = 0; n < capa - 1; n++)
{
stx->mem.slot[n] = (qse_stx_objptr_t)&stx->mem.slot[n + 1];
}
stx->mem.slot[n] = QSE_NULL;
return 0;
}
void qse_stx_finimem (qse_stx_t* stx)
{
/* TODO: free all linked objects... */
QSE_MMGR_FREE (stx->mmgr, stx->mem.slot);
stx->mem.capa = 0;
stx->mem.slot = QSE_NULL;
stx->mem.free = QSE_NULL;
}
void qse_stx_gcmem (qse_stx_t* stx)
{
/* TODO: implement this function */
}
qse_stx_objidx_t qse_stx_allocmem (qse_stx_t* stx, qse_size_t nbytes)
{
qse_stx_objptr_t* slot;
qse_stx_objptr_t objptr;
/* find the free object slot */
if (stx->mem.free == QSE_NULL)
{
qse_stx_gcmem (stx);
if (stx->mem.free == QSE_NULL)
{
/* ran out of object table slots */
/* TODO: NEED TO USE a different error code??? */
qse_stx_seterrnum (stx, QSE_STX_ENOMEM, QSE_NULL);
return QSE_STX_OBJIDX_INVALID;
}
}
/* TODO: memory allocation by region.. instead of calling individual QSE_MMGR_ALLOC
* compaction in gc... etc
*/
objptr = (qse_stx_objptr_t) QSE_MMGR_ALLOC (stx->mmgr, nbytes);
if (objptr == QSE_NULL)
{
qse_stx_gcmem (stx);
objptr = (qse_stx_objptr_t) QSE_MMGR_ALLOC (stx->mmgr, nbytes);
if (objptr == QSE_NULL)
{
/* ran out of object memory */
qse_stx_seterrnum (stx, QSE_STX_ENOMEM, QSE_NULL);
return QSE_STX_OBJIDX_INVALID;
}
}
slot = stx->mem.free;
stx->mem.free = (qse_stx_objptr_t*)*slot;
*slot = objptr;
QSE_MEMSET (objptr, 0, nbytes);
return (qse_stx_objidx_t)(slot - stx->mem.slot);
}
void qse_stx_freemem (qse_stx_t* stx, qse_stx_objidx_t objidx)
{
/*
* THIS IS PRIMITIVE LOW-LEVEL DEALLOC. THIS WILL NOT
* DEALLOCATE MEMORY ALLOCATED FOR ITS INSTANCE VARIABLES.
*/
QSE_MMGR_FREE (stx->mmgr, stx->mem.slot[objidx]);
stx->mem.slot[objidx] = (qse_stx_objptr_t)stx->mem.free;
stx->mem.free = &stx->mem.slot[objidx];
}
void qse_stx_swapmem (qse_stx_t* stx, qse_stx_objidx_t idx1, qse_stx_objidx_t idx2)
{
qse_stx_objptr_t tmp;
tmp = stx->mem.slot[idx1];
stx->mem.slot[idx1] = stx->mem.slot[idx2];
stx->mem.slot[idx2] = tmp;
}

View File

@ -1,45 +0,0 @@
/*
* $Id$
*/
#ifndef _QSE_LIB_STX_MEM_H_
#define _QSE_LIB_STX_MEM_H_
#ifdef __cplusplus
extern "C" {
#endif
int qse_stx_initmem (
qse_stx_t* stx,
qse_size_t capa
);
void qse_stx_finimem (
qse_stx_t* stx
);
void qse_stx_gcmem (
qse_stx_t* stx
);
qse_stx_objidx_t qse_stx_allocmem (
qse_stx_t* stx,
qse_size_t nbytes
);
void qse_stx_freemem (
qse_stx_t* stx,
qse_stx_objidx_t objidx
);
void qse_stx_swapmem (
qse_stx_t* stx,
qse_stx_objidx_t idx1,
qse_stx_objidx_t idx2
);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,50 +0,0 @@
/*
* $Id: method.h 118 2008-03-03 11:21:33Z baconevi $
*/
#ifndef _QSE_STX_METHOD_H_
#define _QSE_STX_METHOD_H_
#include <qse/stx/stx.h>
#define QSE_STX_METHOD_SIZE 5
#define QSE_STX_METHOD_TEXT 0
#define QSE_STX_METHOD_SELECTOR 1
#define QSE_STX_METHOD_BYTECODES 2
#define QSE_STX_METHOD_TMPCOUNT 3
#define QSE_STX_METHOD_ARGCOUNT 4
/* dolphin smalltalk's flags representation
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
-------------------------------------------------------------------------------------------------
| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1| | | | 0| 0| 0| 1|
-------------------------------------------------------------------------------------------------
\----------|-----------/ \----------|----------/ \---------|-----------/ | \---|--/ |
extraIndex arg Count temp Count | flags |
| |
Block flag SmallInteger flag"
*/
struct qse_stx_method_t
{
qse_stx_objhdr_t header;
qse_word_t text;
qse_word_t selector; /* is this necessary? */
qse_word_t bytecodes;
qse_word_t tmpcount;
qse_word_t argcount;
qse_word_t literals[1];
};
typedef struct qse_stx_method_t qse_stx_method_t;
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,212 +0,0 @@
/*
* $Id$
*/
#include "stx.h"
qse_word_t qse_stx_allocwordobj (
qse_stx_t* stx, const qse_word_t* data, qse_word_t nflds,
const qse_word_t* variable_data, qse_word_t variable_nflds)
{
qse_word_t total_nflds;
qse_size_t total_bytes;
qse_stx_objidx_t idx;
qse_word_t ref;
qse_stx_wordobj_t* ptr;
total_nflds = nflds + variable_nflds;
total_bytes =
(total_nflds * QSE_SIZEOF(qse_word_t)) +
QSE_SIZEOF(qse_stx_objhdr_t);
/* TODO: check if n is larger then header.access nfield bits can represent...
* then.... reject .... */
idx = qse_stx_allocmem (stx, total_bytes);
if (idx == QSE_STX_OBJIDX_INVALID) return stx->ref.nil;
ref = IDXTOREF(stx,idx);
ptr = (qse_stx_wordobj_t*)PTRBYIDX(stx,idx);
ptr->h._type = QSE_STX_WORDOBJ;
ptr->h._mark = 0;
ptr->h._refcnt = 0;
ptr->h._size = total_nflds;
ptr->h._class = stx->ref.nil;
ptr->h._backref = ref;
if (variable_data)
{
while (total_nflds > nflds)
{
total_nflds--;
ptr->slot[total_nflds] = variable_data[total_nflds - nflds];
}
}
else
{
while (total_nflds > nflds)
ptr->slot[--total_nflds] = stx->ref.nil;
}
if (data)
{
while (total_nflds > 0)
{
total_nflds--;
ptr->slot[total_nflds] = data[total_nflds];
}
}
else
{
while (total_nflds > 0)
ptr->slot[--total_nflds] = stx->ref.nil;
}
return ref;
}
qse_word_t qse_stx_allocbyteobj (
qse_stx_t* stx, const qse_byte_t* variable_data, qse_word_t variable_nflds)
{
qse_stx_objidx_t idx;
qse_word_t ref;
qse_stx_byteobj_t* ptr;
idx = qse_stx_allocmem (
stx, variable_nflds + QSE_SIZEOF(qse_stx_objhdr_t));
if (idx == QSE_STX_OBJIDX_INVALID) return stx->ref.nil;
ref = QSE_STX_IDXTOREF(stx,idx);
ptr = (qse_stx_byteobj_t*)PTRBYIDX(stx,idx);
ptr->h._type = QSE_STX_BYTEOBJ;
ptr->h._mark = 0;
ptr->h._refcnt = 0;
ptr->h._size = variable_nflds;
ptr->h._class = stx->ref.nil;
ptr->h._backref = ref;
if (variable_data)
{
while (variable_nflds > 0)
{
variable_nflds--;
ptr->slot[variable_nflds] = variable_data[variable_nflds];
}
}
return ref;
}
#if 0
qse_word_t qse_stx_alloc_char_object (
qse_stx_t* stx, const qse_char_t* str)
{
return (str == QSE_NULL)?
qse_stx_alloc_char_objectx (stx, QSE_NULL, 0):
qse_stx_alloc_char_objectx (stx, str, qse_strlen(str));
}
#endif
qse_word_t qse_stx_alloccharobj (
qse_stx_t* stx, const qse_char_t* variable_data, qse_word_t variable_nflds)
{
qse_stx_objidx_t idx;
qse_word_t ref;
qse_stx_charobj_t* ptr;
qse_size_t total_bytes;
total_bytes =
(variable_nflds + 1) * QSE_SIZEOF(qse_char_t) +
QSE_SIZEOF(qse_stx_objhdr_t);
idx = qse_stx_allocmem (stx, total_bytes);
if (idx == QSE_STX_OBJIDX_INVALID) return stx->ref.nil;
ref = QSE_STX_IDXTOREF(stx,idx);
ptr = (qse_stx_charobj_t*)PTRBYIDX(stx,idx);
ptr->h._type = QSE_STX_CHAROBJ;
ptr->h._mark = 0;
ptr->h._refcnt = 0;
/* the size for the character object does not include
* the extra 1 byte allocated for an implicit terminating
* '\0' character */
ptr->h._size = variable_nflds;
ptr->h._class = stx->ref.nil;
ptr->h._backref = ref;
if (variable_data)
{
while (variable_nflds > 0)
{
variable_nflds--;
ptr->slot[variable_nflds] = variable_data[variable_nflds];
}
}
QSE_ASSERT (ptr->slot[ptr->h._size] == QSE_T('\0'));
return ref;
}
#if 0
qse_word_t qse_stx_allocn_char_object (qse_stx_t* stx, ...)
{
qse_word_t idx, n = 0;
const qse_char_t* p;
qse_va_list ap;
qse_stx_char_object_t* obj;
QSE_ASSERT (stx->ref.nil == QSE_STX_NIL);
qse_va_start (ap, stx);
while ((p = qse_va_arg(ap, const qse_char_t*)) != QSE_NULL) {
n += qse_strlen(p);
}
qse_va_end (ap);
idx = qse_stx_memory_alloc (&stx->memory,
(n + 1) * QSE_SIZEOF(qse_char_t) + QSE_SIZEOF(qse_stx_object_t));
if (idx >= stx->memory.capacity) return idx; /* failed */
idx = QSE_STX_TOOBJIDX(idx);
obj = QSE_STX_CHAR_OBJECT(stx,idx);
obj->header.class = stx->ref.nil;
obj->header.access = (n << 2) | QSE_STX_CHAR_INDEXED;
obj->data[n] = QSE_T('\0');
qse_va_start (ap, stx);
n = 0;
while ((p = qse_va_arg(ap, const qse_char_t*)) != QSE_NULL)
{
while (*p != QSE_T('\0'))
{
/*QSE_STX_CHAR_AT(stx,idx,n++) = *p++;*/
obj->data[n++] = *p++;
}
}
qse_va_end (ap);
return idx;
}
#endif
#if 0
qse_word_t qse_stx_class (qse_stx_t* stx, qse_stx_objref_t obj)
{
return QSE_STX_ISSMALLINT(obj)?
stx->class_smallinteger: QSE_STX_CLASS(stx,obj);
}
qse_word_t qse_stx_classof (qse_stx_t* stx, qse_stx_objref_t obj)
{
return QSE_STX_ISSMALLINT(obj)?
stx->class_smallinteger: QSE_STX_CLASS(stx,obj);
}
qse_word_t qse_stx_sizeof (qse_stx_t* stx, qse_stx_objref_t obj)
{
return QSE_STX_ISSMALLINT(obj)? 1: QSE_STX_SIZE(stx,obj);
}
#endif

View File

@ -1,45 +0,0 @@
/*
* $Id: object.h 118 2008-03-03 11:21:33Z baconevi $
*/
#ifndef _QSE_LIB_STX_OBJ_H_
#define _QSE_LIB_STX_OBJ_H_
#ifdef __cplusplus
extern "C" {
#endif
qse_word_t qse_stx_allocwordobj (
qse_stx_t* stx,
const qse_word_t* data,
qse_word_t nflds,
const qse_word_t* variable_data,
qse_word_t variable_nflds
);
qse_word_t qse_stx_allocbyteobj (
qse_stx_t* stx,
const qse_byte_t* variable_data,
qse_word_t variable_nflds
);
qse_word_t qse_stx_alloccharobj (
qse_stx_t* stx,
const qse_char_t* variable_data,
qse_word_t variable_nflds
);
#if 0
qse_word_t qse_stx_instantiate (
qse_stx_t* stx, qse_word_t class_index, const void* data,
const void* variable_data, qse_word_t variable_nfields);
qse_word_t qse_stx_classof (qse_stx_t* stx, qse_word_t obj);
qse_word_t qse_stx_sizeof (qse_stx_t* stx, qse_word_t obj);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,290 +0,0 @@
/*
* $Id: object.c 118 2008-03-03 11:21:33Z baconevi $
*/
#include <qse/stx/object.h>
#include <qse/stx/memory.h>
#include <qse/stx/symbol.h>
#include <qse/stx/class.h>
#include <qse/stx/misc.h>
/* n: number of instance variables */
qse_word_t qse_stx_alloc_word_object (
qse_stx_t* stx, const qse_word_t* data, qse_word_t nfields,
const qse_word_t* variable_data, qse_word_t variable_nfields)
{
qse_stx_objref_t idx;
qse_word_t n;
qse_stx_word_object_t* obj;
QSE_ASSERT (stx->nil == QSE_STX_NIL);
/* bytes to allocated =
* (number of instance variables +
* number of variable instance variables) * word_size
*/
n = nfields + variable_nfields;
/* TODO: check if n is larger then header.access nfield bits can represent...
* then.... reject .... */
idx = qse_stx_memory_alloc (
&stx->memory,
n * QSE_SIZEOF(qse_word_t) + QSE_SIZEOF(qse_stx_object_t));
if (idx >= stx->memory.capacity) return QSE_STX_OBJREF_INVALID; /* failed TODO: return a difference value OBJIDX_INVALID */
idx = QSE_STX_TOOBJREF(idx);
obj = QSE_STX_WORDOBJPTR(stx,idx);
obj->header.class = stx->nil;
obj->header.access = (n << 2) | QSE_STX_WORD_INDEXED;
if (variable_data == QSE_NULL)
{
while (n > nfields) obj->data[--n] = stx->nil;
}
else
{
while (n > nfields) {
n--; obj->data[n] = variable_data[n - nfields];
}
}
if (data == QSE_NULL)
{
while (n > 0) obj->data[--n] = stx->nil;
}
else
{
while (n > 0)
{
n--; obj->data[n] = data[n];
}
}
return idx;
}
/* n: number of bytes */
qse_word_t qse_stx_alloc_byte_object (
qse_stx_t* stx, const qse_byte_t* data, qse_word_t n)
{
qse_word_t idx;
qse_stx_byte_object_t* obj;
QSE_ASSERT (stx->nil == QSE_STX_NIL);
/* TODO: check if n is larger then header.access nfield bits can represent...
* then.... reject .... */
idx = qse_stx_memory_alloc (
&stx->memory, n + QSE_SIZEOF(qse_stx_object_t));
if (idx >= stx->memory.capacity) return idx; /* failed */
idx = QSE_STX_TOOBJIDX(idx);
obj = QSE_STX_BYTE_OBJECT(stx,idx);
obj->header.class = stx->nil;
obj->header.access = (n << 2) | QSE_STX_BYTE_INDEXED;
if (data == QSE_NULL)
{
while (n-- > 0) obj->data[n] = 0;
}
else
{
while (n-- > 0) obj->data[n] = data[n];
}
return idx;
}
qse_word_t qse_stx_alloc_char_object (
qse_stx_t* stx, const qse_char_t* str)
{
return (str == QSE_NULL)?
qse_stx_alloc_char_objectx (stx, QSE_NULL, 0):
qse_stx_alloc_char_objectx (stx, str, qse_strlen(str));
}
/* n: number of characters */
qse_word_t qse_stx_alloc_char_objectx (
qse_stx_t* stx, const qse_char_t* str, qse_word_t n)
{
qse_word_t idx;
qse_stx_char_object_t* obj;
QSE_ASSERT (stx->nil == QSE_STX_NIL);
/* TODO: check if n is larger then header.access nfield bits can represent...
* then.... reject .... */
idx = qse_stx_memory_alloc (&stx->memory,
(n + 1) * QSE_SIZEOF(qse_char_t) + QSE_SIZEOF(qse_stx_object_t));
if (idx >= stx->memory.capacity) return idx; /* failed */
idx = QSE_STX_TOOBJIDX(idx);
obj = QSE_STX_CHAR_OBJECT(stx,idx);
obj->header.class = stx->nil;
obj->header.access = (n << 2) | QSE_STX_CHAR_INDEXED;
obj->data[n] = QSE_T('\0');
if (str == QSE_NULL)
{
while (n-- > 0) obj->data[n] = QSE_T('\0');
}
else
{
while (n-- > 0) obj->data[n] = str[n];
}
return idx;
}
qse_word_t qse_stx_allocn_char_object (qse_stx_t* stx, ...)
{
qse_word_t idx, n = 0;
const qse_char_t* p;
qse_va_list ap;
qse_stx_char_object_t* obj;
QSE_ASSERT (stx->nil == QSE_STX_NIL);
qse_va_start (ap, stx);
while ((p = qse_va_arg(ap, const qse_char_t*)) != QSE_NULL) {
n += qse_strlen(p);
}
qse_va_end (ap);
idx = qse_stx_memory_alloc (&stx->memory,
(n + 1) * QSE_SIZEOF(qse_char_t) + QSE_SIZEOF(qse_stx_object_t));
if (idx >= stx->memory.capacity) return idx; /* failed */
idx = QSE_STX_TOOBJIDX(idx);
obj = QSE_STX_CHAR_OBJECT(stx,idx);
obj->header.class = stx->nil;
obj->header.access = (n << 2) | QSE_STX_CHAR_INDEXED;
obj->data[n] = QSE_T('\0');
qse_va_start (ap, stx);
n = 0;
while ((p = qse_va_arg(ap, const qse_char_t*)) != QSE_NULL)
{
while (*p != QSE_T('\0'))
{
/*QSE_STX_CHAR_AT(stx,idx,n++) = *p++;*/
obj->data[n++] = *p++;
}
}
qse_va_end (ap);
return idx;
}
qse_word_t qse_stx_hash_object (qse_stx_t* stx, qse_word_t objref)
{
qse_word_t hv;
if (QSE_STX_ISSMALLINT(objref))
{
qse_word_t tmp = QSE_STX_FROMSMALLINT(objref);
hv = qse_stx_hash(&tmp, QSE_SIZEOF(tmp));
}
else if (QSE_STX_ISCHAROBJECT(stx,objref))
{
/* the additional null is not taken into account */
hv = qse_stx_hash (QSE_STX_DATA(stx,objref),
QSE_STX_SIZE(stx,objref) * QSE_SIZEOF(qse_char_t));
}
else if (QSE_STX_ISBYTEOBJECT(stx,objref))
{
hv = qse_stx_hash (
QSE_STX_DATA(stx,objref), QSE_STX_SIZE(stx,objref));
}
else
{
QSE_ASSERT (QSE_STX_ISWORDOBJECT(stx,objref));
hv = qse_stx_hash (QSE_STX_DATA(stx,objref),
QSE_STX_SIZE(stx,objref) * QSE_SIZEOF(qse_word_t));
}
return hv;
}
qse_word_t qse_stx_instantiate (
qse_stx_t* stx, qse_stx_objref_t class, const void* data,
const void* variable_data, qse_word_t variable_nfields)
{
qse_stx_class_t* class_ptr;
qse_word_t spec, nfields, inst;
int indexable;
QSE_ASSERT (class != stx->class_smallinteger);
class_ptr = (qse_stx_class_t*)QSE_STX_OBJPTR(stx, class);
/* don't instantiate a metaclass whose instance must be
created in a different way */
/* TODO: maybe delete the following line */
QSE_ASSERT (QSE_STX_CLASS(class) != stx->class_metaclass);
QSE_ASSERT (QSE_STX_ISSMALLINT(class_obj->spec));
spec = QSE_STX_FROMSMALLINT(class_obj->spec);
nfields = (spec >> QSE_STX_SPEC_INDEXABLE_BITS);
indexable = spec & QSE_STX_SPEC_INDEXABLE_MASK;
switch (indexable)
{
case QSE_STX_SPEC_BYTE_INDEXABLE:
/* variable-size byte class */
QSE_ASSERT (nfields == 0 && data == QSE_NULL);
inst = qse_stx_alloc_byte_object(
stx, variable_data, variable_nfields);
break;
case QSE_STX_SPEC_CHAR_INDEXABLE:
/* variable-size char class */
QSE_ASSERT (nfields == 0 && data == QSE_NULL);
inst = qse_stx_alloc_char_objectx(
stx, variable_data, variable_nfields);
break;
case QSE_STX_SPEC_WORD_INDEXABLE:
/* variable-size class */
inst = qse_stx_alloc_word_object (
stx, data, nfields, variable_data, variable_nfields);
break;
case QSE_STX_SPEC_NOT_INDEXABLE:
/* fixed size */
QSE_ASSERT (indexable == QSE_STX_SPEC_NOT_INDEXABLE);
QSE_ASSERT (variable_nfields == 0 && variable_data == QSE_NULL);
inst = qse_stx_alloc_word_object (
stx, data, nfields, QSE_NULL, 0);
break;
default:
/* this should never happen */
QSE_ASSERTX (0, "this should never happen");
inst = QSE_STX_OBJREF_INVALID;
}
if (inst != QSE_STX_OBJREF_INVALID)
QSE_STX_CLASSOF(stx,inst) = class;
return inst;
}
qse_word_t qse_stx_class (qse_stx_t* stx, qse_stx_objref_t obj)
{
return QSE_STX_ISSMALLINT(obj)?
stx->class_smallinteger: QSE_STX_CLASS(stx,obj);
}
qse_word_t qse_stx_classof (qse_stx_t* stx, qse_stx_objref_t obj)
{
return QSE_STX_ISSMALLINT(obj)?
stx->class_smallinteger: QSE_STX_CLASS(stx,obj);
}
qse_word_t qse_stx_sizeof (qse_stx_t* stx, qse_stx_objref_t obj)
{
return QSE_STX_ISSMALLINT(obj)? 1: QSE_STX_SIZE(stx,obj);
}

View File

@ -1,40 +0,0 @@
/*
* $Id: object.h 118 2008-03-03 11:21:33Z baconevi $
*/
#ifndef _QSE_STX_OBJECT_H_
#define _QSE_STX_OBJECT_H_
#include <qse/stx/stx.h>
#ifdef __cplusplus
extern "C" {
#endif
qse_word_t qse_stx_alloc_word_object (
qse_stx_t* stx, const qse_word_t* data, qse_word_t nfields,
const qse_word_t* variable_data, qse_word_t variable_nfields);
qse_word_t qse_stx_alloc_byte_object (
qse_stx_t* stx, const qse_byte_t* data, qse_word_t n);
qse_word_t qse_stx_alloc_char_object (
qse_stx_t* stx, const qse_char_t* str);
qse_word_t qse_stx_alloc_char_objectx (
qse_stx_t* stx, const qse_char_t* str, qse_word_t n);
qse_word_t qse_stx_allocn_char_object (qse_stx_t* stx, ...);
qse_word_t qse_stx_hash_object (qse_stx_t* stx, qse_word_t object);
qse_word_t qse_stx_instantiate (
qse_stx_t* stx, qse_word_t class_index, const void* data,
const void* variable_data, qse_word_t variable_nfields);
qse_word_t qse_stx_classof (qse_stx_t* stx, qse_word_t obj);
qse_word_t qse_stx_sizeof (qse_stx_t* stx, qse_word_t obj);
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,136 +0,0 @@
/*
* $Id: stc.h 118 2008-03-03 11:21:33Z baconevi $
*/
#ifndef _QSE_LIB_STX_PAR_H_
#define _QSE_LIB_STX_PAR_H_
#include "stx.h"
#include <qse/cmn/str.h>
#include <qse/cmn/lda.h>
enum
{
QSE_STC_ERROR_NONE,
/* system errors */
QSE_STC_ERROR_INPUT_FUNC,
QSE_STC_ERROR_INPUT,
QSE_STC_ERROR_MEMORY,
/* lexical errors */
QSE_STC_ERROR_CHAR,
QSE_STC_ERROR_CHARLIT,
QSE_STC_ERROR_STRLIT,
QSE_STC_ERROR_LITERAL,
/* syntatic error */
QSE_STC_ERROR_MESSAGE_SELECTOR,
QSE_STC_ERROR_ARGUMENT_NAME,
QSE_STC_ERROR_TOO_MANY_ARGUMENTS,
QSE_STC_ERROR_PRIMITIVE_KEYWORD,
QSE_STC_ERROR_PRIMITIVE_NUMBER,
QSE_STC_ERROR_PRIMITIVE_NUMBER_RANGE,
QSE_STC_ERROR_PRIMITIVE_NOT_CLOSED,
QSE_STC_ERROR_TEMPORARIES_NOT_CLOSED,
QSE_STC_ERROR_TOO_MANY_TEMPORARIES,
QSE_STC_ERROR_PSEUDO_VARIABLE,
QSE_STC_ERROR_PRIMARY,
QSE_STC_ERROR_NO_PERIOD,
QSE_STC_ERROR_NO_RPAREN,
QSE_STC_ERROR_BLOCK_ARGUMENT_NAME,
QSE_STC_ERROR_BLOCK_ARGUMENT_LIST,
QSE_STC_ERROR_BLOCK_NOT_CLOSED,
QSE_STC_ERROR_UNDECLARED_NAME,
QSE_STC_ERROR_TOO_MANY_LITERALS
};
enum
{
/* input_func cmd */
QSE_STC_INPUT_OPEN,
QSE_STC_INPUT_CLOSE,
QSE_STC_INPUT_CONSUME,
QSE_STC_INPUT_REWIND
};
typedef struct qse_stc_t qse_stc_t;
struct qse_stc_t
{
qse_mmgr_t* mmgr;
qse_stx_t* stx;
int error_code;
qse_word_t method_class;
qse_str_t method_name;
qse_char_t* temporaries[256]; /* TODO: different size? or dynamic? */
qse_word_t argument_count;
qse_word_t temporary_count;
qse_word_t literals[256]; /* TODO: make it a dynamic array */
qse_word_t literal_count;
qse_lda_t bytecode;
struct
{
int type;
/*
qse_stx_int_t ivalue;
qse_stx_flt_t fvalue;
*/
qse_str_t name;
} token;
qse_cint_t curc;
qse_cint_t ungotc[5];
qse_size_t ungotc_count;
void* input_owner;
int (*input_func) (int cmd, void* owner, void* arg);
};
#ifdef __cplusplus
extern "C" {
#endif
qse_stc_t* qse_stc_open (
qse_mmgr_t* mmgr,
qse_size_t xtnsize,
qse_stx_t* stx
);
void qse_stc_close (
qse_stc_t* stc
);
qse_stc_t* qse_stc_init (
qse_stc_t* stc,
qse_mmgr_t* mmgr,
qse_stx_t* stx
);
void qse_stc_fini (
qse_stc_t* stc
);
int qse_stc_parsemethod (
qse_stc_t* stc,
qse_word_t method_class,
void* input
);
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,107 +0,0 @@
/*
* $Id: parser.h 118 2008-03-03 11:21:33Z baconevi $
*/
#ifndef _QSE_STX_PARSER_H_
#define _QSE_STX_PARSER_H_
#include <qse/stx/stx.h>
#include <qse/stx/name.h>
#include <qse/stx/token.h>
#include <qse/bas/arr.h>
enum
{
QSE_STX_PARSER_ERROR_NONE,
/* system errors */
QSE_STX_PARSER_ERROR_INPUT_FUNC,
QSE_STX_PARSER_ERROR_INPUT,
QSE_STX_PARSER_ERROR_MEMORY,
/* lexical errors */
QSE_STX_PARSER_ERROR_CHAR,
QSE_STX_PARSER_ERROR_CHARLIT,
QSE_STX_PARSER_ERROR_STRLIT,
QSE_STX_PARSER_ERROR_LITERAL,
/* syntatic error */
QSE_STX_PARSER_ERROR_MESSAGE_SELECTOR,
QSE_STX_PARSER_ERROR_ARGUMENT_NAME,
QSE_STX_PARSER_ERROR_TOO_MANY_ARGUMENTS,
QSE_STX_PARSER_ERROR_PRIMITIVE_KEYWORD,
QSE_STX_PARSER_ERROR_PRIMITIVE_NUMBER,
QSE_STX_PARSER_ERROR_PRIMITIVE_NUMBER_RANGE,
QSE_STX_PARSER_ERROR_PRIMITIVE_NOT_CLOSED,
QSE_STX_PARSER_ERROR_TEMPORARIES_NOT_CLOSED,
QSE_STX_PARSER_ERROR_TOO_MANY_TEMPORARIES,
QSE_STX_PARSER_ERROR_PSEUDO_VARIABLE,
QSE_STX_PARSER_ERROR_PRIMARY,
QSE_STX_PARSER_ERROR_NO_PERIOD,
QSE_STX_PARSER_ERROR_NO_RPAREN,
QSE_STX_PARSER_ERROR_BLOCK_ARGUMENT_NAME,
QSE_STX_PARSER_ERROR_BLOCK_ARGUMENT_LIST,
QSE_STX_PARSER_ERROR_BLOCK_NOT_CLOSED,
QSE_STX_PARSER_ERROR_UNDECLARED_NAME,
QSE_STX_PARSER_ERROR_TOO_MANY_LITERALS
};
enum
{
/* input_func cmd */
QSE_STX_PARSER_INPUT_OPEN,
QSE_STX_PARSER_INPUT_CLOSE,
QSE_STX_PARSER_INPUT_CONSUME,
QSE_STX_PARSER_INPUT_REWIND
};
typedef struct qse_stx_parser_t qse_stx_parser_t;
struct qse_stx_parser_t
{
qse_stx_t* stx;
int error_code;
qse_word_t method_class;
qse_stx_name_t method_name;
qse_char_t* temporaries[256]; /* TODO: different size? or dynamic? */
qse_word_t argument_count;
qse_word_t temporary_count;
qse_word_t literals[256]; /* TODO: make it a dynamic array */
qse_word_t literal_count;
qse_arr_t bytecode;
qse_stx_token_t token;
qse_cint_t curc;
qse_cint_t ungotc[5];
qse_size_t ungotc_count;
void* input_owner;
int (*input_func) (int cmd, void* owner, void* arg);
qse_bool_t __dynamic;
};
#ifdef __cplusplus
extern "C" {
#endif
qse_stx_parser_t* qse_stx_parser_open (qse_stx_parser_t* parser, qse_stx_t* stx);
void qse_stx_parser_close (qse_stx_parser_t* parser);
const qse_char_t* qse_stx_parser_error_string (qse_stx_parser_t* parser);
int qse_stx_parser_parse_method (
qse_stx_parser_t* parser, qse_word_t method_class, void* input);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,196 +0,0 @@
~~~ method grammar ~~~
<method definition> ::=
<message pattern>
[<temporaries> ]
[<statements>]
<message pattern> ::= <unary pattern> |
<binary pattern> |
<keyword pattern>
<unary pattern> ::= unarySelector
<binary pattern> ::= binarySelector <method argument>
<keyword pattern> ::= (keyword <method argument>)+
<temporaries> ::= '|' <temporary variable list> '|'
<temporary variable list> ::= identifier*
<block constructor> ::= '[' <block body> ']'
<block body> ::= [<block argument>* '|']
[<temporaries>] [<statements>]
<block argument> ::= ':' identifier
<statements> ::=
(<return statement> ['.'] ) |
(<expression> ['.' [<statements>]])
<return statement> ::= returnOperator <expression>
<expression> ::=
<assignment> |
<basic expression>
<assignment> ::= <assignment target> assignmentOperator <expression>
<basic expression> ::=
<primary> [<messages> <cascaded messages>]
<assignment target> := identifier
<primary> ::=
identifier |
<literal> |
<block constructor> |
( '(' <expression> ')' )
<messages> ::=
(<unary message>+ <binary message>* [<keyword message>] ) |
(<binary message>+ [<keyword message>] ) |
<keyword message>
<unary message> ::= unarySelector
<binary message> ::= binarySelector <binary argument>
<binary argument> ::= <primary> <unary message>*
<keyword message> ::= (keyword <keyword argument> )+
<keyword argument> ::= <primary> <unary message>* <binary message>*
<cascaded messages> ::= (';' <messages>)*
<literal> ::=
<number literal> |
<string literal> |
<character literal> |
<symbol literal> |
<selector literal> |
<array literal>
<number literal> ::= ['-'] <number>
<number> ::= integer | float | scaledDecimal
<character literal> ::= quotedCharacter
<string literal> ::= quotedString
<symbol literal> ::= hashedString
<selector literal> ::= quotedSelector
<array literal> ::= '#(' <array element>* ')'
<array element> ::= <literal> | identifier
reserved identifiers -> nil true false self super
~~~ lexical grammar ~~~
character ::=
"Any character in the implementation-defined character set"
whitespace ::=
"Any non-printing character interpreted as white space
including spaces, tabs, and line breaks"
digit ::=
'0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
uppercaseAlphabetic ::=
'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' |
'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' |
'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z'
lowercaseAlphabetic ::=
'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' |
'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' |
's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z'
nonCaseLetter ::= '_'
letter ::=
uppercaseAlphabetic |
lowercaseAlphabetic |
nonCaseLetter |
"implementation defined letters"
commentDelimiter ::= '"'
nonCommentDelimiter::=
"any character that is not a commentDelimiter "
comment :=
commentDelimiter nonCommentDelimiter * commentDelimiter
identifier ::= letter (letter | digit)*
keyword ::= identifier ':'
binaryCharacter ::=
'!' | '%' | '&' | '*' | '+' | ',' |
'/' | '<' | '=' | '>' | '?' | '@' |
'\' | '~' | '|' | '-'
binarySelector ::= binaryCharacter+
returnOperator ::= '^'
assignmentOperator ::= ':='
integer ::= decimalInteger | radixInteger
decimalInteger ::= digits
digits ::= digit+
radixInteger ::= radixSpecifier 'r' radixDigits
radixSpecifier := digits
radixDigits ::= (digit | uppercaseAlphabetic)+
float ::= mantissa [exponentLetter exponent]
mantissa ::= digits'.' digits
exponent ::= ['-']decimalInteger
exponentLetter ::= 'e' | 'd' | 'q'
scaledDecimal ::= scaledMantissa 's' [fractionalDigits]
scaledMantissa ::= decimalInteger | mantissa
fractionalDigits ::= decimalInteger
quotedCharacter ::= '$' character
quotedString ::= stringDelimiter stringBody stringDelimiter
stringBody ::= (nonStringDelimiter | (stringDelimiter stringDelimiter)*)
stringDelimiter ::= ''' "a single quote"
nonStringDelimiter ::= "any character except stringDelimiter"
hashedString ::= '#' quotedString
quotedSelector ::= '#' (unarySelector | binarySelector | keywordSelector)
keywordSelector ::= keyword+
separator ::= (whitespace | comment)*

View File

@ -1,50 +0,0 @@
/*
* $Id: stx.c 118 2008-03-03 11:21:33Z baconevi $
*/
#include "stx.h"
#include "mem.h"
#include "boot.h"
#include "../cmn/mem.h"
int qse_stx_init (qse_stx_t* stx, qse_mmgr_t* mmgr, qse_size_t memcapa)
{
QSE_MEMSET (stx, 0, QSE_SIZEOF(*stx));
stx->mmgr = mmgr;
/* initialize object memory subsystem */
if (qse_stx_initmem (stx, memcapa) <= -1) return -1;
return 0;
}
void qse_stx_fini (qse_stx_t* stx)
{
qse_stx_finimem (stx);
}
qse_stx_t* qse_stx_open (
qse_mmgr_t* mmgr, qse_size_t xtnsize, qse_size_t memcapa)
{
qse_stx_t* stx;
stx = (qse_stx_t*) QSE_MMGR_ALLOC (
mmgr, QSE_SIZEOF(qse_stx_t) + xtnsize
);
if (stx == QSE_NULL) return QSE_NULL;
if (qse_stx_init (stx, mmgr, memcapa) <= -1)
{
QSE_MMGR_FREE (stx->mmgr, stx);
return QSE_NULL;
}
return stx;
}
void qse_stx_close (qse_stx_t* stx)
{
qse_stx_fini (stx);
QSE_MMGR_FREE (stx->mmgr, stx);
}

View File

@ -1,240 +0,0 @@
/*
* $Id$
*/
#ifndef _QSE_LIB_STX_STX_H_
#define _QSE_LIB_STX_STX_H_
#include <qse/stx/stx.h>
typedef qse_word_t qse_stx_objidx_t;
#define QSE_STX_OBJIDX_INVALID ((qse_stx_objidx_t)-1)
typedef struct qse_stx_objhdr_t qse_stx_objhdr_t; /* object header */
typedef struct qse_stx_object_t qse_stx_object_t; /* abstract object */
typedef struct qse_stx_object_t* qse_stx_objptr_t; /* object pointer */
typedef struct qse_stx_byteobj_t qse_stx_byteobj_t;
typedef struct qse_stx_charobj_t qse_stx_charobj_t;
typedef struct qse_stx_wordobj_t qse_stx_wordobj_t;
enum qse_stx_objtype_t
{
QSE_STX_BYTEOBJ = 0,
QSE_STX_CHAROBJ = 1,
QSE_STX_WORDOBJ = 2
};
typedef enum qse_stx_objtype_t qse_stx_objtype_t;
struct qse_stx_objhdr_t
{
/* access - type: 2; size: rest;
* type - word indexed: 00 byte indexed: 01 char indexed: 10
*/
/* TODO: change the order depending on endian.... */
/* mark, type(pinter,wordindexed,indexable), reference-count */
/*
has pointer -> word, byte
variable -> variable, fixed;
word variable =>
char variable =>
byte variale =>
byte fixed => not possible
char fixed => not possible
word fixed
*/
qse_word_t _mark: 1;
qse_word_t _type: 2;
qse_word_t _variable: 1;
qse_word_t _refcnt: ((QSE_SIZEOF_WORD_T*8)-4);
qse_word_t _size;
qse_word_t _class;
qse_word_t _backref;
};
#include "hash.h"
#include "mem.h"
#include "obj.h"
#include "sym.h"
#include "dic.h"
#include "cls.h"
#include "boot.h"
struct qse_stx_object_t
{
qse_stx_objhdr_t h;
};
struct qse_stx_wordobj_t
{
qse_stx_objhdr_t h;
qse_word_t slot[1];
};
struct qse_stx_byteobj_t
{
qse_stx_objhdr_t h;
qse_byte_t slot[1];
};
struct qse_stx_charobj_t
{
qse_stx_objhdr_t h;
qse_char_t slot[1];
};
struct qse_stx_t
{
qse_mmgr_t* mmgr;
/** error information */
struct
{
qse_stx_errstr_t str; /**< error string getter */
qse_stx_errnum_t num; /**< stores an error number */
qse_char_t msg[128]; /**< error message holder */
qse_stx_loc_t loc; /**< location of the last error */
} err;
struct
{
qse_size_t capa;
qse_stx_objptr_t* slot;
qse_stx_objptr_t* free;
} mem;
struct
{
qse_word_t nil;
qse_word_t true;
qse_word_t false;
qse_word_t symtab; /* symbol table */
qse_word_t sysdic; /* system dictionary */
qse_word_t class_symbol;
qse_word_t class_metaclass;
qse_word_t class_association;
qse_word_t class_object;
qse_word_t class_undefinedobject;
qse_word_t class_class;
qse_word_t class_array;
qse_word_t class_bytearray;
qse_word_t class_string;
qse_word_t class_character;
qse_word_t class_context;
qse_word_t class_systemsymboltable;
qse_word_t class_systemdictionary;
qse_word_t class_method;
qse_word_t class_smallinteger;
qse_word_t class_parser;
} ref;
qse_bool_t __wantabort; /* TODO: make it a function pointer */
};
/**
* The QSE_STX_REFISINT macro determines if the object reference is encoded
* of a small integer by checking if the bit 0 is on.
*/
#define QSE_STX_REFISINT(stx,x) (((x) & 0x01) == 0x01)
/**
* The QSE_STX_INTTOREF macro encodes a small integer to an object reference.
*/
#define QSE_STX_INTTOREF(stx,x) (((x) << 1) | 0x01)
/**
* The QSE_STX_REFTOINT macro decodes an object reference to a small integer.
*/
#define QSE_STX_REFTOINT(stx,x) ((x) >> 1)
/**
* The QSE_STX_REFISIDX macro determines if the object reference is encoded
* of an object table index by checking if the bit 0 is off.
*/
#define QSE_STX_REFISIDX(stx,x) (((x) & 0x01) == 0x00)
/**
* The QSE_STX_IDXTOREF macro encodes a object table index to an object
* reference.
*/
#define QSE_STX_IDXTOREF(stx,x) (((x) << 1) | 0x00)
/**
* The QSE_STX_REFTOIDX macro decodes an object reference to a object
* table index.
*/
#define QSE_STX_REFTOIDX(stx,x) ((x) >> 1)
/* get the object pointer by the raw object table index */
#define QSE_STX_PTRBYIDX(stx,x) ((stx)->mem.slot[x])
/* get the object pointer by the encoded object table index */
#define QSE_STX_PTRBYREF(stx,x) QSE_STX_PTRBYIDX(stx,QSE_STX_REFTOIDX(stx,x))
#define QSE_STX_OBJTYPE(stx,ref) (QSE_STX_PTRBYREF(stx,ref)->h._type)
#define QSE_STX_OBJSIZE(stx,ref) (QSE_STX_PTRBYREF(stx,ref)->h._size)
#define QSE_STX_OBJCLASS(stx,ref) (QSE_STX_PTRBYREF(stx,ref)->h._class)
/* pointer to the body of the object past the header */
#define QSE_STX_WORDPTR(stx,ref) \
(((qse_stx_wordobj_t*)QSE_STX_PTRBYREF(stx,ref))->slot)
#define QSE_STX_BYTEPTR(stx,ref) \
(((qse_stx_byteobj_t*)QSE_STX_PTRBYREF(stx,ref))->slot)
#define QSE_STX_CHARPTR(stx,ref) \
(((qse_stx_charobj_t*)QSE_STX_PTRBYREF(stx,ref))->slot)
#define QSE_STX_WORDLEN(stx,ref) OBJSIZE(stx,ref)
#define QSE_STX_BYTELEN(stx,ref) OBJSIZE(stx,ref)
#define QSE_STX_CHARLEN(stx,ref) OBJSIZE(stx,ref)
#define QSE_STX_WORDAT(stx,ref,pos) (QSE_STX_WORDPTR(stx,ref)[pos])
#define QSE_STX_BYTEAT(stx,ref,pos) (QSE_STX_BYTEPTR(stx,ref)[pos])
#define QSE_STX_CHARAT(stx,ref,pos) (QSE_STX_CHARPTR(stx,ref)[pos])
/* REDEFINITION DROPPING PREFIX FOR INTERNAL USE */
#define REFISINT(stx,x) QSE_STX_REFISINT(stx,x)
#define INTTOREF(stx,x) QSE_STX_INTTOREF(stx,x)
#define REFTOINT(stx,x) QSE_STX_REFTOINT(stx,x)
#define REFISIDX(stx,x) QSE_STX_REFISIDX(stx,x)
#define IDXTOREF(stx,x) QSE_STX_IDXTOREF(stx,x)
#define REFTOIDX(stx,x) QSE_STX_REFTOIDX(stx,x)
#define PTRBYREF(stx,x) QSE_STX_PTRBYREF(stx,x)
#define PTRBYIDX(stx,x) QSE_STX_PTRBYIDX(stx,x)
#define OBJTYPE(stx,ref) QSE_STX_OBJTYPE(stx,ref)
#define OBJCLASS(stx,ref) QSE_STX_OBJCLASS(stx,ref)
#define OBJSIZE(stx,ref) QSE_STX_OBJSIZE(stx,ref)
#define BYTEPTR(stx,ref) QSE_STX_BYTEPTR(stx,ref)
#define CHARPTR(stx,ref) QSE_STX_CHARPTR(stx,ref)
#define WORDPTR(stx,ref) QSE_STX_WORDPTR(stx,ref)
#define BYTELEN(stx,ref) QSE_STX_BYTELEN(stx,ref)
#define CHARLEN(stx,ref) QSE_STX_CHARLEN(stx,ref)
#define WORDLEN(stx,ref) QSE_STX_WORDLEN(stx,ref)
#define BYTEAT(stx,ref,pos) QSE_STX_BYTEAT(stx,ref,pos)
#define CHARAT(stx,ref,pos) QSE_STX_CHARAT(stx,ref,pos)
#define WORDAT(stx,ref,pos) QSE_STX_WORDAT(stx,ref,pos)
#define BYTEOBJ QSE_STX_BYTEOBJ
#define CHAROBJ QSE_STX_CHAROBJ
#define WORDOBJ QSE_STX_WORDOBJ
/* SOME INTERNAL MACRO DEFINITIONS */
#define SYMTAB_INIT_CAPA 256
#define SYSDIC_INIT_CAPA 256
#define ISNIL(stx,obj) ((obj) == (stx)->ref.nil)
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,87 +0,0 @@
stx(1) qse
NAME
stx - qse smalltalk system
SYNOPSIS
stx [-f imageFile] MainClass
DESCRIPTION
The virtual machine executes "MainClass main" on start-up.
method 1.
push lookup_class(#MainClass) -> receiver.
send a unary(no argument) message with the selector #main.
return the returned value from main and exits.
method 2. - take a command parameter
push lookup_class(#MainClass) -> receiver.
push argc as an argument.
push argv as an argument.
send a double-argument message the the selector #main:withArgv:.
return the returned value from #main:withArgv and exits.
AUTHOR(S)
Hyung-Hwan Chung (hyunghwan.chung@gmail.com)
COPYRIGHT
Copyright(c) 2005 hyugnhwan.chung@gmail.com
SEE ALSO
qse(7)
-- stack bytecodes --
0 0000 XXXX push_receiver_variable
1 0001 XXXX push_temporary_location
2 0010 XXXX push_literal_constant
3 0011 XXXX push_literal_variable
4 0100 XXXX store_receiver_variable
5 0101 XXXX store_temporary_location
6 0110 0000 XXXXXXXX push_receiver_variable_extended
0110 0001 XXXXXXXX push_temporary_location_extended
0110 0010 XXXXXXXX push_literal_constant_extended
0110 0011 XXXXXXXX push_literal_variable_extended
0110 0100 XXXXXXXX store_receiver_variable_extended
0110 0101 XXXXXXXX store_temporary_location_extended
0110 0110 unused
0110 0111 unused
0110 1000 pop_stack_top
0110 1001 duplicate_stack_top
0110 1010 push_active_context
0110 1011 unused
0110 1100 unused
0110 1101 unused
0110 1110 unused
0110 1111 unused
-- send bytecodes --
7 0111 0000 JJJKKKKK send_to_self
0111 0001 JJJKKKKK send_to_super
0111 0010 JJJJJJJJ KKKKKKKK send_to_self_extended
0111 0011 JJJJJJJJ KKKKKKKK send_to_super_extended
0111 0100 XXXXXXXX
0111 0101 XXXXXXXX
0111 0110 XXXXXXXX
0111 0111 XXXXXXXX
-- return bytecodes --
0111 1000 return receiver
0111 1001 return_true
0111 1010 return_false
0111 1011 return_nil
0111 1100 return_from_message
0111 1101 return_from_block
0111 1110
0111 1111
-- jump bytecodes --
8 1000 0XXX jump_forward
1000 1XXX XXXXXXXX jump_forward
-- primitive --
F 1111 XXXX XXXXXXXX do_primitive

View File

@ -1,184 +0,0 @@
/*
* $Id$
*/
#include "stx.h"
#include <qse/cmn/str.h>
/* Implements global symbol table */
struct qse_stx_symtab_t
{
qse_stx_objhdr_t h;
qse_word_t tally;
qse_word_t slot[1];
};
typedef struct qse_stx_symtab_t qse_stx_symtab_t;
static qse_word_t expand (qse_stx_t* stx, qse_word_t tabref)
{
qse_word_t oldcapa, newcapa;
qse_word_t newtab;
qse_stx_symtab_t* oldptr, * newptr;
QSE_ASSERT (REFISIDX(stx,stx->ref.class_systemsymboltable));
QSE_ASSERT (!ISNIL(stx,stx->ref.class_systemsymboltable));
QSE_ASSERTX (
REFISIDX(stx,tabref),
"The reference is not an object index"
);
/* This function can handle expansion of an object whose class is
* SystemSymbolTable. During initial bootstrapping, the class of
* the stock symbol table (stx->ref.symtab) may not be set properly.
* You must make sure that expansion is not triggered until its class
* is set. If this assertion fails, you must increase the value of
* SYMTAB_INIT_CAPA.
*/
QSE_ASSERT (OBJCLASS(stx,tabref) == stx->ref.class_systemsymboltable);
/* get the current table capacity being the size of the object
* excluding the tally field. */
oldcapa = OBJSIZE(stx,tabref) - 1;
/* instantiate a new symbol table with its capacity doubled. */
newcapa = oldcapa * 2;
newtab = qse_stx_instantiate (
stx, OBJCLASS(stx,tabref),
QSE_NULL, QSE_NULL, newcapa
);
if (ISNIL(stx,newtab)) return stx->ref.nil;
oldptr = (qse_stx_symtab_t*)PTRBYREF(stx,tabref);
newptr = (qse_stx_symtab_t*)PTRBYREF(stx,newtab);
newptr->tally = INTTOREF (stx, 0);
QSE_ASSERT (newcapa == OBJSIZE(stx,newtab) - 1);
/* reorganize the symbol table */
while (oldcapa > 0)
{
qse_word_t symbol;
symbol = oldptr->slot[--oldcapa];
if (!ISNIL(stx,symbol))
{
qse_word_t index;
QSE_ASSERT (REFISIDX(stx,symbol));
QSE_ASSERT (OBJCLASS(stx,symbol) == stx->ref.class_symbol);
QSE_ASSERT (OBJTYPE(stx,symbol) == CHAROBJ);
/* qse_stx_newsymbol uses qse_stx_hashstr().
* this function uses qse_stx_hashobj().
* both must return the same value */
QSE_ASSERT (qse_stx_hashobj (stx, symbol) ==
qse_stx_hashstr (stx, &CHARAT(stx,symbol,0)));
index = qse_stx_hashobj (stx, symbol) % newcapa;
while (!ISNIL(stx,newptr->slot[index]))
index = (index + 1) % newcapa;
newptr->slot[index] = symbol;
}
}
newptr->tally = oldptr->tally;
qse_stx_swapmem (stx, REFTOIDX(stx,tabref), REFTOIDX(stx,newtab));
return tabref;
}
static qse_word_t new_symbol (
qse_stx_t* stx, qse_word_t tabref, const qse_char_t* name, qse_size_t len)
{
qse_stx_symtab_t* tabptr;
qse_word_t symref;
qse_word_t capa, hash, index, tally;
/* the table must have at least one slot excluding the tally field */
QSE_ASSERT (OBJSIZE(stx,tabref) > 1);
capa = OBJSIZE(stx,tabref) - 1; /* exclude the tally field */
hash = qse_stx_hashstr (stx, name);
index = hash % capa;
tabptr = (qse_stx_symtab_t*)PTRBYREF(stx,tabref);
do
{
/*symref = WORDAT (stx, tabref, index + 1);*/
symref = tabptr->slot[index];
if (ISNIL(stx,symref)) break; /* not found */
QSE_ASSERT (REFISIDX(stx,symref));
QSE_ASSERT (OBJCLASS(stx,symref) == stx->ref.class_symbol);
QSE_ASSERT (OBJTYPE(stx,symref) == CHAROBJ);
/*if (qse_strxcmp (
&CHARAT(stx,symref,0), OBJSIZE(stx,symref),
name) == 0) return symref;*/
if (qse_strcmp (&CHARAT(stx,symref,0), name) == 0) return symref;
index = (index + 1) % capa;
}
while (0);
/* symbol is not found. let's create a new symbol */
tally = REFTOINT(stx, tabptr->tally);
/* check if the symbol table is getting full soon */
if (tally + 1 >= capa)
{
/* Enlarge the symbol table before it gets full to
* make sure that it has at least one free slot left
* after having added a new symbol. this is to help
* traversal end at a nil slot if no entry is found. */
if (ISNIL (stx, expand (stx, tabref))) return stx->ref.nil;
/* refresh the object pointer */
tabptr = (qse_stx_symtab_t*)PTRBYREF(stx,tabref);
/* refersh capacity and hash index */
capa = OBJSIZE(stx,tabref) - 1; /* exclude the tally field */
index = hash % capa;
/* after expansion, the tally must still be the same */
QSE_ASSERT (tally == REFTOINT (stx, tabptr->tally));
}
symref = qse_stx_alloccharobj (stx, name, len);
if (!ISNIL(stx,symref))
{
OBJCLASS(stx,symref) = stx->ref.class_symbol;
tabptr->tally = INTTOREF (stx, tally + 1);
tabptr->slot[index] = symref;
}
return symref;
}
qse_word_t qse_stx_newsymbol (qse_stx_t* stx, const qse_char_t* name)
{
return new_symbol (stx, stx->ref.symtab, name, qse_strlen(name));
}
qse_word_t qse_stx_newsymbolx (qse_stx_t* stx, const qse_char_t* name, qse_size_t len)
{
return new_symbol (stx, stx->ref.symtab, name, len);
}
#if 0
void qse_stx_traverse_symbol_table (
qse_stx_t* stx, void (*func) (qse_stx_t*,qse_word_t,void*), void* data)
{
qse_word_t index, x;
for (index = 0; index < stx->symtab.capa; index++)
{
x = stx->symtab.slot[index];
if (x != stx->nil) func (stx, x, data);
}
}
#endif

View File

@ -1,32 +0,0 @@
/*
* $Id: symbol.h 118 2008-03-03 11:21:33Z baconevi $
*/
#ifndef _QSE_LIB_STX_SYM_H_
#define _QSE_LIB_STX_SYM_H_
/* The SystemSymbolTable is a variable word class.
* The info below is for the fixed part only */
#define QSE_STX_SYSTEMSYMBOLTABLE_SIZE 1
#define QSE_STX_SYSTEMSYMBOLTABLE_TALLY 0
#ifdef __cplusplus
extern "C" {
#endif
qse_word_t qse_stx_newsymbol (
qse_stx_t* stx,
const qse_char_t* name
);
qse_word_t qse_stx_newsymbolx (
qse_stx_t* stx,
const qse_char_t* name,
qse_size_t len
);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,77 +0,0 @@
/*
* $Id: token.c 118 2008-03-03 11:21:33Z baconevi $
*/
#include <qse/stx/token.h>
#include <qse/stx/misc.h>
qse_stx_token_t* qse_stx_token_open (
qse_stx_token_t* token, qse_word_t capacity)
{
if (token == QSE_NULL) {
token = (qse_stx_token_t*)
qse_malloc (qse_sizeof(qse_stx_token_t));
if (token == QSE_NULL) return QSE_NULL;
token->__dynamic = qse_true;
}
else token->__dynamic = qse_false;
if (qse_stx_name_open(&token->name, capacity) == QSE_NULL) {
if (token->__dynamic) qse_free (token);
return QSE_NULL;
}
/*
token->ivalue = 0;
token->fvalue = .0;
*/
token->type = QSE_STX_TOKEN_END;
return token;
}
void qse_stx_token_close (qse_stx_token_t* token)
{
qse_stx_name_close (&token->name);
if (token->__dynamic) qse_free (token);
}
int qse_stx_token_addc (qse_stx_token_t* token, qse_cint_t c)
{
return qse_stx_name_addc (&token->name, c);
}
int qse_stx_token_adds (qse_stx_token_t* token, const qse_char_t* s)
{
return qse_stx_name_adds (&token->name, s);
}
void qse_stx_token_clear (qse_stx_token_t* token)
{
/*
token->ivalue = 0;
token->fvalue = .0;
*/
token->type = QSE_STX_TOKEN_END;
qse_stx_name_clear (&token->name);
}
qse_char_t* qse_stx_token_yield (qse_stx_token_t* token, qse_word_t capacity)
{
qse_char_t* p;
p = qse_stx_name_yield (&token->name, capacity);
if (p == QSE_NULL) return QSE_NULL;
/*
token->ivalue = 0;
token->fvalue = .0;
*/
token->type = QSE_STX_TOKEN_END;
return p;
}
int qse_stx_token_compare_name (qse_stx_token_t* token, const qse_char_t* str)
{
return qse_stx_name_compare (&token->name, str);
}

View File

@ -1,66 +0,0 @@
/*
* $Id: token.h 118 2008-03-03 11:21:33Z baconevi $
*/
#ifndef _QSE_STX_TOKEN_H_
#define _QSE_STX_TOKEN_H_
#include <qse/stx/stx.h>
#include <qse/stx/name.h>
enum
{
QSE_STX_TOKEN_END,
QSE_STX_TOKEN_CHARLIT,
QSE_STX_TOKEN_STRLIT,
QSE_STX_TOKEN_SYMLIT,
QSE_STX_TOKEN_NUMLIT,
QSE_STX_TOKEN_IDENT,
QSE_STX_TOKEN_BINARY,
QSE_STX_TOKEN_KEYWORD,
QSE_STX_TOKEN_PRIMITIVE,
QSE_STX_TOKEN_ASSIGN,
QSE_STX_TOKEN_COLON,
QSE_STX_TOKEN_RETURN,
QSE_STX_TOKEN_LBRACKET,
QSE_STX_TOKEN_RBRACKET,
QSE_STX_TOKEN_LPAREN,
QSE_STX_TOKEN_RPAREN,
QSE_STX_TOKEN_APAREN,
QSE_STX_TOKEN_PERIOD,
QSE_STX_TOKEN_SEMICOLON
};
struct qse_stx_token_t
{
int type;
/*
qse_stx_int_t ivalue;
qse_stx_flt_t fvalue;
*/
qse_stx_name_t name;
qse_bool_t __dynamic;
};
typedef struct qse_stx_token_t qse_stx_token_t;
#ifdef __cplusplus
extern "C" {
#endif
qse_stx_token_t* qse_stx_token_open (
qse_stx_token_t* token, qse_word_t capacity);
void qse_stx_token_close (qse_stx_token_t* token);
int qse_stx_token_addc (qse_stx_token_t* token, qse_cint_t c);
int qse_stx_token_adds (qse_stx_token_t* token, const qse_char_t* s);
void qse_stx_token_clear (qse_stx_token_t* token);
qse_char_t* qse_stx_token_yield (qse_stx_token_t* token, qse_word_t capacity);
int qse_stx_token_compare_name (qse_stx_token_t* token, const qse_char_t* str);
#ifdef __cplusplus
}
#endif
#endif