annotate FrameTableInc.cpp @ 1525:863de6ec906b

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