updated verse to version r6p1
authorJiri Hnidek <jiri.hnidek@tul.cz>
Mon, 2 Oct 2006 13:29:17 +0000 (13:29 +0000)
committerJiri Hnidek <jiri.hnidek@tul.cz>
Mon, 2 Oct 2006 13:29:17 +0000 (13:29 +0000)
32 files changed:
extern/verse/dist/Makefile.win32
extern/verse/dist/README.html
extern/verse/dist/SConstruct
extern/verse/dist/v_cmd_def_g.c
extern/verse/dist/v_cmd_def_o.c
extern/verse/dist/v_cmd_def_s.c
extern/verse/dist/v_cmd_def_t.c
extern/verse/dist/v_cmd_gen.c
extern/verse/dist/v_connection.c
extern/verse/dist/v_gen_pack_a_node.c
extern/verse/dist/v_gen_pack_b_node.c
extern/verse/dist/v_gen_pack_c_node.c
extern/verse/dist/v_gen_pack_g_node.c
extern/verse/dist/v_gen_pack_init.c
extern/verse/dist/v_gen_pack_m_node.c
extern/verse/dist/v_gen_pack_o_node.c
extern/verse/dist/v_gen_pack_s_node.c
extern/verse/dist/v_gen_pack_t_node.c
extern/verse/dist/v_gen_unpack_func.h
extern/verse/dist/v_man_pack_node.c
extern/verse/dist/v_network.c
extern/verse/dist/v_network_in_que.c
extern/verse/dist/v_network_in_que.h
extern/verse/dist/verse.h
extern/verse/dist/verse_header.h
extern/verse/dist/vs_main.c
extern/verse/dist/vs_node_audio.c
extern/verse/dist/vs_node_geometry.c
extern/verse/dist/vs_node_material.c
extern/verse/dist/vs_node_object.c
extern/verse/dist/vs_node_text.c
extern/verse/dist/vs_server.h

index 84ca20df7b5c34b216c96fc5d90b7a43ecf35b2d..548881c6a16d27dccecfc34ceabcdd8fdb0f8234 100644 (file)
@@ -44,8 +44,8 @@ LIBVERSE_OBJ = v_gen_pack_init.obj v_gen_pack_a_node.obj v_gen_pack_b_node.obj v
                v_pack.obj v_pack_method.obj v_prime.obj v_randgen.obj v_util.obj
 
 # The server is a simple 1:1 mapping, but in Windows nmake ... That doesn't help much. :/
-VERSE_SRC = vs_connection.c vs_main.c vs_node_audio.c vs_node_bitmap.c vs_node_curve.c vs_node_geometry.c vs_node_head.c vs_node_material.c vs_node_object.c vs_node_particle.c vs_node_storage.c vs_node_text.c
-VERSE_OBJ = vs_connection.obj vs_main.obj vs_node_audio.obj vs_node_bitmap.obj vs_node_curve.obj vs_node_geometry.obj \
+VERSE_SRC = vs_connection.c vs_main.c vs_master.c vs_node_audio.c vs_node_bitmap.c vs_node_curve.c vs_node_geometry.c vs_node_head.c vs_node_material.c vs_node_object.c vs_node_particle.c vs_node_storage.c vs_node_text.c
+VERSE_OBJ = vs_connection.obj vs_main.obj vs_master.obj vs_node_audio.obj vs_node_bitmap.obj vs_node_curve.obj vs_node_geometry.obj \
        vs_node_head.obj vs_node_material.obj vs_node_object.obj vs_node_particle.obj vs_node_storage.obj vs_node_text.obj
 
 # -----------------------------------------------------
