MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->ui->b_disconnect->setEnabled(false);
    this->ui->gb_top->setEnabled(false);
    this->ui->b_send->setEnabled(false);
    this->ui->b_verify->setEnabled(false);
    this->ui->b_repeat->setEnabled(false);
    this->ui->b_reset->setEnabled(false);
    this->btl = new Bootloader();
    this->tfThread = new transferThread();

    this->lastAction = ACTION_NONE;

    this->ui->gb_top->setEnabled(true);
    QObject::connect(this->ui->b_quit,SIGNAL(clicked()),this,SLOT(Quit()));
    QObject::connect(this->ui->b_qt,SIGNAL(clicked()),qApp,SLOT(aboutQt()));
    QObject::connect(this->ui->b_connect, SIGNAL(clicked()), this, SLOT(Connect()));
    QObject::connect(this->ui->b_disconnect, SIGNAL(clicked()), this, SLOT(Disconnect()));
    QObject::connect(this->ui->b_send, SIGNAL(clicked()), this, SLOT(Send()));
    QObject::connect(this->ui->b_verify, SIGNAL(clicked()), this, SLOT(Verify()));
    QObject::connect(this->ui->b_repeat, SIGNAL(clicked()), this, SLOT(Repeat()));
    QObject::connect(this->ui->b_reset, SIGNAL(clicked()), this, SLOT(ResetMCU()));


    // Thread
    QObject::connect(this->tfThread, SIGNAL(sendProgress(quint32)), this, SLOT(updateProgress(quint32)));
    QObject::connect(this->tfThread, SIGNAL(sendStatus(QString)), this, SLOT(updateStatus(QString)));
    QObject::connect(this->tfThread, SIGNAL(sendLock(bool)), this, SLOT(lockUI(bool)));
    QObject::connect(this->ui->b_stop, SIGNAL(clicked()), this->tfThread, SLOT(halt()));
    QObject::connect(this->tfThread, SIGNAL(sendLog(QString)), this, SLOT(log(QString)));

}
示例#2
0
NS_IMETHODIMP
KeyboardEvent::GetRepeat(bool* aIsRepeat)
{
  NS_ENSURE_ARG_POINTER(aIsRepeat);
  *aIsRepeat = Repeat();
  return NS_OK;
}
void KeyboardEvent::GetInitDict(KeyboardEventInit& aParam)
{
  GetKey(aParam.mKey);
  GetCode(aParam.mCode);
  aParam.mLocation = Location();
  aParam.mRepeat = Repeat();
  aParam.mIsComposing = IsComposing();

  // legacy attributes
  aParam.mKeyCode = KeyCode();
  aParam.mCharCode = CharCode();
  aParam.mWhich = Which();

  // modifiers from EventModifierInit
  aParam.mCtrlKey = CtrlKey();
  aParam.mShiftKey = ShiftKey();
  aParam.mAltKey = AltKey();
  aParam.mMetaKey = MetaKey();

  WidgetKeyboardEvent* internalEvent = mEvent->AsKeyboardEvent();
  aParam.mModifierAltGraph = internalEvent->IsAltGraph();
  aParam.mModifierCapsLock = internalEvent->IsCapsLocked();
  aParam.mModifierFn = internalEvent->IsFn();
  aParam.mModifierFnLock = internalEvent->IsFnLocked();
  aParam.mModifierNumLock = internalEvent->IsNumLocked();
  aParam.mModifierOS = internalEvent->IsOS();
  aParam.mModifierScrollLock = internalEvent->IsScrollLocked();
  aParam.mModifierSymbol = internalEvent->IsSymbol();
  aParam.mModifierSymbolLock = internalEvent->IsSymbolLocked();

  // EventInit
  aParam.mBubbles =  internalEvent->mFlags.mBubbles;
  aParam.mCancelable = internalEvent->mFlags.mCancelable;
}
void fasta(int iterations, const char* filename) {

	make_cumulative(iub);
	make_cumulative(homosapiens);

	std::ofstream output(filename, std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);

	make(output, "ONE"  , "H**o sapiens alu"      , iterations * 2, Repeat(alu));
	make(output, "TWO"  , "IUB ambiguity codes"   , iterations * 3, Random(iub));
	make(output, "THREE", "H**o sapiens frequency", iterations * 5, Random(homosapiens));
}
示例#5
0
void Tutorial(int& scene, Font& font)
{
	//画像呼び込み
	Texture floor_image("res/image/floor.png");
	Texture dog_image("res/image/dog.png");
	Texture skeleton_image("res/image/skeleton.png");

	//背景画像
	Random rand;
	rand.setSeed(std::time(nullptr));
	int bg_count = rand(0, 5);
	Texture bg;
	Texture bg2;
	Vec2f bg_pos = Vec2f(-WIDTH / 2, -HEIGHT / 2);
	Vec2f bg2_pos = Vec2f(WIDTH * 3 / 2, -HEIGHT / 2);

	switch (bg_count)
	{
	case 0:
		bg = Texture("res/image/gm_bg.png");
		bg2 = Texture("res/image/gm_bg.png");
		break;

	case 1:
		bg = Texture("res/image/gm_bg2.png");
		bg2 = Texture("res/image/gm_bg2.png");
		break;

	case 2:
		bg = Texture("res/image/gm_bg3.png");
		bg2 = Texture("res/image/gm_bg3.png");
		break;

	case 3:
		bg = Texture("res/image/gm_bg4.png");
		bg2 = Texture("res/image/gm_bg4.png");
		break;

	case 4:
		bg = Texture("res/image/gm_bg5.png");
		bg2 = Texture("res/image/gm_bg5.png");
		break;

	case 5:
		bg = Texture("res/image/gm_bg6.png");
		bg2 = Texture("res/image/gm_bg6.png");
		break;
	}


	//サウンド
	Media skeletonjump("res/sound/skeletonjump.wav");
	Media dogjump("res/sound/dogjump.wav");
	Media dogdash("res/sound/dogdash.wav");
	Media skeletondash("res/sound/skeletondash.wav");

	//決定音
	Media decision("res/sound/decision.wav");

	//ポーズ
	Color color1 = Color::red;
	Color color2 = Color::white;

	int count = 0;

	//for文で使う
	int i;
	int k;

	//アニメーション
	int index = 4;
	int index2 = 0;
	int animation_count = 0;

	//プレイヤー
	Player skeleton, dog;

	//プレイヤー (ガイコツ)
	skeleton.pos.x() = 0.0f;
	skeleton.pos.y() = -160.0f;
	skeleton.size.x() = 64.0f;
	skeleton.size.y() = 80.0f;
	skeleton.vector.x() = 15.0f;
	skeleton.vector.y() = 0.0f;
	skeleton.jumpflag = false;
	skeleton.speedupflag = false;

	//プレイヤー (犬)
	dog.pos.x() = -700.0f;
	dog.pos.y() = -160.0;
	dog.size.x() = 128.0f;
	dog.size.y() = 64.0f;
	dog.vector.x() = 14.0f;
	dog.vector.y() = 0.0f;
	dog.jumpflag = false;
	dog.speedupflag = false;

	//床
	Object floor;

	//ステータス
	Status status;
	status.camera = 0.0f;
	status.scroll = 20.0;
	status.gravity = 0.2f;
	status.pose = false;


	//床
	int mapchip[Geography::HEIGHTNUM][Geography::WIDTHNUM] =
	{														   //20																					     //50
		0, 0, 0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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
	};
	float mapchip_pos_x[Geography::HEIGHTNUM][Geography::WIDTHNUM];
	float mapchip_pos_y[Geography::HEIGHTNUM][Geography::WIDTHNUM];
	float map_pos_x = -2048.0f;
	float map_pos_y = 352.0f;
	float map_size_xy = 128.0f;
	for (i = 0; i < Geography::HEIGHTNUM; ++i)
	{
		for (k = 0; k < Geography::WIDTHNUM; ++k)
		{
			mapchip_pos_x[i][k] = map_pos_x;
			mapchip_pos_y[i][k] = map_pos_y;

			map_pos_x += map_size_xy;
		}

		map_pos_x = -2048.0f;
		map_pos_y -= map_size_xy;
	}


	/////////////////////////////////////////////////////////////////////////////////////////////
	//チュートリアルスタート前
	Vec2f size = Vec2f(2048.0f, 512.0f);

	while (size.y() != 0.0f)
	{
		if (!env.isOpen()){ exit(0); }

		size.y() -= 8.0f;

		env.begin();

		drawTextureBox(-WIDTH / 2, -HEIGHT / 2, WIDTH, HEIGHT, 0, 0, WIDTH, HEIGHT, bg);

		//地形
		for (i = 0; i < Geography::HEIGHTNUM; ++i)
		{
			for (k = 0; k < Geography::WIDTHNUM; ++k)
			{
				if (mapchip[i][k] == FLOOR)
				{
					if (mapchip_pos_x[i][k] + map_size_xy - status.camera >= -(WIDTH / 2) && mapchip_pos_x[i][k] - status.camera < WIDTH / 2)
					{
						drawTextureBox(mapchip_pos_x[i][k] - status.camera, mapchip_pos_y[i][k], map_size_xy, map_size_xy, 0, 0, 64, 64, floor_image);
					}
				}

				if (mapchip[i][k] == FACE)
				{
					drawTextureBox(mapchip_pos_x[i][k] - status.camera, mapchip_pos_y[i][k], map_size_xy, map_size_xy, 0, 0, 192, 64, floor_image);
				}
			}
		}

		//犬
		drawTextureBox(dog.pos.x() - status.camera, dog.pos.y(), dog.size.x(), dog.size.y(), 128 * index, 0, 100, 50, dog_image);

		//ガイコツ
		drawTextureBox(skeleton.pos.x() - status.camera, skeleton.pos.y(), skeleton.size.x(), skeleton.size.y(), 128 * index2 + 30, 0, 98, 230, skeleton_image);

		drawFillBox(-WIDTH / 2, -HEIGHT / 2, size.x(), size.y(), Color::black);
		drawFillBox(-WIDTH / 2, HEIGHT / 2, size.x(), -size.y(), Color::black);

		env.end();
	}




	/////////////////////////////////////////////////////////////////////////////////////////////
	//チュートリアル
	while (scene == TUTORIAL || decision.isPlaying())
	{
		if (!env.isOpen()){ exit(0); }

		env.begin();

		//重力
		Gravity(skeleton, dog, status);

		//速度、ジャンプ
		Move(skeletonjump, dogjump, dogdash, skeletondash, dog, skeleton, status);

		//当たり判定
		for (i = 0; i < Geography::HEIGHTNUM; ++i)
		{
			for (k = 0; k < Geography::WIDTHNUM; ++k)
			{
				if (mapchip[i][k] == Geography::FLOOR)
				{
					floor.pos = Vec2f(mapchip_pos_x[i][k], mapchip_pos_y[i][k]);
					floor.size = Vec2f(map_size_xy, map_size_xy);

					HitFlag(skeleton, floor, status, mapchip[i - 1][k], mapchip[i - 1][k + 1], mapchip[i][k + 1], mapchip[i + 1][k], i, k);

					HitFlag(dog, floor, status, mapchip[i - 1][k], mapchip[i - 1][k + 1], mapchip[i][k + 1], mapchip[i + 1][k], i, k);
				}
			}
		}

		//リスタート
		Restart(dog, skeleton, status);

		//無限生成
		Repeat(skeleton, dog, status, mapchip_pos_x[0][314], bg_pos, bg2_pos);

		/////////////////////////////////////////////////////////////////////////
		//ポーズ
		Pose(font, scene, status, skeleton, dog, color1, color2, count, decision);

		/////////////////////////////////////////////////////////////////////////
		//アニメーション
		Animation(index, index2, animation_count);


		////////////////////////////////////////////////////////////////////////
		//背景ループ
		////////////////////////////////////////////////////////////////////////
		Bg(bg_pos, bg2_pos, status);


		///////////////////////////////////////////////////////////////////////
		//表示処理

		drawTextureBox(bg_pos.x() - status.camera, bg_pos.y(), WIDTH, HEIGHT, 0, 0, WIDTH, HEIGHT, bg);
		drawTextureBox(bg2_pos.x() - status.camera, bg2_pos.y(), -WIDTH, HEIGHT, 0, 0, WIDTH, HEIGHT, bg2);

		//地形
		for (i = 0; i < Geography::HEIGHTNUM; ++i)
		{
			for (k = 0; k < Geography::WIDTHNUM; ++k)
			{
				if (mapchip[i][k] == FLOOR)
				{
					if (mapchip_pos_x[i][k] + map_size_xy - status.camera >= -(WIDTH / 2) && mapchip_pos_x[i][k] - status.camera < WIDTH / 2)
					{
						drawTextureBox(mapchip_pos_x[i][k] - status.camera, mapchip_pos_y[i][k], map_size_xy, map_size_xy, 0, 0, 64, 64, floor_image);
					}
				}

				if (mapchip[i][k] == FACE)
				{
					drawTextureBox(mapchip_pos_x[i][k] - status.camera, mapchip_pos_y[i][k], map_size_xy, map_size_xy, 0, 0, 192, 64, floor_image);
				}
			}
		}

		//犬
		font.draw("A / ダッシュ", Vec2f(dog.pos.x() + dog.size.x() / 2 - font.drawSize("A / ダッシュ").x() / 2 - status.camera,
			dog.pos.y() + dog.size.y() + font.drawSize("A / ダッシュ").y() * 2),
			Color::lime);
		font.draw("S / ジャンプ", Vec2f(dog.pos.x() + dog.size.x() / 2 - font.drawSize("A / ダッシュ").x() / 2 - status.camera,
			dog.pos.y() + dog.size.y() + font.drawSize("A / ダッシュ").y()),
			Color::lime);

		drawTextureBox(dog.pos.x() - status.camera, dog.pos.y(), dog.size.x(), dog.size.y(), 128 * index, 0, 100, 50, dog_image);

		//ガイコツ
		font.draw("K / ダッシュ", Vec2f(skeleton.pos.x() + skeleton.size.x() / 2 - font.drawSize("K / ダッシュ").x() / 2 - status.camera,
			skeleton.pos.y() + skeleton.size.y() + font.drawSize("K / ダッシュ").y() * 2),
			Color::red);
		font.draw("L / ジャンプ", Vec2f(skeleton.pos.x() + skeleton.size.x() / 2 - font.drawSize("L / ジャンプ").x() / 2 - status.camera,
			skeleton.pos.y() + skeleton.size.y() + font.drawSize("L / ジャンプ").y()),
			Color::red);

		
		font.draw("SPACE / ポーズ", Vec2f(WIDTH / 2 - font.drawSize("SPACE / ポーズ").x(), -HEIGHT / 2), Color::yellow);


		drawTextureBox(skeleton.pos.x() - status.camera, skeleton.pos.y(), skeleton.size.x(), skeleton.size.y(), 128 * index2 + 30, 0, 98, 230, skeleton_image);

		//ポーズ
		if (status.pose == true)
		{
			drawFillBox(-WIDTH / 2, -HEIGHT / 2, WIDTH, HEIGHT, Color(0.0f, 0.0f, 0.0f, 0.7f));

			font.draw("タイトル", Vec2f(0, 80) - font.drawSize("タイトル") / 2, color1);
			font.draw("再開", Vec2f(0, -80) - font.drawSize("再開") / 2, color2);
		}


		env.end();
	}

	env.flushInput();
}
示例#6
0
void ShowLine (int move __attribute__ ((unused)), int score, char c)
/*****************************************************************************
 *
 *  Print out the latest PV found during the search.
 *  The only move we know is the root move.  The rest of the PV is taken
 *  from the hash table.  This strategy avoids all the headaches associated
 *  with returning the PV up from the leaf to the root.
 *
 *****************************************************************************/
{
   int i, len;
   int pvar[MAXPLYDEPTH];

   /* SMC */
   if (!(flags & POST))
     return;
   if (NodeCnt < 500000 && (flags & SOLVE)) {
      /* printf("NodeCnt = %d\n",NodeCnt); getchar(); */
      return;
   }
   if (Idepth == DEPTH && c == '&')
      return;
   if ((flags & XBOARD) && c == '&')
      return;
   if (rootscore == -INFINITY-1)
      return;
   GetElapsed ();

   /*
    * What is the reason for these different output formats, in
    * particular for et?
    */
   if (flags & XBOARD) {
     if (score > MATE-255) {
       printf ("%d%c Mat%d %d %lu\t", Idepth/DEPTH, c,
                (int)(MATE+2-abs(score))/2, (int)(et*100), NodeCnt+QuiesCnt);
       if (ofp != stdout)
	 fprintf (ofp,"%2d%c%7.2f  Mat%02d%10lu\t", Idepth/DEPTH, c, et,
                (MATE+2-abs(score))/2, NodeCnt+QuiesCnt);
     } else if (score < -MATE+255) {
       printf ("%d%c -Mat%2d %d %lu\t", Idepth/DEPTH, c,
                (int)(MATE+2-abs(score))/2, (int)(et*100), NodeCnt+QuiesCnt);
       if (ofp != stdout)
	 fprintf (ofp,"%2d%c%7.2f -Mat%02d%10lu\t", Idepth/DEPTH, c, et,
		 (MATE+2-abs(score))/2, NodeCnt+QuiesCnt);
     } else {
	 printf ("%d%c %d %d %lu\t", Idepth/DEPTH, c, (int)score, 
		 (int)(et*100), NodeCnt+QuiesCnt);
	 if (ofp != stdout) 
	   fprintf (ofp,"%2d%c%7.2f%7d%10lu\t", Idepth/DEPTH, c, et, score, NodeCnt+QuiesCnt);	 
       }
   }
   else {
     if (score > MATE-255) {
       printf ("\r%2d%c%7.2f  Mat%02d%10lu\t", Idepth/DEPTH, c, et,
                (MATE+2-abs(score))/2, NodeCnt+QuiesCnt);
       if (ofp != stdout)
	 fprintf (ofp,"\r%2d%c%7.2f  Mat%02d%10lu\t", Idepth/DEPTH, c, et,
                (MATE+2-abs(score))/2, NodeCnt+QuiesCnt);
     } else if (score < -MATE+255) {
       printf ("\r%2d%c%7.2f -Mat%02d%10lu\t", Idepth/DEPTH, c, et,
	     (MATE+2-abs(score))/2, NodeCnt+QuiesCnt);
       if (ofp != stdout)
	 fprintf (ofp,"\r%2d%c%7.2f -Mat%02d%10lu\t", Idepth/DEPTH, c, et,
		 (MATE+2-abs(score))/2, NodeCnt+QuiesCnt);
     } else {
	 printf ("\r%2d%c%7.2f%7d%10lu\t", Idepth/DEPTH, c, et, score, NodeCnt+QuiesCnt);
	 if (ofp != stdout) 
	   fprintf (ofp,"\r%2d%c%7.2f%7d%10lu\t", Idepth/DEPTH, c, et, score, NodeCnt+QuiesCnt);	 
      }
   }

   if (c == '-')
   {
      printf ("\n");
      if (ofp != stdout) fprintf(ofp, "\n");
      return;
   }
   else if (c == '+')
   {
      SANMove (RootPV, 1);
      printf (" %s\n", SANmv);
      if (ofp != stdout) fprintf (ofp," %s\n", SANmv);
      return;
   }

   SANMove (RootPV, 1);
   printf (" %s", SANmv);
   if (ofp != stdout) fprintf (ofp," %s", SANmv);
   MakeMove (board.side, &RootPV);
   TreePtr[3] = TreePtr[2];
   GenMoves (2);
   len = strlen (SANmv);
   i = 2;
   pvar[1] = RootPV;

   /*  We fill the rest of the PV with moves from the hash table */
   if ((flags & USEHASH))
   {
      while (TTGetPV (board.side, i, rootscore, &pvar[i]))
      {
         if ((MATESCORE(score) && abs(score) == MATE+2-i) || Repeat ())
            break;
  
         if (len >= 32)
         {
            printf ("\n\t\t\t\t");
	    if (ofp != stdout) fprintf (ofp,"\n\t\t\t\t");
            len = 0;
         }
         SANMove (pvar[i], i);
         printf (" %s", SANmv);
	 if (ofp != stdout) fprintf (ofp," %s", SANmv);
         MakeMove (board.side, &pvar[i]);
         TreePtr[i+2] = TreePtr[i+1];
         GenMoves (++i);
         len += strlen (SANmv);
      }
   }

   printf ("\n");
   if (ofp != stdout) fprintf(ofp,"\n");
   for (--i; i; i--)
      UnmakeMove (board.side, &pvar[i]);
   fflush (stdout);
   if (ofp != stdout) fflush (ofp);
}
示例#7
0
int Search (int ply, int depth, int alpha, int beta, int nodetype)
/**************************************************************************
 *
 *  The basic algorithm for this search routine came from Anthony 
 *  Marsland.  It is a PVS (Principal Variation Search) algorithm.
 *  The fail-soft alpha-beta technique is also used for improved
 *  pruning.
 *
 **************************************************************************/
{
   int best, score, nullscore, savealpha;
   int side, xside;
   int rc, t0, t1, firstmove;
   int fcut, fdel, donull, savenode, nullthreatdone, extend;
   leaf *p, *pbest;
   int g0, g1;
   int upperbound;

   /* Check if this position is a known draw */
   if (EvaluateDraw ())
      return (DRAWSCORE);
   if (GameCnt >= Game50+3 && Repeat())
   {
      RepeatCnt++;
      return (DRAWSCORE); 
   }

   side = board.side;
   xside = 1^side;
   donull = true;

/*************************************************************************
 *
 *  Perform some basic search extensions.
 *  1.  One reply extensions.  
 *  2.  If in check, extend (maximum of Idepth-1).
 *  3.  If there is a threat to the King, extend (not beyond 2*Idepth)
 *  4.  If recapture to same square and not beyond Idepth+2
 *  5.  If pawn move to 7th rank at the leaf node, extend.
 *
 *************************************************************************/
   extend = false;
   InChk[ply] = SqAtakd (board.king[side], xside);
   if (InChk[ply])
   {
      TreePtr[ply+1] = TreePtr[ply];
      GenCheckEscapes (ply);
      if (TreePtr[ply] == TreePtr[ply+1])
         return (-MATE+ply-2);
      if (TreePtr[ply]+1 == TreePtr[ply+1])
      {
         depth += DEPTH;
	 extend = true;
         OneRepCnt++;
      }
   }

/*
   We've already found a mate at the next ply.  If we aren't being mated by 
   a shorter line, so just return the current material value.
*/
   if (rootscore + ply >= MATE)
      return (MATERIAL);

   g0 = Game[GameCnt].move;
   g1 = GameCnt > 0 ? Game[GameCnt-1].move : 0;
   t0 = TOSQ(g0); 
   t1 = TOSQ(g1);
   ChkCnt[ply+1] = ChkCnt[ply];
   ThrtCnt[ply+1] = ThrtCnt[ply];
   KingThrt[white][ply] = MateScan (white);
   KingThrt[black][ply] = MateScan (black);
   if (InChk[ply]  && /* ChkCnt[ply] < Idepth-1*/ ply <= 2*Idepth/DEPTH)
   {
      ChkExtCnt++;
      ChkCnt[ply+1]++;
      depth += DEPTH;
      extend = true;
   }
   else if (!KingThrt[side][ply-1] && KingThrt[side][ply] && ply <= 2*Idepth/DEPTH)
   {
      KingExtCnt++;
      extend = true;
      depth += DEPTH;
      extend = true;
      donull = false;
   }
   /* Promotion extension */
   else if (g0 & PROMOTION)
   {
      PawnExtCnt++;
      depth += DEPTH;
      extend = true;
   }
   /* Recapture extension */
   else if ((g0 & CAPTURE) && (board.material[computer] - 
	board.material[1^computer] == RootMaterial))
   {
      RcpExtCnt++;
      depth += DEPTH;
      extend = true;
   }
   /* 6th or 7th rank extension */
   else if (depth <= DEPTH && cboard[t0] == pawn && (RANK(t0) == rank7[xside] || RANK(t0) == rank6[xside]))
   {
      PawnExtCnt++;
      depth += DEPTH;
      extend = true;
   }

/**************************************************************************** 
 *
 *  The following extension is to handle cases when the opposing side is 
 *  delaying the mate by useless interposing moves. 
 *
 ****************************************************************************/
   if (ply > 2 && InChk[ply-1] && cboard[t0] != king && t0 != t1 && 
	 !SqAtakd (t0, xside))
   {
      HorzExtCnt++;
      depth += DEPTH;
      extend = true;
   }

/***************************************************************************
 *
 *  This is a new code to perform search reductiion.  We introduce some
 *  form of selectivity here.
 *
 **************************************************************************/

   if (depth <= 0)
      return (Quiesce (ply, alpha, beta)); 

/**************************************************************************** 
 *
 *  Probe the transposition table for a score and a move.
 *  If the score is an upperbound, then we can use it to improve the value
 *  of beta.  If a lowerbound, we improve alpha.  If it is an exact score,
 *  if we now get a cut-off due to the new alpha/beta, return the score.
 *
 ***************************************************************************/
   Hashmv[ply] = 0;
   upperbound = INFINITY;
   if (flags & USEHASH)
   {
      rc = TTGet (side, depth, ply, alpha, beta, &score, &g1);
      if (rc)
      {
         Hashmv[ply] = g1 & MOVEMASK;
         switch (rc)
         {
            case POORDRAFT  :  break;
	    case EXACTSCORE :  return (score);
            case UPPERBOUND :  beta = MIN (beta, score);
			       upperbound = score;
			       donull = false;
	                       break;
            case LOWERBOUND :  /*alpha = MAX (alpha, score);*/
			       alpha = score;
	                       break;
	    case QUIESCENT  :  Hashmv[ply] = 0;
	                       break;
	    default : break;
         }
	 if (alpha >= beta)
	    return (score);
      }
   }

/*****************************************************************************
 *
 *  Perform the null move here.  There are certain cases when null move
 *  is not done.  
 *  1.  When the previous move is a null move.
 *  2.  At the frontier (depth == 1)
 *  3.  At a PV node.
 *  4.  If side to move is in check.
 *  5.  If the material score + pawn value is still below beta.
 *  6.  If we are being mated at next ply.
 *  7.  If hash table indicate the real score is below beta (UPPERBOUND).
 *  8.  If side to move has less than or equal to a bishop in value.
 *  9.  If Idepth <= 3.  This allows us to find mate-in 2 problems quickly.
 *  10. We are looking for a null threat.
 *
 *****************************************************************************/
   if (ply > 4 && InChk[ply-2] && InChk[ply-4])
      donull = false;
   if (flags & USENULL && g0 != NULLMOVE && depth > DEPTH && nodetype != PV &&
       !InChk[ply] && MATERIAL+ValueP > beta && beta > -MATE+ply && donull &&
	board.pmaterial[side] > ValueB && !threatply)
   {
      TreePtr[ply+1] = TreePtr[ply];
      MakeNullMove (side);
      nullscore = -Search (ply+1, depth-DEPTH-R, -beta, -beta+1, nodetype);
      UnmakeNullMove (xside); 
      if (nullscore >= beta)
      {
         NullCutCnt++;
         return (nullscore);
      }
      if ( depth-DEPTH-R >= 1 && MATERIAL > beta && nullscore <= -MATE+256)
      {
         depth += DEPTH;
	 extend = true;
      }
   }

   if (InChk[ply] && TreePtr[ply]+1 < TreePtr[ply+1])
      SortMoves (ply);

   pickphase[ply] = PICKHASH;
   GETNEXTMOVE;

/*************************************************************************
 *
 *  Razoring + Futility.
 *  At depth 3, if there is no extensions and we are really bad, decrease
 *  the search depth by 1.
 *  At depth 2, if there is no extensions and we are quite bad, then we
 *  prune all non checking moves and capturing moves that don't bring us up
 *  back to alpha.
 *  Caveat: Skip all this if we are in the ending.
 *
 *************************************************************************/
   fcut = false;
   fdel = MAX (ValueQ, maxposnscore[side]);
   if (!extend && nodetype != PV && depth == 3*DEPTH && FUTSCORE <= alpha)
   {
      depth = 2*DEPTH;
      RazrCutCnt++;
   }
   fdel = MAX (ValueR, maxposnscore[side]);
   fcut = (!extend && nodetype != PV && depth == 2*DEPTH && FUTSCORE <= alpha);
   if (!fcut)
   {
      fdel = MAX (3*ValueP, maxposnscore[side]);
      fcut = (nodetype != PV && depth == DEPTH && FUTSCORE <= alpha);
   }

   MakeMove (side, &p->move);
   NodeCnt++;
   g0 = g1 = 0;
   while ((g0 = SqAtakd (board.king[side], xside)) > 0 ||
      	 (fcut && FUTSCORE < alpha && !SqAtakd (board.king[xside], side) &&
	  !MateScan (xside)))
   {
      if (g0 == 0) g1++;
      UnmakeMove (xside, &p->move);
      if (GETNEXTMOVE == false)
         return (g1 ? Evaluate(alpha,beta) : DRAWSCORE);
      MakeMove (side, &p->move);
      NodeCnt++;
   }
   firstmove = true;
   pbest = p;
   best = -INFINITY;
   savealpha = alpha;
   nullthreatdone = false;
   nullscore = INFINITY;
   savenode = nodetype;
   if (nodetype != PV)
      nodetype = (nodetype == CUT) ? ALL : CUT;

   while (1)
   {
      /* We have already made the move before the loop. */
      if (firstmove)
      {
         firstmove = false;
         score = -Search (ply+1, depth-DEPTH, -beta, -alpha, nodetype);
      }

      /* Zero window search for rest of moves */
      else
      {
	 if (GETNEXTMOVE == false)
	    break;

#ifdef THREATEXT
/****************************************************************************
 *
 *  This section needs to be explained.  We are doing a null threat search
 *  and the previous ply was the null move.  Inhibit any move which captures
 *  the fail-high moving piece.  Also inhibit any move by the piece which is 
 *  captured by the fail-high move.  Both these moves cannot be executed in
 *  the actual threat, so.....
 *  Also 3 plies later, inhibit moves out of the target square of the PV/fail
 *  high move as this is also not possible.
 *
 ****************************************************************************/
	 if (threatply+1 == ply)
	 { 
	    if ((TOSQ(p->move) == FROMSQ(threatmv)) ||
			 (FROMSQ(p->move) == TOSQ(threatmv)))
	       continue; 
	 }
         if (threatply && threatply+3 == ply && FROMSQ(p->move)==TOSQ(threatmv))
            continue;
#endif

         MakeMove (side, &p->move);
         NodeCnt++;
         if (SqAtakd (board.king[side], xside)) 
         {
            UnmakeMove (xside, &p->move);
            continue;
         }

/*****************************************************************************
 *
 *  Futility pruning.  The idea is that at the frontier node (depth == 1),
 *  if the side on the move is materially bad, then if the move doesn't win
 *  back material or the move isn't a check or doesn't threatened the king, 
 *  then there is no point in searching this move.  So skip it.  
 *  Caveat:  However if the node is a PV, we skip this test.
 *
 *****************************************************************************/
      	 if (fcut && FUTSCORE <= alpha && !SqAtakd (board.king[xside], side) &&
		!MateScan (xside))
		
         {
            UnmakeMove (xside, &p->move);
	    FutlCutCnt++;
	    NodeCnt--;
            continue;
         }
         NodeCnt++;

         if (nodetype == PV)
            nodetype = CUT;
         alpha = MAX (best, alpha);                /* fail-soft condition */
         score = -Search (ply+1, depth-DEPTH, -alpha-1, -alpha, nodetype);
         if (score > best)
         {
	    if (savenode == PV)
	       nodetype = PV;
            if (alpha < score && score < beta)
	    {
               score = -Search (ply+1, depth-DEPTH, -beta, -score, nodetype);
	    } 
	    if (nodetype == PV && score <= alpha &&
		Game[GameCnt+1].move == NULLMOVE)
	    {
               score = -Search (ply+1, depth-DEPTH, -alpha, INFINITY, nodetype);
	    }
         }
      }
      UnmakeMove (xside, &p->move);

/*  Perform threat extensions code */
#ifdef THREATEXT
      if ((score >= beta || nodetype == PV) && !InChk[ply] && g0 != NULLMOVE &&
	!threatply && depth == 4 && ThrtCnt[ply] < 1)
      {
	 if (!nullthreatdone)
	 {
	    threatply = ply;
	    threatmv  = p->move;
            MakeNullMove (side);
            nullscore = -Search(ply+1, depth-1-R, -alpha+THREATMARGIN, 
			-alpha+THREATMARGIN+1, nodetype);
            UnmakeNullMove (xside); 
	    nullthreatdone = true;
	    threatply = 0;
	 }
	 if (nullscore <= alpha-THREATMARGIN)
	 {
	    ThrtExtCnt++;
            ThrtCnt[ply+1]++;
            MakeMove (side, &p->move);
            score = -Search (ply+1, depth, -beta, -alpha, nodetype);
            UnmakeMove (xside, &p->move);
            ThrtCnt[ply+1]--;
         }
      }	
#endif
      
      if (score > best)
      {
         best = score;
         pbest = p;
	 if (best >= beta)
	    goto done;
      }

      if (flags & TIMEOUT)
      {
         best = (ply & 1 ? rootscore : -rootscore);
	 return (best);
      }

      if (SearchDepth == 0 && (NodeCnt & TIMECHECK) == 0)
      {
         GetElapsed ();
         if ((et >= SearchTime && (rootscore == -INFINITY-1 || 
		ply1score > lastrootscore - 25 || flags & SOLVE)) ||
	     et >= maxtime)
	    SET (flags, TIMEOUT);        
      }

/*  The following line should be explained as I occasionally forget too :) */
/*  This code means that if at this ply, a mating move has been found,     */
/*  then we can skip the rest of the moves!  				   */
      if (MATE+1 == best+ply)
         goto done;
   } 

/*****************************************************************************
 *
 *  Out of main search loop.
 *
 *****************************************************************************/
done:

/*
   if (upperbound < best)
      printf ("Inconsistencies %d %d\n", upperbound, best);
*/

   /*  Save the best move inside the transposition table  */
   if (flags & USEHASH)
      TTPut (side, depth, ply, savealpha, beta, best, pbest->move); 

   /*  Update history  */
   if (best > savealpha)
      history[side][pbest->move & 0x0FFF] += HISTSCORE(depth/DEPTH);

   /*  Don't store captures as killers as they are tried before killers */
   if (!(pbest->move & (CAPTURE | PROMOTION)) && best > savealpha)
   {
      if (killer1[ply] == 0)
         killer1[ply] = pbest->move & MOVEMASK;
      else if ((pbest->move & MOVEMASK) != killer1[ply])
         killer2[ply] = pbest->move & MOVEMASK;
   }

   return (best);
}
示例#8
0
 static Result member(Observable&& o) {
   return Result(Repeat(std::forward<Observable>(o)));
 }
