diff --git a/include/psyc.h b/include/psyc.h index ed8ff0d..2926623 100644 --- a/include/psyc.h +++ b/include/psyc.h @@ -32,6 +32,7 @@ #define PSYC_NUM_ELEM(a) (sizeof(a) / sizeof(*(a))) +/// Boolean: true/false, yes/no. typedef enum { PSYC_FALSE = 0, @@ -40,15 +41,14 @@ typedef enum PSYC_YES = 1, } PsycBool; +/// Return code: OK/error. typedef enum { PSYC_OK = 1, PSYC_ERROR = -1, } PsycRC; -/** - * PSYC packet parts. - */ +/// PSYC packet parts. typedef enum { PSYC_PART_RESET = -1, diff --git a/include/psyc/packet.h b/include/psyc/packet.h index 4777a84..0a9d41b 100644 --- a/include/psyc/packet.h +++ b/include/psyc/packet.h @@ -54,6 +54,15 @@ typedef enum PSYC_PACKET_NO_LENGTH = 2, } PsycPacketFlag; +typedef enum +{ + PSYC_OPERATOR_SET = ':', + PSYC_OPERATOR_ASSIGN = '=', + PSYC_OPERATOR_AUGMENT = '+', + PSYC_OPERATOR_DIMINISH = '-', + PSYC_OPERATOR_QUERY = '?', +} PsycOperator; + /** Structure for a modifier. */ typedef struct { diff --git a/pike/psyc.cmod b/pike/psyc.cmod index 2ec7c9f..2cb1d44 100644 --- a/pike/psyc.cmod +++ b/pike/psyc.cmod @@ -121,7 +121,7 @@ PIKEFUN string render(mapping rvars, mapping evars, string method, string|void b struct keypair *k; // for mappings INT32 e; - char oper = C_GLYPH_OPERATOR_SET; + char oper = PSYC_OPERATOR_SET; // fill headers rheaders.lines = 0; diff --git a/test/test_json.c b/test/test_json.c index 19ccbef..126a84b 100644 --- a/test/test_json.c +++ b/test/test_json.c @@ -92,8 +92,8 @@ int main (int argc, char **argv) { CASE_v CASE_S CASE_P case 'h': printf( - HELP_FILE("testJson", "mnqSsvP") - HELP_PORT("testJson", "nqsvP") + HELP_FILE("test_json", "mnqSsvP") + HELP_PORT("test_json", "nqsvP") HELP_f HELP_p HELP_b HELP_c HELP_m HELP_n HELP_q HELP_S HELP_s HELP_v HELP_P HELP_h, diff --git a/test/test_json_glib.c b/test/test_json_glib.c index 2ef2e3e..4327adb 100644 --- a/test/test_json_glib.c +++ b/test/test_json_glib.c @@ -78,8 +78,8 @@ int main (int argc, char **argv) { CASE_s CASE_v CASE_P case 'h': printf( - HELP_FILE("testJsonGlib", "mnqSsvP") - HELP_PORT("testJsonGlib", "nqsvP") + HELP_FILE("test_json_glib", "mnqSsvP") + HELP_PORT("test_json_glib", "nqsvP") HELP_f HELP_p HELP_b HELP_c HELP_m HELP_n HELP_q HELP_S HELP_s HELP_v HELP_P HELP_h, diff --git a/test/test_psyc.c b/test/test_psyc.c index d18bc7a..c9961b6 100644 --- a/test/test_psyc.c +++ b/test/test_psyc.c @@ -326,8 +326,8 @@ int main (int argc, char **argv) { CASE_s CASE_v CASE_S CASE_P case 'h': printf( - HELP_FILE("testPsyc", "mnqrSsvP") - HELP_PORT("testPsyc", "nqrsvP") + HELP_FILE("test_psyc", "mnqrSsvP") + HELP_PORT("test_psyc", "nqrsvP") HELP_f HELP_p HELP_b HELP_c HELP_m HELP_n HELP_r HELP_q HELP_S HELP_s diff --git a/test/test_psyc_speed.c b/test/test_psyc_speed.c index 7ee20fe..d1012db 100644 --- a/test/test_psyc_speed.c +++ b/test/test_psyc_speed.c @@ -52,8 +52,8 @@ int main (int argc, char **argv) { CASE_r CASE_s case 'h': printf( - HELP_FILE("testPsycSpeed", "rs") - HELP_PORT("testPsycSpeed", "rs") + HELP_FILE("test_psyc_speed", "rs") + HELP_PORT("test_psyc_speed", "rs") HELP_f HELP_p HELP_b HELP_c HELP_r HELP_s HELP_h, port, RECV_BUF_SIZE); diff --git a/test/test_render.c b/test/test_render.c index 55497cc..8e55ec0 100644 --- a/test/test_render.c +++ b/test/test_render.c @@ -12,16 +12,16 @@ int testPresence (const char *avail, int availlen, const char *rendered, uint8_t verbose) { PsycModifier routing[1]; - psyc_modifier_init(&routing[0], C_GLYPH_OPERATOR_SET, + psyc_modifier_init(&routing[0], PSYC_OPERATOR_SET, PSYC_C2ARG("_context"), PSYC_C2ARG(myUNI), PSYC_MODIFIER_ROUTING); PsycModifier entity[2]; // presence is to be assigned permanently in distributed state - psyc_modifier_init(&entity[0], C_GLYPH_OPERATOR_ASSIGN, + psyc_modifier_init(&entity[0], PSYC_OPERATOR_ASSIGN, PSYC_C2ARG("_degree_availability"), avail, availlen, PSYC_MODIFIER_CHECK_LENGTH); - psyc_modifier_init(&entity[1], C_GLYPH_OPERATOR_ASSIGN, + psyc_modifier_init(&entity[1], PSYC_OPERATOR_ASSIGN, PSYC_C2ARG("_description_presence"), desc, desclen, PSYC_MODIFIER_CHECK_LENGTH); @@ -42,10 +42,10 @@ int testPresence (const char *avail, int availlen, int testList (const char *rendered, uint8_t verbose) { PsycModifier routing[2]; - psyc_modifier_init(&routing[0], C_GLYPH_OPERATOR_SET, + psyc_modifier_init(&routing[0], PSYC_OPERATOR_SET, PSYC_C2ARG("_source"), PSYC_C2ARG(myUNI), PSYC_MODIFIER_ROUTING); - psyc_modifier_init(&routing[1], C_GLYPH_OPERATOR_SET, + psyc_modifier_init(&routing[1], PSYC_OPERATOR_SET, PSYC_C2ARG("_context"), PSYC_C2ARG(myUNI), PSYC_MODIFIER_ROUTING); @@ -70,10 +70,10 @@ int testList (const char *rendered, uint8_t verbose) psyc_render_list(&list_bin, buf_bin, sizeof(buf_bin)); PsycModifier entity[2]; - psyc_modifier_init(&entity[0], C_GLYPH_OPERATOR_SET, + psyc_modifier_init(&entity[0], PSYC_OPERATOR_SET, PSYC_C2ARG("_list_text"), buf_text, list_text.length, list_text.flag); - psyc_modifier_init(&entity[1], C_GLYPH_OPERATOR_SET, + psyc_modifier_init(&entity[1], PSYC_OPERATOR_SET, PSYC_C2ARG("_list_binary"), buf_bin, list_bin.length, list_bin.flag); diff --git a/test/test_strlen.c b/test/test_strlen.c index 40a50a5..b2d5bf4 100644 --- a/test/test_strlen.c +++ b/test/test_strlen.c @@ -44,8 +44,8 @@ int main (int argc, char **argv) { CASE_s case 'h': printf( - HELP_FILE("testStrlen", "s") - HELP_PORT("testStrlen", "s") + HELP_FILE("test_strlen", "s") + HELP_PORT("test_strlen", "s") HELP_f HELP_p HELP_b HELP_c HELP_s HELP_h, port, RECV_BUF_SIZE); diff --git a/test/uniform_parse.c b/test/uniform_parse.c index 0b82b61..97e6c53 100644 --- a/test/uniform_parse.c +++ b/test/uniform_parse.c @@ -35,6 +35,8 @@ int main () { testUniform("psyc://foo:4405/~bar", PSYC_SCHEME_PSYC); testUniform("psyc://foo:1234", PSYC_SCHEME_PSYC); testUniform("psyc://foo:1234d", PSYC_SCHEME_PSYC); + testUniform("psyc://foo:-1234", PSYC_SCHEME_PSYC); + testUniform("psyc://foo:-1234d", PSYC_SCHEME_PSYC); testUniform("psyc://foo/", PSYC_SCHEME_PSYC); testUniform("psyc://foo", PSYC_SCHEME_PSYC); testUniform("psyc://1234567890abcdef:g/~foo", PSYC_SCHEME_PSYC);