Mercurial > mm7
diff Engine/Tables/FrameTableInc.cpp @ 2499:68cdef6879a0
engine folder
author | Ritor1 |
---|---|
date | Fri, 19 Sep 2014 02:57:42 +0600 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Engine/Tables/FrameTableInc.cpp Fri Sep 19 02:57:42 2014 +0600 @@ -0,0 +1,142 @@ +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> + +#define _CRT_SECURE_NO_WARNINGS +#include "FrameTableInc.h" +#include <memory.h> +//identical function to work in differnt threads + +//----- (004BE3BF) -------------------------------------------------------- +FrameTableTxtLine* txt_file_frametable_parser(const char *str_to_parse, FrameTableTxtLine *tokens_table) + { + bool new_token_flag; // edx@3 + bool in_quotes; // [sp+Ch] [bp-4h]@3 + char* parse_pos; + unsigned char test_char; + int i; + + static char tokens_buff1[1000]; + static struct FrameTableTxtLine temp_tokens_table1; // weak + + temp_tokens_table1.uPropCount = 0; + + if ( str_to_parse && *str_to_parse ) + { + parse_pos=(char*)str_to_parse; + new_token_flag = true; + in_quotes = false; + for(i = 0; (i<1000)&&(temp_tokens_table1.uPropCount < 30) ; ++i) + { + test_char=*parse_pos; + tokens_buff1[i]=test_char; + if ( !test_char ) + break; + if ( (test_char != ' ') && (test_char != ',') && (test_char != '\t') || in_quotes ) + { + if ( test_char == '"' ) + { + tokens_buff1[i]= '\0'; + new_token_flag = true; + if ( in_quotes ) + in_quotes = false; + else + { + in_quotes = true; + if ( *(parse_pos+1) == '"' ) + { + temp_tokens_table1.pProperties[temp_tokens_table1.uPropCount] = &tokens_buff1[i]; + ++temp_tokens_table1.uPropCount; + } + } + } + else + { + if ( new_token_flag ) + { + temp_tokens_table1.pProperties[temp_tokens_table1.uPropCount] = &tokens_buff1[i]; + ++temp_tokens_table1.uPropCount; + } + new_token_flag = false; + } + } + else + { + tokens_buff1[i]= '\0'; + new_token_flag = true; + } + ++parse_pos; + } + tokens_buff1[i]= '\0'; + } + memcpy(tokens_table, &temp_tokens_table1, sizeof(FrameTableTxtLine)); + return tokens_table; + } +// F8BA58: using guessed type FrameTableTxtLine static_stru_F8BA58; + +//----- (004BE485) -------------------------------------------------------- +FrameTableTxtLine * frame_table_txt_parser(const char *str_to_parse, FrameTableTxtLine *tokens_table) + { + bool new_token_flag; // edx@3 + bool in_quotes; // [sp+Ch] [bp-4h]@3 + char* parse_pos; + unsigned char test_char; + int i; + + static char tokens_buff2[1000]; + static struct FrameTableTxtLine temp_tokens_table2; // weak + temp_tokens_table2.uPropCount = 0; + + if ( str_to_parse && *str_to_parse ) + { + parse_pos=(char*)str_to_parse; + new_token_flag = true; + in_quotes = false; + for(i = 0; (i<1000)&&(temp_tokens_table2.uPropCount < 30); ++i) + { + test_char=*parse_pos; + tokens_buff2[i]=test_char; + if ( !test_char ) + break; + if ( (test_char != ' ') && (test_char != ',') && (test_char != '\t') || in_quotes ) + { + if ( test_char == '"' ) + { + tokens_buff2[i]= '\0'; + new_token_flag = true; + if ( in_quotes ) + in_quotes = false; + else + { + in_quotes = true; + if ( *(parse_pos+1) == '"' ) + { + temp_tokens_table2.pProperties[temp_tokens_table2.uPropCount] = &tokens_buff2[i]; + ++temp_tokens_table2.uPropCount; + } + } + } + else + { + if ( new_token_flag ) + { + temp_tokens_table2.pProperties[temp_tokens_table2.uPropCount] = &tokens_buff2[i]; + ++temp_tokens_table2.uPropCount; + } + new_token_flag = false; + } + } + else + { + tokens_buff2[i]= '\0'; + new_token_flag = true; + } + ++parse_pos; + } + + tokens_buff2[i]= '\0'; + } + memcpy(tokens_table, &temp_tokens_table2, sizeof(FrameTableTxtLine)); + return tokens_table; + } +