JunkBox_Lib++ (for Windows) 1.10.1
Loading...
Searching...
No Matches
llsd_tool.cpp
Go to the documentation of this file.
1
9#ifdef CPLUSPLUS
10 #undef CPLUSPLUS
11#endif
12
13#include "llsd_tool.h"
14#include <math.h>
15
16
18// Binary LLSD
19//
20
27{
28 Buffer buf = init_Buffer();
29
30 if (ptr==NULL) return buf;
31
32 int size = ntohl(*(int*)(*ptr));
33 (*ptr) += 4;
34
35 char* str = (char*)malloc(size + 1);
36 if (str!=NULL) {
37 memcpy(str, *ptr, size);
38 str[size] = '\0';
39 buf = make_Buffer_bystr(str);
40 free(str);
41 }
42 (*ptr) += size;
43
44 return buf;
45}
46
47
54{
55 if (ptr==NULL) return 0;
56
57 int value = ntohl(*(int*)(*ptr));
58 (*ptr) += 4;
59
60 return value;
61}
62
63
69unsigned long long int llsd_bin_get_date(uByte** ptr)
70{
71 if (ptr==NULL) return 0ULL;
72
73 unsigned long long int value = ntohull(*(unsigned long long int*)(*ptr));
74 (*ptr) += 8;
75
76 return value;
77}
78
79
86{
87 if (ptr==NULL) return 0.0;
88
89#ifdef WIN32
90 long long int tmp;// __attribute__((may_alias));
91#else
92 long long int tmp __attribute__((may_alias));
93#endif
94
95 tmp = ntohull(*(long long int*)(*ptr));
96
97 double* valuep = (double*)&tmp;
98 double value = *valuep;
99 if (isnan(value)) value = 0.0;
100
101 (*ptr) += 8;
102
103 return value;
104}
105
106
113{
114 Buffer buf = init_Buffer();
115
116 if (ptr==NULL) return buf;
117
118 char* str = (char*)malloc(16);
119 if (str!=NULL) {
120 memcpy(str, *ptr, 16);
121 buf = set_Buffer(str, 16);
122 free(str);
123 }
124 (*ptr) += 16;
125
126 return buf;
127}
128
129
136{
137 Buffer buf = init_Buffer();
138
139 if (ptr==NULL) return buf;
140
141 int size = ntohl(*(int*)(*ptr));
142 (*ptr) += 4;
143
144 uByte* bin = (uByte*)malloc(size);
145 if (bin!=NULL) {
146 memcpy(bin, *ptr, size);
147 buf = set_Buffer(bin, size);
148 free(bin);
149 }
150 (*ptr) += size;
151
152 return buf;
153}
154
155
165int llsd_bin_get_length(uByte* ptr, int sz)
166{
167 if (ptr==NULL) return 0;
168
169 int cc = 0;
170 Buffer stack = make_Buffer(LSDATA);
171 uByte* buf = ptr;
172
173 while (buf<ptr+sz) {
174 //
175 if (*buf==LLSD_MAKER_UNDEF) buf++;
176 else if (*buf==LLSD_MAKER_TRUE) buf++;
177 else if (*buf==LLSD_MAKER_FALSE) buf++;
178 else if (*buf==LLSD_MAKER_INT) buf += 5;
179 else if (*buf==LLSD_MAKER_REAL) buf += 9;
180 else if (*buf==LLSD_MAKER_UUID) buf += 17;
181 else if (*buf==LLSD_MAKER_BIN) buf += ntohl(*(int*)(buf + 1)) + 5;
182 else if (*buf==LLSD_MAKER_STR) buf += ntohl(*(int*)(buf + 1)) + 5;
183 else if (*buf==LLSD_MAKER_URI) buf += ntohl(*(int*)(buf + 1)) + 5;
184 else if (*buf==LLSD_MAKER_KEY) buf += ntohl(*(int*)(buf + 1)) + 5;
185 else if (*buf==LLSD_MAKER_DATE) buf += 9;
186 else if (*buf!=LLSD_MAKER_MAP && *buf!=LLSD_MAKER_ARRAY &&
188 if (ptr==buf) return 0;
189 PRINT_MESG("WARNING: llsd_bin_get_length: unknown marker %c: %04x\n", *buf, *buf);
190 break;
191 }
192
193 if (*buf==LLSD_MAKER_MAP) {
195 cc++;
196 buf += 5;
197 }
198 else if (*buf==LLSD_MAKER_ARRAY) {
200 cc++;
201 buf += 5;
202 }
203 else if (*buf==LLSD_MAKER_MAP_END || *buf==LLSD_MAKER_ARRAY_END) {
204 unsigned char marker = (unsigned char)pop_char_ringStack(&stack);
205 if (marker!=*buf) PRINT_MESG("WARNING: llsd_bin_get_length: missmatch stack data of [ or {\n");
206 cc--;
207 buf++;
208 }
209
210 if (cc==0) break;
211 }
212
213 free_Buffer(&stack);
214
215 return (int)(buf - ptr);
216}
217
218
219
221// Binary LLSD Parser
222//
223
235{
236 tXML* xml;
237 tXML* node;
238
239 xml = new_xml_node(); // アンカー
240 xml->ldat.id = XML_ANCHOR_NODE;
241
242 // パース
243 node = llsd_bin_main_parse(xml, ptr, sz);
244 if (node->state<0) return xml;
245
246 // 元に戻ったか?
247 if (xml==node) {
248 xml->state = JBXL_XML_PARSED;
249 }
250 else {
251 xml->state = JBXL_XML_NOT_CLOSED;
252 }
253
254 // XML rootの数
255 if (xml->next!=NULL) {
256 int n = 0;
257 node = xml->next;
258 while(node!=NULL) {
259 if (node->ldat.id==XML_NAME_NODE) n++;
260 node = node->ysis;
261 }
262 if (n!=1) xml->state = JBXL_XML_MULTI_ROOT;
263 }
264 else xml->state = JBXL_XML_DEFAULT_STATE;
265
266 return xml;
267}
268
269
280tXML* llsd_bin_main_parse(tXML* xml, uByte* ptr, int sz)
281{
282 if (ptr==NULL) return xml;
283 if (xml==NULL) return NULL;
284
285 tXML* snode = xml = add_tTree_node_bystr(xml, XML_NAME_NODE, 0, "llsd", NULL, NULL, 0);
286
287 uByte* end = ptr + sz;
288 while (ptr<end && !(xml==snode && *ptr!=LLSD_MAKER_MAP && *ptr!=LLSD_MAKER_ARRAY)) {
289 //
290 if (*ptr==LLSD_MAKER_MAP) {
291 //PRINT_MESG("LLSD_MAKER_MAP\n");
292 ptr++;
293 int num = llsd_bin_get_map(&ptr);
294 xml = add_tTree_node_bystr(xml, XML_NAME_NODE, num, "map", NULL, NULL, 0);
295 xml->state = JBXL_XML_NODE_OPENED;
296 }
297 //
298 else if (*ptr==LLSD_MAKER_ARRAY) {
299 //PRINT_MESG("LLSD_MAKER_ARRAY\n");
300 ptr++;
301 int num = llsd_bin_get_map(&ptr);
302 xml = add_tTree_node_bystr(xml, XML_NAME_NODE, num, "array", NULL, NULL, 0);
303 xml->state = JBXL_XML_NODE_OPENED;
304 }
305 //
306 else if (*ptr==LLSD_MAKER_MAP_END) {
307 //PRINT_MESG("LLSD_MAKER_MAP_END\n");
308 ptr++;
309 if (xml->state==JBXL_XML_NODE_OPENED) {
310 xml->state = JBXL_XML_NODE_CLOSED;
311 xml = xml->prev;
312 }
313 }
314 //
315 else if (*ptr==LLSD_MAKER_ARRAY_END) {
316 //PRINT_MESG("LLSD_MAKER_ARRAY_END)\n");
317 ptr++;
318 if (xml->state==JBXL_XML_NODE_OPENED) {
319 xml->state = JBXL_XML_NODE_CLOSED;
320 xml = xml->prev;
321 }
322 }
323 //
324 else if (*ptr==LLSD_MAKER_KEY) {
325 //PRINT_MESG("LLSD_MAKER_KEY\n");
326 ptr++;
327 Buffer key = llsd_bin_get_key(&ptr);
328 xml = add_tTree_node_bystr(xml, XML_NAME_NODE, 1, "key", NULL, NULL, 0);
329 xml = add_tTree_node_bystr(xml, XML_CONTENT_NODE, 0, (char*)key.buf, NULL, NULL, 0);
330 xml->state = JBXL_XML_NODE_CLOSED;
331 xml = xml->prev;
332 xml->state = JBXL_XML_NODE_CLOSED;
333 xml = xml->prev;
334 free_Buffer(&key);
335 }
336 //
337 else if (*ptr==LLSD_MAKER_STR) {
338 //PRINT_MESG("LLSD_MAKER_STR\n");
339 ptr++;
340 Buffer str = llsd_bin_get_str(&ptr);
341 xml = add_tTree_node_bystr(xml, XML_NAME_NODE, 1, "string", NULL, NULL, 0);
342 xml = add_tTree_node_bystr(xml, XML_CONTENT_NODE, 0, (char*)str.buf, NULL, NULL, 0);
343 xml->state = JBXL_XML_NODE_CLOSED;
344 xml = xml->prev;
345 xml->state = JBXL_XML_NODE_CLOSED;
346 xml = xml->prev;
347 free_Buffer(&str);
348 }
349 //
350 else if (*ptr==LLSD_MAKER_UUID) {
351 //PRINT_MESG("LLSD_MAKER_UUID\n");
352 ptr++;
353 Buffer uuid = llsd_bin_get_uuid(&ptr);
354 char* guid = (char*)uuid2guid(uuid.buf);
355 xml = add_tTree_node_bystr(xml, XML_NAME_NODE, 1, "uuid", NULL, NULL, 0);
356 xml = add_tTree_node_bystr(xml, XML_CONTENT_NODE, 0, guid, NULL, NULL, 0);
357 xml->state = JBXL_XML_NODE_CLOSED;
358 xml = xml->prev;
359 xml->state = JBXL_XML_NODE_CLOSED;
360 xml = xml->prev;
361 free(guid);
362 free_Buffer(&uuid);
363 }
364 //
365 else if (*ptr==LLSD_MAKER_URI) {
366 //PRINT_MESG("LLSD_MAKER_URI\n");
367 ptr++;
368 Buffer str = llsd_bin_get_uri(&ptr);
369 xml = add_tTree_node_bystr(xml, XML_NAME_NODE, 1, "uri", NULL, NULL, 0);
370 xml = add_tTree_node_bystr(xml, XML_CONTENT_NODE, 0, (char*)str.buf, NULL, NULL, 0);
371 xml->state = JBXL_XML_NODE_CLOSED;
372 xml = xml->prev;
373 xml->state = JBXL_XML_NODE_CLOSED;
374 xml = xml->prev;
375 free_Buffer(&str);
376 }
377 //
378 else if (*ptr==LLSD_MAKER_INT) {
379 //PRINT_MESG("LLSD_MAKER_INT\n");
380 ptr++;
381 int val = llsd_bin_get_int(&ptr);
382 xml = add_tTree_node_bystr(xml, XML_NAME_NODE, 1, "integer", NULL, NULL, 0);
383 char* str = itostr_ts(val);
384 xml = add_tTree_node_bystr(xml, XML_CONTENT_NODE, 0, str, NULL, NULL, 0);
385 freeNull(str);
386 xml->state = JBXL_XML_NODE_CLOSED;
387 xml = xml->prev;
388 xml->state = JBXL_XML_NODE_CLOSED;
389 xml = xml->prev;
390 }
391 //
392 else if (*ptr==LLSD_MAKER_DATE) {
393 //PRINT_MESG("LLSD_MAKER_DATE\n");
394 ptr++;
395 unsigned long long int val = llsd_bin_get_date(&ptr);
396 xml = add_tTree_node_bystr(xml, XML_NAME_NODE, 1, "date", NULL, NULL, 0);
397 char* str = ulltostr_ts(val);
398 xml = add_tTree_node_bystr(xml, XML_CONTENT_NODE, 0, str, NULL, NULL, 0);
399 freeNull(str);
400 xml->state = JBXL_XML_NODE_CLOSED;
401 xml = xml->prev;
402 xml->state = JBXL_XML_NODE_CLOSED;
403 xml = xml->prev;
404 }
405 //
406 else if (*ptr==LLSD_MAKER_REAL) {
407 //PRINT_MESG("LLSD_MAKER_REAL\n");
408 ptr++;
409 double val = llsd_bin_get_real(&ptr);
410 xml = add_tTree_node_bystr(xml, XML_NAME_NODE, 1, "real", NULL, NULL, 0);
411 char* str = dtostr_ts(val);
412 xml = add_tTree_node_bystr(xml, XML_CONTENT_NODE, 0, str, NULL, NULL, 0);
413 freeNull(str);
414 xml->state = JBXL_XML_NODE_CLOSED;
415 xml = xml->prev;
416 xml->state = JBXL_XML_NODE_CLOSED;
417 xml = xml->prev;
418 }
419 //
420 else if (*ptr==LLSD_MAKER_BIN) {
421 //PRINT_MESG("LLSD_MAKER_BUN\n");
422 ptr++;
423 Buffer bin = llsd_bin_get_bin(&ptr);
424 Buffer b64 = encode_base64_Buffer(bin);
425 xml = add_tTree_node_bystr(xml, XML_NAME_NODE, 1, "binary", NULL, NULL, 0);
426 xml = add_tTree_node_bystr(xml, XML_CONTENT_NODE, 0, (char*)b64.buf, NULL, NULL, 0);
427 xml->state = JBXL_XML_NODE_CLOSED;
428 xml = xml->prev;
429 xml->state = JBXL_XML_NODE_CLOSED;
430 xml = xml->prev;
431 free_Buffer(&bin);
432 free_Buffer(&b64);
433 }
434 //
435 else if (*ptr==LLSD_MAKER_TRUE) {
436 //PRINT_MESG("LLSD_MAKER_TRUE\n");
437 ptr++;
438 xml = add_tTree_node_bystr(xml, XML_NAME_NODE, 1, "boolean", NULL, NULL, 0);
439 xml = add_tTree_node_bystr(xml, XML_CONTENT_NODE, 0, "true", NULL, NULL, 0);
440 xml->state = JBXL_XML_NODE_CLOSED;
441 xml = xml->prev;
442 xml->state = JBXL_XML_NODE_CLOSED;
443 xml = xml->prev;
444 }
445 //
446 else if (*ptr==LLSD_MAKER_FALSE) {
447 //PRINT_MESG("LLSD_MAKER_FALSE\n");
448 ptr++;
449 xml = add_tTree_node_bystr(xml, XML_NAME_NODE, 1, "boolean", NULL, NULL, 0);
450 xml = add_tTree_node_bystr(xml, XML_CONTENT_NODE, 0, "false", NULL, NULL, 0);
451 xml->state = JBXL_XML_NODE_CLOSED;
452 xml = xml->prev;
453 xml->state = JBXL_XML_NODE_CLOSED;
454 xml = xml->prev;
455 }
456 //
457 else if (*ptr==LLSD_MAKER_UNDEF) {
458 //PRINT_MESG("LLSD_MAKER_UNDEF\n");
459 ptr++;
460 xml = add_tTree_node_bystr(xml, XML_NAME_NODE, 0, "undef", NULL, NULL, 0);
461 xml->state = JBXL_XML_NODE_CLOSED;
462 xml = xml->prev;
463 }
464 else {
465 PRINT_MESG("WARNING: llsd_bin_main_parse: unknown marker: %c (%04x)\n", *ptr, *ptr);
466 ptr++;
467 }
468 }
469
470 //
471 if (snode==xml) xml->state = JBXL_XML_NODE_CLOSED;
472 else xml->state = JBXL_XML_NOT_CLOSED;
473
474 xml = xml->prev;
475
476 return xml;
477}
478
479
480#ifndef DISABLE_ZLIB
481
482
495tXML* llsd_bin_get_block_data(uByte* buf, int sz, const char* key)
496{
497 int hdsz = llsd_bin_get_length(buf, sz);
498 tXML* xml = llsd_bin_parse(buf, hdsz);
499
500 int ofst = -1, size = -1;
501 if (llsd_xml_contain_key(xml, key)){
502 ofst = llsd_xml_get_content_int(xml, key, "offset");
503 size = llsd_xml_get_content_int(xml, key, "size");
504 }
505 del_all_xml(&xml);
506 if (ofst<0 || size<=0) return NULL;
507
508 //
509 Buffer enc = set_Buffer(buf+ofst+hdsz, size);
510 Buffer dec = gz_decode_data(enc);
511
512 hdsz = llsd_bin_get_length(dec.buf, dec.vldsz);
513 if (dec.vldsz!=hdsz) PRINT_MESG("Warning: llsd_bin_get_block_data:i mismarch of data size (%d != %d)\n", hdsz, dec.vldsz);
514 xml = llsd_bin_parse(dec.buf, hdsz);
515
516 return xml;
517}
518
519
532uWord* llsd_bin_get_skin_weight(uByte* buf, int sz, int vertex_num, int* joints_num)
533{
534 if (buf==NULL) return NULL;
535
536 int max_joints = 4; // 一つの頂点が持つ重み情報の数の最大値(対象Jointの最大数)
537
538 if (joints_num!=NULL) *joints_num = 0;
539 int jnum = 0; // Jointの数
540 int vertex = 0; // 頂点の数
541 int invrtx = 0; // 一個の Jointに対する重みデータの数
542 int pos = 0; // 処理中のデータの位置
543 //
544 // joint の数を数える and データの整合性をチェック.
545 while (pos < sz && vertex < vertex_num) {
546 uByte joint = *(buf + pos);
547 pos++;
548 //
549 if (joint==0xff) {
550 invrtx = 0;
551 vertex++;
552 }
553 else {
554 if ((int)joint>jnum) jnum = (int)joint;
555 invrtx++;
556 pos += 2;
557 if (invrtx%max_joints==0) {
558 invrtx = 0;
559 vertex++;
560 }
561 }
562 }
563 jnum = jnum + 1; // Jointの数
564
565 if (pos!=sz || vertex!=vertex_num) {
566 PRINT_MESG("WARNING: llsd_bin_get_skin_weight: missmatch length %d != %d or %d != %d\n", pos, sz, vertex, vertex_num);
567 }
568 DEBUG_MODE {
569 PRINT_MESG("llsd_bin_get_skin_weight: joints_num = %d\n", jnum);
570 }
571
572 int len = sizeof(uWord)*jnum*vertex_num;
573 uWord* weight = (uWord*)malloc(len);
574 if (weight==NULL) {
575 PRINT_MESG("ERROR: llsd_bin_get_skin_weight: no more memory (%d)\n", len);
576 if (joints_num!=NULL) *joints_num = 0;
577 return NULL;
578 }
579 memset(weight, 0, len);
580
581 invrtx = 0;
582 vertex = 0;
583 pos = 0;
584 //
585 while (pos < sz && vertex < vertex_num) {
586 uByte joint = *(buf + pos);
587 pos++;
588 //
589 if (joint==0xff) {
590 invrtx = 0;
591 vertex++;
592 }
593 else {
594 invrtx++;
595 //int value = (int)*(uWord*)(buf + pos);
596 int value = *(uByte*)(buf + pos) + *(uByte*)(buf + pos + 1)*256;
597 weight[vertex*jnum + (int)joint] = value;
598 pos += 2;
599 if (invrtx%max_joints==0) {
600 invrtx = 0;
601 vertex++;
602 }
603 }
604 }
605
606 if (pos!=sz || vertex!=vertex_num) {
607 PRINT_MESG("ERROR: llsd_bin_get_skin_weight: missmatch length %d != %d\n", vertex, vertex_num);
608 free(weight);
609 weight = NULL;
610 jnum = 0;
611 }
612
613 if (joints_num!=NULL) *joints_num = jnum;
614 return weight;
615}
616
617
618#endif
619
620
621
623// XML LLSD of Single Data
624//
625
626int llsd_xml_contain_key(tXML* xml, const char* key)
627{
628 if (xml==NULL || key==NULL) return FALSE;
629
630 Buffer buf = make_Buffer_bystr("<llsd><map><key>");
631 cat_s2Buffer(key, &buf);
632 cat_s2Buffer("</key>", &buf);
633
634 tXML* node = get_xml_node_bystr(xml, (char*)buf.buf);
635 free_Buffer(&buf);
636
637 if (node!=NULL) return TRUE;
638 return FALSE;
639}
640
641
644int llsd_xml_get_content_int(tXML* xml, const char* key, const char* item)
645{
646 if (xml==NULL || key==NULL || item==NULL) return 0;
647
648 Buffer buf = make_Buffer_bystr("<llsd><map><key>");
649 cat_s2Buffer(key, &buf);
650 cat_s2Buffer("</key><map><key>", &buf);
651 cat_s2Buffer(item, &buf);
652 cat_s2Buffer("</key><integer>", &buf);
653
654 int ret = get_xml_int_content_bystr(xml, (char*)buf.buf);
655 free_Buffer(&buf);
656
657 return ret;
658}
659
660
661double llsd_xml_get_content_real(tXML* xml, const char* key, const char* item)
662{
663 if (xml==NULL || key==NULL || item==NULL) return 0.0;
664
665 Buffer buf = make_Buffer_bystr("<llsd><map><key>");
666 cat_s2Buffer(key, &buf);
667 cat_s2Buffer("</key><map><key>", &buf);
668 cat_s2Buffer(item, &buf);
669 cat_s2Buffer("</key><real>", &buf);
670
671 double ret = get_xml_double_content_bystr(xml, (char*)buf.buf);
672 free_Buffer(&buf);
673
674 return ret;
675}
676
677
678Buffer llsd_xml_get_content_str(tXML* xml, const char* key, const char* item)
679{
680 Buffer buf = init_Buffer();
681 if (xml==NULL || key==NULL || item==NULL) return buf;
682
683 buf = make_Buffer_bystr("<llsd><map><key>");
684 cat_s2Buffer(key, &buf);
685 cat_s2Buffer("</key><map><key>", &buf);
686 cat_s2Buffer(item, &buf);
687 cat_s2Buffer("</key><string>", &buf);
688
689 char* ret = get_xml_char_content_bystr(xml, (char*)buf.buf);
690 free_Buffer(&buf);
691 buf = make_Buffer_bystr(ret);
692
693 return buf;
694}
695
696
697Buffer llsd_xml_get_content_bin(tXML* xml, const char* key, const char* item)
698{
699 Buffer buf = init_Buffer();
700 if (xml==NULL || key==NULL || item==NULL) return buf;
701
702 buf = make_Buffer_bystr("<llsd><map><key>");
703 cat_s2Buffer(key, &buf);
704 cat_s2Buffer("</key><map><key>", &buf);
705 cat_s2Buffer(item, &buf);
706 cat_s2Buffer("</key><binary>", &buf);
707
708 char* ret = get_xml_char_content_bystr(xml, (char*)buf.buf);
709 free_Buffer(&buf);
710 buf = make_Buffer_bystr(ret);
711
712 Buffer bin = decode_base64_Buffer(buf);
713 free_Buffer(&buf);
714
715 return bin;
716}
717
Buffer encode_base64_Buffer(Buffer buf)
バイナリデータ buf.bufの buf.vldszバイトを Base64にエンコード する
Definition buffer.cpp:804
Buffer make_Buffer(int sz)
Buffer型変数のバッファ部をつくり出す.
Definition buffer.cpp:71
Buffer set_Buffer(void *dat, int len)
Buffer型変数のバッファ部を新しく作り, そのバッファに bufをコピーする.
Definition buffer.cpp:170
void free_Buffer(Buffer *buf)
Buffer型変数のバッファ部を解放する
Definition buffer.cpp:128
char pop_char_ringStack(Buffer *buf)
簡易 char型 ringStack POP
Definition buffer.cpp:1855
void push_char_ringStack(Buffer *buf, char cc)
簡易 char型 ringStack PUSH
Definition buffer.cpp:1869
Buffer init_Buffer()
初期化したBuffer型変数を返す.
Definition buffer.cpp:47
Buffer decode_base64_Buffer(Buffer str)
strのバッファを Base64からデコードする
Definition buffer.cpp:850
#define cat_s2Buffer(src, dst)
cat_b2Buffer()
Definition buffer.h:122
#define make_Buffer_bystr(str)
set_Buffer()
Definition buffer.h:57
unsigned short uWord
2Byte
Definition common.h:334
#define TRUE
Definition common.h:226
#define FALSE
Definition common.h:223
unsigned char uByte
1Byte
Definition common.h:332
#define LSDATA
Definition common.h:158
Buffer gz_decode_data(Buffer enc)
圧縮データ encを解凍する.
Definition gz_tool.cpp:32
#define JBXL_XML_NODE_CLOSED
XMLノードは閉じている
Definition jbxl_state.h:95
#define JBXL_XML_DEFAULT_STATE
XMLデータの初期状態
Definition jbxl_state.h:98
#define JBXL_XML_NOT_CLOSED
XMLデータが閉じていない
Definition jbxl_state.h:97
#define JBXL_XML_NODE_OPENED
XMLノードは開いている
Definition jbxl_state.h:94
#define JBXL_XML_MULTI_ROOT
XMLは複数のルート(TOP)を持っている.(パース済み)
Definition jbxl_state.h:93
#define JBXL_XML_PARSED
XMLパース済み
Definition jbxl_state.h:92
tXML * llsd_bin_get_block_data(uByte *buf, int sz, const char *key)
Buffer llsd_bin_get_uuid(uByte **ptr)
UUIDマーカーの要素を返す.ポインタは次に進む.
tXML * llsd_bin_parse(uByte *ptr, int sz)
LLSDヘッダ のバイナリデータを tXMLのデータに格納する.ボディについては別途処理する.
Buffer llsd_xml_get_content_bin(tXML *xml, const char *key, const char *item)
int llsd_bin_get_length(uByte *ptr, int sz)
Buffer llsd_xml_get_content_str(tXML *xml, const char *key, const char *item)
int llsd_bin_get_int(uByte **ptr)
整数マーカーの要素を返す.ポインタは次に進む.
Definition llsd_tool.cpp:53
Buffer llsd_bin_get_str(uByte **ptr)
ストリングマーカーの要素を返す.ポインタは次に進む.
Definition llsd_tool.cpp:26
unsigned long long int llsd_bin_get_date(uByte **ptr)
デイトマーカーの要素を返す.ポインタは次に進む.
Definition llsd_tool.cpp:69
double llsd_xml_get_content_real(tXML *xml, const char *key, const char *item)
int llsd_xml_get_content_int(tXML *xml, const char *key, const char *item)
double llsd_bin_get_real(uByte **ptr)
実数マーカーの要素を返す.ポインタは次に進む.
Definition llsd_tool.cpp:85
int llsd_xml_contain_key(tXML *xml, const char *key)
uWord * llsd_bin_get_skin_weight(uByte *buf, int sz, int vertex_num, int *joints_num)
Buffer llsd_bin_get_bin(uByte **ptr)
バイナリマーカーの要素を返す.ポインタは次に進む.
tXML * llsd_bin_main_parse(tXML *xml, uByte *ptr, int sz)
LLSD のバイナリデータをパースするメイン関数.
LLSD用ライブラリヘッダ(サブセット版)
#define LLSD_MAKER_TRUE
Definition llsd_tool.h:23
#define LLSD_MAKER_UUID
Definition llsd_tool.h:27
#define LLSD_MAKER_ARRAY
Definition llsd_tool.h:33
#define LLSD_MAKER_DATE
Definition llsd_tool.h:32
#define LLSD_MAKER_REAL
Definition llsd_tool.h:26
#define LLSD_MAKER_MAP
Definition llsd_tool.h:35
#define LLSD_MAKER_URI
Definition llsd_tool.h:30
#define LLSD_MAKER_MAP_END
*ptr はマーカーの次のデータを指すポインタ.ポインタは次に進む.
Definition llsd_tool.h:36
#define LLSD_MAKER_UNDEF
Definition llsd_tool.h:22
#define LLSD_MAKER_ARRAY_END
Definition llsd_tool.h:34
#define LLSD_MAKER_INT
Definition llsd_tool.h:25
#define llsd_bin_get_map(p)
要素数を返す.
Definition llsd_tool.h:49
#define LLSD_MAKER_BIN
Definition llsd_tool.h:28
#define LLSD_MAKER_FALSE
Definition llsd_tool.h:24
#define LLSD_MAKER_KEY
Definition llsd_tool.h:31
#define llsd_bin_get_uri(p)
Definition llsd_tool.h:48
#define llsd_bin_get_key(p)
Definition llsd_tool.h:47
#define LLSD_MAKER_STR
Definition llsd_tool.h:29
int vldsz
データの長さ.バイナリデータの場合も使用可能.文字列の場合は 0x00 を含まない.
Definition buffer.h:37
unsigned char * buf
バッファの先頭へのポインタ.str[bufsz]は必ず 0x00となる.
Definition buffer.h:39
unsigned char * uuid2guid(unsigned char *p)
uuid を guid に変換する.要 free()
Definition tools.cpp:3628
unsigned long long int ntohull(unsigned long long int s)
Definition tools.cpp:1824
char * itostr_ts(int n)
int を文字に変換する.要 free()
Definition tools.cpp:1532
char * ulltostr_ts(unsigned long long int n)
Definition tools.cpp:1612
char * dtostr_ts(double n)
double を文字に変換する.要 free()
Definition tools.cpp:1652
#define PRINT_MESG(...)
環境依存用の出力関数.MS Windows用は未実装
Definition tools.h:469
#define DEBUG_MODE
Definition tools.h:502
tTree * add_tTree_node_bystr(tTree *pp, int id, int lv, const char *key, const char *val, void *ptr, int sz)
ノードを末っ子としてリストに追加.
Definition ttree.cpp:202
char * get_xml_char_content_bystr(tXML *pp, const char *str)
get_xml_char_content(tXML* pp, tXML* pt) の _bystr バージョン.free() してはいけない.
Definition txml.cpp:2479
int get_xml_int_content_bystr(tXML *pp, const char *str)
get_xml_int_content(tXML* pp, tXML* pt) の _bystr バージョン
Definition txml.cpp:2430
tXML * get_xml_node_bystr(tXML *pp, const char *str)
get_xml_node(tXML* pp, tXML* pt) の _bystr バージョン
Definition txml.cpp:2353
double get_xml_double_content_bystr(tXML *pp, const char *str)
get_xml_double_content(tXML* pp, tXML* pt) の _bystr バージョン.
Definition txml.cpp:2462
#define XML_CONTENT_NODE
内容(コンテント)ノード
Definition txml.h:109
#define XML_NAME_NODE
ネームノード
Definition txml.h:108
#define del_all_xml(p)
XMLツリーの全ノードの削除.ポインタ ppのノードを含むXMLツリー全体を削除する.
Definition txml.h:204
#define new_xml_node()
new_tTree_node()
Definition txml.h:132
#define XML_ANCHOR_NODE
アンカーノード
Definition txml.h:107