index ab4f8bf37481d39d7d85d4bbf38fc830cb6219a4..b3b3050bf12782f2e4bf485128b1dfded2c0a8ad 100644 (file)
@@ -2,6 +2,7 @@
 <html>
 <head>
 <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Verse README</title>
 <style type="text/css">
 
 h1.title {
@@ -58,6 +59,10 @@ Running "make" here will build the API library, "libverse.a" (and its
 header file, "verse.h"). These two will then be used to build the
 reference Verse server binary, called "verse".
 </p>
+<p>
+If you are more comfortable with <a href="http://www.scons.org/">SCons</a>, and of course have it
+installed on your system, you can type "scons" instead.
+</p>
 
 <h1>Starting the Server</h1>
 <p>
@@ -79,18 +84,39 @@ It is possible that it gets assigned to someone else, in case Verse will need to
 You can use the following command line options to control the server's operation:
 </p>
 <dl>
- <dt>-port=N</dt>
+ <dt>-h</dt>
+ <dd>
+  Print a help text, that shows all understood options.
+ </dd>
+ <dt>-ms</dt>
+ <dd>
+  Enables master server communications to the default, built-in address. Use the -h option to learn
+  what this address is. Please note that master server communication is <strong>disabled</strong> by default.
+ </dd>
+ <dt>-ms:ip=IP</dt>
  <dd>
-  Use the indicated port number, rather than the default.
+  Sets a new address to use for master server communication. This also implies -ms, i.e. the server
+  will try to register itself with the given master server. For details on the protocol used to do
+  this, please see the <a href="http://verse.blender.org/cms/Master_Server__v2.775.0.html">spec</a>.
  </dd>
- <dt>-master=IP</dt>
+ <dt>-ms:de=DESC</dt>
  <dd>
-  Connect to a <a href="http://verse.blender.org/cms/Master_Server.713.0.html">master server</a> at address <i>IP</i>.
+  Sets the description to use for this server, when registering with the the master server. This is
+  only used if master server communication is actually enabled. The description is expected to be a
+  human-readable string, like <code>"A test server, run on a cable modem, and offline during local daytime"</code>
+  or something.
  </dd>
- <dt>-Q</dt>
+ <dt>-ms:ta=TAGS</dt>
  <dd>
-  Don't register with a <a href="http://verse.blender.org/cms/Master_Server.713.0.html">master server</a>.
-  This is currently the default, as master server operation has not been widely used.
+  Sets the tags to use for this server, when registering with the the master server. This is only used
+  if master server communication is actually enabled. The tags consists of a comma-separated list of
+  single words. Each word must begin with a letter, and contain only letters, digits, or underscore
+  characters. For instance: <code>home,r6p1,linux,sweden,open</code>.
+ </dd>
+ <dt>-port=N</dt>
+ <dd>
+  Use the indicated port number, rather than the default. Note that ports below 1024 are generally
+  off-limits to ordinary users. Running Verse on such a port is not recommended.
  </dd>
  <dt>-version</dt>
  <dd>
@@ -99,10 +125,16 @@ You can use the following command line options to control the server's operation
  </dd>
 </dl>
 <p>
-For example, here is how to start the server, with a master server of <code>master.example.org</code>,
-and a port number equal to 16333:
+For example, here is how to start the server, register it with the default master server, and run
+on port number equal to 16333:
+</p>
+<pre class="shell">~> ./server -ms -port=16333
+</pre>
+<p>
+Here is a more complicated example, that uses an explicit master server address, and also sets both
+the description and tags:
 </p>
-<pre class="shell">~> ./server -master=master.example.org -port=16333
+<pre class="shell">~> ./server -ms:ip=master.example.net -ms:de="A test server, for the documentation" -ms:ta=example,docs
 </pre>
 <p>
 Options can occur in any order, with later options overriding earlier ones, in case of conflicts.
index 42c9a58a8c400f5114b58890630001efcf94a03b..f2256c225afed50a0000f08cdc3dd8b7ffe72d9a 100644 (file)
@@ -1,12 +1,4 @@
-#
-# SConstruct for Verse
-#
-# This file is still quite crude, but it does it's job, and
-# is geared towards future extensions.
-#
-# I did this only on Windows so people should look into the
-# if...elif...
-# construction about the platform specific stuff.
+#!/usr/bin/env python
 #
 # I think it is quite straight-forward to add new platforms,
 # just look at the old makefile and at the existing platforms.
 
 import os
 import sys
+import re
 import time
 import string
 from distutils import sysconfig
 
-Import('env')
-
 root_build_dir = '..' + os.sep + 'build' + os.sep
 
+config_file = 'config.opts'
+version = '1.0'
+
+env = Environment ()
+
 defines = []
 cflags = []
 debug_flags = []
@@ -37,88 +33,130 @@ platform_libs = []
 platform_libpath = []
 platform_linkflags = []
 
-window_system = env['OURPLATFORM']
-if window_system == 'win32-vc':
+if sys.platform == 'win32':
     print "Building on win32"
     defines += ['_WIN32']
     warn_flags = ['/Wall']
     platform_libs = ['ws2_32']
-elif window_system == 'win32-mingw':
-    defines += ['_WIN32', 'WIN32']
-    platform_libs = ['shell32', 'kernel32', 'gdi32', 'user32', 'ws2_32']
-elif window_system == 'linux2':
+elif sys.platform == 'linux2':
     print "Building on linux2"
-elif window_system== 'openbsd3':
+elif sys.platform == 'openbsd3':
     print "Building on openbsd3"
 
-user_options_dict = env #user_options_env.Dictionary()
 
-root_build_dir = user_options_dict['BF_BUILDDIR'] + os.sep + "extern" + os.sep + "verse"
-
-if user_options_dict['VERSE_BUILD_BINARY'] == 'release':
+env_dict = env.Dictionary()
+if os.path.exists (config_file):
+    print "Using config file: " + config_file
+else:
+    print "Creating new config file: " + config_file
+    config = open (config_file, 'w')
+    config.write ("#Configuration file for verse SCons user definable options.\n")
+    config.write ("BUILD_BINARY = 'release'\n")
+    config.write ("\n# Compiler information.\n")
+    config.write ("HOST_CC = %r\n"%(env_dict['CC']))
+    config.write ("HOST_CXX = %r\n"%(env_dict['CXX']))
+    config.write ("TARGET_CC = %r\n"%(env_dict['CC']))
+    config.write ("TARGET_CXX = %r\n"%(env_dict['CXX']))
+    config.write ("TARGET_AR = %r\n"%(env_dict['AR']))
+    config.write ("PATH = %r\n"%(os.environ['PATH']))
+
+user_options_env = Environment()
+user_options = Options (config_file)
+user_options.AddOptions(
+    (EnumOption ('BUILD_BINARY',
+        'Build a release or debug binary.', 'release',
+        allowed_values = ('release', 'debug'))),
+    ('BUILD_DIR', 'Target directory for intermediate files.',
+        root_build_dir),
+    (EnumOption ('REGEN_PROTO',
+        'Whether to regenerate the protocol files', 'no',
+        allowed_values = ('yes', 'no'))),
+    ('HOST_CC', 'C compiler for the host platfor. This is the same as target platform when not cross compiling.', env_dict['CC']),
+    ('HOST_CXX', 'C++ compiler for the host platform. This is the same as target platform when not cross compiling.', env_dict['CXX']),
+    ('TARGET_CC', 'C compiler for the target platform.', env_dict['CC']),
+    ('TARGET_CXX', 'C++ compiler for the target platform.', env_dict['CXX']),
+    ('TARGET_AR', 'Linker command for linking libraries.', env_dict['AR']),
+    ('PATH', 'Standard search path', os.environ['PATH'])
+)
+user_options.Update (user_options_env)
+user_options_dict = user_options_env.Dictionary()
+
+root_build_dir = user_options_dict['BUILD_DIR']
+
+if user_options_dict['BUILD_BINARY'] == 'release':
     cflags = extra_flags + release_flags + warn_flags
-    if window_system == 'win32-vc':
+    if sys.platform == 'win32':
         defines += ['NDEBUG']
 else:
     cflags = extra_flags + debug_flags + warn_flags
-    if window_system== 'win32-vc':
+    if sys.platform == 'win32':
         #defines += ['_DEBUG'] specifying this makes msvc want to link to python22_d.lib??
         platform_linkflags += ['/DEBUG','/PDB:verse.pdb']
 
-library_env = env.Copy() #Environment()
-library_env.Replace (CC = user_options_dict['CC'])
-library_env.Replace (CXX = user_options_dict['CXX'])
-#library_env.Replace (PATH = user_options_dict['PATH'])
-#library_env.Replace (AR = user_options_dict['TARGET_AR'])
+
+env = Environment()
+env.Replace (CC = user_options_dict['TARGET_CC'])
+env.Replace (CXX = user_options_dict['TARGET_CXX'])
+env.Replace (PATH = user_options_dict['PATH'])
+env.Replace (AR = user_options_dict['TARGET_AR'])
 
 cmd_gen_files = (['v_cmd_gen.c',
-                  'v_cmd_def_a.c',
-                  'v_cmd_def_b.c',
-                  'v_cmd_def_c.c',
-                  'v_cmd_def_g.c',
-                  'v_cmd_def_m.c',
-                  'v_cmd_def_o.c',
-                  'v_cmd_def_s.c',
-                  'v_cmd_def_t.c'
-                  ])
-
-cmd_gen_deps = (['v_gen_pack_init.c',
-                 'v_gen_pack_a_node.c',
-                 'v_gen_pack_b_node.c',
-                 'v_gen_pack_c_node.c',
-                 'v_gen_pack_g_node.c',
-                 'v_gen_pack_m_node.c',
-                 'v_gen_pack_o_node.c',
-                 'v_gen_pack_s_node.c',
-                 'v_gen_pack_t_node.c',
-                ])
-
-if user_options_dict['VERSE_REGEN_PROTO']=='yes':
-    cmd_gen_env = library_env.Copy()
-    cmd_gen_env.Append(CPPDEFINES=['V_GENERATE_FUNC_MODE'])
-    mkprot = cmd_gen_env.Program(target='mkprot', source=cmd_gen_files)
-    cmd_gen_env.Command('regen', '' , './mkprot')
+                                 'v_cmd_def_a.c',
+                                 'v_cmd_def_b.c',
+                                 'v_cmd_def_c.c',
+                                 'v_cmd_def_g.c',
+                                 'v_cmd_def_m.c',
+                                 'v_cmd_def_o.c',
+                                 'v_cmd_def_s.c',
+                                 'v_cmd_def_t.c'
+                                 ])
+
+cmd_gen_deps = (['v_gen_pack_init.c'])
+
+proto_env = env.Copy()
+proto_env.Append(CPPDEFINES=['V_GENERATE_FUNC_MODE'])
+mkprot_tool = proto_env.Program(target = 'mkprot', source = cmd_gen_files)
+
+mkprot_re = re.compile('v_cmd_def_([a-z]{1}).c')
+def mkprot_emitter(target = None, source = None, env = None):
+       newtargets = list()
+       for s in source:
+               m = mkprot_re.match(str(s))
+               if m:
+                       newtargets.append("v_gen_pack_"+m.group(1)+"_node.c")
+       newtargets.extend(['verse.h'])
+       env.Depends(newtargets, mkprot_tool)
+       return (newtargets, source)
+
+mkprot_bld = Builder(action = "\"" + mkprot_tool[0].abspath + "\"",
+                       emitter = mkprot_emitter)
+
+env['BUILDERS']['Protocol'] = mkprot_bld
+
+cmd_gen_deps.extend(env.Protocol('do_mkprot', cmd_gen_files))
+cmd_gen_deps.pop()
 
 lib_source_files = (['v_cmd_buf.c',
-                     'v_connect.c',
-                     'v_connection.c',
-                     'v_encryption.c',
-                     'v_func_storage.c',
-                     'v_man_pack_node.c',
-                     'v_network.c',
-                     'v_network_in_que.c',
-                     'v_network_out_que.c',
-                     'v_pack.c',
-                     'v_pack_method.c',
-                     'v_prime.c',
-                     'v_randgen.c',
-                     'v_util.c',
-                     'v_bignum.c'
-                     ])
-lib_source_files += cmd_gen_deps
+                                        'v_connect.c',
+                                        'v_connection.c',
+                                        'v_encryption.c',
+                                        'v_func_storage.c',
+                                        'v_man_pack_node.c',
+                                        'v_network.c',
+                                        'v_network_in_que.c',
+                                        'v_network_out_que.c',
+                                        'v_pack.c',
+                                        'v_pack_method.c',
+                                        'v_prime.c',
+                                        'v_randgen.c',
+                                        'v_util.c',
+                                        'v_bignum.c'
+                                        ])
+lib_source_files.extend(cmd_gen_deps)
 
 server_source_files = (['vs_connection.c',
                         'vs_main.c',
+                        'vs_master.c',
                         'vs_node_audio.c',
                         'vs_node_bitmap.c',
                         'vs_node_curve.c',
@@ -131,21 +169,25 @@ server_source_files = (['vs_connection.c',
                         'vs_node_text.c'
                         ])
 
-verselib_env = library_env.Copy()
+verse_example_sources = (['examples/list-nodes.c'])
+
+verselib_env = env.Copy()
 verselib_env.Append(CPPDEFINES = defines)
 
-#server commented out for now, though maybe there
-#should be an option to build it.
 verseserver_env = env.Copy()
 verseserver_env.Append(CPPDEFINES = defines)
-verseserver_env.Append (LIBS=['verse'])
+verseserver_env.Append (LIBS=['libverse'])
+verseserver_env.Append (LIBPATH = ['.'])
 verseserver_env.Append (LIBS= platform_libs)
 
-verselib = env.BlenderLib(libname='verse', sources=lib_source_files, includes=[], defines=defines, libtype=['core', 'intern'], priority = [5, 5])
+verseexample_env = env.Copy()
+verseexample_env.Append(CPPDEFINES = defines)
+verseexample_env.Append (LIBS=['libverse'])
+verseexample_env.Append (LIBPATH = ['.'])
+verseexample_env.Append (LIBS= platform_libs)
+verseexample_env.Append (CPPPATH = ['.'])
+
+verselib = verselib_env.Library(target='libverse', source=lib_source_files)
+verseserver_env.Program(target='verse', source=server_source_files)
+verseexample_env.Program(target='list-nodes', source=verse_example_sources)
 
-verseserver_env.BlenderProg(builddir="#"+root_build_dir, progname="verse",
-  sources=server_source_files, libs=['verse'],
-  libpath='#'+user_options_dict['BF_BUILDDIR']+'/lib')
-if user_options_dict['VERSE_REGEN_PROTO']=='yes':
-    verselib_env.Depends(verselib, mkprot)
index 66c26e9eadd4fcb3ef5a215a50a92d2b8c216865..5a4ea7202b4b2c1ebdd065f33ad6cf39416e7fcd 100644 (file)
@@ -172,19 +172,9 @@ void v_gen_geometry_cmd_def(void)
        v_cg_add_param(VCGP_REAL64,             "pos_x");
        v_cg_add_param(VCGP_REAL64,             "pos_y");
        v_cg_add_param(VCGP_REAL64,             "pos_z");
-       v_cg_add_param(VCGP_NAME,               "pos_label");
-       v_cg_add_param(VCGP_POINTER_TYPE,       "VNQuat64");
-       v_cg_add_param(VCGP_POINTER,            "rot");
-       v_cg_add_param(VCGP_NAME,               "rot_label");
-       v_cg_add_param(VCGP_PACK_INLINE,        "\tif(weight[0] != '\\0')\n\t\tbuffer_pos += vnp_pack_quat64(&buf[buffer_pos], rot);\n");
-       v_cg_add_param(VCGP_UNPACK_INLINE,      "\tif(weight[0] != 0)\n"
-       "\t{\n"
-       "\t\tVNQuat64\ttmp;\n"
-       "\t\tbuffer_pos += vnp_unpack_quat64(&buf[buffer_pos], &tmp);\n"
-       "\t\tif(func_g_bone_create != NULL)\n"
-       "\t\t\tfunc_g_bone_create(v_fs_get_user_data(64), node_id, bone_id, weight, reference, parent, pos_x, pos_y, pos_z, pos_label, &tmp, rot_label);\n"
-       "\t\treturn buffer_pos;\n"
-       "\t}\n");
+       v_cg_add_param(VCGP_NAME,               "position_label");
+       v_cg_add_param(VCGP_NAME,               "rotation_label");
+       v_cg_add_param(VCGP_NAME,               "scale_label");
        v_cg_alias(FALSE, "g_bone_destroy", "if(weight[0] == 0)", 2, NULL);
 
        v_cg_end_cmd();
index 4fc5e894b36f5ce0a91d40e0201557c6dd604308..a0135f2a4a756ed3afa1420a0b69bf6a9bde60e9 100644 (file)
@@ -299,7 +299,7 @@ void v_gen_object_cmd_def(void)
        "\t\telse\n"
        "\t\t\tdrag = 0.0;\n"
        "\t\tif(func_o_transform_rot_real64 != NULL)\n"
-       "\t\t\tfunc_o_transform_rot_real64(v_fs_get_user_data(33), node_id, time_s, time_f, &trot, q[0], q[1], q[2], drag);\n"
+       "\t\t\tfunc_o_transform_rot_real64(v_fs_get_user_data(36), node_id, time_s, time_f, &trot, q[0], q[1], q[2], drag);\n"
        "\t\treturn buffer_pos;\n"
        "\t}\n");
        v_cg_add_param(VCGP_REAL64,             "drag");        
index a20e1daa430ea1bffd94d02ef1a7c65c2174e6f5..1b8b69dcd6de125d122282790eef50d64bc8bd02 100644 (file)
@@ -49,7 +49,7 @@ void v_gen_system_cmd_def(void)
        v_cg_add_param(VCGP_ENUM,               "type");
        v_cg_add_param(VCGP_ENUM_NAME,  "VNodeOwner");
        v_cg_add_param(VCGP_ENUM,               "owner");
-       v_cg_alias(FALSE, "node_destroy", "if(owner == (uint8)-1 || type >= V_NT_NUM_TYPES)", 1, NULL);
+       v_cg_alias(FALSE, "node_destroy", "if(owner == (uint8) ~0u || type >= V_NT_NUM_TYPES)", 1, NULL);
        v_cg_end_cmd();
 
        v_cg_new_cmd(V_NT_SYSTEM,               "node_subscribe", 11, VCGCT_NORMAL);
index 1e739aa21e70dba368951ea56842968064a8c4d5..3c568b42d7bb52099d319637a4718d9970590309 100644 (file)
@@ -9,7 +9,7 @@
 
 void v_gen_text_cmd_def(void)
 {
-       v_cg_new_cmd(V_NT_TEXT,                 "t_set_language", 96, VCGCT_NORMAL);
+       v_cg_new_cmd(V_NT_TEXT,                 "t_language_set", 96, VCGCT_NORMAL);
        v_cg_add_param(VCGP_NODE_ID,    "node_id");
        v_cg_add_param(VCGP_END_ADDRESS, NULL);
        v_cg_add_param(VCGP_LONG_NAME,  "language");
index b687983382d083f2e536e0c8383bad8943dbcbf0..55b1eabfe977a83382148db142c4acd568da4702 100644 (file)
@@ -456,14 +456,14 @@ void v_cg_set_command_address(FILE *f, boolean alias)
                                case  VCGP_FRAGMENT_ID :
                                        if(count++ != 0)
                                                fprintf(f, " || ");
-                                       fprintf(f, "%s == (uint16)(-1)", VCGData.param_name[param[j]]);
+                                       fprintf(f, "%s == (uint16) ~0u", VCGData.param_name[param[j]]);
                                        break;
                                case  VCGP_NODE_ID : 
                                case  VCGP_UINT32 :
                                case  VCGP_REAL32 :
                                        if(count++ != 0)
                                                fprintf(f, " || ");
-                                       fprintf(f, "%s == (uint32)(-1)", VCGData.param_name[param[j]]);
+                                       fprintf(f, "%s == (uint32) ~0u", VCGData.param_name[param[j]]);
                                        break;
                        }
                        j++;
index b8631fc310b82c3df349b9fe6b30afb6dbfeec91..fe4bf7a3105cb5b0bb45cac3e1d3b744d8da23ec 100644 (file)
@@ -318,7 +318,9 @@ void verse_callback_update(unsigned int microseconds)
                        v_destroy_ordered_storage(VConData.con[VConData.current_connection].ordered_storage);
                        if(VConData.con[VConData.current_connection].expected_key != NULL)
                                free(VConData.con[VConData.current_connection].expected_key);
-                       VConData.con[VConData.current_connection] = VConData.con[--VConData.con_count];
+                       if(VConData.con_count - 1 != VConData.current_connection)
+                               VConData.con[VConData.current_connection] = VConData.con[VConData.con_count - 1];
+                       VConData.con_count--;
                        if(connection >= VConData.con_count)
                                VConData.current_connection = 0;
                        return;
index 4d6c4a46610704ce9f0f393f6c318c3bbcad9a59..dc8e53e1a7f36ea0a4059741c578b9ba57579844 100644 (file)
@@ -34,7 +34,7 @@ void verse_send_a_buffer_create(VNodeID node_id, VBufferID buffer_id, const char
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], name, 16);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)type);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], frequency);
-       if(node_id == (uint32)(-1) || buffer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || buffer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -59,7 +59,7 @@ void verse_send_a_buffer_destroy(VNodeID node_id, VBufferID buffer_id)
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 16);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)-1);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], V_REAL64_MAX);
-       if(node_id == (uint32)(-1) || buffer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || buffer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -124,7 +124,7 @@ void verse_send_a_buffer_subscribe(VNodeID node_id, VBufferID layer_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], TRUE);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -147,7 +147,7 @@ void verse_send_a_buffer_unsubscribe(VNodeID node_id, VBufferID layer_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], FALSE);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -208,7 +208,7 @@ void verse_send_a_block_set(VNodeID node_id, VLayerID buffer_id, uint32 block_in
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], block_index);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)type);
        buffer_pos += vnp_pack_audio_block(&buf[buffer_pos], type, samples);
