diff options
-rw-r--r-- | Makefile | 8 | ||||
-rw-r--r-- | mtxexpression.cc | 2 | ||||
-rw-r--r-- | mtxexpression.h | 4 | ||||
-rw-r--r-- | mtxinteger.cc | 2 | ||||
-rw-r--r-- | mtxlanguage.cc | 14 | ||||
-rw-r--r-- | mtxlanguage.h | 2 | ||||
-rw-r--r-- | mtxmatrix.cc | 6 | ||||
-rw-r--r-- | mtxsymbol.cc | 5 | ||||
-rw-r--r-- | mtxsymbol.h | 2 | ||||
-rw-r--r-- | mtxwindow.cc | 2 | ||||
-rw-r--r-- | test.mtx | 8 |
11 files changed, 33 insertions, 22 deletions
@@ -1,7 +1,9 @@ # $Id$ CC = g++ -CPPFLAGS = -Wall $$(pkg-config gtkmm-2.0 --cflags) # -D USE_64BITS_WORDS +CPPFLAGS += -D USE_64BITS_WORDS +CFLAGS = -O3 -g +CFLAGS += -Wall $$(pkg-config gtkmm-2.4 --cflags) LIBS = HEADERS = mtx.h mtxinteger.h mtxrational.h mtxmatrix.h mtxexception.h \ mtxdivbyzeroexception.h mtxsingularmatrixexception.h \ @@ -16,7 +18,7 @@ CLI_LIBS = -lreadline $(LIBS) CLI_OBJECTS = main_cli.o $(OBJECTS) CLI_BINARY = mtx_cli -GUI_LIBS = $$(pkg-config gtkmm-2.0 --libs) $(LIBS) +GUI_LIBS = $$(pkg-config gtkmm-2.4 --libs) $(LIBS) GUI_OBJECTS = main_gui.o mtxwindow.o mtxhistory.o mtxentry.o $(OBJECTS) GUI_BINARY = mtx_gui @@ -38,7 +40,7 @@ $(GUI_BINARY): $(GUI_OBJECTS) $(CC) -o $(GUI_BINARY) $(GUI_OBJECTS) $(GUI_LIBS) %.o: %.cc $(HEADERS) - $(CC) $(CPPFLAGS) -c $< + $(CC) $(CPPFLAGS) $(CFLAGS) $(CXXFLAGS) -c $< doc: doc/html/index.html diff --git a/mtxexpression.cc b/mtxexpression.cc index 0d51f90..f8a447c 100644 --- a/mtxexpression.cc +++ b/mtxexpression.cc @@ -132,7 +132,7 @@ MtxExpression::MtxExpression(MtxLanguage *language, else { mtx_expression_t first_operand, second_operand; - size_t i, j, index; + size_t i, j, index = 0; i = 0; diff --git a/mtxexpression.h b/mtxexpression.h index 848a2a9..eca218a 100644 --- a/mtxexpression.h +++ b/mtxexpression.h @@ -74,7 +74,7 @@ struct mtx_function /** * Function string as entered by the user. */ - char *str; + const char *str; /** * ID of the function. @@ -97,7 +97,7 @@ struct mtx_operator /** * Operator string as entered by the user. */ - char *str; + const char *str; /** * ID of the operator. diff --git a/mtxinteger.cc b/mtxinteger.cc index 7ff2e5d..de51b61 100644 --- a/mtxinteger.cc +++ b/mtxinteger.cc @@ -640,7 +640,7 @@ MtxInteger MtxInteger::operator+(const MtxInteger &integer) const { bool overflow, negative, integer_negative; - mtx_int_t word, word1, word2; + mtx_int_t word = 0, word1, word2; MtxInteger new_integer; size_t i, words_count; diff --git a/mtxlanguage.cc b/mtxlanguage.cc index 623db7c..4055159 100644 --- a/mtxlanguage.cc +++ b/mtxlanguage.cc @@ -18,10 +18,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <string> -#include <vector> -#include <ctype.h> #include <algorithm> +#include <cstring> +#include <ctype.h> +#include <vector> #include "mtx.h" #include "mtxsymbol.h" @@ -34,7 +34,7 @@ using namespace std; -char *MtxLanguage::lexical_groups[] = +const char *MtxLanguage::lexical_groups[] = { "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.", "=+-*/", "(", ")", "[", "]", ",", ";", @@ -48,13 +48,13 @@ MtxLanguage::MtxLanguage() size_t MtxLanguage::findGroup(char c) const { - char *ptr; + const char *ptr; size_t i; i = 0; while (lexical_groups[i] != NULL - && (ptr = strchr(lexical_groups[i], c)) == NULL) + && (ptr = std::strchr(lexical_groups[i], c)) == NULL) i++; if (lexical_groups[i] == NULL) @@ -95,7 +95,7 @@ MtxLanguage::checkLexicalElement(const string &lexical_element) const mtx_expression_t MtxLanguage::parseLexicalElements(const string &expression) const { - size_t i, str_length, prev_group, group; + size_t i, str_length, prev_group = 0, group; mtx_expression_t lexical_elements; string lexical_element; bool prev_set; diff --git a/mtxlanguage.h b/mtxlanguage.h index d95b20a..8ad8772 100644 --- a/mtxlanguage.h +++ b/mtxlanguage.h @@ -104,7 +104,7 @@ class MtxLanguage * Array of groups of lexical elements. E.g. + and = are in the same * group. */ - static char *lexical_groups[]; + static const char *lexical_groups[]; public: /** diff --git a/mtxmatrix.cc b/mtxmatrix.cc index ab23d69..43eb703 100644 --- a/mtxmatrix.cc +++ b/mtxmatrix.cc @@ -18,8 +18,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <string> -#include <stdio.h> +#include <cstdio> +#include <cstring> #include <iostream> #include "mtxmatrix.h" @@ -646,7 +646,7 @@ MtxMatrix::toString(bool float_string) const MtxRational *rational; rational = rationals; - memset(columns_lengths, 0, sizeof(columns_lengths)); + std::memset(columns_lengths, 0, sizeof(columns_lengths)); for (i = 0; i < rows; i++) for (j = 0; j < columns; j++) diff --git a/mtxsymbol.cc b/mtxsymbol.cc index c0846b8..5e521fd 100644 --- a/mtxsymbol.cc +++ b/mtxsymbol.cc @@ -18,7 +18,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <string> +#include <cstdlib> +#include <cstring> #include <vector> #include "mtx.h" @@ -76,7 +77,7 @@ list(const MtxSymbol *symbol) string quit(const MtxSymbol *symbol) { - exit(0); + std::exit(0); } MtxSymbol::MtxSymbol() diff --git a/mtxsymbol.h b/mtxsymbol.h index ab54b5e..78af6f9 100644 --- a/mtxsymbol.h +++ b/mtxsymbol.h @@ -40,7 +40,7 @@ struct mtx_special_name /** * The special name. */ - char *name; + const char *name; /** * Pointer to a function implementing the action associated to the special diff --git a/mtxwindow.cc b/mtxwindow.cc index 6ecca97..3ddf0ac 100644 --- a/mtxwindow.cc +++ b/mtxwindow.cc @@ -42,7 +42,7 @@ entry(language, this) resize(750, 500); move(100, 75); menu_help.items().push_back(Gtk::Menu_Helpers::MenuElem("_About", - SigC::slot(*this, &MtxWindow::on_menu_help_about))); + sigc::mem_fun(*this, &MtxWindow::on_menu_help_about))); menu_bar.items().push_back(Gtk::Menu_Helpers::MenuElem("_Help", menu_help)); vbox.pack_start(menu_bar, Gtk::PACK_SHRINK); buffer = text_view.get_buffer(); diff --git a/test.mtx b/test.mtx new file mode 100644 index 0000000..f2c5354 --- /dev/null +++ b/test.mtx @@ -0,0 +1,8 @@ +m=augment([1;2], [3;4]) +transpose(m) +det(m) +lu(m, l, u) +l, u +inverse(m) +3/2*m +3.0/2*m |