From 59d799dabcba86f92658ddb402f634e262d9aae7 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 28 Jun 2009 17:10:40 +0000 Subject: [PATCH] * Moved the mapm library from src/apps/deskcalc to src/libs and headers/libs. * Moved the ExpressionParser class to shared. It's now built into its own static library. * Added hexadecimal number support to the expression parser as well as Evaluation*() methods to get a number instead of a string. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31298 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../mapm_4.9.5 => headers/libs/mapm}/m_apm.h | 0 .../private/shared}/ExpressionParser.h | 6 +- src/apps/deskcalc/CalcView.cpp | 3 +- src/apps/deskcalc/Jamfile | 49 +------- .../shared}/ExpressionParser.cpp | 107 ++++++++++++++++-- src/kits/shared/Jamfile | 7 ++ src/libs/Jamfile | 1 + .../deskcalc/mapm_4.9.5 => libs/mapm}/README | 0 .../mapm_4.9.5 => libs/mapm}/m_apm_lc.h | 0 .../mapm_4.9.5 => libs/mapm}/mapm5sin.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_add.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_cpi.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_div.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_exp.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_fam.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_fft.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_flr.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_fpf.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_gcd.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_lg2.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_lg3.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_lg4.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_log.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_mul.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_pow.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_rcp.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_rnd.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_set.c | 0 .../mapm_4.9.5 => libs/mapm}/mapm_sin.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmasin.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmasn0.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmcbrt.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmcnst.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmfact.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmfmul.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmgues.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmhasn.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmhsin.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmipwr.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmistr.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmpwr2.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmrsin.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmsqrt.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmstck.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmutil.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmutl1.c | 0 .../mapm_4.9.5 => libs/mapm}/mapmutl2.c | 0 47 files changed, 118 insertions(+), 55 deletions(-) rename {src/apps/deskcalc/mapm_4.9.5 => headers/libs/mapm}/m_apm.h (100%) rename {src/apps/deskcalc => headers/private/shared}/ExpressionParser.h (83%) rename src/{apps/deskcalc => kits/shared}/ExpressionParser.cpp (82%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/README (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/m_apm_lc.h (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm5sin.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_add.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_cpi.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_div.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_exp.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_fam.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_fft.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_flr.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_fpf.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_gcd.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_lg2.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_lg3.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_lg4.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_log.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_mul.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_pow.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_rcp.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_rnd.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_set.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapm_sin.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmasin.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmasn0.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmcbrt.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmcnst.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmfact.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmfmul.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmgues.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmhasn.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmhsin.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmipwr.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmistr.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmpwr2.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmrsin.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmsqrt.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmstck.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmutil.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmutl1.c (100%) rename src/{apps/deskcalc/mapm_4.9.5 => libs/mapm}/mapmutl2.c (100%) diff --git a/src/apps/deskcalc/mapm_4.9.5/m_apm.h b/headers/libs/mapm/m_apm.h similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/m_apm.h rename to headers/libs/mapm/m_apm.h diff --git a/src/apps/deskcalc/ExpressionParser.h b/headers/private/shared/ExpressionParser.h similarity index 83% rename from src/apps/deskcalc/ExpressionParser.h rename to headers/private/shared/ExpressionParser.h index 5875cfef0e..5052448533 100644 --- a/src/apps/deskcalc/ExpressionParser.h +++ b/headers/private/shared/ExpressionParser.h @@ -1,5 +1,5 @@ /* - * Copyright 2006 Haiku, Inc. All Rights Reserved. + * Copyright 2006-2009 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -42,7 +42,11 @@ class ExpressionParser { ExpressionParser(); ~ExpressionParser(); + void SetSupportHexInput(bool enabled); + BString Evaluate(const char* expressionString); + int64 EvaluateToInt64(const char* expressionString); + double EvaluateToDouble(const char* expressionString); private: diff --git a/src/apps/deskcalc/CalcView.cpp b/src/apps/deskcalc/CalcView.cpp index 188407a9a1..d748eeefdc 100644 --- a/src/apps/deskcalc/CalcView.cpp +++ b/src/apps/deskcalc/CalcView.cpp @@ -35,9 +35,10 @@ #include #include +#include + #include "CalcApplication.h" #include "CalcOptions.h" -#include "ExpressionParser.h" #include "ExpressionTextView.h" diff --git a/src/apps/deskcalc/Jamfile b/src/apps/deskcalc/Jamfile index 185800ba5b..f28c1e43e9 100644 --- a/src/apps/deskcalc/Jamfile +++ b/src/apps/deskcalc/Jamfile @@ -2,7 +2,7 @@ SubDir HAIKU_TOP src apps deskcalc ; SetSubDirSupportedPlatformsBeOSCompatible ; -SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src apps deskcalc mapm_4.9.5 ] ; +UsePrivateHeaders shared ; Application DeskCalc : CalcApplication.cpp @@ -10,51 +10,8 @@ Application DeskCalc : CalcView.cpp CalcWindow.cpp DeskCalc.cpp - ExpressionParser.cpp ExpressionTextView.cpp InputTextView.cpp - - # m_apm files - mapmhasn.c - mapmhsin.c - mapm_pow.c - mapm_log.c - mapm_lg2.c - mapm_lg4.c - mapm_exp.c - mapm_lg3.c - mapmasin.c - mapmasn0.c - mapm_sin.c - mapm5sin.c - mapmrsin.c - mapm_cpi.c - mapmsqrt.c - mapmcbrt.c - mapmgues.c - mapmfact.c - mapm_gcd.c - mapmipwr.c - mapmpwr2.c - mapm_rnd.c - mapm_flr.c - mapm_fpf.c - mapm_rcp.c - mapmstck.c - mapm_div.c - mapm_mul.c - mapmfmul.c - mapm_fft.c - mapm_add.c - mapmistr.c - mapm_set.c - mapm_fam.c - mapmutil.c - mapmutl2.c - mapmutl1.c - mapmcnst.c - - : be $(TARGET_LIBSTDC++) media + : be $(TARGET_LIBSTDC++) media libexpression_parser.a libmapm.a : DeskCalc.rdef - ; - +; diff --git a/src/apps/deskcalc/ExpressionParser.cpp b/src/kits/shared/ExpressionParser.cpp similarity index 82% rename from src/apps/deskcalc/ExpressionParser.cpp rename to src/kits/shared/ExpressionParser.cpp index 617d40a17b..d6d509431e 100644 --- a/src/apps/deskcalc/ExpressionParser.cpp +++ b/src/kits/shared/ExpressionParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2006 Haiku, Inc. All Rights Reserved. + * Copyright 2006-2009 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -7,14 +7,16 @@ * Stephan Aßmus */ +#include + #include #include #include +#include #include -#include "m_apm.h" +#include -#include "ExpressionParser.h" static const int32 kMaxDigits = 64; @@ -91,10 +93,16 @@ class Tokenizer { : fString(""), fCurrentChar(NULL), fCurrentToken(), - fReuseToken(false) + fReuseToken(false), + fHexSupport(false) { } + void SetSupportHexInput(bool enabled) + { + fHexSupport = enabled; + } + void SetTo(const char* string) { fString = string; @@ -123,6 +131,8 @@ class Tokenizer { bool decimal = *fCurrentChar == '.' || *fCurrentChar == ','; if (decimal || isdigit(*fCurrentChar)) { + if (fHexSupport && *fCurrentChar == '0' && fCurrentChar[1] == 'x') + return _ParseHexNumber(); BString temp; @@ -155,7 +165,6 @@ class Tokenizer { fCurrentToken.value = temp.String(); } else if (isalpha(*fCurrentChar) && *fCurrentChar != 'x') { - const char* begin = fCurrentChar; while (*fCurrentChar != 0 && (isalpha(*fCurrentChar) || isdigit(*fCurrentChar))) { @@ -166,7 +175,6 @@ class Tokenizer { TOKEN_IDENTIFIER); } else { - int32 type = TOKEN_NONE; switch (*fCurrentChar) { @@ -177,7 +185,6 @@ class Tokenizer { type = TOKEN_MINUS; break; case '*': - case 'x': type = TOKEN_STAR; break; case '/': @@ -214,6 +221,13 @@ class Tokenizer { type = TOKEN_END_OF_LINE; break; + case 'x': + if (!fHexSupport) { + type = TOKEN_STAR; + break; + } + // fall through + default: throw ParseException("unexpected character", _CurrentPos()); } @@ -231,6 +245,43 @@ class Tokenizer { } private: + static bool _IsHexDigit(char c) + { + return isdigit(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); + } + + Token& _ParseHexNumber() + { + const char* begin = fCurrentChar; + fCurrentChar += 2; + // skip "0x" + + if (!_IsHexDigit(*fCurrentChar)) + throw ParseException("expected hex digit", _CurrentPos()); + + fCurrentChar++; + while (_IsHexDigit(*fCurrentChar)) + fCurrentChar++; + + int32 length = fCurrentChar - begin; + fCurrentToken = Token(begin, length, _CurrentPos() - length, + TOKEN_CONSTANT); + + // MAPM has no conversion from long long, so we need to improvise. + uint64 value = strtoll(fCurrentToken.string.String(), NULL, 0); + if (value <= 0x7fffffff) { + fCurrentToken.value = (long)value; + } else { + fCurrentToken.value = (int)(value >> 60); + fCurrentToken.value *= 1 << 30; + fCurrentToken.value += (int)((value >> 30) & 0x3fffffff); + fCurrentToken.value *= 1 << 30; + fCurrentToken.value += (int)(value& 0x3fffffff); + } + + return fCurrentToken; + } + int32 _CurrentPos() const { return fCurrentChar - fString.String(); @@ -240,6 +291,7 @@ class Tokenizer { const char* fCurrentChar; Token fCurrentToken; bool fReuseToken; + bool fHexSupport; }; @@ -255,6 +307,13 @@ ExpressionParser::~ExpressionParser() } +void +ExpressionParser::SetSupportHexInput(bool enabled) +{ + fTokenizer->SetSupportHexInput(enabled); +} + + BString ExpressionParser::Evaluate(const char* expressionString) { @@ -290,6 +349,40 @@ ExpressionParser::Evaluate(const char* expressionString) } +int64 +ExpressionParser::EvaluateToInt64(const char* expressionString) +{ + fTokenizer->SetTo(expressionString); + + MAPM value = _ParseBinary(); + Token token = fTokenizer->NextToken(); + if (token.type != TOKEN_END_OF_LINE) + throw ParseException("parse error", token.position); + + char buffer[128]; + value.toIntegerString(buffer); + + return strtoll(buffer, NULL, 0); +} + + +double +ExpressionParser::EvaluateToDouble(const char* expressionString) +{ + fTokenizer->SetTo(expressionString); + + MAPM value = _ParseBinary(); + Token token = fTokenizer->NextToken(); + if (token.type != TOKEN_END_OF_LINE) + throw ParseException("parse error", token.position); + + char buffer[1024]; + value.toString(buffer, sizeof(buffer) - 4); + + return strtod(buffer, NULL); +} + + MAPM ExpressionParser::_ParseBinary() { diff --git a/src/kits/shared/Jamfile b/src/kits/shared/Jamfile index 65572de793..1330a0dabd 100644 --- a/src/kits/shared/Jamfile +++ b/src/kits/shared/Jamfile @@ -22,3 +22,10 @@ StaticLibrary libshared.a : RWLockManager.cpp Variant.cpp ; + + +UseLibraryHeaders mapm ; + +StaticLibrary libexpression_parser.a : + ExpressionParser.cpp +; diff --git a/src/libs/Jamfile b/src/libs/Jamfile index 53611f0dbc..35a3535bd2 100644 --- a/src/libs/Jamfile +++ b/src/libs/Jamfile @@ -14,6 +14,7 @@ SubInclude HAIKU_TOP src libs iconv ; SubInclude HAIKU_TOP src libs libtelnet ; SubInclude HAIKU_TOP src libs linprog ; SubInclude HAIKU_TOP src libs lp_solve ; +SubInclude HAIKU_TOP src libs mapm ; SubInclude HAIKU_TOP src libs ncurses ; SubInclude HAIKU_TOP src libs pdflib ; SubInclude HAIKU_TOP src libs png ; diff --git a/src/apps/deskcalc/mapm_4.9.5/README b/src/libs/mapm/README similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/README rename to src/libs/mapm/README diff --git a/src/apps/deskcalc/mapm_4.9.5/m_apm_lc.h b/src/libs/mapm/m_apm_lc.h similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/m_apm_lc.h rename to src/libs/mapm/m_apm_lc.h diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm5sin.c b/src/libs/mapm/mapm5sin.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm5sin.c rename to src/libs/mapm/mapm5sin.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_add.c b/src/libs/mapm/mapm_add.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_add.c rename to src/libs/mapm/mapm_add.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_cpi.c b/src/libs/mapm/mapm_cpi.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_cpi.c rename to src/libs/mapm/mapm_cpi.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_div.c b/src/libs/mapm/mapm_div.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_div.c rename to src/libs/mapm/mapm_div.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_exp.c b/src/libs/mapm/mapm_exp.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_exp.c rename to src/libs/mapm/mapm_exp.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_fam.c b/src/libs/mapm/mapm_fam.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_fam.c rename to src/libs/mapm/mapm_fam.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_fft.c b/src/libs/mapm/mapm_fft.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_fft.c rename to src/libs/mapm/mapm_fft.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_flr.c b/src/libs/mapm/mapm_flr.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_flr.c rename to src/libs/mapm/mapm_flr.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_fpf.c b/src/libs/mapm/mapm_fpf.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_fpf.c rename to src/libs/mapm/mapm_fpf.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_gcd.c b/src/libs/mapm/mapm_gcd.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_gcd.c rename to src/libs/mapm/mapm_gcd.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_lg2.c b/src/libs/mapm/mapm_lg2.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_lg2.c rename to src/libs/mapm/mapm_lg2.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_lg3.c b/src/libs/mapm/mapm_lg3.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_lg3.c rename to src/libs/mapm/mapm_lg3.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_lg4.c b/src/libs/mapm/mapm_lg4.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_lg4.c rename to src/libs/mapm/mapm_lg4.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_log.c b/src/libs/mapm/mapm_log.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_log.c rename to src/libs/mapm/mapm_log.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_mul.c b/src/libs/mapm/mapm_mul.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_mul.c rename to src/libs/mapm/mapm_mul.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_pow.c b/src/libs/mapm/mapm_pow.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_pow.c rename to src/libs/mapm/mapm_pow.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_rcp.c b/src/libs/mapm/mapm_rcp.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_rcp.c rename to src/libs/mapm/mapm_rcp.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_rnd.c b/src/libs/mapm/mapm_rnd.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_rnd.c rename to src/libs/mapm/mapm_rnd.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_set.c b/src/libs/mapm/mapm_set.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_set.c rename to src/libs/mapm/mapm_set.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapm_sin.c b/src/libs/mapm/mapm_sin.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapm_sin.c rename to src/libs/mapm/mapm_sin.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmasin.c b/src/libs/mapm/mapmasin.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmasin.c rename to src/libs/mapm/mapmasin.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmasn0.c b/src/libs/mapm/mapmasn0.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmasn0.c rename to src/libs/mapm/mapmasn0.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmcbrt.c b/src/libs/mapm/mapmcbrt.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmcbrt.c rename to src/libs/mapm/mapmcbrt.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmcnst.c b/src/libs/mapm/mapmcnst.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmcnst.c rename to src/libs/mapm/mapmcnst.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmfact.c b/src/libs/mapm/mapmfact.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmfact.c rename to src/libs/mapm/mapmfact.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmfmul.c b/src/libs/mapm/mapmfmul.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmfmul.c rename to src/libs/mapm/mapmfmul.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmgues.c b/src/libs/mapm/mapmgues.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmgues.c rename to src/libs/mapm/mapmgues.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmhasn.c b/src/libs/mapm/mapmhasn.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmhasn.c rename to src/libs/mapm/mapmhasn.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmhsin.c b/src/libs/mapm/mapmhsin.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmhsin.c rename to src/libs/mapm/mapmhsin.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmipwr.c b/src/libs/mapm/mapmipwr.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmipwr.c rename to src/libs/mapm/mapmipwr.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmistr.c b/src/libs/mapm/mapmistr.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmistr.c rename to src/libs/mapm/mapmistr.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmpwr2.c b/src/libs/mapm/mapmpwr2.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmpwr2.c rename to src/libs/mapm/mapmpwr2.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmrsin.c b/src/libs/mapm/mapmrsin.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmrsin.c rename to src/libs/mapm/mapmrsin.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmsqrt.c b/src/libs/mapm/mapmsqrt.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmsqrt.c rename to src/libs/mapm/mapmsqrt.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmstck.c b/src/libs/mapm/mapmstck.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmstck.c rename to src/libs/mapm/mapmstck.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmutil.c b/src/libs/mapm/mapmutil.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmutil.c rename to src/libs/mapm/mapmutil.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmutl1.c b/src/libs/mapm/mapmutl1.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmutl1.c rename to src/libs/mapm/mapmutl1.c diff --git a/src/apps/deskcalc/mapm_4.9.5/mapmutl2.c b/src/libs/mapm/mapmutl2.c similarity index 100% rename from src/apps/deskcalc/mapm_4.9.5/mapmutl2.c rename to src/libs/mapm/mapmutl2.c