changed: variables and functions are copied to the second thread only

when they have been changed (performance)
         flags: variables_id and functions_id in ProgramResources
changed: you don't have to be an administrator to use the setup (installer)
         PrivilegesRequired=none in innosetup.iss
changed: small changes in Makefile(s) especially pathes
changed: upx 3.03 is used now (for the portable version)


git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@116 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2009-04-02 05:13:27 +00:00
parent 04fbbaceca
commit 6555140b9a
17 changed files with 141 additions and 46 deletions

View File

@ -1,7 +1,7 @@
[OPTIONS]
Auto Index=Yes
Compatibility=1.1 or later
Compiled file=..\..\output\ttcalc.chm
Compiled file=ttcalc.chm
Contents file=toc.hhc
Default topic=index.html
Display compile progress=No

View File

@ -4,6 +4,7 @@
[Setup]
AppName=TTCalc
AppVerName=TTCalc 0.8.3
AppVersion=0.8.3
AppPublisher=Tomasz Sowa
AppPublisherURL=http://ttcalc.sourceforge.net
AppSupportURL=http://ttcalc.sourceforge.net
@ -13,11 +14,12 @@ DefaultGroupName=TTCalc
AllowNoIcons=yes
; special COPYRIGHT version (without a new line characters in the clause -- it is better displayed in the setup window)
LicenseFile=COPYRIGHT
OutputDir=..\..\output
OutputDir=..\setup
OutputBaseFilename=ttcalc-setup
Compression=lzma
SolidCompression=yes
ShowUndisplayableLanguages=yes
PrivilegesRequired=none
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
@ -32,9 +34,11 @@ Type: files; Name: "{app}\mingwm10.dll"
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "..\..\output\ttcalc.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\..\output\ttcalc.chm"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\src\ttcalc.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\help\ttcalc.chm"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\COPYRIGHT"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\CHANGELOG"; DestDir: "{app}"; Flags: ignoreversion
Source: "..\README"; DestDir: "{app}"; Flags: ignoreversion
; now we do not use *.ini file in the installer
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

View File

@ -1,6 +1,6 @@
CC = g++
#CFLAGS = -Wall -pedantic -s -O2 -mwindows -I../../../ttmath -DTTCALC_CONVERT
CFLAGS = -Wall -pedantic -s -O2 -mwindows -I../../../ttmath
#CFLAGS = -Wall -pedantic -s -O2 -mwindows -I../../ttmath -DTTCALC_CONVERT
CFLAGS = -Wall -pedantic -s -O2 -mwindows -I../../ttmath
name = ttcalc.exe
# the name of the help is also set in the html help workshop project file
@ -8,37 +8,34 @@ helpname = ttcalc.chm
# the name of the setup is also set in the Inno Setup config file
setupname = ttcalc-setup.exe
dir_output = ../../output
all: ttcalc
include Makefile.dep
$(dir_output)/$(name): $(o)
$(CC) -o $(dir_output)/$(name) $(CFLAGS) $(o) -lcomctl32
ttcalc: $(dir_output)/$(name)
ttcalc: $(o)
$(CC) -o $(name) $(CFLAGS) $(o) -lcomctl32
resource.o: resource.rc
#windres -DTTCALC_CONVERT resource.rc resource.o
windres resource.rc resource.o
$(dir_output)/$(helpname): $(helpdep)
help: $(helpdep)
Makefile.help.sh
help: $(dir_output)/$(helpname)
$(dir_output)/$(setupname): $(setupdep)
setup: $(setupdep)
iscc ../setup/innosetup.iss
setup: $(dir_output)/$(setupname)
clean:
rm -f *.o
rm -f *.s
rm -f $(dir_output)/$(name)
rm -f $(dir_output)/$(helpname)
rm -f $(dir_output)/$(setupname)
rm -f $(name)
rm -f $(helpname)
rm -f $(setupname)

View File

