In XDR, introduce a new type 'string_big_int'.
[whenjobs.git] / lib / whenproto.x
index 2e64636..603cf91 100644 (file)
  * 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<MAX_VARIABLE_NAME_LENGTH>;
 typedef string string_value<MAX_VARIABLE_VALUE_LENGTH>;
+typedef string string_big_int<MAX_BIG_INT_LENGTH>;
 
 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' */
 };