comparison src/of-general-1-symtab-fixes.patch @ 4409:60b45297db4a

allow of-general to build with current octave sources * src/of-general-1-symtab-fixes.patch: New file. * dist-files.mk: Update.
author John W. Eaton <jwe@octave.org>
date Mon, 10 Jul 2017 14:31:09 -0400
parents
children 342cc3ee5e4b
comparison
equal deleted inserted replaced
4408:eb8b37422e16 4409:60b45297db4a
1 diff -uNr a/src/packfields.cc b/src/packfields.cc
2 --- a/src/packfields.cc 2015-05-27 11:43:57.000000000 -0400
3 +++ b/src/packfields.cc 2017-07-10 14:21:37.229291149 -0400
4 @@ -15,10 +15,11 @@
5
6 #include <octave/oct.h>
7 #include <octave/utils.h>
8 +#include <octave/interpreter.h>
9 #include <octave/symtab.h>
10 #include <octave/oct-map.h>
11
12 -DEFUN_DLD (packfields, args, ,
13 +DEFMETHOD_DLD (packfields, interp, args, ,
14 "-*- texinfo -*-\n\
15 @deftypefn {Loadable Function} {} packfields (@var{s_name}, @var{var1}, @var{var2}, @dots{})\n\
16 Create struct from variables.\n\
17 @@ -44,6 +45,9 @@
18
19 if (nargin > 0)
20 {
21 + octave::symbol_table::scope *curr_scope
22 + = interp.require_current_scope ("packfields");
23 +
24 std::string struct_name = args (0).string_value ();
25 string_vector fld_names(nargin-1);
26 octave_value_list fld_vals(nargin-1);
27 @@ -64,7 +68,7 @@
28 if (valid_identifier (fld_name))
29 {
30 fld_names(i) = fld_name;
31 - octave_value fld_val = symbol_table::varval (fld_name);
32 + octave_value fld_val = curr_scope->varval (fld_name);
33 if (fld_val.is_defined ())
34 fld_vals(i) = fld_val;
35 else
36 @@ -77,7 +81,7 @@
37 if (! error_state)
38 {
39 // Force the symbol to be inserted in caller's scope.
40 - symbol_table::symbol_record& rec = symbol_table::insert (struct_name);
41 + octave::symbol_table::symbol_record& rec = curr_scope->insert (struct_name);
42
43 octave_value& struct_ref = rec.varref ();
44
45 diff -uNr a/src/unpackfields.cc b/src/unpackfields.cc
46 --- a/src/unpackfields.cc 2015-05-27 11:43:57.000000000 -0400
47 +++ b/src/unpackfields.cc 2017-07-10 14:21:30.893590654 -0400
48 @@ -15,10 +15,11 @@
49
50 #include <octave/oct.h>
51 #include <octave/utils.h>
52 +#include <octave/interpreter.h>
53 #include <octave/symtab.h>
54 #include <octave/oct-map.h>
55
56 -DEFUN_DLD (unpackfields, args, ,
57 +DEFMETHOD_DLD (unpackfields, interp, args, ,
58 "-*- texinfo -*-\n\
59 @deftypefn {Loadable Function} {} unpackfields (@var{s_name}, @var{fld1}, @var{fld2}, @dots{})\n\
60 Create variables from fields of a struct.\n\
61 @@ -50,6 +51,9 @@
62
63 if (nargin > 0)
64 {
65 + octave::symbol_table::scope *curr_scope
66 + = interp.require_current_scope ("unpackfields");
67 +
68 std::string struct_name = args (0).string_value ();
69 string_vector fld_names(nargin-1);
70
71 @@ -75,7 +79,7 @@
72 if (! error_state)
73 {
74 // Force the symbol to be inserted in caller's scope.
75 - octave_value struct_val = symbol_table::varval (struct_name);
76 + octave_value struct_val = curr_scope->varval (struct_name);
77
78 if (struct_val.is_map ())
79 {
80 @@ -89,7 +93,7 @@
81 {
82 octave_scalar_map::const_iterator iter = map.seek (fld_names(i));
83 if (iter != map.end ())
84 - symbol_table::assign (fld_names(i), map.contents (iter));
85 + curr_scope->assign (fld_names(i), map.contents (iter));
86 else
87 {
88 error ("unpackfields: field %s does not exist", fld_names(i).c_str ());
89 @@ -114,7 +118,7 @@
90 break;
91
92 if (val.is_defined ())
93 - symbol_table::assign (fld_names(i), val);
94 + curr_scope->assign (fld_names(i), val);
95 }
96 }
97 }