mdsPutCh.cpp File Reference

device-aware mdsPut interface More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <sys/syslog.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
#include <assert.h>
#include <errno.h>
#include "local.h"
#include "acq-util.h"
#include "mdsshell.h"
#include <popt.h>
#include <list>
#include "parser.h"
#include "../vin/InputBlock.h"
#include "Timebase.h"

Go to the source code of this file.

Data Structures

struct  UnixSocket
class  CBuf
class  MdsShellTransaction
struct  Globs
class  Expression
class  RootExpression
class  ExpressionLoader
class  Evaluator
class  EvalS0
class  EvalS1
class  EvalS2
class  EvalDT
class  EvalStride
class  ProxyExpression
class  VMaxExpression
class  VMinExpression
class  CodeMaxExpression
class  CodeMinExpression
class  ChannelMask


#define BUILD   "$Id: mdsPutCh.cpp,v 1.34 2010/02/03 08:08:11 pgm Exp $ $Revision: 1.34 $ B1014"
#define PROCLOGNAME   "mdsPutCh"
#define CUSTOM_EXP_NOSH   ".mdsPutCh.nosh"
#define CUSTOM_EXP_SH   ""
#define KW_V1   "%V1"
#define KW_V2   "%V2"
#define KW_R1   "%R1"
#define KW_R2   "%R2"
#define KW_CAL   "%CAL"
#define KW_S0   "%S0"
#define KW_S1   "%S1"
#define KW_S2   "%S2"
#define KW_DT   "%DT"
#define KW_STRIDE   "%STR"
#define DEFTIMEBASE   ":,:,1"
#define DEBUG_SOCK   "/tmp/mdsshell.debug"
#define _COMMAND_SOCK   "/tmp/mdsshell.command"
#define REPEAT_FOREVER   -1
#define NOSUBS   1
#define CALEX   "\"(%V1 + (%V2 - %V1)*($ - %R1)/(%R2 - %R1))\""
#define GCM   "acqcmd getChannelMask"
#define ACQPFX   "ACQ32:getChannelMask="
#define MAXLINE   4096


typedef list< string >::iterator VSI
typedef list< string >
typedef list< Expression * >


int readline (int fd, char *bufptr, size_t len)
static int sendfileOk (Timebase &timebase)
static void mdsPutChannel (int ch, const char *expr, Timebase &timebase)
static int mdsPutCh (InputBlock &inputBlock)
static void handleUsr2 (int signum)
static int doRepeatMode (InputBlock &inputBlock)
static void initContext ()
int get_args (int argc, const char *argv[], const char **&params)
int process (int nparams, const char **params, InputBlock &inputBlock)
int main (int argc, const char *argv[])


int acq200_debug = 0
static struct Globs GL
int norestore
int repeatn = REPEAT_FOREVER
ChannelMask channel_mask
static char channel_exp [MAXEXP]
unsigned guard1 = 0xdeadbeef
static struct poptOption opt_table []
int repeat_mode = 0

Detailed Description

device-aware mdsPut interface

this is a custom client for mdsshell-af_unix server.

It is possible to create a custom user expression based on these values, for example:

: future options to supporting REPEATED GATE:

Examples # upload 96 channels, all the data, raw expression

# upload 96 channels with unique calibration expression per channel

# upload 96 channels with signal timebase and calibration:

# upload 96 channels with a stride of 100 (for rapid upload) :

# upload 10000 samples starting at sample #50000 :

# upload 10 subshots, length 10000

mdsPutCh -- subshots 10 --timebase 1,10000,1 --subfield "SUBSHOT%04d" --field "CH%02d" 1:96

Definition in file mdsPutCh.cpp.

Define Documentation

#define _COMMAND_SOCK   "/tmp/mdsshell.command"

Definition at line 194 of file mdsPutCh.cpp.

#define ACQPFX   "ACQ32:getChannelMask="

Definition at line 834 of file mdsPutCh.cpp.

Referenced by ChannelMask::ChannelMask().

#define BUILD   "$Id: mdsPutCh.cpp,v 1.34 2010/02/03 08:08:11 pgm Exp $ $Revision: 1.34 $ B1014"

Definition at line 132 of file mdsPutCh.cpp.

Referenced by get_args(), main(), and mdsshell_help().

#define CALEX   "\"(%V1 + (%V2 - %V1)*($ - %R1)/(%R2 - %R1))\""

Definition at line 700 of file mdsPutCh.cpp.

#define CUSTOM_EXP_NOSH   ".mdsPutCh.nosh"

Definition at line 155 of file mdsPutCh.cpp.

Referenced by ExpressionLoader::getNosh().

#define CUSTOM_EXP_SH   ""

Definition at line 156 of file mdsPutCh.cpp.

#define DEBUG_SOCK   "/tmp/mdsshell.debug"

Definition at line 193 of file mdsPutCh.cpp.

#define DEFTIMEBASE   ":,:,1"

Definition at line 173 of file mdsPutCh.cpp.

#define GCM   "acqcmd getChannelMask"

Definition at line 833 of file mdsPutCh.cpp.

Referenced by ChannelMask::ChannelMask().

#define KW_CAL   "%CAL"

Definition at line 163 of file mdsPutCh.cpp.

#define KW_DT   "%DT"

Definition at line 168 of file mdsPutCh.cpp.

#define KW_R1   "%R1"

Definition at line 161 of file mdsPutCh.cpp.

#define KW_R2   "%R2"

Definition at line 162 of file mdsPutCh.cpp.

