| 1 | /*****************************************************************************/cxx . . $ `<file>/hdlcutil/fl/xfsmdiag_main.cxx`/ |
| 2 | |
| 3 | /* |
| 4 | * xfsmdiag.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 14.12.1996 Started |
| 30 | * 0.2 11.05.1997 introduced hdrvcomm.h |
| 31 | * 0.3 05.01.2000 upgraded to fltk 1.0.7 |
| 32 | */ |
| 33 | |
| 34 | /*****************************************************************************/ |
| 35 | |
| 36 | #include <stdlib.h> |
| 37 | #include <stdio.h> |
| 38 | #include <sys/time.h> |
| 39 | #include <sys/types.h> |
| 40 | #include <sys/stat.h> |
| 41 | #include <unistd.h> |
| 42 | #include <string.h> |
| 43 | #include <sys/types.h> |
| 44 | #include <limits.h> |
| 45 | #include <net/if.h> |
| 46 | #include <X11/X.h> |
| 47 | #include <X11/Xlib.h> |
| 48 | #include <X11/Xutil.h> |
| 49 | #include "hdrvcomm.h"cxx . . $ `<file>/hdlcutil/hdrvcomm.h`/ |
| 50 | #include "xfsmdiag.h"cxx . . $ `<file>/hdlcutil/fl/xfsmdiag.h`/ |
| 51 | #include <FL/x.H> |
| 52 | #include <FL/fl_draw.H> |
| 53 | |
| 54 | #include <config.h>cxx . . $ `<file>/config.h`/ |
| 55 | #include <scm-version.h>cxx . . $ `<file>/scm-version.h`/ |
| 56 | |
| 57 | /* ---------------------------------------------------------------------- */ |
| 58 | |
| 59 | static char *prognamecxx . . $ progname.; |
| 60 | static unsigned int drawflagscxx . . $ drawflags.; |
| 61 | |
| 62 | /* ---------------------------------------------------------------------- */ |
| 63 | |
| 64 | scopecxx . . $ scope#::scopecxx . . $ scope#scope(8c3222651be003c9).(int x, int y, int w, int h, const char *l) |
| 65 | : Fl_Boxcxx . . $ Fl_Box#(x, y, w, h, l) |
| 66 | { |
| 67 | boxcxx . . $ Fl_Widget#box(295d9e9c4fb469a4).(FL_DOWN_FRAMEcxx . . $ FL_DOWN_FRAME.); |
| 68 | Xcxx . . $ scope#X. = x+3; |
| 69 | Ycxx . . $ scope#Y. = y+4; |
| 70 | Wcxx . . $ scope#W. = w-6; |
| 71 | Hcxx . . $ scope#H. = h-8; |
| 72 | drawmodecxx . . $ scope#drawmode. = HDRVC_DIAGMODE_OFFcxx . . $ `hdlcutil/hdrvcomm.h:70:9`!; |
| 73 | pixmalloccxx . . $ scope#pixmalloc. = false; |
| 74 | hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).(); |
| 75 | } |
| 76 | |
| 77 | scopecxx . . $ scope#::~cxx . . $ scope#`~scope`(ced63f7c635d850d).scopecxx . . $ scope#() |
| 78 | { |
| 79 | if (pixmalloccxx . . $ scope#pixmalloc.) { |
| 80 | XFreePixmap(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap.); |
| 81 | pixmalloccxx . . $ scope#pixmalloc. = false; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | void scopecxx . . $ scope#::resizecxx . . $ scope#resize(748afa4755bc9595).(int xx, int yy, int ww, int hh) |
| 86 | { |
| 87 | if (pixmalloccxx . . $ scope#pixmalloc. && (ww != wcxx . . $ Fl_Widget#w(455f465bc33b4cdf).() || hh != hcxx . . $ Fl_Widget#h(455f465bc33b4cdf).())) { |
| 88 | XFreePixmap(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap.); |
| 89 | pixmalloccxx . . $ scope#pixmalloc. = false; |
| 90 | } |
| 91 | Xcxx . . $ scope#X. = xx+3; |
| 92 | Ycxx . . $ scope#Y. = yy+4; |
| 93 | Wcxx . . $ scope#W. = ww-6; |
| 94 | Hcxx . . $ scope#H. = hh-8; |
| 95 | Fl_Boxcxx . . $ Fl_Box#::resizecxx . . $ Fl_Widget#resize(748afa4755bc9595).(xx, yy, ww, hh); |
| 96 | } |
| 97 | |
| 98 | void scopecxx . . $ scope#::drawcxx . . $ scope#draw(49f6e7a06ebc5aa8).() |
| 99 | { |
| 100 | GCcxx . . $ GC# gc; |
| 101 | XGCValuescxx . . $ XGCValues# gcv; |
| 102 | |
| 103 | /* cannot use draw_box(); as it clears the whole window -> flicker */ |
| 104 | /* from fl_boxtype.C, fl_down_frame */ |
| 105 | if (Wcxx . . $ scope#W. > 0 && Hcxx . . $ scope#H. > 0) { |
| 106 | fl_colorcxx . . $ fl_color(cb2f890c2fdad230).(FL_DARK1cxx . . $ FL_DARK1.); fl_xylinecxx . . $ fl_xyline(b1146eedae1e1d0b).(Xcxx . . $ scope#X.-3, Ycxx . . $ scope#Y.-4, Xcxx . . $ scope#X.+Wcxx . . $ scope#W.+1); |
| 107 | fl_colorcxx . . $ fl_color(cb2f890c2fdad230).(FL_DARK2cxx . . $ FL_DARK2.); fl_yxlinecxx . . $ fl_yxline(748afa4755bc9595).(Xcxx . . $ scope#X.-3, Ycxx . . $ scope#Y.+Hcxx . . $ scope#H.+3, Ycxx . . $ scope#Y.-3, Xcxx . . $ scope#X.+Wcxx . . $ scope#W.+1); |
| 108 | fl_colorcxx . . $ fl_color(cb2f890c2fdad230).(FL_DARK3cxx . . $ FL_DARK3.); fl_yxlinecxx . . $ fl_yxline(748afa4755bc9595).(Xcxx . . $ scope#X.-2, Ycxx . . $ scope#Y.+Hcxx . . $ scope#H.+2, Ycxx . . $ scope#Y.-2, Xcxx . . $ scope#X.+Wcxx . . $ scope#W.); |
| 109 | fl_colorcxx . . $ fl_color(cb2f890c2fdad230).(FL_LIGHT3cxx . . $ FL_LIGHT3.); fl_xylinecxx . . $ fl_xyline(748afa4755bc9595).(Xcxx . . $ scope#X.-1, Ycxx . . $ scope#Y.+Hcxx . . $ scope#H.+1, Xcxx . . $ scope#X.+Wcxx . . $ scope#W.+1, Ycxx . . $ scope#Y.-2); |
| 110 | fl_colorcxx . . $ fl_color(cb2f890c2fdad230).(FL_LIGHT2cxx . . $ FL_LIGHT2.); fl_xylinecxx . . $ fl_xyline(748afa4755bc9595).(Xcxx . . $ scope#X.-2, Ycxx . . $ scope#Y.+Hcxx . . $ scope#H.+2, Xcxx . . $ scope#X.+Wcxx . . $ scope#W.+2, Ycxx . . $ scope#Y.-4); |
| 111 | fl_colorcxx . . $ fl_color(cb2f890c2fdad230).(FL_LIGHT1cxx . . $ FL_LIGHT1.); fl_xylinecxx . . $ fl_xyline(b1146eedae1e1d0b).(Xcxx . . $ scope#X.-3, Ycxx . . $ scope#Y.+Hcxx . . $ scope#H.+3, Xcxx . . $ scope#X.+Wcxx . . $ scope#W.+2); |
| 112 | } |
| 113 | draw_labelcxx . . $ Fl_Widget#draw_label(83f5f38750778ac8).(); |
| 114 | if (pixmalloccxx . . $ scope#pixmalloc.) |
| 115 | XCopyArea(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap., fl_windowcxx . . $ fl_window., fl_gccxx . . $ fl_gc., 0, 0, Wcxx . . $ scope#W., Hcxx . . $ scope#H., Xcxx . . $ scope#X., Ycxx . . $ scope#Y.); |
| 116 | else { |
| 117 | gcv.line_widthcxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_width. = 1; |
| 118 | gcv.line_stylecxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_style. = LineSolidcxx . . $ `<external>/1208737181511191802/X.h:504:9`!; |
| 119 | gcv.fill_stylecxx . . $ $anonymous_type_17d7f07cf933eea7_2#fill_style. = FillSolidcxx . . $ `<external>/1208737181511191802/X.h:523:9`!; |
| 120 | gc = XCreateGC(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap., GCLineWidthcxx . . $ `<external>/1208737181511191802/X.h:568:9`! | GCLineStylecxx . . $ `<external>/1208737181511191802/X.h:569:9`! | GCFillStylecxx . . $ `<external>/1208737181511191802/X.h:572:9`!, &gcv); |
| 121 | XSetState(fl_displaycxx . . $ fl_display., gc, col_backgroundcxx . . $ scope#col_background., col_backgroundcxx . . $ scope#col_background., GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!, AllPlanescxx . . $ `<external>/7073035915403465041/Xlib.h:95:9`!); |
| 122 | XFillRectangle(fl_displaycxx . . $ fl_display., fl_windowcxx . . $ fl_window., gc, Xcxx . . $ scope#X., Ycxx . . $ scope#Y., Wcxx . . $ scope#W., Hcxx . . $ scope#H.); |
| 123 | XFreeGC(fl_displaycxx . . $ fl_display., gc); |
| 124 | } |
| 125 | XSync(fl_displaycxx . . $ fl_display., 0); |
| 126 | } |
| 127 | |
| 128 | /* ---------------------------------------------------------------------- */ |
| 129 | |
| 130 | int scopecxx . . $ scope#::modecxx . . $ scope#mode(b126dc7c1de90089).(void) |
| 131 | { |
| 132 | modecxx . . $ scope#mode(d4f767463ce0a6b3).(drawmodecxx . . $ scope#drawmode.); |
| 133 | return drawmodecxx . . $ scope#drawmode.; |
| 134 | } |
| 135 | |
| 136 | void scopecxx . . $ scope#::modecxx . . $ scope#mode(d4f767463ce0a6b3).(int dmode) |
| 137 | { |
| 138 | Fl_Windowcxx . . $ Fl_Window# *wnd; |
| 139 | |
| 140 | if (dmode != drawmodecxx . . $ scope#drawmode.) { |
| 141 | if (pixmalloccxx . . $ scope#pixmalloc.) { |
| 142 | XFreePixmap(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap.); |
| 143 | pixmalloccxx . . $ scope#pixmalloc. = false; |
| 144 | } |
| 145 | drawmodecxx . . $ scope#drawmode. = dmode; |
| 146 | switch (drawmodecxx . . $ scope#drawmode.) { |
| 147 | case HDRVC_DIAGMODE_OFFcxx . . $ `hdlcutil/hdrvcomm.h:70:9`!: |
| 148 | default: |
| 149 | hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).(); |
| 150 | break; |
| 151 | |
| 152 | case HDRVC_DIAGMODE_INPUTcxx . . $ `hdlcutil/hdrvcomm.h:71:9`!: |
| 153 | case HDRVC_DIAGMODE_DEMODcxx . . $ `hdlcutil/hdrvcomm.h:72:9`!: |
| 154 | sizecxx . . $ Fl_Widget#size(3e454b8ccf442868).(512+6, 256+8); |
| 155 | showcxx . . $ Fl_Widget#show(49f6e7a06ebc5aa8).(); |
| 156 | break; |
| 157 | |
| 158 | case HDRVC_DIAGMODE_CONSTELLATIONcxx . . $ `hdlcutil/hdrvcomm.h:73:9`!: |
| 159 | sizecxx . . $ Fl_Widget#size(3e454b8ccf442868).(512+6, 512+8); |
| 160 | showcxx . . $ Fl_Widget#show(49f6e7a06ebc5aa8).(); |
| 161 | break; |
| 162 | } |
| 163 | } |
| 164 | if (pixmalloccxx . . $ scope#pixmalloc. || !visiblecxx . . $ Fl_Widget#visible(ddd8539a2fcdd4ce).() || Wcxx . . $ scope#W. < 2 || Hcxx . . $ scope#H. < 2) |
| 165 | return; |
| 166 | if (!(wnd = windowcxx . . $ Fl_Widget#window(cea7c156bf2d94e0).())) |
| 167 | return; |
| 168 | wnd->make_currentcxx . . $ Fl_Window#make_current(49f6e7a06ebc5aa8).(); |
| 169 | if (!(pixmapcxx . . $ scope#pixmap. = XCreatePixmap(fl_displaycxx . . $ fl_display., fl_windowcxx . . $ fl_window., Wcxx . . $ scope#W., Hcxx . . $ scope#H., fl_visualcxx . . $ fl_visual.->depthcxx . . $ $anonymous_type_c787e362e16f063b_7#depth.))) { |
| 170 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "unable to open offscreen pixmap\n"); |
| 171 | exitcxx . . $ exit(44ed87f96534fad7).(1); |
| 172 | } |
| 173 | pixmalloccxx . . $ scope#pixmalloc. = true; |
| 174 | col_zerolinecxx . . $ scope#col_zeroline. = fl_xpixelcxx . . $ fl_xpixel(1892545c1754497d).(FL_REDcxx . . $ FL_RED.); |
| 175 | col_backgroundcxx . . $ scope#col_background. = fl_xpixelcxx . . $ fl_xpixel(1892545c1754497d).(FL_WHITEcxx . . $ FL_WHITE.); |
| 176 | col_tracecxx . . $ scope#col_trace. = fl_xpixelcxx . . $ fl_xpixel(1892545c1754497d).(FL_BLACKcxx . . $ FL_BLACK.); |
| 177 | clearcxx . . $ scope#clear(49f6e7a06ebc5aa8).(); |
| 178 | } |
| 179 | |
| 180 | /* ---------------------------------------------------------------------- */ |
| 181 | |
| 182 | void scopecxx . . $ scope#::clearcxx . . $ scope#clear(49f6e7a06ebc5aa8).(void) |
| 183 | { |
| 184 | GCcxx . . $ GC# gc; |
| 185 | XGCValuescxx . . $ XGCValues# gcv; |
| 186 | |
| 187 | if (!pixmalloccxx . . $ scope#pixmalloc.) |
| 188 | return; |
| 189 | gcv.line_widthcxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_width. = 1; |
| 190 | gcv.line_stylecxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_style. = LineSolidcxx . . $ `<external>/1208737181511191802/X.h:504:9`!; |
| 191 | gcv.fill_stylecxx . . $ $anonymous_type_17d7f07cf933eea7_2#fill_style. = FillSolidcxx . . $ `<external>/1208737181511191802/X.h:523:9`!; |
| 192 | gc = XCreateGC(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap., GCLineWidthcxx . . $ `<external>/1208737181511191802/X.h:568:9`! | GCLineStylecxx . . $ `<external>/1208737181511191802/X.h:569:9`! | GCFillStylecxx . . $ `<external>/1208737181511191802/X.h:572:9`!, &gcv); |
| 193 | XSetState(fl_displaycxx . . $ fl_display., gc, col_backgroundcxx . . $ scope#col_background., col_backgroundcxx . . $ scope#col_background., GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!, AllPlanescxx . . $ `<external>/7073035915403465041/Xlib.h:95:9`!); |
| 194 | XFillRectangle(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap., gc, 0, 0, Wcxx . . $ scope#W., Hcxx . . $ scope#H.); |
| 195 | XFreeGC(fl_displaycxx . . $ fl_display., gc); |
| 196 | redrawcxx . . $ Fl_Widget#redraw(49f6e7a06ebc5aa8).(); |
| 197 | } |
| 198 | |
| 199 | /* ---------------------------------------------------------------------- */ |
| 200 | |
| 201 | #define WIDTHcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:201:9`! 512 |
| 202 | |
| 203 | /* ---------------------------------------------------------------------- */ |
| 204 | |
| 205 | void scopecxx . . $ scope#::drawdatacxx . . $ scope#drawdata(e1bec1d01040f3bf).(short data[], int len, int xm) |
| 206 | { |
| 207 | int cnt; |
| 208 | GCcxx . . $ GC# gc; |
| 209 | XGCValuescxx . . $ XGCValues# gcv; |
| 210 | |
| 211 | modecxx . . $ scope#mode(b126dc7c1de90089).(); |
| 212 | if (!pixmalloccxx . . $ scope#pixmalloc. || (drawmodecxx . . $ scope#drawmode. != HDRVC_DIAGMODE_CONSTELLATIONcxx . . $ `hdlcutil/hdrvcomm.h:73:9`! && |
| 213 | drawmodecxx . . $ scope#drawmode. != HDRVC_DIAGMODE_INPUTcxx . . $ `hdlcutil/hdrvcomm.h:71:9`! && |
| 214 | drawmodecxx . . $ scope#drawmode. != HDRVC_DIAGMODE_DEMODcxx . . $ `hdlcutil/hdrvcomm.h:72:9`!)) |
| 215 | return; |
| 216 | gcv.line_widthcxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_width. = 1; |
| 217 | gcv.line_stylecxx . . $ $anonymous_type_17d7f07cf933eea7_2#line_style. = LineSolidcxx . . $ `<external>/1208737181511191802/X.h:504:9`!; |
| 218 | gc = XCreateGC(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap., GCLineWidthcxx . . $ `<external>/1208737181511191802/X.h:568:9`! | GCLineStylecxx . . $ `<external>/1208737181511191802/X.h:569:9`!, &gcv); |
| 219 | if (drawmodecxx . . $ scope#drawmode. == HDRVC_DIAGMODE_CONSTELLATIONcxx . . $ `hdlcutil/hdrvcomm.h:73:9`!) { |
| 220 | #define XCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:220:9`!(x) ((SHRT_MAXcxx . . $ `<external>/67164224788392828/limits.h:106:9`! - (int)(x)) * W / USHRT_MAXcxx . . $ `<external>/67164224788392828/limits.h:113:10`!) |
| 221 | #define YCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:221:9`!(y) ((SHRT_MAXcxx . . $ `<external>/67164224788392828/limits.h:106:9`! - (int)(y)) * H / USHRT_MAXcxx . . $ `<external>/67164224788392828/limits.h:113:10`!) |
| 222 | XSetState(fl_displaycxx . . $ fl_display., gc, col_backgroundcxx . . $ scope#col_background., col_backgroundcxx . . $ scope#col_background., GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!, AllPlanescxx . . $ `<external>/7073035915403465041/Xlib.h:95:9`!); |
| 223 | XSetForeground(fl_displaycxx . . $ fl_display., gc, col_tracecxx . . $ scope#col_trace.); |
| 224 | for (cnt = 0; cnt < len-1; cnt += 2) |
| 225 | XDrawPoint(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap., gc, XCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:220:9`!(data[cnt]), YCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:221:9`!(data[cnt+1])); |
| 226 | XSetForeground(fl_displaycxx . . $ fl_display., gc, col_zerolinecxx . . $ scope#col_zeroline.); |
| 227 | XDrawLine(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap., gc, 0, YCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:221:9`!(0), Wcxx . . $ scope#W., YCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:221:9`!(0)); |
| 228 | XDrawLine(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap., gc, XCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:220:9`!(0), 0, XCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:220:9`!(0), Hcxx . . $ scope#H.); |
| 229 | #undef XCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:220:9`! |
| 230 | #undef YCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:221:9`! |
| 231 | } else { |
| 232 | #define XCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:232:9`!(x) ((x) * xm) |
| 233 | #define YCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:233:9`!(y) ((SHRT_MAXcxx . . $ `<external>/67164224788392828/limits.h:106:9`! - (int)(y)) * H / USHRT_MAXcxx . . $ `<external>/67164224788392828/limits.h:113:10`!) |
| 234 | XSetState(fl_displaycxx . . $ fl_display., gc, col_backgroundcxx . . $ scope#col_background., col_backgroundcxx . . $ scope#col_background., GXcopycxx . . $ `<external>/1208737181511191802/X.h:488:9`!, AllPlanescxx . . $ `<external>/7073035915403465041/Xlib.h:95:9`!); |
| 235 | if (drawmodecxx . . $ scope#drawmode. == HDRVC_DIAGMODE_INPUTcxx . . $ `hdlcutil/hdrvcomm.h:71:9`!) { |
| 236 | XFillRectangle(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap., gc, 0, 0, Wcxx . . $ scope#W., Hcxx . . $ scope#H.); |
| 237 | xm = 5; |
| 238 | } |
| 239 | XSetForeground(fl_displaycxx . . $ fl_display., gc, col_tracecxx . . $ scope#col_trace.); |
| 240 | for (cnt = 0; cnt < len-1; cnt++) |
| 241 | XDrawLine(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap., gc, XCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:232:9`!(cnt), YCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:233:9`!(data[cnt]), |
| 242 | XCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:232:9`!(cnt+1), YCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:233:9`!(data[cnt+1])); |
| 243 | XSetForeground(fl_displaycxx . . $ fl_display., gc, col_zerolinecxx . . $ scope#col_zeroline.); |
| 244 | XDrawLine(fl_displaycxx . . $ fl_display., pixmapcxx . . $ scope#pixmap., gc, 0, YCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:233:9`!(0), Wcxx . . $ scope#W., YCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:233:9`!(0)); |
| 245 | #undef XCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:232:9`! |
| 246 | #undef YCOORDcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:233:9`! |
| 247 | } |
| 248 | XFreeGC(fl_displaycxx . . $ fl_display., gc); |
| 249 | redrawcxx . . $ Fl_Widget#redraw(49f6e7a06ebc5aa8).(); |
| 250 | } |
| 251 | |
| 252 | /* ---------------------------------------------------------------------- */ |
| 253 | |
| 254 | void cb_cleargrcxx . . $ cb_cleargr(a1c60d4e2a3bbb68).(Fl_Buttoncxx . . $ Fl_Button# *, long) |
| 255 | { |
| 256 | scdispcxx . . $ scdisp.->clearcxx . . $ scope#clear(49f6e7a06ebc5aa8).(); |
| 257 | } |
| 258 | |
| 259 | /* ---------------------------------------------------------------------- */ |
| 260 | |
| 261 | void cb_modecxx . . $ cb_mode(8b3e0ccea47f97e5).(Fl_Check_Buttoncxx . . $ Fl_Check_Button# *, long which) |
| 262 | { |
| 263 | struct sm_diag_data diag; |
| 264 | short data; |
| 265 | |
| 266 | diag.mode = HDRVC_DIAGMODE_OFFcxx . . $ `hdlcutil/hdrvcomm.h:70:9`!; |
| 267 | diag.flags = 0; |
| 268 | diag.datalen = 1; |
| 269 | diag.data = &data; |
| 270 | hdrvc_diag(&diag); |
| 271 | switch (which) { |
| 272 | case 256: |
| 273 | drawflagscxx . . $ drawflags. ^= HDRVC_DIAGFLAG_DCDGATEcxx . . $ `hdlcutil/hdrvcomm.h:78:9`!; |
| 274 | break; |
| 275 | |
| 276 | case 0: |
| 277 | scdispcxx . . $ scdisp.->modecxx . . $ scope#mode(d4f767463ce0a6b3).(HDRVC_DIAGMODE_OFFcxx . . $ `hdlcutil/hdrvcomm.h:70:9`!); |
| 278 | drawflagscxx . . $ drawflags. = 0; |
| 279 | break; |
| 280 | |
| 281 | case 1: |
| 282 | scdispcxx . . $ scdisp.->modecxx . . $ scope#mode(d4f767463ce0a6b3).(HDRVC_DIAGMODE_INPUTcxx . . $ `hdlcutil/hdrvcomm.h:71:9`!); |
| 283 | drawflagscxx . . $ drawflags. = 0; |
| 284 | break; |
| 285 | |
| 286 | case 2: |
| 287 | scdispcxx . . $ scdisp.->modecxx . . $ scope#mode(d4f767463ce0a6b3).(HDRVC_DIAGMODE_DEMODcxx . . $ `hdlcutil/hdrvcomm.h:72:9`!); |
| 288 | drawflagscxx . . $ drawflags. = HDRVC_DIAGFLAG_DCDGATEcxx . . $ `hdlcutil/hdrvcomm.h:78:9`!; |
| 289 | break; |
| 290 | |
| 291 | case 3: |
| 292 | scdispcxx . . $ scdisp.->modecxx . . $ scope#mode(d4f767463ce0a6b3).(HDRVC_DIAGMODE_CONSTELLATIONcxx . . $ `hdlcutil/hdrvcomm.h:73:9`!); |
| 293 | drawflagscxx . . $ drawflags. = HDRVC_DIAGFLAG_DCDGATEcxx . . $ `hdlcutil/hdrvcomm.h:78:9`!; |
| 294 | break; |
| 295 | } |
| 296 | sm_dcdcxx . . $ sm_dcd.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(!!(drawflagscxx . . $ drawflags. & HDRVC_DIAGFLAG_DCDGATEcxx . . $ `hdlcutil/hdrvcomm.h:78:9`!)); |
| 297 | } |
| 298 | |
| 299 | /* ---------------------------------------------------------------------- */ |
| 300 | |
| 301 | void cb_quitcxx . . $ cb_quit(a1c60d4e2a3bbb68).(Fl_Buttoncxx . . $ Fl_Button# *, long) |
| 302 | { |
| 303 | struct sm_diag_data diag; |
| 304 | short data; |
| 305 | |
| 306 | diag.mode = HDRVC_DIAGMODE_OFFcxx . . $ `hdlcutil/hdrvcomm.h:70:9`!; |
| 307 | diag.flags = 0; |
| 308 | diag.datalen = 1; |
| 309 | diag.data = &data; |
| 310 | hdrvc_diag(&diag); |
| 311 | exitcxx . . $ exit(44ed87f96534fad7).(0); |
| 312 | } |
| 313 | |
| 314 | /* ---------------------------------------------------------------------- */ |
| 315 | |
| 316 | void cb_timercxx . . $ cb_timer(5d22bdacc48458e8).(void *) |
| 317 | { |
| 318 | struct hdrvc_channel_state cs; |
| 319 | int ret; |
| 320 | short data[256]; |
| 321 | unsigned int samplesperbit; |
| 322 | |
| 323 | Flcxx . . $ Fl#::add_timeoutcxx . . $ Fl#add_timeout(5c1e27f8f85f9ba8).(0.2, cb_timercxx . . $ cb_timer(5d22bdacc48458e8).); |
| 324 | /* |
| 325 | * display state |
| 326 | */ |
| 327 | ret = hdrvc_get_channel_state(&cs); |
| 328 | if (ret < 0) { |
| 329 | perror("hdrvc_get_channel_state"); |
| 330 | } else { |
| 331 | st_pttcxx . . $ st_ptt.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(cs.ptt); |
| 332 | st_dcdcxx . . $ st_dcd.->valuecxx . . $ Fl_Button#value(7864480464b09eea).(cs.dcd); |
| 333 | } |
| 334 | /* |
| 335 | * draw scope |
| 336 | */ |
| 337 | if ((ret = hdrvc_diag2(scdispcxx . . $ scdisp.->modecxx . . $ scope#mode(b126dc7c1de90089).(), drawflagscxx . . $ drawflags., data, sizeof(data) / sizeof(short), |
| 338 | &samplesperbit)) < 0) { |
| 339 | perror("hdrvc_diag2"); |
| 340 | exitcxx . . $ exit(44ed87f96534fad7).(1); |
| 341 | } |
| 342 | if (ret > 0) |
| 343 | scdispcxx . . $ scdisp.->drawdatacxx . . $ scope#drawdata(e1bec1d01040f3bf).(data, ret, WIDTHcxx . . $ `hdlcutil/fl/xfsmdiag_main.cxx:201:9`! / (2*(samplesperbit > 0 ? samplesperbit : 1))); |
| 344 | } |
| 345 | |
| 346 | /* ---------------------------------------------------------------------- */ |
| 347 | |
| 348 | static const char *usage_strcxx . . $ usage_str. = |
| 349 | "[-i smif]\n" |
| 350 | " -i: specify the name of the baycom kernel driver interface\n\n"; |
| 351 | |
| 352 | /* ---------------------------------------------------------------------- */ |
| 353 | |
| 354 | int maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[]) |
| 355 | { |
| 356 | int c, i; |
| 357 | int ret; |
| 358 | unsigned int ifflags; |
| 359 | char name[64]; |
| 360 | |
| 361 | prognamecxx . . $ progname. = *argv; |
| 362 | printf("%s: Version " FULL_VERcxx . . $ `scm-version.h:6:9`! "; (C) 1996,1997,2000 by Thomas Sailer HB9JNX/AE4WA\n", *argv); |
| 363 | |
| 364 | hdrvc_args(&argc, argv, "sm0"); |
| 365 | for (i = 1; i < argc; ) { |
| 366 | c = i; |
| 367 | Flcxx . . $ Fl#::argcxx . . $ Fl#arg(8593696dd6f7d2b6).(argc, argv, c); |
| 368 | if (c <= 0) { |
| 369 | i++; |
| 370 | continue; |
| 371 | } |
| 372 | memmove(&argv[i], &argv[i+c], (argc-i) * sizeof(char *)); |
| 373 | argc -= c; |
| 374 | } |
| 375 | #if 0 |
| 376 | while ((ret = getopt(argc, argv, "")) != -1) { |
| 377 | switch (ret) { |
| 378 | default: |
| 379 | printf("usage: %s %s", *argv, usage_str); |
| 380 | exit(-1); |
| 381 | } |
| 382 | } |
| 383 | #endif |
| 384 | hdrvc_init(); |
| 385 | ifflags = hdrvc_get_ifflags(); |
| 386 | if (!(ifflags & IFF_UPcxx . . $ `<external>/2638090476884991293/if.h:45:10`!)) { |
| 387 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "interface %s down\n", hdrvc_ifname()); |
| 388 | exitcxx . . $ exit(44ed87f96534fad7).(1); |
| 389 | } |
| 390 | if (!(ifflags & IFF_RUNNINGcxx . . $ `<external>/2638090476884991293/if.h:57:10`!)) { |
| 391 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "interface %s not running\n", hdrvc_ifname()); |
| 392 | exitcxx . . $ exit(44ed87f96534fad7).(1); |
| 393 | } |
| 394 | create_the_formscxx . . $ create_the_forms(80327a7a60f718d1).(); |
| 395 | scdispcxx . . $ scdisp.->hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).(); |
| 396 | /* |
| 397 | * set driver and modem name |
| 398 | */ |
| 399 | ret = hdrvc_get_mode_name(name, sizeof(name)); |
| 400 | if (ret < 0) { |
| 401 | perror("hdrvc_get_mode_name"); |
| 402 | modenamecxx . . $ modename.->hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).(); |
| 403 | } else |
| 404 | modenamecxx . . $ modename.->valuecxx . . $ Fl_Input_#value(5c4306d8553b3696).(name); |
| 405 | ret = hdrvc_get_driver_name(name, sizeof(name)); |
| 406 | if (ret < 0) { |
| 407 | perror("hdrvc_get_driver_name"); |
| 408 | drivernamecxx . . $ drivername.->hidecxx . . $ Fl_Widget#hide(49f6e7a06ebc5aa8).(); |
| 409 | } else |
| 410 | drivernamecxx . . $ drivername.->valuecxx . . $ Fl_Input_#value(5c4306d8553b3696).(name); |
| 411 | Flcxx . . $ Fl#::add_timeoutcxx . . $ Fl#add_timeout(5c1e27f8f85f9ba8).(0.1, cb_timercxx . . $ cb_timer(5d22bdacc48458e8).); |
| 412 | scopewindowcxx . . $ scopewindow.->showcxx . . $ Fl_Window#show(49f6e7a06ebc5aa8).(); |
| 413 | Flcxx . . $ Fl#::runcxx . . $ Fl#run(b126dc7c1de90089).(); |
| 414 | cb_quitcxx . . $ cb_quit(a1c60d4e2a3bbb68).(quitcxx . . $ quit., 0); |
| 415 | exitcxx . . $ exit(44ed87f96534fad7).(0); |
| 416 | } |