From 863afe7f43aca8651d2e2095ce47175882a8d620 Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Mon, 19 Dec 2011 21:15:36 -0500 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- examples/address_book.proto | 2 +- examples/simple.proto | 4 ++-- examples/test_address_book.ml | 14 +++++++------- examples/test_grafff.ml | 30 +++++++++++++++--------------- test/inspect_msg.rb | 30 +++++++++++++++--------------- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/examples/address_book.proto b/examples/address_book.proto index a144524..7d21f82 100644 --- a/examples/address_book.proto +++ b/examples/address_book.proto @@ -1,4 +1,4 @@ -(* +(* The protocol below corresponds to this Protocol Buffers definition, taken from its tutorial: diff --git a/examples/simple.proto b/examples/simple.proto index 9d8e2e0..640a2c4 100644 --- a/examples/simple.proto +++ b/examples/simple.proto @@ -4,14 +4,14 @@ type meta 'a = Unset | Set source 'a type dim = (int * int) -message metadata = +message metadata = Text { author: meta; pages : meta } | Image { dims : meta; - colors : meta + colors : meta } type tup 'a 'b = ('a * 'b) diff --git a/examples/test_address_book.ml b/examples/test_address_book.ml index 1f6a7fd..06ea3e9 100644 --- a/examples/test_address_book.ml +++ b/examples/test_address_book.ml @@ -3,12 +3,12 @@ open Extprot open Address_book open Printf -let names = - [| "John"; "Jacob"; "Michael"; "Ethan"; "Joshua"; +let names = + [| "John"; "Jacob"; "Michael"; "Ethan"; "Joshua"; "Daniel"; "Christopher"; "Anthony"; "William"; "Matthew"; |] -let surnames = - [| "Smith"; "Johnson"; "Williams"; "Brown"; "Jones"; +let surnames = + [| "Smith"; "Johnson"; "Williams"; "Brown"; "Jones"; "Miller"; "Davis"; "García"; "Rodríguez"; "Wilson" |] let phone_type = [|Phone_type.Mobile; Phone_type.Home; Phone_type.Work|] @@ -20,17 +20,17 @@ let name_to_s (n, s) = n ^ " " ^ s let random_email (n, s) = if Random.bool () then Optional.Unset else Optional.Set (n ^ string_of_int (Random.int 100) ^ "@" ^ s ^ ".name") -let random_phone () = +let random_phone () = (sprintf "%d-%d" (Random.int 1000) (Random.int 10000), pick phone_type) let random_list ?(max_len = 10) f = Array.to_list (Array.init (Random.int max_len) (fun _ -> f ())) let random_person () = let n = random_name () in - { Person.name = name_to_s n; id = Random.int 100000; + { Person.name = name_to_s n; id = Random.int 100000; email = random_email n; phones = random_list random_phone } -let address_book len = +let address_book len = { Address_book.persons = random_list ~max_len:len random_person } diff --git a/examples/test_grafff.ml b/examples/test_grafff.ml index 2bf9146..0ab07a7 100644 --- a/examples/test_grafff.ml +++ b/examples/test_grafff.ml @@ -12,19 +12,19 @@ let circle1 = Shape.Circle { Shape.center = (2, 2); radius = 1 } let grafff_0_0_1 = { Grafff.objects = [ (triangle1, 100); (circle1, 0); ] } -let grafff_1_0 = - { - Grafff1.objects = [ (triangle1, 100, Brush.Hello_Kitty 10); - (circle1, 0, Brush.Calligraphic 4); ] +let grafff_1_0 = + { + Grafff1.objects = [ (triangle1, 100, Brush.Hello_Kitty 10); + (circle1, 0, Brush.Calligraphic 4); ] } -let grafff_2_0 = - { - Grafff2.objects = +let grafff_2_0 = + { + Grafff2.objects = [ - (triangle1, bright_red, Brush.Hello_Kitty 10, Filling.No_filling); - (circle1, black, Brush.Calligraphic 4, Filling.Alpha_filling 50); - ] + (triangle1, bright_red, Brush.Hello_Kitty 10, Filling.No_filling); + (circle1, black, Brush.Calligraphic 4, Filling.Alpha_filling 50); + ] } let write = Conv.serialize @@ -36,7 +36,7 @@ let aeq pp ?(msg = "") expected actual = msg pp expected pp actual end -let check () = +let check () = let s0 = write Grafff.write_grafff grafff_0_0_1 in let s1 = write Grafff1.write_grafff1 grafff_1_0 in let s2 = write Grafff2.write_grafff2 grafff_2_0 in @@ -48,19 +48,19 @@ let check () = aeq Grafff.pp_grafff g0 g0''; (* default values for missing new fields *) let g1' = read Grafff1.read_grafff1 s0 in - aeq Grafff1.pp_grafff1 + aeq Grafff1.pp_grafff1 { Grafff1.objects = [(triangle1, 100, Brush.Default); (circle1, 0, Brush.Default)] } g1'; (* primitive types expanded to composed types (tuples) *) let g2' = read Grafff2.read_grafff2 s1 in aeq Grafff2.pp_grafff2 - { Grafff2.objects = + { Grafff2.objects = [(triangle1, hsv_0_0_100, Brush.Hello_Kitty 10, Filling.No_filling); - (circle1, black, Brush.Calligraphic 4, Filling.No_filling)] } + (circle1, black, Brush.Calligraphic 4, Filling.No_filling)] } g2'; () -let () = +let () = try check () with Error.Extprot_error(err, loc) -> Format.printf "Extprot error:@.%a@." Error.pp_extprot_error (err, loc) diff --git a/test/inspect_msg.rb b/test/inspect_msg.rb index 6fbc8cf..3b99268 100644 --- a/test/inspect_msg.rb +++ b/test/inspect_msg.rb @@ -7,11 +7,11 @@ class BadWireType < ExtprotError; end class UnknownTag < ExtprotError; end module Codec - @@types = [ - :vint, :tuple, :bits8, :bytes, + @@types = [ + :vint, :tuple, :bits8, :bytes, :bits32, :htuple, :bits64_long, :assoc, :bits64_float, :invalid, :enum, :invalid, - :invalid, :invalid, :invalid, :invalid + :invalid, :invalid, :invalid, :invalid ] def ll_type(n); @@types[n & 0xf] end @@ -20,7 +20,7 @@ def ll_tag(n); n >> 4 end module_function :ll_type, :ll_tag end -class Reader +class Reader include Codec def initialize(io) @@ -33,7 +33,7 @@ def read_vint raise EOFError unless b return b if b < 128 x = e = 0 - while b >= 128 + while b >= 128 x += (b - 128) << e e += 7 b = read_byte @@ -44,18 +44,18 @@ def read_vint alias_method :read_prefix, :read_vint - def read_bytes(n); - r = @io.read(n) + def read_bytes(n); + r = @io.read(n) @off += r.size r end - def read_byte; + def read_byte; @off += 1 - @io.getc + @io.getc end - def check_prim_type(ty, t) + def check_prim_type(ty, t) p = read_prefix if ll_tag(p) != 0 then skip_value(p) @@ -71,7 +71,7 @@ def read_prim_type(ty, &b) p = read_prefix llty = ll_type(p) puts "prefix #{p} type #{llty}" - if ll_tag(p) == 0 && llty == ty + if ll_tag(p) == 0 && llty == ty b.call elsif ll_tag(p) != 0 skip_value p @@ -109,7 +109,7 @@ def skip_value(p) when :bits8; read_byte when :bits32; read_bytes(4) when :bits64_float, :bits64_long; read_bytes(8) - when :enum; + when :enum; when :tuple, :htuple, :bytes, :assoc; @rd.read(read_vint) when :invalid; raise BadWireType end @@ -154,7 +154,7 @@ def skip_to(off) end class Inspect - include Codec + include Codec def initialize(reader, out, verbose = true, maxwidth = 79) @rd = reader @@ -172,12 +172,12 @@ def inspect def doinspect(prefix) tag = ll_tag(prefix) - case ll_type(prefix) + case ll_type(prefix) when :tuple; inspect_tuple("{ ", " }", prefix) when :htuple; inspect_tuple("[ ", " ]", prefix) when :assoc; inspect_assoc(prefix) when :vint - if @verbose || tag != 0 + if @verbose || tag != 0 @out.text("Vint_%d %d" % [tag, @rd.read_raw_rel_int]) else @out.text("%d" % @rd.read_raw_rel_int)