示例#9
0
 static Result member(Observable&& o, Count&& c) {
   return Result(Repeat(std::forward<Observable>(o), std::forward<Count>(c)));
 }
示例#10
0
TreeNode* Parser::Statement()
{
	kdDebug(0)<<"Parser::Statement()"<<endl;
	while (currentToken.type == tokEOL) getToken(); // statements can allways start on newlines
	switch (currentToken.type)
	{
		case tokLearn         : return Learn();            break;

		case tokIf            : return If();               break;
		case tokFor           : return For();              break;
		case tokForEach       : return ForEach();          break;
		case tokWhile         : return While();            break;
		case tokRun           : return ExternalRun();      break;
		case tokReturn        : return Return();           break;
		case tokBreak         : return Break();            break;
		case tokUnknown       : return Other();            break; //assignment or function call

		case tokClear         : return Clear();            break;
		case tokGo            : return Go();               break;
		case tokGoX           : return GoX();              break;
		case tokGoY           : return GoY();              break;
		case tokForward       : return Forward();          break;
		case tokBackward      : return Backward();         break;
		case tokDirection     : return Direction();        break;
		case tokTurnLeft      : return TurnLeft();         break;
		case tokTurnRight     : return TurnRight();        break;
		case tokCenter        : return Center();           break;
		case tokSetPenWidth   : return SetPenWidth();      break;
		case tokPenUp         : return PenUp();            break;
		case tokPenDown       : return PenDown();          break;
		case tokSetFgColor    : return SetFgColor();       break;
		case tokSetBgColor    : return SetBgColor();       break;
		case tokResizeCanvas  : return ResizeCanvas();     break;
		case tokSpriteShow    : return SpriteShow();       break;
		case tokSpriteHide    : return SpriteHide();       break;
		case tokSpritePress   : return SpritePress();      break;
		case tokSpriteChange  : return SpriteChange();     break;

		case tokPrint         : return Print();            break;
		case tokInputWindow   : return InputWindow();      break;
		case tokMessage       : return Message();          break;
		case tokFontType      : return FontType();         break;
		case tokFontSize      : return FontSize();         break;
		case tokRepeat        : return Repeat();           break;
		case tokRandom        : return Random();           break;
		case tokWait          : return Wait();             break;
		case tokWrapOn        : return WrapOn();           break;
		case tokWrapOff       : return WrapOff();          break;
		case tokReset         : return Reset();            break;
		
		case tokEOF           : return EndOfFile();        break;
		
		case tokEnd           : Error(currentToken, i18n("Cannot understand ']'"), 1050);
		                        getToken();
		                        return new TreeNode(currentToken, Unknown);
		                        break;

		case tokBegin         : Error(currentToken, i18n("Cannot understand '['"), 1050);
		                        getToken();
		                        return new TreeNode(currentToken, Unknown);
		                        break;

		default               : break;
	}
	if (currentToken.type != tokEnd)
	{
		Error(currentToken, i18n("Cannot understand '%1'").arg(currentToken.look), 1060);
	}

	getToken();
	return new TreeNode(currentToken, Unknown); // fall-though for unknowns
}
示例#11
0
int main(int argc, char *argv[])
/* Initialize the main stuff. Will be cleaned up later. */
{
    int _735;
    int _0, _1, _2;

    Argc = argc;
    Argv = argv;
    stack_base = (char *)&_0;
    eu_startup(_00, (int)CLOCKS_PER_SEC, (int)sysconf(_SC_CLK_TCK));
    init_literal(); /* Sets up all the stuff in init-.c */
    shift_args(argc, argv);
    _4ELINUX = (3 == 3);
    _4EWINDOWS = (3 == 2);
    _4EDOS = (3 == 1);

#ifdef ELINUX
    _4PATH_SEPARATOR = 58; /* : */
    _4SLASH = 47; /* / */
    _4SLASH_CHARS = _274;
    /* Special chars allowed in path. */
#else
    _4PATH_SEPARATOR = 59; /* ; */
    _4SLASH = 92; /* \ */
    _4SLASH_CHARS = _277; /* \ and / and : */
#endif

    _4NOVALUE = _321;
    /* For showing that the item has no value. Always on, except for constants. */

    _4SymTab = _39;
    /* The Symbol Table where almost everything is stored. */

    _4file_name = _39;
    _4file_name_entered = _39;
    _4current_file_no = 1;
    _4slist = _39;

    _6warning_list = _39;
    /* Error list. */

    _10buckets = Repeat(0, 2003);
    /* For calculating hashes. */

    _10literal_init = 0;

    RefDS(_39);
    _10lastintval = _39;
    /* Integers : The values of the integers sent. */

    RefDS(_39);
    _10lastintsym = _39;
    /* Integers : Holds the position of the value. */

    /* When integers are made, lastinval and lastintsym are checked to see if we already
       have a symbol with that value. If so, we point to it instead of making a new one. */

    _10last_sym = 0;

    _10SEARCH_LIMIT = 20;
    /* How long to search for a double before stopping. */

    _10temps_allocated = 0;
    /* A counter of how many temps were allocated. Used to allocate the stack for tasks. */

    _11start_include = 0;
    _11LastLineNumber = -1;

    RefDS(_39);
    _11all_source = _39; /* Storage spot for trace. */

    _11current_source_next = 10000; /* For Scanner.c : Helps allocate for trace. */
    _14previous_op = -1; /* For emit.c : Holds the last op we emitted. */

    RefDS(_39);
    _14current_sequence = _39; /* The current sequence we are working with. */

    _14lhs_ptr = 0;
    _14assignable = 0; /* For emit.c : Is this routine/op assignable to? */

    _15sample_size = 0;
    /* For profiling. */

    _15max_stack_per_call = 1;
    /* Not necessary, since it's always 1. However, backend references it, so i'll
       remove it when I get to backend.c */

    RefDS(_39);
    DeRef(_15branch_list);
    _15branch_list = _39;

    _15short_circuit = 0;
    _15short_circuit_B = 0; /* circuit expression? given short_circuit_B is 1 (TRUE) */
    _15factors = 0;
    _15lhs_subs_level = -1;
    _15left_sym = 0;

    RefDS(_3832);
    DeRef(_15mix_msg);
    _15mix_msg = _3832;

    /* For compressing objects in backend. */
    _16MIN2B = - 32768;
    _16MAX2B = 32767;
    _16MIN3B = - 8388608;
    _16MAX3B = 8388607;
    _735 = power(2, 31);
    _16MIN4B = unary_op(UMINUS, _735);
    DeRef(_735);

    int ptr_;
    s1_ptr ptr;
    object_ptr Base;

    /* Fields for keylist... */
    _1 = NewS1(98);
    _2 = (int)((s1_ptr)_1)->base;
    Base = ((s1_ptr)_1)->base;

    /* Set the elements of the keylist. This will be used later to make SymTab. */

    e_arg1 = NewString("if");
    e_arg2 = 8; e_arg3 = 20; e_arg4 = 0; e_arg5 = 0;
    Base[1] = new_key_entry();
    /* "if", SC_KEYWORD, IF, 0, 0 */

    e_arg1 = NewString("end");
    e_arg3 = 402;
    Base[2] = new_key_entry();
    /* "end", SC_KEYWORD, END, 0, 0 */

    e_arg1 = NewString("then");
    e_arg3 = 409;
    Base[3] = new_key_entry();
    /* "then", SC_KEYWORD, THEN, 0, 0 */

    e_arg1 = NewString("procedure");
    e_arg3 = 405;
    Base[4] = new_key_entry();
    /* "procedure", SC_KEYWORD, PROCEDURE, 0, 0 */

    e_arg1 = NewString("else");
    e_arg3 = 23;
    Base[5] = new_key_entry();
    /* "else", SC_KEYWORD, ELSE, 0, 0 */

    e_arg1 = NewString("for");
    e_arg3 = 21;
    Base[6] = new_key_entry();
    /* "for", SC_KEYWORD, FOR, 0, O */

    e_arg1 = NewString("return");
    e_arg3 = 412;
    Base[7] = new_key_entry();
    /* "return", SC_KEYWORD, RETURN, 0, 0 */

    e_arg1 = NewString("do");
    e_arg3 = 410;
    Base[8] = new_key_entry();
    /* "do", SC_KEYWORD, DO, 0, 0 */

    e_arg1 = NewString("elsif");
    e_arg3 = 413;
    Base[9] = new_key_entry();
    /* "elsif", SC_KEYWORD, ELSIF, 0, 0 */

    e_arg1 = NewString("while");
    e_arg3 = 47;
    Base[10] = new_key_entry();
    /* "while", SC_KEYWORD, WHILE, 0, 0 */

    e_arg1 = NewString("type");
    e_arg3 = 415;
    Base[11] = new_key_entry();
    /* "type", SC_KEYWORD, TYPE_DECL, 0, 0 */

    e_arg1 = NewString("constant");
    e_arg3 = 416;
    Base[12] = new_key_entry();
    /* "constant", SC_KEYWORD, CONSTANT, 0, 0 */

    e_arg1 = NewString("to");
    e_arg3 = 403;
    Base[13] = new_key_entry();
    /* "to", SC_KEYWORD, TO, 0, 0 */

    e_arg1 = NewString("and");
    e_arg3 = 8;
    Base[14] = new_key_entry();
    /* "and", SC_KEYWORD, AND, 0, 0 */

    e_arg1 = NewString("or");
    e_arg3 = 9;
    Base[15] = new_key_entry();
    /* "or", SC_KEYWORD, OR, 0, 0 */

    e_arg1 = NewString("exit");
    e_arg3 = 61;
    Base[16] = new_key_entry();
    /* "exit", SC_KEYWORD, EXIT, 0, 0 */

    e_arg1 = NewString("function");
    e_arg3 = 406;
    Base[17] = new_key_entry();
    /* "function", SC_KEYWORD, FUNCTION, 0, 0 */

    e_arg1 = NewString("global");
    e_arg3 = 411;
    Base[18] = new_key_entry();
    /* "global", SC_KEYWORD, GLOBAL, 0, 0 */

    e_arg1 = NewString("by");
    e_arg3 = 404;
    Base[19] = new_key_entry();
    /* "by", SC_KEYWORD, BY, 0, 0 */

    e_arg1 = NewString("not");
    e_arg3 = 7;
    Base[20] = new_key_entry();
    /* "not", SC_KEYWORD, NOT, 0, 0 */

    e_arg1 = NewString("include");
    e_arg3 = 417;
    Base[21] = new_key_entry();
    /* "include", SC_KEYWORD, INCLUDE, 0, 0 */

    e_arg1 = NewString("with");
    e_arg3 = 419;
    Base[22] = new_key_entry();
    /* "with", SC_KEYWORD, WITH, 0, 0 */

    e_arg1 = NewString("without");
    e_arg3 = 420;
    Base[23] = new_key_entry();
    /* "without", SC_KEYWORD, WITHOUT, 0, 0 */

    e_arg1 = NewString("xor");
    e_arg3 = 154;
    Base[24] = new_key_entry();
    /* "xor", SC_KEYWORD, XOR, 0, 0 */

    /* Now the ops... */

    e_arg1 = NewString("length");
    e_arg2 = 7; e_arg3 = 501; e_arg4 = 42; e_arg5 = 1;
    Base[25] = new_key_entry();
    /* "length", SC_PREDEF, FUNC, LENGTH, 1 */

    e_arg1 = NewString("puts");
    e_arg3 = 27; e_arg4 = 44; e_arg5 = 2;
    Base[26] = new_key_entry();
    /* "puts", SC_PREDEF, PROC, PUTS, 2 */

    e_arg1 = NewString("integer");
    e_arg3 = 504; e_arg4 = 94; e_arg5 = 1;
    Base[27] = new_key_entry();
    /* "integer", SC_PREDEF, TYPE, IS_AN_INTEGER, 1 */

    e_arg1 = NewString("sequence");
    e_arg4 = 68;
    Base[28] = new_key_entry();
    /* "sequence", SC_PREDEF, TYPE, IS_A_SEQUENCE, 1 */

    e_arg1 = NewString("position");
    e_arg3 = 27; e_arg4 = 60; e_arg5 = 2;
    Base[29] = new_key_entry();
    /* "position", SC_PREDEF, PROC, POSITION, 2 */

    e_arg1 = NewString("object");
    e_arg3 = 504; e_arg4 = 40; e_arg5 = 1;
    Base[30] = new_key_entry();
    /* "object", SC_PREDEF, FUNC, IS_AN_OBJECT, 1 */

    e_arg1 = NewString("append");
    e_arg3 = 501; e_arg4 = 35; e_arg5 = 2;
    Base[31] = new_key_entry();
    /* "append", SC_PREDEF, FUNC, APPEND, 2 */

    e_arg1 = NewString("prepend");
    e_arg4 = 57;
    Base[32] = new_key_entry();
    /* "prepend", SC_PREDEF, FUNC, PREPEND, 2 */

    e_arg1 = NewString("print");
    e_arg3 = 27; e_arg4 = 19;
    Base[33] = new_key_entry();
    /* "print", SC_PREDEF, PROC, PRINT, 2 */

    e_arg1 = NewString("printf");
    e_arg4 = 38; e_arg5 = 3;
    Base[34] = new_key_entry();
    /* "printf", SC_PREDEF, PROC, PRINTF, 3 */

    e_arg1 = NewString("clear_screen");
    e_arg4 = 59; e_arg5 = 0;
    Base[35] = new_key_entry();
    /* "clear_screen", SC_PREDEF, PROC, CLEAR_SCREEN, 0 */

    e_arg1 = NewString("floor");
    e_arg3 = 501; e_arg4 = 83; e_arg5 = 1;
    Base[36] = new_key_entry();
    /* "floor", SC_PREDEF, FUNC, FLOOR, 1 */

    e_arg1 = NewString("getc");
    e_arg4 = 33;
    Base[37] = new_key_entry();
    /* "getc", SC_PREDEF, FUNC, GETC, 1 */

    e_arg1 = NewString("gets");
    e_arg3 = 501; e_arg4 = 17; e_arg5 = 1;
    Base[38] = new_key_entry();
    /* "gets", SC_PREDEF, FUNC, GETS, 1 */

    e_arg1 = NewString("get_key");
    e_arg4 = 79; e_arg5 = 0;
    Base[39] = new_key_entry();
    /* "get_key", SC_PREDEF, FUNC, GET_KEY, 0 */

    e_arg1 = NewString("rand");
    e_arg4 = 62; e_arg5 = 1;
    Base[40] = new_key_entry();
    /* "rand", SC_PREDEF, FUNC, RAND, 1 */

    e_arg1 = NewString("repeat");
    e_arg4 = 32; e_arg5 = 2;
    Base[41] = new_key_entry();
    /* "repeat", SC_PREDEF, FUNC, REPEAT, 2 */

    e_arg1 = NewString("atom");
    e_arg3 = 504; e_arg4 = 67; e_arg5 = 1;
    Base[42] = new_key_entry();
    /* "atom", SC_PREDEF, TYPE, IS_AN_ATOM, 1 */

    e_arg1 = NewString("compare");
    e_arg3 = 501; e_arg4 = 76; e_arg5 = 2;
    Base[43] = new_key_entry();
    /* "compare", SC_PREDEF, FUNC, COMPARE, 2 */

    e_arg1 = NewString("find");
    e_arg4 = 77;
    Base[44] = new_key_entry();
    /* "find", SC_PREDEF, FUNC, FIND, 2 */

    e_arg1 = NewString("match");
    e_arg4 = 78;
    Base[45] = new_key_entry();
    /* "match", SC_PREDEF, FUNC, MATCH, 2 */

    e_arg1 = NewString("time");
    e_arg4 = 70; e_arg5 = 0;
    Base[46] = new_key_entry();
    /* "time", SC_PREDEF, FUNC, TIME, 0 */

    e_arg1 = NewString("command_line");
    e_arg4 = 100;
    Base[47] = new_key_entry();
    /* "command_line", SC_PREDEF, FUNC, COMMAND_LINE, 0 */

    e_arg1 = NewString("open");
    e_arg4 = 37; e_arg5 = 2;
    Base[48] = new_key_entry();
    /* "open", SC_PREDEF, FUNC, OPEN, 2 */

    e_arg1 = NewString("close");
    e_arg3 = 27; e_arg4 = 86; e_arg5 = 1;
    Base[49] = new_key_entry();
    /* "close", SC_PREDEF, PROC, CLOSE, 1 */

    e_arg1 = NewString("trace");
    e_arg4 = 64; e_arg5 = 1;
    Base[50] = new_key_entry();
    /* "trace", SC_PREDEF, PROC, TRACE, 1 */

    e_arg1 = NewString("getenv");
    e_arg3 = 501; e_arg4 = 91;
    Base[51] = new_key_entry();
    /* "getenv", SC_PREDEF, FUNC, GETENV, 1 */

    e_arg1 = NewString("sqrt");
    e_arg4 = 41;
    Base[52] = new_key_entry();
    /* "sqrt", SC_PREDEF, FUNC, SQRT, 1 */

    e_arg1 = NewString("sin");
    e_arg4 = 80;
    Base[53] = new_key_entry();
    /* "sin", SC_PREDEF, FUNC, SIN, 1 */

    e_arg1 = NewString("cos");
    e_arg4 = 81;
    Base[54] = new_key_entry();
    /* "cos", SC_PREDEF, FUNC, COS, 1 */

    e_arg1 = NewString("tan");
    e_arg4 = 82;
    Base[55] = new_key_entry();
    /* "tan", SC_PREDEF, FUNC, TAN, 1 */

    e_arg1 = NewString("log");
    e_arg4 = 74;
    Base[56] = new_key_entry();
    /* "log", SC_PREDEF, FUNC, LOG, 1 */

    e_arg1 = NewString("system");
    e_arg3 = 27; e_arg4 = 99; e_arg5 = 2;
    Base[57] = new_key_entry();
    /* "system", SC_PREDEF, PROC, SYSTEM, 2 */

    e_arg1 = NewString("date");
    e_arg3 = 501; e_arg4 = 69; e_arg5 = 0;
    Base[58] = new_key_entry();
    /* "date", SC_PREDEF, FUNC, DATE, 0 */

    e_arg1 = NewString("remainder");
    e_arg4 = 71; e_arg5 = 2;
    Base[59] = new_key_entry();
    /* "remainder", SC_PREDEF, FUNC, REMAINDER, 2 */

    e_arg1 = NewString("power");
    e_arg4 = 72;
    Base[60] = new_key_entry();
    /* "power", SC_PREDEF, FUNC, POWER, 2 */

    e_arg1 = NewString("machine_func");
    e_arg4 = 111;
    Base[61] = new_key_entry();
    /* "machine_func", SC_PREDEF, FUNC, MACHINE_FUNC, 2 */

    e_arg1 = NewString("machine_proc");
    e_arg3 = 27; e_arg4 = 112;
    Base[62] = new_key_entry();
    /* "machine_proc", SC_PREDEF, PROC, MACHINE_PROC, 2 */

    e_arg1 = NewString("abort");
    e_arg4 = 126; e_arg5 = 1;
    Base[63] = new_key_entry();
    /* "abort", SC_PREDEF, PROC, ABORT, 1 */

    e_arg1 = NewString("peek");
    e_arg3 = 501; e_arg4 = 127;
    Base[64] = new_key_entry();
    /* "peek", SC_PREDEF, FUNC, PEEK, 1 */

    e_arg1 = NewString("poke");
    e_arg3 = 27; e_arg4 = 128; e_arg5 = 2;
    Base[65] = new_key_entry();
    /* "poke", SC_PREDEF, PROC, POKE, 2 */

    e_arg1 = NewString("call");
    e_arg3 = 27; e_arg4 = 129; e_arg5 = 1;
    Base[66] = new_key_entry();
    /* "call", SC_PREDEF, PROC, CALL, 1 */

    e_arg1 = NewString("sprintf");
    e_arg3 = 501; e_arg4 = 53; e_arg5 = 2;
    Base[67] = new_key_entry();
    /* "sprintf", SC_PREDEF, FUNC, SPRINTF, 2 */

    e_arg1 = NewString("arctan");
    e_arg4 = 73; e_arg5 = 1;
    Base[68] = new_key_entry();
    /* "arctan", SC_PREDEF, FUNC, ARCTAN, 1 */

    e_arg1 = NewString("and_bits");
    e_arg4 = 56; e_arg5 = 2;
    Base[69] = new_key_entry();
    /* "and_bits", SC_PREDEF, FUNC, AND_BITS, 2 */

    e_arg1 = NewString("or_bits");
    e_arg4 = 24; e_arg5 = 2;
    Base[70] = new_key_entry();
    /* "or_bits", SC_PREDEF, FUNC, OR_BITS, 2 */

    e_arg1 = NewString("xor_bits");
    e_arg4 = 26;
    Base[71] = new_key_entry();
    /* "xor_bits", SC_PREDEF, FUNC, XOR_BITS, 2 */

    e_arg1 = NewString("not_bits");
    e_arg4 = 51; e_arg5 = 1;
    Base[72] = new_key_entry();
    /* "not_bits", SC_PREDEF, FUNC, NOT_BITS, 1 */

    e_arg1 = NewString("pixel");
    e_arg3 = 27; e_arg4 = 130; e_arg5 = 2;
    Base[73] = new_key_entry();
    /* "pixel", SC_PREDEF, PROC, PIXEL, 2 */

    e_arg1 = NewString("get_pixel");
    e_arg3 = 501; e_arg4 = 131; e_arg5 = 1;
    Base[74] = new_key_entry();
    /* "get_pixel", SC_PREDEF, FUNC, GET_PIXEL, 1 */

    e_arg1 = NewString("mem_copy");
    e_arg3 = 27; e_arg4 = 132; e_arg5 = 3;
    Base[75] = new_key_entry();
    /* "mem_copy", SC_PREDEF, PROC, MEM_COPY, 3 */

    e_arg1 = NewString("mem_set");
    e_arg4 = 133; e_arg5 = 3;
    Base[76] = new_key_entry();
    /* "mem_set", SC_PREDEF, PROC, MEM_SET, 3 */

    e_arg1 = NewString("c_proc");
    e_arg4 = 134; e_arg5 = 2;
    Base[77] = new_key_entry();
    /* "c_proc", SC_PREDEF, PROC, C_PROC, 2 */

    e_arg1 = NewString("c_func");
    e_arg3 = 501; e_arg4 = 135;
    Base[78] = new_key_entry();
    /* "c_func", SC_PREDEF, FUNC, C_FUNC, 2 */

    e_arg1 = NewString("routine_id");
    e_arg4 = 136; e_arg5 = 1;
    Base[79] = new_key_entry();
    /* "routine_id", SC_PREDEF, FUNC, ROUTINE_ID, 1 */

    e_arg1 = NewString("call_proc");
    e_arg3 = 27; e_arg4 = 138; e_arg5 = 2;
    Base[80] = new_key_entry();
    /* "call_proc", SC_PREDEF, PROC, CALL_PROC, 2 */

    e_arg1 = NewString("call_func");
    e_arg3 = 501; e_arg4 = 139;
    Base[81] = new_key_entry();
    /* "call_func", SC_PREDEF, FUNC, CALL_FUNC, 2 */

    e_arg1 = NewString("poke4");
    e_arg3 = 27; e_arg4 = 140;
    Base[82] = new_key_entry();
    /* "poke4", SC_PREDEF, PROC, POKE4, 2 */

    e_arg1 = NewString("peek4s");
    e_arg3 = 501; e_arg4 = 141; e_arg5 = 1;
    Base[83] = new_key_entry();
    /* "peek4s", SC_PREDEF, FUNC, PEEK4S, 1 */

    e_arg1 = NewString("peek4u");
    e_arg4 = 142;
    Base[84] = new_key_entry();
    /* "peek4u", SC_PREDEF, FUNC, PEEK4U, 1 */

    e_arg1 = NewString("profile");
    e_arg3 = 27; e_arg4 = 153;
    Base[85] = new_key_entry();
    /* "profile", SC_PREDEF, PROC, PROFILE, 1 */

    e_arg1 = NewString("equal");
    e_arg3 = 501; e_arg4 = 155; e_arg5 = 2;
    Base[86] = new_key_entry();
    /* "equal", SC_PREDEF, FUNC, EQUAL, 2 */

    e_arg1 = NewString("system_exec");
    e_arg4 = 156;
    Base[87] = new_key_entry();
    /* "system_exec", SC_PREDEF, FUNC, SYSTEM_EXEC, 2 */

    e_arg1 = NewString("platform");
    e_arg4 = 157; e_arg5 = 0;
    Base[88] = new_key_entry();
    /* "platform", SC_PREDEF, FUNC, PLATFORM, 0 */

    e_arg1 = NewString("task_create");
    e_arg4 = 169; e_arg5 = 2;
    Base[89] = new_key_entry();
    /* "task_create", SC_PREDEF, FUNC, TASK_CREATE, 2 */

    e_arg1 = NewString("task_schedule");
    e_arg3 = 27; e_arg4 = 170;
    Base[90] = new_key_entry();
    /* "task_schedule", SC_PREDEF, PROC, TASK_SCHEDULE, 2 */

    e_arg1 = NewString("task_yield");
    e_arg4 = 171; e_arg5 = 0;
    Base[91] = new_key_entry();
    /* "task_yield", SC_PREDEF, PROC, TASK_YIELD, 0 */

    e_arg1 = NewString("task_self");
    e_arg3 = 501; e_arg4 = 172;
    Base[92] = new_key_entry();
    /* "task_self", SC_PREDEF, FUNC, TASK_SELF, 0 */

    e_arg1 = NewString("task_suspend");
    e_arg3 = 27; e_arg4 = 173; e_arg5 = 1;
    Base[93] = new_key_entry();
    /* "task_suspend", SC_PREDEF, PROC, TASK_SUSPEND, 1 */

    e_arg1 = NewString("task_list");
    e_arg3 = 501; e_arg4 = 174; e_arg5 = 0;
    Base[94] = new_key_entry();
    /* "task_list", SC_PREDEF, FUNC, TASK_LIST, 0 */

    e_arg1 = NewString("task_status");
    e_arg4 = 157; e_arg5 = 1;
    Base[95] = new_key_entry();
    /* "task_status", SC_PREDEF, FUNC, TASK_STATUS, 1 */

    e_arg1 = NewString("task_clock_stop");
    e_arg3 = 27; e_arg4 = 176; e_arg5 = 0;
    Base[96] = new_key_entry();
    /* "task_clock_stop", SC_PREDEF, PROC, TASK_CLOCK_STOP, 0 */

    e_arg1 = NewString("task_clock_start");
    e_arg4 = 177;
    Base[97] = new_key_entry();
    /* "task_clock_start", SC_PREDEF, PROC, TASK_CLOCK_START, 0 */

    e_arg1 = NewString("_toplevel_");
    e_arg4 = 0;
    Base[98] = new_key_entry();
    /* "_toplevel_", SC_PREDEF, PROC, 0, 0 */

    /* _toplevel_ is an extremely important part of SymTab. When we pass off
       SymTab through the backend, this is then executed as if it were a proc.
       This contains all code not in functions or procedures. A user cannot call
       this directly because _ isn't allowed to start routines, I think. */

    _8keylist = MAKE_SEQ(_1);

    /* Generating fields for token_name now. token_name is used by LexName to get
       a correct message from a token. This way, instead of sending strings to be matched,
       we send numbers from scanner. If the number we send doesn't match scanner's, then
       we search through this list to find a name for the token to tell the user what was
       expected and what we got. If we're unable to find the token, we return '...'.
       In the future, this may only be used to output "expected %s", which would mean less
       tokens to hold. Also, less redundancy by telling the user what they sent with the line
       holding the stuff they sent too! */

    _1 = NewS1(59);
    _2 = (int)((s1_ptr)_1)->base;
    Base = ((s1_ptr)_1)->base;
    Base[1] = new_lex_entry(8, NewString("and"));
    Base[2] = new_lex_entry(502, NewString("a number"));
    Base[3] = new_lex_entry(-1, NewString("!"));
    Base[4] = new_lex_entry(404, NewString("by"));
    Base[5] = new_lex_entry(-23, NewString(":"));
    Base[6] = new_lex_entry(-30, NewString(","));
    Base[7] = new_lex_entry(15, NewString("&"));
    Base[8] = new_lex_entry(416, NewString("constant"));
    Base[9] = new_lex_entry(14, NewString("/"));
    Base[10] = new_lex_entry(410, NewString("do"));
    Base[11] = new_lex_entry(23, NewString("else"));
    Base[12] = new_lex_entry(413, NewString("elsif"));
    Base[13] = new_lex_entry(402, NewString("end"));
    Base[14] = new_lex_entry(-21, NewString("the end of file."));
    Base[15] = new_lex_entry(155, NewString("="));
    Base[16] = new_lex_entry(61, NewString("exit"));
    Base[17] = new_lex_entry(21, NewString("for"));
    Base[18] = new_lex_entry(501, NewString("a function"));
    Base[19] = new_lex_entry(406, NewString("function"));
    Base[20] = new_lex_entry(411, NewString("global"));
    Base[21] = new_lex_entry(6, NewString(">"));
    Base[22] = new_lex_entry(2, NewString(">="));
    Base[23] = new_lex_entry(20, NewString("if"));
    Base[24] = new_lex_entry(-20, NewString("an illegal character"));
    Base[25] = new_lex_entry(417, NewString("include"));
    Base[26] = new_lex_entry(-24, NewString("{"));
    Base[27] = new_lex_entry(-26, NewString("("));
    Base[28] = new_lex_entry(-28, NewString("["));
    Base[29] = new_lex_entry(1, NewString("<"));
    Base[30] = new_lex_entry(5, NewString("<="));
    Base[31] = new_lex_entry(10, NewString("-"));
    Base[32] = new_lex_entry(13, NewString("*"));
    Base[33] = new_lex_entry(523, NewString("a namespace qualifier"));
    Base[34] = new_lex_entry(-6, NewString("end-of-line"));
    Base[35] = new_lex_entry(7, NewString("not"));
    Base[36] = new_lex_entry(4, NewString("!="));
    Base[37] = new_lex_entry(9, NewString("or"));
    Base[38] = new_lex_entry(11, NewString("+"));
    Base[39] = new_lex_entry(27, NewString("a procedure"));
    Base[40] = new_lex_entry(405, NewString("procedure"));
    Base[41] = new_lex_entry(515, NewString("a variable"));
    Base[42] = new_lex_entry(524, NewString("a function"));
    Base[43] = new_lex_entry(525, NewString("a procedure"));
    Base[44] = new_lex_entry(526, NewString("a type"));
    Base[45] = new_lex_entry(-25, NewString("}"));
    Base[46] = new_lex_entry(-27, NewString(")"));
    Base[47] = new_lex_entry(-29, NewString("]"));
    Base[48] = new_lex_entry(412, NewString("return"));
    Base[49] = new_lex_entry(516, NewString("a slice"));
    Base[50] = new_lex_entry(503, NewString("a character string"));
    Base[51] = new_lex_entry(403, NewString("to"));
    Base[52] = new_lex_entry(409, NewString("then"));
    Base[53] = new_lex_entry(504, NewString("a type"));
    Base[54] = new_lex_entry(415, NewString("type"));
    Base[55] = new_lex_entry(-100, NewString("a variable"));
    Base[56] = new_lex_entry(419, NewString("with"));
    Base[57] = new_lex_entry(420, NewString("without"));
    Base[58] = new_lex_entry(47, NewString("while"));
    Base[59] = new_lex_entry(63, NewString("?"));

    _14token_name = MAKE_SEQ(_1);

    /* op_result = repeat(T_UNKNOWN, MAX_OPCODE) */
    _14op_result = Repeat(5, 177);

    ptr = SEQ_PTR(_14op_result);
    Base = ptr->base;

    /* op_result[RIGHT_BRACE_N] = T_SEQUENCE */
    Base[31] = 3;

    /* op_result[RIGHT_BRACE_2] = T_SEQUENCE */
    Base[85] = 3;

    /* op_result[REPEAT] = T_SEQUENCE */
    Base[32] = 3;

    /* op_result[APPEND] = T_SEQUENCE */
    Base[35] = 3;

    /* op_result[RHS_SLICE] = T_SEQUENCE */
    Base[46] = 3;

    /* op_result[CONCAT] = T_SEQUENCE */
    Base[15] = 3;

    /* op_result[CONCAT_N] = T_SEQUENCE */
    Base[159] = 3;

    /* op_result[PREPEND] = T_SEQUENCE */
    Base[57] = 3;

    /* op_result[COMMAND_LINE] = T_SEQUENCE */
    Base[100] = 3;

    /* op_result[SPRINTF] = T_SEQUENCE */
    Base[53] = 3;

    /* op_result[ROUTINE_ID] = T_INTEGER */
    Base[136] = 1;

    /* op_result[GETC] = T_INTEGER */
    Base[33] = 1;

    /* op_result[OPEN] = T_INTEGER */
    Base[37] = 1;

    /* op_result[LENGTH] = T_INTEGER   -- assume less than a billion */
    Base[42] = 1;

    /* op_result[PLENGTH] = T_INTEGER  -- "" */
    Base[162] = 1;

    /* op_result[IS_AN_OBJECT] = T_INTEGER */
    Base[40] = 1;

    /* op_result[IS_AN_ATOM] = T_INTEGER */
    Base[67] = 1;

    /* op_result[IS_A_SEQUENCE] = T_INTEGER */
    Base[68] = 1;

    /* op_result[COMPARE] = T_INTEGER */
    Base[76] = 1;

    /* op_result[EQUAL] = T_INTEGER */
    Base[155] = 1;

    /* op_result[FIND] = T_INTEGER */
    Base[77] = 1;

    /* op_result[MATCH]  = T_INTEGER */
    Base[78] = 1;

    /* op_result[GET_KEY] = T_INTEGER */
    Base[79] = 1;

    /* op_result[IS_AN_INTEGER] = T_INTEGER */
    Base[94] = 1;

    /* op_result[ASSIGN_I] = T_INTEGER */
    Base[113] = 1;

    /* op_result[RHS_SUBS_I] = T_INTEGER */
    Base[114] = 1;

    /* op_result[PLUS_I] = T_INTEGER */
    Base[115] = 1;

    /* op_result[MINUS_I] = T_INTEGER */
    Base[116] = 1;

    /* op_result[PLUS1_I] = T_INTEGER */
    Base[117] = 1;

    /* op_result[SYSTEM_EXEC] = T_INTEGER */
    Base[156] = 1;

    /* op_result[TIME] = T_ATOM */
    Base[70] = 4;

    /* op_result[TASK_STATUS] = T_INTEGER */
    Base[175] = 1;

    /* op_result[TASK_SELF] = T_ATOM */
    Base[172] = 4;

    /* op_result[TASK_CREATE] = T_ATOM */
    Base[169] = 4;

    /* op_result[TASK_LIST] = T_SEQUENCE */
    Base[174] = 3;

    /* op_result[PLATFORM] = T_INTEGER */
    Base[157] = 1;

    /* Initialize the error stack. */
    ebegin();

    _18main();
    Cleanup(0);
}