@ -1,18 +1,15 @@
CC = g++
CFLAGS = -Wall -pedantic -s -Os -fno-default-inline -mwindows -I../../../ttmath -DTTCALC_PORTABLE
CFLAGS = -Wall -pedantic -s -Os -fno-default-inline -mwindows -I../../ttmath -DTTCALC_PORTABLE
name = ttcalcp.exe
dir_output = ../../output
compressor = upx
all: ttcalc
include Makefile.dep
$(dir_output)/$(name): $(o)
$(CC) -o $(dir_output)/$(name) $(CFLAGS) $(o) -lcomctl32
$(compressor) -7 $(dir_output)/$(name)
ttcalc: $(o)
$(CC) -o $(name) $(CFLAGS) $(o) -lcomctl32
$(compressor) -7 $(name)
ttcalc: $(dir_output)/$(name)
resource.o: resource.rc
windres -DTTCALC_PORTABLE resource.rc resource.o

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2008, Tomasz Sowa
* Copyright (c) 2006-2009, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2008, Tomasz Sowa
* Copyright (c) 2006-2009, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2008, Tomasz Sowa
* Copyright (c) 2006-2009, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2008, Tomasz Sowa
* Copyright (c) 2006-2009, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -223,6 +223,7 @@ BOOL WmTabCommand_AddFunction(HWND, UINT message, WPARAM wParam, LPARAM lParam)
GetPrgRes()->GetThreadController()->StopCalculating();
code = GetPrgRes()->GetFunctions()->Add(name, value, parameters);
GetPrgRes()->FunctionsChanged();
GetPrgRes()->GetThreadController()->StartCalculating();
if( code != ttmath::err_ok )
@ -290,6 +291,7 @@ adding = false;
// if we've changed the name then we're changing the value and parameters
code = GetPrgRes()->GetFunctions()->EditValue(name, value, parameters);
GetPrgRes()->FunctionsChanged();
GetPrgRes()->GetThreadController()->StartCalculating();
if( code != ttmath::err_ok )
@ -339,9 +341,12 @@ int items = ListView_GetSelectedCount(list);
all_deleted = false;
else
ListView_DeleteItem(list, id);
GetPrgRes()->FunctionsChanged();
}
}
GetPrgRes()->GetThreadController()->StartCalculating();
delete [] buffer;

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2008, Tomasz Sowa
* Copyright (c) 2006-2009, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -337,7 +337,7 @@ void Languages::InitGuiMessagesTab()
" a developer or a 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_text_exe_packer, "EXE Packer: UPX 3.03\r\n");
InsertGuiPair(about_box_title, "About");
InsertGuiPair(about_box_button_close, "Close");
InsertGuiPair(unknown_error, "An unknown error has occurred");
@ -462,7 +462,7 @@ void Languages::InitGuiMessagesTab()
" 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_text_exe_packer, "Paker exe: UPX 3.03\r\n");
InsertGuiPair(about_box_title, "O programie");
InsertGuiPair(about_box_button_close, "Zamknij");
InsertGuiPair(unknown_error, "Nieznany kod b³êdu");
@ -591,7 +591,7 @@ void Languages::InitGuiMessagesTab()
" desarrollador o programador, no dudes en contactar con el autor."
);
InsertGuiPair(about_text_portable_version, " version portatil");
InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.00\r\n");
InsertGuiPair(about_text_exe_packer, "EXE Packer: UPX 3.03\r\n");
InsertGuiPair(about_box_title, "Acerca de");
InsertGuiPair(about_box_button_close, "Cerrar");
InsertGuiPair(unknown_error, "Ocurrio un error desconocido");

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2008, Tomasz Sowa
* Copyright (c) 2006-2009, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2008, Tomasz Sowa
* Copyright (c) 2006-2009, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -50,6 +50,8 @@ ParserManager::ParserManager() : buffer_len(2048)
when_scientific = 15;
rounding = -1;
remove_zeroes = true;
last_variables_id = 0;
last_functions_id = 0;
}
@ -62,6 +64,8 @@ ParserManager::ParserManager(const ParserManager & p) : buffer_len(p.buffer_len)
when_scientific = p.when_scientific;
rounding = p.rounding;
remove_zeroes = p.remove_zeroes;
last_variables_id = p.last_variables_id;
last_functions_id = p.last_functions_id;
}
@ -142,8 +146,17 @@ unsigned int i;
//
variables = *GetPrgRes()->GetVariables();
functions = *GetPrgRes()->GetFunctions();
if( GetPrgRes()->GetVariablesId() != last_variables_id )
{
variables = *GetPrgRes()->GetVariables();
last_variables_id = GetPrgRes()->GetVariablesId();
}
if( GetPrgRes()->GetFunctionsId() != last_functions_id )
{
functions = *GetPrgRes()->GetFunctions();
last_functions_id = GetPrgRes()->GetFunctionsId();
}
//
base_input = GetPrgRes()->GetBaseInput();

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2008, Tomasz Sowa
* Copyright (c) 2006-2009, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -121,6 +121,8 @@ private:
#endif
ttmath::Objects variables, functions;
int last_variables_id;
int last_functions_id;
const unsigned int buffer_len;
char * buffer;