-       if(node_id == (uint32)(-1) || buffer_id == (uint16)(-1) || block_index == (uint32)(-1))
+       if(node_id == (uint32) ~0u || buffer_id == (uint16) ~0u || block_index == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -232,7 +232,7 @@ void verse_send_a_block_clear(VNodeID node_id, VLayerID buffer_id, uint32 block_
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], buffer_id);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], block_index);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)-1);
-       if(node_id == (uint32)(-1) || buffer_id == (uint16)(-1) || block_index == (uint32)(-1))
+       if(node_id == (uint32) ~0u || buffer_id == (uint16) ~0u || block_index == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -303,7 +303,7 @@ void verse_send_a_stream_create(VNodeID node_id, VLayerID stream_id, const char
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], stream_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], name, 16);
-       if(node_id == (uint32)(-1) || stream_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || stream_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -326,7 +326,7 @@ void verse_send_a_stream_destroy(VNodeID node_id, VLayerID stream_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], stream_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 16);
-       if(node_id == (uint32)(-1) || stream_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || stream_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -383,7 +383,7 @@ void verse_send_a_stream_subscribe(VNodeID node_id, VLayerID stream_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], stream_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], TRUE);
-       if(node_id == (uint32)(-1) || stream_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || stream_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -406,7 +406,7 @@ void verse_send_a_stream_unsubscribe(VNodeID node_id, VLayerID stream_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], stream_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], FALSE);
-       if(node_id == (uint32)(-1) || stream_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || stream_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -469,7 +469,7 @@ void verse_send_a_stream(VNodeID node_id, VLayerID stream_id, uint32 time_s, uin
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)type);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], frequency);
        buffer_pos += vnp_pack_audio_block(&buf[buffer_pos], type, samples);
-       if(node_id == (uint32)(-1) || stream_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || stream_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
index 9ff7ab27bbc802ac2abe44c70f4804e8a9eb0539..a4792a10fe48e8ebe72cb9a0a68542b0a17cc323 100644 (file)
@@ -33,7 +33,7 @@ void verse_send_b_dimensions_set(VNodeID node_id, uint16 width, uint16 height, u
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], width);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], height);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], depth);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -82,7 +82,7 @@ void verse_send_b_layer_create(VNodeID node_id, VLayerID layer_id, const char *n
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], name, 16);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)type);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -106,7 +106,7 @@ void verse_send_b_layer_destroy(VNodeID node_id, VLayerID layer_id)
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 16);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)-1);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -169,7 +169,7 @@ void verse_send_b_layer_subscribe(VNodeID node_id, VLayerID layer_id, uint8 leve
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], level);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -192,7 +192,7 @@ void verse_send_b_layer_unsubscribe(VNodeID node_id, VLayerID layer_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], -1);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
index 192eac5a75159ca9d0df70e6bc6d9deae9f4ad63..b75fa2133839c9f3faa15b0d194edab904043fb5 100644 (file)
@@ -33,7 +33,7 @@ void verse_send_c_curve_create(VNodeID node_id, VLayerID curve_id, const char *n
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], curve_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], name, 16);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], dimensions);
-       if(node_id == (uint32)(-1) || curve_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || curve_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -57,7 +57,7 @@ void verse_send_c_curve_destroy(VNodeID node_id, VLayerID curve_id)
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], curve_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 16);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], -1);
-       if(node_id == (uint32)(-1) || curve_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || curve_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -118,7 +118,7 @@ void verse_send_c_curve_subscribe(VNodeID node_id, VLayerID curve_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], curve_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], TRUE);
-       if(node_id == (uint32)(-1) || curve_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || curve_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -141,7 +141,7 @@ void verse_send_c_curve_unsubscribe(VNodeID node_id, VLayerID curve_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], curve_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], FALSE);
-       if(node_id == (uint32)(-1) || curve_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || curve_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
index 7b2b0259cfe97d3518ef90f46723d899c1ff8764..5a70173554d9d5c788664f55155ee52c65bd853b 100644 (file)
@@ -35,7 +35,7 @@ void verse_send_g_layer_create(VNodeID node_id, VLayerID layer_id, const char *n
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)type);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], def_uint);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], def_real);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -61,7 +61,7 @@ void verse_send_g_layer_destroy(VNodeID node_id, VLayerID layer_id)
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)-1);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], -1);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], V_REAL64_MAX);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -128,7 +128,7 @@ void verse_send_g_layer_subscribe(VNodeID node_id, VLayerID layer_id, VNRealForm
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)type);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -151,7 +151,7 @@ void verse_send_g_layer_unsubscribe(VNodeID node_id, VLayerID layer_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)-1);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -213,7 +213,7 @@ void verse_send_g_vertex_set_xyz_real32(VNodeID node_id, VLayerID layer_id, uint
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], x);
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], y);
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], z);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1) || vertex_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u || vertex_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -239,7 +239,7 @@ void verse_send_g_vertex_delete_real32(VNodeID node_id, uint32 vertex_id)
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], V_REAL32_MAX);
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], V_REAL32_MAX);
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], V_REAL32_MAX);
-       if(node_id == (uint32)(-1) || vertex_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || vertex_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -305,7 +305,7 @@ void verse_send_g_vertex_set_xyz_real64(VNodeID node_id, VLayerID layer_id, uint
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], x);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], y);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], z);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1) || vertex_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u || vertex_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -331,7 +331,7 @@ void verse_send_g_vertex_delete_real64(VNodeID node_id, uint32 vertex_id)
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], V_REAL64_MAX);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], V_REAL64_MAX);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], V_REAL64_MAX);
-       if(node_id == (uint32)(-1) || vertex_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || vertex_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -395,7 +395,7 @@ void verse_send_g_vertex_set_uint32(VNodeID node_id, VLayerID layer_id, uint32 v
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], vertex_id);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], value);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1) || vertex_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u || vertex_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -444,7 +444,7 @@ void verse_send_g_vertex_set_real64(VNodeID node_id, VLayerID layer_id, uint32 v
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], vertex_id);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], value);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1) || vertex_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u || vertex_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -493,7 +493,7 @@ void verse_send_g_vertex_set_real32(VNodeID node_id, VLayerID layer_id, uint32 v
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], vertex_id);
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], value);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1) || vertex_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u || vertex_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -545,7 +545,7 @@ void verse_send_g_polygon_set_corner_uint32(VNodeID node_id, VLayerID layer_id,
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], v1);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], v2);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], v3);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1) || polygon_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u || polygon_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -572,7 +572,7 @@ void verse_send_g_polygon_delete(VNodeID node_id, uint32 polygon_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], -1);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], -1);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], -1);
-       if(node_id == (uint32)(-1) || polygon_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || polygon_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -641,7 +641,7 @@ void verse_send_g_polygon_set_corner_real64(VNodeID node_id, VLayerID layer_id,
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], v1);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], v2);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], v3);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1) || polygon_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u || polygon_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -699,7 +699,7 @@ void verse_send_g_polygon_set_corner_real32(VNodeID node_id, VLayerID layer_id,
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], v1);
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], v2);
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], v3);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1) || polygon_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u || polygon_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -754,7 +754,7 @@ void verse_send_g_polygon_set_face_uint8(VNodeID node_id, VLayerID layer_id, uin
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], polygon_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], value);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1) || polygon_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u || polygon_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -803,7 +803,7 @@ void verse_send_g_polygon_set_face_uint32(VNodeID node_id, VLayerID layer_id, ui
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], polygon_id);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], value);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1) || polygon_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u || polygon_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -852,7 +852,7 @@ void verse_send_g_polygon_set_face_real64(VNodeID node_id, VLayerID layer_id, ui
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], polygon_id);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], value);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1) || polygon_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u || polygon_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -901,7 +901,7 @@ void verse_send_g_polygon_set_face_real32(VNodeID node_id, VLayerID layer_id, ui
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], layer_id);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], polygon_id);
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], value);
-       if(node_id == (uint32)(-1) || layer_id == (uint16)(-1) || polygon_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u || layer_id == (uint16) ~0u || polygon_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
@@ -949,7 +949,7 @@ void verse_send_g_crease_set_vertex(VNodeID node_id, const char *layer, uint32 d
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], layer, 16);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], def_crease);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -997,7 +997,7 @@ void verse_send_g_crease_set_edge(VNodeID node_id, const char *layer, uint32 def
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], layer, 16);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], def_crease);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -1030,17 +1030,17 @@ unsigned int v_unpack_g_crease_set_edge(const char *buf, size_t buffer_length)
        return buffer_pos;
 }
 
