示例#1
0
Compiler :: Compiler (FILE* c_file, LogHTML& log, FILE* asm_file):
    code (),
    root ({ Block })
    {
        log.setFontColor ("white");
        log.setSize      (100);
        log.setColor     ("blue");

        log.output ("========== Build started: DeerC %d.%d ==========\n", 1, 0);

        log.setColor ("red");
        clock_t start = clock ();

        LexicialAnalyzer lexicial_analyzer (c_file, code);
        //Preprocessor          preprocessor (code, log);
        SyntaxAnalyzer     syntax_analyzer (root, code, log);
        //SemanticAnalyzer semantic_analyzer (root, log);
        //Optimizer                optimizer (root);
        CodeGeneration     code_generation (root, asm_file, 1);

        clock_t end = clock ();
        log.setColor ("blue");

        RenderTree (root, "GCD.dot");

        log.output ("Build started on: %f\n",   (float) start / CLOCKS_PER_SEC);
        log.output ("Build   ended on: %f\n\n", (float)   end / CLOCKS_PER_SEC);

        log.output ("========== Build finished ==========\n");

        log.out ();
    }
示例#2
0
VOID Render()
{
	SetupMatrix() ;

	OnFrameMove() ;

	g_pCamera->Update(0.1f, 1.0f) ;

	// Clear the back-buffer to a RED color
	g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(255,255,255), 1.0f, 0 );

	// Begin the scene
	if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )
	{
		RenderTerrain() ;

		RenderTree() ;

		RenderTeapot() ;

		// End the scene
		g_pd3dDevice->EndScene();
	}

	// Present the back-buffer contents to the display
	g_pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
void Collision::RenderTree(){
  static let path = "C:\\Users\\master8\\Documents\\Visual Studio 2013\\Projects\\assimptest\\assimptest\\result";
  if (verts){
    let len = verts->size();
    for (size_t i = 0; i < len; i+=6)
    {
      let el = verts[i];
      //初めの3要素は座標、後ろがextent
      glTranslatef(adec(el,0));
      glScalef    (adec(el,3));
      glutWireCube(1);
    }
  }
  else{
    verts = &readResult("C:\\");
    RenderTree();
  }
}
示例#4
0
void SkyBoxShader::RenderTree(OctreeNode* renderTree, ID3D11Device* currDevice, ID3D11DeviceContext* deviceContext, ShaderData* drawData)
{
	OctreeNode* currentNode = renderTree;
	D3DXMATRIX wvpMatrix;

	if(!mEffect)
	{
		std::cerr << "Render Error: SkyBox Shader Uninitialised!" << std::endl;
		return;
	}

	setInputLayout(deviceContext);

	while(currentNode != 0)
	{
		if(currentNode->mCurrentEntities)
		{
			for(int i = 0; i < currentNode->mCurrentEntities; i++)
			{
				if(currentNode->mNodeContents[i])
				{
					RenderEntity(currentNode->mNodeContents[i], currDevice, deviceContext, drawData);
				}
			}
		}

		for(int i = 0; i < 8; i++)
		{
			if(currentNode->mChildNodes[i])
			{
				RenderTree(currentNode->mChildNodes[i], currDevice, deviceContext, drawData);
			}
			else
			{
				currentNode = 0;
			}
		}

		currentNode = 0;
	}
}
示例#5
0
文件: httpd.c 项目: bochf/testing
/* ========================================================================= */
void *httpd_worker(void *vp)
{
   struct httpdsrv *h;
   int s;
   struct iobuf *ibuf; /* input buffer */
   struct iobuf *obuf; /* output buffer */
   struct query *q = NULL;
   int httprc = 200; /* Set to an initial value for compiler sake */

   /* Bring in the big data structure */
   h = (struct httpdsrv *)vp;

   /* Allocate memory for the input buffer */

   if ( NULL == (ibuf = NewIOBuf(h->o->cf_ibufsz)) )
   {
      error_msg("ERROR: Worker thread failed to allocate buffer memory.");
      pthread_exit((void *)1);
   }


   if ( NULL == (obuf = NewIOBuf(h->o->cf_obufsz)) )
   {
      error_msg("ERROR: Worker thread failed to allocate buffer memory.");
      pthread_exit((void *)1);
   }

   while ( h->trun )
   {   
      /* This is our holding pattern location */
      pthread_mutex_lock(h->qlock);
      while ( h->squeue == -1 )
         pthread_cond_wait(h->qready, h->qlock);
      s = h->squeue;
      h->squeue = -1;
      pthread_mutex_unlock(h->qlock);

      /* Passing a -2 to all our threads will shut them all down */
      if ( s == -2 )
         pthread_exit((void *)0);

      /* Read what the client sent */
      ResetIOBuf(ibuf);
      if (NULL == (q = read_request(q, s, ibuf)))
      {
         error_msg("ERROR: Worker thread failed to allocate query memory.\n");
         pthread_exit((void *)1);
      }

      /* Go ahead and set up the send - as long as the socket is good */
      if ( q->parse_failure != UP_DEAD_SOCKET )
      {
         /* The query could still be bad. But we will consider this a customer
            served - even if it may have been an error. */
         pthread_mutex_lock(&cs_lock);
         customers_served++;
         pthread_mutex_unlock(&cs_lock);
         
         /* Conditionally handle what method the user/client requested */
         switch(q->method)
         {
         case METHOD_GET:
         case METHOD_POST:
            RenderTree(obuf, q, h->trees, h->o, &httprc);
            send_header(s, httprc, 0, obuf->eod);

            if ( 200 == httprc )
               send(s, obuf->buf, obuf->eod, 0);
            break;
         case METHOD_HEAD: /* Like GET but no data */
            RenderTree(obuf, q, h->trees, h->o, &httprc);
            send_header(s, httprc, 0, obuf->eod);
            break;
         case METHOD_OPTIONS:
            send_options_header(s, 200);
            break;
         default:
            send_options_header(s, 405);
            break;
         }

         /* LogAccess() is dependent on an open socket to get connection
            information. It must be called before the close() on the socket. */
         LogAccess(s, q->tree, q->format, httprc);
      }

      close(s);
   } /* while ( continue_to_run ) */

   return((void *)0);
}