annotate test/bug-58593/myclass2.m @ 31191:bb9d776eafac stable

Fix wrong color in PDF printout of some latex strings (bug #62884) * octave-svgconvert (draw): For "rect" elements only set brush color if necessary and eventually restore to previous color.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sun, 14 Aug 2022 18:24:07 +0200
parents fc4bb4bd1d5e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
1 classdef myclass2 < handle
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
2 properties
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
3 data_
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
4 end
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
5
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
6 methods
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
7 function obj = myclass2 ()
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
8 obj.data_ = 1001:1005;
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
9 end
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
10
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
11 function r = subsref (obj, S)
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
12 switch (S(1).type)
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
13 case '.'
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
14 switch (S(1).subs)
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
15 case 'data'
28942
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28922
diff changeset
16 %% Transform: obj.data --> obj.data_
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
17 r = obj.data_;
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
18 if (length (S) > 1)
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
19 r = subsref (r, S(2:end));
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
20 end
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
21 case 'alldata'
28942
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28922
diff changeset
22 %% Transform: obj.data --> obj.data_(1:end)
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28922
diff changeset
23 %% This statement should trigger *builtin* subsref *twice* (one
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28922
diff changeset
24 %% for the evaluation of 'end', and the other for the whole rvalue).
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28922
diff changeset
25 %% 'end' here is also builtin 'end'
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
26 r = obj.data_(1:end);
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
27
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
28 if (length (S) > 1)
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
29 r = subsref (r, S(2:end));
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
30 end
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
31 otherwise
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
32 error ('Incorrect usage');
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
33 end
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
34 case '()'
28942
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28922
diff changeset
35 %% Transform: obj(index) --> obj.data_(index)
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
36 r = subsref (obj.data_, S);
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
37 otherwise
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
38 error ('Incorrect usage');
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
39 end
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
40 end
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
41
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
42 function obj = subsasgn (obj, S, B)
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
43 switch (S(1).type)
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
44 case '.'
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
45 switch (S(1).subs)
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
46 case 'data'
28942
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28922
diff changeset
47 %% Transform: obj.data --> obj.data_
28922
c68b077c8fd6 maint: Use parentheses around conditional expressions in test/.
Rik <rik@octave.org>
parents: 28916
diff changeset
48 if (length (S)>1)
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
49 B = subsasgn (obj.data_, S(2:end), B);
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
50 end
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
51 obj.data_ = B;
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
52 case 'alldata'
28942
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28922
diff changeset
53 %% Transform: obj.data --> obj.data_(1:end)
28922
c68b077c8fd6 maint: Use parentheses around conditional expressions in test/.
Rik <rik@octave.org>
parents: 28916
diff changeset
54 if (length (S)>1)
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
55 B = subsasgn (obj.data_(1:end), S(2:end), B);
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
56 end
28942
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28922
diff changeset
57 %% This statement should trigger *builtin* subsref to evaluate 'end',
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28922
diff changeset
58 %% then *builtin* subsasgn for the whole assignment expression
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28922
diff changeset
59 %% 'end' here is also builtin 'end'
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
60 obj.data_(1:end) = B;
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
61 otherwise
28916
ec591c500fa4 maint: Use Octave convention of space after function name in test/.
Rik <rik@octave.org>
parents: 28856
diff changeset
62 error ('Incorrect usage');
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
63 end
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
64 case '()'
28942
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28922
diff changeset
65 %% Transform: obj(index) --> obj.data_(index)
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
66 obj.data_ = subsasgn (obj.data_, S, B);
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
67 otherwise
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
68 error ('Incorrect usage');
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
69 end
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
70 end
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
71
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
72 function r = end (obj, k, n)
28942
fc4bb4bd1d5e maint: Use '##' as lead-in for full-line comments.
Rik <rik@octave.org>
parents: 28922
diff changeset
73 %% We subtract 1 from the "real" end of obj.data_
28856
dece83bfab89 Improve tests for bug #58593.
Fernando Alvarruiz <feralber@upvnet.upv.es>
parents: 28804
diff changeset
74 r = builtin ('end', obj.data_, k, n) - 1;
28804
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
75 end
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
76 end
3719f5d452d4 refactor implementation of END indexing in interpreter (bug #58953)
John W. Eaton <jwe@octave.org> and Fernando Alvarruiz
parents:
diff changeset
77 end