-void verse_send_g_bone_create(VNodeID node_id, uint16 bone_id, const char *weight, const char *reference, uint16 parent, real64 pos_x, real64 pos_y, real64 pos_z, const char *pos_label, const VNQuat64 *rot, const char *rot_label)
+void verse_send_g_bone_create(VNodeID node_id, uint16 bone_id, const char *weight, const char *reference, uint16 parent, real64 pos_x, real64 pos_y, real64 pos_z, const char *position_label, const char *rotation_label, const char *scale_label)
 {
        uint8 *buf;
        unsigned int buffer_pos = 0;
        VCMDBufHead *head;
-       head = v_cmd_buf_allocate(VCMDBS_1500);/* Allocating the buffer */
+       head = v_cmd_buf_allocate(VCMDBS_160);/* Allocating the buffer */
        buf = ((VCMDBuffer10 *)head)->buf;
 
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], 64); /* Pack the command. */
 #if defined V_PRINT_SEND_COMMANDS
-       printf("send: verse_send_g_bone_create(node_id = %u bone_id = %u weight = %s reference = %s parent = %u pos_x = %f pos_y = %f pos_z = %f pos_label = %s rot = %p rot_label = %s );\n", node_id, bone_id, weight, reference, parent, pos_x, pos_y, pos_z, pos_label, rot, rot_label);
+       printf("send: verse_send_g_bone_create(node_id = %u bone_id = %u weight = %s reference = %s parent = %u pos_x = %f pos_y = %f pos_z = %f position_label = %s rotation_label = %s scale_label = %s );\n", node_id, bone_id, weight, reference, parent, pos_x, pos_y, pos_z, position_label, rotation_label, scale_label);
 #endif
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], bone_id);
@@ -1050,11 +1050,10 @@ void verse_send_g_bone_create(VNodeID node_id, uint16 bone_id, const char *weigh
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], pos_x);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], pos_y);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], pos_z);
-       buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], pos_label, 16);
-       buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], rot_label, 16);
-       if(weight[0] != '\0')
-               buffer_pos += vnp_pack_quat64(&buf[buffer_pos], rot);
-       if(node_id == (uint32)(-1) || bone_id == (uint16)(-1))
+       buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], position_label, 16);
+       buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], rotation_label, 16);
+       buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], scale_label, 16);
+       if(node_id == (uint32) ~0u || bone_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -1067,7 +1066,7 @@ void verse_send_g_bone_destroy(VNodeID node_id, uint16 bone_id)
        uint8 *buf;
        unsigned int buffer_pos = 0;
        VCMDBufHead *head;
-       head = v_cmd_buf_allocate(VCMDBS_1500);/* Allocating the buffer */
+       head = v_cmd_buf_allocate(VCMDBS_160);/* Allocating the buffer */
        buf = ((VCMDBuffer10 *)head)->buf;
 
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], 64); /* Pack the command. */
@@ -1084,7 +1083,8 @@ void verse_send_g_bone_destroy(VNodeID node_id, uint16 bone_id)
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], V_REAL64_MAX);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 16);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 16);
-       if(node_id == (uint32)(-1) || bone_id == (uint16)(-1))
+       buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 16);
+       if(node_id == (uint32) ~0u || bone_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -1095,7 +1095,7 @@ void verse_send_g_bone_destroy(VNodeID node_id, uint16 bone_id)
 unsigned int v_unpack_g_bone_create(const char *buf, size_t buffer_length)
 {
        unsigned int buffer_pos = 0;
-       void (* func_g_bone_create)(void *user_data, VNodeID node_id, uint16 bone_id, const char *weight, const char *reference, uint16 parent, real64 pos_x, real64 pos_y, real64 pos_z, const char *pos_label, const VNQuat64 *rot, const char *rot_label);
+       void (* func_g_bone_create)(void *user_data, VNodeID node_id, uint16 bone_id, const char *weight, const char *reference, uint16 parent, real64 pos_x, real64 pos_y, real64 pos_z, const char *position_label, const char *rotation_label, const char *scale_label);
        VNodeID node_id;
        uint16 bone_id;
        char weight[16];
@@ -1104,9 +1104,9 @@ unsigned int v_unpack_g_bone_create(const char *buf, size_t buffer_length)
        real64 pos_x;
        real64 pos_y;
        real64 pos_z;
-       char pos_label[16];
-       const VNQuat64 *rot;
-       char rot_label[16];
+       char position_label[16];
+       char rotation_label[16];
+       char scale_label[16];
        
        func_g_bone_create = v_fs_get_user_func(64);
        if(buffer_length < 6)
@@ -1123,27 +1123,19 @@ unsigned int v_unpack_g_bone_create(const char *buf, size_t buffer_length)
        buffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &pos_x);
        buffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &pos_y);
        buffer_pos += vnp_raw_unpack_real64(&buf[buffer_pos], &pos_z);
-       buffer_pos += vnp_raw_unpack_string(&buf[buffer_pos], pos_label, 16, buffer_length - buffer_pos);
+       buffer_pos += vnp_raw_unpack_string(&buf[buffer_pos], position_label, 16, buffer_length - buffer_pos);
        if(buffer_length < 0 + buffer_pos)
                return -1;
-       buffer_pos += vnp_raw_unpack_string(&buf[buffer_pos], rot_label, 16, buffer_length - buffer_pos);
+       buffer_pos += vnp_raw_unpack_string(&buf[buffer_pos], rotation_label, 16, buffer_length - buffer_pos);
        if(buffer_length < 0 + buffer_pos)
                return -1;
+       buffer_pos += vnp_raw_unpack_string(&buf[buffer_pos], scale_label, 16, buffer_length - buffer_pos);
 #if defined V_PRINT_RECEIVE_COMMANDS
        if(weight[0] == 0)
                printf("receive: verse_send_g_bone_destroy(node_id = %u bone_id = %u ); callback = %p\n", node_id, bone_id, v_fs_get_alias_user_func(64));
        else
-               printf("receive: verse_send_g_bone_create(node_id = %u bone_id = %u weight = %s reference = %s parent = %u pos_x = %f pos_y = %f pos_z = %f pos_label = %s rot_label = %s ); callback = %p\n", node_id, bone_id, weight, reference, parent, pos_x, pos_y, pos_z, pos_label, rot_label, v_fs_get_user_func(64));
+               printf("receive: verse_send_g_bone_create(node_id = %u bone_id = %u weight = %s reference = %s parent = %u pos_x = %f pos_y = %f pos_z = %f position_label = %s rotation_label = %s scale_label = %s ); callback = %p\n", node_id, bone_id, weight, reference, parent, pos_x, pos_y, pos_z, position_label, rotation_label, scale_label, v_fs_get_user_func(64));
 #endif
-       if(weight[0] != 0)
-       {
-               VNQuat64        tmp;
-               buffer_pos += vnp_unpack_quat64(&buf[buffer_pos], &tmp);
-               if(func_g_bone_create != NULL)
-                       func_g_bone_create(v_fs_get_user_data(64), node_id, bone_id, weight, reference, parent, pos_x, pos_y, pos_z, pos_label, &tmp, rot_label);
-               return buffer_pos;
-       }
-
        if(weight[0] == 0)
        {
                void (* alias_g_bone_destroy)(void *user_data, VNodeID node_id, uint16 bone_id);
@@ -1153,7 +1145,7 @@ unsigned int v_unpack_g_bone_create(const char *buf, size_t buffer_length)
                return buffer_pos;
        }
        if(func_g_bone_create != NULL)
-               func_g_bone_create(v_fs_get_user_data(64), node_id, bone_id, weight, reference, parent, pos_x, pos_y, pos_z, pos_label, rot, rot_label);
+               func_g_bone_create(v_fs_get_user_data(64), node_id, bone_id, weight, reference, parent, pos_x, pos_y, pos_z, position_label, rotation_label, scale_label);
 
        return buffer_pos;
 }
index dabc2c3120240f259d4591d1fd459c766345a6fd..64aa83a3d272c7a95e743d5f6dcd6f64e9beaa92 100644 (file)
@@ -77,7 +77,7 @@ void init_pack_and_unpack(void)
        v_fs_add_func(81, v_unpack_b_layer_create, verse_send_b_layer_create, verse_send_b_layer_destroy);
        v_fs_add_func(82, v_unpack_b_layer_subscribe, verse_send_b_layer_subscribe, verse_send_b_layer_unsubscribe);
        v_fs_add_func(83, v_unpack_b_tile_set, verse_send_b_tile_set, NULL);
-       v_fs_add_func(96, v_unpack_t_set_language, verse_send_t_set_language, NULL);
+       v_fs_add_func(96, v_unpack_t_language_set, verse_send_t_language_set, NULL);
        v_fs_add_func(97, v_unpack_t_buffer_create, verse_send_t_buffer_create, verse_send_t_buffer_destroy);
        v_fs_add_func(98, v_unpack_t_buffer_subscribe, verse_send_t_buffer_subscribe, verse_send_t_buffer_unsubscribe);
        v_fs_add_func(99, v_unpack_t_text_set, verse_send_t_text_set, NULL);
