1. Kota UENISHI
  2. ocaml-bert

Commits

UENISHI Kota  committed 9a3b9b5

adding interface..

  • Participants
  • Parent commits 98e42ef
  • Branches default

Comments (0)

Files changed (3)

File OMakefile

View file
  • Ignore whitespace
 
 FILES[] =
      tcp_server
-     erbo
+     bert
 
 PROGRAM = tcp_server
 OCAML_LIBS +=

File bert.ml

View file
  • Ignore whitespace
 open Str;;
 
-type term =
-    Int of int
-  | Float of float
-(*  | Atom of string *) 
-  | Tuple of term list (* type of tuple is different btw Erlang and OCaml *)
-  | List of term list 
-  | String of string
-  | Binary of string
-  | None;;
-
-type result = 
-  | Ok of term * string
-  | More of int
-  | None;;
-
 (*
 class pid = let a in 1;;
 class ref = let a in 1;;
 class port = Not_supported;;
 *)
 
+type erlterm =
+    Int of int
+  | Float of float
+      (*  | Atom of string *) 
+  | Tuple of erlterm list (* type of tuple is different btw Erlang and OCaml *)
+  | List of erlterm list 
+  | String of string
+  | Binary of string
+  | None;;
+
+type result = 
+  | Ok of erlterm * string
+  | More of int
+  | None;;
+
 exception Not_supported;;
 exception Unknown_type;;
 
 	make_small_bigint_ (i+1) p (v  + p * n)
     else v in
     make_small_bigint_ 0 1 0;;
-    
 
 let make_int32 bin = 
   let rec make_int32_ bin v i =
     else v
   in make_int32_ bin 0 0;;
 
-(*  8 bit is: 0 - 255 *)
-let make_int8 r = (int_of_char r);;
-
 (* binary -> (decoded tuple, remain), (more, Length), (error, Reason)
    throws exceptions: Not_supported | Unknown_type
    when more binaries  *)
 	  local_decode (String.sub bin 1 ((String.length bin)-1)); 
       | _ -> raise Unknown_type;
     end;;
-

File bert.mli

View file
  • Ignore whitespace
+type erlterm =
+    Int of int
+  | Float of float
+      (*  | Atom of string *) 
+  | Tuple of erlterm list (* type of tuple is different btw Erlang and OCaml *)
+  | List of erlterm list 
+  | String of string
+  | Binary of string
+  | None;;
+
+type result = 
+  | Ok of erlterm * string
+  | More of int
+  | None;;
+
+val decode_binary : string -> result
+  
+exception Not_supported;;
+exception Unknown_type;;
+