brotorift 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/elixir_server_types_generator.ex.erb +40 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec815c3f6bf6be4219a1d516bad35445d34b49a268e4c77615b4412583dd750b
|
4
|
+
data.tar.gz: 99e29f05a34a2517aab5e2e2365e514fb32051aa32a44b6628aa048ea6194edd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1958086bf357ca8e78ac59cfeee35cfbb23dde2cbe067a3c499519dd5def2f6be4345f0c54ec4133e8308ad1766ad0ae4ad3ccb3a4e4ee851432246dcb08e0e9
|
7
|
+
data.tar.gz: 8b727b7b9038828b4715ebad10dc7e6343dbf7f3d1f2d111074d61257af23891032756f8d481e3a82361e691294809d7fd679ec013443c76fd789fbf632aba2f
|
@@ -0,0 +1,40 @@
|
|
1
|
+
defmodule <%= node.namespace %>.Enums do<% for e in runtime.enums.values %>
|
2
|
+
def <%= e.elixir_read_name %>(data) do
|
3
|
+
<<value::32-little, data::binary>> = data
|
4
|
+
case value do<% for v in e.elements.values %>
|
5
|
+
<%= v.value %> -> {data, <%= v.elixir_name %>}<% end %>
|
6
|
+
_ -> :error
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def <%= e.elixir_write_name %>(data, value) do
|
11
|
+
case value do<% for v in e.elements.values %>
|
12
|
+
<%= v.elixir_name %> -> <<data::binary, <%= v.value %>::32-little>><% end %>
|
13
|
+
_ -> :error
|
14
|
+
end
|
15
|
+
end
|
16
|
+
<% end %>end
|
17
|
+
|
18
|
+
<% for s in runtime.structs.values %>
|
19
|
+
defmodule <%= node.namespace %>.<%= s.name %> do
|
20
|
+
defstruct [<%= s.elixir_members %>]
|
21
|
+
|
22
|
+
import <%= node.namespace %>.Enums
|
23
|
+
|
24
|
+
@typedoc """
|
25
|
+
<%= s.doc %><% for m in s.members %>
|
26
|
+
`:<%= m.elixir_name %>`: <%= m.doc %><% end %>
|
27
|
+
"""
|
28
|
+
@type t :: %<%= node.namespace %>.<%= s.name %>{<%= s.elixir_members_with_types node %>}
|
29
|
+
|
30
|
+
def read(data) do<% for m in s.members %>
|
31
|
+
{data, <%= m.elixir_name %>} = <%= m.type.elixir_read node %><% end %>
|
32
|
+
{data, %<%= node.namespace %>.<%= s.name %>{<%= s.elixir_members_with_values %>}}
|
33
|
+
end
|
34
|
+
|
35
|
+
def write(data, value) do<% for m in s.members %>
|
36
|
+
data = <%= m.type.elixir_write node, 'value.' + m.elixir_name %><% end %>
|
37
|
+
data
|
38
|
+
end
|
39
|
+
end
|
40
|
+
<% end %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brotorift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Ren
|
@@ -67,6 +67,7 @@ files:
|
|
67
67
|
- lib/compiler_error.rb
|
68
68
|
- lib/generators/elixir_server_generator.ex.erb
|
69
69
|
- lib/generators/elixir_server_generator.rb
|
70
|
+
- lib/generators/elixir_server_types_generator.ex.erb
|
70
71
|
- lib/generators/scala_server_generator.rb
|
71
72
|
- lib/generators/scala_server_generator.scala.erb
|
72
73
|
- lib/generators/unity_client_generator.cs.erb
|