int main( int argc, char *argv[] )
{
	int i;

	struct deltadb *db = deltadb_create();

	for (i=1; i<argc; i++){
		char *attr = strtok(argv[i], ",");
		char *type = strtok(0,",");

		struct deltadb_reduction *r = deltadb_reduction_create(type,attr);

		if(!r) {
			fprintf(stderr,"%s: invalid deltadb_reduction: %s\n",argv[0],type);
			return 1;
		}

		db->deltadb_reductions[db->ndeltadb_reductions++] = r;
	}

	log_play(db,stdin);

	deltadb_delete(db);

	return 0;
}
示例#2
0
static int parse_input( struct deltadb *db )
{
    while(1) {
        int keepgoing = log_play(db);
        if(!keepgoing) break;
    }
    return 1;
}
示例#3
0
int main( int argc, char *argv[] )
{
	struct deltadb *db = deltadb_create();
	int i;

	for(i=1;i<argc;i++) {
		db->fields[db->nfields++] = argv[i];
	}

	emit_table_header(db);
	log_play(db,stdin);

	deltadb_delete(db);

	return 0;
}
static int parse_input( struct deltadb *db )
{      
	checkpoint_read(db);
	
	printf(".Checkpoint End.\n");
	
	while(1) {

		int keepgoing = log_play(db);
		
		if(!keepgoing) break;

	}

	printf(".Log End.\n");

	return 1;
}
示例#5
0
CentralWindow::CentralWindow()
{
    drawMutex = new QMutex();
    centralwidget = new QWidget(this);
    centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
    gridLayout = new QGridLayout(centralwidget);
    gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
    Spielfeld = new QFrame(centralwidget);
    Spielfeld->setObjectName(QString::fromUtf8("Spielfeld"));
    QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(Spielfeld->sizePolicy().hasHeightForWidth());
    Spielfeld->setSizePolicy(sizePolicy);
    Spielfeld->setFrameShape(QFrame::Panel);
    Spielfeld->setFrameShadow(QFrame::Raised);
    Spielfeld->setLineWidth(1);
    gridLayout_7 = new QGridLayout(Spielfeld);
    gridLayout_7->setSpacing(0);
    gridLayout_7->setMargin(0);
    gridLayout_7->setObjectName(QString::fromUtf8("gridLayout_7"));
    soccerView = new SoccerView(drawMutex);
    soccerView->setObjectName(QString::fromUtf8("soccerView"));
    soccerView->setEnabled(true);

    gridLayout_7->addWidget(soccerView, 1, 0, 1, 1);

    gridLayout->addWidget(Spielfeld, 0, 0, 1, 1);
    this->setCentralWidget(centralwidget);

    logControl = new QDockWidget(this);
    logControl->setObjectName(QString::fromUtf8("logControl"));
    logControl->setEnabled(true);
    logControl->setMinimumSize(QSize(79, 150));
    logControl->setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
    logControl->setAllowedAreas(Qt::BottomDockWidgetArea);
    logControlWidget = new QWidget();
    logControlWidget->setObjectName(QString::fromUtf8("logControlWidget"));
    horizontalSlider = new QSlider(logControlWidget);
    horizontalSlider->setObjectName(QString::fromUtf8("horizontalSlider"));
    horizontalSlider->setGeometry(QRect(0, 0, 631, 22));
    horizontalSlider->setMaximum(1800);
    horizontalSlider->setPageStep(60);
    horizontalSlider->setOrientation(Qt::Horizontal);
    horizontalSlider->setTickPosition(QSlider::TicksAbove);
    horizontalSlider->setTickInterval(300);
    log_backward = new QPushButton(logControlWidget);
    log_backward->setObjectName(QString::fromUtf8("log_backward"));
    log_backward->setGeometry(QRect(0, 30, 150, 25));
    log_pause = new QPushButton(logControlWidget);
    log_pause->setObjectName(QString::fromUtf8("log_pause"));
    log_pause->setGeometry(QRect(160, 30, 150, 25));
    log_forward = new QPushButton(logControlWidget);
    log_forward->setObjectName(QString::fromUtf8("log_forward"));
    log_forward->setGeometry(QRect(320, 30, 150, 25));
    log_play = new QPushButton(logControlWidget);
    log_play->setObjectName(QString::fromUtf8("log_play"));
    log_play->setGeometry(QRect(480, 30, 150, 25));
    log_slower = new QPushButton(logControlWidget);
    log_slower->setObjectName(QString::fromUtf8("log_slower"));
    log_slower->setGeometry(QRect(0, 60, 150, 25));
    log_speed = new QLabel(logControlWidget);
    log_speed->setObjectName(QString::fromUtf8("log_speed"));
    log_speed->setGeometry(QRect(160, 60, 150, 25));
    log_speed->setAlignment(Qt::AlignCenter);
    log_faster = new QPushButton(logControlWidget);
    log_faster->setObjectName(QString::fromUtf8("log_faster"));
    log_faster->setGeometry(QRect(320, 60, 150, 25));
    log_frame_back = new QPushButton(logControlWidget);
    log_frame_back->setObjectName(QString::fromUtf8("log_frame_back"));
    log_frame_back->setGeometry(QRect(0, 90, 150, 25));
    log_frameNumber = new QLCDNumber(logControlWidget);
    log_frameNumber->setObjectName(QString::fromUtf8("log_frameNumber"));
    log_frameNumber->setGeometry(QRect(160, 90, 150, 25));
    log_frameNumber->setNumDigits(7);
    log_frameNumber->setSegmentStyle(QLCDNumber::Flat);
    log_frameNumber->setProperty("intValue", QVariant(0));
    log_frame_forward = new QPushButton(logControlWidget);
    log_frame_forward->setObjectName(QString::fromUtf8("log_frame_forward"));
    log_frame_forward->setGeometry(QRect(320, 90, 150, 25));
    log_totalFrames = new QLCDNumber(logControlWidget);
    log_totalFrames->setObjectName(QString::fromUtf8("log_totalFrames"));
    log_totalFrames->setGeometry(QRect(480, 90, 150, 25));
    log_totalFrames->setAutoFillBackground(false);
    log_totalFrames->setSmallDecimalPoint(false);
    log_totalFrames->setNumDigits(7);
    log_totalFrames->setSegmentStyle(QLCDNumber::Flat);
    logControl->setWidget(logControlWidget);
    this->addDockWidget(static_cast<Qt::DockWidgetArea>(8), logControl);

    logControl->setWindowTitle(QApplication::translate("GuiControls", "LogControl", 0, QApplication::UnicodeUTF8));
    log_backward->setText(QApplication::translate("GuiControls", "backward", 0, QApplication::UnicodeUTF8));
    log_pause->setText(QApplication::translate("GuiControls", "pause", 0, QApplication::UnicodeUTF8));
    log_forward->setText(QApplication::translate("GuiControls", "forward", 0, QApplication::UnicodeUTF8));
    log_play->setText(QApplication::translate("GuiControls", "play", 0, QApplication::UnicodeUTF8));
    log_slower->setText(QApplication::translate("GuiControls", "slower", 0, QApplication::UnicodeUTF8));
    log_speed->setText(QApplication::translate("GuiControls", "Speed", 0, QApplication::UnicodeUTF8));
    log_faster->setText(QApplication::translate("GuiControls", "faster", 0, QApplication::UnicodeUTF8));
    log_frame_back->setText(QApplication::translate("GuiControls", "frame--", 0, QApplication::UnicodeUTF8));
    log_frame_forward->setText(QApplication::translate("GuiControls", "frame++", 0, QApplication::UnicodeUTF8));

    logControl->hide();
    thread = new ViewUpdateThread(soccerView, drawMutex);

    //connect all SLOTs and SIGNALs
    //Slider control
    connect(thread, SIGNAL(initializeSlider(int,int,int,int,int)), this, SLOT(initializeSlider(int, int, int, int, int)));
    connect(thread, SIGNAL(update_frame(int)), horizontalSlider,         SLOT(setValue(int)));
    connect(horizontalSlider, SIGNAL(valueChanged(int)), thread->log_control, SLOT(goto_frame(int)));
    connect(horizontalSlider, SIGNAL(sliderPressed()),   thread->log_control, SLOT(log_pause()));
    connect(horizontalSlider, SIGNAL(sliderReleased()),  thread->log_control, SLOT(log_play()));

    //Buttons for logfile control
    connect(log_forward,       SIGNAL(clicked()), thread->log_control, SLOT(log_forward()));
    connect(log_play,          SIGNAL(clicked()), thread->log_control, SLOT(log_play()));
    connect(log_backward,      SIGNAL(clicked()), thread->log_control, SLOT(log_backward()));
    connect(log_pause,         SIGNAL(clicked()), thread->log_control, SLOT(log_pause()));
    connect(log_faster,        SIGNAL(clicked()), thread->log_control, SLOT(log_faster()));
    connect(log_slower,        SIGNAL(clicked()), thread->log_control, SLOT(log_slower()));
    connect(log_frame_back,    SIGNAL(clicked()), thread->log_control, SLOT(log_frame_back()));
    connect(log_frame_forward, SIGNAL(clicked()), thread->log_control, SLOT(log_frame_forward()));

    //Log Control
    connect(thread, SIGNAL(showLogControl(bool)), logControl, SLOT(setVisible(bool)));

    //QLCDNumber control
    connect(thread, SIGNAL(update_frame(int)), log_frameNumber, SLOT(display(int)));
    connect(thread, SIGNAL(log_size(int)),     log_totalFrames, SLOT(display(int)));
    connect(thread->log_control, SIGNAL(update_speed(QString)), log_speed, SLOT(setText(QString)));

    thread->start(QThread::NormalPriority);

    //initialisation for nice start
    for(int i = 0; i < 14; i++)
    {
        soccerView->initView();
        soccerView->updateView();
    }
}
示例#6
0
文件: yaku.c 项目: CecilHarvey/netmaj
void
ui_result (global_t * gp)
{
  int p, i;
  int iy[4];
  char buf[1024];
  int n = 0;

  if (flag_pause && !auto_play && !BUILD4)
    {
      wait4key ();
    }
  if (!point)
    make_point ();
  if (BUILD4)
    wrap_widgets ();

  snd (audioplay_yaku ());
  flag_not_needredraw = 0;
  point_clear ();

  memcpy (hora_global, gp, sizeof (global_t));
  hora_reset ();

  for (p = 0; p < 4; p++)
    {
      if (result[p].flag == 0)
        {
          continue;
        }
      n++;
    }
  for (p = 0; p < 4; p++)
    {
      if (result[p].flag == 0)
        {
          continue;
        }

      if (result[p].flag != RESULT_RYUKYOKU && (result[p].who != -1))
        {
          hora_set (hora_global, result[p].who);
        }
      else
        {
          hora_set (hora_global, -1);
        }

      result_cvt_to_int (result + p, iy);
      pmcontainer_print (point_results, pm_result_name[result[p].flag]);

      for (i = 0; i < 4; i++)
        {
          integer_t color;
          pmcontainer_print (point_home[i], pm_home_names[i]);
          print_yakupoint (point_home_point[i], result[p].points[i]);

          widget_configure (point_home_user[i], resource_text,
                            player[pplayer[i]].name);
          color = point_color (result[p].points[i]);
          widget_configure (point_home_user[i], resource_textfont, MEDIUMJP);
          widget_configure (point_home_user[i], resource_textcolor, color);
          {
            extern integer_t *tblpos;
            color = point_bgcolor (result[p].points[i]);
            widget_model_change (name_frame[tblpos[i]], color, white, white,
                                 white);
          }
        }

      if (result[p].fu)
        {
          widget_configure (point_fubase, resource_invisible, 0);
          print_yakupoint (point_fu, result[p].fu);
          print_yakupoint (point_fan, result[p].fan);
        }
      else
        {
          widget_configure (point_fubase, resource_invisible, 1);
        }

#define yaku_idx(idx)  		\
		if (!point_yaku[idx]) { goto YAKUEND; }

      {
        integer_t idx = 0;
        for (i = 0; i < Y_MAX; i++)
          {
            if (Y_GET (iy, i))
              {
                char buf[128];
                int len, n;

                yaku_idx (idx);

                strcpy (buf, result_str[i]);
                len = strlen (buf);

                if (buf[len - 1] == ')' && buf[len - 3] == '(')
                  {
                    buf[len - 3] = buf[len - 1] = 0;
                    n = buf[len - 2] - '0';
                    print_yakupoint (point_yaku_point[idx], n);
                  }
                else
                  {
                    widget_configure (point_yaku_point[idx], resource_text,
                                      "");
                  }
                widget_configure (point_yaku[idx], resource_text, buf);
                idx++;
              }
          }

        if (result[p].dora)
          {
            yaku_idx (idx);
            widget_configure (point_yaku[idx], resource_text, dora_str);
            print_yakupoint (point_yaku_point[idx], result[p].dora);
            idx++;
          }
        if (result[p].uradora)
          {
            yaku_idx (idx);
            widget_configure (point_yaku[idx], resource_text, uradora_str);
            print_yakupoint (point_yaku_point[idx], result[p].uradora);
            idx++;
          }
        if (result[p].akadora)
          {
            yaku_idx (idx);
            widget_configure (point_yaku[idx], resource_text, akadora_str);
            print_yakupoint (point_yaku_point[idx], result[p].akadora);
            idx++;
          }
        for (; idx < 30; idx++)
          {
            if (!point_yaku[idx])
              {
                continue;
              }
            widget_configure (point_yaku[idx], resource_text, "");
            widget_configure (point_yaku_point[idx], resource_text, "");
          }
      }
    YAKUEND:
      draw_hora ();
      {
        extern widget_t board;
        if (!BUILD4)
          {
            widget_unmap (board);
          }
        widget_map (point);
        widget_display (point);
        widget_flush (point);
        {
          for (i = 0; i < 4; i++)
            {
              widget_display (name_frame[i]);
              widget_flush (name_frame[i]);
            }
        }

        if (!auto_play)
          wait_key ();

        hora_reset ();
      }
    }

  linepos_clear ();
  for (i = 0; i < 4; i++)
    {
      widget_model_change (name_frame[i], get_basiccolorpixel (), white,
                           white, white);
    }
  if (!BUILD4)
    {
      widget_unmap (point);
    }
  else
    {
      unwrap_widgets ();
    }
  board_reset ();
  board_redraw (1);

  if (logfile)
    log_play (gp, logfile);
}