X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=lib%2Fwhenproto.x;h=603cf9161d8a0ec857b2cc8640935caa336cf4e7;hb=acb316417965e2b40010aeb35f8ff990db0d1d42;hp=58d3ca2ab5d59f6e31b74cbc8da26a4b13ef38a7;hpb=afad75cdd3a3b9a4b17f4fc25645bca7cecf5a16;p=whenjobs.git diff --git a/lib/whenproto.x b/lib/whenproto.x index 58d3ca2..603cf91 100644 --- a/lib/whenproto.x +++ b/lib/whenproto.x @@ -21,12 +21,14 @@ * socket '$HOME/.whenjobs/socket'. The wire protocol is SunRPC. */ -/* Maximum length of a variable name and string value. */ +/* Maximum lengths and some useful typedefs. */ const MAX_VARIABLE_NAME_LENGTH = 256; const MAX_VARIABLE_VALUE_LENGTH = 65536; +const MAX_BIG_INT_LENGTH = 64; /* when encoded as a string */ typedef string variable_name; typedef string string_value; +typedef string string_big_int; typedef variable_name variable_name_list<>; @@ -44,19 +46,22 @@ union status switch (status_code s) { }; enum variable_type { - BOOL_T = 0, - STRING_T = 1, - INT_T = 2, - FLOAT_T = 3 + UNIT_T = 0, + BOOL_T = 1, + STRING_T = 2, + INT_T = 3, + FLOAT_T = 4 }; union variable switch (variable_type t) { + case UNIT_T: + void; case BOOL_T: bool b; case STRING_T: string_value s; case INT_T: - string i<64>; /* OCaml [big_int], as a string. */ + string_big_int i; /* OCaml [big_int], as a string. */ case FLOAT_T: double f; /* C 'double' maps to an OCaml 'float' */ }; @@ -65,7 +70,7 @@ union variable switch (variable_type t) { program When { version V1 { status reload_file (void) = 1; - void set_variable (variable_name, variable) = 2; + status set_variable (variable_name, variable) = 2; variable get_variable (variable_name) = 3; variable_name_list get_variable_names (void) = 4; status exit_daemon (void) = 5;