Mercurial > hg > octave-lyh
comparison libinterp/parse-tree/pt-decl.cc @ 15195:2fc554ffbc28
split libinterp from src
* libinterp: New directory. Move all files from src directory here
except Makefile.am, main.cc, main-cli.cc, mkoctfile.in.cc,
mkoctfilr.in.sh, octave-config.in.cc, octave-config.in.sh.
* libinterp/Makefile.am: New file, extracted from src/Makefile.am.
* src/Makefile.am: Delete everything except targets and definitions
needed to build and link main and utility programs.
* Makefile.am (SUBDIRS): Include libinterp in the list.
* autogen.sh: Run config-module.sh in libinterp/dldfcn directory, not
src/dldfcn directory.
* configure.ac (AC_CONFIG_SRCDIR): Use libinterp/octave.cc, not
src/octave.cc.
(DL_LDFLAGS, LIBOCTINTERP): Use libinterp, not src.
(AC_CONFIG_FILES): Include libinterp/Makefile in the list.
* find-docstring-files.sh: Look in libinterp, not src.
* gui/src/Makefile.am (liboctgui_la_CPPFLAGS): Find header files in
libinterp, not src.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 18 Aug 2012 16:23:39 -0400 |
parents | src/parse-tree/pt-decl.cc@46b19589b593 |
children |
comparison
equal
deleted
inserted
replaced
15194:0f0b795044c3 | 15195:2fc554ffbc28 |
---|---|
1 /* | |
2 | |
3 Copyright (C) 1996-2012 John W. Eaton | |
4 | |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 3 of the License, or (at your | |
10 option) any later version. | |
11 | |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
18 along with Octave; see the file COPYING. If not, see | |
19 <http://www.gnu.org/licenses/>. | |
20 | |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
24 #include <config.h> | |
25 #endif | |
26 | |
27 #include "defun.h" | |
28 #include "error.h" | |
29 #include "pt-cmd.h" | |
30 #include "ov.h" | |
31 #include "oct-lvalue.h" | |
32 #include "pt-bp.h" | |
33 #include "pt-decl.h" | |
34 #include "pt-exp.h" | |
35 #include "pt-id.h" | |
36 #include "pt-walk.h" | |
37 #include "utils.h" | |
38 #include "variables.h" | |
39 | |
40 // Declarations (global, static, etc.). | |
41 | |
42 tree_decl_elt::~tree_decl_elt (void) | |
43 { | |
44 delete id; | |
45 delete expr; | |
46 } | |
47 | |
48 bool | |
49 tree_decl_elt::eval (void) | |
50 { | |
51 bool retval = false; | |
52 | |
53 if (id && expr) | |
54 { | |
55 octave_lvalue ult = id->lvalue (); | |
56 | |
57 octave_value init_val = expr->rvalue1 (); | |
58 | |
59 if (! error_state) | |
60 { | |
61 ult.assign (octave_value::op_asn_eq, init_val); | |
62 | |
63 retval = true; | |
64 } | |
65 } | |
66 | |
67 return retval; | |
68 } | |
69 | |
70 tree_decl_elt * | |
71 tree_decl_elt::dup (symbol_table::scope_id scope, | |
72 symbol_table::context_id context) const | |
73 { | |
74 return new tree_decl_elt (id ? id->dup (scope, context) : 0, | |
75 expr ? expr->dup (scope, context) : 0); | |
76 } | |
77 | |
78 void | |
79 tree_decl_elt::accept (tree_walker& tw) | |
80 { | |
81 tw.visit_decl_elt (*this); | |
82 } | |
83 | |
84 // Initializer lists for declaration statements. | |
85 | |
86 tree_decl_init_list * | |
87 tree_decl_init_list::dup (symbol_table::scope_id scope, | |
88 symbol_table::context_id context) const | |
89 { | |
90 tree_decl_init_list *new_dil = new tree_decl_init_list (); | |
91 | |
92 for (const_iterator p = begin (); p != end (); p++) | |
93 { | |
94 const tree_decl_elt *elt = *p; | |
95 | |
96 new_dil->append (elt ? elt->dup (scope, context) : 0); | |
97 } | |
98 | |
99 return new_dil; | |
100 } | |
101 | |
102 void | |
103 tree_decl_init_list::accept (tree_walker& tw) | |
104 { | |
105 tw.visit_decl_init_list (*this); | |
106 } | |
107 | |
108 // Base class for declaration commands (global, static). | |
109 | |
110 tree_decl_command::~tree_decl_command (void) | |
111 { | |
112 delete init_list; | |
113 } | |
114 | |
115 // Global. | |
116 | |
117 tree_command * | |
118 tree_global_command::dup (symbol_table::scope_id scope, | |
119 symbol_table::context_id context) const | |
120 { | |
121 return | |
122 new tree_global_command (init_list ? init_list->dup (scope, context) : 0, | |
123 line (), column ()); | |
124 } | |
125 | |
126 void | |
127 tree_global_command::accept (tree_walker& tw) | |
128 { | |
129 tw.visit_global_command (*this); | |
130 } | |
131 | |
132 // Static. | |
133 | |
134 tree_command * | |
135 tree_persistent_command::dup (symbol_table::scope_id scope, | |
136 symbol_table::context_id context) const | |
137 { | |
138 return | |
139 new tree_persistent_command (init_list ? init_list->dup (scope, context) : 0, | |
140 line (), column ()); | |
141 } | |
142 | |
143 void | |
144 tree_persistent_command::accept (tree_walker& tw) | |
145 { | |
146 tw.visit_persistent_command (*this); | |
147 } |