added: the portable version of the program TTCalc
(it uses *.ini config file from the same folder where is the executable file) changed: Makefile added: Makefileportable, Makefile.dep Makefileportable uses TTCALC_PORTABLE macro to indicate that we're compiling the portable version of the TTCalc in portable mode we're compiling with -Os changed: small changes in almost all files for using with TTCALC_PORTABLE macro in the portable version we have only one parser (as the parsers are leant on templates that the program will be smaller now) changed: in the portable version the bitmap on the about dialog has gone away (it was 142kb) added: the portable version *.exe is packed by the UPX packer (http://upx.sourceforge.net/) added: help/bitwise_functions.html (I forgot to add it to the repository) git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@43 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
aa10a71d13
commit
97ec3123d9
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>TTCalc - bitwise functions</title>
|
||||
<link rel="stylesheet" href="styles.css" type="text/css">
|
||||
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
|
||||
<param name="Keyword" value="bitand">
|
||||
<param name="Keyword" value="bitor">
|
||||
<param name="Keyword" value="bitxor">
|
||||
<param name="Keyword" value="band">
|
||||
<param name="Keyword" value="bor">
|
||||
<param name="Keyword" value="bxor">
|
||||
<param name="Keyword" value="bitwise functions">
|
||||
</object>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Bitwise functions</h1>
|
||||
|
||||
<p>
|
||||
There are bitwise functions in the program but they can operate only on non-negative values.
|
||||
We don't define the BitNot() function too.
|
||||
</p>
|
||||
|
||||
|
||||
<dl>
|
||||
|
||||
<dt>BitAnd(x ; y) or band(x ; y)</dt>
|
||||
<dd>Bitwise AND. For example:<br>
|
||||
bitand(6; 2) = bitand(&110 ; &10) = &10 = 2<br>
|
||||
bitand(6.5; 2.5) = bitand(&110.1 ; &10.1) = &10.1 = 2.5</dd>
|
||||
|
||||
<dt>BitOr(x ; y) or bor(x ; y)</dt>
|
||||
<dd>Bitwise OR. For example:<br>
|
||||
bitor(6; 1) = bitor(&110 ; &1) = &111 = 7<br>
|
||||
bitor(6.5; 1.5) = bitor(&110.1 ; &1.1) = &111.1 = 7.5</dd>
|
||||
|
||||
<dt>BitXor(x ; y) or bxor(x ; y)</dt>
|
||||
<dd>Bitwise XOR. For example:<br>
|
||||
bitxor(6; 3) = bitxor(&110 ; &11) = &101 = 5<br>
|
||||
bitxor(6.5; 3.5) = bitxor(&110.1 ; &11.1) = &101.0 = 5</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
</body>
|
||||
</html>
|
23
src/Makefile
23
src/Makefile
|
@ -1,39 +1,18 @@
|
|||
CC = g++
|
||||
o = resource.o calculation.o functions.o iniparser.o languages.o mainwindow.o parsermanager.o programresources.o tabs.o variables.o winmain.o
|
||||
CFLAGS = -Wall -pedantic -s -O2 -mwindows -mthreads -I../../../ttmath
|
||||
name = ttcalc.exe
|
||||
dir_output = ../../output
|
||||
|
||||
|
||||
|
||||
.SUFFIXES: .cpp .o
|
||||
|
||||
.cpp.o:
|
||||
$(CC) -c $(CFLAGS) $<
|
||||
|
||||
|
||||
all: ttcalc
|
||||
|
||||
include Makefile.dep
|
||||
|
||||
ttcalc: $(o)
|
||||
$(CC) -o $(dir_output)/$(name) $(CFLAGS) $(o) -lcomctl32
|
||||
|
||||
|
||||
resource.o: resource.rc
|
||||
windres resource.rc resource.o
|
||||
|
||||
calculation.o: calculation.cpp compileconfig.h parsermanager.h resource.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h tabs.h messages.h
|
||||
functions.o: functions.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
iniparser.o: iniparser.cpp compileconfig.h iniparser.h
|
||||
languages.o: languages.cpp compileconfig.h languages.h
|
||||
mainwindow.o: mainwindow.cpp compileconfig.h winmain.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h resource.h messages.h tabs.h
|
||||
parsermanager.o: parsermanager.cpp compileconfig.h parsermanager.h resource.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
programresources.o: programresources.cpp compileconfig.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
tabs.o: tabs.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
variables.o: variables.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
winmain.o: winmain.cpp compileconfig.h winmain.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h resource.h messages.h tabs.h
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f *.s
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
o = resource.o calculation.o functions.o iniparser.o languages.o mainwindow.o parsermanager.o programresources.o tabs.o variables.o winmain.o
|
||||
|
||||
calculation.o: calculation.cpp compileconfig.h parsermanager.h resource.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h tabs.h messages.h
|
||||
functions.o: functions.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
iniparser.o: iniparser.cpp compileconfig.h iniparser.h
|
||||
languages.o: languages.cpp compileconfig.h languages.h
|
||||
mainwindow.o: mainwindow.cpp compileconfig.h winmain.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h resource.h messages.h tabs.h
|
||||
parsermanager.o: parsermanager.cpp compileconfig.h parsermanager.h resource.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
programresources.o: programresources.cpp compileconfig.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
tabs.o: tabs.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
variables.o: variables.cpp compileconfig.h tabs.h resource.h messages.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h
|
||||
winmain.o: winmain.cpp compileconfig.h winmain.h programresources.h iniparser.h languages.h threadcontroller.h stopcalculating.h resource.h messages.h tabs.h
|
||||
|
||||
.SUFFIXES: .cpp .o
|
||||
|
||||
.cpp.o:
|
||||
$(CC) -c $(CFLAGS) $<
|
|
@ -0,0 +1,21 @@
|
|||
CC = g++
|
||||
CFLAGS = -Wall -pedantic -s -Os -fno-default-inline -mwindows -mthreads -I../../../ttmath -DTTCALC_PORTABLE
|
||||
name = ttcalcp.exe
|
||||
dir_output = ../../output
|
||||
compressor = upx
|
||||
|
||||
all: ttcalc
|
||||
|
||||
include Makefile.dep
|
||||
|
||||
ttcalc: $(o)
|
||||
$(CC) -o $(dir_output)/$(name) $(CFLAGS) $(o) -lcomctl32
|
||||
$(compressor) -7 $(dir_output)/$(name)
|
||||
|
||||
resource.o: resource.rc
|
||||
windres -DTTCALC_PORTABLE resource.rc resource.o
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
rm -f *.s
|
||||
rm -f $(dir_output)/$(name)
|
|
@ -55,8 +55,8 @@
|
|||
*/
|
||||
#define TTCALC_MAJOR_VER 0
|
||||
#define TTCALC_MINOR_VER 8
|
||||
#define TTCALC_REVISION_VER 1
|
||||
#define TTCALC_PRERELEASE_VER 0
|
||||
#define TTCALC_REVISION_VER 2
|
||||
#define TTCALC_PRERELEASE_VER 1
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
/*!
|
||||
\file iniparser.h
|
||||
\brief A Parser witch we use for parsing 'ini' files
|
||||
\brief A Parser which we use for parsing 'ini' files
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
|
|
@ -273,7 +273,7 @@ void Languages::InitGuiMessagesTab()
|
|||
InsertGuiPair(cant_create_main_window, "I could not create the main window of the application");
|
||||
InsertGuiPair(cant_init_common_controls,"I could not initialize the common controls (InitCommonControlsEx)");
|
||||
InsertGuiPair(about_text,
|
||||
"Mathematical calculator TTCalc %d.%d.%d%s\r\n"
|
||||
"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"
|
||||
|
@ -281,6 +281,7 @@ void Languages::InitGuiMessagesTab()
|
|||
"Bignum library: TTMath %d.%d.%d%s\r\n"
|
||||
"Programming language: C++\r\n"
|
||||
"Compiler: %s\r\n"
|
||||
"%s" // for upx
|
||||
"\r\n"
|
||||
"This program uses the TTMath bignum library"
|
||||
" which can be found at http://sourceforge.net/projects/ttmath\r\n"
|
||||
|
@ -289,6 +290,8 @@ void Languages::InitGuiMessagesTab()
|
|||
" this program or if you want to join to this project as"
|
||||
" a developer or programmer feel free to contant with the author."
|
||||
);
|
||||
InsertGuiPair(about_text_portable_version, " portable version");
|
||||
InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.00\r\n");
|
||||
InsertGuiPair(about_box_title, "About");
|
||||
InsertGuiPair(about_box_button_close, "Close");
|
||||
InsertGuiPair(unknown_error, "An unknown error has occurred");
|
||||
|
@ -381,7 +384,7 @@ void Languages::InitGuiMessagesTab()
|
|||
InsertGuiPair(cant_create_main_window, "Nie uda³o siê utworzyæ g³ównego okna aplikacji");
|
||||
InsertGuiPair(cant_init_common_controls,"Nie uda³o siê zainicjalizowaæ obs³ugi Common Controls (InitCommonControlsEx)");
|
||||
InsertGuiPair(about_text,
|
||||
"Kalkulator matematyczny TTCalc %d.%d.%d%s\r\n"
|
||||
"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"
|
||||
|
@ -389,6 +392,7 @@ void Languages::InitGuiMessagesTab()
|
|||
"Biblioteka du¿ych liczb: TTMath %d.%d.%d%s\r\n"
|
||||
"Jêzyk programowania: C++\r\n"
|
||||
"Kompilator: %s\r\n"
|
||||
"%s" // for upx
|
||||
"\r\n"
|
||||
"Ten program u¿ywa biblioteki du¿ych liczb TTMath"
|
||||
" która jest dostêpna na http://sourceforge.net/projects/ttmath\r\n"
|
||||
|
@ -397,6 +401,8 @@ void Languages::InitGuiMessagesTab()
|
|||
" tego programu lub chcia³byœ do³¹czyæ jako projektant/programista"
|
||||
" poprostu skontaktuj siê z autorem."
|
||||
);
|
||||
InsertGuiPair(about_text_portable_version, " wersja portable");
|
||||
InsertGuiPair(about_text_exe_packer, "Paker exe: UPX 3.00\r\n");
|
||||
InsertGuiPair(about_box_title, "O programie");
|
||||
InsertGuiPair(about_box_button_close, "Zamknij");
|
||||
InsertGuiPair(unknown_error, "Nieznany kod b³êdu");
|
||||
|
|
|
@ -125,6 +125,8 @@ public:
|
|||
cant_find_help,
|
||||
cant_open_project_page,
|
||||
about_text,
|
||||
about_text_portable_version,
|
||||
about_text_exe_packer,
|
||||
about_box_title,
|
||||
about_box_button_close,
|
||||
display_group_scientific,
|
||||
|
|
|
@ -386,28 +386,47 @@ TCITEM tab_item;
|
|||
tab_standard = 0;
|
||||
tab_variables = 1;
|
||||
tab_functions = 2;
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
tab_precision = 3;
|
||||
tab_display = 4;
|
||||
#else
|
||||
tab_precision = -1; // this one will not be used
|
||||
tab_display = 3;
|
||||
#endif
|
||||
|
||||
|
||||
// this insertion must be in the ascending order
|
||||
// (the second parameter of 'TabCtrl_InsertItem')
|
||||
TabCtrl_InsertItem(hTab, tab_standard, &tab_item);
|
||||
TabCtrl_InsertItem(hTab, tab_variables, &tab_item);
|
||||
TabCtrl_InsertItem(hTab, tab_functions, &tab_item);
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
TabCtrl_InsertItem(hTab, tab_precision, &tab_item);
|
||||
#endif
|
||||
|
||||
TabCtrl_InsertItem(hTab, tab_display, &tab_item);
|
||||
|
||||
WmInitDialogCreateTab(hTab, tab_standard, IDD_DIALOG_STANDARD, TabWindowProc);
|
||||
WmInitDialogCreateTab(hTab, tab_variables, IDD_DIALOG_VARIABLES, TabWindowProc);
|
||||
WmInitDialogCreateTab(hTab, tab_functions, IDD_DIALOG_FUNCTIONS, TabWindowProc);
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
WmInitDialogCreateTab(hTab, tab_precision, IDD_DIALOG_PRECISION, TabWindowProc);
|
||||
#endif
|
||||
|
||||
WmInitDialogCreateTab(hTab, tab_display, IDD_DIALOG_DISPLAY, TabWindowProc);
|
||||
|
||||
SetSizeOfDialogs();
|
||||
|
||||
SendMessage(GetPrgRes()->GetTabWindow(tab_variables), WM_INIT_TAB_VARIABLES, 0,0);
|
||||
SendMessage(GetPrgRes()->GetTabWindow(tab_functions), WM_INIT_TAB_FUNCTIONS, 0,0);
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
SendMessage(GetPrgRes()->GetTabWindow(tab_precision), WM_INIT_TAB_PRECISION, 0,0);
|
||||
#endif
|
||||
|
||||
SendMessage(GetPrgRes()->GetTabWindow(tab_display), WM_INIT_TAB_DISPLAY, 0,0);
|
||||
|
||||
TabWindowFunctions::SetLanguage(hTab);
|
||||
|
@ -733,7 +752,7 @@ PROCESS_INFORMATION pi;
|
|||
|
||||
memset(&si,0,sizeof(si));
|
||||
si.cb = sizeof(si);
|
||||
CreateProcess(buffer,"",0,0,false,NORMAL_PRIORITY_CLASS,0,0,&si,&pi);
|
||||
CreateProcess(buffer,const_cast<char*>(""),0,0,false,NORMAL_PRIORITY_CLASS,0,0,&si,&pi);
|
||||
|
||||
delete [] buffer;
|
||||
|
||||
|
@ -877,20 +896,20 @@ SHELLEXECUTEINFO exec;
|
|||
|
||||
exec.cbSize = sizeof(exec);
|
||||
exec.fMask = SEE_MASK_FLAG_NO_UI | SEE_MASK_NOCLOSEPROCESS;
|
||||
exec.hwnd = 0;
|
||||
exec.lpVerb = "open";
|
||||
exec.lpFile = "ttcalc.chm";
|
||||
exec.lpParameters = 0;
|
||||
exec.lpDirectory = "";
|
||||
exec.nShow = SW_SHOWNORMAL;
|
||||
exec.hwnd = 0;
|
||||
exec.lpVerb = "open";
|
||||
exec.lpFile = "ttcalc.chm";
|
||||
exec.lpParameters = 0;
|
||||
exec.lpDirectory = "";
|
||||
exec.nShow = SW_SHOWNORMAL;
|
||||
|
||||
if( !ShellExecuteEx(&exec) )
|
||||
{
|
||||
MessageBox(hWnd,
|
||||
GetPrgRes()->GetLanguages()->GuiMessage(Languages::cant_find_help),
|
||||
GetPrgRes()->GetLanguages()->GuiMessage(Languages::message_box_caption),
|
||||
MB_ICONERROR);
|
||||
}
|
||||
if( !ShellExecuteEx(&exec) )
|
||||
{
|
||||
MessageBox(hWnd,
|
||||
GetPrgRes()->GetLanguages()->GuiMessage(Languages::cant_find_help),
|
||||
GetPrgRes()->GetLanguages()->GuiMessage(Languages::message_box_caption),
|
||||
MB_ICONERROR);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -902,20 +921,20 @@ SHELLEXECUTEINFO exec;
|
|||
|
||||
exec.cbSize = sizeof(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.lpParameters = 0;
|
||||
exec.lpDirectory = "";
|
||||
exec.nShow = SW_SHOWNORMAL;
|
||||
exec.hwnd = 0;
|
||||
exec.lpVerb = "open";
|
||||
exec.lpFile = "http://sourceforge.net/projects/ttcalc";
|
||||
exec.lpParameters = 0;
|
||||
exec.lpDirectory = "";
|
||||
exec.nShow = SW_SHOWNORMAL;
|
||||
|
||||
if( !ShellExecuteEx(&exec) )
|
||||
{
|
||||
MessageBox(hWnd,
|
||||
GetPrgRes()->GetLanguages()->GuiMessage(Languages::cant_open_project_page),
|
||||
GetPrgRes()->GetLanguages()->GuiMessage(Languages::message_box_caption),
|
||||
MB_ICONERROR);
|
||||
}
|
||||
if( !ShellExecuteEx(&exec) )
|
||||
{
|
||||
MessageBox(hWnd,
|
||||
GetPrgRes()->GetLanguages()->GuiMessage(Languages::cant_open_project_page),
|
||||
GetPrgRes()->GetLanguages()->GuiMessage(Languages::message_box_caption),
|
||||
MB_ICONERROR);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -978,7 +997,7 @@ void CreateMainMessagesTable(Messages & messages)
|
|||
*/
|
||||
void CreateAboutText(char * buffer)
|
||||
{
|
||||
char compiler[30];
|
||||
char compiler[50];
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
|
@ -1032,10 +1051,21 @@ char compiler[30];
|
|||
buffer,
|
||||
GetPrgRes()->GetLanguages()->GuiMessage(Languages::about_text),
|
||||
TTCALC_MAJOR_VER, TTCALC_MINOR_VER, TTCALC_REVISION_VER,
|
||||
#ifndef TTCALC_PORTABLE
|
||||
"",
|
||||
#else
|
||||
GetPrgRes()->GetLanguages()->GuiMessage(Languages::about_text_portable_version),
|
||||
#endif
|
||||
(TTCALC_PRERELEASE_VER!=0)? " (prerelease)" : "",
|
||||
TTMATH_MAJOR_VER, TTMATH_MINOR_VER, TTMATH_REVISION_VER,
|
||||
(TTMATH_PRERELEASE_VER!=0)? " (prerelease)" : "",
|
||||
compiler);
|
||||
compiler,
|
||||
#ifndef TTCALC_PORTABLE
|
||||
""
|
||||
#else
|
||||
GetPrgRes()->GetLanguages()->GuiMessage(Languages::about_text_exe_packer)
|
||||
#endif
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ ttmath::ErrorCode ParserManager::Parse()
|
|||
{
|
||||
try
|
||||
{
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
switch( precision )
|
||||
{
|
||||
case 0:
|
||||
|
@ -103,6 +105,13 @@ ttmath::ErrorCode ParserManager::Parse()
|
|||
code = parser3.Parse(buffer);
|
||||
break;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
parser1.SetBase(base_input);
|
||||
code = parser1.Parse(buffer);
|
||||
|
||||
#endif
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
|
@ -151,6 +160,8 @@ void ParserManager::Init()
|
|||
parser1.SetVariables( &variables );
|
||||
parser1.SetFunctions( &functions );
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
parser2.SetStopObject( GetPrgRes()->GetThreadController()->GetStopObject() );
|
||||
parser2.SetVariables( &variables );
|
||||
parser2.SetFunctions( &functions );
|
||||
|
@ -158,6 +169,8 @@ void ParserManager::Init()
|
|||
parser3.SetStopObject( GetPrgRes()->GetThreadController()->GetStopObject() );
|
||||
parser3.SetVariables( &variables );
|
||||
parser3.SetFunctions( &functions );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -165,6 +178,8 @@ void ParserManager::PrintResult()
|
|||
{
|
||||
if( code == ttmath::err_ok )
|
||||
{
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
switch( precision )
|
||||
{
|
||||
case 0:
|
||||
|
@ -176,6 +191,12 @@ void ParserManager::PrintResult()
|
|||
default:
|
||||
return PrintResult(parser3);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
return PrintResult(parser1);
|
||||
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -105,9 +105,13 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
ttmath::Parser<ttmath::Big<1,3> > parser1;
|
||||
ttmath::Parser<ttmath::Big<2,6> > parser2;
|
||||
ttmath::Parser<ttmath::Big<3,9> > parser3;
|
||||
#else
|
||||
ttmath::Parser<ttmath::Big<1,3> > parser1;
|
||||
#endif
|
||||
|
||||
ttmath::Objects variables, functions;
|
||||
|
||||
|
@ -133,46 +137,17 @@ private:
|
|||
|
||||
for(i=0 ; i<matparser.stack.size() ; ++i)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
if( matparser.stack[i].value.ToString(part,base_output, always_scientific, when_scientific, rounding) )
|
||||
{
|
||||
// we shouldn't have this error in the new version of ToStrign(...)
|
||||
// (it could be if were using very big mantissa and exponent
|
||||
// in the Big type)
|
||||
|
||||
//
|
||||
// look at this: part.erase()
|
||||
//
|
||||
// we're using it because it's something wrong on gcc
|
||||
// when we're compiling with -O3 optimization flag
|
||||
//
|
||||
// gcc version 3.4.2 (mingw-special) with -O3
|
||||
// program tell us if there was an error here (from ToString())
|
||||
// but in fact it shouldn't have been here
|
||||
// I don't know where is the problem (I think in optimization,
|
||||
// with -O1 and -O2 program works well and visual express works perfectly
|
||||
// as well)
|
||||
|
||||
part.erase();
|
||||
|
||||
// we can omit this part.erase() and use operator+= instead of
|
||||
// operator= below, for example:
|
||||
// part += GetPrgRes()->GetLanguages()->GuiMessage(country, Languages::overflow_during_printing);
|
||||
// will be working correctly on gcc with -O3
|
||||
|
||||
// this error doesn't appear always, it can be seen, for example,
|
||||
// if we use Big<1,3> type and we give '2^32' for calculating
|
||||
|
||||
// I didn't check this error on a new version of gcc
|
||||
|
||||
// we shouldn't have had this error in the new version of ToStrign(...)
|
||||
// (where we're using a bigger type for calculating)
|
||||
part = GetPrgRes()->GetLanguages()->GuiMessage(country, Languages::overflow_during_printing);
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
part.erase();
|
||||
part = GetPrgRes()->GetLanguages()->ErrorMessage(country, ttmath::err_internal_error);
|
||||
}
|
||||
|
||||
|
|
|
@ -491,12 +491,17 @@ return status;
|
|||
|
||||
void ProgramResources::SetNameOfConfigurationFile()
|
||||
{
|
||||
static const char simple_file_name[] = "ttcalc.ini";
|
||||
static const char simple_file_name[] = "ttcalc.ini";
|
||||
|
||||
// if there'll be an error we assume that the current directory will be used
|
||||
// (in the portable version the configuration file is in a current directory)
|
||||
configuration_file = std::string(".\\") + simple_file_name;
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
static const char simple_directory_name[] = "TTCalc";
|
||||
std::string application_data;
|
||||
|
||||
// if there'll be an error we assume that the current directory will be used
|
||||
configuration_file = std::string(".\\") + simple_file_name;
|
||||
|
||||
// we're trying to read the value "AppData" from registry
|
||||
// which can be, for instance, as:
|
||||
|
@ -533,6 +538,8 @@ std::string application_data;
|
|||
|
||||
delete [] buffer;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -45,7 +45,11 @@ END
|
|||
101 DIALOG 0, 0, 265, 150
|
||||
STYLE DS_SETFONT |DS_CENTER |WS_POPUP |WS_SYSMENU |WS_THICKFRAME |WS_MAXIMIZEBOX |WS_MINIMIZEBOX |WS_CAPTION
|
||||
MENU 200
|
||||
#ifndef TTCALC_PORTABLE
|
||||
CAPTION "TTCalc"
|
||||
#else
|
||||
CAPTION "TTCalc portable"
|
||||
#endif
|
||||
FONT 8, "Ms Shell Dlg"
|
||||
BEGIN
|
||||
CONTROL "",1000,"EDIT",ES_AUTOHSCROLL |ES_LEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,0,6,260,14
|
||||
|
@ -151,6 +155,8 @@ BEGIN
|
|||
CONTROL "",1143,"SysListView32",LVS_REPORT |LVS_SHOWSELALWAYS |LVS_SORTASCENDING |LVS_ALIGNLEFT |WS_CHILD |WS_BORDER |WS_TABSTOP |WS_VISIBLE ,57,3,223,85
|
||||
END
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
113 DIALOG 0, 0, 287, 90
|
||||
STYLE DS_3DLOOK |DS_FIXEDSYS |DS_SETFONT |WS_CHILD | WS_TABSTOP |WS_GROUP
|
||||
CAPTION "tab4"
|
||||
|
@ -164,6 +170,8 @@ BEGIN
|
|||
CONTROL "info 3",1155,"STATIC",SS_LEFT |WS_CHILD |WS_VISIBLE ,28,74,245,8
|
||||
END
|
||||
|
||||
#endif
|
||||
|
||||
114 DIALOG DISCARDABLE 0, 0, 255, 90
|
||||
STYLE DS_3DLOOK | DS_FIXEDSYS |DS_SETFONT |WS_CHILD | WS_TABSTOP |WS_GROUP
|
||||
CAPTION "tab5"
|
||||
|
@ -182,6 +190,7 @@ BEGIN
|
|||
GROUPBOX "Print scientific value",1168,11,51,240,31
|
||||
END
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
200 DIALOG DISCARDABLE 0, 0, 349, 202
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
|
@ -193,6 +202,20 @@ BEGIN
|
|||
WS_BORDER | NOT WS_TABSTOP
|
||||
DEFPUSHBUTTON "Close",IDOK,175,172,86,14
|
||||
END
|
||||
#else
|
||||
200 DIALOG DISCARDABLE 0, 0, 268, 239
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION |
|
||||
WS_SYSMENU
|
||||
CAPTION "About"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
EDITTEXT 1200,16,18,234,183,ES_MULTILINE | ES_READONLY | NOT
|
||||
WS_BORDER | NOT WS_TABSTOP
|
||||
DEFPUSHBUTTON "Close",IDOK,90,213,86,14
|
||||
END
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
1201 BITMAP "..\\res\\abacus_01.bmp"
|
||||
|
||||
#endif
|
||||
|
|
34
src/tabs.cpp
34
src/tabs.cpp
|
@ -391,6 +391,8 @@ void SetLanguageTabFunctions(HWND hWnd)
|
|||
|
||||
void SetLanguageTabPrecision(HWND hWnd)
|
||||
{
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
SetDlgItemText(hWnd, IDC_RADIO_PRECISION_1, GetPrgRes()->GetLanguages()->GuiMessage(Languages::radio_precision_1) );
|
||||
SetDlgItemText(hWnd, IDC_RADIO_PRECISION_2, GetPrgRes()->GetLanguages()->GuiMessage(Languages::radio_precision_2) );
|
||||
SetDlgItemText(hWnd, IDC_RADIO_PRECISION_3, GetPrgRes()->GetLanguages()->GuiMessage(Languages::radio_precision_3) );
|
||||
|
@ -398,6 +400,8 @@ void SetLanguageTabPrecision(HWND hWnd)
|
|||
SetDlgItemText(hWnd, IDC_LABEL_PRECISION_1_INFO, GetPrgRes()->GetLanguages()->GuiMessage(Languages::precision_1_info) );
|
||||
SetDlgItemText(hWnd, IDC_LABEL_PRECISION_2_INFO, GetPrgRes()->GetLanguages()->GuiMessage(Languages::precision_2_info) );
|
||||
SetDlgItemText(hWnd, IDC_LABEL_PRECISION_3_INFO, GetPrgRes()->GetLanguages()->GuiMessage(Languages::precision_3_info) );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -456,16 +460,24 @@ TCITEM tab;
|
|||
tab.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_functions) );
|
||||
TabCtrl_SetItem(hTab,tab_functions, &tab);
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
tab.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_precision) );
|
||||
TabCtrl_SetItem(hTab,tab_precision, &tab);
|
||||
|
||||
#endif
|
||||
|
||||
tab.pszText = const_cast<char*>( GetPrgRes()->GetLanguages()->GuiMessage(Languages::tab_display) );
|
||||
TabCtrl_SetItem(hTab,tab_display, &tab);
|
||||
|
||||
SetLanguageTabStandard( GetPrgRes()->GetTabWindow(tab_standard) );
|
||||
SetLanguageTabVariables( GetPrgRes()->GetTabWindow(tab_variables) );
|
||||
SetLanguageTabFunctions( GetPrgRes()->GetTabWindow(tab_functions) );
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
SetLanguageTabPrecision( GetPrgRes()->GetTabWindow(tab_precision) );
|
||||
#endif
|
||||
|
||||
SetLanguageTabDisplay( GetPrgRes()->GetTabWindow(tab_display) );
|
||||
|
||||
InvalidateRect(hTab, 0, false);
|
||||
|
@ -474,6 +486,8 @@ TCITEM tab;
|
|||
|
||||
BOOL WmTabCommand_SetPrecision1(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
// there are another messages besides that one
|
||||
// which is sent when a user clicks on the radio button
|
||||
if( IsDlgButtonChecked(hWnd, IDC_RADIO_PRECISION_1) != BST_CHECKED )
|
||||
|
@ -483,12 +497,16 @@ BOOL WmTabCommand_SetPrecision1(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
|
|||
GetPrgRes()->SetPrecision(0);
|
||||
GetPrgRes()->GetThreadController()->StartCalculating();
|
||||
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
BOOL WmTabCommand_SetPrecision2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
// there are another messages besides that one
|
||||
// which is sent when a user clicks on the radio button
|
||||
if( IsDlgButtonChecked(hWnd, IDC_RADIO_PRECISION_2) != BST_CHECKED )
|
||||
|
@ -498,12 +516,16 @@ BOOL WmTabCommand_SetPrecision2(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
|
|||
GetPrgRes()->SetPrecision(1);
|
||||
GetPrgRes()->GetThreadController()->StartCalculating();
|
||||
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
BOOL WmTabCommand_SetPrecision3(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
// there are another messages besides that one
|
||||
// which is sent when a user clicks on the radio button
|
||||
if( IsDlgButtonChecked(hWnd, IDC_RADIO_PRECISION_3) != BST_CHECKED )
|
||||
|
@ -513,6 +535,8 @@ BOOL WmTabCommand_SetPrecision3(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
|
|||
GetPrgRes()->SetPrecision(2);
|
||||
GetPrgRes()->GetThreadController()->StartCalculating();
|
||||
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -701,10 +725,14 @@ void CreateTabCommandMessagesTable(Messages & cmessages)
|
|||
cmessages.Associate(IDC_BUTTON_EDIT_FUNCTION, Functions::WmTabCommand_EditFunction);
|
||||
cmessages.Associate(IDC_BUTTON_DELETE_FUNCTION, Functions::WmTabCommand_DeleteFunction);
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
|
||||
cmessages.Associate(IDC_RADIO_PRECISION_1, WmTabCommand_SetPrecision1);
|
||||
cmessages.Associate(IDC_RADIO_PRECISION_2, WmTabCommand_SetPrecision2);
|
||||
cmessages.Associate(IDC_RADIO_PRECISION_3, WmTabCommand_SetPrecision3);
|
||||
|
||||
#endif
|
||||
|
||||
cmessages.Associate(IDC_COMBO_DISPLAY_INPUT, WmTabCommand_DisplayInputChanged);
|
||||
cmessages.Associate(IDC_COMBO_DISPLAY_OUTPUT, WmTabCommand_DisplayOutputChanged);
|
||||
cmessages.Associate(IDC_COMBO_DISPLAY_ROUNDING, WmTabCommand_DisplayRoundingChanged);
|
||||
|
@ -904,7 +932,9 @@ return true;
|
|||
|
||||
BOOL WmInitTabPrecision(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
#ifndef TTCALC_PORTABLE
|
||||
CheckDlgButton(hWnd, IDC_RADIO_PRECISION_1 + GetPrgRes()->GetPrecision(), BST_CHECKED);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1034,7 +1064,11 @@ void CreateTabMessagesTable(Messages & messages)
|
|||
messages.Associate(WM_COMMAND, WmTabCommand);
|
||||
messages.Associate(WM_INIT_TAB_VARIABLES, WmInitTabVariables);
|
||||
messages.Associate(WM_INIT_TAB_FUNCTIONS, WmInitTabFunctions);
|
||||
|
||||
#ifndef TTCALC_PORTABLE
|
||||
messages.Associate(WM_INIT_TAB_PRECISION, WmInitTabPrecision);
|
||||
#endif
|
||||
|
||||
messages.Associate(WM_INIT_TAB_DISPLAY, WmInitTabDisplay);
|
||||
messages.Associate(WM_NOTIFY, WmNotify);
|
||||
}
|
||||
|
|
|
@ -49,10 +49,6 @@
|
|||
#include "programresources.h"
|
||||
|
||||
|
||||
//#define WM_INIT_TAB_VARIABLES WM_USER+2
|
||||
//#define WM_INIT_TAB_FUNCTIONS WM_USER+3
|
||||
//#define WM_INIT_TAB_PRECISION WM_USER+4
|
||||
|
||||
#define WM_INIT_TAB_VARIABLES WM_APP
|
||||
#define WM_INIT_TAB_FUNCTIONS WM_APP+1
|
||||
#define WM_INIT_TAB_PRECISION WM_APP+2
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
/*!
|
||||
\file mainwin.cpp
|
||||
\brief There's defined the entry point to the application
|
||||
\brief There's defined the entry point to the application in this file
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
|
|
Loading…
Reference in New Issue