updated verse to version r6p1
[blender.git] / extern / verse / dist / v_gen_pack_t_node.c
1 /*
2 ** This is automatically generated source code -- do not edit.
3 ** Changes are affected either by editing the corresponding protocol
4 ** definition file (v_cmd_def_X.c where X=node type), or by editing
5 ** the code generator itself, in v_cmd_gen.c.
6 */
7
8 #include <stdlib.h>
9 #include <stdio.h>
10
11 #include "v_cmd_gen.h"
12 #if !defined(V_GENERATE_FUNC_MODE)
13 #include "verse.h"
14 #include "v_cmd_buf.h"
15 #include "v_network_out_que.h"
16 #include "v_network.h"
17 #include "v_connection.h"
18 #include "v_util.h"
19
20 void verse_send_t_language_set(VNodeID node_id, const char *language)
21 {
22         uint8 *buf;
23         unsigned int buffer_pos = 0;
24         VCMDBufHead *head;
25         head = v_cmd_buf_allocate(VCMDBS_1500);/* Allocating the buffer */
26         buf = ((VCMDBuffer10 *)head)->buf;
27
28         buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], 96); /* Pack the command. */
29 #if defined V_PRINT_SEND_COMMANDS
30         printf("send: verse_send_t_language_set(node_id = %u language = %s );\n", node_id, language);
31 #endif
32         buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
33         buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], language, 512);
34         if(node_id == (uint32) ~0u)
35                 v_cmd_buf_set_unique_address_size(head, 5);
36         else
37                 v_cmd_buf_set_address_size(head, 5);
38         v_cmd_buf_set_size(head, buffer_pos);
39         v_noq_send_buf(v_con_get_network_queue(), head);
40 }
41
42 unsigned int v_unpack_t_language_set(const char *buf, size_t buffer_length)
43 {
44         unsigned int buffer_pos = 0;
45         void (* func_t_language_set)(void *user_data, VNodeID node_id, const char *language);
46         VNodeID node_id;
47         char language[512];
48         
49         func_t_language_set = v_fs_get_user_func(96);
50         if(buffer_length < 4)
51                 return -1;
52         buffer_pos += vnp_raw_unpack_uint32(&buf[buffer_pos], &node_id);
53         buffer_pos += vnp_raw_unpack_string(&buf[buffer_pos], language, 512, buffer_length - buffer_pos);
54 #if defined V_PRINT_RECEIVE_COMMANDS
55         printf("receive: verse_send_t_language_set(node_id = %u language = %s ); callback = %p\n", node_id, language, v_fs_get_user_func(96));
56 #endif
57         if(func_t_language_set != NULL)
58                 func_t_language_set(v_fs_get_user_data(96), node_id, language);
59
60         return buffer_pos;
61 }
62
63 void verse_send_t_buffer_create(VNodeID node_id, VBufferID buffer_id, const char *name)
64 {
65         uint8 *buf;
66         unsigned int buffer_pos = 0;
67         VCMDBufHead *head;
68         head = v_cmd_buf_allocate(VCMDBS_30);/* Allocating the buffer */
69         buf = ((VCMDBuffer10 *)head)->buf;
70
71         buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], 97); /* Pack the command. */
72 #if defined V_PRINT_SEND_COMMANDS
73         printf("send: verse_send_t_buffer_create(node_id = %u buffer_id = %u name = %s );\n", node_id, buffer_id, name);
74 #endif
75         buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
76         buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], buffer_id);
77         buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], name, 16);
78         if(node_id == (uint32) ~0u || buffer_id == (uint16) ~0u)
79                 v_cmd_buf_set_unique_address_size(head, 7);
80         else
81                 v_cmd_buf_set_address_size(head, 7);
82         v_cmd_buf_set_size(head, buffer_pos);
83         v_noq_send_buf(v_con_get_network_queue(), head);
84 }
85
86 void verse_send_t_buffer_destroy(VNodeID node_id, VBufferID buffer_id)
87 {
88         uint8 *buf;
89         unsigned int buffer_pos = 0;
90         VCMDBufHead *head;
91         head = v_cmd_buf_allocate(VCMDBS_30);/* Allocating the buffer */
92         buf = ((VCMDBuffer10 *)head)->buf;
93
94         buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], 97); /* Pack the command. */
95 #if defined V_PRINT_SEND_COMMANDS
96         printf("send: verse_send_t_buffer_destroy(node_id = %u buffer_id = %u );\n", node_id, buffer_id);
97 #endif
98         buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
99         buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], buffer_id);
100         buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 16);
101         if(node_id == (uint32) ~0u || buffer_id == (uint16) ~0u)
102                 v_cmd_buf_set_unique_address_size(head, 7);
103         else
104                 v_cmd_buf_set_address_size(head, 7);
105         v_cmd_buf_set_size(head, buffer_pos);
106         v_noq_send_buf(v_con_get_network_queue(), head);
107 }
108
109 unsigned int v_unpack_t_buffer_create(const char *buf, size_t buffer_length)
110 {
111         unsigned int buffer_pos = 0;
112         void (* func_t_buffer_create)(void *user_data, VNodeID node_id, VBufferID buffer_id, const char *name);
113         VNodeID node_id;
114         VBufferID buffer_id;
115         char name[16];
116         
117         func_t_buffer_create = v_fs_get_user_func(97);
118         if(buffer_length < 6)
119                 return -1;
120         buffer_pos += vnp_raw_unpack_uint32(&buf[buffer_pos], &node_id);
121         buffer_pos += vnp_raw_unpack_uint16(&buf[buffer_pos], &buffer_id);
122         buffer_pos += vnp_raw_unpack_string(&buf[buffer_pos], name, 16, buffer_length - buffer_pos);
123 #if defined V_PRINT_RECEIVE_COMMANDS
124         if(name[0] == 0)
125                 printf("receive: verse_send_t_buffer_destroy(node_id = %u buffer_id = %u ); callback = %p\n", node_id, buffer_id, v_fs_get_alias_user_func(97));
126         else
127                 printf("receive: verse_send_t_buffer_create(node_id = %u buffer_id = %u name = %s ); callback = %p\n", node_id, buffer_id, name, v_fs_get_user_func(97));
128 #endif
129         if(name[0] == 0)
130         {
131                 void (* alias_t_buffer_destroy)(void *user_data, VNodeID node_id, VBufferID buffer_id);
132                 alias_t_buffer_destroy = v_fs_get_alias_user_func(97);
133                 if(alias_t_buffer_destroy != NULL)
134                         alias_t_buffer_destroy(v_fs_get_alias_user_data(97), node_id, buffer_id);
135                 return buffer_pos;
136         }
137         if(func_t_buffer_create != NULL)
138                 func_t_buffer_create(v_fs_get_user_data(97), node_id, buffer_id, name);
139
140         return buffer_pos;
141 }
142
143 void verse_send_t_buffer_subscribe(VNodeID node_id, VBufferID buffer_id)
144 {
145         uint8 *buf;
146         unsigned int buffer_pos = 0;
147         VCMDBufHead *head;
148         head = v_cmd_buf_allocate(VCMDBS_10);/* Allocating the buffer */
149         buf = ((VCMDBuffer10 *)head)->buf;
150
151         buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], 98); /* Pack the command. */
152 #if defined V_PRINT_SEND_COMMANDS
153         printf("send: verse_send_t_buffer_subscribe(node_id = %u buffer_id = %u );\n", node_id, buffer_id);
154 #endif
155         buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
156         buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], buffer_id);
157         buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], TRUE);
158         if(node_id == (uint32) ~0u || buffer_id == (uint16) ~0u)
159                 v_cmd_buf_set_unique_address_size(head, 7);
160         else
161                 v_cmd_buf_set_address_size(head, 7);
162         v_cmd_buf_set_size(head, buffer_pos);
163         v_noq_send_buf(v_con_get_network_queue(), head);
164 }
165
166 void verse_send_t_buffer_unsubscribe(VNodeID node_id, VBufferID buffer_id)
167 {
168         uint8 *buf;
169         unsigned int buffer_pos = 0;
170         VCMDBufHead *head;
171         head = v_cmd_buf_allocate(VCMDBS_10);/* Allocating the buffer */
172         buf = ((VCMDBuffer10 *)head)->buf;
173
174         buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], 98); /* Pack the command. */
175 #if defined V_PRINT_SEND_COMMANDS
176         printf("send: verse_send_t_buffer_unsubscribe(node_id = %u buffer_id = %u );\n", node_id, buffer_id);
177 #endif
178         buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
179         buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], buffer_id);
180         buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], FALSE);
181         if(node_id == (uint32) ~0u || buffer_id == (uint16) ~0u)
182                 v_cmd_buf_set_unique_address_size(head, 7);
183         else
184                 v_cmd_buf_set_address_size(head, 7);
185         v_cmd_buf_set_size(head, buffer_pos);
186         v_noq_send_buf(v_con_get_network_queue(), head);
187 }
188
189 unsigned int v_unpack_t_buffer_subscribe(const char *buf, size_t buffer_length)
190 {
191         unsigned int buffer_pos = 0;
192         void (* func_t_buffer_subscribe)(void *user_data, VNodeID node_id, VBufferID buffer_id);
193         VNodeID node_id;
194         VBufferID buffer_id;
195         uint8   alias_bool;
196
197         func_t_buffer_subscribe = v_fs_get_user_func(98);
198         if(buffer_length < 6)
199                 return -1;
200         buffer_pos += vnp_raw_unpack_uint32(&buf[buffer_pos], &node_id);
201         buffer_pos += vnp_raw_unpack_uint16(&buf[buffer_pos], &buffer_id);
202         if(buffer_length < buffer_pos + 1)
203                 return -1;
204         buffer_pos += vnp_raw_unpack_uint8(&buf[buffer_pos], &alias_bool);
205 #if defined V_PRINT_RECEIVE_COMMANDS
206         if(!alias_bool)
207                 printf("receive: verse_send_t_buffer_unsubscribe(node_id = %u buffer_id = %u ); callback = %p\n", node_id, buffer_id, v_fs_get_alias_user_func(98));
208         else
209                 printf("receive: verse_send_t_buffer_subscribe(node_id = %u buffer_id = %u ); callback = %p\n", node_id, buffer_id, v_fs_get_user_func(98));
210 #endif
211         if(!alias_bool)
212         {
213                 void (* alias_t_buffer_unsubscribe)(void *user_data, VNodeID node_id, VBufferID buffer_id);
214                 alias_t_buffer_unsubscribe = v_fs_get_alias_user_func(98);
215                 if(alias_t_buffer_unsubscribe != NULL)
216                         alias_t_buffer_unsubscribe(v_fs_get_alias_user_data(98), node_id, buffer_id);
217                 return buffer_pos;
218         }
219         if(func_t_buffer_subscribe != NULL)
220                 func_t_buffer_subscribe(v_fs_get_user_data(98), node_id, buffer_id);
221
222         return buffer_pos;
223 }
224
225 #endif
226