protomsg 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
data/lib/templates/header.h
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
#pragma pack(push)
|
2
|
+
#pragma pack(1)
|
1
3
|
typedef struct {
|
2
4
|
char _version;
|
3
5
|
char _type;<% @attributes.each do |attr|%>
|
@@ -10,3 +12,4 @@ typedef struct {
|
|
10
12
|
void *<%= attr.name %>;
|
11
13
|
size_t <%= attr.name %>_length;<% end %>
|
12
14
|
} <%= @name %>;
|
15
|
+
#pragma pack(pop)
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
long long <%= @name %>_length;
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
long long <%= @name %>_length;
|
data/lib/templates/io.h
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
#define read_<%= @name %>(msg, sock, error) {\
|
10
10
|
error = 0;\
|
11
11
|
if(!msg) {\
|
12
|
-
msg = (<%= @name %> *)
|
12
|
+
msg = (<%= @name %> *) calloc(1, sizeof(<%= @name %>));\
|
13
13
|
msg->header_length = sizeof(<%= @name %>_header);\
|
14
14
|
msg->header = (<%= @name %>_header *)malloc(sizeof(<%= @name %>_header));\
|
15
15
|
}\
|
data/lib/templates/lengths.h
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
<% variable_attributes.each do |attr| %>#define <%= @name %>_<%= attr.name %>_length(msg) (msg-><%= attr.name %>_length)
|
2
|
-
<% end %>#define <%= @name %>_length(msg) (msg->header_length <%= variable_attributes.size > 0 ? ("+ " + variable_attributes.collect {|attr| "msg->#{attr.name}_length"}.join(" + ")) : '' %>)<% if variable_attributes.size > 0 %>
|
3
|
-
#define <%= @name %>_variable_length(msg) (<%= variable_attributes.collect {|attr| "msg->#{attr.name}_length"}.join(" + ")%>)<% end %>
|
1
|
+
<% variable_attributes.each do |attr| %>#define <%= @name %>_<%= attr.name %>_length(msg) (msg->header-><%= attr.name %>_length)
|
2
|
+
<% end %>#define <%= @name %>_length(msg) (msg->header_length <%= variable_attributes.size > 0 ? ("+ " + variable_attributes.collect {|attr| "msg->header->#{attr.name}_length"}.join(" + ")) : '' %>)<% if variable_attributes.size > 0 %>
|
3
|
+
#define <%= @name %>_variable_length(msg) (<%= variable_attributes.collect {|attr| "msg->header->#{attr.name}_length"}.join(" + ")%>)<% end %>
|
data/lib/templates/protomsg.h
CHANGED
@@ -9,8 +9,8 @@
|
|
9
9
|
#define __protomsg__
|
10
10
|
|
11
11
|
#define PROTO_MESSAGE_VERSION 1
|
12
|
-
#define INVALID_PROTOMSG_VERSION 1
|
13
|
-
#define INVALID_MESSAGE_TYPE 2
|
12
|
+
#define INVALID_PROTOMSG_VERSION -1
|
13
|
+
#define INVALID_MESSAGE_TYPE -2
|
14
14
|
|
15
15
|
#define safe_read(sock, buffer, size, error) {\
|
16
16
|
error = 0;\
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 8
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.8.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Will Cannings
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-06 00:00:00 +10:00
|
18
18
|
default_executable: protomsg
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|