index 518368d2c0aad5b9949029a7d9bd6d7247ec6195..376b6c51c39c51f6b886e54d6aa35c6fb9b10519 100644 (file)
@@ -137,7 +137,7 @@ void verse_send_m_fragment_create(VNodeID node_id, VNMFragmentID frag_id, VNMFra
                buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], fragment->output.back);
                break;
        }
-       if(node_id == (uint32)(-1) || frag_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || frag_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -160,7 +160,7 @@ void verse_send_m_fragment_destroy(VNodeID node_id, VNMFragmentID frag_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], frag_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)-1);
-       if(node_id == (uint32)(-1) || frag_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || frag_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
index b366c9e64b72b3e42ce807e3c651521d9e7fe6e1..5d60bafe1d021287af843842afcb6be5e858cbaa 100644 (file)
@@ -68,7 +68,7 @@ void verse_send_o_transform_pos_real32(VNodeID node_id, uint32 time_s, uint32 ti
                vnp_raw_pack_uint8(&buf[cmd], mask);
        }if(FALSE)
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], drag);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -174,7 +174,7 @@ void verse_send_o_transform_rot_real32(VNodeID node_id, uint32 time_s, uint32 ti
        }
        if(FALSE)
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], drag);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -251,7 +251,7 @@ void verse_send_o_transform_scale_real32(VNodeID node_id, real32 scale_x, real32
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], scale_x);
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], scale_y);
        buffer_pos += vnp_raw_pack_real32(&buf[buffer_pos], scale_z);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -335,7 +335,7 @@ void verse_send_o_transform_pos_real64(VNodeID node_id, uint32 time_s, uint32 ti
                vnp_raw_pack_uint8(&buf[cmd], mask);
        }if(FALSE)
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], drag);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -441,7 +441,7 @@ void verse_send_o_transform_rot_real64(VNodeID node_id, uint32 time_s, uint32 ti
        }
        if(FALSE)
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], drag);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -492,7 +492,7 @@ unsigned int v_unpack_o_transform_rot_real64(const char *buf, size_t buffer_leng
                else
                        drag = 0.0;
                if(func_o_transform_rot_real64 != NULL)
-                       func_o_transform_rot_real64(v_fs_get_user_data(33), node_id, time_s, time_f, &trot, q[0], q[1], q[2], drag);
+                       func_o_transform_rot_real64(v_fs_get_user_data(36), node_id, time_s, time_f, &trot, q[0], q[1], q[2], drag);
                return buffer_pos;
        }
 
@@ -518,7 +518,7 @@ void verse_send_o_transform_scale_real64(VNodeID node_id, real64 scale_x, real64
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], scale_x);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], scale_y);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], scale_z);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -566,7 +566,7 @@ void verse_send_o_transform_subscribe(VNodeID node_id, VNRealFormat type)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)type);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], TRUE);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -589,7 +589,7 @@ void verse_send_o_transform_unsubscribe(VNodeID node_id, VNRealFormat type)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)type);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], FALSE);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -651,7 +651,7 @@ void verse_send_o_light_set(VNodeID node_id, real64 light_r, real64 light_g, rea
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], light_r);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], light_g);
        buffer_pos += vnp_raw_pack_real64(&buf[buffer_pos], light_b);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -702,7 +702,7 @@ void verse_send_o_link_set(VNodeID node_id, uint16 link_id, VNodeID link, const
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], label, 16);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], target_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], TRUE);
-       if(node_id == (uint32)(-1) || link_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || link_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -728,7 +728,7 @@ void verse_send_o_link_destroy(VNodeID node_id, uint16 link_id)
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 16);
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], -1);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], FALSE);
-       if(node_id == (uint32)(-1) || link_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || link_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -795,7 +795,7 @@ void verse_send_o_method_group_create(VNodeID node_id, uint16 group_id, const ch
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], group_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], name, 16);
-       if(node_id == (uint32)(-1) || group_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || group_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -818,7 +818,7 @@ void verse_send_o_method_group_destroy(VNodeID node_id, uint16 group_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], group_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 16);
-       if(node_id == (uint32)(-1) || group_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || group_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -875,7 +875,7 @@ void verse_send_o_method_group_subscribe(VNodeID node_id, uint16 group_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], group_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], TRUE);
-       if(node_id == (uint32)(-1) || group_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || group_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -898,7 +898,7 @@ void verse_send_o_method_group_unsubscribe(VNodeID node_id, uint16 group_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], group_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], FALSE);
-       if(node_id == (uint32)(-1) || group_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || group_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -974,7 +974,7 @@ void verse_send_o_method_create(VNodeID node_id, uint16 group_id, uint16 method_
                        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], param_names[i], 1500 - buffer_pos);
                }
        }
-       if(node_id == (uint32)(-1) || group_id == (uint16)(-1) || method_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || group_id == (uint16) ~0u || method_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 9);
        else
                v_cmd_buf_set_address_size(head, 9);
@@ -999,7 +999,7 @@ void verse_send_o_method_destroy(VNodeID node_id, uint16 group_id, uint16 method
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], method_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 512);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], -1);
-       if(node_id == (uint32)(-1) || group_id == (uint16)(-1) || method_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || group_id == (uint16) ~0u || method_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 9);
        else
                v_cmd_buf_set_address_size(head, 9);
@@ -1186,7 +1186,7 @@ void verse_send_o_anim_run(VNodeID node_id, uint16 link_id, uint32 time_s, uint3
                }
                vnp_raw_pack_uint8(&buf[cmd], mask);
        }
-       if(node_id == (uint32)(-1) || link_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || link_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -1264,7 +1264,7 @@ void verse_send_o_hide(VNodeID node_id, uint8 hidden)
 #endif
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], hidden);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
index be36cc22596e6ddb45436f10992d3548f0b3f28f..6a9f4a05a0b84c64311e80c77ebc645ce966547a 100644 (file)
@@ -106,7 +106,7 @@ void verse_send_node_index_subscribe(uint32 mask)
        printf("send: verse_send_node_index_subscribe(mask = %u );\n", mask);
 #endif
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], mask);
-       if(mask == (uint32)(-1))
+       if(mask == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -148,7 +148,7 @@ void verse_send_node_create(VNodeID node_id, VNodeType type, VNodeOwner owner)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)type);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)owner);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -171,7 +171,7 @@ void verse_send_node_destroy(VNodeID node_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)-1);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)-1);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -197,12 +197,12 @@ unsigned int v_unpack_node_create(const char *buf, size_t buffer_length)
        buffer_pos += vnp_raw_unpack_uint8(&buf[buffer_pos], &enum_temp);
        owner = (VNodeOwner)enum_temp;
 #if defined V_PRINT_RECEIVE_COMMANDS
-       if(owner == (uint8)-1 || type >= V_NT_NUM_TYPES)
+       if(owner == (uint8) ~0u || type >= V_NT_NUM_TYPES)
                printf("receive: verse_send_node_destroy(node_id = %u ); callback = %p\n", node_id, v_fs_get_alias_user_func(10));
        else
                printf("receive: verse_send_node_create(node_id = %u type = %u owner = %u ); callback = %p\n", node_id, type, owner, v_fs_get_user_func(10));
 #endif
-       if(owner == (uint8)-1 || type >= V_NT_NUM_TYPES)
+       if(owner == (uint8) ~0u || type >= V_NT_NUM_TYPES)
        {
                void (* alias_node_destroy)(void *user_data, VNodeID node_id);
                alias_node_destroy = v_fs_get_alias_user_func(10);
@@ -230,7 +230,7 @@ void verse_send_node_subscribe(VNodeID node_id)
 #endif
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], TRUE);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -252,7 +252,7 @@ void verse_send_node_unsubscribe(VNodeID node_id)
 #endif
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], FALSE);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -309,7 +309,7 @@ void verse_send_tag_group_create(VNodeID node_id, uint16 group_id, const char *n
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], group_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], name, 16);
-       if(node_id == (uint32)(-1) || group_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || group_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -332,7 +332,7 @@ void verse_send_tag_group_destroy(VNodeID node_id, uint16 group_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], group_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 16);
-       if(node_id == (uint32)(-1) || group_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || group_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -389,7 +389,7 @@ void verse_send_tag_group_subscribe(VNodeID node_id, uint16 group_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], group_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], TRUE);
-       if(node_id == (uint32)(-1) || group_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || group_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -412,7 +412,7 @@ void verse_send_tag_group_unsubscribe(VNodeID node_id, uint16 group_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], group_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], FALSE);
-       if(node_id == (uint32)(-1) || group_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || group_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -529,7 +529,7 @@ void verse_send_tag_create(VNodeID node_id, uint16 group_id, uint16 tag_id, cons
                default :
                        ;
        }
-       if(node_id == (uint32)(-1) || group_id == (uint16)(-1) || tag_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || group_id == (uint16) ~0u || tag_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 9);
        else
                v_cmd_buf_set_address_size(head, 9);
@@ -554,7 +554,7 @@ void verse_send_tag_destroy(VNodeID node_id, uint16 group_id, uint16 tag_id)
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], tag_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 16);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], (uint8)-1);
-       if(node_id == (uint32)(-1) || group_id == (uint16)(-1) || tag_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || group_id == (uint16) ~0u || tag_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 9);
        else
                v_cmd_buf_set_address_size(head, 9);
@@ -678,7 +678,7 @@ void verse_send_node_name_set(VNodeID node_id, const char *name)
 #endif
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], name, 512);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
index d04d54e28e03ba0c5d2e27e31a408d9ab043d1ae..0cfbf8b7f2170e546fad5e3de5b1b325ff6ceb43 100644 (file)
@@ -17,7 +17,7 @@
 #include "v_connection.h"
 #include "v_util.h"
 
-void verse_send_t_set_language(VNodeID node_id, const char *language)
+void verse_send_t_language_set(VNodeID node_id, const char *language)
 {
        uint8 *buf;
        unsigned int buffer_pos = 0;
@@ -27,11 +27,11 @@ void verse_send_t_set_language(VNodeID node_id, const char *language)
 
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], 96); /* Pack the command. */
 #if defined V_PRINT_SEND_COMMANDS
-       printf("send: verse_send_t_set_language(node_id = %u language = %s );\n", node_id, language);
+       printf("send: verse_send_t_language_set(node_id = %u language = %s );\n", node_id, language);
 #endif
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], language, 512);
-       if(node_id == (uint32)(-1))
+       if(node_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 5);
        else
                v_cmd_buf_set_address_size(head, 5);
@@ -39,23 +39,23 @@ void verse_send_t_set_language(VNodeID node_id, const char *language)
        v_noq_send_buf(v_con_get_network_queue(), head);
 }
 
