annotate FrameTableInc.cpp @ 2489:ceda74e07201

.
author Ritor1
date Thu, 11 Sep 2014 17:30:59 +0600
parents f4af3b203f65
children
rev   line source
2415
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2253
diff changeset
1 #define _CRTDBG_MAP_ALLOC
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2253
diff changeset
2 #include <stdlib.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2253
diff changeset
3 #include <crtdbg.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2253
diff changeset
4
2253
aff7a7b072b7 adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents: 703
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
0
Ritor1
parents:
diff changeset
6 #include "FrameTableInc.h"
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
7 #include <memory.h>
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
8 //identical function to work in differnt threads
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
9
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
10 //----- (004BE3BF) --------------------------------------------------------
703
a9c1fb7483c2 monster parser almost complete.
Gloval
parents: 701
diff changeset
11 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
12 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
13 bool new_token_flag; // edx@3
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
14 bool in_quotes; // [sp+Ch] [bp-4h]@3
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
15 char* parse_pos;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
16 unsigned char test_char;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
17 int i;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
18
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
19 static char tokens_buff1[1000];
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
20 static struct FrameTableTxtLine temp_tokens_table1; // weak
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
21
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
22 temp_tokens_table1.uPropCount = 0;
0
Ritor1
parents:
diff changeset
23
701
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
24 if ( str_to_parse && *str_to_parse )
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 parse_pos=(char*)str_to_parse;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
27 new_token_flag = true;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
28 in_quotes = false;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
29 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
30 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
31 test_char=*parse_pos;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
32 tokens_buff1[i]=test_char;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
33 if ( !test_char )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
34 break;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
35 if ( (test_char != ' ') && (test_char != ',') && (test_char != '\t') || in_quotes )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
36 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
37 if ( test_char == '"' )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
38 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
39 tokens_buff1[i]= '\0';
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
40 new_token_flag = true;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
41 if ( in_quotes )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
42 in_quotes = false;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
43 else
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
44 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
45 in_quotes = true;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
46 if ( *(parse_pos+1) == '"' )
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 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
49 ++temp_tokens_table1.uPropCount;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
50 }
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 }
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
53 else
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 if ( new_token_flag )
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 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
58 ++temp_tokens_table1.uPropCount;
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 new_token_flag = false;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
61 }
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 else
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 new_token_flag = true;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
67 }
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
68 ++parse_pos;
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 tokens_buff1[i]= '\0';
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 memcpy(tokens_table, &temp_tokens_table1, sizeof(FrameTableTxtLine));
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
73 return 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 // F8BA58: using guessed type FrameTableTxtLine static_stru_F8BA58;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
76
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
77 //----- (004BE485) --------------------------------------------------------
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
78 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
79 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
80 bool new_token_flag; // edx@3
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
81 bool in_quotes; // [sp+Ch] [bp-4h]@3
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
82 char* parse_pos;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
83 unsigned char test_char;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
84 int i;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
85
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
86 static char tokens_buff2[1000];
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
87 static struct FrameTableTxtLine temp_tokens_table2; // weak
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
88 temp_tokens_table2.uPropCount = 0;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
89
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
90 if ( str_to_parse && *str_to_parse )
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 parse_pos=(char*)str_to_parse;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
93 new_token_flag = true;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
94 in_quotes = false;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
95 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
96 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
97 test_char=*parse_pos;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
98 tokens_buff2[i]=test_char;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
99 if ( !test_char )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
100 break;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
101 if ( (test_char != ' ') && (test_char != ',') && (test_char != '\t') || in_quotes )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
102 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
103 if ( test_char == '"' )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
104 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
105 tokens_buff2[i]= '\0';
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
106 new_token_flag = true;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
107 if ( in_quotes )
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
108 in_quotes = false;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
109 else
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
110 {
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
111 in_quotes = true;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
112 if ( *(parse_pos+1) == '"' )
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 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
115 ++temp_tokens_table2.uPropCount;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
116 }
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 }
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
119 else
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 if ( new_token_flag )
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 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
124 ++temp_tokens_table2.uPropCount;
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 new_token_flag = false;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
127 }
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 else
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 tokens_buff2[i]= '\0';
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
132 new_token_flag = true;
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 ++parse_pos;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
135 }
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 tokens_buff2[i]= '\0';
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
138 }
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
139 memcpy(tokens_table, &temp_tokens_table2, sizeof(FrameTableTxtLine));
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
140 return tokens_table;
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
141 }
d5b16a44d9b3 frame_table parser, new files for UI func
Gloval
parents: 0
diff changeset
142