1
0
Fork 0
mirror of git://git.psyced.org/git/psyced synced 2024-08-15 03:25:10 +00:00

spyc: use libpsyc for parsing & rendering

This commit is contained in:
Gabor Adam Toth 2011-05-23 01:33:12 +02:00
parent a21b0024ef
commit ffabd7af08
12 changed files with 343 additions and 242 deletions

View file

@ -2,9 +2,10 @@
// $Id: circuit.c,v 1.38 2008/10/14 19:02:29 lynx Exp $
#include "psyc.h"
#include "../psyc/circuit.c"
#if 0 // first we get the syntax running, then we'll think of new features:
#ifdef USE_PSYC
# include "../psyc/circuit.c"
#else
#include <net.h>
#include <uniform.h>
@ -35,7 +36,7 @@ volatile string netloc;
return 0; \
}
mapping instate;
mapping instate = ([ ]);
mapping outstate;
mapping legal_senders;
@ -51,6 +52,14 @@ void runQ();
int isServer() { return 0; }
void peek(string data) {
#if __EFUN_DEFINED__(enable_binary)
enable_binary(ME);
#else
raise_error("Driver compiled without enable_binary()");
#endif
}
void feed(string data) {
input_to(#'feed, INPUT_IGNORE_BANG);
::feed(data);
@ -91,7 +100,7 @@ void sender_verification(array(string) sourcehosts, array(string) targethosts)
int logon(int failure) {
sAuthHosts(([ ])); // reset authhosts
legal_senders = ([ ]);
instate = ([ "_INTERNAL_origin" : ME]);
instate = ([ "_INTERNAL_origin" : ME ]);
outstate = ([ ]);
#ifdef __TLS__
mixed cert;
@ -145,11 +154,6 @@ int logon(int failure) {
peerip = query_ip_number(ME) || "127.0.0.1";
#if __EFUN_DEFINED__(enable_binary)
enable_binary(ME);
#else
# echo Driver compiled without enable_binary() - PSYC functionality warning!
#endif
input_to(#'feed, INPUT_IGNORE_BANG);
call_out(#'quit, 90);
@ -202,37 +206,6 @@ first_response() {
emit("|\n");
}
// processes routing header variable assignments
// basic version does no state
mapping process_header(mixed varops) {
mapping vars = ([ ]);
foreach(mixed vop : varops) {
string vname = vop[0];
switch(vop[1]) {
case C_GLYPH_MODIFIER_ASSIGN:
instate[vname] = vop[2];
// fall thru
case C_GLYPH_MODIFIER_SET:
vars[vname] = vop[2];
break;
case C_GLYPH_MODIFIER_AUGMENT:
case C_GLYPH_MODIFIER_DIMINISH:
case C_GLYPH_MODIFIER_QUERY:
CIRCUITERROR("header modifier with glyph other than ':', this is not implemented")
break;
default:
CIRCUITERROR("header modifier with unknown glyph")
break;
}
// FIXME: not every legal varname is a mmp varname
// look at shared_memory("routing")
if (!legal_keyword(vname) || abbrev("_INTERNAL", vname)) {
CIRCUITERROR("illegal varname in header")
}
}
return vars;
}
#define PSYC_TCP
#include "dispatch.i"
@ -329,4 +302,4 @@ varargs int msg(string source, string mc, string data,
return emit(buf);
}
#endif // 0
#endif // USE_PSYC