#define KW_S0   "%S0"

Definition at line 165 of file mdsPutCh.cpp.

#define KW_S1   "%S1"

Definition at line 166 of file mdsPutCh.cpp.

#define KW_S2   "%S2"

Definition at line 167 of file mdsPutCh.cpp.

#define KW_STRIDE   "%STR"

Definition at line 171 of file mdsPutCh.cpp.

#define KW_V1   "%V1"

Definition at line 159 of file mdsPutCh.cpp.

#define KW_V2   "%V2"

Definition at line 160 of file mdsPutCh.cpp.

#define MAXLINE   4096

Definition at line 1039 of file mdsPutCh.cpp.

#define NOSUBS   1

Definition at line 529 of file mdsPutCh.cpp.

Referenced by ExpressionLoader::load().

#define PROCLOGNAME   "mdsPutCh"

Definition at line 152 of file mdsPutCh.cpp.

#define REPEAT_FOREVER   -1

Definition at line 300 of file mdsPutCh.cpp.

Typedef Documentation

typedef list<Expression*>::const_iterator VECI

Definition at line 312 of file mdsPutCh.cpp.

typedef list<string>::const_iterator VSCI

Definition at line 311 of file mdsPutCh.cpp.

typedef list<string>::iterator VSI

Definition at line 308 of file mdsPutCh.cpp.

Function Documentation

static int doRepeatMode ( InputBlock &  inputBlock  )  [static]

Definition at line 914 of file mdsPutCh.cpp.

Referenced by process().

int get_args ( int  argc,
const char *  argv[],
const char **&  params 

Definition at line 988 of file mdsPutCh.cpp.

References BUILD, RootExpression::create(), and RootExpression::listAll().

Referenced by main().

static void handleUsr2 ( int  signum  )  [static]

Definition at line 910 of file mdsPutCh.cpp.

static void initContext (  )  [static]

sendfile mode default if no switch, else MUST be specified

Definition at line 958 of file mdsPutCh.cpp.

References COMMAND_SOCK, command_sock, GL, and Globs::sendfile.

Referenced by main().

int main ( int  argc,
const char *  argv[] 

command[s] on stdin - saves inputBlock overhead

Definition at line 1041 of file mdsPutCh.cpp.

References COMMAND_SOCK, get_args(), GL, initContext(), MAXLINE, Globs::mds, and process().

static int mdsPutCh ( InputBlock &  inputBlock  )  [static]

static void mdsPutChannel ( int  ch,
const char *  expr,
Timebase timebase 
) [static]

int process ( int  nparams,
const char **  params,
InputBlock &  inputBlock 

Definition at line 1025 of file mdsPutCh.cpp.

References Globs::channels, doRepeatMode(), GL, and mdsPutCh().

Referenced by main().

int readline ( int  fd,
char *  bufptr,
size_t  len 

static int sendfileOk ( Timebase timebase  )  [static]

Definition at line 793 of file mdsPutCh.cpp.

References Timebase::getStride(), GL, and Globs::sendfile.

Referenced by mdsPutChannel().

Variable Documentation

int acq200_debug = 0

Definition at line 175 of file mdsPutCh.cpp.

char channel_exp[MAXEXP] [static]

Definition at line 867 of file mdsPutCh.cpp.

Definition at line 865 of file mdsPutCh.cpp.


Definition at line 196 of file mdsPutCh.cpp.

struct Globs GL [static]

unsigned guard1 = 0xdeadbeef

Definition at line 868 of file mdsPutCh.cpp.

Referenced by doMdsValue().

int norestore

Definition at line 298 of file mdsPutCh.cpp.

struct poptOption opt_table[] [static]

Initial value:

{ "expr",  'E', POPT_ARG_STRING, &GL.expr, 0,
       "default : $" },
{ "field", 'F', POPT_ARG_STRING, &GL.field, 0,
        "mdsplus field name %02d substitutes channel" },
{ "dataroot-format", 'D', POPT_ARG_STRING, &GL.dataroot_format, 0,
                "source data format, %02d substitutes channel" },
{ "timebase", 'T', POPT_ARG_STRING, &GL.timebase, 0,
        "start,length,stride, default: all [" DEFTIMEBASE "]" },
{ "subshots", 'S', POPT_ARG_INT, &GL.subshots, 'S',
        "number of times to step and repeat timebase [0]"},
{ "subfield", 's', POPT_ARG_STRING, &GL.subfield, 's',
        "mdsfield name prepends \"field\", %04d substitutes subshot [blank]"},
{ "verbose", 'v', POPT_ARG_INT, &acq200_debug, 0 },
{ "norestore", 0, POPT_ARG_INT, &norestore, 0 },
{ "version",   0, POPT_ARG_NONE, 0, 'v' },
{ "repeat",  'r', POPT_ARG_NONE, 0, 'r', 
      "block on SIGUSR2, then loop. PID stored in $PWD/" },
{ "repeatn",  'R', POPT_ARG_INT, &repeatn, 'r', 
     "block on SIGUSR2, then loop N times. PID stored in $PWD/" },
{ "list",  0,     POPT_ARG_NONE, 0, 'l',
      "list available keywords" },

Definition at line 932 of file mdsPutCh.cpp.

int repeat_mode = 0

Definition at line 985 of file mdsPutCh.cpp.

int repeatn = REPEAT_FOREVER

Definition at line 301 of file mdsPutCh.cpp.

Generated on Wed Feb 3 08:08:33 2010 for mdsshell by  doxygen