are we going to have state implemented just by mistake?

This commit is contained in:
psyc://psyced.org/~lynX 2011-05-23 13:02:04 +02:00
parent c4a915e82f
commit 7502990918
9 changed files with 32 additions and 29 deletions

View File

@ -55,10 +55,15 @@ volatile mapping _routes, _u;
#endif
#ifdef CONTEXT_STATE // {{{
// why volatile.. that breaks the whole meaning of state
volatile mapping _costate, _cmemory;
volatile mapping ctemp, cunused;
#endif // }}}
#ifdef USE_SPYC
mapping _state; // an alternative to ifdef CONTEXT_STATE ?
#endif
#ifdef PERSISTENT_SLAVES
int revision; // persistent revision counter
#endif
@ -85,6 +90,9 @@ create() {
ctemp = ([ ]);
_cmemory = m_allocate(0, 2);
#endif // }}}
#ifdef USE_SPYC
_state = ([ ]);
#endif
::create();
}
@ -286,6 +294,19 @@ insert_member(source, origin) {
P3(("%O -> _routes = %O\n", ME, _routes))
}
#ifdef USE_SPYC
get_state() {
PT(("cstate for %O picked up by %O: %O\n", ME,
previous_object(), _state))
return _state;
}
commit_state() {
PT(("cstate for %O committed by %O: %O\n", ME,
previous_object(), _state))
_state = ([ ]);
}
#endif
// code duplicaton is faster than others
#ifdef CONTEXT_STATE // {{{
//

View File

@ -1113,13 +1113,18 @@ protected int deliver(mixed ip, string host, string mc, string buffer, mapping c
return 1;
}
void peek(string data) {
// temporary new "lfun" called from driver's comm.c to peek into new connection
void connection_peek(string data) {
P4((">> peek: %O\n", data));
#ifdef USE_SPYC
# if !__EFUN_DEFINED__(psyc_parse)
# echo New PSYC syntax will not work: Driver compiled without libpsyc!
# endif
if (data[0] == C_GLYPH_NEW_PACKET_DELIMITER) {
# if __EFUN_DEFINED__(enable_binary)
enable_binary(ME);
# else
# echo New PSYC syntax will not work: Driver compiled without enable_binary!
raise_error("Driver compiled without enable_binary()");
# endif
}

View File

@ -274,6 +274,7 @@ static varargs string render_psyc(mixed source, string mc, mixed data,
if (mappingp(vars))
mapeach (key, val, vars) {
// psyc_isRoutingVar() would be faster here I presume
routeMe = isRouting[key];
if ((routeMe &&! (routeMe & PSYC_ROUTING_RENDER))
|| abbrev("_INTERNAL", key))
@ -286,8 +287,7 @@ static varargs string render_psyc(mixed source, string mc, mixed data,
}
return psyc_render(({ rvars, evars, mc, data }));
#endif
#else
if (mappingp(vars))
vars = vars + rvars;
else
@ -323,6 +323,7 @@ static varargs string render_psyc(mixed source, string mc, mixed data,
if (strlen(rbuf)) return rbuf[1 ..] +"\n"+
ebuf +"\n" S_GLYPH_PACKET_DELIMITER "\n";
return ebuf +"\n" S_GLYPH_PACKET_DELIMITER "\n";
#endif
}
// notice for completeness: the PSYC renderer does not convert_charset

View File

@ -3,10 +3,6 @@
#include "psyc.h"
#ifdef USE_PSYC
# include "../psyc/circuit.c"
#else
#include <net.h>
#include <uniform.h>
#include <tls.h>
@ -302,4 +298,3 @@ varargs int msg(string source, string mc, string data,
return emit(buf);
}
#endif // USE_PSYC

View File

@ -1,3 +0,0 @@
#ifdef USE_PSYC
# include "../psyc/common.h"
#endif

View File

@ -1,8 +1,6 @@
// vim:foldmethod=marker:syntax=lpc:noexpandtab
// $Id: parse.c,v 1.30 2008/12/18 18:16:14 lynx Exp $
#ifndef USE_PSYC
#include "psyc.h"
#include <net.h>
#include <input_to.h>
@ -468,5 +466,3 @@ void interrupt_parse() {
void resume_parse() {
state = PSYCPARSE_STATE_HEADER;
}
#endif // USE_PSYC

View File

@ -23,12 +23,11 @@
* the first byte.
*/
#ifndef SPYC
#define SPYC
#include <psyc.h>
#ifndef USE_PSYC
#if __EFUN_DEFINED__(psyc_parse)
# define LIBPSYC
# include <sys/libpsyc.h>
@ -46,4 +45,4 @@
return; \
}
#endif // USE_PSYC
#endif // SPYC

View File

@ -5,10 +5,6 @@
#include "psyc.h"
#ifdef USE_PSYC
# include "../psyc/server.c"
#else
#include <net.h>
#include <services.h>
#define NO_INHERIT
@ -195,4 +191,3 @@ void circuit_msg(string mc, mapping vars, string data) {
}
}
#endif // USE_PSYC

View File

@ -3,10 +3,6 @@
#include "psyc.h"
#ifdef USE_PSYC
# include "../psyc/udp.c"
#else
#include <net.h>
#include <uniform.h>
#include <text.h>
@ -42,5 +38,3 @@ parseUDP(ip, port, msg) {
// ignoring the routing vars.. TODO FIXME
#define PSYC_UDP
#include "dispatch.i"
#endif // USE_PSYC