Exemple #1
0
/*
============
idMapEntity::Write
============
*/
bool idMapEntity::Write( idFile *fp, int entityNum ) const {
	int i;
	idMapPrimitive *mapPrim;
	idVec3 origin;

	fp->WriteFloatString( "// entity %d\n{\n", entityNum );

	// write entity epairs
	for ( i = 0; i < epairs.GetNumKeyVals(); i++) {
		fp->WriteFloatString( "\"%s\" \"%s\"\n", epairs.GetKeyVal(i)->GetKey().c_str(), epairs.GetKeyVal(i)->GetValue().c_str());
	}

	epairs.GetVector( "origin", "0 0 0", origin );

	// write pritimives
	for ( i = 0; i < GetNumPrimitives(); i++ ) {
		mapPrim = GetPrimitive( i );

		switch( mapPrim->GetType() ) {
			case idMapPrimitive::TYPE_BRUSH:
				static_cast<idMapBrush*>(mapPrim)->Write( fp, i, origin );
				break;
			case idMapPrimitive::TYPE_PATCH:
				static_cast<idMapPatch*>(mapPrim)->Write( fp, i, origin );
				break;
		}
	}

	fp->WriteFloatString( "}\n" );

	return true;
}
Exemple #2
0
static void HistoClickProc (PaneL pn, PoinT pt)
{
  VieweR    v;
  Uint2     segID, primID, primCt;
  SegmenT   s;
  PrimitivE p;
  GraphViewFormPtr gvp;
  SeqIntPtr sint;
  PntInfo   pnt;

  segID = 0;
  primID = 0;
  primCt = 0;

  v = (VieweR) pn;
  s = FindSegment (v, pt, &segID, &primID, &primCt);

  gvp = GetObjectExtra (v);
  if (primID < 1)
  {
    WatchCursor ();
    ExploreSegment (s, v, UnHLSeg);
    ObjMgrDeSelectAll ();
    ArrowCursor ();
  }
  else
  {
    WatchCursor ();
    ExploreSegment (s, v, UnHLSeg);
    ObjMgrDeSelectAll ();
    ArrowCursor ();
    p = GetPrimitive (s, primCt);
    HighlightPrimitive (v, s, p, FRAME_PRIMITIVE);
    gvp->slp = (SeqLocPtr) ValNodeNew (NULL);
    sint = SeqIntNew ();
    sint->id = SeqIdDup (gvp->bsp->id);
    if (primID == 1)
      sint->strand = Seq_strand_plus;
    else
      sint->strand = Seq_strand_minus;
    MapViewerToWorld (v, pt, &pnt);
    gvp->start = pnt.x * gvp->zoom;
    gvp->stop = gvp->start+gvp->window;
    sint->from = gvp->start;
    sint->to = gvp->stop;
    gvp->slp->choice = SEQLOC_INT;
    gvp->slp->data.ptrvalue = (Pointer) sint;
    ObjMgrSelect (gvp->entityID, gvp->itemID, OBJ_BIOSEQ, OM_REGION_SEQLOC,
                  gvp->slp);
  }
  return;
}
Exemple #3
0
void RenderArray(Shader *sh, Primitive prim, int count, const char *fmt, int vertsize, void *vbuf, int *ibuf)
{
    sh->Set();
    GLenum glprim = GetPrimitive(prim);
    SetAttribs(0, fmt, vertsize, (char *)vbuf);
    if (ibuf)
    {
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
        glDrawElements(glprim, count, GL_UNSIGNED_INT, ibuf);
    }
    else glDrawArrays(glprim, 0, count);
    UnSetAttribs(fmt);
}
Exemple #4
0
void RenderArray(Primitive prim, int tcount, int vcount, const char *fmt,
                 int vertsize1, uint vbo, uint ibo = 0, int vertsize2 = 0, uint vbo2 = 0)
{
    GLenum glprim = GetPrimitive(prim);
    SetAttribs(vbo, fmt, vertsize1, vbo2, vertsize2);
    if (ibo)
    {
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
        glDrawElements(glprim, tcount, GL_UNSIGNED_INT, 0);
    }
    else
    {
        glDrawArrays(glprim, 0, vcount);
    }
    UnSetAttribs(fmt);

}
Exemple #5
0
/*
===============
idMapEntity::GetGeometryCRC
===============
*/
unsigned int idMapEntity::GetGeometryCRC( void ) const {
	int i;
	unsigned int crc;
	idMapPrimitive	*mapPrim;

	crc = 0;
	for ( i = 0; i < GetNumPrimitives(); i++ ) {
		mapPrim = GetPrimitive( i );

		switch( mapPrim->GetType() ) {
			case idMapPrimitive::TYPE_BRUSH:
				crc ^= static_cast<idMapBrush*>(mapPrim)->GetGeometryCRC();
				break;
			case idMapPrimitive::TYPE_PATCH:
				crc ^= static_cast<idMapPatch*>(mapPrim)->GetGeometryCRC();
				break;
		}
	}

	return crc;
}
Exemple #6
0
void Mesh::Render(Shader *sh)
{
    if (prim == PRIM_POINT) SetPointSprite(pointsize);

    sh->Set();

    if (numbones && numframes)
    {
        int frame1 = (int)floor(curanim);
        int frame2 = frame1 + 1;
        float frameoffset = curanim - frame1;

        float3x4 *mat1 = &mats[(frame1 % numframes) * numbones],
                 *mat2 = &mats[(frame2 % numframes) * numbones];

        auto outframe = new float3x4[numbones];

        for(int i = 0; i < numbones; i++) outframe[i] = mix(mat1[i], mat2[i], frameoffset);

        sh->SetAnim(outframe, numbones);

        delete[] outframe;
    }

    geom->RenderSetup();

    if (surfs.size())
    {
        for (auto s : surfs) s->Render(sh);
    }
    else
    {
        glDrawArrays(GetPrimitive(prim), 0, geom->nverts);
    }
    geom->RenderDone();
}
Exemple #7
0
static Int2 LIBCALLBACK MatrixMsgFunc (OMMsgStructPtr ommsp)
{
  OMUserDataPtr         omudp;
  GraphViewFormPtr      gvp;
  SeqGraphPtr           sgp;
  VieweR                v;
  PoinT                 pt;
  PntInfo               pw;
  Uint2                 segID, primID, primCt;
  SegmenT               s;
  PrimitivE             p;
  Int4                  pos;
  FloatHi               maxVal;

  if ((omudp = (OMUserDataPtr) (ommsp->omuserdata)) == NULL)
    return OM_MSG_RET_ERROR;
  if ((gvp = (GraphViewFormPtr) (omudp->userdata.ptrvalue)) == NULL)
    return OM_MSG_RET_ERROR;

  switch (ommsp->message)
  {
   case OM_MSG_SELECT:
    if (ommsp->itemtype == OBJ_BIOSEQ)
    {
      if (ommsp->regiontype == OM_REGION_SEQLOC)
      {
        if ((sgp = gvp->sgp) == NULL)
          return OM_MSG_RET_ERROR;

        switch (sgp->flags[2])
        {
         default:
         case 1:
          maxVal = sgp->max.realvalue;
          break;
         case 2:
         case 3:
          maxVal = (FloatHi) sgp->max.intvalue;
          break;
        }

        if (gvp->slp != NULL)
        {
          v = gvp->viewer;
          pt.x = 0;
          pt.y = 0;
          s = FindSegment (v, pt, &segID, &primID, &primCt);
          ExploreSegment (s, v, UnHLSeg);
/*
          ObjMgrDeSelectAll ();
          gvp->slp = NULL;
*/
        }
        pos = SeqLocStart ((SeqLocPtr) ommsp->region);
        pos += SeqLocStop ((SeqLocPtr) ommsp->region);
        pos /= 2;
        pos /= gvp->zoom;
        pw.x = (Int2) pos;
        if (SeqLocStrand ((SeqLocPtr) ommsp->region) == Seq_strand_plus)
        {
          pw.y = (Int2) (gvp->margin + ((Int4) (1.0 +
                               (maxVal/2)) * sgp->a) +
                               (Int4) sgp->b);
        }
        else
        {
          pw.y = (Int2) (gvp->margin + ((Int4) (maxVal - 1.0 -
                               (maxVal/2)) * sgp->a) +
                               (Int4) sgp->b);
        }
        v = gvp->viewer;
        primID = 0;
        MapWorldToViewer (v, pw, &pt);
        s = FindSegment (v, pt, &segID, &primID, &primCt);
        if (primID < 1 || s == NULL)
          return OM_MSG_RET_ERROR;
        p = GetPrimitive (s, primCt);
        WatchCursor ();
        ExploreSegment (s, v, UnHLSeg);
        ArrowCursor ();
        HighlightPrimitive (v, s, p, FRAME_PRIMITIVE);
/* DUP/memcp and delta id
        gvp->slp = (Pointer) (ommsp->region);
*/
/*
        ObjMgrSelect (gvp->entityID, gvp->itemID, OBJ_BIOSEQ, OM_REGION_SEQLOC,
                      gvp->slp);
*/
      }
    }
    break;
   case OM_MSG_DESELECT:
    if (ommsp->itemtype == OBJ_BIOSEQ)
    {
      if (ommsp->regiontype == OM_REGION_SEQLOC)
      {
        if (gvp->slp != NULL)
        {
/*
          v = gvp->viewer;
          pt.x = 0;
          pt.y = 0;
          s = FindSegment (v, pt, &segID, &primID, &primCt);
          ExploreSegment (s, v, UnHLSeg);
          ObjMgrDeSelectAll ();
          gvp->slp = NULL;
*/
        }
      }
    }
    break;
   case OM_MSG_DEL:
   case OM_MSG_CREATE:
   case OM_MSG_UPDATE:
   case OM_MSG_CACHED:
   case OM_MSG_UNCACHED:
   case OM_MSG_TO_CLIPBOARD:
    break;
   default:
    break;
  }
  return OM_MSG_RET_OK;
}
Exemple #8
0
static Int2 LIBCALLBACK FilterMsgFunc (OMMsgStructPtr ommsp)
{
  OMUserDataPtr         omudp;
  GraphViewFormPtr      gvp;
  SeqGraphPtr           sgp;
  VieweR                v;
  PoinT                 pt;
  PntInfo               pw;
  Uint2                 segID, primID, primCt, start, end, i;
  SegmenT               s;
  PrimitivE             p;
  FloatHi               fval;
  Int4                  pos;
  FloatHi               maxVal, minVal;

  if ((omudp = (OMUserDataPtr) (ommsp->omuserdata)) == NULL)
    return OM_MSG_RET_ERROR;
  if ((gvp = (GraphViewFormPtr) (omudp->userdata.ptrvalue)) == NULL)
    return OM_MSG_RET_ERROR;

  switch (ommsp->message)
  {
   case OM_MSG_SELECT:
    if (ommsp->itemtype == OBJ_BIOSEQ)
    {
      if (ommsp->regiontype == OM_REGION_SEQLOC)
      {
        if ((sgp = gvp->sgp) == NULL)
          return OM_MSG_RET_ERROR;

        switch (sgp->flags[2])
        {
         default:
         case 1:
          maxVal = sgp->max.realvalue;
          minVal = sgp->min.realvalue;
          break;
         case 2:
         case 3:
          maxVal = (FloatHi) sgp->max.intvalue;
          minVal = (FloatHi) sgp->min.intvalue;
          break;
        }

        if (gvp->slp != NULL)
        {
          v = gvp->viewer;
          pt.x = 0;
          pt.y = 0;
          s = FindSegment (v, pt, &segID, &primID, &primCt);
          ExploreSegment (s, v, UnHLSeg);
/*
          ObjMgrDeSelectAll ();
          gvp->slp = NULL;
*/
        }
        pos = SeqLocStart ((SeqLocPtr) ommsp->region);
        pos /= gvp->zoom;
        pw.x = (Int2) pos;
        v = gvp->viewer;
        primID = 0;
        fval = minVal - 1;
        while (primID < 1 && fval < maxVal)
        {
          fval++;
          pw.y = (Int2) (gvp->margin + ((Int4) (fval * sgp->a)) +
                         (Int4) sgp->b);
          MapWorldToViewer (v, pw, &pt);
          s = FindSegment (v, pt, &segID, &primID, &primCt);
        }
        if (primCt == 0 && fval == maxVal)
          return OM_MSG_RET_ERROR;
        if (s == NULL)
          return OM_MSG_RET_ERROR;
        start = primCt;

        pos = SeqLocStop ((SeqLocPtr) ommsp->region);
        pos /= gvp->zoom;
        pw.x = (Int2) pos;
        primID = 0;
        fval = minVal - 1;
        while (primID < 1 && fval < maxVal)
        {
          fval++;
          pw.y = (Int2) (gvp->margin + ((Int4) (fval * sgp->a)) +
                         (Int4) sgp->b);
          MapWorldToViewer (v, pw, &pt);
          s = FindSegment (v, pt, &segID, &primID, &primCt);
        }
        if (primCt == 0 || fval == maxVal)
          return OM_MSG_RET_ERROR;
        if (s == NULL)
          return OM_MSG_RET_ERROR;
        end = primCt;
        if (start > end)
          return OM_MSG_RET_ERROR;
        WatchCursor ();
        ExploreSegment (s, v, UnHLSeg);
        ArrowCursor ();
        for (i = start; i < end; i++)
        {
          p = GetPrimitive (s, i);
          HighlightPrimitive (v, s, p, FRAME_PRIMITIVE);
        }
/* DUP/memcp and delta id
        gvp->slp = (Pointer) (ommsp->region);
*/
/*
        ObjMgrSelect (gvp->entityID, gvp->itemID, OBJ_BIOSEQ, OM_REGION_SEQLOC,
                      gvp->slp);
*/
      }
    }
    break;
   case OM_MSG_DESELECT:
    if (ommsp->itemtype == OBJ_BIOSEQ)
    {
      if (ommsp->regiontype == OM_REGION_SEQLOC)
      {
        if (gvp->slp != NULL)
        {
/*
          v = gvp->viewer;
          pt.x = 0;
          pt.y = 0;
          s = FindSegment (v, pt, &segID, &primID, &primCt);
          ExploreSegment (s, v, UnHLSeg);
          ObjMgrDeSelectAll ();
          gvp->slp = NULL;
*/
        }
      }
    }
    break;
   case OM_MSG_DEL:
   case OM_MSG_CREATE:
   case OM_MSG_UPDATE:
   case OM_MSG_CACHED:
   case OM_MSG_UNCACHED:
   case OM_MSG_TO_CLIPBOARD:
    break;
   default:
    break;
  }
  return OM_MSG_RET_OK;
}
Exemple #9
0
void Surface::Render(Shader *sh)
{
    sh->SetTextures(textures);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboId);
    glDrawElements(GetPrimitive(prim), (GLsizei)numidx, GL_UNSIGNED_INT, 0);
}
	const Primitive& PrimitiveList::operator()(unsigned int i) const
	{
		return GetPrimitive(i);
	}
