Anonymous avatar Anonymous committed 604a43c

list curretly not supported but test implementation ...

Comments (0)

Files changed (1)

     Int of int
   | Float of float
 (*  | Atom of string
-  | `List of term list
-  | `Tuple of term list   *)
+  | `Tuple of term list 
+  | List of 'term list  *)
   | String of string
   | Binary of string
   | None;;
    throws exceptions: Not_supported | Unknown_type
    when more binaries  *)
 let decode_binary bin = 
-  let rec local_decode local_bin = 
+  let rec decode_list count local_bin list = 
+    if count=0 then Ok( list, local_bin )
+    else
+      begin match local_decode local_bin with
+	| Ok( term, remain )->
+	    decode_list (count-1) remain (term::list);
+	| More( length )->
+	    More( length );
+	| _-> 
+	    raise Unknown_type;
+      end
+  and local_decode local_bin = 
     let length = String.length local_bin in 
       (* see http://www.erlang.org/doc/apps/erts/erl_ext_dist.html for details*)
       begin match (String.get local_bin 0) with
 	    Ok( String( String.sub local_bin 3 (len+3) ),
 		String.sub local_bin (len+3) (length-len-3) );
 	| 'l' -> (* LIST_EXT *)
-(*	    let len = make_int32 (String.sub local_bin 1 4) in *)
+	    let len = make_int32 (String.sub local_bin 1 5) in
+	      
 	    raise Unknown_type;
 	| 'm' -> (* BINARY_EXT *)
 	    raise Unknown_type;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.