-unsigned int v_unpack_t_set_language(const char *buf, size_t buffer_length)
+unsigned int v_unpack_t_language_set(const char *buf, size_t buffer_length)
 {
        unsigned int buffer_pos = 0;
-       void (* func_t_set_language)(void *user_data, VNodeID node_id, const char *language);
+       void (* func_t_language_set)(void *user_data, VNodeID node_id, const char *language);
        VNodeID node_id;
        char language[512];
        
-       func_t_set_language = v_fs_get_user_func(96);
+       func_t_language_set = v_fs_get_user_func(96);
        if(buffer_length < 4)
                return -1;
        buffer_pos += vnp_raw_unpack_uint32(&buf[buffer_pos], &node_id);
        buffer_pos += vnp_raw_unpack_string(&buf[buffer_pos], language, 512, buffer_length - buffer_pos);
 #if defined V_PRINT_RECEIVE_COMMANDS
-       printf("receive: verse_send_t_set_language(node_id = %u language = %s ); callback = %p\n", node_id, language, v_fs_get_user_func(96));
+       printf("receive: verse_send_t_language_set(node_id = %u language = %s ); callback = %p\n", node_id, language, v_fs_get_user_func(96));
 #endif
-       if(func_t_set_language != NULL)
-               func_t_set_language(v_fs_get_user_data(96), node_id, language);
+       if(func_t_language_set != NULL)
+               func_t_language_set(v_fs_get_user_data(96), node_id, language);
 
        return buffer_pos;
 }
@@ -75,7 +75,7 @@ void verse_send_t_buffer_create(VNodeID node_id, VBufferID buffer_id, const char
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], buffer_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], name, 16);
-       if(node_id == (uint32)(-1) || buffer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || buffer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -98,7 +98,7 @@ void verse_send_t_buffer_destroy(VNodeID node_id, VBufferID buffer_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], buffer_id);
        buffer_pos += vnp_raw_pack_string(&buf[buffer_pos], NULL, 16);
-       if(node_id == (uint32)(-1) || buffer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || buffer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -155,7 +155,7 @@ void verse_send_t_buffer_subscribe(VNodeID node_id, VBufferID buffer_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], buffer_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], TRUE);
-       if(node_id == (uint32)(-1) || buffer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || buffer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
@@ -178,7 +178,7 @@ void verse_send_t_buffer_unsubscribe(VNodeID node_id, VBufferID buffer_id)
        buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], node_id);
        buffer_pos += vnp_raw_pack_uint16(&buf[buffer_pos], buffer_id);
        buffer_pos += vnp_raw_pack_uint8(&buf[buffer_pos], FALSE);
-       if(node_id == (uint32)(-1) || buffer_id == (uint16)(-1))
+       if(node_id == (uint32) ~0u || buffer_id == (uint16) ~0u)
                v_cmd_buf_set_unique_address_size(head, 7);
        else
                v_cmd_buf_set_address_size(head, 7);
index 6e13d9d1f287a1368787acfcce1381fc51f20fb7..462777608c7b232857a8f948ccfc7ef9cfeb6205 100644 (file)
@@ -48,7 +48,7 @@ extern unsigned int v_unpack_b_dimensions_set(const char *data, size_t length);
 extern unsigned int v_unpack_b_layer_create(const char *data, size_t length);
 extern unsigned int v_unpack_b_layer_subscribe(const char *data, size_t length);
 extern unsigned int v_unpack_b_tile_set(const char *data, size_t length);
-extern unsigned int v_unpack_t_set_language(const char *data, size_t length);
+extern unsigned int v_unpack_t_language_set(const char *data, size_t length);
 extern unsigned int v_unpack_t_buffer_create(const char *data, size_t length);
 extern unsigned int v_unpack_t_buffer_subscribe(const char *data, size_t length);
 extern unsigned int v_unpack_t_text_set(const char *data, size_t length);
index 1b44bdadd1536df4b95be4efcfd58492043006eb..21b5acdbd8f03be202170e237fc5dd7d3ca8d66e 100644 (file)
@@ -382,7 +382,7 @@ void verse_send_c_key_set(VNodeID node_id, VLayerID curve_id, uint32 key_id, uin
        for(i = 0; i < dimensions; i++)
                buffer_pos += vnp_raw_pack_uint32(&buf[buffer_pos], post_pos[i]);       
 
-       if(key_id == (uint32)(-1))
+       if(key_id == (uint32) ~0u)
                v_cmd_buf_set_unique_address_size(head, 11);
        else
                v_cmd_buf_set_address_size(head, 11);
index 2341edf9994db80466114e2657df1ad02e914c5e..a7ed87762ceeabee000e6b4d84b47135a0437776 100644 (file)
@@ -119,26 +119,47 @@ void v_n_socket_destroy(void)
 
 boolean v_n_set_network_address(VNetworkAddress *address, const char *host_name)
 {
-       struct hostent *he;
-       char *colon = NULL;
+       struct hostent  *he;
+       char            *colon = NULL, *buf = NULL;
+       boolean         ok = FALSE;
+
        v_n_socket_create();
        address->port = VERSE_STD_CONNECT_TO_PORT;
+       /* If a port number is included, as indicated by a colon, we need to work a bit more. */
        if((colon = strchr(host_name, ':')) != NULL)
        {
-               unsigned int tp;
-               *colon = '\0';
-               if(sscanf(colon + 1, "%u", &tp) == 1)
-                       address->port = tp;
+               size_t  hl = strlen(host_name);
+
+               if((buf = malloc(hl + 1)) != NULL)
+               {
+                       unsigned int    tp;
+
+                       strcpy(buf, host_name);
+                       colon = buf + (colon - host_name);
+                       *colon = '\0';
+                       host_name = buf;
+                       if(sscanf(colon + 1, "%u", &tp) == 1)
+                       {
+                               address->port = (unsigned short) tp;
+                               if(address->port != tp) /* Protect against overflow. */
+                                       host_name = NULL;
+                       }
+                       else
+                               host_name = NULL;       /* Protect against parse error. */
+               }
+               else
+                       return FALSE;
        }
-       if((he = gethostbyname(host_name)) != NULL)
+       if(host_name != NULL && (he = gethostbyname(host_name)) != NULL)
        {
                memcpy(&address->ip, he->h_addr_list[0], he->h_length);
-               address->ip = htonl(address->ip);
-       }else
-               return FALSE;
-       if(colon != NULL)
-               *colon = ':';
-       return TRUE;
+               address->ip = ntohl(address->ip);
+               ok = TRUE;
+       }
+       if(buf != NULL)
+               free(buf);
+
+       return ok;
 }
 
 int v_n_send_data(VNetworkAddress *address, const char *data, size_t length)
index 77f1c3a3a726097fcde3f6e9271ce08f78e84c12..d99a4ad11ecb2004f26e34cbe3db68505cbbd29b 100644 (file)
@@ -30,15 +30,30 @@ void v_niq_clear(VNetInQueue *queue)
 /* Set queue's last-used timestamp to "now". */
 void v_niq_timer_update(VNetInQueue *queue)
 {
-       v_n_get_current_time(&queue->seconds, NULL);
+       v_n_get_current_time(&queue->seconds, &queue->fractions);
+       queue->acc_seconds = queue->acc_fractions = 0;
 }
 
-uint32 v_niq_time_out(const VNetInQueue *queue)
+uint32 v_niq_time_out(VNetInQueue *queue)
 {
-       uint32 seconds;
-       v_n_get_current_time(&seconds, NULL);
+       uint32  fractions, f;
+
+       /* Magic code to disregard if the clock moves forward more than one second at a time.
+        * This should help keep Verse alive on e.g. a notebook that is suspended.
+       */
+       v_n_get_current_time(NULL, &fractions);
+       if(fractions < queue->fractions)
+               f = 0xffffffffu - queue->fractions + fractions;
+       else
+               f = fractions - queue->fractions;
+/*     printf("now=%u last=%u -> f=%u\n", fractions, queue->fractions, f);*/
+       if(queue->acc_fractions + f < queue->acc_fractions)
+               queue->acc_seconds += 1;
+       queue->acc_fractions += f;
+       queue->fractions = fractions;
+       
 /*     printf("queue at %p has seconds=%u, now=%u -> diff=%u\n", queue, queue->seconds, seconds, seconds - queue->seconds);*/
-       return seconds - queue->seconds;
+       return queue->acc_seconds;
 }
 
 VNetInPacked * v_niq_get(VNetInQueue *queue, size_t *length)
