comparison FrameTableInc.cpp @ 701:d5b16a44d9b3

frame_table parser, new files for UI func
author Gloval
date Mon, 18 Mar 2013 22:53:56 +0400
parents 9c0607679772
children a9c1fb7483c2
comparison
equal deleted inserted replaced
700:1d05543f522d 701:d5b16a44d9b3
1 #include "FrameTableInc.h" 1 #include "FrameTableInc.h"
2 struct FrameTableTxtLine stru_F8B5E8; // weak 2 #include <memory.h>
3 //identical function to work in differnt threads
3 4
5 //----- (004BE3BF) --------------------------------------------------------
6 FrameTableTxtLine *texture_frame_table_txt_parser(const char *str_to_parse, FrameTableTxtLine *tokens_table)
7 {
8 bool new_token_flag; // edx@3
9 bool in_quotes; // [sp+Ch] [bp-4h]@3
10 char* parse_pos;
11 unsigned char test_char;
12 int i;
13
14 static char tokens_buff1[1000];
15 static struct FrameTableTxtLine temp_tokens_table1; // weak
16
17 temp_tokens_table1.uPropCount = 0;
18
19 if ( str_to_parse && *str_to_parse )
20 {
21 parse_pos=(char*)str_to_parse;
22 new_token_flag = true;
23 in_quotes = false;
24 for(i = 0; (i<1000)&&(temp_tokens_table1.uPropCount < 30) ; ++i)
25 {
26 test_char=*parse_pos;
27 tokens_buff1[i]=test_char;
28 if ( !test_char )
29 break;
30 if ( (test_char != ' ') && (test_char != ',') && (test_char != '\t') || in_quotes )
31 {
32 if ( test_char == '"' )
33 {
34 tokens_buff1[i]= '\0';
35 new_token_flag = true;
36 if ( in_quotes )
37 in_quotes = false;
38 else
39 {
40 in_quotes = true;
41 if ( *(parse_pos+1) == '"' )
42 {
43 temp_tokens_table1.pProperties[temp_tokens_table1.uPropCount] = &tokens_buff1[i];
44 ++temp_tokens_table1.uPropCount;
45 }
46 }
47 }
48 else
49 {
50 if ( new_token_flag )
51 {
52 temp_tokens_table1.pProperties[temp_tokens_table1.uPropCount] = &tokens_buff1[i];
53 ++temp_tokens_table1.uPropCount;
54 }
55 new_token_flag = false;
56 }
57 }
58 else
59 {
60 tokens_buff1[i]= '\0';
61 new_token_flag = true;
62 }
63 ++parse_pos;
64 }
65 tokens_buff1[i]= '\0';
66 }
67 memcpy(tokens_table, &temp_tokens_table1, sizeof(FrameTableTxtLine));
68 return tokens_table;
69 }
70 // F8BA58: using guessed type FrameTableTxtLine static_stru_F8BA58;
71
72 //----- (004BE485) --------------------------------------------------------
73 FrameTableTxtLine * frame_table_txt_parser(const char *str_to_parse, FrameTableTxtLine *tokens_table)
74 {
75 bool new_token_flag; // edx@3
76 bool in_quotes; // [sp+Ch] [bp-4h]@3
77 char* parse_pos;
78 unsigned char test_char;
79 int i;
80
81 static char tokens_buff2[1000];
82 static struct FrameTableTxtLine temp_tokens_table2; // weak
83 temp_tokens_table2.uPropCount = 0;
84
85 if ( str_to_parse && *str_to_parse )
86 {
87 parse_pos=(char*)str_to_parse;
88 new_token_flag = true;
89 in_quotes = false;
90 for(i = 0; (i<1000)&&(temp_tokens_table2.uPropCount < 30); ++i)
91 {
92 test_char=*parse_pos;
93 tokens_buff2[i]=test_char;
94 if ( !test_char )
95 break;
96 if ( (test_char != ' ') && (test_char != ',') && (test_char != '\t') || in_quotes )
97 {
98 if ( test_char == '"' )
99 {
100 tokens_buff2[i]= '\0';
101 new_token_flag = true;
102 if ( in_quotes )
103 in_quotes = false;
104 else
105 {
106 in_quotes = true;
107 if ( *(parse_pos+1) == '"' )
108 {
109 temp_tokens_table2.pProperties[temp_tokens_table2.uPropCount] = &tokens_buff2[i];
110 ++temp_tokens_table2.uPropCount;
111 }
112 }
113 }
114 else
115 {
116 if ( new_token_flag )
117 {
118 temp_tokens_table2.pProperties[temp_tokens_table2.uPropCount] = &tokens_buff2[i];
119 ++temp_tokens_table2.uPropCount;
120 }
121 new_token_flag = false;
122 }
123 }
124 else
125 {
126 tokens_buff2[i]= '\0';
127 new_token_flag = true;
128 }
129 ++parse_pos;
130 }
131
132 tokens_buff2[i]= '\0';
133 }
134 memcpy(tokens_table, &temp_tokens_table2, sizeof(FrameTableTxtLine));
135 return tokens_table;
136 }
137