Mercurial > hg > Members > kono > Cerium
diff Renderer/Test/dynamic_create.cc @ 610:529188ae604d
change htonl to xdr_float (checked working on mac)
author | kazz@kazzone.st.ie.u-ryukyu.ac.jp |
---|---|
date | Sun, 08 Nov 2009 03:30:06 +0900 |
parents | 8782cc4171b7 |
children | 000a3bd205d1 |
line wrap: on
line diff
--- a/Renderer/Test/dynamic_create.cc Sat Nov 07 18:07:28 2009 +0900 +++ b/Renderer/Test/dynamic_create.cc Sun Nov 08 03:30:06 2009 +0900 @@ -7,6 +7,8 @@ #include <sys/stat.h> #include <unistd.h> #include <arpa/inet.h> +#include <rpc/types.h> +#include <rpc/xdr.h> #include "SceneGraphRoot.h" #include "lindaapi.h" #include "dynamic_create.h" @@ -15,6 +17,8 @@ #define SERIAL_REGIST_TUPLE_NO 1 +#define RECV_DATA_SIZE sizeof(float) * 6 + /* typedef struct { caddr_t file_mmap; @@ -84,17 +88,15 @@ moon_move(SceneGraphPtr node, int screen_w, int screen_h) { // LindaServerから座標データを取得してオブジェクトに反映させる。 -// static int seq = 0; -// float *reply; - -// if (seq == 0) -// seq = psx_wait_rd(sgroot->tid, node->id * 10 + 1); unsigned char *reply = psx_reply(node->seq); if (reply != NULL) { - float *data = (float *)(reply + LINDA_HEADER_SIZE); + char *data = (char *)(reply + LINDA_HEADER_SIZE); + // XDRの準備 + XDR xdrs; + xdrmem_create(&xdrs, data, RECV_DATA_SIZE, XDR_DECODE); // ntoh_float(&data[0]); ntoh_float(&data[1]); for (int i = 0; i < 3; i++) { - node->xyz[i] = ntohl(data[i]); + xdr_float(&xdrs, &node->xyz[i]); } node->seq = psx_wait_rd(sgroot->tid, node->id * 10 + 1); } @@ -148,8 +150,7 @@ data = taple + LINDA_HEADER_SIZE; // clientのSerialIDを取得 serial_id = ntohl(*(int *)data); - printf("serial id = %d\n", serial_id); - // タプルを解放 + printf("serial id = %d\n", serial_id); // タプルを解放 //psx_del(carg->tid, SERIAL_REGIST_TUPLE_NO); // xml fileを取得する もうすでにxml fileが送信済みである事を期待