changed: variables and functions are case-sensitive now
added: variables and functions can have underline characters in their names git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@62 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -97,10 +97,10 @@ int i;
|
||||
pchar = new char[temporary_buffer_size];
|
||||
|
||||
GetDlgItemText(hWnd, IDC_EDIT_FUNCTION_NAME, pchar, temporary_buffer_size);
|
||||
name = Variables::ChangeToSmallLetters( Variables::StripWhiteCharacters(pchar) );
|
||||
name = Variables::StripWhiteCharacters(pchar);
|
||||
|
||||
GetDlgItemText(hWnd, IDC_EDIT_FUNCTION_VALUE, pchar, temporary_buffer_size);
|
||||
value = Variables::ChangeToSmallLetters( Variables::StripWhiteCharacters(pchar) );
|
||||
value = Variables::StripWhiteCharacters(pchar);
|
||||
|
||||
parameters = (int)SendDlgItemMessage(hWnd,IDC_COMBO_FUNCTION_PARAM,CB_GETCURSEL,0,0);
|
||||
|
||||
|
@@ -44,6 +44,26 @@ IniParser::IniParser()
|
||||
{
|
||||
strip_white_characters_from_value = true;
|
||||
convert_value_to_small_letters = true;
|
||||
section_case_sensitive = false;
|
||||
pattern_case_sensitive = false;
|
||||
}
|
||||
|
||||
|
||||
void IniParser::ConvertValueToSmallLetters(bool conv)
|
||||
{
|
||||
convert_value_to_small_letters = conv;
|
||||
}
|
||||
|
||||
|
||||
void IniParser::SectionCaseSensitive(bool sens)
|
||||
{
|
||||
section_case_sensitive = sens;
|
||||
}
|
||||
|
||||
|
||||
void IniParser::PatternCaseSensitive(bool sens)
|
||||
{
|
||||
pattern_case_sensitive = sens;
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +168,10 @@ IniParser::Error IniParser::ReadSection(std::string & section)
|
||||
}
|
||||
|
||||
while( IsSectionCharacter( (c = ReadCharacter()) ) )
|
||||
section += LowerCase(c);
|
||||
if( section_case_sensitive )
|
||||
section += c;
|
||||
else
|
||||
section += LowerCase(c);
|
||||
|
||||
if( c != ']' )
|
||||
{
|
||||
@@ -220,7 +243,11 @@ IniParser::Error IniParser::ReadExpression(std::string & pattern, std::string &
|
||||
|
||||
while( IsPatternCharacter(c) )
|
||||
{
|
||||
pattern += LowerCase(c);
|
||||
if( pattern_case_sensitive )
|
||||
pattern += c;
|
||||
else
|
||||
pattern += LowerCase(c);
|
||||
|
||||
c = ReadCharacter();
|
||||
}
|
||||
|
||||
|
@@ -133,6 +133,34 @@ public:
|
||||
Error ReadFromFile(const char * path);
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
when true the names of sections will be case-sensitive
|
||||
e.g.
|
||||
when true: '[foo]' is not equal '[Foo]'
|
||||
|
||||
default: false
|
||||
*/
|
||||
void SectionCaseSensitive(bool sens);
|
||||
|
||||
|
||||
/*!
|
||||
when true the names of patterns will be case-sensitive
|
||||
e.g.
|
||||
when true: 'foo = 4' is not equal 'Foo = 4'
|
||||
|
||||
default: false
|
||||
*/
|
||||
void PatternCaseSensitive(bool sens);
|
||||
|
||||
|
||||
/*!
|
||||
if conv=true (default) that the whole characters in a value
|
||||
will be changed into small letters
|
||||
*/
|
||||
void ConvertValueToSmallLetters(bool conv);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
typedef std::map<std::string, std::string *> Table;
|
||||
@@ -144,6 +172,8 @@ private:
|
||||
int line;
|
||||
bool strip_white_characters_from_value;
|
||||
bool convert_value_to_small_letters;
|
||||
bool section_case_sensitive;
|
||||
bool pattern_case_sensitive;
|
||||
|
||||
Error Read();
|
||||
Error ReadSection(std::string & section);
|
||||
|
@@ -283,8 +283,8 @@ void Languages::InitGuiMessagesTab()
|
||||
"Mathematical calculator TTCalc %d.%d.%d%s%s\r\n"
|
||||
"Author: Tomasz Sowa\r\n"
|
||||
"Contact: t.sowa@slimaczek.pl\r\n"
|
||||
"Licence: (New) BSD licence\r\n"
|
||||
"Project page: http://sourceforge.net/projects/ttcalc\r\n"
|
||||
"Licence: BSD (open source)\r\n"
|
||||
"Project page: http://ttcalc.sourceforge.net\r\n"
|
||||
"Bignum library: TTMath %d.%d.%d%s\r\n"
|
||||
"Programming language: C++\r\n"
|
||||
"Compiler: %s\r\n"
|
||||
@@ -406,8 +406,8 @@ void Languages::InitGuiMessagesTab()
|
||||
"Kalkulator matematyczny TTCalc %d.%d.%d%s%s\r\n"
|
||||
"Autor: Tomasz Sowa\r\n"
|
||||
"Kontakt: t.sowa@slimaczek.pl\r\n"
|
||||
"Licencja: (New) BSD\r\n"
|
||||
"Strona projektu: http://sourceforge.net/projects/ttcalc\r\n"
|
||||
"Licencja: BSD (open source)\r\n"
|
||||
"Strona projektu: http://ttcalc.sourceforge.net\r\n"
|
||||
"Biblioteka du<64>ych liczb: TTMath %d.%d.%d%s\r\n"
|
||||
"J<EFBFBD>zyk programowania: C++\r\n"
|
||||
"Kompilator: %s\r\n"
|
||||
|
@@ -1038,7 +1038,8 @@ SHELLEXECUTEINFO exec;
|
||||
exec.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS;
|
||||
exec.hwnd = 0;
|
||||
exec.lpVerb = "open";
|
||||
exec.lpFile = "http://sourceforge.net/projects/ttcalc";
|
||||
//exec.lpFile = "http://sourceforge.net/projects/ttcalc";
|
||||
exec.lpFile = "http://ttcalc.sourceforge.net";
|
||||
exec.lpParameters = 0;
|
||||
exec.lpDirectory = "";
|
||||
exec.nShow = SW_SHOWNORMAL;
|
||||
|
@@ -604,6 +604,11 @@ IniParser::Section temp_variables, temp_functions;
|
||||
IniParser::Section::iterator ic;
|
||||
std::string ini_value[20];
|
||||
|
||||
iparser.ConvertValueToSmallLetters(false);
|
||||
iparser.SectionCaseSensitive(false);
|
||||
|
||||
// we have variables and functions case-sensitive
|
||||
iparser.PatternCaseSensitive(true);
|
||||
|
||||
iparser.Associate( "global|always.on.top", &ini_value[0] );
|
||||
iparser.Associate( "global|view", &ini_value[1] );
|
||||
|
@@ -109,10 +109,10 @@ char * pchar;
|
||||
pchar = new char[temporary_buffer_size];
|
||||
|
||||
GetDlgItemText(hWnd, IDC_EDIT_VARIABLE_NAME, pchar, temporary_buffer_size);
|
||||
name = ChangeToSmallLetters( StripWhiteCharacters(pchar) );
|
||||
name = StripWhiteCharacters(pchar);
|
||||
|
||||
GetDlgItemText(hWnd, IDC_EDIT_VARIABLE_VALUE, pchar, temporary_buffer_size);
|
||||
value = ChangeToSmallLetters( StripWhiteCharacters(pchar) );
|
||||
value = StripWhiteCharacters(pchar);
|
||||
|
||||
delete [] pchar;
|
||||
|
||||
|
Reference in New Issue
Block a user