Debian Codegraph @

hdlcutil/smdiag.c

raw symbols SCIP
1 /*****************************************************************************/cxx . . $ `<file>/hdlcutil/smdiag.c`/
2
3 /*
4 * smdiag.c -- kernel soundcard radio modem driver diagnostics utility.
5 *
6 * Copyright (C) 1996,1997,2000 Thomas Sailer ([email protected])
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
21 * 02110-1301, USA.
22 *
23 * Please note that the GPL allows you to use the driver, NOT the radio.
24 * In order to use the radio, you need a license from the communications
25 * authority of your country.
26 *
27 *
28 * History:
29 * 0.1 26.06.1996 Started
30 * 0.2 11.05.1997 introduced hdrvcomm.h
31 * 0.3 05.01.2000 glibc compile fixes
32 */
33
34 /*****************************************************************************/
35
36 #include <stdlib.h>
37 #include <stdio.h>
38 #include <errno.h>
39 #include <sys/time.h>
40 #include <sys/types.h>
41 #include <sys/stat.h>
42 #include <fcntl.h>
43 #include <unistd.h>
44 #include <string.h>
45 #include <limits.h>
46 #include <net/if.h>
47 #include <X11/X.h>
48 #include <X11/Xlib.h>
49 #include <X11/Xutil.h>
50 #include "hdrvcomm.h"cxx . . $ `<file>/hdlcutil/hdrvcomm.h`/
51
52 #include <config.h>cxx . . $ `<file>/config.h`/
53 #include <scm-version.h>cxx . . $ `<file>/scm-version.h`/
54
55 /* ---------------------------------------------------------------------- */
56
57 static char *prognamecxx . . $ progname.;
58 static Displaycxx . . $ Display# *displaycxx . . $ display.;
59 static Windowcxx . . $ Window# windowcxx . . $ window.;
60 static Pixmapcxx . . $ Pixmap# pixmapcxx . . $ pixmap.;
61 static unsigned long col_zerolinecxx . . $ col_zeroline.;
62 static unsigned long col_backgroundcxx . . $ col_background.;
63 static unsigned long col_tracecxx . . $ col_trace.;
64 static GCcxx . . $ GC# gr_contextcxx . . $ gr_context.;
65 static int xmulcxx . . $ xmul.;
66
67 /* ---------------------------------------------------------------------- */
68
69 static int x_error_handlercxx . . $ x_error_handler(be6f75432f619949).(Displaycxx . . $ Display# *disp, XErrorEventcxx . . $ XErrorEvent# *evt)
70 {
71 char err_buf[256], mesg[256], number[256];
72 char *mtype = "XlibMessage";
73
74 XGetErrorTextcxx . . $ XGetErrorText(154de8ee31c64074).(disp, evt->error_codecxx . . $ $anonymous_type_17d7f07cf933eea7_52#error_code., err_buf, sizeof(err_buf));
75 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "X Error: %s\n", err_buf);
76 XGetErrorDatabaseTextcxx . . $ XGetErrorDatabaseText(3552b71b0e642321).(disp, mtype, "MajorCode", "Request Major code %d",
77 mesg, sizeof(mesg));
78 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, mesg, evt->request_codecxx . . $ $anonymous_type_17d7f07cf933eea7_52#request_code.);
79 sprintfcxx . . $ sprintf(26c8642d26409d6d).(number, "%d", evt->request_codecxx . . $ $anonymous_type_17d7f07cf933eea7_52#request_code.);
80 XGetErrorDatabaseTextcxx . . $ XGetErrorDatabaseText(3552b71b0e642321).(disp, "XRequest", number, "", err_buf,
81 sizeof(err_buf));
82 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, " (%s)\n", err_buf);
83 abortcxx . . $ abort(8df32a62017fbbf6).();
84 }
85
86 /* ---------------------------------------------------------------------- */
87
88 #define WIDTHcxx . . $ `hdlcutil/smdiag.c:88:9`! 512
89 #define HEIGHTcxx . . $ `hdlcutil/smdiag.c:89:9`! (constell ? 512 : 256)
90
91 static int openwindowcxx . . $ openwindow(fa3df6d5de4c4541).(char *disp, int constell, int samplesperbit)
92 {
93 XSetWindowAttributescxx . . $ XSetWindowAttributes# attr;
94 XGCValuescxx . . $ XGCValues# gr_values;
95 XColorcxx . . $ XColor# color, dummy;
96 XSizeHintscxx . . $ XSizeHints# sizehints;
97
98 displaycxx . . $ display. = XOpenDisplaycxx . . $ XOpenDisplay(f2c82aea04a05a19).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
99 if (!displaycxx . . $ display.)
100 return -1;
101 XSetErrorHandlercxx . . $ XSetErrorHandler(5a8e06d121cf0aa8).(x_error_handlercxx . . $ x_error_handler(be6f75432f619949).);
102 XAllocNamedColorcxx . . $ XAllocNamedColor(dc4235180b29d4b2).(displaycxx . . $ display., DefaultColormapcxx . . $ `<external>/7073035915403465041/Xlib.h:110:9`!(display, 0), "red",
103 &color, &dummy);
104 col_zerolinecxx . . $ col_zeroline. = color.pixelcxx . . $ $anonymous_type_17d7f07cf933eea7_12#pixel.;
105 col_backgroundcxx . . $ col_background. = WhitePixelcxx . . $ `<external>/7073035915403465041/Xlib.h:94:9`!(display, 0);
106 col_tracecxx . . $ col_trace. = BlackPixelcxx . . $ `<external>/7073035915403465041/Xlib.h:93:9`!(display, 0);
107 attr.background_pixelcxx . . $ $anonymous_type_17d7f07cf933eea7_7#background_pixel. = col_backgroundcxx . . $ col_background.;
108 windowcxx . . $ window. = XCreateWindowcxx . . $ XCreateWindow(fa7f8352c846d326).(displaycxx . . $ display., XRootWindowcxx . . $ XRootWindow(87141f1aff7122b9).(displaycxx . . $ display., 0), 200, 200,
109 WIDTHcxx . . $ `hdlcutil/smdiag.c:88:9`!, HEIGHTcxx . . $ `hdlcutil/smdiag.c:89:9`!, 5, DefaultDepthcxx . . $ `<external>/7073035915403465041/Xlib.h:109:9`!(display, 0),
110 InputOutputcxx . . $ `<external>/1208737181511191802/X.h:387:9`!, DefaultVisualcxx . . $ `<external>/7073035915403465041/Xlib.h:91:9`!(display, 0),
111 CWBackPixelcxx . . $ `<external>/1208737181511191802/X.h:393:9`!, &attr);
112 if (!windowcxx . . $ window.) {
113 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "smdiag: unable to open X window\n");
114 exitcxx . . $ exit(3ca292c338df9bb3).(1);
115 }
116 pixmapcxx . . $ pixmap. = XCreatePixmapcxx . . $ XCreatePixmap(22c037a85c11f920).(displaycxx . . $ display., windowcxx . . $ window., WIDTHcxx . . $ `hdlcutil/smdiag.c:88:9`!, HEIGHTcxx . . $ `hdlcutil/smdiag.c:89:9`!,
117 DefaultDepthcxx . . $ `<external>/7073035915403465041/Xlib.h:109:9`!(display, 0));
118 if (!pixmapcxx . . $ pixmap.) {
119 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "smdiag: unable to open offscreen pixmap\n");
120 exitcxx . . $ exit(3ca292c338df9bb3).(1);
121 }
122 xmulcxx . . $ xmul. = WIDTHcxx . . $ `hdlcutil/smdiag.c:88:9`! / (2*(samplesperbit > 0 ? samplesperbit : 1));
123 XSelectInputcxx . . $ XSelectInput(7df10027c125095f).(displaycxx . . $ display., windowcxx . . $ window., KeyPressMaskcxx . . $ `<external>/1208737181511191802/X.h:151:9`! | StructureNotifyMaskcxx . . $ `<external>/1208737181511191802/X.h:168:9`!
124 | ExposureMaskcxx . . $ `<external>/1208737181511191802/X.h:166:9`!) ;
125 XAllocNamedColorcxx . . $ XAllocNamedColor(dc4235180b29d4b2).(displaycxx . . $ display., DefaultColormapcxx . . $ `<external>/7073035915403465041/Xlib.h:110:9`!(display, 0), "red",
126 &color, &dummy);
127 gr_values.foregroundcxx . . $ $anonymous_type_17d7f07cf933eea7_2#foreground. = col_tracecxx . . $ col_trace.;
128 gr_values.line_widthcxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_width. = 1;
129 gr_values.line_stylecxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_style. = LineSolidcxx . . $ `<external>/1208737181511191802/X.h:504:9`!;
130 gr_contextcxx . . $ gr_context. = XCreateGCcxx . . $ XCreateGC(183ad189da2d988e).(displaycxx . . $ display., windowcxx . . $ window., GCForegroundcxx . . $ `<external>/1208737181511191802/X.h:566:9`! | GCLineWidthcxx . . $ `<external>/1208737181511191802/X.h:568:9`! |
131 GCLineStylecxx . . $ `<external>/1208737181511191802/X.h:569:9`!, &gr_values);
132 XStoreNamecxx . . $ XStoreName(586116e7f6532429).(displaycxx . . $ display., windowcxx . . $ window., "diagnostics");
133 /*
134 * Do not allow the window to be resized
135 */
136 memsetcxx . . $ memset(d1de1e4fb215f1c6).(&sizehints, 0, sizeof(sizehints));
137 sizehints.min_widthcxx . . $ $anonymous_type_c787e362e16f063b_0#min_width. = sizehints.max_widthcxx . . $ $anonymous_type_c787e362e16f063b_0#max_width. = WIDTHcxx . . $ `hdlcutil/smdiag.c:88:9`!;
138 sizehints.min_heightcxx . . $ $anonymous_type_c787e362e16f063b_0#min_height. = sizehints.max_heightcxx . . $ $anonymous_type_c787e362e16f063b_0#max_height. = HEIGHTcxx . . $ `hdlcutil/smdiag.c:89:9`!;
139 sizehints.flagscxx . . $ $anonymous_type_c787e362e16f063b_0#flags. = PMinSizecxx . . $ `<external>/9110752858362169270/Xutil.h:107:9`! | PMaxSizecxx . . $ `<external>/9110752858362169270/Xutil.h:108:9`!;
140 XSetWMNormalHintscxx . . $ XSetWMNormalHints(a3cc4db016dec141).(displaycxx . . $ display., windowcxx . . $ window., &sizehints);
141 XMapWindowcxx . . $ XMapWindow(5223c1f954fb9eb9).(displaycxx . . $ display., windowcxx . . $ window.);
142 XSynchronizecxx . . $ XSynchronize(637c0b4657183fd).(displaycxx . . $ display., 1);
143 return 0;
144 }
145
146 #undef WIDTHcxx . . $ `hdlcutil/smdiag.c:88:9`!
147 #undef HEIGHTcxx . . $ `hdlcutil/smdiag.c:89:9`!
148
149 /* ---------------------------------------------------------------------- */
150
151 static void closewindowcxx . . $ closewindow(49f6e7a06ebc5aa8).(void)
152 {
153 if (!displaycxx . . $ display.)
154 return;
155 XDestroyWindowcxx . . $ XDestroyWindow(5223c1f954fb9eb9).(displaycxx . . $ display., windowcxx . . $ window.);
156 XCloseDisplaycxx . . $ XCloseDisplay(62a385dbb0483707).(displaycxx . . $ display.);
157 displaycxx . . $ display. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
158 }
159
160 /* ---------------------------------------------------------------------- */
161
162 #define XCOORDcxx . . $ `hdlcutil/smdiag.c:162:9`!(x) ((x) * xm)
163 #define YCOORDcxx . . $ `hdlcutil/smdiag.c:163:9`!(y) ((SHRT_MAXcxx . . $ `<external>/67164224788392828/limits.h:106:9`! - (int)(y)) * winattrs.height / USHRT_MAXcxx . . $ `<external>/67164224788392828/limits.h:113:10`!)
164
165 static void drawdatacxx . . $ drawdata(838890671440a482).(short *data, int len, int replace, int xm)
166 {
167 int cnt;
168 GCcxx . . $ GC# gc;
169 XGCValuescxx . . $ XGCValues# gcv;
170 XWindowAttributescxx . . $ XWindowAttributes# winattrs;
171
172 if (!displaycxx . . $ display. || !pixmapcxx . . $ pixmap.)
173 return;
174 XGetWindowAttributescxx . . $ XGetWindowAttributes(5c1303d7cbd27958).(displaycxx . . $ display., windowcxx . . $ window., &winattrs);
175 gcv.line_widthcxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_width. = 1;
176 gcv.line_stylecxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_style. = LineSolidcxx . . $ `<external>/1208737181511191802/X.h:504:9`!;
177 gc = XCreateGCcxx . . $ XCreateGC(183ad189da2d988e).(displaycxx . . $ display., pixmapcxx . . $ pixmap., GCLineWidthcxx . . $ `<external>/1208737181511191802/X.h:568:9`! | GCLineStylecxx . . $ `<external>/1208737181511191802/X.h:569:9`!, &gcv);
178 XSetStatecxx . . $ XSetState(c4204ca1b4a77528).(displaycxx . . $ display., gc, col_backgroundcxx . . $ col_background., col_backgroundcxx . . $ col_background., GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!,
179 AllPlanescxx . . $ `<external>/7073035915403465041/Xlib.h:95:9`!);
180 if (replace)
181 XFillRectanglecxx . . $ XFillRectangle(be8231154a6fb35c).(displaycxx . . $ display., pixmapcxx . . $ pixmap., gc, 0, 0,
182 winattrs.widthcxx . . $ $anonymous_type_17d7f07cf933eea7_8#width., winattrs.heightcxx . . $ $anonymous_type_17d7f07cf933eea7_8#height.);
183 else
184 XCopyAreacxx . . $ XCopyArea(6b1ba6de71507f13).(displaycxx . . $ display., windowcxx . . $ window., pixmapcxx . . $ pixmap., gr_contextcxx . . $ gr_context., 0, 0,
185 winattrs.widthcxx . . $ $anonymous_type_17d7f07cf933eea7_8#width., winattrs.heightcxx . . $ $anonymous_type_17d7f07cf933eea7_8#height., 0, 0);
186 XSetForegroundcxx . . $ XSetForeground(d7c9d36fcaf627b2).(displaycxx . . $ display., gc, col_tracecxx . . $ col_trace.);
187 for (cnt = 0; cnt < len-1; cnt++)
188 XDrawLinecxx . . $ XDrawLine(b8fafa137e0dc2f).(displaycxx . . $ display., pixmapcxx . . $ pixmap., gc, XCOORDcxx . . $ `hdlcutil/smdiag.c:162:9`!(cnt), YCOORDcxx . . $ `hdlcutil/smdiag.c:163:9`!(data[cnt]),
189 XCOORDcxx . . $ `hdlcutil/smdiag.c:162:9`!(cnt+1), YCOORDcxx . . $ `hdlcutil/smdiag.c:163:9`!(data[cnt+1]));
190 XSetForegroundcxx . . $ XSetForeground(d7c9d36fcaf627b2).(displaycxx . . $ display., gc, col_zerolinecxx . . $ col_zeroline.);
191 XDrawLinecxx . . $ XDrawLine(b8fafa137e0dc2f).(displaycxx . . $ display., pixmapcxx . . $ pixmap., gc, 0, YCOORDcxx . . $ `hdlcutil/smdiag.c:163:9`!(0), winattrs.widthcxx . . $ $anonymous_type_17d7f07cf933eea7_8#width.,
192 YCOORDcxx . . $ `hdlcutil/smdiag.c:163:9`!(0));
193 XCopyAreacxx . . $ XCopyArea(6b1ba6de71507f13).(displaycxx . . $ display., pixmapcxx . . $ pixmap., windowcxx . . $ window., gr_contextcxx . . $ gr_context., 0, 0, winattrs.widthcxx . . $ $anonymous_type_17d7f07cf933eea7_8#width.,
194 winattrs.heightcxx . . $ $anonymous_type_17d7f07cf933eea7_8#height., 0, 0);
195 XFreeGCcxx . . $ XFreeGC(92f5b971658625f7).(displaycxx . . $ display., gc);
196 XSynccxx . . $ XSync(3212536831777fd4).(displaycxx . . $ display., 0);
197 }
198
199 #undef XCOORDcxx . . $ `hdlcutil/smdiag.c:162:9`!
200 #undef YCOORDcxx . . $ `hdlcutil/smdiag.c:163:9`!
201
202 /* ---------------------------------------------------------------------- */
203
204 #define XCOORDcxx . . $ `hdlcutil/smdiag.c:204:9`!(x) ((SHRT_MAXcxx . . $ `<external>/67164224788392828/limits.h:106:9`! - (int)(x)) * winattrs.width / USHRT_MAXcxx . . $ `<external>/67164224788392828/limits.h:113:10`!)
205 #define YCOORDcxx . . $ `hdlcutil/smdiag.c:205:9`!(y) ((SHRT_MAXcxx . . $ `<external>/67164224788392828/limits.h:106:9`! - (int)(y)) * winattrs.height / USHRT_MAXcxx . . $ `<external>/67164224788392828/limits.h:113:10`!)
206
207 static void drawconstellcxx . . $ drawconstell(4683f455c3e046d4).(short *data, int len)
208 {
209 int cnt;
210 GCcxx . . $ GC# gc;
211 XGCValuescxx . . $ XGCValues# gcv;
212 XWindowAttributescxx . . $ XWindowAttributes# winattrs;
213
214 if (!displaycxx . . $ display. || !pixmapcxx . . $ pixmap.)
215 return;
216 XGetWindowAttributescxx . . $ XGetWindowAttributes(5c1303d7cbd27958).(displaycxx . . $ display., windowcxx . . $ window., &winattrs);
217 gcv.line_widthcxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_width. = 1;
218 gcv.line_stylecxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_style. = LineSolidcxx . . $ `<external>/1208737181511191802/X.h:504:9`!;
219 gc = XCreateGCcxx . . $ XCreateGC(183ad189da2d988e).(displaycxx . . $ display., pixmapcxx . . $ pixmap., GCLineWidthcxx . . $ `<external>/1208737181511191802/X.h:568:9`! | GCLineStylecxx . . $ `<external>/1208737181511191802/X.h:569:9`!, &gcv);
220 XSetStatecxx . . $ XSetState(c4204ca1b4a77528).(displaycxx . . $ display., gc, col_backgroundcxx . . $ col_background., col_backgroundcxx . . $ col_background., GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!,
221 AllPlanescxx . . $ `<external>/7073035915403465041/Xlib.h:95:9`!);
222 XCopyAreacxx . . $ XCopyArea(6b1ba6de71507f13).(displaycxx . . $ display., windowcxx . . $ window., pixmapcxx . . $ pixmap., gr_contextcxx . . $ gr_context., 0, 0,
223 winattrs.widthcxx . . $ $anonymous_type_17d7f07cf933eea7_8#width., winattrs.heightcxx . . $ $anonymous_type_17d7f07cf933eea7_8#height., 0, 0);
224 XSetForegroundcxx . . $ XSetForeground(d7c9d36fcaf627b2).(displaycxx . . $ display., gc, col_tracecxx . . $ col_trace.);
225 for (cnt = 0; cnt < len-1; cnt += 2)
226 XDrawPointcxx . . $ XDrawPoint(6a9a44d64fe6b599).(displaycxx . . $ display., pixmapcxx . . $ pixmap., gc,
227 XCOORDcxx . . $ `hdlcutil/smdiag.c:204:9`!(data[cnt]), YCOORDcxx . . $ `hdlcutil/smdiag.c:205:9`!(data[cnt+1]));
228 XSetForegroundcxx . . $ XSetForeground(d7c9d36fcaf627b2).(displaycxx . . $ display., gc, col_zerolinecxx . . $ col_zeroline.);
229 XDrawLinecxx . . $ XDrawLine(b8fafa137e0dc2f).(displaycxx . . $ display., pixmapcxx . . $ pixmap., gc, 0, YCOORDcxx . . $ `hdlcutil/smdiag.c:205:9`!(0), winattrs.widthcxx . . $ $anonymous_type_17d7f07cf933eea7_8#width., YCOORDcxx . . $ `hdlcutil/smdiag.c:205:9`!(0));
230 XDrawLinecxx . . $ XDrawLine(b8fafa137e0dc2f).(displaycxx . . $ display., pixmapcxx . . $ pixmap., gc, XCOORDcxx . . $ `hdlcutil/smdiag.c:204:9`!(0), 0, XCOORDcxx . . $ `hdlcutil/smdiag.c:204:9`!(0), winattrs.heightcxx . . $ $anonymous_type_17d7f07cf933eea7_8#height.);
231 XCopyAreacxx . . $ XCopyArea(6b1ba6de71507f13).(displaycxx . . $ display., pixmapcxx . . $ pixmap., windowcxx . . $ window., gr_contextcxx . . $ gr_context., 0, 0, winattrs.widthcxx . . $ $anonymous_type_17d7f07cf933eea7_8#width.,
232 winattrs.heightcxx . . $ $anonymous_type_17d7f07cf933eea7_8#height., 0, 0);
233 XFreeGCcxx . . $ XFreeGC(92f5b971658625f7).(displaycxx . . $ display., gc);
234 XSynccxx . . $ XSync(3212536831777fd4).(displaycxx . . $ display., 0);
235 }
236
237 #undef XCOORDcxx . . $ `hdlcutil/smdiag.c:204:9`!
238 #undef YCOORDcxx . . $ `hdlcutil/smdiag.c:205:9`!
239
240 /* ---------------------------------------------------------------------- */
241
242 static void clearwindowcxx . . $ clearwindow(49f6e7a06ebc5aa8).(void)
243 {
244 XWindowAttributescxx . . $ XWindowAttributes# winattrs;
245 GCcxx . . $ GC# gc;
246 XGCValuescxx . . $ XGCValues# gcv;
247
248 if (!displaycxx . . $ display. || !pixmapcxx . . $ pixmap.)
249 return;
250 XGetWindowAttributescxx . . $ XGetWindowAttributes(5c1303d7cbd27958).(displaycxx . . $ display., windowcxx . . $ window., &winattrs);
251 gcv.line_widthcxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_width. = 1;
252 gcv.line_stylecxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_style. = LineSolidcxx . . $ `<external>/1208737181511191802/X.h:504:9`!;
253 gc = XCreateGCcxx . . $ XCreateGC(183ad189da2d988e).(displaycxx . . $ display., pixmapcxx . . $ pixmap., GCLineWidthcxx . . $ `<external>/1208737181511191802/X.h:568:9`! | GCLineStylecxx . . $ `<external>/1208737181511191802/X.h:569:9`!, &gcv);
254 XSetStatecxx . . $ XSetState(c4204ca1b4a77528).(displaycxx . . $ display., gc, col_backgroundcxx . . $ col_background., col_backgroundcxx . . $ col_background., GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!,
255 AllPlanescxx . . $ `<external>/7073035915403465041/Xlib.h:95:9`!);
256 XFillRectanglecxx . . $ XFillRectangle(be8231154a6fb35c).(displaycxx . . $ display., pixmapcxx . . $ pixmap., gc, 0, 0,
257 winattrs.widthcxx . . $ $anonymous_type_17d7f07cf933eea7_8#width., winattrs.heightcxx . . $ $anonymous_type_17d7f07cf933eea7_8#height.);
258 XSetForegroundcxx . . $ XSetForeground(d7c9d36fcaf627b2).(displaycxx . . $ display., gc, col_zerolinecxx . . $ col_zeroline.);
259 XClearAreacxx . . $ XClearArea(66297347daac3894).(displaycxx . . $ display., windowcxx . . $ window., 0, 0, 0, 0, Falsecxx . . $ `<external>/7073035915403465041/Xlib.h:81:9`!);
260 XCopyAreacxx . . $ XCopyArea(6b1ba6de71507f13).(displaycxx . . $ display., pixmapcxx . . $ pixmap., windowcxx . . $ window., gr_contextcxx . . $ gr_context., 0, 0, winattrs.widthcxx . . $ $anonymous_type_17d7f07cf933eea7_8#width.,
261 winattrs.heightcxx . . $ $anonymous_type_17d7f07cf933eea7_8#height., 0, 0);
262 XFreeGCcxx . . $ XFreeGC(92f5b971658625f7).(displaycxx . . $ display., gc);
263 }
264
265 /* ---------------------------------------------------------------------- */
266
267 static Boolcxx . . $ `<external>/7073035915403465041/Xlib.h:78:9`! predicatecxx . . $ predicate(9f7fa3a1c1dbdd00).(Displaycxx . . $ Display# *display, XEventcxx . . $ XEvent# *event, char *arg)
268 {
269 return Truecxx . . $ `<external>/7073035915403465041/Xlib.h:80:9`!;
270 }
271
272 /* ---------------------------------------------------------------------- */
273
274 static char *getkeycxx . . $ getkey(41208ce6ca65dd58).(void)
275 {
276 XWindowAttributescxx . . $ XWindowAttributes# winattrs;
277 XEventcxx . . $ XEvent# evt;
278 static char kbuf[32];
279 int i;
280
281 if (!displaycxx . . $ display.)
282 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
283 XSynccxx . . $ XSync(3212536831777fd4).(displaycxx . . $ display., 0);
284 while (XCheckIfEventcxx . . $ XCheckIfEvent(dd18a786f03f74be).(displaycxx . . $ display., &evt, predicatecxx . . $ predicate(9f7fa3a1c1dbdd00)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)) {
285 switch (evt.typecxx . . $ _XEvent#type.) {
286 case KeyPresscxx . . $ `<external>/1208737181511191802/X.h:181:9`!:
287 i = XLookupStringcxx . . $ XLookupString(c7d91eefa64f0b1c).((XKeyEventcxx . . $ XKeyEvent# *)&evt, kbuf, sizeof(kbuf)-1,
288 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
289 if (!i)
290 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
291 kbuf[i] = 0;
292 return kbuf;
293 case DestroyNotifycxx . . $ `<external>/1208737181511191802/X.h:196:9`!:
294 XCloseDisplaycxx . . $ XCloseDisplay(62a385dbb0483707).(displaycxx . . $ display.);
295 displaycxx . . $ display. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
296 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
297 case Exposecxx . . $ `<external>/1208737181511191802/X.h:191:9`!:
298 XGetWindowAttributescxx . . $ XGetWindowAttributes(5c1303d7cbd27958).(displaycxx . . $ display., windowcxx . . $ window., &winattrs);
299 XCopyAreacxx . . $ XCopyArea(6b1ba6de71507f13).(displaycxx . . $ display., pixmapcxx . . $ pixmap., windowcxx . . $ window., gr_contextcxx . . $ gr_context., 0, 0,
300 winattrs.widthcxx . . $ $anonymous_type_17d7f07cf933eea7_8#width., winattrs.heightcxx . . $ $anonymous_type_17d7f07cf933eea7_8#height., 0, 0);
301 break;
302 default:
303 break;
304 }
305 }
306 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
307 }
308
309 /* ---------------------------------------------------------------------- */
310
311 static void printmodecxx . . $ printmode(b4d55b1286ff73e8).(unsigned int mode, unsigned int trigger)
312 {
313 printfcxx . . $ printf(581fddd72a8db8fc).("Source: %s%s\n", (mode == SM_DIAGMODE_DEMODcxx . . $ `hdlcutil/soundmodem.h:59:9`!) ?
314 "demodulator (eye diagram)" : "input (oscilloscope)",
315 (trigger & SM_DIAGFLAG_DCDGATEcxx . . $ `hdlcutil/soundmodem.h:65:9`!) ? " gated with DCD" : "");
316 }
317
318 /* ---------------------------------------------------------------------- */
319
320 static const char *usage_strcxx . . $ usage_str. =
321 "[-d display] [-i smif] [-c] [-e]\n"
322 " -d: display host\n"
323 " -i: specify the name of the baycom kernel driver interface\n"
324 " -c: toggle carrier trigger\n"
325 " -e: eye diagram mode\n\n"
326 " -p: constellation plot\n\n";
327
328 int maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[])
329 {
330 char *disp = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
331 unsigned int mode = HDRVC_DIAGMODE_INPUTcxx . . $ `hdlcutil/hdrvcomm.h:71:9`!;
332 unsigned int trigger = 0;
333 unsigned int ifflags;
334 short data[256];
335 char *cp;
336 int ret;
337 unsigned int samplesperbit;
338
339 prognamecxx . . $ progname. = *argv;
340 printfcxx . . $ printf(581fddd72a8db8fc).("%s: Version " FULL_VERcxx . . $ `scm-version.h:6:9`! "; (C) 1996-1997 by Thomas Sailer HB9JNX/AE4WA\n", *argv);
341 hdrvc_argscxx . . $ hdrvc_args(de06760a4a38ab9).(&argc, argv, "sm0");
342 while ((ret = getoptcxx . . $ getopt(2483c31ff9bab884).(argc, argv, "d:ecp")) != -1) {
343 switch (ret) {
344 case 'd':
345 disp = optargcxx . . $ optarg.;
346 break;
347 case 'e':
348 mode = HDRVC_DIAGMODE_DEMODcxx . . $ `hdlcutil/hdrvcomm.h:72:9`!;
349 trigger = HDRVC_DIAGFLAG_DCDGATEcxx . . $ `hdlcutil/hdrvcomm.h:78:9`!;
350 break;
351 case 'c':
352 trigger ^= HDRVC_DIAGFLAG_DCDGATEcxx . . $ `hdlcutil/hdrvcomm.h:78:9`!;
353 break;
354 case 'p':
355 mode = HDRVC_DIAGMODE_CONSTELLATIONcxx . . $ `hdlcutil/hdrvcomm.h:73:9`!;
356 break;
357 default:
358 printfcxx . . $ printf(581fddd72a8db8fc).("usage: %s %s", *argv, usage_strcxx . . $ usage_str.);
359 exitcxx . . $ exit(3ca292c338df9bb3).(-1);
360 }
361 }
362 hdrvc_initcxx . . $ hdrvc_init(49f6e7a06ebc5aa8).();
363 ifflags = hdrvc_get_ifflagscxx . . $ hdrvc_get_ifflags(db52760e79bf9054).();
364 if (!(ifflags & IFF_UPcxx . . $ `<external>/2638090476884991293/if.h:45:10`!)) {
365 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "interface %s down\n", hdrvc_ifnamecxx . . $ hdrvc_ifname(33a1f659e94feb42).());
366 exitcxx . . $ exit(3ca292c338df9bb3).(1);
367 }
368 if (!(ifflags & IFF_RUNNINGcxx . . $ `<external>/2638090476884991293/if.h:57:10`!)) {
369 fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "interface %s not running\n", hdrvc_ifnamecxx . . $ hdrvc_ifname(33a1f659e94feb42).());
370 exitcxx . . $ exit(3ca292c338df9bb3).(1);
371 }
372 printmodecxx . . $ printmode(b4d55b1286ff73e8).(mode, trigger);
373 for (;;) {
374 ret = hdrvc_diag2cxx . . $ hdrvc_diag2(2b48473033b61705).(mode, trigger, data,
375 sizeof(data) / sizeof(short),
376 &samplesperbit);
377 if (ret < 0) {
378 perrorcxx . . $ perror(85c52e162fed56f9).("hdrvc_diag2");
379 exitcxx . . $ exit(3ca292c338df9bb3).(1);
380 }
381 if (ret > 0) {
382 if (!displaycxx . . $ display.) {
383 openwindowcxx . . $ openwindow(fa3df6d5de4c4541).(disp, mode == HDRVC_DIAGMODE_CONSTELLATIONcxx . . $ `hdlcutil/hdrvcomm.h:73:9`!,
384 samplesperbit);
385 clearwindowcxx . . $ clearwindow(49f6e7a06ebc5aa8).();
386 }
387 if (mode == SM_DIAGMODE_CONSTELLATIONcxx . . $ `hdlcutil/soundmodem.h:60:9`!)
388 drawconstellcxx . . $ drawconstell(4683f455c3e046d4).(data, ret);
389 else
390 drawdatacxx . . $ drawdata(838890671440a482).(data, ret, mode == HDRVC_DIAGMODE_INPUTcxx . . $ `hdlcutil/hdrvcomm.h:71:9`!,
391 mode == HDRVC_DIAGMODE_INPUTcxx . . $ `hdlcutil/hdrvcomm.h:71:9`! ? 5:xmulcxx . . $ xmul.);
392 } else
393 usleepcxx . . $ usleep(4c679297bf94b9eb).(100000L);
394 if (displaycxx . . $ display.) {
395 cp = getkeycxx . . $ getkey(41208ce6ca65dd58).();
396 if (cp) {
397 for (; *cp; cp++) {
398 printfcxx . . $ printf(581fddd72a8db8fc).("char pressed: '%c'\n", *cp);
399 switch (*cp) {
400 case 'c':
401 case 'C':
402 clearwindowcxx . . $ clearwindow(49f6e7a06ebc5aa8).();
403 printmodecxx . . $ printmode(b4d55b1286ff73e8).(mode, trigger);
404 break;
405 case 'q':
406 case 'Q':
407 closewindowcxx . . $ closewindow(49f6e7a06ebc5aa8).();
408 break;
409 case 'i':
410 case 'I':
411 if (mode == HDRVC_DIAGMODE_CONSTELLATIONcxx . . $ `hdlcutil/hdrvcomm.h:73:9`!)
412 break;
413 mode = HDRVC_DIAGMODE_INPUTcxx . . $ `hdlcutil/hdrvcomm.h:71:9`!;
414 clearwindowcxx . . $ clearwindow(49f6e7a06ebc5aa8).();
415 printmodecxx . . $ printmode(b4d55b1286ff73e8).(mode, trigger);
416 break;
417 case 'e':
418 case 'E':
419 if (mode == HDRVC_DIAGMODE_CONSTELLATIONcxx . . $ `hdlcutil/hdrvcomm.h:73:9`!)
420 break;
421 mode = HDRVC_DIAGMODE_DEMODcxx . . $ `hdlcutil/hdrvcomm.h:72:9`!;
422 clearwindowcxx . . $ clearwindow(49f6e7a06ebc5aa8).();
423 printmodecxx . . $ printmode(b4d55b1286ff73e8).(mode, trigger);
424 break;
425 case 'd':
426 case 'D':
427 trigger ^= HDRVC_DIAGFLAG_DCDGATEcxx . . $ `hdlcutil/hdrvcomm.h:78:9`!;
428 clearwindowcxx . . $ clearwindow(49f6e7a06ebc5aa8).();
429 printmodecxx . . $ printmode(b4d55b1286ff73e8).(mode, trigger);
430 break;
431 }
432 }
433 }
434 if (!displaycxx . . $ display.)
435 exitcxx . . $ exit(3ca292c338df9bb3).(0);
436 }
437 }
438 }
439
440 /* ---------------------------------------------------------------------- */