Beispiel #1
0
	void ArgumentParser::parseArguments()
	{
		for (int i = 1; i < argc; i++) {
			string arg_str(argv[i]);
			if (arg_str == "-l") {
				args_map.emplace("list_stations", "");
			}
			else if (arg_str == "-t") {
				args_map.emplace("test_source", string(argv[++i]));
			}
			else if (arg_str == "-d") {
				args_map.emplace("date", string(argv[++i]));
			}
			else {
				if (!isArgumentExists("start_station")) {
					args_map.emplace("start_station", string(argv[i]));
				}
				else if (!isArgumentExists("start_time")) {
					args_map.emplace("start_time", string(argv[i]));
				}
				else if (!isArgumentExists("dest_station")) {
					args_map.emplace("dest_station", string(argv[i]));
				}
			}
		}
	}
Beispiel #2
0
vector<string> arg_split(const char* argv) {

	if( argv == NULL ) return vector<string>();

	string arg_str(argv);
	vector<string> result;

	while( !arg_str.empty() ) {

		if ( arg_str[0] == ' ' ) {
			//ƒJƒ‰“Ç‚Ý
			int i;
			for(i=1; i < arg_str.size(); i++) {
				if( arg_str[i] != ' ') {
					break;
				}
			}
			
			if( i == arg_str.size() ) { break; }
			arg_str = arg_str.substr( i, string::npos );

		} else if( arg_str[0] =='\"' ) {
		
			int pos = arg_str.find( '\"', 1 );

			if( pos == string::npos ) {
	
				result.push_back( arg_str.substr( 0, pos ) );
				break;
			}

			result.push_back( arg_str.substr( 0, pos+1 ) );
			
			arg_str = arg_str.substr( pos+1, string::npos );
			
		} else {

			int pos = arg_str.find( ' ' );
			result.push_back( arg_str.substr( 0, pos ) );

			if(pos == string::npos ) break;

			arg_str = arg_str.substr( pos+1, string::npos );
			
		}

	} // while( !arg_str.empty() )

	return result;

} // ArgSplit
Beispiel #3
0
void hPART(struct user *user, char *channels, char *reason) {
	struct manyargs chlist;
	struct channel *c;
	int i;
	VERIFY_USER(user);

	split(&chlist, channels, ',');
	for (i = 0; i < chlist.c; i++) {
		c = get_channel_by_name(chlist.v[i]);
		VERIFY_CHANNEL(c);
		hook_call("onpart", pack_args(arg_user(user), arg_chan(c), arg_str(reason ? reason : "")));
		chanusers_leave(user, c);
	}
}
Beispiel #4
0
int
main(
  int		argc,			/* arg count */
  char	      * argv[]			/* arg vector */
){
  static char * context = "main(life)";
  bool2D	world;			/* world to evolve */
  int		nr, nc;			/* matrix size */
  int		iters;			/* number of iterations */
  char	      * infn = NULL;		/* input file name */
  char	      * outfn = NULL;		/* output file name */
  int		argd = 1;		/* argument index */
  void	      * args[5];

  /* arguments */
#if NUMA
  MAIN_INITENV(,32000000)
  BARINIT(GlobalBar);
#endif
  while (argd < argc){
    CHECK(argv[argd][0] == '-',
	  fail(context, "bad argument", "index", "%d", argd, NULL));
    switch(argv[argd][1]){
     case 'L' :
      iters = arg_int(context, argc, argv, argd+1, argv[argd]);
      argd += 2;
      break;
#if GRAPHICS
     case 'g' :
      gfx_open(app_life, arg_gfxCtrl(context, argc, argv, argd+1, argv[argd]));
      argd += 2;
      break;
#endif
#if PARALLEL
     case 'p' :
      DataDist = arg_dataDist(context, argc, argv, argd+1, argv[argd]);
      ParWidth = arg_int(context, argc, argv, argd+2, argv[argd]);
      argd += 3;
      break;
#endif
     case 'i' :
      infn = arg_str(context, argc, argv, argd+1, argv[argd]);
      argd += 2;
      break;
     case 'o' :
      outfn = arg_str(context, argc, argv, argd+1, argv[argd]);
      argd += 2;
      break;
     case 'u' :
      io_init(FALSE);
      argd += 1;
      break;
     default :
      fail(context, "unknown flag", "flag", "%s", argv[argd], NULL);
      break;
    }
  }

  /* setup */
  sch_init(DataDist);
  CHECK(0 < iters,
	fail(context, "non-positive number of iterations",
	     "number of iterations", "%d", iters, NULL));
  io_rdBool2D(context, infn, world, &nr, &nc);

  /* run */
  TP_any(args, 0, world);
  TP_any(args, 1, nr);
  TP_any(args, 2, nc);
  TP_any(args, 3, iters);
  thr_grp(life_thr, args);

  /* takedown */
  io_wrBool2D(context, outfn, world, nr, nc);

#if GRAPHICS
  gfx_close();
#endif
#if IEEE
  ieee_retrospective(stderr);
#endif
#if NUMA
  BARFREE(GlobalBar);
  MAIN_END;
#endif

  return 0;
}
// argc has to be a reference, or QCoreApplication will segfault
ExecObjects init_xivoclient(int & argc, char **argv)
{
    ExecObjects ret;
    QCoreApplication::setOrganizationName("XIVO");
    QCoreApplication::setOrganizationDomain("xivo.fr");
    QCoreApplication::setApplicationName("XIVO_Client");
    PowerAwareApplication *app = new PowerAwareApplication(argc, argv);

    FileOpenEventHandler* fileOpenHandler = new FileOpenEventHandler(app, app);
    app->installEventFilter(fileOpenHandler);

    QSettings * settings = new QSettings(QSettings::IniFormat,
                                         QSettings::UserScope,
                                         QCoreApplication::organizationName(),
                                         QCoreApplication::applicationName());
    qDebug() << "Reading configuration file" << settings->fileName();

    QString profile = "default-user";
    QString msg = "";
    for (int i = 1; i < argc; i ++) {
        QString arg_str(argv[i]);
        if (arg_str.length() == 0 || arg_str.contains(str_socket_arg_prefix)) {
            continue;
        }
        if(! PhoneNumber::isURI(arg_str)) {
            profile = arg_str;
        } else {
            msg = PhoneNumber::extract(arg_str);
        }
    }

    qDebug() << "Selected profile: " << profile;

    if (! msg.isEmpty()) {
        // send message if there is an argument.
        // see http://people.w3.org/~dom/archives/2005/09/integrating-a-new-uris-scheme-handler-to-gnome-and-firefox/
        // to learn how to handle "tel:0123456" uri scheme
        app->sendMessage(msg);
        // warning : this sends the message only to the first instance, if ever there are >1 instances running
    }

    app->setWindowIcon(QIcon(":/images/xivo-login.png"));

    QString info_osname;
    QString info_endianness = QSysInfo::ByteOrder ? "LE" : "BE";

#if defined(Q_WS_X11)
    info_osname = QString("X11-%1-%2")
        .arg(info_endianness)
        .arg(app->applicationPid());
#elif defined(Q_WS_WIN)
    info_osname = QString("WIN-%1-0x%2-%3")
        .arg(info_endianness)
        .arg(QSysInfo::WindowsVersion, 2, 16, QChar('0'))
        .arg(app->applicationPid());
#elif defined(Q_WS_MAC)
    info_osname = QString("MAC-%1-0x%2-%3")
        .arg(info_endianness)
        .arg(QSysInfo::MacintoshVersion, 2, 16, QChar('0'))
        .arg(app->applicationPid());
#else
    info_osname = QString("unknown-%1-%2")
        .arg(info_endianness)
        .arg(app->applicationPid());
#endif

    bool shallbeunique = settings->value("display/unique").toBool();
    if (shallbeunique && app->isRunning()) {
        qDebug() << Q_FUNC_INFO << "unique mode : application is already running : exiting";
        // do not create a new application, just activate the currently running one
        ret.initOK = false;
        return ret;
    }

    settings->setValue("profile/lastused", profile);

    b_engine = new BaseEngine(settings, info_osname);

    QString qsskind = b_engine->getConfig("qss").toString();

    QFile qssFile(QString(":/%1.qss").arg(qsskind));
    if(qssFile.open(QIODevice::ReadOnly)) {
        app->setStyleSheet(qssFile.readAll());
    }
    assembler = new Assembler();
    if (! assembler) {
        qDebug() << Q_FUNC_INFO << "Failed to instantiate the Assembler";
        return ret;
    }
    MainWindow *main_window = assembler->mainWindow();
    main_window->initialize();

    bool activate_on_tel = b_engine->getConfig("activate_on_tel").toBool();
    app->setActivationWindow(main_window, activate_on_tel);
    fileOpenHandler->setActivationWindow(activate_on_tel);

    app->setQuitOnLastWindowClosed(false);
    app->setProperty("stopper", "lastwindow");

    QObject::connect(app, SIGNAL(standBy()),
                     b_engine, SLOT(stop()));
    QObject::connect(app, SIGNAL(resume()),
                     b_engine, SLOT(start()));
    QObject::connect(app, SIGNAL(powerEvent(const QString &)),
                     b_engine, SLOT(powerEvent(const QString &)));
    QObject::connect(app, SIGNAL(messageReceived(const QString &)),
                     b_engine, SLOT(handleOtherInstanceMessage(const QString &)));
    QObject::connect(fileOpenHandler, SIGNAL(dialNumber(QString)),
                     b_engine, SLOT(handleOtherInstanceMessage(const QString &)));

    ret.app = app;
    ret.win = main_window;
    ret.baseengine = b_engine;
    ret.initOK = true;

#ifdef FUNCTESTS
    QString socket = "/tmp/xc-default.sock";
    for (int i = 1; i < argc; i ++) {
        QString arg_str(argv[i]);
        if (arg_str.contains(str_socket_arg_prefix)) {
            socket = arg_str.replace(str_socket_arg_prefix, "");
        }
    }
    qDebug() << "Selected RC socket: " << socket;

    ret.rc = new RemoteControl(ret, socket);
#endif

    return ret;
}
Beispiel #6
0
static const char *trtype_str(__u8 trtype)
{
	return arg_str(trtypes, ARRAY_SIZE(trtypes), trtype);
}
Beispiel #7
0
static const char *cms_str(__u8 cm)
{
	return arg_str(cms, ARRAY_SIZE(cms), cm);
}
Beispiel #8
0
static inline const char *qptype_str(__u8 qptype)
{
	return arg_str(qptypes, ARRAY_SIZE(qptypes), qptype);
}
Beispiel #9
0
static inline const char *prtype_str(__u8 prtype)
{
	return arg_str(prtypes, ARRAY_SIZE(prtypes), prtype);
}
Beispiel #10
0
static inline const char *subtype_str(__u8 subtype)
{
	return arg_str(subtypes, ARRAY_SIZE(subtypes), subtype);
}
Beispiel #11
0
static inline const char *adrfam_str(__u8 adrfam)
{
	return arg_str(adrfams, ARRAY_SIZE(adrfams), adrfam);
}
        void tokenizeEntityArguments( std::string& argument_str, std::vector<std::string>& entity_arguments )
        {
            char* stream_pos = (char*)argument_str.c_str();
            if( *stream_pos != '(' )
            {
                return;
            }

            ++stream_pos;
            int num_open_braces = 1;
            char* last_token = stream_pos;

            while( *stream_pos != '\0' )
            {
                if( *stream_pos == '\'' )
                {
                    // go to end of string
                    ++stream_pos;
                    char look_back = ' ';
                    char look_back2 = ' ';
                    while( *stream_pos != '\0' )
                    {
                        if( *stream_pos == '\'' )
                        {
                            if( look_back == '\\' )
                            {
                                if( look_back2 != '\\' )
                                {
                                    // tick is escaped
                                    look_back = *stream_pos;
                                    ++stream_pos;
                                    continue;
                                }
                            }
                            // else tick marks the end of argument
                            ++stream_pos;
                            break;
                        }
                        look_back2 = look_back;
                        look_back = *stream_pos;
                        ++stream_pos;
                    }
                    continue;
                }

                if( *stream_pos == '(' )
                {
                    ++num_open_braces;
                }
                else if( *stream_pos == ',' )
                {
                    if( num_open_braces == 1 )
                    {
                        if( *last_token == ',' )
                        {
                            ++last_token;
                        }

                        char* begin_arg = last_token;

                        // skip whitespace
                        while( isspace( *begin_arg ) )
                        {
                            ++begin_arg;
                        }
                        char* end_arg = stream_pos-1;
                        if( *begin_arg == '\'' && *end_arg == '\'' )
                        {
                            // TODO:
                            std::string arg_str( begin_arg+1, end_arg-begin_arg-1 );
                            arg_str = decodeStepString( arg_str );
                            entity_arguments.push_back( arg_str );
                        }
                        else
                        {
                            entity_arguments.push_back( std::string( begin_arg, end_arg-begin_arg+1 ) );
                        }
                        last_token = stream_pos;
                    }
                }
                else if( *stream_pos == ')' )
                {
                    --num_open_braces;
                    if( num_open_braces == 0 )
                    {
                        if( *last_token == ',' )
                        {
                            ++last_token;
                        }

                        char* begin_arg = last_token;

                        // skip whitespace
                        while( isspace( *begin_arg ) )
                        {
                            ++begin_arg;
                        }

                        int remaining_size = (int)(stream_pos - begin_arg);
                        if( remaining_size > 0 )
                        {
                            char* end_arg = stream_pos-1;
                            if( *begin_arg == '\'' && *end_arg == '\'' )
                            {
                                entity_arguments.push_back( std::string( begin_arg+1, end_arg-begin_arg-1 ) );
                            }
                            else
                            {
                                entity_arguments.push_back( std::string( begin_arg, end_arg-begin_arg+1 ) );
                            }
                        }
                        break;
                    }
                }
                ++stream_pos;
            }
        }