View File

@ -319,6 +319,31 @@ ttmath::Objects * ProgramResources::GetFunctions()
return &functions;
}
void ProgramResources::VariablesChanged()
{
++variables_id;
}
void ProgramResources::FunctionsChanged()
{
++functions_id;
}
int ProgramResources::GetVariablesId()
{
return variables_id;
}
int ProgramResources::GetFunctionsId()
{
return functions_id;
}
Languages * ProgramResources::GetLanguages()
{
return &languages;
@ -453,6 +478,9 @@ ProgramResources::ProgramResources()
decimal_point = 0;
angle_deg_rad_grad = 1; // rad is default
variables_id = 0;
functions_id = 0;
}
@ -647,17 +675,26 @@ IniParser::Section::iterator ic;
// we're adding variables
if( !if_not_exist )
{
variables.Clear();
VariablesChanged();
}
for( ic = temp_variables.begin() ; ic!=temp_variables.end() ; ++ic )
if( !if_not_exist || !variables.IsDefined(ic->first) )
{
variables.Add(ic->first, ic->second);
VariablesChanged();
}
// we're adding functions
if( !if_not_exist )
{
functions.Clear();
FunctionsChanged();
}
for( ic = temp_functions.begin() ; ic!=temp_functions.end() ; ++ic )
{
@ -666,7 +703,10 @@ IniParser::Section::iterator ic;
if( !if_not_exist || !functions.IsDefined(ic->first) )
if( SplitFunction(ic->second, &name, &param) )
{
functions.Add(ic->first, name, param);
FunctionsChanged();
}
}
}
@ -675,7 +715,6 @@ IniParser::Error ProgramResources::ReadVariablesFunctionsFromFile()
{
IniParser iparser;
IniParser::Section temp_variables, temp_functions;
std::string ini_value[20];
iparser.ConvertValueToSmallLetters(false);
iparser.SectionCaseSensitive(false);

View File

@ -218,6 +218,36 @@ public:
volatile ThreadController * GetThreadController();
/*!
if you change some variables by using GetVariable() method
you should call this method in order to inform the second thread that variables have changed
(variables_id will be increment)
*/
void VariablesChanged();
/*!
if you change some functions by using GetFunction() method
you should call this method in order to inform the second thread that functions have changed
(functions_id will be increment)
*/
void FunctionsChanged();
/*!
returning the state of variables_id
(used by the second thread)
*/
int GetVariablesId();
/*!
returning the state of functions_id
(used by the second thread)
*/
int GetFunctionsId();
/*!
pointers to variables' table, functions' table, the languages' object, convert object
and to the characters' buffer
@ -321,6 +351,9 @@ private:
Convert convert;
volatile ThreadController thread_controller;
int variables_id;
int functions_id;
unsigned int buffer_size;
char * buffer;

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2008, Tomasz Sowa
* Copyright (c) 2006-2009, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2008, Tomasz Sowa
* Copyright (c) 2006-2009, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2006-2008, Tomasz Sowa
* Copyright (c) 2006-2009, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -254,6 +254,7 @@ BOOL WmTabCommand_AddVariable(HWND, UINT message, WPARAM wParam, LPARAM lParam)
GetPrgRes()->GetThreadController()->StopCalculating();
code = GetPrgRes()->GetVariables()->Add(name, value);
GetPrgRes()->VariablesChanged();
GetPrgRes()->GetThreadController()->StartCalculating();
if( code != ttmath::err_ok )
@ -317,6 +318,7 @@ adding = false;
code = GetPrgRes()->GetVariables()->EditValue(name, value);
// the code should be err_ok here
GetPrgRes()->VariablesChanged();
GetPrgRes()->GetThreadController()->StartCalculating();
if( code != ttmath::err_ok )
@ -366,8 +368,11 @@ int items = ListView_GetSelectedCount(list);
all_deleted = false;
else
ListView_DeleteItem(list, id);
GetPrgRes()->VariablesChanged();
}
}
GetPrgRes()->GetThreadController()->StartCalculating();