Exemple #11
0
static void GraphClickProc (PaneL pn, PoinT pt)
{
  VieweR    v;
  Uint2     segID, primID, primCt, start, end, i;
  SegmenT   s;
  PrimitivE p;
  GraphViewFormPtr gvp;
  SeqIntPtr sint;
  PntInfo   pnt;

  segID = 0;
  primID = 0;
  primCt = 0;

  v = (VieweR) pn;
  s = FindSegment (v, pt, &segID, &primID, &primCt);
  p = GetPrimitive (s, primCt);
  if (primID == 0)
    return;

  gvp = GetObjectExtra (v);
  if (gvp->flagNewClick)
  {
    WatchCursor ();
    ExploreSegment (s, v, UnHLSeg);
    ArrowCursor ();
    HighlightPrimitive (v, s, p, FRAME_PRIMITIVE);
    gvp->flagNewClick = FALSE;
    gvp->HLRange = primCt;
    MapViewerToWorld (v, pt, &pnt);
    gvp->start = pnt.x * gvp->zoom;
  }
  else
  {
    start = gvp->HLRange;
    if (start < primCt)
      end = (Uint2) (primCt + 1);
    else
    {
      start = primCt;
      end = (Uint2) (gvp->HLRange + 1);
    }
    for (i = start; i < end; i++)
    {
      p = GetPrimitive (s, i);
      HighlightPrimitive (v, s, p, FRAME_PRIMITIVE);
    }
    if (gvp->slp != NULL)
    {
      ObjMgrDeSelect (gvp->entityID, gvp->itemID, OBJ_BIOSEQ, OM_REGION_SEQLOC,
                      gvp->slp);
/*      gvp->slp = SeqLocFree (gvp->slp); */
      gvp->slp = NULL;
    }
    gvp->slp = (SeqLocPtr) ValNodeNew (NULL);
    sint = SeqIntNew ();
    sint->id = SeqIdDup (gvp->bsp->id);
    sint->strand = Seq_strand_plus;
    MapViewerToWorld (v, pt, &pnt);
    gvp->stop = pnt.x * gvp->zoom;
    if (gvp->start < gvp->stop)
    {
      sint->from = gvp->start;
      sint->to = gvp->stop;
    }
    else
    {
      sint->from = gvp->stop;
      sint->to = gvp->start;
    }
    gvp->slp->choice = SEQLOC_INT;
    gvp->slp->data.ptrvalue = (Pointer) sint;
    ObjMgrSelect (gvp->entityID, gvp->itemID, OBJ_BIOSEQ, OM_REGION_SEQLOC,
                  gvp->slp);
/* ObjMgrAlsoSelect for loop thru slp's */
/* have to clone each slp added to chain and pass clone to OM */
    gvp->flagNewClick = TRUE;
  }
  return;
}

   
   TH1F *h_MC_stat= new TH1F("h_MC_stat","",100,0,10);//hist of rise times by running the macro many(kk=100) times in a loop.(deadtime NOT included) 
   TH1F *h_SiPM_Output_Pulse_stat= new TH1F("h_SiPM_Output_Pulse_stat","",100,0,10);//hist of rise times by running the macro many(kk=100) times in a loop.(deadtime included) 

   


   
   
  //---------------getting average pulse from MCP 32 GeV and fill h_avg histogram with it------------- 
   TFile f4("sum32MCP.root","read");
   TH1F *h_avg;
  c1 = (TCanvas*)f4.Get("canv111");
  h_avg = (TH1F*)c1->GetPrimitive("sum");

  for(int i=1;i<75;i++)
    h_avg->SetBinContent(i,0);
  
  for(int i=820;i<1024;i++)
       h_avg->SetBinContent(i+1,exp(7.01884e-01-5.07216e-03*i));
