annotate liboctave/operators/mk-ops.awk @ 29357:bbbe4dcc7200 stable

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