index ff835e7fb14d569804ea23470b67b8d255f041a6..9241fe18fe8c963f7d8f49caf13a928182672a0e 100644 (file)
@@ -3,7 +3,8 @@ typedef struct{
        void    *oldest;
        void    *newest;
        uint32  packet_id;
-       uint32  seconds;
+       uint32  seconds, fractions;             /* Current time. */
+       uint32  acc_seconds, acc_fractions;     /* Accumulated time. */
 }VNetInQueue;
 
 typedef struct{
@@ -20,4 +21,4 @@ extern VNetInPacked * v_niq_get(VNetInQueue *queue, size_t *length);
 extern void            v_niq_release(VNetInQueue *queue, VNetInPacked *p);
 extern char *          v_niq_store(VNetInQueue *queue, size_t length, unsigned int packet_id);
 unsigned int           v_niq_free(VNetInQueue *queue);
-extern uint32          v_niq_time_out(const VNetInQueue *queue);
+extern uint32          v_niq_time_out(VNetInQueue *queue);
index 75207c943db12f52f49ed83f6e79070383db3154..53ce674725a99b3956e8982780edb24e1c48303c 100644 (file)
@@ -19,7 +19,7 @@ extern "C" {
 
 /* Release information. */
 #define        V_RELEASE_NUMBER        6
-#define        V_RELEASE_PATCH         0
+#define        V_RELEASE_PATCH         1
 #define        V_RELEASE_LABEL         ""
 
 typedef unsigned char  boolean;
@@ -32,8 +32,8 @@ typedef unsigned int  uint32;
 typedef float          real32;
 typedef double         real64;
 
-#define V_REAL64_MAX         1.7976931348623158e+308 /* max value */
-#define V_REAL32_MAX         3.40282347e+38F
+#define V_REAL64_MAX         1.7976931348623158e+308
+#define V_REAL32_MAX         3.402823466e+38f
 
 #if !defined TRUE
 #define TRUE  1
@@ -483,7 +483,7 @@ extern void verse_send_g_polygon_set_face_real64(VNodeID node_id, VLayerID layer
 extern void verse_send_g_polygon_set_face_real32(VNodeID node_id, VLayerID layer_id, uint32 polygon_id, real32 value);
 extern void verse_send_g_crease_set_vertex(VNodeID node_id, const char *layer, uint32 def_crease);
 extern void verse_send_g_crease_set_edge(VNodeID node_id, const char *layer, uint32 def_crease);
-extern void verse_send_g_bone_create(VNodeID node_id, uint16 bone_id, const char *weight, const char *reference, uint16 parent, real64 pos_x, real64 pos_y, real64 pos_z, const char *pos_label, const VNQuat64 *rot, const char *rot_label);
+extern void verse_send_g_bone_create(VNodeID node_id, uint16 bone_id, const char *weight, const char *reference, uint16 parent, real64 pos_x, real64 pos_y, real64 pos_z, const char *position_label, const char *rotation_label, const char *scale_label);
 extern void verse_send_g_bone_destroy(VNodeID node_id, uint16 bone_id);
 
 extern void verse_send_m_fragment_create(VNodeID node_id, VNMFragmentID frag_id, VNMFragmentType type, const VMatFrag *fragment);
@@ -496,7 +496,7 @@ extern void verse_send_b_layer_subscribe(VNodeID node_id, VLayerID layer_id, uin
 extern void verse_send_b_layer_unsubscribe(VNodeID node_id, VLayerID layer_id);
 extern void verse_send_b_tile_set(VNodeID node_id, VLayerID layer_id, uint16 tile_x, uint16 tile_y, uint16 z, VNBLayerType type, const VNBTile *tile);
 
-extern void verse_send_t_set_language(VNodeID node_id, const char *language);
+extern void verse_send_t_language_set(VNodeID node_id, const char *language);
 extern void verse_send_t_buffer_create(VNodeID node_id, VBufferID buffer_id, const char *name);
 extern void verse_send_t_buffer_destroy(VNodeID node_id, VBufferID buffer_id);
 extern void verse_send_t_buffer_subscribe(VNodeID node_id, VBufferID buffer_id);
index 4d69492e50de0962a7d7aefc39027a6ba36aaae8..3f3403265fdd4edb412bd73bb1e97fdcdef3e31c 100644 (file)
@@ -5,7 +5,7 @@
 
 /* Release information. */
 #define        V_RELEASE_NUMBER        6
-#define        V_RELEASE_PATCH         0
+#define        V_RELEASE_PATCH         1
 #define        V_RELEASE_LABEL         ""
 
 typedef unsigned char  boolean;
@@ -18,8 +18,8 @@ typedef unsigned int  uint32;
 typedef float          real32;
 typedef double         real64;
 
-#define V_REAL64_MAX         1.7976931348623158e+308 /* max value */
-#define V_REAL32_MAX         3.40282347e+38F
+#define V_REAL64_MAX         1.7976931348623158e+308
+#define V_REAL32_MAX         3.402823466e+38f
 
 #if !defined TRUE
 #define TRUE  1
index 7e7655a70823163999c22841ee6c5c5bc1d97d83..3b388eecc560e91ddf3dd7f57adf01db06e09038 100644 (file)
 #include "v_util.h"
 #include "vs_server.h"
 
-#define        MASTER_SERVER_PERIOD    (1.0  * 60.0)
-
 extern VNodeID vs_node_create(VNodeID owner_id, unsigned int type);
 extern void    callback_send_node_destroy(void *user_data, VNodeID node_id);
 extern void    vs_reset_owner(VNodeID owner_id);
 
-static void callback_send_ping(void *user, const char *address, const char *message)
-{
-       printf("Bouncing ping '%s' back to '%s'\n", message, address);
-       verse_send_ping(address, message);
-}
-
 static void callback_send_connect(void *user, const char *name, const char *pass, const char *address, const uint8 *host_id)
 {
        VNodeID avatar;
@@ -96,29 +88,52 @@ static void cb_sigint_handler(int sig)
        }
 }
 
-static void master_server_update(VUtilTimer *timer, const char *master_server)
+static void callback_send_ping(void *user, const char *address, const char *message)
+{
+       if(strncmp(message, "DESCRIBE", 8) == 0 && message[8] == ' ')
+               vs_master_handle_describe(address, message + 9);
+}
+
+static void usage(void)
 {
-       if(master_server == NULL || v_timer_elapsed(timer) < MASTER_SERVER_PERIOD)
-               return;
-       verse_send_ping(master_server, "MS:ANNOUNCE");
-       v_timer_start(timer);
-       printf("MS:ANNOUNCE sent to %s\n", master_server);
+       printf("Verse server usage:\n");
+       printf(" -h\t\t\tShow this usage information.\n");
+       printf(" -ms\t\t\tRegisters the server with a master server at the address\n");
+       printf(" \t\t\tgiven with the -ms:ip= option. Off by default.\n");
+       printf(" -ms:ip=IP[:PORT]\tSet master server to register with. Implies -ms.\n");
+       printf(" \t\t\tThe default address is <%s>.\n", vs_master_get_address());
+       printf(" -ms:de=DESC\t\tSet description, sent to master server.\n");
+       printf(" -ms:ta=TAGS\t\tSet tags, sent to master server.\n");
+       printf(" -port=PORT\t\tSet port to use for incoming connections.\n");
+       printf(" -version\t\tPrint version information and exit.\n");
 }
 
 int main(int argc, char **argv)
 {
-       const char      *ms_address = NULL;
-       VUtilTimer      ms_timer;
        uint32          i, seconds, fractions, port = VERSE_STD_CONNECT_PORT;
 
        signal(SIGINT, cb_sigint_handler);
 
+       vs_master_set_address("master.uni-verse.org");          /* The default master address. */
+       vs_master_set_enabled(FALSE);                           /* Make sure master server support is disabled. */
        for(i = 1; i < (uint32) argc; i++)
        {
-               if(strcmp(argv[i], "-Q") == 0)
-                       ms_address = NULL;
-               else if(strncmp(argv[i], "-master=", 9) == 0)
-                       ms_address = argv[i] + 9;
+               if(strcmp(argv[i], "-h") == 0)
+               {
+                       usage();
+                       return EXIT_SUCCESS;
+               }
+               else if(strcmp(argv[i], "-ms") == 0)
+                       vs_master_set_enabled(TRUE);
+                else if(strncmp(argv[i], "-ms:ip=", 7) == 0)
+               {
+                        vs_master_set_address(argv[i] + 7);
+                       vs_master_set_enabled(TRUE);
+               }
+                else if(strncmp(argv[i], "-ms:de=", 7) == 0)
+                        vs_master_set_desc(argv[i] + 7);
+                else if(strncmp(argv[i], "-ms:ta=", 7) == 0)
+                       vs_master_set_tags(argv[i] + 7);
                else if(strncmp(argv[i], "-port=", 6) == 0)
                        port = strtoul(argv[i] + 6, NULL, 0);
                else if(strcmp(argv[i], "-version") == 0)
@@ -127,10 +142,10 @@ int main(int argc, char **argv)
                        return EXIT_SUCCESS;
                }
                else
-                       fprintf(stderr, "Ignoring unknown argument \"%s\"\n", argv[i]);
+                       fprintf(stderr, "Ignoring unknown argument \"%s\", try -h for help\n", argv[i]);
        }
 
-       printf("Verse Server r%up%u%s by Eskil Steenberg <http://www.blender.org/modules/verse/>\n", V_RELEASE_NUMBER, V_RELEASE_PATCH, V_RELEASE_LABEL);
+       printf("Verse Server r%up%u%s by Eskil Steenberg <http://verse.blender.org/>\n", V_RELEASE_NUMBER, V_RELEASE_PATCH, V_RELEASE_LABEL);
        verse_set_port(port);   /* The Verse standard port. */
        printf(" Listening on port %d\n", port);
 
@@ -153,13 +168,11 @@ int main(int argc, char **argv)
        verse_callback_set(verse_send_connect,          callback_send_connect,          NULL);
        verse_callback_set(verse_send_connect_terminate, callback_send_connect_terminate, NULL);
 
-       v_timer_start(&ms_timer);
-       v_timer_advance(&ms_timer, MASTER_SERVER_PERIOD - 1.0);
        while(TRUE)
        {
                vs_set_next_session();
                verse_callback_update(1000000);
-               master_server_update(&ms_timer, ms_address);
+               vs_master_update();
        }
        return EXIT_SUCCESS;
 }
index a61e8040138510a4e5a24831d9ad1f8db55d47ca..e69d3d9b3ec3d2e986fba963cd60928722c31bf6 100644 (file)
@@ -292,7 +292,7 @@ static void callback_send_a_block_set(void *user, VNodeID node_id, VLayerID buff
        VSNodeAudio *node;
        unsigned int i, count;
 
-       if(type < 0 || type > VN_A_BLOCK_REAL64)        /* Protect blocksize array. */
+       if(type > VN_A_BLOCK_REAL64)    /* Protect blocksize array. */
                return;
 
        node = (VSNodeAudio *)vs_get_node(node_id, V_NT_AUDIO);
index c3b7a268a72069c32cccb48c681cbeeb90499d1b..4b1f88c8ac28d672dfc007799e47f8b7dd6a4d6d 100644 (file)
@@ -35,9 +35,9 @@ typedef struct {
        real64  pos_x;
        real64  pos_y;
        real64  pos_z;
-       char    pos_label[16];
-       VNQuat64 rot;
-       char    rot_label[16];
+       char    position_label[16];
+       char    rotation_label[16];
+       char    scale_label[16];
 } VSNGBone;
 
 typedef struct {
@@ -136,8 +136,8 @@ void vs_g_subscribe(VSNodeGeometry *node)
        {
                if(node->bones[i].weight[0] != 0)
                        verse_send_g_bone_create(node->head.id, (uint16)i, node->bones[i].weight, node->bones[i].reference, node->bones[i].parent,
-                                                node->bones[i].pos_x, node->bones[i].pos_y, node->bones[i].pos_z, node->bones[i].pos_label,
-                                                &node->bones[i].rot, node->bones[i].rot_label);
+                                                node->bones[i].pos_x, node->bones[i].pos_y, node->bones[i].pos_z, node->bones[i].position_label,
+                                                node->bones[i].rotation_label, node->bones[i].scale_label);
        }
 }
 
@@ -368,42 +368,42 @@ static void callback_send_g_layer_subscribe(void *user, VNodeID node_id, VLayerI
                break;
                case VN_G_LAYER_POLYGON_CORNER_UINT32 :
                        for(i = 0; i < node->poly_size; i++)
-                               if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) -1 && !(((uint32 *)layer->layer)[i * 4] == layer->def.integer && ((uint32 *)layer->layer)[i * 4 + 1] == layer->def.integer && ((uint32 *)layer->layer)[i * 4 + 2] == layer->def.integer && ((uint32 *)layer->layer)[i * 4 + 3] == layer->def.integer))
+                               if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) ~0u && !(((uint32 *)layer->layer)[i * 4] == layer->def.integer && ((uint32 *)layer->layer)[i * 4 + 1] == layer->def.integer && ((uint32 *)layer->layer)[i * 4 + 2] == layer->def.integer && ((uint32 *)layer->layer)[i * 4 + 3] == layer->def.integer))
                                        verse_send_g_polygon_set_corner_uint32(node_id, layer_id, i, ((uint32 *)layer->layer)[i * 4], ((uint32 *)layer->layer)[i * 4 + 1], ((uint32 *)layer->layer)[i * 4 + 2], ((uint32 *)layer->layer)[i * 4 + 3]);
                break;
                case VN_G_LAYER_POLYGON_CORNER_REAL :
                        if(type == VN_FORMAT_REAL64)
                        {
                                for(i = 0; i < node->poly_size; i++)
-                                       if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) -1 && !(((real64 *)layer->layer)[i * 4] == layer->def.real && ((real64 *)layer->layer)[i * 4 + 1] == layer->def.real && ((real64 *)layer->layer)[i * 4 + 2] == layer->def.real && ((real64 *)layer->layer)[i * 4 + 3] == layer->def.real))
+                                       if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) ~0u && !(((real64 *)layer->layer)[i * 4] == layer->def.real && ((real64 *)layer->layer)[i * 4 + 1] == layer->def.real && ((real64 *)layer->layer)[i * 4 + 2] == layer->def.real && ((real64 *)layer->layer)[i * 4 + 3] == layer->def.real))
                                                verse_send_g_polygon_set_corner_real64(node_id, layer_id, i, ((real64 *)layer->layer)[i * 4], ((real64 *)layer->layer)[i * 4 + 1], ((real64 *)layer->layer)[i * 4 + 2], ((real64 *)layer->layer)[i * 4 + 3]);
                        }else
                        {
                                for(i = 0; i < node->poly_size; i++)
-                                       if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) -1 && !(((real64 *)layer->layer)[i * 4] == layer->def.real && ((real64 *)layer->layer)[i * 4 + 1] == layer->def.real && ((real64 *)layer->layer)[i * 4 + 2] == layer->def.real && ((real64 *)layer->layer)[i * 4 + 3] == layer->def.real))
+                                       if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) ~0u && !(((real64 *)layer->layer)[i * 4] == layer->def.real && ((real64 *)layer->layer)[i * 4 + 1] == layer->def.real && ((real64 *)layer->layer)[i * 4 + 2] == layer->def.real && ((real64 *)layer->layer)[i * 4 + 3] == layer->def.real))
                                                verse_send_g_polygon_set_corner_real32(node_id, layer_id, i, (float)((real64 *)layer->layer)[i * 4], (float)((real64 *)layer->layer)[i * 4 + 1], (float)((real64 *)layer->layer)[i * 4 + 2], (float)((real64 *)layer->layer)[i * 4 + 3]);
                        }
                break;
                case VN_G_LAYER_POLYGON_FACE_UINT8 :
                        for(i = 0; i < node->poly_size; i++)
