ideas for better mood methods

This commit is contained in:
psyc://psyced.org/~lynX 2011-04-27 17:40:30 +02:00
parent ea815f871f
commit cefc6ccad9
3 changed files with 58 additions and 17 deletions

View File

@ -100,14 +100,14 @@ volatile mapping share = ([
0 : "", // unspecified mood
// any suggestions on these?
1 : "_dead",
2 : "_angry",
3 : "_sad",
4 : "_moody",
2 : "_angry", // tragic, enraged, sore, irate?
3 : "_sad", // gloomy, miserable?
4 : "_moody", // pensive?
5 : "_okay",
6 : "_good",
7 : "_happy",
8 : "_bright",
9 : "_nirvana",
8 : "_bright", // blissful? blessed? joyous?
9 : "_nirvana", // enlightened? paradisiacal?
]),
#endif // _flag_disable_module_presence
#ifndef _flag_disable_module_friendship

View File

@ -46,7 +46,7 @@ void dispatch(mixed header_vars, mixed varops, mixed method, mixed body) {
if ((t = vars["_target"])) {
array(mixed) u;
unless (u = parse_uniform(t)) {
DISPATCHERROR("target is not an uniform\n")
DISPATCHERROR("target is not a uniform\n")
}
// FIXME relaying support here?
if (!is_localhost(lower_case(u[UHost]))) {

View File

@ -6,8 +6,46 @@
#include <input_to.h>
private string buffer;
private string body_buffer;
int state;
#if __EFUN_DEFINED__(psyc_parse)
# echo ___ using libpsyc!
void parser_init() {
if (state != PSYCPARSE_STATE_BLOCKED)
state = PSYCPARSE_STATE_HEADER;
buffer = "";
}
// called when a complete packet has arrived
void dispatch(mixed header_vars, mixed varops, mixed method, mixed body) {
parser_init();
}
// input data to the buffer
void feed(string data) {
# ifdef _flag_log_sockets_SPYC
log_file("RAW_SPYC", "» %O\n%s\n", ME, data);
# endif
buffer += data;
if (data == "|\n") {
mixed p = psyc_parse(buffer);
if (pointerp(p) && sizeof(p) == 4)
dispatch(p[0], p[1], p[2], p[3]);
else {
P1(("psyc_parse(%O) returned %O\n", buffer, p))
}
}
}
mixed list_parse(string val) {
return 0; // TBD
}
#else /* !libpsyc */
private string body_buffer;
int body_len;
int may_parse_more;
@ -51,16 +89,6 @@ void parser_init() {
state = PSYCPARSE_STATE_GREET; // AFTER reset
}
// it is sometimes useful to stop parsing
void interrupt_parse() {
state = PSYCPARSE_STATE_BLOCKED;
}
// and resume after some blocking operation is done
void resume_parse() {
state = PSYCPARSE_STATE_HEADER;
}
// input data to the buffer
void feed(string data) {
# ifdef _flag_log_sockets_SPYC
@ -408,3 +436,16 @@ test() {
list_parse("5\tabcde|4\tabcd");
}
#endif
#endif /* !libpsyc */
// it is sometimes useful to stop parsing
void interrupt_parse() {
state = PSYCPARSE_STATE_BLOCKED;
}
// and resume after some blocking operation is done
void resume_parse() {
state = PSYCPARSE_STATE_HEADER;
}