h_avg->Scale(1.0/h_avg->Integral());
  //------------------------------------------------------------------------------------------------


 Float_t TenPercent_h_MC=0;
 Float_t SixtyPercent_h_MC=0;
Float_t TenPercent_SiPM_Output_Pulse=0;
 Float_t SixtyPercent_SiPM_Output_Pulse=0;
bool ShortDataType::CastTo(DataType* dt, bool explicitCast)
{
	Instruction* instruction;
	Parser* parser = g_app->GetParser();
	bool result = false;

	// Check we are not casting to the same thing.
	if (dt->GetPrimitive() == GetPrimitive())
		return true;
	
	PrimitiveDataType pdt = dt->GetPrimitive();
	if (pdt == PDT_CLASS && dynamic_cast<StringDataType*>(dt) != NULL)
		pdt = PDT_STRING;

	switch (pdt)
	{
		case PDT_BOOL: 
		case PDT_BYTE: 
			{
				// Allocate register.
				Register reg = parser->AllocateRegister(this);
				Register reg2Main = parser->AllocateRegister(this);
				Register reg2 = parser->Register32BitTo8Bit(reg2Main);

				// Pop value into a register.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_POP, parser->GetCurrentToken());
				instruction->AddRegisterOperand(reg2);

				// Truncate.
				//instruction = new Instruction(parser->GetInstructionScope(), OPCODE_AND, parser->GetCurrentToken());
				//instruction->AddRegisterOperand(reg);
				//instruction->AddStringLiteralOperand("0x000000FF");
				
				// Move with zero extend.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_MOVZX, parser->GetCurrentToken());
				instruction->AddRegisterOperand(reg);
				instruction->AddRegisterOperand(reg2);

				// TODO: CBW, CWD

				// Push into stack.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_PUSH, parser->GetCurrentToken());
				instruction->AddRegisterOperand(reg);
				
				// Deallocate register.
				parser->DeallocateRegister(reg2Main);
				parser->DeallocateRegister(reg);

				result = true;
				break;
			}
		case PDT_INT: 
			{
				// Allocate register.
				Register reg = parser->AllocateRegister(this);
				Register reg2Main = parser->AllocateRegister(this);
				Register reg2 = parser->Register32BitTo8Bit(reg2Main);

				// Pop value into a register.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_POP, parser->GetCurrentToken());
				instruction->AddRegisterOperand(reg2);

				// Truncate.
				//instruction = new Instruction(parser->GetInstructionScope(), OPCODE_AND, parser->GetCurrentToken());
				//instruction->AddRegisterOperand(reg);
				//instruction->AddStringLiteralOperand("0x000000FF");
				
				// Move with zero extend.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_MOVZX, parser->GetCurrentToken());
				instruction->AddRegisterOperand(reg);
				instruction->AddRegisterOperand(reg2);

				// Convert from word to dword.
				//instruction = new Instruction(parser->GetInstructionScope(), OPCODE_CWD, parser->GetCurrentToken());
				
				// TODO: CBW, CWD

				// Push into stack.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_PUSH, parser->GetCurrentToken());
				instruction->AddRegisterOperand(reg);
				
				// Deallocate register.
				parser->DeallocateRegister(reg2Main);
				parser->DeallocateRegister(reg);

				result = true;
				break;
			}
		case PDT_LONG:
			{
				// Allocate register.
				Register reg = REG_EAX;
				parser->SetRegisterAllocation(REG_EAX, true);
				parser->SetRegisterAllocation(REG_EDX, true);
				//Register reg = parser->AllocateRegister(dt);
				Register loBits = parser->Register64LoBitsTwin(reg);
				Register hiBits = parser->Register64HiBitsTwin(reg);

				// Pop value into a register.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_POP, parser->GetCurrentToken());
				instruction->AddRegisterOperand(reg);
				
				// Truncate.
				//instruction = new Instruction(parser->GetInstructionScope(), OPCODE_AND, parser->GetCurrentToken());
				//instruction->AddRegisterOperand(reg);
				//instruction->AddStringLiteralOperand("0x0000FFFF");
				
				// Convert from word to dword.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_CWD, parser->GetCurrentToken());
				
				// Convert from dword to quad.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_CDQ, parser->GetCurrentToken());

				// Push hi-bits onto stack.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_PUSH, parser->GetCurrentToken());
				instruction->AddRegisterOperand(hiBits);
				
				// Push lo-bits onto stack.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_PUSH, parser->GetCurrentToken());
				instruction->AddRegisterOperand(loBits);

				// Deallocate register.
				parser->SetRegisterAllocation(REG_EAX, false);
				parser->SetRegisterAllocation(REG_EDX, false);

				result = true;
				break;
			}
		case PDT_FLOAT:
			{
				// Invoke class allocation function.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_CALL, parser->GetCurrentToken());
				instruction->AddStringLiteralOperand("_icr__Int_IntToFloat");
				
				// Cleanup Stack
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_ADD, parser->GetCurrentToken());
				instruction->AddRegisterOperand(REG_ESP);
				instruction->AddIntLiteralOperand(4);

				// Push in the resulting value.
				dt->PushReturn();

				result = true;
				break;
			}
		case PDT_DOUBLE:
			{
				// Invoke class allocation function.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_CALL, parser->GetCurrentToken());
				instruction->AddStringLiteralOperand("_icr__Int_IntToDouble");
				
				// Cleanup Stack
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_ADD, parser->GetCurrentToken());
				instruction->AddRegisterOperand(REG_ESP);
				instruction->AddIntLiteralOperand(4);

				// Push in the resulting value.
				dt->PushReturn();

				result = true;
				break;
			}
		case PDT_STRING:
			{
				// Invoke class allocation function.
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_CALL, parser->GetCurrentToken());
				instruction->AddStringLiteralOperand("_icr__Int_IntToString");
				
				// Cleanup Stack
				instruction = new Instruction(parser->GetInstructionScope(), OPCODE_ADD, parser->GetCurrentToken());
				instruction->AddRegisterOperand(REG_ESP);
				instruction->AddIntLiteralOperand(4);

				// Push in the resulting value.
				dt->PushReturn();

				result = true;
				break;
			}
		case PDT_VOID: break;
		case PDT_CLASS: 
			{
				ClassDataType* classDT = (ClassDataType*)dt;
				result = false;
				break;
			}
	}

	// Error? Perhaps this should go in parser?
	if (result == false)
		g_app->EmitError("Unable to cast between '" + GetMnemonicForDataType(this) + "' and '" + GetMnemonicForDataType(dt) + "'.", ES_PARSER, EL_FATAL, parser->GetCurrentToken().Line, parser->GetCurrentToken().Column, parser->GetCurrentToken().Path);

	return result;
}