summarylogtreecommitdiffstats
path: root/octave-4.3-compat.diff
blob: 3db5404425b0aa006b2c8e4d4327447e95b4fe83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
diff --git a/pure-octave/embed.cc b/pure-octave/embed.cc
index 94bb666b..bae774f6 100644
--- a/pure-octave/embed.cc
+++ b/pure-octave/embed.cc
@@ -98,6 +98,35 @@ static void my_clean_up_and_exit(int exit_status, bool safe_to_return)
     embedded_interpreter = 0;
   }
 }
+
+// other recent breakage in the 4.3 API:
+#define is_bool_type islogical
+#define is_integer_type isinteger
+#define is_complex_type iscomplex
+
+#define get_global_value myget_global_value
+#define set_global_value myset_global_value
+
+octave_value
+get_global_value (const std::string& nm, bool silent)
+{
+  octave::symbol_table& symtab = embedded_interpreter->get_symbol_table();
+
+  octave_value val = symtab.global_varval (nm);
+
+  if (val.is_undefined () && ! silent)
+    error ("get_global_value: undefined symbol '%s'", nm.c_str ());
+
+  return val;
+}
+
+void
+set_global_value (const std::string& nm, const octave_value& val)
+{
+  octave::symbol_table& symtab = embedded_interpreter->get_symbol_table();
+
+  symtab.global_assign (nm, val);
+}
 #endif
 
 static void install_builtins();
@@ -843,7 +872,12 @@ pure_expr *octave_func(pure_expr *fun)
   // First try to find an ordinary function handle.
   char *s;
   if (pure_is_cstring_dup(fun, &s)) {
+#if OCTAVE_MAJOR>4 || OCTAVE_MAJOR>=4 && OCTAVE_MINOR>=3
+    octave::symbol_table& symtab = embedded_interpreter->get_symbol_table();
+    octave_value f = symtab.find_function(s);
+#else
     octave_value f = symbol_table::find_function(s);
+#endif
     free(s);
     if (f.is_defined()) {
       pure_expr *f = pure_string_dup("str2func"),