Beispiel #13
0
int
main(
  int		argc,			/* arg count */
  char	      * argv[]			/* arg vector */
){
  static char * context = "main(chain)";
  char	      * stem = NULL;		/* dump filename stem */
  char	      * suffix = NULL;		/* dump filename suffix */
  char	      * suff2 = NULL;		/* last half of suffix */
  int		nr, nc;			/* integer matrix sizes */
  int		n;			/* square matrix/vector size */
  real		base_x, base_y;		/* base of Mandelbrot */
  real		ext_x, ext_y;		/* extent of Mandelbrot */
  int		limit, seed;		/* randmat controls */
  real		fraction;		/* invperc/thresh filling */
  int		itersLife;		/* life iterations */
  int		itersElastic, relax;	/* elastic controls */
  int2D		i2D;			/* integer matrix */
  bool2D	b2D;			/* boolean matrix */
  pt1D		cities;			/* cities point vector */
  int		n_cities;		/* number of cities */
  pt1D		net;			/* net point vector */
  int		n_net;			/* number of net points */
  real2D	r2D_gauss;		/* real matrix for Gaussian */
  real2D	r2D_sor;		/* real matrix for SOR */
  real1D	r1D_gauss_v;		/* real vector input for Gaussian */
  real1D	r1D_sor_v;		/* real vector input for SOR */
  real1D	r1D_gauss_a;		/* real vector answer for Gaussian */
  real1D	r1D_sor_a;		/* real vector answer for SOR */
  real1D	r1D_gauss_c;		/* real vector check for Gaussian */
  real1D	r1D_sor_c;		/* real vector check for SOR */
  real		tol;			/* SOR tolerance */
  real		realDiff;		/* vector difference */
  bool		choicesSet = FALSE;	/* path choices set? */
  bool		doMandel = TRUE;	/* mandel vs. randmat */
  bool		doInvperc = TRUE;	/* invperc vs. thresholding */
  bool		doDump = FALSE;		/* dump intermediate results? */
  int		argd = 1;		/* argument index */

  /* arguments */
#if NUMA
  MAIN_INITENV(,32000000)
#endif
  while (argd < argc){
    CHECK(argv[argd][0] == '-',
	  fail(context, "bad argument", "index", "%d", argd, NULL));
    switch(argv[argd][1]){
     case 'E' :				/* elastic */
      itersElastic = arg_int(context, argc, argv, argd+1, argv[argd]);
      relax = arg_int(context, argc, argv, argd+2, argv[argd]);
      argd += 3;
      break;
     case 'F' :				/* fraction (invperc/thresh) */
      fraction = arg_real(context, argc, argv, argd+1, argv[argd]);
      argd += 2;
      break;
     case 'L' :				/* life */
      itersLife = arg_int(context, argc, argv, argd+1, argv[argd]);
      argd += 2;
      break;
     case 'M' :				/* mandel */
      base_x = arg_real(context, argc, argv, argd+1, argv[argd]);
      base_y = arg_real(context, argc, argv, argd+2, argv[argd]);
      ext_x  = arg_real(context, argc, argv, argd+3, argv[argd]);
      ext_y  = arg_real(context, argc, argv, argd+4, argv[argd]);
      argd += 5;
      break;
     case 'N' :				/* winnow */
      n_cities = arg_int(context, argc, argv, argd+1, argv[argd]);
      argd += 2;
      break;
     case 'R' :				/* randmat */
      limit = arg_int(context, argc, argv, argd+1, argv[argd]);
      seed  = arg_int(context, argc, argv, argd+2, argv[argd]);
      argd += 3;
      break;
     case 'S' :				/* matrix size */
      nr = arg_int(context, argc, argv, argd+1, argv[argd]);
      nc = arg_int(context, argc, argv, argd+2, argv[argd]);
      argd += 3;
      break;
     case 'T' :				/* SOR tolerance */
      tol = arg_real(context, argc, argv, argd+1, argv[argd]);
      argd += 2;
      break;
     case 'c' :				/* choice */
      CHECK(!choicesSet,
	    fail(context, "choices already set", NULL));
      suffix = arg_str(context, argc, argv, argd+1, argv[argd]);
      argd += 2;
      switch(suffix[0]){
       case 'i' :	doInvperc = TRUE;	break;
       case 't' :	doInvperc = FALSE;	break;
       default :
	fail(context, "unknown choice(s)", "choice", "%s", suffix, NULL);
      }
      switch(suffix[1]){
       case 'm' :	doMandel = TRUE;	break;
       case 'r' :	doMandel = FALSE;	break;
       default :
	fail(context, "unknown choice(s)", "choice", "%s", suffix, NULL);
      }
      suff2 = suffix+1;
      choicesSet = TRUE;
      break;
     case 'd' :				/* dump */
      doDump = TRUE;
      argd += 1;
      if ((argd < argc) && (argv[argd][0] != '-')){
        stem = arg_str(context, argc, argv, argd, argv[argd-1]);
        argd += 1;
      }
      break;
#if GRAPHICS
     case 'g' :
      gfx_open(app_chain, arg_gfxCtrl(context, argc, argv, argd+1, argv[argd]));
      argd += 2;
      break;
#endif
#if MIMD
     case 'p' :
      DataDist = arg_dataDist(context, argc, argv, argd+1, argv[argd]);
      ParWidth = arg_int(context, argc, argv, argd+2, argv[argd]);
      argd += 3;
      break;
#endif
     case 'u' :
      io_init(FALSE);
      argd += 1;
      break;
     default :
      fail(context, "unknown flag", "flag", "%s", argv[argd], NULL);
      break;
    }
  }
  CHECK(choicesSet,
	fail("context", "choices not set using -c flag", NULL));

  /* initialize */
#if MIMD
  sch_init(DataDist);
#endif

  /* mandel vs. randmat */
  if (doMandel){
    mandel(i2D, nr, nc, base_x, base_y, ext_x, ext_y);
    if (doDump) io_wrInt2D(context, mkfname(stem, NULL, suff2, "i2"), i2D, nr, nc);
  } else {
    randmat(i2D, nr, nc, limit, seed);
    if (doDump) io_wrInt2D(context, mkfname(stem, NULL, suff2, "i2"), i2D, nr, nc);
  }

  /* half */
  half(i2D, nr, nc);
  if (doDump) io_wrInt2D(context, mkfname(stem, "h", suff2, "i2"), i2D, nr, nc);

  /* invperc vs. thresh */
  if (doInvperc){
    invperc(i2D, b2D, nr, nc, fraction);
    if (doDump) io_wrBool2D(context, mkfname(stem, NULL, suffix, "b2"), b2D, nr, nc);
  } else {
    thresh(i2D, b2D, nr, nc, fraction);
    if (doDump) io_wrBool2D(context, mkfname(stem, NULL, suffix, "b2"), b2D, nr, nc);
  }

  /* life */
  life(b2D, nr, nc, itersLife);
  if (doDump) io_wrBool2D(context, mkfname(stem, "l", suffix, "b2"), b2D, nr, nc);

  /* winnow */
  winnow(i2D, b2D, nr, nc, cities, n_cities);
  if (doDump) io_wrPt1D(context, mkfname(stem, "w", suffix, "p1"), cities, n_cities);

  /* norm */
  norm(cities, n_cities);
  if (doDump) io_wrPt1D(context, mkfname(stem, "n", suffix, "p1"), cities, n_cities);

  /* elastic */
  n_net = (int)(ELASTIC_RATIO * n_cities);
  CHECK(n_net <= MAXEXT,
	fail(context, "too many net points required",
	     "number of net points", "%d", n_net, NULL));
  elastic(cities, n_cities, net, n_net, itersElastic, relax);
  if (doDump) io_wrPt1D(context, mkfname(stem, "e", suffix, "p1"), net, n_net);

  /* outer */
  n = n_net;
  outer(net, r2D_gauss, r1D_gauss_v, n);
  if (doDump){
    io_wrReal2D(context, mkfname(stem, "o", suffix, "r2"), r2D_gauss, n, n);
    io_wrReal1D(context, mkfname(stem, "o", suffix, "r1"), r1D_gauss_v, n);
  }

  cpReal2D(r2D_gauss, r2D_sor, n, n);
  cpReal1D(r1D_gauss_v, r1D_sor_v, n);

  /* gauss */
  gauss(r2D_gauss, r1D_gauss_v, r1D_gauss_a, n);
  if (doDump) io_wrReal1D(context, mkfname(stem, "g", suffix, "r1"), r1D_gauss_a, n);

  /* product (gauss) */
  product(r2D_gauss, r1D_gauss_a, r1D_gauss_c, n, n);
  if (doDump) io_wrReal1D(context, mkfname(stem, "pg", suffix, "r1"), r1D_gauss_c, n);

  /* sor */
  sor(r2D_sor, r1D_sor_v, r1D_sor_a, n, tol);
  if (doDump) io_wrReal1D(context, mkfname(stem, "s", suffix, "r1"), r1D_gauss_a, n);

  /* product (sor) */
  product(r2D_sor, r1D_sor_a, r1D_sor_c, n, n);
  if (doDump) io_wrReal1D(context, mkfname(stem, "ps", suffix, "r1"), r1D_gauss_c, n);

  /* difference */
  vecdiff(r1D_gauss_a, r1D_sor_a, n, &realDiff);
  if (doDump) io_wrReal0D(context, mkfname(stem, "v", suffix, "r0"), realDiff);

#if IEEE
  ieee_retrospective(stderr);
#endif
#if NUMA
  MAIN_END;
#endif

  return 0;
}
Beispiel #14
0
MAIN_ENV
#endif
#include "specific.h"

