annotate liboctave/system/cmach-info.c @ 33636:3ec6fcce7715 default tip @

gui: Avoid using HAVE_QSCINTILLA in more header files. * gui-settings.h, settings-dialog.h: Don't include QScintilla header. Forward-declare QSciLexer class instead if necessary. Declare all member functions unconditionally. * gui-settings.cc (gui_settings::get_valid_lexer_styles, gui_settings::read_lexer_settings), settings-dialog.cc (settings_dialog::update_lexer, settings_dialog::get_lexer_settings, settings_dialog::write_lexer_settings): Define functions unconditionally. * gui-preferences-ed.h: Don't include QScintilla header. Remove definition of local variable os_eol_mode from header. * gui-preferences-ed.cc (os_eol_mode): Move definition of local variable here.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 28 May 2024 14:54:58 +0200
parents 2e484f9f1f18
children
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 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
32632
2e484f9f1f18 maint: update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 31706
diff changeset
3 // Copyright (C) 1996-2024 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
23820
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 #if defined (HAVE_CONFIG_H)
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 # include "config.h"
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 #endif
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30 #include <stdint.h>
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 #include "cmach-info.h"
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 #include "f77-fcn.h"
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 extern double F77_FUNC (d1mach, D1MACH) (const F77_INT*);
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 typedef union
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 {
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 double d;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 int32_t i[2];
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 } equiv;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 typedef struct
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 {
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 int fp_fmt;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46 equiv fp_par[4];
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 } float_params;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 #define INIT_FLT_PAR(fp, fmt, sm1, sm2, lrg1, lrg2, rt1, rt2, dv1, dv2) \
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 do \
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 { \
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 fp.fp_fmt = (fmt); \
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 fp.fp_par[0].i[0] = (sm1); fp.fp_par[0].i[1] = (sm2); \
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 fp.fp_par[1].i[0] = (lrg1); fp.fp_par[1].i[1] = (lrg2); \
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 fp.fp_par[2].i[0] = (rt1); fp.fp_par[2].i[1] = (rt2); \
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 fp.fp_par[3].i[0] = (dv1); fp.fp_par[3].i[1] = (dv2); \
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57 } \
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58 while (0)
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60 static int equiv_compare (const equiv *std, const equiv *v, int len)
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 {
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 int i;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63 for (i = 0; i < len; i++)
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64 if (v[i].i[0] != std[i].i[0] || v[i].i[1] != std[i].i[1])
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 return 0;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 return 1;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 }
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 // Return 0 if the floating point format is unknown, 1 if it is IEEE
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 // little endian, or 2 if it is IEEE big endian.
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 //
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 // If the return values change, you must also change the values of the
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 // float format enum in mach-info.h and the correspondence between the
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74 // integer and enum values in octave::mach_info::get_float_format.
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76 int
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77 octave_get_float_format (void)
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 {
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 int retval = 0;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 float_params fp[3];
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83 INIT_FLT_PAR (fp[0], 1,
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
84 0, 1048576,
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85 -1, 2146435071,
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
86 0, 1017118720,
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
87 0, 1018167296);
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
88
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89 INIT_FLT_PAR (fp[1], 2,
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90 1048576, 0,
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
91 2146435071, -1,
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92 1017118720, 0,
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
93 1018167296, 0);
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
94
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
95 INIT_FLT_PAR (fp[2], 0,
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
96 0, 0,
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
97 0, 0,
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
98 0, 0,
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
99 0, 0);
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
101 equiv mach_fp_par[4];
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
102
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
103 F77_INT opt;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
104
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
105 opt = 1;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
106 mach_fp_par[0].d = F77_FUNC (d1mach, D1MACH) (&opt);
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
107
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
108 opt = 2;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
109 mach_fp_par[1].d = F77_FUNC (d1mach, D1MACH) (&opt);
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
110
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
111 opt = 3;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
112 mach_fp_par[2].d = F77_FUNC (d1mach, D1MACH) (&opt);
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
114 opt = 4;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
115 mach_fp_par[3].d = F77_FUNC (d1mach, D1MACH) (&opt);
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
116
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
117 int i = 0;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
118 do
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
119 {
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120 if (equiv_compare (fp[i].fp_par, mach_fp_par, 4))
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
121 {
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
122 retval = fp[i].fp_fmt;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
123 break;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
124 }
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
125 }
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
126 while (fp[++i].fp_fmt != 0);
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
127
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
128 return retval;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129 }
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
130
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
131 int
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
132 octave_is_big_endian (void)
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
133 {
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
134 // Are we little or big endian? From Harbison & Steele.
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
135
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
136 union
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
137 {
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
138 long l;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
139 char c[sizeof (long)];
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
140 } u;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
141
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
142 u.l = 1;
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
143
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
144 return (u.c[sizeof (long) - 1] == 1);
1a08d0ac510f move union field type punning code to C (bug #51638)
John W. Eaton <jwe@octave.org>
parents:
diff changeset
145 }