From: jsancho Date: Sun, 9 Oct 2011 21:48:15 +0000 (+0000) Subject: Mobs Events Engine X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;ds=sidebyside;h=500b68bdf16918b05f859830cc83d5a429d5b447;p=gacela.git Mobs Events Engine --- diff --git a/Makefile b/Makefile index b562aea..05255bf 100644 --- a/Makefile +++ b/Makefile @@ -123,11 +123,11 @@ DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print -ACLOCAL = ${SHELL} /home/jsancho/proyectos/guile/missing --run aclocal-1.11 -AMTAR = ${SHELL} /home/jsancho/proyectos/guile/missing --run tar -AUTOCONF = ${SHELL} /home/jsancho/proyectos/guile/missing --run autoconf -AUTOHEADER = ${SHELL} /home/jsancho/proyectos/guile/missing --run autoheader -AUTOMAKE = ${SHELL} /home/jsancho/proyectos/guile/missing --run automake-1.11 +ACLOCAL = ${SHELL} /home/jsancho/proyectos/gacela/trunk/missing --run aclocal-1.11 +AMTAR = ${SHELL} /home/jsancho/proyectos/gacela/trunk/missing --run tar +AUTOCONF = ${SHELL} /home/jsancho/proyectos/gacela/trunk/missing --run autoconf +AUTOHEADER = ${SHELL} /home/jsancho/proyectos/gacela/trunk/missing --run autoheader +AUTOMAKE = ${SHELL} /home/jsancho/proyectos/gacela/trunk/missing --run automake-1.11 AWK = mawk CC = gcc CCDEPMODE = depmode=gcc3 @@ -140,11 +140,11 @@ ECHO_C = ECHO_N = -n ECHO_T = EXEEXT = -GUILE = /usr/local/bin/guile -GUILE_CFLAGS = -I/usr/local/include -pthread -GUILE_CONFIG = /usr/local/bin/guile-config -GUILE_LDFLAGS = -pthread -L/usr/local/lib -lguile -lltdl -lgmp -lcrypt -lm -lltdl -GUILE_TOOLS = /usr/local/bin/guile-tools +GUILE = /usr/bin/guile +GUILE_CFLAGS = +GUILE_CONFIG = /usr/bin/guile-config +GUILE_LDFLAGS = -lguile -lltdl -lgmp -lcrypt -lm -lltdl +GUILE_TOOLS = /usr/bin/guile-tools INSTALL = /usr/bin/install -c INSTALL_DATA = ${INSTALL} -m 644 INSTALL_PROGRAM = ${INSTALL} @@ -154,7 +154,7 @@ LDFLAGS = LIBOBJS = LIBS = -lreadline -lSDL -lSDL_image -lSDL_gfx -lSDL_mixer -lGL -lGLU -lftgl LTLIBOBJS = -MAKEINFO = ${SHELL} /home/jsancho/proyectos/guile/missing --run makeinfo +MAKEINFO = ${SHELL} /home/jsancho/proyectos/gacela/trunk/missing --run makeinfo MKDIR_P = /bin/mkdir -p OBJEXT = o PACKAGE = gacela @@ -169,10 +169,10 @@ SET_MAKE = SHELL = /bin/bash STRIP = VERSION = 0.5 -abs_builddir = /home/jsancho/proyectos/guile -abs_srcdir = /home/jsancho/proyectos/guile -abs_top_builddir = /home/jsancho/proyectos/guile -abs_top_srcdir = /home/jsancho/proyectos/guile +abs_builddir = /home/jsancho/proyectos/gacela/trunk +abs_srcdir = /home/jsancho/proyectos/gacela/trunk +abs_top_builddir = /home/jsancho/proyectos/gacela/trunk +abs_top_srcdir = /home/jsancho/proyectos/gacela/trunk ac_ct_CC = gcc am__include = include am__leading_dot = . @@ -191,7 +191,7 @@ host_alias = htmldir = ${docdir} includedir = ${prefix}/include infodir = ${datarootdir}/info -install_sh = ${SHELL} /home/jsancho/proyectos/guile/install-sh +install_sh = ${SHELL} /home/jsancho/proyectos/gacela/trunk/install-sh libdir = ${exec_prefix}/lib libexecdir = ${exec_prefix}/libexec localedir = ${datarootdir}/locale diff --git a/src/gacela_mobs.scm b/src/gacela_mobs.scm index f9594cf..0ae561e 100755 --- a/src/gacela_mobs.scm +++ b/src/gacela_mobs.scm @@ -94,11 +94,28 @@ ((get-type) ,type-symbol) (else - (display ,(cons 'list (map (lambda (x) `(cons ',(car x) ,(car x))) publish))) - (newline) (catch #t (lambda () ,@body) - (lambda (key . args) #f)))))))) + (lambda (key . args) #f)) + (cond ((not (null? ,publish)) + (display ,(cons 'list (map (lambda (x) `(cons ',(car x) ,(car x))) publish))) + (publish-mob-data ,mob-id-symbol ,type-symbol ,(cons 'list (map (lambda (x) `(cons ',(car x) ,(car x))) publish))))) + (newline))))))) (define-macro (lambda-mob attr . body) `(the-mob 'undefined ,attr '() ,@body)) + + +;;; Events Engine + +(define publish-mob-data #f) +(define published-data (make-hash-table)) + +(let ((nop #f)) + (set! publish-mob-data + (lambda (mob-id mob-type data) + (let ((t (hash-ref published-data mob-type)) + (i (cons mob-id data))) + (hash-set! published-data mob-type + (cond (t (cons i t)) + (else (list i))))))))