int
main(
  int		argc,			/* arg count */
  char	      * argv[]			/* arg vector */
){
  static char * context = "main(winnow)";
  int2D		matrix;			/* matrix of values */
  bool2D	mask;			/* mask on values */
  int		nr, nc, nrM, ncM;	/* sizes */
  pt1D		pt;			/* resulting point vector */
  int		npt;			/* number of points to keep */
  char	      * infnMat = NULL;		/* input matrix file name */
  char	      * infnMask = NULL;	/* input mask file name */
  char	      * outfn = NULL;		/* output file name */
  int		argd = 1;		/* argument index */

  /* arguments */
#if NUMA
  MAIN_INITENV(,32000000)
#endif
  while (argd < argc){
    CHECK(argv[argd][0] == '-',
	  fail(context, "bad argument", "index", "%d", argd, NULL));
    switch(argv[argd][1]){
     case 'N' :
      npt = arg_int(context, argc, argv, argd+1, argv[argd]);
      argd += 2;
      break;
#if GRAPHICS
     case 'g' :
      gfx_open(app_winnow, arg_gfxCtrl(context, argc, argv, argd+1, argv[argd]));
      argd += 2;
      break;
#endif
#if MIMD
     case 'p' :
      DataDist = arg_dataDist(context, argc, argv, argd+1, argv[argd]);
      ParWidth = arg_int(context, argc, argv, argd+2, argv[argd]);
      argd += 3;
      break;
#endif
     case 'i' :
      infnMat = arg_str(context, argc, argv, argd+1, argv[argd]);
      infnMask = arg_str(context, argc, argv, argd+2, argv[argd]);
      argd += 3;
      break;
     case 'o' :
      outfn = arg_str(context, argc, argv, argd+1, argv[argd]);
      argd += 2;
      break;
     case 'u' :
      io_init(FALSE);
      argd += 1;
      break;
     default :
      fail(context, "unknown flag", "flag", "%s", argv[argd], NULL);
      break;
    }
  }

  /* setup */
#if MIMD
  sch_init(DataDist);
#endif
  CHECK(npt > 0,
	fail(context, "non-positive number of points requested",
	     "number of points", "%d", npt, NULL));
  io_rdInt2D(context, infnMat, matrix, &nr, &nc);
  io_rdBool2D(context, infnMask, mask, &nrM, &ncM);
  CHECK((nr == nrM) && (nc == ncM),
	fail(context, "matrix/mask size mismatch",
	     "matrix file", "%s", infnMat,
	     "mask file", "%s", infnMask, NULL));

  /* run */
  winnow(matrix, mask, nr, nc, pt, npt);

  /* takedown */
  io_wrPt1D(context, outfn, pt, npt);

#if GRAPHICS
  gfx_close();
#endif
#if IEEE
  ieee_retrospective(stderr);
#endif
#if NUMA
  MAIN_END;
#endif

  return 0;
}
Beispiel #15
0
void hQUIT(struct user *from, char *reason) {
	VERIFY_USER(from);
	hook_call("onquit", pack_args(arg_user(from), arg_str(reason ? reason : "")));
	del_user(from);
}
Beispiel #16
0
void hPRIVMSG(struct entity *from, char *target, char *msg) {
	struct user *u = (struct user *)from;

	if (!verify_user(u))
		return;
	if (u->server == me)
		return;

	if (*target == '#')
		hook_call("onchanmsg", pack_args(arg_user(u), arg_chan(get_channel_by_name(target)), arg_str(msg)));
	else
		hook_call("onprivmsg", pack_args(arg_user(u), arg_user(get_user_by_numeric(str2unum(target))), arg_str(msg)));
}
Beispiel #17
0
static inline const char *treq_str(__u8 treq)
{
	return arg_str(treqs, ARRAY_SIZE(treqs), treq);
}
Beispiel #18
0
void hNOTICE(struct entity *from, char *target, char *msg) {
	struct user *u = (struct user *)from;

	if (!verify_user(u))
		return;
	if (u->server == me)
		return;
	if (*target != '#')
		hook_call("onprivnotc", pack_args(arg_user(u), arg_user(get_user_by_numeric(str2unum(target))), arg_str(msg)));
}