2007-02-08 18:54:37 +01:00
|
|
|
/*
|
|
|
|
* This file is a part of TTCalc - a mathematical calculator
|
|
|
|
* and is distributed under the (new) BSD licence.
|
|
|
|
* Author: Tomasz Sowa <t.sowa@slimaczek.pl>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2009-04-01 04:31:38 +02:00
|
|
|
* Copyright (c) 2006-2009, Tomasz Sowa
|
2007-02-08 18:54:37 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* * Neither the name Tomasz Sowa nor the names of contributors to this
|
|
|
|
* project may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
|
|
* THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
#include "compileconfig.h"
|
|
|
|
#include "programresources.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace ProgramResourcesGlobal
|
|
|
|
{
|
|
|
|
ProgramResources program_resource;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ProgramResources * GetPrgRes()
|
|
|
|
{
|
|
|
|
return &ProgramResourcesGlobal::program_resource;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ProgramResources::SetXPos(int x)
|
|
|
|
{
|
|
|
|
x_pos = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ProgramResources::SetYPos(int y)
|
|
|
|
{
|
|
|
|
y_pos = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ProgramResources::GetXPos()
|
|
|
|
{
|
|
|
|
return x_pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ProgramResources::GetYPos()
|
|
|
|
{
|
|
|
|
return y_pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ProgramResources::SetXSize(int x)
|
|
|
|
{
|
|
|
|
x_size = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgramResources::SetYSize(int y)
|
|
|
|
{
|
|
|
|
y_size = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ProgramResources::GetXSize()
|
|
|
|
{
|
|
|
|
return x_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ProgramResources::GetYSize()
|
|
|
|
{
|
|
|
|
return y_size;
|
|
|
|
}
|
|
|
|
|
2009-10-16 04:12:10 +02:00
|
|
|
|
|
|
|
void ProgramResources::SetPadXPos(int x)
|
|
|
|
{
|
|
|
|
pad_x_pos = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgramResources::SetPadYPos(int y)
|
|
|
|
{
|
|
|
|
pad_y_pos = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ProgramResources::GetPadXPos()
|
|
|
|
{
|
|
|
|
return pad_x_pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ProgramResources::GetPadYPos()
|
|
|
|
{
|
|
|
|
return pad_y_pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgramResources::SetPadXSize(int x)
|
|
|
|
{
|
|
|
|
pad_x_size = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgramResources::SetPadYSize(int y)
|
|
|
|
{
|
|
|
|
pad_y_size = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ProgramResources::GetPadXSize()
|
|
|
|
{
|
|
|
|
return pad_x_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ProgramResources::GetPadYSize()
|
|
|
|
{
|
|
|
|
return pad_y_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
void ProgramResources::SetYSizeNormal(int y)
|
|
|
|
{
|
|
|
|
y_size_normal = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ProgramResources::GetYSizeNormal()
|
|
|
|
{
|
|
|
|
return y_size_normal;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgramResources::SetYSizeCompact(int y)
|
|
|
|
{
|
|
|
|
y_size_compact = y;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ProgramResources::GetYSizeCompact()
|
|
|
|
{
|
|
|
|
return y_size_compact;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgramResources::SetXSizeMin(int x)
|
|
|
|
{
|
|
|
|
x_size_min = x;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ProgramResources::GetXSizeMin()
|
|
|
|
{
|
|
|
|
return x_size_min;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ProgramResources::SetView(ProgramResources::View v)
|
|
|
|
{
|
|
|
|
view = v;
|
|
|
|
|
|
|
|
if( v == view_normal)
|
2007-02-08 18:54:37 +01:00
|
|
|
MoveWindow(main_window, x_pos, y_pos, x_size, y_size, true);
|
2007-01-22 12:12:01 +01:00
|
|
|
else
|
2007-02-08 18:54:37 +01:00
|
|
|
MoveWindow(main_window, x_pos, y_pos, x_size, y_size_compact, true);
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ProgramResources::View ProgramResources::GetView()
|
|
|
|
{
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ProgramResources::SetMaximized(bool max)
|
|
|
|
{
|
|
|
|
maximized = max;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ProgramResources::GetMaximized()
|
|
|
|
{
|
|
|
|
return maximized;
|
|
|
|
}
|
|
|
|
|
2009-10-16 04:12:10 +02:00
|
|
|
void ProgramResources::SetPadMaximized(bool max)
|
|
|
|
{
|
|
|
|
pad_maximized = max;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ProgramResources::GetPadMaximized()
|
|
|
|
{
|
|
|
|
return pad_maximized;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ProgramResources::ShowPad(bool show)
|
|
|
|
{
|
|
|
|
show_pad = show;
|
|
|
|
|
|
|
|
if( show_pad )
|
|
|
|
{
|
|
|
|
if( pad_maximized )
|
|
|
|
ShowWindow(pad_window, SW_SHOWMAXIMIZED);
|
|
|
|
else
|
|
|
|
ShowWindow(pad_window, SW_SHOWNORMAL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ShowWindow(pad_window, SW_HIDE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ProgramResources::IsPadVisible()
|
|
|
|
{
|
|
|
|
return show_pad;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
void ProgramResources::SetAlwaysOnTop(bool always)
|
|
|
|
{
|
|
|
|
always_on_top = always;
|
|
|
|
|
|
|
|
if( always )
|
|
|
|
SetWindowPos(main_window, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
|
|
|
else
|
|
|
|
SetWindowPos(main_window, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ProgramResources::GetAlwaysOnTop()
|
|
|
|
{
|
|
|
|
return always_on_top;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ProgramResources::SetDisplayRounding(int r)
|
|
|
|
{
|
2008-04-12 10:52:21 +02:00
|
|
|
if( r < -1 )
|
|
|
|
r = -1;
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2008-04-12 10:52:21 +02:00
|
|
|
if( r > 99 )
|
2007-01-22 12:12:01 +01:00
|
|
|
r = 99;
|
|
|
|
|
|
|
|
display_rounding = r;
|
|
|
|
}
|
|
|
|
|
2008-04-12 10:52:21 +02:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
int ProgramResources::GetDisplayRounding()
|
|
|
|
{
|
|
|
|
return display_rounding;
|
|
|
|
}
|
|
|
|
|
2008-04-12 10:52:21 +02:00
|
|
|
|
|
|
|
void ProgramResources::SetRemovingZeroes(bool r)
|
|
|
|
{
|
|
|
|
remove_zeroes = r;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ProgramResources::GetRemovingZeroes()
|
|
|
|
{
|
|
|
|
return remove_zeroes;
|
|
|
|
}
|
|
|
|
|
2009-03-28 19:26:20 +01:00
|
|
|
|
|
|
|
void ProgramResources::SetDegRadGrad(int angle)
|
|
|
|
{
|
|
|
|
if( angle < 0 || angle > 2 )
|
|
|
|
angle = 1;
|
|
|
|
|
|
|
|
angle_deg_rad_grad = angle;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int ProgramResources::GetDegRadGrad()
|
|
|
|
{
|
|
|
|
return angle_deg_rad_grad;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
void ProgramResources::SetDisplayAlwaysScientific(bool a)
|
|
|
|
{
|
|
|
|
display_always_scientific = a;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ProgramResources::GetDisplayAlwaysScientific()
|
|
|
|
{
|
|
|
|
return display_always_scientific;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgramResources::SetDisplayWhenScientific(int w)
|
|
|
|
{
|
|
|
|
if(w<1)
|
|
|
|
w = 1;
|
|
|
|
|
|
|
|
if( w > 99 )
|
|
|
|
w = 99;
|
|
|
|
|
|
|
|
display_when_scientific = w;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ProgramResources::GetDisplayWhenScientific()
|
|
|
|
{
|
|
|
|
return display_when_scientific;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ProgramResources::SetBaseInput(int i)
|
|
|
|
{
|
|
|
|
if(i<2)
|
|
|
|
i = 2;
|
|
|
|
|
|
|
|
if(i>16)
|
|
|
|
i = 16;
|
|
|
|
|
|
|
|
base_input = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ProgramResources::GetBaseInput()
|
|
|
|
{
|
|
|
|
return base_input;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ProgramResources::SetBaseOutput(int i)
|
|
|
|
{
|
|
|
|
if(i<2)
|
|
|
|
i = 2;
|
|
|
|
|
|
|
|
if(i>16)
|
|
|
|
i = 16;
|
|
|
|
|
|
|
|
base_output = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ProgramResources::GetBaseOutput()
|
|
|
|
{
|
|
|
|
return base_output;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-09 21:05:15 +01:00
|
|
|
void ProgramResources::SetDecimalPoint(int decimal)
|
|
|
|
{
|
|
|
|
decimal_point = decimal;
|
|
|
|
|
|
|
|
if( decimal_point<0 || decimal_point>1 )
|
|
|
|
decimal_point = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ProgramResources::GetDecimalPoint()
|
|
|
|
{
|
|
|
|
return decimal_point;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
ttmath::Objects * ProgramResources::GetVariables()
|
|
|
|
{
|
|
|
|
return &variables;
|
|
|
|
}
|
|
|
|
|
|
|
|
ttmath::Objects * ProgramResources::GetFunctions()
|
|
|
|
{
|
|
|
|
return &functions;
|
|
|
|
}
|
|
|
|
|
2009-04-02 07:13:27 +02:00
|
|
|
|
|
|
|
void ProgramResources::VariablesChanged()
|
|
|
|
{
|
|
|
|
++variables_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ProgramResources::FunctionsChanged()
|
|
|
|
{
|
|
|
|
++functions_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ProgramResources::GetVariablesId()
|
|
|
|
{
|
|
|
|
return variables_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ProgramResources::GetFunctionsId()
|
|
|
|
{
|
|
|
|
return functions_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
Languages * ProgramResources::GetLanguages()
|
|
|
|
{
|
|
|
|
return &languages;
|
|
|
|
}
|
|
|
|
|
2008-10-13 06:17:57 +02:00
|
|
|
|
|
|
|
Convert * ProgramResources::GetConvert()
|
|
|
|
{
|
|
|
|
return &convert;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
void ProgramResources::SetInstance(HINSTANCE h)
|
|
|
|
{
|
|
|
|
hInstance = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
HINSTANCE ProgramResources::GetInstance()
|
|
|
|
{
|
|
|
|
return hInstance;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgramResources::SetMainWindow(HWND h)
|
|
|
|
{
|
|
|
|
main_window = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
HWND ProgramResources::GetMainWindow()
|
|
|
|
{
|
|
|
|
return main_window;
|
|
|
|
}
|
|
|
|
|
2009-10-14 00:41:00 +02:00
|
|
|
void ProgramResources::SetPadWindow(HWND h)
|
|
|
|
{
|
|
|
|
pad_window = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
HWND ProgramResources::GetPadWindow()
|
|
|
|
{
|
|
|
|
return pad_window;
|
|
|
|
}
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
void ProgramResources::SetTabWindow(unsigned int id, HWND h)
|
|
|
|
{
|
|
|
|
if( id >= sizeof(tab_window) / sizeof(HWND) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
tab_window[id] = h;
|
|
|
|
}
|
|
|
|
|
|
|
|
HWND ProgramResources::GetTabWindow(unsigned int id)
|
|
|
|
{
|
|
|
|
if( id >= sizeof(tab_window) / sizeof(HWND) )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return tab_window[id];
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int ProgramResources::HowManyTabWindows()
|
|
|
|
{
|
|
|
|
return sizeof(tab_window) / sizeof(HWND);
|
|
|
|
}
|
|
|
|
|
|
|
|
char * ProgramResources::GetBuffer()
|
|
|
|
{
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int ProgramResources::GetBufferSize()
|
|
|
|
{
|
|
|
|
return buffer_size;
|
|
|
|
}
|
|
|
|
|
|
|
|
volatile ThreadController * ProgramResources::GetThreadController()
|
|
|
|
{
|
|
|
|
return &thread_controller;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProgramResources::SetPrecision(int p)
|
|
|
|
{
|
|
|
|
if( p < 0 )
|
|
|
|
p = 0;
|
|
|
|
|
|
|
|
if( p > 2 )
|
|
|
|
p = 2;
|
|
|
|
|
|
|
|
precision = p;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ProgramResources::GetPrecision()
|
|
|
|
{
|
|
|
|
return precision;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ProgramResources::ProgramResources()
|
|
|
|
{
|
2007-02-08 18:54:37 +01:00
|
|
|
// if you want to change the input buffer you have also to change
|
|
|
|
// ParserManager::ParserManager() : buffer_len(2048) in parsermanager.cpp
|
|
|
|
buffer_size = 2048;
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
buffer = new char[buffer_size];
|
|
|
|
buffer[0] = 0;
|
|
|
|
|
|
|
|
|
|
|
|
always_on_top = false;
|
|
|
|
view = view_normal;
|
|
|
|
|
|
|
|
maximized = false;
|
|
|
|
|
|
|
|
precision = 0;
|
|
|
|
|
|
|
|
hInstance = 0;
|
|
|
|
main_window = 0;
|
|
|
|
|
|
|
|
base_input = 10;
|
|
|
|
base_output = 10;
|
|
|
|
|
|
|
|
display_always_scientific = false;
|
2009-04-02 12:26:55 +02:00
|
|
|
display_when_scientific = 8;
|
2008-04-12 10:52:21 +02:00
|
|
|
display_rounding = -1;
|
|
|
|
remove_zeroes = true;
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
for(int i=HowManyTabWindows()-1 ; i!=-1 ; --i)
|
|
|
|
tab_window[i] = 0;
|
|
|
|
|
|
|
|
x_pos = 0;
|
|
|
|
y_pos = 0;
|
|
|
|
x_size = 100;
|
|
|
|
y_size = 100;
|
|
|
|
|
2009-10-16 04:12:10 +02:00
|
|
|
pad_x_pos = 30;
|
|
|
|
pad_y_pos = 30;
|
|
|
|
pad_x_size = 600;
|
|
|
|
pad_y_size = 500;
|
|
|
|
pad_maximized = false;
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
y_size_normal = 0;
|
|
|
|
y_size_compact = 0;
|
|
|
|
x_size_min = 0;
|
2008-10-13 06:17:57 +02:00
|
|
|
|
2009-03-28 19:26:20 +01:00
|
|
|
// !!! put into Convert constructor
|
|
|
|
#ifdef TTCALC_CONVERT
|
2008-10-13 06:17:57 +02:00
|
|
|
convert.Init();
|
2009-03-28 19:26:20 +01:00
|
|
|
#endif
|
2007-08-22 23:16:19 +02:00
|
|
|
|
2007-12-09 21:05:15 +01:00
|
|
|
|
|
|
|
decimal_point = 0;
|
2009-03-28 19:26:20 +01:00
|
|
|
angle_deg_rad_grad = 1; // rad is default
|
2009-04-02 07:13:27 +02:00
|
|
|
|
|
|
|
variables_id = 0;
|
|
|
|
functions_id = 0;
|
2009-10-14 00:41:00 +02:00
|
|
|
|
|
|
|
show_pad = false;
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ProgramResources::~ProgramResources()
|
|
|
|
{
|
|
|
|
delete [] buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool ProgramResources::IsWhiteCharacter(int c)
|
|
|
|
{
|
|
|
|
if( c==' ' || c=='\t' || c==13 || c=='\n' )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char * ProgramResources::SkipWhiteCharacters(const char * string)
|
|
|
|
{
|
|
|
|
while( IsWhiteCharacter(*string) )
|
|
|
|
++string;
|
|
|
|
|
|
|
|
return string;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ProgramResources::IsDecDigit(int c)
|
|
|
|
{
|
|
|
|
if( c>='0' && c<='9' )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ProgramResources::SplitFunction(const std::string & input, const char * * name, int * param)
|
|
|
|
{
|
|
|
|
const char * pchar = input.c_str();
|
|
|
|
const int buffer_len = 20;
|
|
|
|
char buffer[buffer_len];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
pchar = SkipWhiteCharacters(pchar);
|
|
|
|
|
|
|
|
for(i=0 ; i<buffer_len-1 && IsDecDigit(*pchar) ; ++i, ++pchar)
|
|
|
|
buffer[i] = *pchar;
|
|
|
|
|
|
|
|
buffer[i] = 0;
|
|
|
|
|
|
|
|
*param = atoi(buffer);
|
|
|
|
if(*param < 0)
|
|
|
|
*param = 0;
|
|
|
|
else
|
|
|
|
if(*param > 9)
|
|
|
|
*param = 9;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
while( IsDecDigit(*pchar) );
|
|
|
|
|
|
|
|
pchar = SkipWhiteCharacters(pchar);
|
|
|
|
if( *pchar != '|' )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
pchar = SkipWhiteCharacters(pchar+1);
|
|
|
|
|
|
|
|
*name = pchar;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ProgramResources::ReadTextValueFromRegistry(HKEY main_key, const char * sub_key, const char * value, std::string & result)
|
|
|
|
{
|
|
|
|
HKEY reg_key;
|
|
|
|
|
|
|
|
if( RegOpenKeyEx( main_key, sub_key, 0, KEY_QUERY_VALUE, ®_key ) != ERROR_SUCCESS )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
bool status = false;
|
|
|
|
DWORD result_type;
|
|
|
|
char result_buffer[300];
|
|
|
|
DWORD buffer_size = sizeof(result_buffer) / sizeof(char);
|
|
|
|
|
|
|
|
if( RegQueryValueEx( reg_key, value, 0, &result_type, reinterpret_cast<BYTE*>(result_buffer), &buffer_size ) == ERROR_SUCCESS )
|
|
|
|
{
|
|
|
|
if( result_type == REG_SZ )
|
|
|
|
{
|
|
|
|
result = result_buffer;
|
|
|
|
status = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(reg_key);
|
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ProgramResources::SetNameOfConfigurationFile()
|
|
|
|
{
|
2007-06-24 22:11:14 +02:00
|
|
|
static const char simple_file_name[] = "ttcalc.ini";
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
// if there'll be an error we assume that the current directory will be used
|
2007-06-24 22:11:14 +02:00
|
|
|
// (in the portable version the configuration file is in a current directory)
|
2007-01-22 12:12:01 +01:00
|
|
|
configuration_file = std::string(".\\") + simple_file_name;
|
|
|
|
|
2007-06-24 22:11:14 +02:00
|
|
|
#ifndef TTCALC_PORTABLE
|
|
|
|
|
|
|
|
static const char simple_directory_name[] = "TTCalc";
|
|
|
|
std::string application_data;
|
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
// we're trying to read the value "AppData" from registry
|
|
|
|
// which can be, for instance, as:
|
changed: on win9x the configuration file is in
"c:\windows\data application\ttcalc\" now
changed: the program uses the TTMath 0.8.1 now
added: from TTMath 0.8.1:
root(x, index), bitand(x,y), bitor(x,y), bitxor(x,y)
/band(x,y), bor(x,y), bxor(x,y)/
asinh(x), acosh(x), atanh(x), acoth(x) /atgh(x), actgh(x)/
changed: from TTMath 0.8.1: calculations are much faster now
especially the factorial() function
changed: from TTMath 0.8.1: the way of parsing operators
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@37 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-04-17 15:41:38 +02:00
|
|
|
// "C:\Documents and Settings\user\data application" on WinNT
|
|
|
|
// or "C:\Windows\Data Application\" on Win9x
|
2007-01-22 12:12:01 +01:00
|
|
|
if( ReadTextValueFromRegistry(
|
|
|
|
HKEY_CURRENT_USER,
|
|
|
|
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",
|
|
|
|
"AppData",
|
|
|
|
application_data) )
|
|
|
|
{
|
|
|
|
std::string application_directory = application_data + '\\' + simple_directory_name;
|
|
|
|
bool success = false;
|
|
|
|
|
added: a user can change the names of variables or functions now
changed: the program uses TTMath 0.8.0 now
added: functions: from TTMath 0.8.0:
DegToDeg(deg, min, sec), DegToRad(deg), DegToRad(deg, min, sec),
RadToDeg(rad), Ceil(x), Floor(x), Sqrt(x), Sinh(x), Cosh(x),
Tanh(x) /Tgh(x)/, Coth(x) /Ctgh(x)/
added: a help
changed: from TTMath 0.8.0:
renamed: CTan() into Cot() or Ctg()
renamed: ACTan() into ACot() or ACtg()
Factorial() has a history log now (it can remember last
10 calculated values)
added: a directory 'help' with files of the help
added: a directory 'setup' with files needed to make an installer
(we're using InnoSetup Compiler to make it)
fixed: the vertical size of the main window when a user uses a different size
of the window caption (especially under the Windows XP Luna)
fixed: on Windows 9x: the program hung when a user clicks on a control
on the first tab (the procedure SetNextFocus(...) has been completely
rewritten and the flag WS_EX_CONTROLPARENT on the tab dialogs has
gone away)
fixed: when started navigating from the keyboard the program showed a wrong
variable or a funtion in the edit dialog
git-svn-id: svn://ttmath.org/publicrep/ttcalc/trunk@28 e52654a7-88a9-db11-a3e9-0013d4bc506e
2007-04-02 02:17:26 +02:00
|
|
|
// we have to remember the currect directory
|
|
|
|
// (because we're using it when we're opening the help)
|
|
|
|
char * buffer = new char[_MAX_PATH];
|
|
|
|
|
|
|
|
if( GetCurrentDirectory(_MAX_PATH, buffer) )
|
|
|
|
{
|
|
|
|
// we're testing whether we've got our directory or not
|
|
|
|
if( SetCurrentDirectory( application_directory.c_str() ) )
|
|
|
|
success = true;
|
|
|
|
else
|
|
|
|
// now we must create our directory inside it
|
|
|
|
if( CreateDirectory(application_directory.c_str(), 0) )
|
|
|
|
success = true;
|
|
|
|
|
|
|
|
if( success )
|
|
|
|
configuration_file = application_directory + '\\' + simple_file_name;
|
|
|
|
|
|
|
|
SetCurrentDirectory(buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
delete [] buffer;
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
2007-06-24 22:11:14 +02:00
|
|
|
|
|
|
|
#endif
|
2007-01-22 12:12:01 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-08 20:15:55 +01:00
|
|
|
void ProgramResources::CheckCoordinates()
|
|
|
|
{
|
|
|
|
if( x_pos < -50 )
|
|
|
|
x_pos = 0;
|
|
|
|
|
|
|
|
if( y_pos < -50 )
|
|
|
|
y_pos = 0;
|
|
|
|
|
|
|
|
if( x_size < 100 )
|
|
|
|
x_size = 100;
|
|
|
|
|
|
|
|
if( y_size < 30 )
|
|
|
|
y_size = 30;
|
|
|
|
|
|
|
|
int cx = GetSystemMetrics(SM_CXSCREEN);
|
|
|
|
int cy = GetSystemMetrics(SM_CYSCREEN);
|
|
|
|
|
|
|
|
if( x_size > cx+10 )
|
|
|
|
x_size = cx;
|
|
|
|
|
|
|
|
if( y_size > cy+10 )
|
|
|
|
y_size = cy;
|
|
|
|
|
|
|
|
if( x_pos > cx-50 )
|
|
|
|
x_pos = cx - x_size;
|
|
|
|
|
|
|
|
if( y_pos > cy-50 )
|
|
|
|
y_pos = cy - y_size;
|
|
|
|
}
|
|
|
|
|
2009-10-16 04:12:10 +02:00
|
|
|
void ProgramResources::CheckPadCoordinates()
|
|
|
|
{
|
|
|
|
if( pad_x_pos < -50 )
|
|
|
|
pad_x_pos = 0;
|
|
|
|
|
|
|
|
if( pad_y_pos < -50 )
|
|
|
|
pad_y_pos = 0;
|
|
|
|
|
|
|
|
if( pad_x_size < 30 )
|
|
|
|
pad_x_size = 600;
|
|
|
|
|
|
|
|
if( pad_y_size < 30 )
|
|
|
|
pad_y_size = 500;
|
|
|
|
|
|
|
|
int cx = GetSystemMetrics(SM_CXSCREEN);
|
|
|
|
int cy = GetSystemMetrics(SM_CYSCREEN);
|
|
|
|
|
|
|
|
if( pad_x_size > cx+10 )
|
|
|
|
pad_x_size = cx;
|
|
|
|
|
|
|
|
if( pad_y_size > cy+10 )
|
|
|
|
pad_y_size = cy;
|
|
|
|
|
|
|
|
if( pad_x_pos > cx-50 )
|
|
|
|
pad_x_pos = cx - pad_x_size;
|
|
|
|
|
|
|
|
if( pad_y_pos > cy-50 )
|
|
|
|
pad_y_pos = cy - pad_y_size;
|
|
|
|
}
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2007-08-22 23:16:19 +02:00
|
|
|
|
2009-04-01 04:31:38 +02:00
|
|
|
void ProgramResources::AddVariablesFunctions( IniParser::Section & temp_variables,
|
|
|
|
IniParser::Section & temp_functions,
|
|
|
|
bool if_not_exist)
|
|
|
|
{
|
|
|
|
IniParser::Section::iterator ic;
|
|
|
|
|
|
|
|
// we're adding variables
|
|
|
|
|
|
|
|
if( !if_not_exist )
|
2009-04-02 07:13:27 +02:00
|
|
|
{
|
2009-04-01 04:31:38 +02:00
|
|
|
variables.Clear();
|
2009-04-02 07:13:27 +02:00
|
|
|
VariablesChanged();
|
|
|
|
}
|
2009-04-01 04:31:38 +02:00
|
|
|
|
|
|
|
for( ic = temp_variables.begin() ; ic!=temp_variables.end() ; ++ic )
|
|
|
|
if( !if_not_exist || !variables.IsDefined(ic->first) )
|
2009-04-02 07:13:27 +02:00
|
|
|
{
|
2009-04-01 04:31:38 +02:00
|
|
|
variables.Add(ic->first, ic->second);
|
2009-04-02 07:13:27 +02:00
|
|
|
VariablesChanged();
|
|
|
|
}
|
2009-04-01 04:31:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
// we're adding functions
|
|
|
|
|
|
|
|
if( !if_not_exist )
|
2009-04-02 07:13:27 +02:00
|
|
|
{
|
2009-04-01 04:31:38 +02:00
|
|
|
functions.Clear();
|
2009-04-02 07:13:27 +02:00
|
|
|
FunctionsChanged();
|
|
|
|
}
|
2009-04-01 04:31:38 +02:00
|
|
|
|
|
|
|
for( ic = temp_functions.begin() ; ic!=temp_functions.end() ; ++ic )
|
|
|
|
{
|
|
|
|
const char * name;
|
|
|
|
int param;
|
|
|
|
|
|
|
|
if( !if_not_exist || !functions.IsDefined(ic->first) )
|
|
|
|
if( SplitFunction(ic->second, &name, ¶m) )
|
2009-04-02 07:13:27 +02:00
|
|
|
{
|
2009-04-01 04:31:38 +02:00
|
|
|
functions.Add(ic->first, name, param);
|
2009-04-02 07:13:27 +02:00
|
|
|
FunctionsChanged();
|
|
|
|
}
|
2009-04-01 04:31:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IniParser::Error ProgramResources::ReadVariablesFunctionsFromFile()
|
|
|
|
{
|
|
|
|
IniParser iparser;
|
|
|
|
IniParser::Section temp_variables, temp_functions;
|
|
|
|
|
|
|
|
iparser.ConvertValueToSmallLetters(false);
|
|
|
|
iparser.SectionCaseSensitive(false);
|
|
|
|
|
|
|
|
// we have variables and functions case-sensitive
|
|
|
|
iparser.PatternCaseSensitive(true);
|
|
|
|
|
|
|
|
iparser.Associate( "variables", &temp_variables );
|
|
|
|
iparser.Associate( "functions", &temp_functions );
|
|
|
|
|
|
|
|
bad_line = -1;
|
|
|
|
IniParser::Error err = iparser.ReadFromFile( configuration_file.c_str() );
|
|
|
|
|
|
|
|
if( err == IniParser::err_cant_open_file )
|
|
|
|
return err;
|
|
|
|
|
|
|
|
AddVariablesFunctions(temp_variables, temp_functions, true);
|
|
|
|
|
|
|
|
if( err != IniParser::err_ok )
|
|
|
|
bad_line = iparser.GetBadLine();
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2007-08-22 23:16:19 +02:00
|
|
|
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
IniParser::Error ProgramResources::ReadFromFile()
|
|
|
|
{
|
|
|
|
IniParser iparser;
|
|
|
|
IniParser::Section temp_variables, temp_functions;
|
|
|
|
IniParser::Section::iterator ic;
|
2009-10-16 04:12:10 +02:00
|
|
|
std::string ini_value[30];
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2008-01-24 00:51:53 +01:00
|
|
|
iparser.ConvertValueToSmallLetters(false);
|
|
|
|
iparser.SectionCaseSensitive(false);
|
|
|
|
|
|
|
|
// we have variables and functions case-sensitive
|
|
|
|
iparser.PatternCaseSensitive(true);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
iparser.Associate( "global|always.on.top", &ini_value[0] );
|
|
|
|
iparser.Associate( "global|view", &ini_value[1] );
|
|
|
|
iparser.Associate( "global|maximized", &ini_value[2] );
|
|
|
|
iparser.Associate( "global|x", &ini_value[3] );
|
|
|
|
iparser.Associate( "global|y", &ini_value[4] );
|
|
|
|
iparser.Associate( "global|size.x", &ini_value[5] );
|
|
|
|
iparser.Associate( "global|precision", &ini_value[6] );
|
|
|
|
iparser.Associate( "global|disp.input", &ini_value[7] );
|
|
|
|
iparser.Associate( "global|disp.output", &ini_value[8] );
|
|
|
|
iparser.Associate( "global|disp.alw.scientific", &ini_value[9] );
|
|
|
|
iparser.Associate( "global|disp.when.scientific", &ini_value[10] );
|
|
|
|
iparser.Associate( "global|disp.rounding", &ini_value[11] );
|
2007-02-08 18:54:37 +01:00
|
|
|
iparser.Associate( "global|size.y", &ini_value[12] );
|
2007-02-28 18:52:09 +01:00
|
|
|
iparser.Associate( "global|language", &ini_value[13] );
|
2007-12-09 21:05:15 +01:00
|
|
|
iparser.Associate( "global|disp.dec.point", &ini_value[14] );
|
2008-04-12 10:52:21 +02:00
|
|
|
iparser.Associate( "global|disp.remove.zeroes", &ini_value[15] );
|
2009-03-28 19:26:20 +01:00
|
|
|
iparser.Associate( "global|disp.deg_rad_grad", &ini_value[16] );
|
2009-10-16 04:12:10 +02:00
|
|
|
iparser.Associate( "global|pad.x", &ini_value[17] );
|
|
|
|
iparser.Associate( "global|pad.y", &ini_value[18] );
|
|
|
|
iparser.Associate( "global|pad.size.x", &ini_value[19] );
|
|
|
|
iparser.Associate( "global|pad.size.y", &ini_value[20] );
|
|
|
|
iparser.Associate( "global|pad.maximized", &ini_value[21] );
|
|
|
|
iparser.Associate( "global|pad", &ini_value[22] );
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
iparser.Associate( "variables", &temp_variables );
|
|
|
|
iparser.Associate( "functions", &temp_functions );
|
|
|
|
|
|
|
|
bad_line = -1;
|
|
|
|
IniParser::Error err = iparser.ReadFromFile( configuration_file.c_str() );
|
|
|
|
|
|
|
|
if( err == IniParser::err_cant_open_file )
|
|
|
|
return err;
|
|
|
|
|
2009-04-01 04:31:38 +02:00
|
|
|
AddVariablesFunctions(temp_variables, temp_functions, false);
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
// we're setting various values
|
|
|
|
always_on_top = bool( atoi(ini_value[0].c_str()) );
|
|
|
|
view = atoi(ini_value[1].c_str()) == 0 ? view_normal : view_compact;
|
|
|
|
maximized = bool( atoi(ini_value[2].c_str()) );
|
2007-03-08 20:15:55 +01:00
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
x_pos = atoi( ini_value[3].c_str() );
|
|
|
|
y_pos = atoi( ini_value[4].c_str() );
|
|
|
|
x_size = atoi( ini_value[5].c_str() );
|
2007-02-08 18:54:37 +01:00
|
|
|
y_size = atoi( ini_value[12].c_str() );
|
2007-03-08 20:15:55 +01:00
|
|
|
CheckCoordinates();
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
SetPrecision( atoi(ini_value[6].c_str()) );
|
|
|
|
SetBaseInput( atoi(ini_value[7].c_str()) );
|
|
|
|
SetBaseOutput( atoi(ini_value[8].c_str()) );
|
|
|
|
|
|
|
|
SetDisplayAlwaysScientific( bool(atoi(ini_value[9].c_str())) );
|
|
|
|
SetDisplayWhenScientific( atoi(ini_value[10].c_str()) );
|
|
|
|
SetDisplayRounding( atoi(ini_value[11].c_str()) );
|
2008-04-12 10:52:21 +02:00
|
|
|
SetRemovingZeroes( bool(atoi(ini_value[15].c_str())) );
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2009-09-08 03:24:56 +02:00
|
|
|
if( ini_value[13] == "6" )
|
|
|
|
languages.SetCurrentLanguage(Languages::swe);
|
|
|
|
else
|
2009-06-25 06:54:48 +02:00
|
|
|
if( ini_value[13] == "5" )
|
|
|
|
languages.SetCurrentLanguage(Languages::ru);
|
|
|
|
else
|
2009-06-11 18:07:18 +02:00
|
|
|
if( ini_value[13] == "4" )
|
|
|
|
languages.SetCurrentLanguage(Languages::chn);
|
|
|
|
else
|
2009-05-01 00:59:06 +02:00
|
|
|
if( ini_value[13] == "3" )
|
|
|
|
languages.SetCurrentLanguage(Languages::da);
|
|
|
|
else
|
2008-05-01 14:29:44 +02:00
|
|
|
if( ini_value[13] == "2" )
|
|
|
|
languages.SetCurrentLanguage(Languages::sp);
|
|
|
|
else
|
2007-02-28 18:52:09 +01:00
|
|
|
if( ini_value[13] == "1" )
|
|
|
|
languages.SetCurrentLanguage(Languages::pl);
|
|
|
|
else
|
|
|
|
languages.SetCurrentLanguage(Languages::en);
|
|
|
|
|
2007-12-09 21:05:15 +01:00
|
|
|
SetDecimalPoint( atoi(ini_value[14].c_str()) );
|
2009-03-28 19:26:20 +01:00
|
|
|
SetDegRadGrad( atoi(ini_value[16].c_str()) );
|
2007-02-28 18:52:09 +01:00
|
|
|
|
2009-10-16 04:12:10 +02:00
|
|
|
pad_x_pos = atoi( ini_value[17].c_str() );
|
|
|
|
pad_y_pos = atoi( ini_value[18].c_str() );
|
|
|
|
pad_x_size = atoi( ini_value[19].c_str() );
|
|
|
|
pad_y_size = atoi( ini_value[20].c_str() );
|
|
|
|
pad_maximized = bool( atoi(ini_value[21].c_str()) );
|
|
|
|
show_pad = bool( atoi(ini_value[22].c_str()) );
|
|
|
|
CheckPadCoordinates();
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
if( err != IniParser::err_ok )
|
|
|
|
bad_line = iparser.GetBadLine();
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ProgramResources::SaveToFile()
|
|
|
|
{
|
|
|
|
std::ofstream file( configuration_file.c_str() );
|
|
|
|
|
|
|
|
if( !file )
|
|
|
|
return;
|
|
|
|
|
|
|
|
file << "# the configuration file of the program ttcalc\n\n";
|
|
|
|
file << "[GLOBAL]\n";
|
|
|
|
|
|
|
|
file << "always.on.top = " << (int)always_on_top << std::endl;
|
|
|
|
file << "view = " << (int)view << std::endl;
|
|
|
|
file << "x = " << x_pos << std::endl;
|
|
|
|
file << "y = " << y_pos << std::endl;
|
|
|
|
file << "size.x = " << x_size << std::endl;
|
2007-02-08 18:54:37 +01:00
|
|
|
file << "size.y = " << y_size << std::endl;
|
2009-10-16 04:12:10 +02:00
|
|
|
file << "maximized = " << (int)maximized << std::endl;
|
|
|
|
file << "pad = " << (int)show_pad << std::endl;
|
|
|
|
file << "pad.x = " << pad_x_pos << std::endl;
|
|
|
|
file << "pad.y = " << pad_y_pos << std::endl;
|
|
|
|
file << "pad.size.x = " << pad_x_size << std::endl;
|
|
|
|
file << "pad.size.y = " << pad_y_size << std::endl;
|
|
|
|
file << "pad.maximized = " << (int)pad_maximized << std::endl;
|
2007-01-22 12:12:01 +01:00
|
|
|
file << "precision = " << precision << std::endl;
|
|
|
|
file << "disp.input = " << base_input << std::endl;
|
|
|
|
file << "disp.output = " << base_output << std::endl;
|
2007-02-28 18:52:09 +01:00
|
|
|
file << "language = " << static_cast<int>(languages.GetCurrentLanguage())
|
|
|
|
<< std::endl;
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
file << "disp.alw.scientific = " << (int)display_always_scientific << std::endl;
|
|
|
|
file << "disp.when.scientific = " << display_when_scientific << std::endl;
|
|
|
|
file << "disp.rounding = " << display_rounding << std::endl;
|
2008-04-12 10:52:21 +02:00
|
|
|
file << "disp.remove.zeroes = " << (int)remove_zeroes << std::endl;
|
2007-12-09 21:05:15 +01:00
|
|
|
file << "disp.dec.point = " << decimal_point << std::endl;
|
2009-03-28 19:26:20 +01:00
|
|
|
file << "disp.deg_rad_grad = " << angle_deg_rad_grad << std::endl;
|
|
|
|
|
2007-01-22 12:12:01 +01:00
|
|
|
|
2007-02-28 18:52:09 +01:00
|
|
|
file << "\n[variables]\n";
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
ttmath::Objects::CIterator iv = variables.Begin();
|
|
|
|
|
|
|
|
for( ; iv != variables.End() ; ++iv )
|
|
|
|
file << iv->first.c_str() << " = " << iv->second.value.c_str() << std::endl;
|
|
|
|
|
2007-02-28 18:52:09 +01:00
|
|
|
file << "\n[functions]\n";
|
2007-01-22 12:12:01 +01:00
|
|
|
|
|
|
|
iv = functions.Begin();
|
|
|
|
for( ; iv != functions.End() ; ++iv )
|
|
|
|
file << iv->first.c_str() << " = " << iv->second.param <<
|
|
|
|
" | " << iv->second.value.c_str() << std::endl;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int ProgramResources::GetBadLine()
|
|
|
|
{
|
|
|
|
return bad_line;
|
|
|
|
}
|
|
|
|
|