-                               if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) -1 && ((uint8 *)layer->layer)[i] != layer->def.integer)
+                               if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) ~0u && ((uint8 *)layer->layer)[i] != layer->def.integer)
                                        verse_send_g_polygon_set_face_uint8(node_id, layer_id, i, ((uint8 *)layer->layer)[i]);
                break;
                case VN_G_LAYER_POLYGON_FACE_UINT32 :
                        for(i = 0; i < node->poly_size; i++)
-                               if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) -1 && ((uint32 *)layer->layer)[i] != layer->def.integer)
+                               if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) ~0u && ((uint32 *)layer->layer)[i] != layer->def.integer)
                                        verse_send_g_polygon_set_face_uint32(node_id, layer_id, i, ((uint32 *)layer->layer)[i]);
                break;
                case VN_G_LAYER_POLYGON_FACE_REAL :
                        if(type == VN_FORMAT_REAL64)
                        {
                                for(i = 0; i < node->poly_size; i++)
-                                       if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) -1 && ((real64 *)layer->layer)[i] != layer->def.real)
+                                       if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) ~0u && ((real64 *)layer->layer)[i] != layer->def.real)
                                                verse_send_g_polygon_set_face_real64(node_id, layer_id, i, ((real64 *)layer->layer)[i]);
                        }else
                        {
                                for(i = 0; i < node->poly_size; i++)
-                                       if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) -1 && ((real64 *)layer->layer)[i] != layer->def.real)
+                                       if(((uint32 *)node->layer[1].layer)[i * 4] != (uint32) ~0u && ((real64 *)layer->layer)[i] != layer->def.real)
                                                verse_send_g_polygon_set_face_real32(node_id, layer_id, i, (float)((real64 *)layer->layer)[i]);
                        }
                break;
@@ -955,8 +955,8 @@ static void callback_send_g_crease_set_edge(void *user, VNodeID node_id, const c
 
 void callback_send_g_bone_create(void *user, VNodeID node_id, uint16 bone_id, const char *weight,
                                 const char *reference, uint16 parent,
-                                real64 pos_x, real64 pos_y, real64 pos_z, const char *pos_label,
-                                const VNQuat64 *rot, const char *rot_label)
+                                real64 pos_x, real64 pos_y, real64 pos_z,
+                                const char *position_label, const char *rotation_label, const char *scale_label)
 {
        VSNodeGeometry *node;
        unsigned int i, count;
@@ -984,15 +984,15 @@ void callback_send_g_bone_create(void *user, VNodeID node_id, uint16 bone_id, co
        node->bones[bone_id].pos_x = pos_x;
        node->bones[bone_id].pos_y = pos_y;
        node->bones[bone_id].pos_z = pos_z;
-       v_strlcpy(node->bones[bone_id].pos_label, pos_label, sizeof node->bones[bone_id].pos_label);
-       node->bones[bone_id].rot = *rot;
-       v_strlcpy(node->bones[bone_id].rot_label, rot_label, sizeof node->bones[bone_id].rot_label);
+       v_strlcpy(node->bones[bone_id].position_label, position_label, sizeof node->bones[bone_id].position_label);
+       v_strlcpy(node->bones[bone_id].rotation_label, rotation_label, sizeof node->bones[bone_id].rotation_label);
+       v_strlcpy(node->bones[bone_id].scale_label,    scale_label,    sizeof node->bones[bone_id].scale_label);
 
        count = vs_get_subscript_count(node->head.subscribers);
        for(i = 0; i < count; i++)
        {
                vs_set_subscript_session(node->head.subscribers, i);
-               verse_send_g_bone_create(node_id, bone_id, weight, reference, parent, pos_x, pos_y, pos_z, pos_label, rot, rot_label);
+               verse_send_g_bone_create(node_id, bone_id, weight, reference, parent, pos_x, pos_y, pos_z, position_label, rotation_label, scale_label);
        }
        vs_reset_subscript_session();
 }
index d332d1ea6137f7224fd049c8160ec900b223bca5..06983c599cc6a0541adf7c9528d9910e37bdec5f 100644 (file)
@@ -65,8 +65,9 @@ static void callback_send_m_fragment_create(void *user, VNodeID node_id, VNMFrag
                return;
        if(node->frag_count + 32 < frag_id)
                frag_id = (uint16)-1;
-       if(frag_id == (uint16)-1)
-               for(frag_id = 0; frag_id < node->frag_count && node->frag[frag_id].type < VN_M_FT_OUTPUT + 1; frag_id++);
+       if(frag_id == (uint16) ~0u)
+               for(frag_id = 0; frag_id < node->frag_count && node->frag[frag_id].type < VN_M_FT_OUTPUT + 1; frag_id++)
+                       ;
        if(frag_id >= node->frag_count)
        {
                node->frag = realloc(node->frag, (sizeof *node->frag) * (node->frag_count + 16));
index cee0b8162de62deae2ceb01c9645f766583bfc11..019419e43a1de58d45253a848d9f3e141b9ebd3c 100644 (file)
@@ -609,6 +609,7 @@ static void callback_send_o_method_group_subscribe(void *user, VNodeID node_id,
 {
        VSNodeObject *node;
        unsigned int i, j;
+
        node = (VSNodeObject *)vs_get_node(node_id, V_NT_OBJECT);
        if(node == NULL || vs_get_node(node_id, V_NT_OBJECT) == NULL)
                return;
@@ -641,7 +642,7 @@ static void callback_send_o_method_create(void *user, VNodeID node_id, uint16 gr
        VSNodeObject *node;
        unsigned int i, j, count;
        VSMethodGroup *group;
-       
+
        node = (VSNodeObject *) vs_get_node(node_id, V_NT_OBJECT);
        if(node == NULL || vs_get_node(node_id, V_NT_OBJECT) == NULL)
                return;
index b901a3a079c10fd6fde76ca02095738dc77a7163..ae7c3c737c3c203d5b003f53ac4495f32a4ef00c 100644 (file)
@@ -67,7 +67,7 @@ void vs_t_destroy_node(VSNodeText *node)
 void vs_t_subscribe(VSNodeText *node)
 {
        unsigned int i;
-       verse_send_t_set_language(node->head.id, node->language);
+       verse_send_t_language_set(node->head.id, node->language);
        for(i = 0; i < node->buffer_count; i++)
                if(node->buffer[i].name[0] != 0)
                        verse_send_t_buffer_create(node->head.id, i, node->buffer[i].name);
@@ -81,7 +81,7 @@ void vs_t_unsubscribe(VSNodeText *node)
                        vs_remove_subscriptor(node->buffer[i].subscribers);
 }
 
-static void callback_send_t_set_language(void *user, VNodeID node_id, char *language)
+static void callback_send_t_language_set(void *user, VNodeID node_id, char *language)
 {
        VSNodeText *node;
        unsigned int i, count;
@@ -95,7 +95,7 @@ static void callback_send_t_set_language(void *user, VNodeID node_id, char *lang
        for(i = 0; i < count; i++)
        {
                vs_set_subscript_session(node->head.subscribers, i);
-               verse_send_t_set_language(node_id, language);
+               verse_send_t_language_set(node_id, language);
        }
        vs_reset_subscript_session();
 
@@ -263,7 +263,7 @@ static void callback_send_t_text_set(void *user, VNodeID node_id, VBufferID buff
 
 void vs_t_callback_init(void)
 {
-       verse_callback_set(verse_send_t_set_language,           callback_send_t_set_language, NULL);
+       verse_callback_set(verse_send_t_language_set,           callback_send_t_language_set, NULL);
        verse_callback_set(verse_send_t_buffer_create,          callback_send_t_buffer_create, NULL);
        verse_callback_set(verse_send_t_buffer_destroy,         callback_send_t_buffer_destroy, NULL);
        verse_callback_set(verse_send_t_buffer_subscribe,       callback_send_t_buffer_subscribe, NULL);
index 0a8716dc2609c4e7385e1bda2eda992abc22111a..76e1b482eb9ab0b12430b388086950530fe3a70d 100644 (file)
@@ -52,3 +52,11 @@ extern void                  vs_t_callback_init(void);
 extern void                    vs_c_callback_init(void);
 extern void                    vs_a_callback_init(void);
 extern void                    init_callback_node_storage(void);
+
+extern void            vs_master_set_enabled(boolean enabled);
+extern void            vs_master_set_address(const char *address);
+extern const char *    vs_master_get_address(void);
+extern void            vs_master_set_desc(const char *desc);
+extern void            vs_master_set_tags(const char *tags);
+extern void            vs_master_update(void);
+extern void            vs_master_handle_describe(const char *address, const char *message);