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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
6 #
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
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
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
19 # You should have received a copy of the GNU General Public License
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
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
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
22
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
23 BEGIN {
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
24 declare_types = 0;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
67 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
68 }
4547
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
69 /^#/ {
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
70 if ($2 == "types")
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
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
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
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
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
75 generate_ops = 1;
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
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
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
89 }
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
90 next;
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
91 } {
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
92 if (declare_types)
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
93 {
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
94 ntypes++;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
fabb1be5fd84 [project @ 2006-10-28 00:13:58 by jwe]
jwe
parents: 5030
diff changeset
100
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
101 fwd_decl_ok[ntypes] = $5 == "YES";
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
102 header[ntypes] = $4 == "NONE" ? "" : $4;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
103 class[ntypes] = $3;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
104 type[ntypes] = $2;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
105 tag[ntypes] = $1;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
106 rev_tag[$1] = ntypes;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
107 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
110 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
111 else if (generate_ops)
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
150 printf ("#include \"%s\"\n", h_file);
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
151 next;
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
152 }
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
169 rhs_type = type[rhs_num];
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
fabb1be5fd84 [project @ 2006-10-28 00:13:58 by jwe]
jwe
parents: 5030
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
178 rhs_header = header[rhs_num];
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4669
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
325 emit_bin_op_decls(sparse, lhs_class, rhs_class,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
326 result_type_1, result_type_2,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
327 lhs_type, rhs_type);
4964
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4669
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
330 emit_cmp_op_decls(sparse, lhs_class, rhs_class,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
331 lhs_type, rhs_type);
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
334 emit_eqne_op_decls(sparse, lhs_class, rhs_class,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
335 lhs_type, rhs_type);
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
338 emit_bool_op_decls(sparse, lhs_class, rhs_class,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
339 lhs_type, rhs_type);
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
334a27c8f453 [project @ 2003-11-26 07:02:42 by jwe]
jwe
parents: 4585
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
394 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
395 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
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
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
398 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
399 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
400 END {
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
401 if (make_inclusive_header)
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
402 print "#endif";
4547
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
403 }
25662
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
404
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
405 function emit_bin_op_decl (result_type, operator, lhs_type, rhs_type)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
406 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
407 if (operator != "")
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
408 printf (" extern OCTAVE_API %s %s (const %s&, const %s&);\n",
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
409 result_type, operator, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
410 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
411
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
412 function emit_bin_op_decls_1 (result_type, lhs_type, rhs_type,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
413 add_op, sub_op, mul_op, div_op)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
414 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
415 emit_bin_op_decl(result_type, add_op, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
416 emit_bin_op_decl(result_type, sub_op, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
417 emit_bin_op_decl(result_type, mul_op, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
418 emit_bin_op_decl(result_type, div_op, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
419 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
420
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
421 function emit_sparse_bin_op_decls (result_type_1, result_type_2,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
422 lhs_type, rhs_type,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
423 add_op, sub_op, mul_op, div_op)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
424 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
425 emit_bin_op_decl(result_type_1, add_op, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
426 emit_bin_op_decl(result_type_1, sub_op, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
427 emit_bin_op_decl(result_type_2, mul_op, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
428 emit_bin_op_decl(result_type_2, div_op, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
429 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
430
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
431 function emit_bin_op_decls (sparse, lhs_class, rhs_class,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
432 result_type_1, result_type_2,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
433 lhs_type, rhs_type)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
434 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
435 if (sparse)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
436 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
437 if ((lhs_class == "SM" && rhs_class == "S") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
438 || (lhs_class == "S" && rhs_class == "SM"))
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
439 emit_sparse_bin_op_decls(result_type_1, result_type_2,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
440 lhs_type, rhs_type,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
441 "operator +", "operator -",
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
442 "operator *", "operator /");
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
443
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
444 else if ((lhs_class == "M" && rhs_class == "SM") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
445 || (lhs_class == "SM" && rhs_class == "M") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
446 || (lhs_class == "SM" && rhs_class == "SM"))
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
447 emit_sparse_bin_op_decls(result_type_1, result_type_2,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
448 lhs_type, rhs_type,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
449 "operator +", "operator -",
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
450 "product", "quotient");
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
451 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
452 else
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
453 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
454 if ((lhs_class == "M" && rhs_class == "S") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
455 || (lhs_class == "ND" && rhs_class == "S") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
456 || (lhs_class == "S" \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
457 && (rhs_class == "M" || rhs_class == "ND" || rhs_class == "V")) \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
458 || (lhs_class == "V" && rhs_class == "S"))
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
459 emit_bin_op_decls_1(result_type_1, lhs_type, rhs_type,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
460 "operator +", "operator -",
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
461 "operator *", "operator /");
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
462
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
463 else if ((lhs_class == "M" && rhs_class == "M") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
464 || (lhs_class == "ND" && rhs_class == "ND") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
465 || (lhs_class == "V" && rhs_class == "V"))
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
466 emit_bin_op_decls_1(result_type_1, lhs_type, rhs_type,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
467 "operator +", "operator -",
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
468 "product", "quotient");
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
469
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
470 else if ((lhs_class == "DM" && rhs_class == "M") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
471 || (lhs_class == "M" && rhs_class == "DM"))
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
472 emit_bin_op_decls_1(result_type_1, lhs_type, rhs_type,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
473 "operator +", "operator -", "operator *", "");
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
474
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
475 else if (lhs_class == "DM" && rhs_class == "DM")
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
476 emit_bin_op_decls_1(result_type_1, lhs_type, rhs_type,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
477 "operator +", "operator -", "product", "");
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
478
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
479 else if (lhs_class == "DM" && rhs_class == "S")
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
480 emit_bin_op_decls_1(result_type_1, lhs_type, rhs_type,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
481 "", "", "operator *", "operator /");
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
482
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
483 else if ((lhs_class == "M" && rhs_class == "PM") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
484 || (lhs_class == "PM" && rhs_class == "M") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
485 || (lhs_class == "S" && rhs_class == "DM"))
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
486 emit_bin_op_decls_1(result_type_1, lhs_type, rhs_type,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
487 "", "", "operator *", "");
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
488 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
489 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
490
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
491 function emit_cmp_op_decls_1(result_type, lhs_type, rhs_type)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
492 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
493 emit_bin_op_decl(result_type, "mx_el_lt", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
494 emit_bin_op_decl(result_type, "mx_el_le", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
495 emit_bin_op_decl(result_type, "mx_el_ge", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
496 emit_bin_op_decl(result_type, "mx_el_gt", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
497 emit_bin_op_decl(result_type, "mx_el_eq", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
498 emit_bin_op_decl(result_type, "mx_el_ne", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
499 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
500
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
501 function emit_cmp_op_decls (sparse, lhs_class, rhs_class, lhs_type, rhs_type)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
502 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
503 if (sparse)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
504 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
505 if ((lhs_class == "M" && rhs_class == "SM") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
506 || (lhs_class == "SM" && (rhs_class == "M" || rhs_class == "S" || rhs_class == "SM")) \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
507 || (lhs_class == "S" && rhs_class == "SM"))
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
508 emit_cmp_op_decls_1("SparseBoolMatrix", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
509 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
510 else
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
511 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
512 if ((lhs_class == "M" && rhs_class == "M") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
513 || (lhs_class == "M" && rhs_class == "S") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
514 || (lhs_class == "S" && rhs_class == "M"))
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
515 emit_cmp_op_decls_1("boolMatrix", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
516 else if ((lhs_class == "ND" && rhs_class == "ND") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
517 || (lhs_class == "ND" && rhs_class == "S") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
518 || (lhs_class == "S" && rhs_class == "ND"))
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
519 emit_cmp_op_decls_1("boolNDArray", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
520 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
521 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
522
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
523 function emit_eqne_op_decls_1(result_type, lhs_type, rhs_type)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
524 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
525 emit_bin_op_decl(result_type, "mx_el_eq", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
526 emit_bin_op_decl(result_type, "mx_el_ne", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
527 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
528
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
529 function emit_eqne_op_decls (sparse, lhs_class, rhs_class, lhs_type, rhs_type)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
530 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
531 if (sparse)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
532 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
533 if ((lhs_class == "M" && rhs_class == "SM") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
534 || (lhs_class == "SM" && rhs_class == "M"))
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
535 emit_eqne_op_decls_1("SparseBoolMatrix", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
536 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
537
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
538 ## No separate eqne ops for full-matrix or vector.
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
539 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
540
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
541 function emit_bool_op_decls_1 (result_type, lhs_type, rhs_type)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
542 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
543 emit_bin_op_decl(result_type, "mx_el_and", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
544 emit_bin_op_decl(result_type, "mx_el_or", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
545 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
546
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
547 function emit_bool_op_decls_2 (result_type, lhs_type, rhs_type)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
548 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
549 emit_bin_op_decl(result_type, "mx_el_not_and", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
550 emit_bin_op_decl(result_type, "mx_el_not_or", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
551 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
552
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
553 function emit_bool_op_decls_3 (result_type, lhs_type, rhs_type)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
554 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
555 emit_bin_op_decl(result_type, "mx_el_and_not", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
556 emit_bin_op_decl(result_type, "mx_el_or_not", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
557 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
558
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
559 function emit_bool_op_decls (sparse, lhs_class, rhs_class, lhs_type, rhs_type)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
560 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
561 if (sparse)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
562 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
563 if ((lhs_class == "M" && rhs_class == "SM") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
564 || (lhs_class == "SM" && (rhs_class == "M" || rhs_class == "S" || rhs_class == "SM")) \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
565 || (lhs_class == "S" && rhs_class == "SM"))
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
566 emit_bool_op_decls_1("SparseBoolMatrix", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
567 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
568 else
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
569 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
570 if ((lhs_class == "M" && rhs_class == "M") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
571 || (lhs_class == "M" && rhs_class == "S") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
572 || (lhs_class == "S" && rhs_class == "M"))
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
573 emit_bool_op_decls_1("boolMatrix", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
574 else if (lhs_class == "ND" && rhs_class == "S")
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
575 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
576 emit_bool_op_decls_1("boolNDArray", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
577 emit_bool_op_decls_2("boolNDArray", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
578 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
579 else if (lhs_class == "S" && rhs_class == "ND")
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
580 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
581 emit_bool_op_decls_1("boolNDArray", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
582 emit_bool_op_decls_3("boolNDArray", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
583 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
584 else if (lhs_class == "ND" && rhs_class == "ND")
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
585 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
586 emit_bool_op_decls_1("boolNDArray", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
587 emit_bool_op_decls_2("boolNDArray", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
588 emit_bool_op_decls_3("boolNDArray", lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
589 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
590 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
591 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
592
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
593 function emit_sparse_bin_ops (lhs_class, rhs_class, result_type_1,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
594 result_type_2, lhs_type, rhs_type)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
595 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
596 printf ("SPARSE_%s%s_BIN_OPS (%s, %s, %s, %s)\n",
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
597 lhs_class, rhs_class, result_type_1,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
598 result_type_2, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
599 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
600
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
606 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
607
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
608 function emit_mm_bin_op (result_t, op, lhs_t, rhs_t, fcn)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
609 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
610 printf ("\n" \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
611 "%s\n" \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
612 "%s (const %s& m1, const %s& m2)\n" \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
613 "{\n" \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
614 " return do_mm_binary_op<%s::element_type, %s::element_type, %s::element_type> (m1, m2, %s, %s, %s, \"%s\");\n" \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
615 "}\n",
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
616 result_t, op, lhs_t, rhs_t, result_t, lhs_t, rhs_t,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
617 fcn, fcn, fcn, op);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
618 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
619
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
620 function emit_mm_bin_ops (result_t, lhs_t, rhs_t)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
621 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
622 emit_mm_bin_op(result_t, "operator +", lhs_t, rhs_t, "mx_inline_add");
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
623 emit_mm_bin_op(result_t, "operator -", lhs_t, rhs_t, "mx_inline_sub");
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
624 emit_mm_bin_op(result_t, "product", lhs_t, rhs_t, "mx_inline_mul");
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
625 emit_mm_bin_op(result_t, "quotient", lhs_t, rhs_t, "mx_inline_div");
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
626 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
627
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
630 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
631 if (sparse)
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
632 emit_sparse_bin_ops(lhs_class, rhs_class, result_type_1,
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
633 result_type_2, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
634 else if ((lhs_class == "DM" && rhs_class == "M") \
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
635 || (lhs_class == "M" && rhs_class == "DM"))
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
638 else if (lhs_class == "M" && rhs_class == "M")
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
639 emit_mm_bin_ops(result_type_1, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
640 else
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
641 printf ("%s%s_BIN_OPS (%s, %s, %s)\n",
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
642 lhs_class, rhs_class, result_type_1, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
643 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
646 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
650 else
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
651 printf ("%s%s_CMP_OPS (%s, %s)\n",
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
652 lhs_class, rhs_class, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
653 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
656 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
660
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
661 ## No separate eqne ops for full-matrix or vector.
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
662 }
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
665 {
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
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
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
669 else
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
670 printf ("%s%s_BOOL_OPS (%s, %s)\n",
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
671 lhs_class, rhs_class, lhs_type, rhs_type);
924689a356e8 refactor mk-ops.awk
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
672 }