/* -*- mode: C++; indent-tabs-mode: nil; fill-column: 100; c-basic-offset: 4; -*- * * Copyright (C) 1996 - 2001 Tim Witham * * (see the files README and COPYING for more details) * * This file implements the basic oscilloscope internals * */ #include #include #include #include #include #include "xoscope.h" /* program defaults */ #include "display.h" /* display routines */ #include "func.h" /* signal math functions */ #include "file.h" /* file I/O functions */ /* global program structures */ Scope scope; #ifdef HAVE_LIBCOMEDI extern DataSrc datasrc_comedi; #endif #ifdef HAVE_LIBASOUND extern DataSrc datasrc_sc; #endif #ifdef HAVE_LIBESD extern DataSrc datasrc_esd; // XXX: This will not happen anymore... #endif DataSrc *datasrcs[] = { #ifdef HAVE_LIBCOMEDI &datasrc_comedi, #endif #ifdef HAVE_LIBASOUND &datasrc_sc, #endif #ifdef HAVE_LIBESD &datasrc_esd #endif }; int ndatasrcs = sizeof(datasrcs)/sizeof(DataSrc *); int datasrci = -1; DataSrc *datasrc = NULL; Channel ch[CHANNELS]; /* extra global variable definitions */ char *progname; /* the program's name, autoset via argv[0] */ char version[] = VERSION; /* version of the program, from Makefile */ char error[4256]; /* buffer for "one-line" error messages */ int clip = 0; /* whether we're maxed out or not */ char *filename; /* default file name */ int frames = 0; /* # of frames (full or partial) captured */ int in_progress = 0; /* frame collection in progress? * if so, this is index of next sample */ const char * datasrc_names(void) { int i; int limit = sizeof(datasrcs)/sizeof(DataSrc *); static char buffer[256]; buffer[0] = '\0'; for (i=0; i 0) { strcat(buffer, "/"); } strcat(buffer, datasrcs[i]->name); } return buffer; } /* display command usage on stdout or stderr and exit */ void usage(int error) { static char *def[] = {"graticule", "signal"}, *onoff[] = {"on", "off"}; FILE *where; where = error ? stderr : stdout; fprintf(where, "usage: %s [options] [file]\n\ \n\ Startup Options Description (defaults) version %s\n\ -h this Help message and exit\n\ -D select named data source (%s)\n\ -A select named ALSA-device on soundcard (%s)\n\ -o