annotate liboctave/operators/mk-ops.awk @ 20595:c1a6c31ac29a

eliminate more simple uses of error_state * ov-classdef.cc: Eliminate simple uses of error_state.
author John W. Eaton <jwe@octave.org>
date Tue, 06 Oct 2015 00:20:02 -0400
parents 0ce7d8303152
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19627
diff changeset
1 # Copyright (C) 2003-2015 John W. Eaton
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
2 #
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
3 # This file is part of Octave.
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
4 #
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
5 # Octave is free software; you can redistribute it and/or modify it
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
6 # under the terms of the GNU General Public License as published by the
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
7 # Free Software Foundation; either version 3 of the License, or (at
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
8 # your option) any later version.
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
9 #
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
10 # Octave is distributed in the hope that it will be useful, but WITHOUT
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
13 # for more details.
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
14 #
7019
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
15 # You should have received a copy of the GNU General Public License
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
16 # along with Octave; see the file COPYING. If not, see
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
17 # <http://www.gnu.org/licenses/>.
4270ded9ddc6 [project @ 2007-10-13 01:42:20 by jwe]
jwe
parents: 6708
diff changeset
18
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
19 BEGIN {
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
20 declare_types = 0;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
21 generate_ops = 0;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
22 ntypes = 0;
4547
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
23 } {
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
24 if (NR == 1 && make_inclusive_header)
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
25 {
4547
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
26 print "// DO NOT EDIT -- generated by mk-ops";
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
27 tmp = make_inclusive_header;
4547
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
28 gsub (/[\.-]/, "_", tmp);
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
29 printf ("#if !defined (octave_%s)\n", tmp);
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
30 printf ("#define octave_%s 1\n", tmp);
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
31 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
32 }
4547
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
33 /^#/ {
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
34 if ($2 == "types")
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
35 declare_types = 1;
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
36 else if ($2 == "ops")
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
37 {
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
38 generate_ops = 1;
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
39 declare_types = 0;
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
40 }
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
41 next;
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
42 } {
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
43 if (declare_types)
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
44 {
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
45 ntypes++;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
46
6119
fabb1be5fd84 [project @ 2006-10-28 00:13:58 by jwe]
jwe
parents: 5030
diff changeset
47 if (NF == 6 || NF == 7)
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
48 {
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
49 if (NF == 7)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
50 core_type[ntypes] = $7;
6119
fabb1be5fd84 [project @ 2006-10-28 00:13:58 by jwe]
jwe
parents: 5030
diff changeset
51
5030
160365410ad4 [project @ 2004-09-24 03:22:23 by jwe]
jwe
parents: 4964
diff changeset
52 scalar_zero_val[ntypes] = $6;
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
53 fwd_decl_ok[ntypes] = $5 == "YES";
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
54 header[ntypes] = $4 == "NONE" ? "" : $4;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
55 class[ntypes] = $3;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
56 type[ntypes] = $2;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
57 tag[ntypes] = $1;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
58 rev_tag[$1] = ntypes;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
59 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
60 else
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
61 printf ("skipping line %d: %s\n", NR, $0);
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
62 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
63 else if (generate_ops)
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
64 {
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
65 if (NF >= 4)
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
66 {
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
67 result_tag = $1;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
68 lhs_tag = $2;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
69 rhs_tag = $3;
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
70 op_type = $4;
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
71
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
72 bin_ops = index (op_type, "B") != 0;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
73 cmp_ops = index (op_type, "C") != 0;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
74 bool_ops = index (op_type, "L") != 0;
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
75
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
76 n = 4;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
77
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
78 lhs_conv = cmp_ops ? $(++n) : "";
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
79 rhs_conv = cmp_ops ? $(++n) : "";
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
80
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
81 if (lhs_conv == "NONE")
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
82 lhs_conv = "";
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
83
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
84 if (rhs_conv == "NONE")
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
85 rhs_conv = "";
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
86
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
87 k = 0
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
88 while (NF > n)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
89 bool_headers[k++] = $(++n);
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
90
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
91 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
92 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
93
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
94 if (list_cc_files)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
95 {
20362
0ce7d8303152 eliminate recursive make invocations in liboctave and libinterp directories
John W. Eaton <jwe@octave.org>
parents: 19731
diff changeset
96 printf (" liboctave/operators/%s", cc_file);
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
97 next;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
98 }
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
99
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
100 if (list_h_files)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
101 {
20362
0ce7d8303152 eliminate recursive make invocations in liboctave and libinterp directories
John W. Eaton <jwe@octave.org>
parents: 19731
diff changeset
102 printf (" liboctave/operators/%s", h_file);
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
103 next;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
104 }
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
105
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
106 if (make_inclusive_header)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
107 {
4547
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
108 printf ("#include \"%s\"\n", h_file);
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
109 next;
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
110 }
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
111
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
112 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
113
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
114 result_num = rev_tag[result_tag];
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
115 lhs_num = rev_tag[lhs_tag];
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
116 rhs_num = rev_tag[rhs_tag];
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
117
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
118 result_type = type[result_num];
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
119 lhs_type = type[lhs_num];
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
120 rhs_type = type[rhs_num];
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
121
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
122 lhs_core_type = core_type[lhs_num];
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
123 rhs_core_type = core_type[rhs_num];
6119
fabb1be5fd84 [project @ 2006-10-28 00:13:58 by jwe]
jwe
parents: 5030
diff changeset
124
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
125 result_scalar_zero_val = scalar_zero_val[result_num];
5030
160365410ad4 [project @ 2004-09-24 03:22:23 by jwe]
jwe
parents: 4964
diff changeset
126 lhs_scalar_zero_val = scalar_zero_val[lhs_num];
160365410ad4 [project @ 2004-09-24 03:22:23 by jwe]
jwe
parents: 4964
diff changeset
127 rhs_scalar_zero_val = scalar_zero_val[rhs_num];
160365410ad4 [project @ 2004-09-24 03:22:23 by jwe]
jwe
parents: 4964
diff changeset
128
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
129 result_header = header[result_num];
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
130 lhs_header = header[lhs_num];
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
131 rhs_header = header[rhs_num];
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
132
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
133 lhs_class = class[lhs_num];
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
134 rhs_class = class[rhs_num];
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 print "// DO NOT EDIT -- generated by mk-ops" > h_file;
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
137
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
138 printf ("#if !defined (%s)\n", h_guard) >> h_file;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
139 printf ("#define %s 1\n", h_guard) >> h_file;
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
140
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
141 if (result_header)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
142 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
143 if (result_fwd_decl_ok)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
144 printf ("class %s\n", result_type) >> h_file;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
145 else
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
146 printf ("#include \"%s\"\n", result_header) >> h_file;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
147 }
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
148
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
149 if (lhs_header && ! (lhs_header == result_header))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
150 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
151 if (result_fwd_decl_ok)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
152 printf ("class %s\n", lhs_type) >> h_file;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
153 else
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
154 printf ("#include \"%s\"\n", lhs_header) >> h_file;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
155 }
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
156
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
157 if (rhs_header && ! (rhs_header == lhs_header || rhs_header == result_header))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
158 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
159 if (result_fwd_decl_ok)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
160 printf ("class %s\n", rhs_type) >> h_file;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
161 else
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
162 printf ("#include \"%s\"\n", rhs_header) >> h_file;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
163 }
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
164
8774
b756ce0002db split implementation and interface in mx-op-defs and MArray-defs
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
165 printf ("#include \"mx-op-decl.h\"\n") >> h_file;
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
166
4964
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4669
diff changeset
167 if (bin_ops)
6708
0ce71beb1cf3 [project @ 2007-06-13 06:40:48 by jwe]
jwe
parents: 6119
diff changeset
168 printf ("%s%s_BIN_OP_DECLS (%s, %s, %s, OCTAVE_API)\n", lhs_class,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
169 rhs_class, result_type, lhs_type, rhs_type) >> h_file
4964
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4669
diff changeset
170
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4669
diff changeset
171 if (cmp_ops)
6708
0ce71beb1cf3 [project @ 2007-06-13 06:40:48 by jwe]
jwe
parents: 6119
diff changeset
172 printf ("%s%s_CMP_OP_DECLS (%s, %s, OCTAVE_API)\n", lhs_class,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
173 rhs_class, lhs_type, rhs_type) >> h_file
4964
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4669
diff changeset
174
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4669
diff changeset
175 if (bool_ops)
6708
0ce71beb1cf3 [project @ 2007-06-13 06:40:48 by jwe]
jwe
parents: 6119
diff changeset
176 printf ("%s%s_BOOL_OP_DECLS (%s, %s, OCTAVE_API)\n", lhs_class,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
177 rhs_class, lhs_type, rhs_type) >> h_file
4964
269c3d6c0569 [project @ 2004-09-04 01:16:28 by jwe]
jwe
parents: 4669
diff changeset
178
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
179
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
180 print "#endif" >> h_file;
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
181
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
182 close (h_file);
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
183
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
184
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
185 print "// DO NOT EDIT -- generated by mk-ops" > cc_file;
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
186
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
187 print "#ifdef HAVE_CONFIG_H" >> cc_file;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
188 print "#include <config.h>" >> cc_file;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
189 print "#endif" >> cc_file;
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
190
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
191 print "#include \"Array-util.h\"" >> cc_file;
4669
334a27c8f453 [project @ 2003-11-26 07:02:42 by jwe]
jwe
parents: 4585
diff changeset
192
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
193 printf ("#include \"%s\"\n", h_file) >> cc_file;
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
194
8774
b756ce0002db split implementation and interface in mx-op-defs and MArray-defs
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
195 printf ("#include \"mx-op-defs.h\"\n") >> cc_file;
b756ce0002db split implementation and interface in mx-op-defs and MArray-defs
Jaroslav Hajek <highegg@gmail.com>
parents: 7019
diff changeset
196
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
197 for (i in bool_headers)
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
198 {
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
199 printf ("#include \"%s\"\n", bool_headers[i]) >> cc_file;
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
200 delete bool_headers[i];
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
201 }
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
202
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
203 if (result_header)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
204 printf ("#include \"%s\"\n", result_header) >> cc_file;
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
205
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
206 if (lhs_header && ! (lhs_header == result_header))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
207 printf ("#include \"%s\"\n", lhs_header) >> cc_file;
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
208
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
209 if (rhs_header && ! (rhs_header == lhs_header || rhs_header == result_header))
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
210 printf ("#include \"%s\"\n", rhs_header) >> cc_file;
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
211
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
212 if (bin_ops)
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
213 {
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
214 if ((lhs_class == "DM" && rhs_class == "M") || (lhs_class == "M" && rhs_class == "DM"))
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
215 printf ("%s%s_BIN_OPS (%s, %s, %s, %s)\n",
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
216 lhs_class, rhs_class, result_type,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
217 lhs_type, rhs_type, result_scalar_zero_val) >> cc_file
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
218 else
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
219 printf ("%s%s_BIN_OPS (%s, %s, %s)\n",
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
220 lhs_class, rhs_class, result_type,
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
221 lhs_type, rhs_type) >> cc_file
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
222 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
223
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
224 if (cmp_ops)
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
225 printf ("%s%s_CMP_OPS (%s, %s)\n",
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
226 lhs_class, rhs_class, lhs_type, rhs_type) >> cc_file
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
227
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
228 if (bool_ops)
9550
3d6a9aea2aea refactor binary & bool ops in liboctave
Jaroslav Hajek <highegg@gmail.com>
parents: 8920
diff changeset
229 printf ("%s%s_BOOL_OPS (%s, %s)\n", lhs_class, rhs_class,
10317
42d098307c30 untabify additional source files
John W. Eaton <jwe@octave.org>
parents: 9578
diff changeset
230 lhs_type, rhs_type) >> cc_file
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
231
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
232
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
233 close (cc_file);
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
234 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
235 else
19627
446c46af4b42 strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents: 17744
diff changeset
236 printf ("skipping line %d: %s\n", NR, $0);
4544
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
237 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
238 }
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
239 END {
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
240 if (make_inclusive_header)
74c92e375b54 [project @ 2003-10-23 23:48:29 by jwe]
jwe
parents:
diff changeset
241 print "#endif";
4547
308feb0e5646 [project @ 2003-10-25 01:59:15 by jwe]
jwe
parents: 4544
diff changeset
242 }