Mercurial > octave
annotate liboctave/operators/mk-ops.awk @ 27919:1891570abac8
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2020.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 06 Jan 2020 22:29:51 -0500 |
parents | b442ec6dda5c |
children | bd51beb6205e |
rev | line source |
---|---|
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
1 # Copyright (C) 2003-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
2 # |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
3 # See the file COPYRIGHT.md in the top-level directory of this distribution |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 # or <https://octave.org/COPYRIGHT.html/>. |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
5 # |
7019 | 6 # |
7 # This file is part of Octave. | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
8 # |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
9 # Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
10 # under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
11 # the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
12 # (at your option) any later version. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
13 # |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
14 # Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
15 # WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 # GNU General Public License for more details. |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
18 # |
7019 | 19 # You should have received a copy of the GNU General Public License |
20 # along with Octave; see the file COPYING. If not, see | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
21 # <https://www.gnu.org/licenses/>. |
7019 | 22 |
4544 | 23 BEGIN { |
24 declare_types = 0; | |
25 generate_ops = 0; | |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
26 op_class = ""; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
27 sparse = 0; |
4544 | 28 ntypes = 0; |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
29 make_inclusive_header = 0; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
30 make_header = 0; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
31 make_source = 0; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
32 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
33 if (build_file) |
4544 | 34 { |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
35 if (build_file == "mx-ops.h" || build_file == "smx-ops.h" || build_file == "vx-ops.h") |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
36 { |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
37 make_inclusive_header = 1; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
38 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
39 print "// DO NOT EDIT -- generated by mk-ops.awk"; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
40 tmp = build_file; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
41 prefix = substr (tmp, 1, index (tmp, "-")-1); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
42 gsub (/[\.-]/, "_", tmp); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
43 printf ("#if ! defined (octave_%s)\n", tmp); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
44 printf ("#define octave_%s 1\n", tmp); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
45 print "#include \"octave-config.h\""; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
46 } |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
47 else |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
48 { |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
49 if (match (build_file, /\.h$/)) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
50 { |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
51 make_header = 1; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
52 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
53 tmp = substr (build_file, 1, length (build_file)-2); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
54 } |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
55 else if (match (build_file, /\.cc$/)) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
56 { |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
57 make_source = 1; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
58 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
59 tmp = substr (build_file, 1, length (build_file)-3); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
60 } |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
61 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
62 prefix = substr (tmp, 1, index (tmp, "-")-1); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
63 tmp = substr (tmp, index (tmp, "-")+1); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
64 lhs_arg = substr (tmp, 1, index (tmp, "-")-1); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
65 rhs_arg = substr (tmp, index (tmp, "-")+1); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
66 } |
4544 | 67 } |
68 } | |
4547 | 69 /^#/ { |
70 if ($2 == "types") | |
71 declare_types = 1; | |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
72 else if ($3 == "operators") |
4547 | 73 { |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
74 op_class = $2; |
4547 | 75 generate_ops = 1; |
76 declare_types = 0; | |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
77 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
78 if (op_class == "vector") |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
79 sparse = 0; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
80 else if (op_class == "full-matrix") |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
81 sparse = 0; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
82 else if (op_class == "sparse-matrix") |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
83 sparse = 1; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
84 else |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
85 { |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
86 printf ("unrecognized object type: %s", op_class); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
87 exit (1); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
88 } |
4547 | 89 } |
90 next; | |
91 } { | |
4544 | 92 if (declare_types) |
93 { | |
94 ntypes++; | |
95 | |
25665
dc073ccde64e
eliminate more zero args in macros and type definitions for operators
John W. Eaton <jwe@octave.org>
parents:
25664
diff
changeset
|
96 if (NF == 5 || NF == 6) |
4544 | 97 { |
25665
dc073ccde64e
eliminate more zero args in macros and type definitions for operators
John W. Eaton <jwe@octave.org>
parents:
25664
diff
changeset
|
98 if (NF == 6) |
dc073ccde64e
eliminate more zero args in macros and type definitions for operators
John W. Eaton <jwe@octave.org>
parents:
25664
diff
changeset
|
99 core_type[ntypes] = $6; |
6119 | 100 |
4544 | 101 fwd_decl_ok[ntypes] = $5 == "YES"; |
102 header[ntypes] = $4 == "NONE" ? "" : $4; | |
103 class[ntypes] = $3; | |
104 type[ntypes] = $2; | |
105 tag[ntypes] = $1; | |
106 rev_tag[$1] = ntypes; | |
107 } | |
108 else | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
109 printf ("skipping line %d: %s\n", NR, $0); |
4544 | 110 } |
111 else if (generate_ops) | |
112 { | |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
113 if (NF >= 4 || (sparse && NF >= 5)) |
4544 | 114 { |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
115 n = 0; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
116 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
117 result_tag_1 = $(++n); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
118 if (sparse) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
119 result_tag_2 = $(++n); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
120 lhs_tag = $(++n); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
121 rhs_tag = $(++n); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
122 op_type = $(++n); |
4544 | 123 |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
124 bin_ops = index (op_type, "B") != 0; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
125 cmp_ops = index (op_type, "C") != 0; |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
126 eqne_ops = index (op_type, "E") != 0; |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
127 bool_ops = index (op_type, "L") != 0; |
4544 | 128 |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
129 k = 0 |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
130 while (NF > n) |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
131 bool_headers[k++] = $(++n); |
4544 | 132 |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
133 cc_file = sprintf ("%s-%s-%s.cc", prefix, lhs_tag, rhs_tag); |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
134 h_file = sprintf ("%s-%s-%s.h", prefix, lhs_tag, rhs_tag); |
4544 | 135 |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
136 if (list_cc_files) |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
137 { |
20327
0ce7d8303152
eliminate recursive make invocations in liboctave and libinterp directories
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
138 printf (" liboctave/operators/%s", cc_file); |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
139 next; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
140 } |
4544 | 141 |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
142 if (list_h_files) |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
143 { |
20327
0ce7d8303152
eliminate recursive make invocations in liboctave and libinterp directories
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
144 printf (" liboctave/operators/%s", h_file); |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
145 next; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
146 } |
4544 | 147 |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
148 if (make_inclusive_header) |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
149 { |
4547 | 150 printf ("#include \"%s\"\n", h_file); |
151 next; | |
152 } | |
4544 | 153 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
154 if (lhs_arg != lhs_tag || rhs_arg != rhs_tag) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
155 next; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
156 |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
157 h_guard = sprintf ("octave_%s_%s_%s_h", prefix, lhs_tag, rhs_tag); |
4544 | 158 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
159 result_num_1 = rev_tag[result_tag_1]; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
160 if (sparse) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
161 result_num_2 = rev_tag[result_tag_2]; |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
162 lhs_num = rev_tag[lhs_tag]; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
163 rhs_num = rev_tag[rhs_tag]; |
4544 | 164 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
165 result_type_1 = type[result_num_1]; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
166 if (sparse) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
167 result_type_2 = type[result_num_2]; |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
168 lhs_type = type[lhs_num]; |
4544 | 169 rhs_type = type[rhs_num]; |
170 | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
171 lhs_core_type = core_type[lhs_num]; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
172 rhs_core_type = core_type[rhs_num]; |
6119 | 173 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
174 result_header_1 = header[result_num_1]; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
175 if (sparse) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
176 result_header_2 = header[result_num_2]; |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
177 lhs_header = header[lhs_num]; |
4544 | 178 rhs_header = header[rhs_num]; |
179 | |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
180 lhs_class = class[lhs_num]; |
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
181 rhs_class = class[rhs_num]; |
4544 | 182 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
183 if (make_header) |
10317
42d098307c30
untabify additional source files
John W. Eaton <jwe@octave.org>
parents:
9578
diff
changeset
|
184 { |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
185 print "// DO NOT EDIT -- generated by mk-ops.awk"; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
186 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
187 printf ("#if ! defined (%s)\n", h_guard); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
188 printf ("#define %s 1\n", h_guard); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
189 print "#include \"octave-config.h\""; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
190 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
191 if (result_header_1) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
192 { |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
193 if (result_fwd_decl_ok) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
194 printf ("class %s\n", result_type_1); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
195 else |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
196 printf ("#include \"%s\"\n", result_header_1); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
197 } |
4544 | 198 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
199 if (result_header_2 && ! (result_header_2 == result_header_1)) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
200 { |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
201 if (result_fwd_decl_ok) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
202 printf ("class %s\n", result_type_2); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
203 else |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
204 printf ("#include \"%s\"\n", result_header_2); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
205 } |
4544 | 206 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
207 if (lhs_header && ! (lhs_header == result_header_1 || lhs_header == result_header_2)) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
208 { |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
209 if (result_fwd_decl_ok) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
210 printf ("class %s\n", lhs_type); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
211 else |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
212 printf ("#include \"%s\"\n", lhs_header); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
213 } |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
214 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
215 if (rhs_header && ! (rhs_header == lhs_header || rhs_header == result_header_1 || rhs_header == result_header_2)) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
216 { |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
217 if (result_fwd_decl_ok) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
218 printf ("class %s\n", rhs_type); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
219 else |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
220 printf ("#include \"%s\"\n", rhs_header); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
221 } |
4964 | 222 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
223 if (sparse) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
224 { |
21784
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
225 lhs_is_sparse = 0; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
226 rhs_is_sparse = 0; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
227 |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
228 xlhs_tag = "NONE"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
229 xrhs_tag = "NONE"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
230 |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
231 if (lhs_tag == "sbm") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
232 { |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
233 lhs_is_sparse = 1; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
234 xlhs_tag = "b"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
235 } |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
236 else if (lhs_tag == "scm") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
237 { |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
238 lhs_is_sparse = 1; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
239 xlhs_tag = "cs"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
240 } |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
241 else if (lhs_tag == "sm") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
242 { |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
243 lhs_is_sparse = 1; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
244 xlhs_tag = "s"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
245 } |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
246 else if (lhs_tag == "bm" || lhs_tag == "cm" || lhs_tag == "m") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
247 xlhs_tag = lhs_tag; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
248 |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
249 if (rhs_tag == "sbm") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
250 { |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
251 rhs_is_sparse = 1; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
252 xrhs_tag = "b"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
253 } |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
254 else if (rhs_tag == "scm") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
255 { |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
256 rhs_is_sparse = 1; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
257 xrhs_tag = "cs"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
258 } |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
259 else if (rhs_tag == "sm") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
260 { |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
261 rhs_is_sparse = 1; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
262 xrhs_tag = "s"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
263 } |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
264 else if (rhs_tag == "bm" || rhs_tag == "cm" || rhs_tag == "m") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
265 xrhs_tag = rhs_tag; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
266 |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
267 same_types = ((xlhs_tag == "b" && xrhs_tag == "bm") || (xlhs_tag == "cs" && xrhs_tag == "cm") || (xlhs_tag == "s" && xrhs_tag == "m") || (xlhs_tag == "bm" && xrhs_tag == "b") || (xlhs_tag == "cm" && xrhs_tag == "cs") || (xlhs_tag == "m" && xrhs_tag == "s")); |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
268 |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
269 if (! (same_types || (rhs_is_sparse && lhs_is_sparse) || xlhs_tag == "NONE" || xrhs_tag == "NONE")) |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
270 { |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
271 printf ("#include \"mx-%s-%s.h\"\n", xlhs_tag, xrhs_tag); |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
272 printf ("#include \"mx-%s-%s.h\"\n", xrhs_tag, xlhs_tag); |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
273 |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
274 xxlhs_tag = xlhs_tag; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
275 xxrhs_tag = xrhs_tag; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
276 |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
277 if (xxlhs_tag == "cs") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
278 xxlhs_tag = "cm"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
279 else if (xxlhs_tag == "s") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
280 xxlhs_tag = "m"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
281 else if (xxlhs_tag == "b") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
282 xxlhs_tag = "NONE"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
283 |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
284 if (xxrhs_tag == "cs") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
285 xxrhs_tag = "cm"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
286 else if (xxrhs_tag == "s") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
287 xxrhs_tag = "m"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
288 else if (xxrhs_tag == "b") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
289 xxrhs_tag = "NONE"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
290 |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
291 if (! (xxlhs_tag == "NONE" || xxrhs_tag == "NONE" || xxlhs_tag == xxrhs_tag)) |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
292 { |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
293 printf ("#include \"mx-%s-%s.h\"\n", xxlhs_tag, xxrhs_tag); |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
294 printf ("#include \"mx-%s-%s.h\"\n", xxrhs_tag, xxlhs_tag); |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
295 } |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
296 |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
297 xxlhs_tag = xlhs_tag; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
298 xxrhs_tag = xrhs_tag; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
299 |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
300 if (xxlhs_tag == "m") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
301 xxlhs_tag = "nda"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
302 else if (xxlhs_tag == "cm") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
303 xxlhs_tag = "cnda"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
304 else if (xxlhs_tag == "bm") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
305 xxlhs_tag = "NONE"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
306 |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
307 if (xxrhs_tag == "m") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
308 xxrhs_tag = "nda"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
309 else if (xxrhs_tag == "cm") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
310 xxrhs_tag = "cnda"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
311 else if (xxrhs_tag == "bm") |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
312 xxrhs_tag = "NONE"; |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
313 |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
314 if (! (xxlhs_tag == "NONE" || xxrhs_tag == "NONE")) |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
315 { |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
316 printf ("#include \"mx-%s-%s.h\"\n", xxlhs_tag, xxrhs_tag); |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
317 printf ("#include \"mx-%s-%s.h\"\n", xxrhs_tag, xxlhs_tag); |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
318 } |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
319 } |
d13883644981
avoid including mx-ops.h in every generated sparse ops file
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
320 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
321 printf ("#include \"Sparse-op-defs.h\"\n"); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
322 } |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
323 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
324 if (bin_ops) |
25662 | 325 emit_bin_op_decls(sparse, lhs_class, rhs_class, |
326 result_type_1, result_type_2, | |
327 lhs_type, rhs_type); | |
4964 | 328 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
329 if (cmp_ops) |
25662 | 330 emit_cmp_op_decls(sparse, lhs_class, rhs_class, |
331 lhs_type, rhs_type); | |
4544 | 332 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
333 if (eqne_ops) |
25662 | 334 emit_eqne_op_decls(sparse, lhs_class, rhs_class, |
335 lhs_type, rhs_type); | |
4544 | 336 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
337 if (bool_ops) |
25662 | 338 emit_bool_op_decls(sparse, lhs_class, rhs_class, |
339 lhs_type, rhs_type); | |
4544 | 340 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
341 print "#endif"; |
4544 | 342 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
343 exit (0); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
344 } |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
345 else if (make_source) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
346 { |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
347 print "// DO NOT EDIT -- generated by mk-ops.awk"; |
4544 | 348 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
349 print "#if defined (HAVE_CONFIG_H)"; |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21247
diff
changeset
|
350 print "# include \"config.h\""; |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
351 print "#endif"; |
4669 | 352 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
353 print "#include \"Array-util.h\""; |
4544 | 354 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
355 printf ("#include \"%s\"\n", h_file); |
8774
b756ce0002db
split implementation and interface in mx-op-defs and MArray-defs
Jaroslav Hajek <highegg@gmail.com>
parents:
7019
diff
changeset
|
356 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
357 if (! sparse) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
358 printf ("#include \"mx-op-defs.h\"\n"); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
359 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
360 for (i in bool_headers) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
361 { |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
362 printf ("#include \"%s\"\n", bool_headers[i]); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
363 delete bool_headers[i]; |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
364 } |
4544 | 365 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
366 if (result_header_1) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
367 printf ("#include \"%s\"\n", result_header_1); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
368 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
369 if (result_header_2 && ! (result_header_2 == result_header_1)) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
370 printf ("#include \"%s\"\n", result_header_2); |
4544 | 371 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
372 if (lhs_header && ! (lhs_header == result_header_1 || lhs_header == result_header_2)) |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
373 printf ("#include \"%s\"\n", lhs_header); |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
374 |
25662 | 375 if (rhs_header && ! (rhs_header == lhs_header || rhs_header == result_header_1 || rhs_header == result_header_2)) |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
376 printf ("#include \"%s\"\n", rhs_header); |
4544 | 377 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
378 if (bin_ops) |
25662 | 379 emit_bin_ops(sparse, lhs_class, rhs_class, |
25663
2de707ae8de4
eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents:
25662
diff
changeset
|
380 result_type_1, result_type_2, lhs_type, rhs_type); |
4544 | 381 |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
382 if (cmp_ops) |
25665
dc073ccde64e
eliminate more zero args in macros and type definitions for operators
John W. Eaton <jwe@octave.org>
parents:
25664
diff
changeset
|
383 emit_cmp_ops(sparse, lhs_class, rhs_class, lhs_type, rhs_type); |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
384 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
385 if (eqne_ops) |
25662 | 386 emit_eqne_ops(sparse, lhs_class, rhs_class, |
25665
dc073ccde64e
eliminate more zero args in macros and type definitions for operators
John W. Eaton <jwe@octave.org>
parents:
25664
diff
changeset
|
387 lhs_type, rhs_type); |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
388 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
389 if (bool_ops) |
25662 | 390 emit_bool_ops(sparse, lhs_class, rhs_class, |
25663
2de707ae8de4
eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents:
25662
diff
changeset
|
391 lhs_type, rhs_type); |
21247
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
392 |
7be239ae42c8
merge sparse-mk-ops.awk and mk-ops.awk scripts
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
393 exit (0); |
4544 | 394 } |
395 } | |
396 else | |
19593
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17744
diff
changeset
|
397 printf ("skipping line %d: %s\n", NR, $0); |
4544 | 398 } |
399 } | |
400 END { | |
401 if (make_inclusive_header) | |
402 print "#endif"; | |
4547 | 403 } |
25662 | 404 |
405 function emit_bin_op_decl (result_type, operator, lhs_type, rhs_type) | |
406 { | |
407 if (operator != "") | |
408 printf (" extern OCTAVE_API %s %s (const %s&, const %s&);\n", | |
409 result_type, operator, lhs_type, rhs_type); | |
410 } | |
411 | |
412 function emit_bin_op_decls_1 (result_type, lhs_type, rhs_type, | |
413 add_op, sub_op, mul_op, div_op) | |
414 { | |
415 emit_bin_op_decl(result_type, add_op, lhs_type, rhs_type); | |
416 emit_bin_op_decl(result_type, sub_op, lhs_type, rhs_type); | |
417 emit_bin_op_decl(result_type, mul_op, lhs_type, rhs_type); | |
418 emit_bin_op_decl(result_type, div_op, lhs_type, rhs_type); | |
419 } | |
420 | |
421 function emit_sparse_bin_op_decls (result_type_1, result_type_2, | |
422 lhs_type, rhs_type, | |
423 add_op, sub_op, mul_op, div_op) | |
424 { | |
425 emit_bin_op_decl(result_type_1, add_op, lhs_type, rhs_type); | |
426 emit_bin_op_decl(result_type_1, sub_op, lhs_type, rhs_type); | |
427 emit_bin_op_decl(result_type_2, mul_op, lhs_type, rhs_type); | |
428 emit_bin_op_decl(result_type_2, div_op, lhs_type, rhs_type); | |
429 } | |
430 | |
431 function emit_bin_op_decls (sparse, lhs_class, rhs_class, | |
432 result_type_1, result_type_2, | |
433 lhs_type, rhs_type) | |
434 { | |
435 if (sparse) | |
436 { | |
437 if ((lhs_class == "SM" && rhs_class == "S") \ | |
438 || (lhs_class == "S" && rhs_class == "SM")) | |
439 emit_sparse_bin_op_decls(result_type_1, result_type_2, | |
440 lhs_type, rhs_type, | |
441 "operator +", "operator -", | |
442 "operator *", "operator /"); | |
443 | |
444 else if ((lhs_class == "M" && rhs_class == "SM") \ | |
445 || (lhs_class == "SM" && rhs_class == "M") \ | |
446 || (lhs_class == "SM" && rhs_class == "SM")) | |
447 emit_sparse_bin_op_decls(result_type_1, result_type_2, | |
448 lhs_type, rhs_type, | |
449 "operator +", "operator -", | |
450 "product", "quotient"); | |
451 } | |
452 else | |
453 { | |
454 if ((lhs_class == "M" && rhs_class == "S") \ | |
455 || (lhs_class == "ND" && rhs_class == "S") \ | |
456 || (lhs_class == "S" \ | |
457 && (rhs_class == "M" || rhs_class == "ND" || rhs_class == "V")) \ | |
458 || (lhs_class == "V" && rhs_class == "S")) | |
459 emit_bin_op_decls_1(result_type_1, lhs_type, rhs_type, | |
460 "operator +", "operator -", | |
461 "operator *", "operator /"); | |
462 | |
463 else if ((lhs_class == "M" && rhs_class == "M") \ | |
464 || (lhs_class == "ND" && rhs_class == "ND") \ | |
465 || (lhs_class == "V" && rhs_class == "V")) | |
466 emit_bin_op_decls_1(result_type_1, lhs_type, rhs_type, | |
467 "operator +", "operator -", | |
468 "product", "quotient"); | |
469 | |
470 else if ((lhs_class == "DM" && rhs_class == "M") \ | |
471 || (lhs_class == "M" && rhs_class == "DM")) | |
472 emit_bin_op_decls_1(result_type_1, lhs_type, rhs_type, | |
473 "operator +", "operator -", "operator *", ""); | |
474 | |
475 else if (lhs_class == "DM" && rhs_class == "DM") | |
476 emit_bin_op_decls_1(result_type_1, lhs_type, rhs_type, | |
477 "operator +", "operator -", "product", ""); | |
478 | |
479 else if (lhs_class == "DM" && rhs_class == "S") | |
480 emit_bin_op_decls_1(result_type_1, lhs_type, rhs_type, | |
481 "", "", "operator *", "operator /"); | |
482 | |
483 else if ((lhs_class == "M" && rhs_class == "PM") \ | |
484 || (lhs_class == "PM" && rhs_class == "M") \ | |
485 || (lhs_class == "S" && rhs_class == "DM")) | |
486 emit_bin_op_decls_1(result_type_1, lhs_type, rhs_type, | |
487 "", "", "operator *", ""); | |
488 } | |
489 } | |
490 | |
491 function emit_cmp_op_decls_1(result_type, lhs_type, rhs_type) | |
492 { | |
493 emit_bin_op_decl(result_type, "mx_el_lt", lhs_type, rhs_type); | |
494 emit_bin_op_decl(result_type, "mx_el_le", lhs_type, rhs_type); | |
495 emit_bin_op_decl(result_type, "mx_el_ge", lhs_type, rhs_type); | |
496 emit_bin_op_decl(result_type, "mx_el_gt", lhs_type, rhs_type); | |
497 emit_bin_op_decl(result_type, "mx_el_eq", lhs_type, rhs_type); | |
498 emit_bin_op_decl(result_type, "mx_el_ne", lhs_type, rhs_type); | |
499 } | |
500 | |
501 function emit_cmp_op_decls (sparse, lhs_class, rhs_class, lhs_type, rhs_type) | |
502 { | |
503 if (sparse) | |
504 { | |
505 if ((lhs_class == "M" && rhs_class == "SM") \ | |
506 || (lhs_class == "SM" && (rhs_class == "M" || rhs_class == "S" || rhs_class == "SM")) \ | |
507 || (lhs_class == "S" && rhs_class == "SM")) | |
508 emit_cmp_op_decls_1("SparseBoolMatrix", lhs_type, rhs_type); | |
509 } | |
510 else | |
511 { | |
512 if ((lhs_class == "M" && rhs_class == "M") \ | |
513 || (lhs_class == "M" && rhs_class == "S") \ | |
514 || (lhs_class == "S" && rhs_class == "M")) | |
515 emit_cmp_op_decls_1("boolMatrix", lhs_type, rhs_type); | |
516 else if ((lhs_class == "ND" && rhs_class == "ND") \ | |
517 || (lhs_class == "ND" && rhs_class == "S") \ | |
518 || (lhs_class == "S" && rhs_class == "ND")) | |
519 emit_cmp_op_decls_1("boolNDArray", lhs_type, rhs_type); | |
520 } | |
521 } | |
522 | |
523 function emit_eqne_op_decls_1(result_type, lhs_type, rhs_type) | |
524 { | |
525 emit_bin_op_decl(result_type, "mx_el_eq", lhs_type, rhs_type); | |
526 emit_bin_op_decl(result_type, "mx_el_ne", lhs_type, rhs_type); | |
527 } | |
528 | |
529 function emit_eqne_op_decls (sparse, lhs_class, rhs_class, lhs_type, rhs_type) | |
530 { | |
531 if (sparse) | |
532 { | |
533 if ((lhs_class == "M" && rhs_class == "SM") \ | |
534 || (lhs_class == "SM" && rhs_class == "M")) | |
535 emit_eqne_op_decls_1("SparseBoolMatrix", lhs_type, rhs_type); | |
536 } | |
537 | |
538 ## No separate eqne ops for full-matrix or vector. | |
539 } | |
540 | |
541 function emit_bool_op_decls_1 (result_type, lhs_type, rhs_type) | |
542 { | |
543 emit_bin_op_decl(result_type, "mx_el_and", lhs_type, rhs_type); | |
544 emit_bin_op_decl(result_type, "mx_el_or", lhs_type, rhs_type); | |
545 } | |
546 | |
547 function emit_bool_op_decls_2 (result_type, lhs_type, rhs_type) | |
548 { | |
549 emit_bin_op_decl(result_type, "mx_el_not_and", lhs_type, rhs_type); | |
550 emit_bin_op_decl(result_type, "mx_el_not_or", lhs_type, rhs_type); | |
551 } | |
552 | |
553 function emit_bool_op_decls_3 (result_type, lhs_type, rhs_type) | |
554 { | |
555 emit_bin_op_decl(result_type, "mx_el_and_not", lhs_type, rhs_type); | |
556 emit_bin_op_decl(result_type, "mx_el_or_not", lhs_type, rhs_type); | |
557 } | |
558 | |
559 function emit_bool_op_decls (sparse, lhs_class, rhs_class, lhs_type, rhs_type) | |
560 { | |
561 if (sparse) | |
562 { | |
563 if ((lhs_class == "M" && rhs_class == "SM") \ | |
564 || (lhs_class == "SM" && (rhs_class == "M" || rhs_class == "S" || rhs_class == "SM")) \ | |
565 || (lhs_class == "S" && rhs_class == "SM")) | |
566 emit_bool_op_decls_1("SparseBoolMatrix", lhs_type, rhs_type); | |
567 } | |
568 else | |
569 { | |
570 if ((lhs_class == "M" && rhs_class == "M") \ | |
571 || (lhs_class == "M" && rhs_class == "S") \ | |
572 || (lhs_class == "S" && rhs_class == "M")) | |
573 emit_bool_op_decls_1("boolMatrix", lhs_type, rhs_type); | |
574 else if (lhs_class == "ND" && rhs_class == "S") | |
575 { | |
576 emit_bool_op_decls_1("boolNDArray", lhs_type, rhs_type); | |
577 emit_bool_op_decls_2("boolNDArray", lhs_type, rhs_type); | |
578 } | |
579 else if (lhs_class == "S" && rhs_class == "ND") | |
580 { | |
581 emit_bool_op_decls_1("boolNDArray", lhs_type, rhs_type); | |
582 emit_bool_op_decls_3("boolNDArray", lhs_type, rhs_type); | |
583 } | |
584 else if (lhs_class == "ND" && rhs_class == "ND") | |
585 { | |
586 emit_bool_op_decls_1("boolNDArray", lhs_type, rhs_type); | |
587 emit_bool_op_decls_2("boolNDArray", lhs_type, rhs_type); | |
588 emit_bool_op_decls_3("boolNDArray", lhs_type, rhs_type); | |
589 } | |
590 } | |
591 } | |
592 | |
593 function emit_sparse_bin_ops (lhs_class, rhs_class, result_type_1, | |
594 result_type_2, lhs_type, rhs_type) | |
595 { | |
596 printf ("SPARSE_%s%s_BIN_OPS (%s, %s, %s, %s)\n", | |
597 lhs_class, rhs_class, result_type_1, | |
598 result_type_2, lhs_type, rhs_type); | |
599 } | |
600 | |
601 function emit_dm_bin_ops (lhs_class, rhs_class, result_type_1, | |
25663
2de707ae8de4
eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents:
25662
diff
changeset
|
602 lhs_type, rhs_type) |
25662 | 603 { |
25663
2de707ae8de4
eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents:
25662
diff
changeset
|
604 printf ("%s%s_BIN_OPS (%s, %s, %s)\n", |
2de707ae8de4
eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents:
25662
diff
changeset
|
605 lhs_class, rhs_class, result_type_1, lhs_type, rhs_type); |
25662 | 606 } |
607 | |
608 function emit_mm_bin_op (result_t, op, lhs_t, rhs_t, fcn) | |
609 { | |
610 printf ("\n" \ | |
611 "%s\n" \ | |
612 "%s (const %s& m1, const %s& m2)\n" \ | |
613 "{\n" \ | |
614 " return do_mm_binary_op<%s::element_type, %s::element_type, %s::element_type> (m1, m2, %s, %s, %s, \"%s\");\n" \ | |
615 "}\n", | |
616 result_t, op, lhs_t, rhs_t, result_t, lhs_t, rhs_t, | |
617 fcn, fcn, fcn, op); | |
618 } | |
619 | |
620 function emit_mm_bin_ops (result_t, lhs_t, rhs_t) | |
621 { | |
622 emit_mm_bin_op(result_t, "operator +", lhs_t, rhs_t, "mx_inline_add"); | |
623 emit_mm_bin_op(result_t, "operator -", lhs_t, rhs_t, "mx_inline_sub"); | |
624 emit_mm_bin_op(result_t, "product", lhs_t, rhs_t, "mx_inline_mul"); | |
625 emit_mm_bin_op(result_t, "quotient", lhs_t, rhs_t, "mx_inline_div"); | |
626 } | |
627 | |
628 function emit_bin_ops (sparse, lhs_class, rhs_class, | |
25663
2de707ae8de4
eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents:
25662
diff
changeset
|
629 result_type_1, result_type_2, lhs_type, rhs_type) |
25662 | 630 { |
631 if (sparse) | |
632 emit_sparse_bin_ops(lhs_class, rhs_class, result_type_1, | |
633 result_type_2, lhs_type, rhs_type); | |
634 else if ((lhs_class == "DM" && rhs_class == "M") \ | |
635 || (lhs_class == "M" && rhs_class == "DM")) | |
636 emit_dm_bin_ops(lhs_class, rhs_class, result_type_1, | |
25663
2de707ae8de4
eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents:
25662
diff
changeset
|
637 lhs_type, rhs_type); |
25662 | 638 else if (lhs_class == "M" && rhs_class == "M") |
639 emit_mm_bin_ops(result_type_1, lhs_type, rhs_type); | |
640 else | |
641 printf ("%s%s_BIN_OPS (%s, %s, %s)\n", | |
642 lhs_class, rhs_class, result_type_1, lhs_type, rhs_type); | |
643 } | |
644 | |
25665
dc073ccde64e
eliminate more zero args in macros and type definitions for operators
John W. Eaton <jwe@octave.org>
parents:
25664
diff
changeset
|
645 function emit_cmp_ops (sparse, lhs_class, rhs_class, lhs_type, rhs_type) |
25662 | 646 { |
647 if (sparse) | |
25665
dc073ccde64e
eliminate more zero args in macros and type definitions for operators
John W. Eaton <jwe@octave.org>
parents:
25664
diff
changeset
|
648 printf ("SPARSE_%s%s_CMP_OPS (%s, %s)\n", |
dc073ccde64e
eliminate more zero args in macros and type definitions for operators
John W. Eaton <jwe@octave.org>
parents:
25664
diff
changeset
|
649 lhs_class, rhs_class, lhs_type, rhs_type); |
25662 | 650 else |
651 printf ("%s%s_CMP_OPS (%s, %s)\n", | |
652 lhs_class, rhs_class, lhs_type, rhs_type); | |
653 } | |
654 | |
25665
dc073ccde64e
eliminate more zero args in macros and type definitions for operators
John W. Eaton <jwe@octave.org>
parents:
25664
diff
changeset
|
655 function emit_eqne_ops (sparse, lhs_class, rhs_class, lhs_type, rhs_type) |
25662 | 656 { |
657 if (sparse) | |
25665
dc073ccde64e
eliminate more zero args in macros and type definitions for operators
John W. Eaton <jwe@octave.org>
parents:
25664
diff
changeset
|
658 printf ("SPARSE_%s%s_EQNE_OPS (%s, %s)\n", |
dc073ccde64e
eliminate more zero args in macros and type definitions for operators
John W. Eaton <jwe@octave.org>
parents:
25664
diff
changeset
|
659 lhs_class, rhs_class, lhs_type, rhs_type); |
25662 | 660 |
661 ## No separate eqne ops for full-matrix or vector. | |
662 } | |
663 | |
25663
2de707ae8de4
eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents:
25662
diff
changeset
|
664 function emit_bool_ops (sparse, lhs_class, rhs_class, lhs_type, rhs_type) |
25662 | 665 { |
666 if (sparse) | |
25663
2de707ae8de4
eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents:
25662
diff
changeset
|
667 printf ("SPARSE_%s%s_BOOL_OPS (%s, %s)\n", |
2de707ae8de4
eliminate LHS_ZERO and RHS_ZERO args from sparse macros
John W. Eaton <jwe@octave.org>
parents:
25662
diff
changeset
|
668 lhs_class, rhs_class, lhs_type, rhs_type); |
25662 | 669 else |
670 printf ("%s%s_BOOL_OPS (%s, %s)\n", | |
671 lhs_class, rhs_class, lhs_type, rhs_type); | |
672 } |