annotate libgui/src/symbol-information.h @ 15268:307912900544

Use angle brackets for #include <config.h> for consistency. * symbol-information.h, oct.h, mkbuiltins, mkops, boolSparse.cc, oct-md5.cc: Use angle brackets for #include <config.h> for consistency.
author Rik <rik@octave.org>
date Thu, 30 Aug 2012 18:52:02 -0700
parents 359098ad343e
children 67fabb3d81f4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15204
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
1 /*
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
2
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
3 Copyright (C) 2011-2012 Jacob Dawid
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
4
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
5 This file is part of Octave.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
6
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
7 Octave is free software; you can redistribute it and/or modify it
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
8 under the terms of the GNU General Public License as published by the
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
9 Free Software Foundation; either version 3 of the License, or (at your
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
10 option) any later version.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
11
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
12 Octave is distributed in the hope that it will be useful, but WITHOUT
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
15 for more details.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
16
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
17 You should have received a copy of the GNU General Public License
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
18 along with Octave; see the file COPYING. If not, see
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
19 <http://www.gnu.org/licenses/>.
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
20
359098ad343e update copyright notices in libgui directory
John W. Eaton <jwe@octave.org>
parents: 15196
diff changeset
21 */
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
22
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
23 #ifndef SYMBOLINFORMATION_H
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
24 #define SYMBOLINFORMATION_H
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
25
15155
9e62d5a3a45e partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents: 15053
diff changeset
26 // FIXME -- we should not be including config.h in header files.
9e62d5a3a45e partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents: 15053
diff changeset
27
9e62d5a3a45e partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents: 15053
diff changeset
28 #ifdef HAVE_CONFIG_H
15268
307912900544 Use angle brackets for #include <config.h> for consistency.
Rik <rik@octave.org>
parents: 15204
diff changeset
29 #include <config.h>
15155
9e62d5a3a45e partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents: 15053
diff changeset
30 #endif
9e62d5a3a45e partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents: 15053
diff changeset
31
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
32 #include <QString>
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
33 #include <QHash>
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
34
14879
4daed35ff776 Added dimension column to workspace view. Using octave print-function to retrieve a value string for a variable.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14797
diff changeset
35 #include <sstream>
4daed35ff776 Added dimension column to workspace view. Using octave print-function to retrieve a value string for a variable.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14797
diff changeset
36
15053
6889217b9d78 Modified GUI sources so they can be build inside the source tree, without installing octave first.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 15045
diff changeset
37 #include "symtab.h"
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
38
14713
565ddd85565e Added comments for the octave-adapter module.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
39 /**
565ddd85565e Added comments for the octave-adapter module.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
40 * \struct symbol_information
565ddd85565e Added comments for the octave-adapter module.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
41 * \brief Meta-information over a symbol-table entry.
565ddd85565e Added comments for the octave-adapter module.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
42 * \author Jacob Dawid
565ddd85565e Added comments for the octave-adapter module.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
43 * This struct is used to store meta information over a symbol entry.
565ddd85565e Added comments for the octave-adapter module.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
44 * It reduces memory consumption, since it only stores relevant data
565ddd85565e Added comments for the octave-adapter module.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
45 * about a symbol-table entry that will be used in the model for the
565ddd85565e Added comments for the octave-adapter module.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
46 * graphical user interface.
565ddd85565e Added comments for the octave-adapter module.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
47 */
15155
9e62d5a3a45e partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents: 15053
diff changeset
48 struct symbol_information
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
49 {
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
50 enum Scope
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
51 {
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
52 local = 0,
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
53 global = 1,
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
54 persistent = 2,
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
55 hidden = 3
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
56 };
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
57
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
58 QString _symbol;
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
59 QString _type;
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
60 QString _value;
14879
4daed35ff776 Added dimension column to workspace view. Using octave print-function to retrieve a value string for a variable.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14797
diff changeset
61 QString _dimension;
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
62 Scope _scope;
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
63
14713
565ddd85565e Added comments for the octave-adapter module.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
64 /** Hashes the symbol information for quickly comparing it. */
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
65 int
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
66 hash () const
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
67 {
15045
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14886
diff changeset
68 return qHash (_symbol) + qHash (_type) + qHash (_value)
1ffaad442161 Source code formatting (80-column lines, mostly whitespace changes)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents: 14886
diff changeset
69 + qHash (_dimension) + (int)_scope;
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
70 }
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
71
14713
565ddd85565e Added comments for the octave-adapter module.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
72 /** Compares two symbol information objects. */
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
73 bool
14712
5cb54cca8a06 Completion of code reformatting.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14707
diff changeset
74 equals (const symbol_information& other) const
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
75 {
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
76 if (hash () == other.hash ())
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
77 {
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
78 return _symbol == other._symbol
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
79 && _type == other._type
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
80 && _value == other._value
14879
4daed35ff776 Added dimension column to workspace view. Using octave print-function to retrieve a value string for a variable.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14797
diff changeset
81 && _scope == other._scope
4daed35ff776 Added dimension column to workspace view. Using octave print-function to retrieve a value string for a variable.
Jacob Dawid <jacob.dawid@gmail.com>
parents: 14797
diff changeset
82 && _dimension == other._dimension;
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
83 }
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
84 }
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
85
14713
565ddd85565e Added comments for the octave-adapter module.
Jacob Dawid <jacob.dawid@googlemail.com>
parents: 14712
diff changeset
86 /** Extracts meta information from a given symbol record. */
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
87 bool
15155
9e62d5a3a45e partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents: 15053
diff changeset
88 from_symbol_record (const symbol_table::symbol_record& symbol_record);
9e62d5a3a45e partial cleanup of include files in gui sources
John W. Eaton <jwe@octave.org>
parents: 15053
diff changeset
89 };
14698
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
90
79c9a6d06590 Wrote SymbolInformation struct and refactored code that updates the symbol table.
Jacob Dawid <jacob.dawid@googlemail.com>
parents:
diff changeset
91 #endif // SYMBOLINFORMATION_H