Esempio n. 1
0
void FPU_copy_to_reg1(FPU_REG const *r, u_char tag)
{
	reg_copy(r, &st(1));
	FPU_settagi(1, tag);
}
Esempio n. 2
0
/**
* Scans a whole f*****g xml-style graph-model-file...raaaaa...
**/
void XMLFileScanner::scan(std::string& text)
{
  StringTokenizer st(text);
  std::string delim("<>");
  std::string token;
  std::string section;


  //token = st.next(delim); // <
  token = st.next(delim); // <tag>

  if(token == "model")
    {
      token = st.next(delim); // <model> /n <
      token = st.next(delim); // <modelinfos>
		
      if(token == "moduleinfos")
	{
	  section += "moduleinfos\n";
	  token = st.next(delim);
	  while(token!= "/moduleinfos" )
	    {
	      token = st.next(delim); //cut "\n"
	      section += token;
	    }
	  scanInfoSection(section);			
	} else {
	  throw std::runtime_error("File has wrong format...section moduleinfos");
	}
      //reset section string
      section = "";
      token = st.next(delim);
      token = st.next(delim);
      if(token == "nodes")
	{
	  section += "nodes\n";
	  token = st.next(delim);
	  while(token != "/nodes")
	    {
	      token = st.next(delim); //cut "\n"
	      section += token;
	    }
	  scanNodeSection(section);
	} else {
	  throw std::runtime_error("File has wrong format...section nodes");
	}
      section = "";
      token = st.next(delim);
      token = st.next(delim);
      if(token == "controls")
	{
	  section += "controls\n";
	  token = st.next(delim);
	  while(token != "/controls")
	    {
	      token = st.next(delim);
	      section += token;
	    }
	  scanCtrlSection(section);
	} 
      else 
	{
	  throw std::runtime_error("File has wrong format...section controls");
	}
      section = "";
      token = st.next(delim);
      token = st.next(delim);
      if(token == "connections")
	{
	  section += "connections\n";
	  token = st.next(delim);
	  while(token != "/connections")
	    {
	      token = st.next(delim);
	      section += token;
	    }
	  scanConnectionSection(section);
	} 
      else 
	{
	  std::string msg = "File has wrong format...section connections. ";
	  msg += token;
	  throw std::runtime_error(msg.c_str());
	}

      token = st.next(delim);
      token = st.next(delim);
      if(token != "/model")
	throw std::runtime_error("File has a wrong finishing tag...wrong format");
    } 
  else 
    {
      throw std::runtime_error("This is no Ge-Phex Graph file...go f**k your dog!!!");
    }
}
Esempio n. 3
0
double
CUnigramSorter::getCost(unsigned int wid)
{
    CThreadSlm::TState st(0, 0);
    return m_Model.transferNegLog(st, wid, st);
}
Esempio n. 4
0
    virtual void on_draw()
    {
        typedef agg::pixfmt_gray8 pixfmt_gray8;
        typedef agg::renderer_base<pixfmt_gray8> ren_base_gray8;

        m_ras.clip_box(0,0, width(), height());

        pixfmt_gray8 pixf_gray8(m_gray8_rbuf);
        ren_base_gray8 renb_gray8(pixf_gray8);
        renb_gray8.clear(agg::gray8(0));

        // Testing enhanced compositing operations. 
        // Uncomment and replace renb.blend_from_* to renb_blend.blend_from_*
        //----------------
        //typedef agg::comp_op_rgba_minus<color_type, component_order> blender_type;
        //typedef agg::comp_adaptor_rgba<blender_type> blend_adaptor_type;
        //typedef agg::pixfmt_custom_blend_rgba<blend_adaptor_type, agg::rendering_buffer> pixfmt_type;
        //typedef agg::renderer_base<pixfmt_type> ren_base;
        //pixfmt_type pixf_blend(rbuf_window());
        //agg::renderer_base<pixfmt_type> renb_blend(pixf_blend);

        pixfmt pixf(rbuf_window());
        agg::renderer_base<pixfmt> renb(pixf);
        renb.clear(agg::rgba(1, 0.95, 0.95));

        agg::trans_perspective shadow_persp(m_shape_bounds.x1, m_shape_bounds.y1, 
                                            m_shape_bounds.x2, m_shape_bounds.y2,
                                            m_shadow_ctrl.polygon());

        agg::conv_transform<shape_type, 
                            agg::trans_perspective> shadow_trans(m_shape, 
                                                                 shadow_persp);

        start_timer();

        // Render shadow
        m_ras.add_path(shadow_trans);
        agg::render_scanlines_aa_solid(m_ras, m_sl, renb_gray8, agg::gray8(255));

        // Calculate the bounding box and extend it by the blur radius
        agg::rect_d bbox;
        agg::bounding_rect_single(shadow_trans, 0, &bbox.x1, &bbox.y1, &bbox.x2, &bbox.y2);

        bbox.x1 -= m_radius.value();
        bbox.y1 -= m_radius.value();
        bbox.x2 += m_radius.value();
        bbox.y2 += m_radius.value();

        if(bbox.clip(agg::rect_d(0, 0, width(), height())))
        {
            // Create a new pixel renderer and attach it to the main one as a child image. 
            // It returns true if the attachment suceeded. It fails if the rectangle 
            // (bbox) is fully clipped.
            //------------------
            pixfmt_gray8 pixf2(m_gray8_rbuf2);
            if(pixf2.attach(pixf_gray8, int(bbox.x1), int(bbox.y1), int(bbox.x2), int(bbox.y2)))
            {
                // Blur it
                agg::stack_blur_gray8(pixf2, agg::uround(m_radius.value()), 
                                             agg::uround(m_radius.value()));
            }
            if(m_method.cur_item() == 0)
            {
                renb.blend_from_color(pixf2, 
                                      agg::rgba8(0, 100, 0), 
                                      0, 
                                      int(bbox.x1), 
                                      int(bbox.y1));
            }
            else
            {
                renb.blend_from_lut(pixf2, 
                                    m_color_lut.data(),
                                    0, 
                                    int(bbox.x1), 
                                    int(bbox.y1));
            }
        }
        double tm = elapsed_time();

        char buf[64]; 
        agg::gsv_text t;
        t.size(10.0);

        agg::conv_stroke<agg::gsv_text> st(t);
        st.width(1.5);

        sprintf(buf, "%3.2f ms", tm);
        t.start_point(140.0, 30.0);
        t.text(buf);

        m_ras.add_path(st);
        agg::render_scanlines_aa_solid(m_ras, m_sl, renb, agg::rgba(0,0,0));

        agg::render_ctrl(m_ras, m_sl, renb, m_method);
        agg::render_ctrl(m_ras, m_sl, renb, m_radius);
        agg::render_ctrl(m_ras, m_sl, renb, m_shadow_ctrl);
    }
Esempio n. 5
0
/*
  Operates on st(0) and st(n), or on st(0) and temporary data.
  The destination must be one of the source st(x).
  */
int FPU_add(FPU_REG const *b, u_char tagb, int deststnr, u16 control_w)
{
  FPU_REG *a = &st(0);
  FPU_REG *dest = &st(deststnr);
  u_char signb = getsign(b);
  u_char taga = FPU_gettag0();
  u_char signa = getsign(a);
  u_char saved_sign = getsign(dest);
  int diff, tag, expa, expb;
  
  if ( !(taga | tagb) )
    {
      expa = exponent(a);
      expb = exponent(b);

    valid_add:
      /* Both registers are valid */
      if (!(signa ^ signb))
	{
	  /* signs are the same */
	  tag = FPU_u_add(a, b, dest, control_w, signa, expa, expb);
	}
      else
	{
	  /* The signs are different, so do a subtraction */
	  diff = expa - expb;
	  if (!diff)
	    {
	      diff = a->sigh - b->sigh;  /* This works only if the ms bits
					    are identical. */
	      if (!diff)
		{
		  diff = a->sigl > b->sigl;
		  if (!diff)
		    diff = -(a->sigl < b->sigl);
		}
	    }
      
	  if (diff > 0)
	    {
	      tag = FPU_u_sub(a, b, dest, control_w, signa, expa, expb);
	    }
	  else if ( diff < 0 )
	    {
	      tag = FPU_u_sub(b, a, dest, control_w, signb, expb, expa);
	    }
	  else
	    {
	      FPU_copy_to_regi(&CONST_Z, TAG_Zero, deststnr);
	      /* sign depends upon rounding mode */
	      setsign(dest, ((control_w & CW_RC) != RC_DOWN)
		      ? SIGN_POS : SIGN_NEG);
	      return TAG_Zero;
	    }
	}

      if ( tag < 0 )
	{
	  setsign(dest, saved_sign);
	  return tag;
	}
      FPU_settagi(deststnr, tag);
      return tag;
    }

  if ( taga == TAG_Special )
    taga = FPU_Special(a);
  if ( tagb == TAG_Special )
    tagb = FPU_Special(b);

  if ( ((taga == TAG_Valid) && (tagb == TW_Denormal))
	    || ((taga == TW_Denormal) && (tagb == TAG_Valid))
	    || ((taga == TW_Denormal) && (tagb == TW_Denormal)) )
    {
      FPU_REG x, y;

      if ( denormal_operand() < 0 )
	return FPU_Exception;

      FPU_to_exp16(a, &x);
      FPU_to_exp16(b, &y);
      a = &x;
      b = &y;
      expa = exponent16(a);
      expb = exponent16(b);
      goto valid_add;
    }

  if ( (taga == TW_NaN) || (tagb == TW_NaN) )
    {
      if ( deststnr == 0 )
	return real_2op_NaN(b, tagb, deststnr, a);
      else
	return real_2op_NaN(a, taga, deststnr, a);
    }

  return add_sub_specials(a, taga, signa, b, tagb, signb,
			  dest, deststnr, control_w);
}
Esempio n. 6
0
StationType& StationType::operator= (const std::string &type) {
    StationType st(type);
    this->_type = st._type;
    return *this;
}
Esempio n. 7
0
File: Path.cpp Progetto: kutabar/of
bool Path::find(const std::string& pathList, const std::string& name, Path& path)
{
	StringTokenizer st(pathList, std::string(1, pathSeparator()), StringTokenizer::TOK_IGNORE_EMPTY + StringTokenizer::TOK_TRIM);
	return find(st.begin(), st.end(), name, path);
}
Esempio n. 8
0
void MainWindow::deleteConfig(QString section)
{
    QSettings st(programConfig, QSettings::IniFormat);
    st.remove(section);
}
Esempio n. 9
0
int FPU_add(FPU_REG const *b, u_char tagb, int deststnr, int control_w)
{
	FPU_REG *a = &st(0);
	FPU_REG *dest = &st(deststnr);
	u_char signb = getsign(b);
	u_char taga = FPU_gettag0();
	u_char signa = getsign(a);
	u_char saved_sign = getsign(dest);
	int diff, tag, expa, expb;

	if (!(taga | tagb)) {
		expa = exponent(a);
		expb = exponent(b);

	      valid_add:
		
		if (!(signa ^ signb)) {
			
			tag =
			    FPU_u_add(a, b, dest, control_w, signa, expa, expb);
		} else {
			
			diff = expa - expb;
			if (!diff) {
				diff = a->sigh - b->sigh;	
				if (!diff) {
					diff = a->sigl > b->sigl;
					if (!diff)
						diff = -(a->sigl < b->sigl);
				}
			}

			if (diff > 0) {
				tag =
				    FPU_u_sub(a, b, dest, control_w, signa,
					      expa, expb);
			} else if (diff < 0) {
				tag =
				    FPU_u_sub(b, a, dest, control_w, signb,
					      expb, expa);
			} else {
				FPU_copy_to_regi(&CONST_Z, TAG_Zero, deststnr);
				
				setsign(dest, ((control_w & CW_RC) != RC_DOWN)
					? SIGN_POS : SIGN_NEG);
				return TAG_Zero;
			}
		}

		if (tag < 0) {
			setsign(dest, saved_sign);
			return tag;
		}
		FPU_settagi(deststnr, tag);
		return tag;
	}

	if (taga == TAG_Special)
		taga = FPU_Special(a);
	if (tagb == TAG_Special)
		tagb = FPU_Special(b);

	if (((taga == TAG_Valid) && (tagb == TW_Denormal))
	    || ((taga == TW_Denormal) && (tagb == TAG_Valid))
	    || ((taga == TW_Denormal) && (tagb == TW_Denormal))) {
		FPU_REG x, y;

		if (denormal_operand() < 0)
			return FPU_Exception;

		FPU_to_exp16(a, &x);
		FPU_to_exp16(b, &y);
		a = &x;
		b = &y;
		expa = exponent16(a);
		expb = exponent16(b);
		goto valid_add;
	}

	if ((taga == TW_NaN) || (tagb == TW_NaN)) {
		if (deststnr == 0)
			return real_2op_NaN(b, tagb, deststnr, a);
		else
			return real_2op_NaN(a, taga, deststnr, a);
	}

	return add_sub_specials(a, taga, signa, b, tagb, signb,
				dest, deststnr, control_w);
}
Esempio n. 10
0
int FPU_div(int flags, int rm, int control_w)
{
	FPU_REG x, y;
	FPU_REG const *a, *b, *st0_ptr, *st_ptr;
	FPU_REG *dest;
	u_char taga, tagb, signa, signb, sign, saved_sign;
	int tag, deststnr;

	if (flags & DEST_RM)
		deststnr = rm;
	else
		deststnr = 0;

	if (flags & REV) {
		b = &st(0);
		st0_ptr = b;
		tagb = FPU_gettag0();
		if (flags & LOADED) {
			a = (FPU_REG *) rm;
			taga = flags & 0x0f;
		} else {
			a = &st(rm);
			st_ptr = a;
			taga = FPU_gettagi(rm);
		}
	} else {
		a = &st(0);
		st0_ptr = a;
		taga = FPU_gettag0();
		if (flags & LOADED) {
			b = (FPU_REG *) rm;
			tagb = flags & 0x0f;
		} else {
			b = &st(rm);
			st_ptr = b;
			tagb = FPU_gettagi(rm);
		}
	}

	signa = getsign(a);
	signb = getsign(b);

	sign = signa ^ signb;

	dest = &st(deststnr);
	saved_sign = getsign(dest);

	if (!(taga | tagb)) {
		
		reg_copy(a, &x);
		reg_copy(b, &y);
		setpositive(&x);
		setpositive(&y);
		tag = FPU_u_div(&x, &y, dest, control_w, sign);

		if (tag < 0)
			return tag;

		FPU_settagi(deststnr, tag);
		return tag;
	}

	if (taga == TAG_Special)
		taga = FPU_Special(a);
	if (tagb == TAG_Special)
		tagb = FPU_Special(b);

	if (((taga == TAG_Valid) && (tagb == TW_Denormal))
	    || ((taga == TW_Denormal) && (tagb == TAG_Valid))
	    || ((taga == TW_Denormal) && (tagb == TW_Denormal))) {
		if (denormal_operand() < 0)
			return FPU_Exception;

		FPU_to_exp16(a, &x);
		FPU_to_exp16(b, &y);
		tag = FPU_u_div(&x, &y, dest, control_w, sign);
		if (tag < 0)
			return tag;

		FPU_settagi(deststnr, tag);
		return tag;
	} else if ((taga <= TW_Denormal) && (tagb <= TW_Denormal)) {
		if (tagb != TAG_Zero) {
			
			if (tagb == TW_Denormal) {
				if (denormal_operand() < 0)
					return FPU_Exception;
			}

			
			FPU_copy_to_regi(&CONST_Z, TAG_Zero, deststnr);
			setsign(dest, sign);
			return TAG_Zero;
		}
		
		if (taga == TAG_Zero) {
			
			return arith_invalid(deststnr);
		}
		
		return FPU_divide_by_zero(deststnr, sign);
	}
	
	else if ((taga == TW_NaN) || (tagb == TW_NaN)) {
		if (flags & LOADED)
			return real_2op_NaN((FPU_REG *) rm, flags & 0x0f, 0,
					    st0_ptr);

		if (flags & DEST_RM) {
			int tag;
			tag = FPU_gettag0();
			if (tag == TAG_Special)
				tag = FPU_Special(st0_ptr);
			return real_2op_NaN(st0_ptr, tag, rm,
					    (flags & REV) ? st0_ptr : &st(rm));
		} else {
			int tag;
			tag = FPU_gettagi(rm);
			if (tag == TAG_Special)
				tag = FPU_Special(&st(rm));
			return real_2op_NaN(&st(rm), tag, 0,
					    (flags & REV) ? st0_ptr : &st(rm));
		}
	} else if (taga == TW_Infinity) {
		if (tagb == TW_Infinity) {
			
			return arith_invalid(deststnr);
		} else {
			
			if ((tagb == TW_Denormal) && (denormal_operand() < 0))
				return FPU_Exception;

			
			FPU_copy_to_regi(a, TAG_Special, deststnr);
			setsign(dest, sign);
			return taga;
		}
	} else if (tagb == TW_Infinity) {
		if ((taga == TW_Denormal) && (denormal_operand() < 0))
			return FPU_Exception;

		
		FPU_copy_to_regi(&CONST_Z, TAG_Zero, deststnr);
		setsign(dest, sign);
		return TAG_Zero;
	}
#ifdef PARANOID
	else {
		EXCEPTION(EX_INTERNAL | 0x102);
		return FPU_Exception;
	}
#endif 

	return 0;
}
  jvmdiError load_new_class_versions(TRAPS) {
    // For consistency allocate memory using os::malloc wrapper.
    _k_h_new = (instanceKlassHandle *) os::malloc(sizeof(instanceKlassHandle) * _class_count);

    ResourceMark rm(THREAD);

    for (int i = 0; i < _class_count; i++) {
      oop mirror = JNIHandles::resolve_non_null(_class_defs[i].clazz);
      klassOop k_oop = java_lang_Class::as_klassOop(mirror);
      instanceKlassHandle k_h = instanceKlassHandle(THREAD, k_oop);
      symbolHandle k_name = symbolHandle(THREAD, k_h->name());

      ClassFileStream st((u1*) _class_defs[i].class_bytes, _class_defs[i].class_byte_count, NULL);

      // Parse the stream.
      Handle k_loader_h(THREAD, k_h->class_loader());
      Handle protection_domain;
      klassOop k = SystemDictionary::parse_stream(k_name, 
                                                  k_loader_h, 
                                                  protection_domain,
                                                  &st,
                                                  THREAD);
                                     
      instanceKlassHandle k_h_new (THREAD, k);

      if (HAS_PENDING_EXCEPTION) {
        if (PENDING_EXCEPTION->klass()->klass_part()->name() ==
          vmSymbols::java_lang_UnsupportedClassVersionError()) {
          CLEAR_PENDING_EXCEPTION;
          return JVMDI_ERROR_UNSUPPORTED_VERSION;

        } else if (PENDING_EXCEPTION->klass()->klass_part()->name() == 
          vmSymbols::java_lang_ClassFormatError()) {
          CLEAR_PENDING_EXCEPTION;
          return JVMDI_ERROR_INVALID_CLASS_FORMAT;
        } else if (PENDING_EXCEPTION->klass()->klass_part()->name() ==
          vmSymbols::java_lang_ClassCircularityError()) {
          CLEAR_PENDING_EXCEPTION;
          return JVMDI_ERROR_CIRCULAR_CLASS_DEFINITION;
        } else if (PENDING_EXCEPTION->klass()->klass_part()->name() ==
          vmSymbols::java_lang_NoClassDefFoundError()) {
          // The message will be "XXX (wrong name: YYY)"
          CLEAR_PENDING_EXCEPTION;
          return JVMDI_ERROR_NAMES_DONT_MATCH;
        } else {  // Just in case more exceptions can be thrown..
          return JVMDI_ERROR_FAILS_VERIFICATION;
        }
      }

      // See instanceKlass::link_klass_impl()
      { ObjectLocker ol(k_h_new, THREAD);
        Verifier::verify_byte_codes(k_h_new, THREAD);

        if (HAS_PENDING_EXCEPTION) {
          CLEAR_PENDING_EXCEPTION;
          return JVMDI_ERROR_FAILS_VERIFICATION;
        }
        Rewriter::rewrite(k_h_new, THREAD); // No exception can happen here
      }

      jvmdiError res = compare_class_versions(k_h, k_h_new);
      if (res != JVMDI_ERROR_NONE) return res;
  
      _k_h_new[i] = k_h_new;
    }
  
    return JVMDI_ERROR_NONE;
  }
Esempio n. 12
0
Vector4D&
	Vector4D::MultiplySetClip(
		const Point3D &v,
		const Matrix4D &m,
		int *clipper
	)
{
	Check_Pointer(this);
	Check_Object(&v);
	Check_Object(&m);

#if USE_ASSEMBLER_CODE
	Scalar *f = &x;
	_asm {
		mov         edi, v

		fld			dword ptr [edi]			//	v.x

		mov         esi, m

		fld			dword ptr [edi+4]		//	v.y
		fld			dword ptr [edi+8]		//	v.z

		mov         edi, f

		fld         dword ptr [esi+34h]		//	m[1][3]
		fmul        st, st(2)				//	v.y

		fld         dword ptr [esi+38h]		//	m[2][3]
		fmul        st, st(2)				//	v.z

		fxch		st(1)
		fadd        dword ptr [esi+3Ch]		//	m[3][3]

		fld         dword ptr [esi+30h]		//	m[0][3]
		fmul        st, st(5)				//	v.x

		fxch		st(2)
		faddp       st(1),st

		fld         dword ptr [esi+14h]		//	m[1][1]
		fmul        st, st(4)				//	v.y

		fxch		st(2)
		faddp       st(1),st

		fld         dword ptr [esi+18h]		//	m[2][1]
		fmul        st, st(3)				//	v.z

		fxch		st(1)
		fstp        dword ptr [edi+0Ch]		//	w

		fadd        dword ptr [esi+1Ch]		//	m[3][1]

		fld         dword ptr [esi+10h]		//	m[0][1]
		fmul        st, st(5)				//	v.x

		fxch		st(2)
		faddp       st(1),st

		fld         dword ptr [esi+24h]		//	m[1][2]
		fmul        st, st(4)				//	v.y

		fxch		st(2)
		faddp       st(1),st

		fld         dword ptr [esi+28h]		//	m[2][2]
		fmul        st, st(3)				//	v.z

		fxch		st(1)
		fstp        dword ptr [edi+4]		//	y

		fadd        dword ptr [esi+2Ch]		//	m[3][2]

		fld         dword ptr [esi+20h]		//	m[0][2]
		fmul        st, st(5)				//	v.x

		fxch		st(2)
		faddp       st(1),st

		fld         dword ptr [esi+4]		//	m[1][0]
		fmul        st, st(4)				//	v.y

		fxch		st(2)
		faddp       st(1),st

		fld         dword ptr [esi+8]		//	m[2][0]
		fmul        st, st(3)				//	v.z

		fxch		st(1)
		fstp        dword ptr [edi+8]		//	z

		fadd        dword ptr [esi+0Ch]		//	m[3][0]

		fld         dword ptr [esi]			//	m[0][0]
		fmul        st, st(5)				//	v.x

		fxch		st(2)
		faddp       st(1),st

		faddp       st(1),st

		//	get rid of x, y, z
		fstp		st(1)
		fstp		st(1)
		fstp		st(1)

		fstp        dword ptr [edi]			//	x

	}
#else
	x = v.x*m(0,0) + v.y*m(1,0) + v.z*m(2,0) + m(3,0);
	y = v.x*m(0,1) + v.y*m(1,1) + v.z*m(2,1) + m(3,1);
	z = v.x*m(0,2) + v.y*m(1,2) + v.z*m(2,2) + m(3,2);
	w = v.x*m(0,3) + v.y*m(1,3) + v.z*m(2,3) + m(3,3);
#endif

	*clipper = 0;

	if(w <= z)
	{
		*clipper |= 32;
	}

	if(z < 0.0f)
	{
		*clipper |= 16;
	}

	if(x < 0.0f)
	{
		*clipper |= 8;
	}

	if(w < x)
	{
		*clipper |= 4;
	}

	if(y < 0.0f)
	{
		*clipper |= 2;
	}

	if(w < y)
	{
		*clipper |= 1;
	}

	return *this;
}
Esempio n. 13
0
void FPU_copy_to_regi(FPU_REG const *r, u_char tag, int stnr)
{
	reg_copy(r, &st(stnr));
	FPU_settagi(stnr, tag);
}
Esempio n. 14
0
int FPU_stackoverflow(FPU_REG ** st_new_ptr)
{
	*st_new_ptr = &st(-1);

	return ((fpu_tag_word >> (((top - 1) & 7) * 2)) & 3) != TAG_Empty;
}
Esempio n. 15
0
File: main.cpp Progetto: nutsi/hell
int	main(int ac, char **av)
{
  if (ac < 2)
    {
      std::cout << "Usage : ./test_dynamic_fsa [Chaine a rechercher]" << std::endl;
      return 0;
    }

  Edge	e0('m');
  Edge	e1('e');
  Edge	e2('c');
  Edge	e3('h');
  Edge	e4('a');
  Edge	e5('n');
  Edge	e6('t');

  Fsa	fsa;

  State*	s0 = State::createUniqueState();
  State*	s1 = State::createUniqueState();
  State*	s2 = State::createUniqueState();
  State*	s3 = State::createUniqueState();
  State*	s4 = State::createUniqueState();
  State*	s5 = State::createUniqueState();
  State*	s6 = State::createUniqueState();
  State*	s7 = State::createUniqueState();
  State*	sf = State::createUniqueState();

  sf->endState(true);
  s7->endState(true);


  s0->addLink(&e0, "S1");
  s1->addLink(&e1, "S2");
  s2->addLink(&e2, "S3");
  s2->addLink(&e1, "S2");
  s3->addLink(&e3, "S4");
  s4->addLink(&e4, "S5");
  s5->addLink(&e5, "S6");
  s6->addLink(&e6, "S7");
  s6->addLink(&e5, "S6");
  
  std::cout << s0->name() << std::endl;
  std::cout << s1->name() << std::endl;
  std::cout << s2->name() << std::endl;
  std::cout << s3->name() << std::endl;
  std::cout << s4->name() << std::endl;
  std::cout << s5->name() << std::endl;
  std::cout << s6->name() << std::endl;
  std::cout << s7->name() << std::endl;
  std::cout << sf->name() << std::endl;
  

  fsa.addState(s0);
  fsa.addState(s1);
  fsa.addState(s2);
  fsa.addState(s3);
  fsa.addState(s4);
  fsa.addState(s5);
  fsa.addState(s6);
  fsa.addState(s7);
  fsa.addState(sf);

  fsa.initState("S0");


  Matcher	match(fsa);

  match.find(av[1]);

  std::string	st(av[1]);
  st += av[1];

  int	l;
  match.find(st, l);

  std::cout << "La seconde instance de find a matcher " << l << " fois" << std::endl;

  return 0;
}
Esempio n. 16
0
/** Parse a keyfile
 *
 * @param _load_mesh : whether the mesh shall loaded
 * @return success : whether loading the data was successful
 *
 * The parameter can be used to prevent the loading of the mesh,
 * even though we use parse_mesh. We need this for includes.
 */
bool
KeyFile::load(bool _load_mesh)
{

  // read file
  auto my_filepath = resolve_include_filepath(get_filepath());
  std::vector<char> char_buffer = read_binary_file(my_filepath);
  has_linebreak_at_eof = char_buffer.back() == '\n';

#ifdef QD_DEBUG
  std::cout << "done." << std::endl;
#endif

  // init parallel worker if master file
  // if (parent_kf == this)
  //   _wq.init_workers(1);

  // convert buffer into blocks
  size_t iLine = 0;
  std::string last_keyword;
  std::vector<std::string> line_buffer;
  std::vector<std::string> line_buffer_tmp;
  bool found_pgp_section = false;

  std::string line;
  auto string_buffer = std::string(char_buffer.begin(), char_buffer.end());
  std::stringstream st(string_buffer);
  // for (; std::getline(st, line); ++iLine) {
  for (; std::getline(st, line); ++iLine) {

    if (line.find("-----BEGIN PGP") != std::string::npos) {
      found_pgp_section = true;
#ifdef QD_DEBUG
      std::cout << "Found PGP Section\n";
#endif
    }

    // remove windows file ending ... I hate it ...
    if (line.size() != 0 && line.back() == '\r')
      line.pop_back();

    // new keyword
    if (line[0] == '*' || found_pgp_section) {

      if (!line_buffer.empty() && !last_keyword.empty()) {

        // transfer possible header for following keyword (see function)
        transfer_comment_header(line_buffer, line_buffer_tmp);

        // get type
        auto kw_type = Keyword::determine_keyword_type(last_keyword);

#ifdef QD_DEBUG
        std::cout << last_keyword << " -> ";
        switch (kw_type) {
          case (Keyword::KeywordType::NODE):
            std::cout << "NODE\n";
            break;
          case (Keyword::KeywordType::ELEMENT):
            std::cout << "ELEMENT\n";
            break;
          case (Keyword::KeywordType::PART):
            std::cout << "PART\n";
            break;
          case (Keyword::KeywordType::GENERIC):
            std::cout << "GENERIC\n";
            break;
          case (Keyword::KeywordType::INCLUDE):
            std::cout << "INCLUDE\n";
            break;
          case (Keyword::KeywordType::INCLUDE_PATH):
            std::cout << "INCLUDE_PATH\n";
            break;
        }
#endif

        auto kw = create_keyword(line_buffer,
                                 kw_type,
                                 iLine - line_buffer.size() -
                                   line_buffer_tmp.size() + 1);
        if (kw)
          keywords[kw->get_keyword_name()].push_back(kw);

        // transfer cropped data
        line_buffer = line_buffer_tmp;
      }

      // we always trim keywords
      trim_right(line);
      last_keyword = line;

    } // IF:line[0] == '*'

    // Encrypted Sections
    //
    // Extracts encrypted section here and places it in a line in the
    // line buffer. An encrypted section is treated like a keyword.
    if (found_pgp_section) {
      found_pgp_section = false;

      // get stream position
      const auto stream_position = st.tellg();

      const auto end_position =
        string_buffer.find("-----END PGP", stream_position);

      if (end_position == std::string::npos)
        throw(
          std::runtime_error("Could not find \"-----END PGP MESSAGE-----\" for "
                             "corresponding \"-----BEGIN PGP MESSAGE-----\" "));

      // set stream position behind encrypted section
      st.seekg(end_position);

      // extract encrypted stuff
      line += '\n';
      line += std::string(char_buffer.begin() + stream_position,
                          char_buffer.begin() + end_position);

      // print_string_as_hex(line);

      if (line.back() == '\n')
        line.pop_back();
      if (line.back() == '\r')
        line.pop_back();
    }

    // we stupidly add every line to the buffer
    line_buffer.push_back(line);

  } // for:line

  // allocate last block
  if (!line_buffer.empty() && !last_keyword.empty()) {

    auto kw = create_keyword(line_buffer,
                             Keyword::determine_keyword_type(last_keyword),
                             iLine - line_buffer.size() + 1);
    if (kw)
      keywords[kw->get_keyword_name()].push_back(kw);
  }

  // only load files above *END!
  const auto end_kw_position = get_end_keyword_position();

  // includes
  if (load_includes) {

    // update include dirs
    get_include_dirs(true);

    // do the thing
    for (auto& include_kw : include_keywords) {

      if (include_kw->get_position() < end_kw_position)
        // Note: prevent loading the mesh here
        include_kw->load(false);
    }
  }

  // wait for threads to finish preloading
  // _wq.wait_for_completion();

  // Wait for completion
  // while (work_queue.size() != 0) {
  //   work_queue.front().wait();
  //   work_queue.pop();
  // }

  // load mesh if requested
  if (parse_mesh && _load_mesh) {

    // load nodes
    load_nodes();

    // load parts
    load_parts();

    // load elements
    load_elements();
  }

  return true;
}
Esempio n. 17
0
wxSize wxChoice::DoGetBestSize() const
{
    int lbWidth = GetCount() > 0 ? 20 : 100;  // some defaults
    int lbHeight = 20;
    int wLine;

#if TARGET_CARBON
    SInt32 metric ;

    GetThemeMetric( kThemeMetricPopupButtonHeight , &metric );
    lbHeight = metric ;
#endif

    {
#if wxMAC_USE_CORE_GRAPHICS
        wxClientDC dc(const_cast<wxChoice*>(this));
#else
        wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetTopLevelWindowRef() ) ) ;
        if ( m_font.Ok() )
        {
            ::TextFont( m_font.MacGetFontNum() ) ;
            ::TextSize( m_font.MacGetFontSize() ) ;
            ::TextFace( m_font.MacGetFontStyle() ) ;
        }
        else
        {
            ::TextFont( kFontIDMonaco ) ;
            ::TextSize( 9 ) ;
            ::TextFace( 0 ) ;
        }
#endif
        // Find the widest line
        for(unsigned int i = 0; i < GetCount(); i++)
        {
            wxString str(GetString(i));
#if wxMAC_USE_CORE_GRAPHICS
            wxCoord width, height ;
            dc.GetTextExtent( str , &width, &height);
            wLine = width ;
#else
#if wxUSE_UNICODE
            Point bounds = { 0, 0 } ;
            SInt16 baseline ;

            ::GetThemeTextDimensions( wxMacCFStringHolder( str , GetFont().GetEncoding() ) ,
                kThemeCurrentPortFont,
                kThemeStateActive,
                false,
                &bounds,
                &baseline );

            wLine = bounds.h ;
#else
            wLine = ::TextWidth( str.c_str() , 0 , str.length() ) ;
#endif
#endif
            lbWidth = wxMax( lbWidth, wLine ) ;
        }

        // Add room for the popup arrow
        lbWidth += 2 * lbHeight ;
#if wxMAC_USE_CORE_GRAPHICS
        wxCoord width, height ;
        dc.GetTextExtent( wxT("X"), &width, &height);
        int cx = width ;
        lbHeight += 4;
#else
        // And just a bit more
        int cx = ::TextWidth( "X" , 0 , 1 ) ;
#endif
        lbWidth += cx ;
    }

    return wxSize( lbWidth, lbHeight );
}
Esempio n. 18
0
void state::do_string(const std::string& string) const
{
	stack st(*this);
	st.create_function(string);
	st.call(0, 0);
}
Esempio n. 19
0
void
OfferFrame::storeAdd(LedgerDelta& delta, Database& db) const
{
    std::string actIDStrKey = PubKeyUtils::toStrKey(mOffer.sellerID);

    soci::statement st(db.getSession().prepare << "select 1");

    auto timer = db.getInsertTimer("offer");

    unsigned int sellingType = mOffer.selling.type();
    unsigned int buyingType = mOffer.buying.type();
    std::string sellingIssuerStrKey, buyingIssuerStrKey;
    std::string sellingAssetCode, buyingAssetCode;

    if(sellingType == ASSET_TYPE_CREDIT_ALPHANUM4)
    {
        sellingIssuerStrKey =
            PubKeyUtils::toStrKey(mOffer.selling.alphaNum4().issuer); 
        assetCodeToStr(mOffer.selling.alphaNum4().assetCode,
            sellingAssetCode);
       
    } else if(sellingType == ASSET_TYPE_CREDIT_ALPHANUM12)
    {
        sellingIssuerStrKey =
            PubKeyUtils::toStrKey(mOffer.selling.alphaNum12().issuer);
        assetCodeToStr(mOffer.selling.alphaNum12().assetCode,
            sellingAssetCode);
    }

    if(buyingType == ASSET_TYPE_CREDIT_ALPHANUM4)
    {
        buyingIssuerStrKey =
            PubKeyUtils::toStrKey(mOffer.buying.alphaNum4().issuer);
        assetCodeToStr(mOffer.buying.alphaNum4().assetCode,
            buyingAssetCode);

    } else if(buyingType == ASSET_TYPE_CREDIT_ALPHANUM12)
    {
        buyingIssuerStrKey =
            PubKeyUtils::toStrKey(mOffer.buying.alphaNum12().issuer);
        assetCodeToStr(mOffer.buying.alphaNum12().assetCode,
            buyingAssetCode);
    }
    
   
    
    st = (db.getSession().prepare
        << "INSERT INTO offers (sellerid,offerid,"
        "sellingassettype,sellingassetcode,sellingissuer,"
        "buyingassettype,buyingassetcode,buyingissuer,"
        "amount,pricen,priced,price,flags) VALUES "
        "(:v1,:v2,:v3,:v4,:v5,:v6,:v7,:v8,:v9,:v10,:v11,:v12,:v13)",
        use(actIDStrKey), use(mOffer.offerID), use(sellingType), 
        use(sellingAssetCode),
        use(sellingIssuerStrKey), use(buyingType), use(buyingAssetCode),
        use(buyingIssuerStrKey), use(mOffer.amount), use(mOffer.price.n),
        use(mOffer.price.d), use(computePrice()), use(mOffer.flags));
    st.execute(true);
    

    if (st.get_affected_rows() != 1)
    {
        throw std::runtime_error("could not update SQL");
    }

    delta.addEntry(*this);
}
Esempio n. 20
0
asm void bar() { fool:
	adc	eax, 1
	adc	fool, 1
	adc	eax, eax
	adc	fool, eax
	adc	eax, fool
	add	eax, 1
	add	fool, 1
	add	eax, eax
	add	fool, eax
	add	eax, fool
	addpd	xmm0, xmm0
	addpd	xmm0, fool
	addps	xmm0, xmm0
	addps	xmm0, fool
	addsd	xmm0, xmm0
	addsd	xmm0, fool
	addss	xmm0, xmm0
	addss	xmm0, fool
	addsubpd	xmm0, xmm0
	addsubpd	xmm0, fool
	addsubps	xmm0, xmm0
	addsubps	xmm0, fool
	and	eax, 1
	and	fool, 1
	and	eax, eax
	and	fool, eax
	and	eax, fool
	andnpd	xmm0, xmm0
	andnpd	xmm0, fool
	andnps	xmm0, xmm0
	andnps	xmm0, fool
	andpd	xmm0, xmm0
	andpd	xmm0, fool
	andps	xmm0, xmm0
	andps	xmm0, fool
	arpl	ax, ax
	arpl	foos, ax
	bsf	eax, eax
	bsf	eax, fool
	bsr	eax, eax
	bsr	eax, fool
	bt	eax, eax
	bt	fool, eax
	bt	eax, 1
	bt	fool, 1
	btc	eax, eax
	btc	fool, eax
	btc	eax, 1
	btc	fool, 1
	btr	eax, eax
	btr	fool, eax
	btr	eax, 1
	btr	fool, 1
	bts	eax, eax
	bts	fool, eax
	bts	eax, 1
	bts	fool, 1
	call	eax
	call	fool
	call	fool
	clflush	fool
	cmova	ax, ax
	cmova	ax, foos
	cmova	eax, eax
	cmova	eax, fooi
	cmovae	eax, eax
	cmovae	eax, fool
	cmovb	eax, eax
	cmovb	eax, fool
	cmovbe	eax, eax
	cmovbe	eax, fool
	cmovc	eax, eax
	cmovc	eax, fool
	cmove	eax, eax
	cmove	eax, fool
	cmovg	eax, eax
	cmovg	eax, fool
	cmovge	eax, eax
	cmovge	eax, fool
	cmovl	eax, eax
	cmovl	eax, fool
	cmovle	eax, eax
	cmovle	eax, fool
	cmovna	eax, eax
	cmovna	eax, fool
	cmovnae	eax, eax
	cmovnae	eax, fool
	cmovnb	eax, eax
	cmovnb	eax, fool
	cmovnbe	eax, eax
	cmovnbe	eax, fool
	cmovnc	eax, eax
	cmovnc	eax, fool
	cmovne	eax, eax
	cmovne	eax, fool
	cmovng	eax, eax
	cmovng	eax, fool
	cmovnge	eax, eax
	cmovnge	eax, fool
	cmovnl	eax, eax
	cmovnl	eax, fool
	cmovnle	eax, eax
	cmovnle	eax, fool
	cmovno	eax, eax
	cmovno	eax, fool
	cmovnp	eax, eax
	cmovnp	eax, fool
	cmovns	eax, eax
	cmovns	eax, fool
	cmovnz	eax, eax
	cmovnz	eax, fool
	cmovo	eax, eax
	cmovo	eax, fool
	cmovp	eax, eax
	cmovp	eax, fool
	cmovpe	eax, eax
	cmovpe	eax, fool
	cmovpo	eax, eax
	cmovpo	eax, fool
	cmovs	eax, eax
	cmovs	eax, fool
	cmovz	eax, eax
	cmovz	eax, fool
	cmp	eax, 1
	cmp	fool, 1
	cmp	eax, eax
	cmp	fool, eax
	cmp	eax, fool
	cmpeqpd	xmm0, xmm0
	cmpeqpd	xmm0, fool
	cmpeqps	xmm0, xmm0
	cmpeqps	xmm0, fool
	cmpeqsd	xmm0, xmm0
	cmpeqsd	xmm0, fool
	cmpeqss	xmm0, xmm0
	cmpeqss	xmm0, fool
	cmplepd	xmm0, xmm0
	cmplepd	xmm0, fool
	cmpleps	xmm0, xmm0
	cmpleps	xmm0, fool
	cmplesd	xmm0, xmm0
	cmplesd	xmm0, fool
	cmpless	xmm0, xmm0
	cmpless	xmm0, fool
	cmpltpd	xmm0, xmm0
	cmpltpd	xmm0, fool
	cmpltps	xmm0, xmm0
	cmpltps	xmm0, fool
	cmpltsd	xmm0, xmm0
	cmpltsd	xmm0, fool
	cmpltss	xmm0, xmm0
	cmpltss	xmm0, fool
	cmpneqpd	xmm0, xmm0
	cmpneqpd	xmm0, fool
	cmpneqps	xmm0, xmm0
	cmpneqps	xmm0, fool
	cmpneqsd	xmm0, xmm0
	cmpneqsd	xmm0, fool
	cmpneqss	xmm0, xmm0
	cmpneqss	xmm0, fool
	cmpnlepd	xmm0, xmm0
	cmpnlepd	xmm0, fool
	cmpnleps	xmm0, xmm0
	cmpnleps	xmm0, fool
	cmpnlesd	xmm0, xmm0
	cmpnlesd	xmm0, fool
	cmpnless	xmm0, xmm0
	cmpnless	xmm0, fool
	cmpnltpd	xmm0, xmm0
	cmpnltpd	xmm0, fool
	cmpnltps	xmm0, xmm0
	cmpnltps	xmm0, fool
	cmpnltsd	xmm0, xmm0
	cmpnltsd	xmm0, fool
	cmpnltss	xmm0, xmm0
	cmpnltss	xmm0, fool
	cmpordpd	xmm0, xmm0
	cmpordpd	xmm0, fool
	cmpordps	xmm0, xmm0
	cmpordps	xmm0, fool
	cmpordsd	xmm0, xmm0
	cmpordsd	xmm0, fool
	cmpordss	xmm0, xmm0
	cmpordss	xmm0, fool
	cmppd	xmm0, xmm0, 4
	cmppd	xmm0, fool, 4
	cmpps	xmm0, xmm0, 4
	cmpps	xmm0, fool, 4
	cmpsd	xmm0, xmm0, 4
	cmpsd	xmm0, fool, 4
	cmpss	xmm0, xmm0, 4
	cmpss	xmm0, fool, 4
	cmpunordpd	xmm0, xmm0
	cmpunordpd	xmm0, fool
	cmpunordps	xmm0, xmm0
	cmpunordps	xmm0, fool
	cmpunordsd	xmm0, xmm0
	cmpunordsd	xmm0, fool
	cmpunordss	xmm0, xmm0
	cmpunordss	xmm0, fool
	cmpxchg	fool, eax
	cmpxchg	eax, eax
	comisd	xmm0, xmm0
	comisd	xmm0, fool
	comiss	xmm0, xmm0
	comiss	xmm0, fool
	cvtdq2pd	xmm0, xmm0
	cvtdq2pd	xmm0, fool
	cvtdq2ps	xmm0, xmm0
	cvtdq2ps	xmm0, fool
	cvtpd2dq	xmm0, xmm0
	cvtpd2dq	xmm0, fool
	cvtpd2pi	mm0, xmm0
	cvtpd2pi	mm0, fool
	cvtpd2ps	xmm0, xmm0
	cvtpd2ps	xmm0, fool
	cvtpi2pd	xmm0, mm0
	cvtpi2pd	xmm0, fool
	cvtpi2ps	xmm0, mm0
	cvtpi2ps	xmm0, fool
	cvtps2dq	xmm0, xmm0
	cvtps2dq	xmm0, fool
	cvtps2pd	xmm0, xmm0
	cvtps2pd	xmm0, fool
	cvtps2pi	mm0, xmm0
	cvtps2pi	mm0, fool
	cvtsd2si	eax, xmm0
	cvtsd2si	eax, fool
	cvtsd2ss	xmm0, xmm0
	cvtsd2ss	xmm0, fool
	cvtsi2sd	xmm0, eax
	cvtsi2sd	xmm0, fooi
	cvtsi2ss	xmm0, eax
	cvtsi2ss	xmm0, fooi
	cvtss2sd	xmm0, xmm0
	cvtss2sd	xmm0, fool
	cvtss2si	eax, xmm0
	cvtss2si	eax, fool
	cvttpd2dq	xmm0, xmm0
	cvttpd2dq	xmm0, fool
	cvttpd2pi	mm0, xmm0
	cvttpd2pi	mm0, fool
	cvttps2dq	xmm0, xmm0
	cvttps2dq	xmm0, fool
	cvttps2pi	mm0, xmm0
	cvttps2pi	mm0, fool
	cvttsd2si	eax, xmm0
	cvttsd2si	eax, fool
	cvttss2si	eax, xmm0
	cvttss2si	eax, fool
	dec	ah
	dec	fooc
	dec	ax
	dec	foos
	dec	eax
	dec	fooi
	div	ah
	div	fooc
	div	ax
	div	foos
	div	eax
	div	fooi
	divpd	xmm0, xmm0
	divpd	xmm0, fool
	divps	xmm0, xmm0
	divps	xmm0, fool
	divsd	xmm0, xmm0
	divsd	xmm0, fool
	divss	xmm0, xmm0
	divss	xmm0, fool
	enter	1, 1
	fadd	st(0), st(2)
	fadd	st(2), st(0)
	fadd	foof
	fadd	food
	faddp	st(2), st(0)
	fbld	fool
	fbstp	fool
	fcmovb	st(0), st(2)
	fcmovbe	st(0), st(2)
	fcmove	st(0), st(2)
	fcmovnb	st(0), st(2)
	fcmovnbe	st(0), st(2)
	fcmovne	st(0), st(2)
	fcmovnu	st(0), st(2)
	fcmovu	st(0), st(2)
	fcom	st(2)
	fcom	foof
	fcom	food
	fcomi	st(0), st(2)
	fcomip	st(0), st(2)
	fcomp	st(2)
	fcomp	foof
	fcomp	food
	fdiv	st(0), st(2)
	fdiv	st(2), st(0)
	fdiv	foof
	fdiv	food
	fdivp	st(2), st(0)
	fdivr	st(0), st(2)
	fdivr	foof
	fdivr	food
	fdivrp	st(2), st(0)
	ffree	st(2)
	fiadd	foos
	fiadd	fooi
	ficom	foos
	ficom	fooi
	ficomp	foos
	ficomp	fooi
	fidiv	foos
	fidiv	fooi
	fidivr	foos
	fidivr	fooi
	fild	foos
	fild	fooi
	fild	fooll
	fimul	foos
	fimul	fooi
	fist	foos
	fist	fooi
	fistp	foos
	fistp	fooi
	fistp	fooll
	fisttp	foos
	fisttp	fooi
	fisttp	fooll
	fisub	foos
	fisub	fooi
	fisubr	foos
	fisubr	fooi
	fld	st(2)
	fld	foof
	fld	food
	fld	foold
	fldcw	foos
	fldenv	fool
	fldt	fool
	fmul	st(2), st(0)
	fmul	st(0), st(2)
	fmul	foof
	fmul	food
	fmulp	st(2), st(0)
	fnsave	fool
	fnstcw	fool
	fnstenv	fool
	fnstsw	fool
	fnstsw	eax
	frstor	fool
	fsave	fool
	fst	st(2)
	fst	foof
	fst	food
	fstcw	fool
	fstenv	fool
	fstp	st(2)
	fstp	foof
	fstp	food
	fstp	foold
	fstsw	fool
	fstsw	eax
	fsub	st(2), st(0)
	fsub	st(0), st(2)
	fsub	foof
	fsub	food
	fsubr	st(2), st(0)
	fsubr	st(0), st(2)
	fsubr	foof
	fsubr	food
	fucom	st(2)
	fucomi	st(0), st(2)
	fucomip	st(0), st(2)
	fucomp	st(2)
	fxch	st(2)
	fxrstor	fool
	fxsave	fool
	haddpd	xmm0, xmm0
	haddpd	xmm0, fool
	haddps	xmm0, xmm0
	haddps	xmm0, fool
	hsubpd	xmm0, xmm0
	hsubpd	xmm0, fool
	hsubps	xmm0, xmm0
	hsubps	xmm0, fool
	idiv	ah
	idiv	fooc
	idiv	ax
	idiv	foos
	idiv	eax
	idiv	fooi
	imul	eax, eax, 4
	imul	eax, fool, 4
	in	eax, 1
	inc	ah
	inc	fooc
	inc	ax
	inc	foos
	inc	eax
	inc	fooi
	ins	fooc, dx
	ins	foos, dx
	ins	fooi, dx
	int	1
	invlpg	fool
	ja	fool
	jae	fool
	jb	fool
	jbe	fool
	jc	fool
	jcxz	.-24
	je	fool
	jecxz	.-24
	jg	fool
	jge	fool
	jl	fool
	jle	fool
	jmp	fool
	jmp	eax
	jmp	fooi
	jna	fool
	jnae	fool
	jnb	fool
	jnc	fool
	jne	fool
	jng	fool
	jnge	fool
	jnl	fool
	jnle	fool
	jno	fool
	jnp	fool
	jns	fool
	jnz	fool
	jo	fool
	jp	fool
	jpe	fool
	jpo	fool
	js	fool
	jz	fool
	lar	eax, eax
	lar	eax, fool
	lddqu	xmm0, fool
	ldmxcsr	fool
	lds	ax, foos
	lds	eax, fooi
	lea	eax, fool
	les	ax, foos
	les	eax, fooi
	lfs	ax, foos
	lfs	eax, fooi
	lgdt	fool
	lgs	ax, foos
	lgs	eax, fooi
	lidt	fool
	lldt	ax
	lldt	foos
	lmsw	fool
	lods	fooc
	lods	foos
	lods	fooi
	loop	.-24
	loope	.-24
	loopne	.-24
	loopnz	.-24
	loopz	.-24
	lsl	ax, ax
	lsl	ax, foos
	lsl	eax, eax
	lsl	eax, fooi
	lss	ax, foos
	lss	eax, fooi
	ltr	ax
	ltr	foos
	maskmovdqu	xmm0, xmm0
	maskmovq	mm0, mm0
	maxpd	xmm0, xmm0
	maxpd	xmm0, fool
	maxps	xmm0, xmm0
	maxps	xmm0, fool
	maxsd	xmm0, xmm0
	maxsd	xmm0, fool
	maxss	xmm0, xmm0
	maxss	xmm0, fool
	minpd	xmm0, xmm0
	minpd	xmm0, fool
	minps	xmm0, xmm0
	minps	xmm0, fool
	minsd	xmm0, xmm0
	minsd	xmm0, fool
	minss	xmm0, xmm0
	minss	xmm0, fool
	mov	ah, ah
	mov	fooc, ah
	mov	ah, 1
	mov	fooc, 1
	mov	ax, ax
	mov	foos, ax
	mov	ax, 1
	mov	foos, 1
	mov	eax, eax
	mov	fooi, eax
	mov	eax, 1
	mov	fooi, 1
	mov	ah, ah
	mov	ah, 1
	mov	ah, fooc
	mov	ax, ax
	mov	ax, 1
	mov	ax, foos
	mov	eax, eax
	mov	eax, 1
	mov	eax, fooi
	movapd	xmm0, xmm0
	movapd	xmm0, fool
	movapd	xmm0, xmm0
	movapd	fool, xmm0
	movaps	xmm0, xmm0
	movaps	xmm0, fool
	movaps	xmm0, xmm0
	movaps	fool, xmm0
	movd	eax, xmm0
	movd	fool, xmm0
	movd	xmm0, eax
	movd	xmm0, fool
	movd	mm0, eax
	movd	mm0, fool
	movd	eax, mm0
	movd	fool, mm0
	movddup	xmm0, xmm0
	movddup	xmm0, fool
	movdq2q	mm0, xmm0
	movdqa	xmm0, xmm0
	movdqa	xmm0, fool
	movdqu	xmm0, xmm0
	movdqu	xmm0, fool
	movhlps	xmm0, xmm0
	movhpd	xmm0, fool
	movhpd	fool, xmm0
	movhps	xmm0, fool
	movhps	fool, xmm0
	movlhps	xmm0, xmm0
	movlpd	xmm0, fool
	movlpd	fool, xmm0
	movlps	xmm0, fool
	movlps	fool, xmm0
	movmskpd	eax, xmm0
	movmskps	eax, xmm0
	movntdq	fool, xmm0
	movnti	fool, eax
	movntpd	fool, xmm0
	movntps	fool, xmm0
	movntq	fool, mm0
	movq	xmm0, xmm0
	movq	xmm0, fool
	movq	fool, xmm0
	movq	mm0, mm0
	movq	mm0, fool
	movq	fool, mm0
	movq2dq	xmm0, mm0
	movs	fooc, fooc
	movs	foos, foos
	movs	fooi, fooi
	movsd	xmm0, xmm0
	movsd	fool, xmm0
	movsd	xmm0, xmm0
	movsd	xmm0, fool
	movshdup	xmm0, xmm0
	movshdup	xmm0, fool
	movsldup	xmm0, xmm0
	movsldup	xmm0, fool
	movss	xmm0, xmm0
	movss	fool, xmm0
	movss	xmm0, xmm0
	movss	xmm0, fool
	movsx	ax, ah
	movsx	ax, fooc
	movsx	eax, ah
	movsx	eax, fooc
	movsx	eax, ax
	movsx	eax, foos
	movupd	xmm0, xmm0
	movupd	xmm0, fool
	movupd	xmm0, xmm0
	movupd	fool, xmm0
	movups	xmm0, xmm0
	movups	xmm0, fool
	movups	xmm0, xmm0
	movups	fool, xmm0
	movzx	ax, ah
	movzx	ax, fooc
	movzx	eax, ah
	movzx	eax, fooc
	movzx	eax, ax
	movzx	eax, foos
	mul	ah
	mul	fooc
	mul	ax
	mul	foos
	mul	eax
	mul	fooi
	mulpd	xmm0, xmm0
	mulpd	xmm0, fool
	mulps	xmm0, xmm0
	mulps	xmm0, fool
	mulsd	xmm0, xmm0
	mulsd	xmm0, fool
	mulss	xmm0, xmm0
	mulss	xmm0, fool
	neg	ah
	neg	fooc
	neg	ax
	neg	foos
	neg	eax
	neg	fooi
	not	ah
	not	fooc
	not	ax
	not	foos
	not	eax
	not	fooi
	or	ah, ah
	or	fooc, ah
	or	ah, 1
	or	fooc, 1
	or	ax, ax
	or	foos, ax
	or	ax, 1
	or	foos, 1
	or	eax, eax
	or	fooi, eax
	or	eax, 1
	or	fooi, 1
	or	ah, fooc
	or	ax, foos
	or	eax, fooi
	orpd	xmm0, xmm0
	orpd	xmm0, fool
	orps	xmm0, xmm0
	orps	xmm0, fool
	out	1, al
	out	dx, al
	out	1, ax
	out	dx, ax
	out	1, eax
	out	dx, eax
	outs	dx, fooc
	outs	dx, foos
	outs	dx, fooi
	packssdw	xmm0, xmm0
	packssdw	xmm0, fool
	packssdw	mm0, mm0
	packssdw	mm0, fool
	packsswb	xmm0, xmm0
	packsswb	xmm0, fool
	packsswb	mm0, mm0
	packsswb	mm0, fool
	packuswb	xmm0, xmm0
	packuswb	xmm0, fool
	packuswb	mm0, mm0
	packuswb	mm0, fool
	paddb	xmm0, xmm0
	paddb	xmm0, fool
	paddb	mm0, mm0
	paddb	mm0, fool
	paddd	xmm0, xmm0
	paddd	xmm0, fool
	paddd	mm0, mm0
	paddd	mm0, fool
	paddq	xmm0, xmm0
	paddq	xmm0, fool
	paddq	mm0, mm0
	paddq	mm0, fool
	paddsb	xmm0, xmm0
	paddsb	xmm0, fool
	paddsb	mm0, mm0
	paddsb	mm0, fool
	paddsw	xmm0, xmm0
	paddsw	xmm0, fool
	paddsw	mm0, mm0
	paddsw	mm0, fool
	paddusb	xmm0, xmm0
	paddusb	xmm0, fool
	paddusb	mm0, mm0
	paddusb	mm0, fool
	paddusw	xmm0, xmm0
	paddusw	xmm0, fool
	paddusw	mm0, mm0
	paddusw	mm0, fool
	paddw	xmm0, xmm0
	paddw	xmm0, fool
	paddw	mm0, mm0
	paddw	mm0, fool
	pand	xmm0, xmm0
	pand	xmm0, fool
	pand	mm0, mm0
	pand	mm0, fool
	pandn	xmm0, xmm0
	pandn	xmm0, fool
	pandn	mm0, mm0
	pandn	mm0, fool
	pavgb	xmm0, xmm0
	pavgb	xmm0, fool
	pavgb	mm0, mm0
	pavgb	mm0, fool
	pavgw	xmm0, xmm0
	pavgw	xmm0, fool
	pavgw	mm0, mm0
	pavgw	mm0, fool
	pcmpeqb	xmm0, xmm0
	pcmpeqb	xmm0, fool
	pcmpeqb	mm0, mm0
	pcmpeqb	mm0, fool
	pcmpeqd	xmm0, xmm0
	pcmpeqd	xmm0, fool
	pcmpeqd	mm0, mm0
	pcmpeqd	mm0, fool
	pcmpeqw	xmm0, xmm0
	pcmpeqw	xmm0, fool
	pcmpeqw	mm0, mm0
	pcmpeqw	mm0, fool
	pcmpgtb	xmm0, xmm0
	pcmpgtb	xmm0, fool
	pcmpgtb	mm0, mm0
	pcmpgtb	mm0, fool
	pcmpgtd	xmm0, xmm0
	pcmpgtd	xmm0, fool
	pcmpgtd	mm0, mm0
	pcmpgtd	mm0, fool
	pcmpgtw	xmm0, xmm0
	pcmpgtw	xmm0, fool
	pcmpgtw	mm0, mm0
	pcmpgtw	mm0, fool
	pextrw	eax, xmm0, 4
	pextrw	eax, mm0, 4
	pinsrw	xmm0, eax, 4
	pinsrw	mm0, eax, 4
	pinsrw	xmm0, fool, 4
	pinsrw	mm0, fool, 4
	pmaddwd	xmm0, xmm0
	pmaddwd	xmm0, fool
	pmaddwd	mm0, mm0
	pmaddwd	mm0, fool
	pmaxsw	xmm0, xmm0
	pmaxsw	xmm0, fool
	pmaxsw	mm0, mm0
	pmaxsw	mm0, fool
	pmaxub	xmm0, xmm0
	pmaxub	xmm0, fool
	pmaxub	mm0, mm0
	pmaxub	mm0, fool
	pminsw	xmm0, xmm0
	pminsw	xmm0, fool
	pminsw	mm0, mm0
	pminsw	mm0, fool
	pminub	xmm0, xmm0
	pminub	xmm0, fool
	pminub	mm0, mm0
	pminub	mm0, fool
	pmovmskb	eax, xmm0
	pmovmskb	eax, mm0
	pmulhuw	xmm0, xmm0
	pmulhuw	xmm0, fool
	pmulhuw	mm0, mm0
	pmulhuw	mm0, fool
	pmulhw	xmm0, xmm0
	pmulhw	xmm0, fool
	pmulhw	mm0, mm0
	pmulhw	mm0, fool
	pmullw	xmm0, xmm0
	pmullw	xmm0, fool
	pmullw	mm0, mm0
	pmullw	mm0, fool
	pmuludq	xmm0, xmm0
	pmuludq	xmm0, fool
	pmuludq	mm0, mm0
	pmuludq	mm0, fool
	pop	ax
	pop	foos
	pop	eax
	pop	fooi
	por	xmm0, xmm0
	por	xmm0, fool
	por	mm0, mm0
	por	mm0, fool
	prefetchnta	fool
	prefetcht0	fool
	prefetcht1	fool
	prefetcht2	fool
	psadbw	xmm0, xmm0
	psadbw	xmm0, fool
	psadbw	mm0, mm0
	psadbw	mm0, fool
	pshufd	xmm0, xmm0, 4
	pshufd	xmm0, fool, 4
	pshufhw	xmm0, xmm0, 4
	pshufhw	xmm0, fool, 4
	pshuflw	xmm0, xmm0, 4
	pshuflw	xmm0, fool, 4
	pshufw	mm0, mm0, 4
	pshufw	mm0, fool, 4
	pslld	xmm0, xmm0
	pslld	xmm0, fool
	pslld	xmm0, 1
	pslld	mm0, mm0
	pslld	mm0, fool
	pslld	mm0, 1
	pslldq	xmm0, 1
	psllq	xmm0, xmm0
	psllq	xmm0, fool
	psllq	xmm0, 1
	psllq	mm0, mm0
	psllq	mm0, fool
	psllq	mm0, 1
	psllw	xmm0, xmm0
	psllw	xmm0, fool
	psllw	xmm0, 1
	psllw	mm0, mm0
	psllw	mm0, fool
	psllw	mm0, 1
	psrad	xmm0, xmm0
	psrad	xmm0, fool
	psrad	xmm0, 1
	psrad	mm0, mm0
	psrad	mm0, fool
	psrad	mm0, 1
	psraw	xmm0, xmm0
	psraw	xmm0, fool
	psraw	xmm0, 1
	psraw	mm0, mm0
	psraw	mm0, fool
	psraw	mm0, 1
	psrld	xmm0, xmm0
	psrld	xmm0, fool
	psrld	xmm0, 1
	psrld	mm0, mm0
	psrld	mm0, fool
	psrld	mm0, 1
	psrldq	xmm0, 1
	psrlq	xmm0, xmm0
	psrlq	xmm0, fool
	psrlq	xmm0, 1
	psrlq	mm0, mm0
	psrlq	mm0, fool
	psrlq	mm0, 1
	psrlw	xmm0, xmm0
	psrlw	xmm0, fool
	psrlw	xmm0, 1
	psrlw	mm0, mm0
	psrlw	mm0, fool
	psrlw	mm0, 1
	psubb	xmm0, xmm0
	psubb	xmm0, fool
	psubb	mm0, mm0
	psubb	mm0, fool
	psubd	xmm0, xmm0
	psubd	xmm0, fool
	psubd	mm0, mm0
	psubd	mm0, fool
	psubq	xmm0, xmm0
	psubq	xmm0, fool
	psubq	mm0, mm0
	psubq	mm0, fool
	psubsb	xmm0, xmm0
	psubsb	xmm0, fool
	psubsb	mm0, mm0
	psubsb	mm0, fool
	psubsw	xmm0, xmm0
	psubsw	xmm0, fool
	psubsw	mm0, mm0
	psubsw	mm0, fool
	psubusb	xmm0, xmm0
	psubusb	xmm0, fool
	psubusb	mm0, mm0
	psubusb	mm0, fool
	psubusw	xmm0, xmm0
	psubusw	xmm0, fool
	psubusw	mm0, mm0
	psubusw	mm0, fool
	psubw	xmm0, xmm0
	psubw	xmm0, fool
	psubw	mm0, mm0
	psubw	mm0, fool
	punpckhbw	xmm0, xmm0
	punpckhbw	xmm0, fool
	punpckhbw	mm0, mm0
	punpckhbw	mm0, fool
	punpckhdq	xmm0, xmm0
	punpckhdq	xmm0, fool
	punpckhdq	mm0, mm0
	punpckhdq	mm0, fool
	punpckhqdq	xmm0, xmm0
	punpckhqdq	xmm0, fool
	punpckhwd	xmm0, xmm0
	punpckhwd	xmm0, fool
	punpckhwd	mm0, mm0
	punpckhwd	mm0, fool
	punpcklbw	xmm0, xmm0
	punpcklbw	xmm0, fool
	punpcklbw	mm0, mm0
	punpcklbw	mm0, fool
	punpckldq	xmm0, xmm0
	punpckldq	xmm0, fool
	punpckldq	mm0, mm0
	punpckldq	mm0, fool
	punpcklqdq	xmm0, xmm0
	punpcklqdq	xmm0, fool
	punpcklwd	xmm0, xmm0
	punpcklwd	xmm0, fool
	punpcklwd	mm0, mm0
	punpcklwd	mm0, fool
	push	ax
	push	foos
	push	eax
	push	fooi
	push	1
	pxor	xmm0, xmm0
	pxor	xmm0, fool
	pxor	mm0, mm0
	pxor	mm0, fool
	rcl	ah, 1
	rcl	fooc, 1
	rcl	ax, 1
	rcl	foos, 1
	rcl	eax, 1
	rcl	fooi, 1
	rcl	ah, cl
	rcl	fooc, cl
	rcl	ax, cl
	rcl	foos, cl
	rcl	eax, cl
	rcl	fooi, cl
	rcpps	xmm0, xmm0
	rcpps	xmm0, fool
	rcpss	xmm0, xmm0
	rcpss	xmm0, fool
	rcr	ah, 1
	rcr	fooc, 1
	rcr	ax, 1
	rcr	foos, 1
	rcr	eax, 1
	rcr	fooi, 1
	rcr	ah, cl
	rcr	fooc, cl
	rcr	ax, cl
	rcr	foos, cl
	rcr	eax, cl
	rcr	fooi, cl
	ret	1
	rol	ah, 1
	rol	fooc, 1
	rol	ax, 1
	rol	foos, 1
	rol	eax, 1
	rol	fooi, 1
	rol	ah, cl
	rol	fooc, cl
	rol	ax, cl
	rol	foos, cl
	rol	eax, cl
	rol	fooi, cl
	ror	ah, 1
	ror	fooc, 1
	ror	ax, 1
	ror	foos, 1
	ror	eax, 1
	ror	fooi, 1
	ror	ah, cl
	ror	fooc, cl
	ror	ax, cl
	ror	foos, cl
	ror	eax, cl
	ror	fooi, cl
	rsqrtps	xmm0, xmm0
	rsqrtps	xmm0, fool
	rsqrtss	xmm0, xmm0
	rsqrtss	xmm0, fool
	sal	ah, 1
	sal	fooc, 1
	sal	ax, 1
	sal	foos, 1
	sal	eax, 1
	sal	fooi, 1
	sal	ah, cl
	sal	fooc, cl
	sal	ax, cl
	sal	foos, cl
	sal	eax, cl
	sal	fooi, cl
	sar	ah, 1
	sar	fooc, 1
	sar	ax, 1
	sar	foos, 1
	sar	eax, 1
	sar	fooi, 1
	sar	ah, cl
	sar	fooc, cl
	sar	ax, cl
	sar	foos, cl
	sar	eax, cl
	sar	fooi, cl
	sbb	ah, ah
	sbb	fooc, ah
	sbb	ah, 1
	sbb	fooc, 1
	sbb	ax, ax
	sbb	foos, ax
	sbb	ax, 1
	sbb	foos, 1
	sbb	eax, eax
	sbb	fooi, eax
	sbb	eax, 1
	sbb	fooi, 1
	sbb	ah, fooc
	sbb	ax, foos
	sbb	eax, fooi
	scas	fooc
	scas	foos
	scas	fooi
	seta	ah
	seta	fool
	setae	ah
	setae	fool
	setb	ah
	setb	fool
	setbe	ah
	setbe	fool
	setc	ah
	setc	fool
	sete	ah
	sete	fool
	setg	ah
	setg	fool
	setge	ah
	setge	fool
	setl	ah
	setl	fool
	setle	ah
	setle	fool
	setna	ah
	setna	fool
	setnae	ah
	setnae	fool
	setnb	ah
	setnb	fool
	setnbe	ah
	setnbe	fool
	setnc	ah
	setnc	fool
	setne	ah
	setne	fool
	setng	ah
	setng	fool
	setnge	ah
	setnge	fool
	setnl	ah
	setnl	fool
	setnle	ah
	setnle	fool
	setno	ah
	setno	fool
	setnp	ah
	setnp	fool
	setns	ah
	setns	fool
	setnz	ah
	setnz	fool
	seto	ah
	seto	fool
	setp	ah
	setp	fool
	setpe	ah
	setpe	fool
	setpo	ah
	setpo	fool
	sets	ah
	sets	fool
	setz	ah
	setz	fool
	sgdt	fool
	shl	ah, 1
	shl	fooc, 1
	shl	ax, 1
	shl	foos, 1
	shl	eax, 1
	shl	fooi, 1
	shl	ah, cl
	shl	fooc, cl
	shl	ax, cl
	shl	foos, cl
	shl	eax, cl
	shl	fooi, cl
	shld	ax, ax, 4
	shld	foos, ax, 4
	shld	eax, eax, 4
	shld	fooi, eax, 4
	shr	ah, 1
	shr	fooc, 1
	shr	ax, 1
	shr	foos, 1
	shr	eax, 1
	shr	fooi, 1
	shr	ah, cl
	shr	fooc, cl
	shr	ax, cl
	shr	foos, cl
	shr	eax, cl
	shr	fooi, cl
	shrd	ax, ax, 4
	shrd	foos, ax, 4
	shrd	eax, eax, 4
	shrd	fooi, eax, 4
	shufpd	xmm0, xmm0, 4
	shufpd	xmm0, fool, 4
	shufps	xmm0, xmm0, 4
	shufps	xmm0, fool, 4
	sidt	fool
	sldt	ax
	sldt	fool
	smsw	ax
	smsw	fool
	sqrtpd	xmm0, xmm0
	sqrtpd	xmm0, fool
	sqrtps	xmm0, xmm0
	sqrtps	xmm0, fool
	sqrtsd	xmm0, xmm0
	sqrtsd	xmm0, fool
	sqrtss	xmm0, xmm0
	sqrtss	xmm0, fool
	stmxcsr	fool
	stos	fool
	str	ax
	str	fool
	sub	eax, 1
	sub	fool, 1
	sub	eax, eax
	sub	fool, eax
	sub	eax, fool
	subpd	xmm0, xmm0
	subpd	xmm0, fool
	subps	xmm0, xmm0
	subps	xmm0, fool
	subsd	xmm0, xmm0
	subsd	xmm0, fool
	subss	xmm0, xmm0
	subss	xmm0, fool
	test	eax, eax
	test	ah, 1
	test	fooc, 1
	test	ax, 1
	test	foos, 1
	test	eax, 1
	test	fooi, 1
	ucomisd	xmm0, xmm0
	ucomisd	xmm0, fool
	ucomiss	xmm0, xmm0
	ucomiss	xmm0, fool
	unpckhpd	xmm0, xmm0
	unpckhpd	xmm0, fool
	unpckhps	xmm0, xmm0
	unpckhps	xmm0, fool
	unpcklpd	xmm0, xmm0
	unpcklpd	xmm0, fool
	unpcklps	xmm0, xmm0
	unpcklps	xmm0, fool
	verr	ax
	verr	foos
	verw	ax
	verw	foos
	xadd	ah, ah
	xadd	fooc, ah
	xadd	ax, ax
	xadd	foos, ax
	xadd	eax, eax
	xadd	fooi, eax
	xchg	eax, eax
	xchg	fool, eax
	xchg	eax, fool
	xlat	fool
	xor	eax, eax
	xor	fool, eax
	xor	eax, 1
	xor	fool, 1
	xor	eax, fool
	xorpd	xmm0, xmm0
	xorpd	xmm0, fool
	xorps	xmm0, xmm0
	xorps	xmm0, fool
}
int runEppTestChangePoll(EppParser & parser)
{
	// tests on helper classes define as part of ChangePollExtension implementation
	{
		//EppReason test
		EppReason* r = new EppReason();
		r->setReason("test reason");
		r->setLanguage("en-US");
		cout<<endl <<"EppReason=" << r->toString();
		delete r;
		
		//EppChangePollOperation test
		EppChangePollOperation* op = new EppChangePollOperation();
		op->setOperation("delete");
		op->setSubOperation("purge");
		cout<<endl <<"EppChangePollOperation=" << op->toString();
		delete op;
	}

	DOMNode* n;

	EppDomain domain("DOMAIN.BIZ");
	domain.setRoid("TESTROID-12345");
	EppStatus st(EppDomain::STATUS_OK);
	domain.addStatus(st);
	domain.setClientId("testID");
	EppResult result(EppError::CODE_NO_ERROR);
	EppValueReason reason0("TestValue0", "TestReason0", "en-US");
	EppValueReason reason4("Value4");
	result.addValue(reason0);
	result.addValue("Value1");
	result.addValue("Value2");
	result.addValue("Value3");
	result.addValue(reason4);
	EppTransactionId trid("CLIENT-XID", "SERVER-ID");
	EppResponse rsp;
	rsp.addResult(result);
	rsp.setTransactionId(trid);

	EppResponseDataInfo infData(&domain);
	rsp.setResponseData(&infData);
	EppChangePollExt* ext = new EppChangePollExt();
	ext->setState("after");
	EppChangePollOperation *operation = new EppChangePollOperation();
	operation->setOperation("delete");
	operation->setSubOperation("purge");
	ext->setOperation(operation);
	ext->setWho("you");
	ext->setDate(time_t(0) + (30* 3600 * 24));
	ext->setSvTRID("x1y2z3");
	ext->setReason(new EppReason("Example-Reason-EN", "en-US"));

	rsp.addExtension(ext);

	DOMString orig = rsp.toString();

	parser.parse(orig);
	n = parser.getRootNode();
	EppResponse * newRsp = EppResponse::fromXML(*n);

	DOMString again = newRsp->toString();

	if ( orig.equals(again) )
	{
		std::cout<<endl
			 <<"Original=" <<endl<<orig<<endl
			 <<"PASSED: "  <<__FILE__<<endl;
	}
	else
	{
		std::cout<<endl
			 <<"Original=" <<endl<<orig<<endl
			 <<"Again="    <<endl<<again<<endl
		  	 <<"FAILED : " <<__FILE__<<endl;
	}
	delete newRsp;

	return 0;
}
Esempio n. 22
0
static void forte_fill_call_trace_given_top(JavaThread* thd,
                                            ASGCT_CallTrace* trace,
                                            int depth,
                                            frame top_frame) {
  NoHandleMark nhm;

  frame initial_Java_frame;
  methodOop method;
  int bci;
  int count;

  count = 0;
  assert(trace->frames != NULL, "trace->frames must be non-NULL");

  bool fully_decipherable = find_initial_Java_frame(thd, &top_frame, &initial_Java_frame, &method, &bci);

  // The frame might not be walkable but still recovered a method
  // (e.g. an nmethod with no scope info for the pc

  if (method == NULL) return;

  CollectedHeap* ch = Universe::heap();

  // The method is not stored GC safe so see if GC became active
  // after we entered AsyncGetCallTrace() and before we try to
  // use the methodOop.
  // Yes, there is still a window after this check and before
  // we use methodOop below, but we can't lock out GC so that
  // has to be an acceptable risk.
  if (!ch->is_valid_method(method)) {
    trace->num_frames = ticks_GC_active; // -2
    return;
  }

  // We got a Java frame however it isn't fully decipherable
  // so it won't necessarily be safe to use it for the
  // initial frame in the vframe stream.

  if (!fully_decipherable) {
    // Take whatever method the top-frame decoder managed to scrape up.
    // We look further at the top frame only if non-safepoint
    // debugging information is available.
    count++;
    trace->num_frames = count;
    trace->frames[0].method_id = method->find_jmethod_id_or_null();
    if (!method->is_native()) {
      trace->frames[0].lineno = bci;
    } else {
      trace->frames[0].lineno = -3;
    }

    if (!initial_Java_frame.safe_for_sender(thd)) return;

    RegisterMap map(thd, false);
    initial_Java_frame = initial_Java_frame.sender(&map);
  }

  vframeStreamForte st(thd, initial_Java_frame, false);

  for (; !st.at_end() && count < depth; st.forte_next(), count++) {
    bci = st.bci();
    method = st.method();

    // The method is not stored GC safe so see if GC became active
    // after we entered AsyncGetCallTrace() and before we try to
    // use the methodOop.
    // Yes, there is still a window after this check and before
    // we use methodOop below, but we can't lock out GC so that
    // has to be an acceptable risk.
    if (!ch->is_valid_method(method)) {
      // we throw away everything we've gathered in this sample since
      // none of it is safe
      trace->num_frames = ticks_GC_active; // -2
      return;
    }

    trace->frames[count].method_id = method->find_jmethod_id_or_null();
    if (!method->is_native()) {
      trace->frames[count].lineno = bci;
    } else {
      trace->frames[count].lineno = -3;
    }
  }
  trace->num_frames = count;
  return;
}
Esempio n. 23
0
/* Subtract b from a.  (a-b) -> dest
 bbd: arg2 used to be int type, but sometimes pointers were forced
 in with typecasts.  On Alphas pointers are 64 bits and ints are 32,
 so when rm was cast back to a pointer...SEGFAULT.  Pass the pointers
 around instead, since they are always larger precision than the
 register numbers. */
int FPU_sub(int flags, FPU_REG *rm, u16 control_w)
{
  FPU_REG const *a, *b;
  FPU_REG *dest;
  u_char taga, tagb, signa, signb, saved_sign, sign;
  int diff, tag, expa, expb, deststnr;

  a = &st(0);
  taga = FPU_gettag0();

  deststnr = 0;
  if ( flags & LOADED )
    {
      b = rm;
      tagb = flags & 0x0f;
    }
  else
    {
      int rmint = PTR2INT(rm);
      b = &st(rmint);
      tagb = FPU_gettagi(rmint);

      if ( flags & DEST_RM )
	deststnr = rmint;
    }

  signa = getsign(a);
  signb = getsign(b);

  if ( flags & REV )
    {
      signa ^= SIGN_NEG;
      signb ^= SIGN_NEG;
    }

  dest = &st(deststnr);
  saved_sign = getsign(dest);

  if ( !(taga | tagb) )
    {
      expa = exponent(a);
      expb = exponent(b);

    valid_subtract:
      /* Both registers are valid */

      diff = expa - expb;

      if (!diff)
	{
	  diff = a->sigh - b->sigh;  /* Works only if ms bits are identical */
	  if (!diff)
	    {
	      diff = a->sigl > b->sigl;
	      if (!diff)
		diff = -(a->sigl < b->sigl);
	    }
	}

      switch ( (((int)signa)*2 + signb) / SIGN_NEG )
	{
	case 0: /* P - P */
	case 3: /* N - N */
	  if (diff > 0)
	    {
	      /* |a| > |b| */
	      tag = FPU_u_sub(a, b, dest, control_w, signa, expa, expb);
	    }
	  else if ( diff == 0 )
	    {
	      FPU_copy_to_regi(&CONST_Z, TAG_Zero, deststnr);

	      /* sign depends upon rounding mode */
	      setsign(dest, ((control_w & CW_RC) != RC_DOWN)
		? SIGN_POS : SIGN_NEG);
	      return TAG_Zero;
	    }
	  else
	    {
	      sign = signa ^ SIGN_NEG;
	      tag = FPU_u_sub(b, a, dest, control_w, sign, expb, expa);
	    }
	  break;
	case 1: /* P - N */
	  tag = FPU_u_add(a, b, dest, control_w, SIGN_POS, expa, expb);
	  break;
	case 2: /* N - P */
	  tag = FPU_u_add(a, b, dest, control_w, SIGN_NEG, expa, expb);
	  break;
#ifdef PARANOID
	default:
	  EXCEPTION(EX_INTERNAL|0x111);
	  return -1;
#endif
	}
      if ( tag < 0 )
	{
	  setsign(dest, saved_sign);
	  return tag;
	}
      FPU_settagi(deststnr, tag);
      return tag;
    }

  if ( taga == TAG_Special )
    taga = FPU_Special(a);
  if ( tagb == TAG_Special )
    tagb = FPU_Special(b);

  if ( ((taga == TAG_Valid) && (tagb == TW_Denormal))
	    || ((taga == TW_Denormal) && (tagb == TAG_Valid))
	    || ((taga == TW_Denormal) && (tagb == TW_Denormal)) )
    {
      FPU_REG x, y;

      if ( denormal_operand() < 0 )
	return FPU_Exception;

      FPU_to_exp16(a, &x);
      FPU_to_exp16(b, &y);
      a = &x;
      b = &y;
      expa = exponent16(a);
      expb = exponent16(b);

      goto valid_subtract;
    }

  if ( (taga == TW_NaN) || (tagb == TW_NaN) )
    {
      FPU_REG const *d1, *d2;
      if ( flags & REV )
	{
	  d1 = b;
	  d2 = a;
	}
      else
	{
	  d1 = a;
	  d2 = b;
	}
      if ( flags & LOADED )
	return real_2op_NaN(b, tagb, deststnr, d1);
      if ( flags & DEST_RM )
	return real_2op_NaN(a, taga, deststnr, d2);
      else
	return real_2op_NaN(b, tagb, deststnr, d2);
    }

    return add_sub_specials(a, taga, signa, b, tagb, signb ^ SIGN_NEG,
			    dest, deststnr, control_w);
}
void
MSRouteHandler::myStartElement(SumoXMLTag element,
                               const SUMOSAXAttributes &attrs) throw(ProcessError) {
    switch (element) {
    case SUMO_TAG_VEHICLE:
        delete myVehicleParameter;
        myVehicleParameter = SUMOVehicleParserHelper::parseVehicleAttributes(attrs);
        break;
    case SUMO_TAG_PERSON:
        delete myVehicleParameter;
        myVehicleParameter = SUMOVehicleParserHelper::parseVehicleAttributes(attrs);
        myActivePlan = new MSPerson::MSPersonPlan();
        break;
    case SUMO_TAG_RIDE: {
        const std::string pid = myVehicleParameter->id;
        bool ok = true;
        MSEdge *from = 0;
        if (attrs.hasAttribute(SUMO_ATTR_FROM)) {
            const std::string fromID = attrs.getStringReporting(SUMO_ATTR_FROM, "ride", pid.c_str(), ok);
            from = MSEdge::dictionary(fromID);
            if (from==0) {
                throw ProcessError("The from edge '" + fromID + "' within a ride of person '" + pid + "' is not known.");
            }
            if (myActivePlan->empty() || &myActivePlan->back()->getDestination() != from) {
                myActivePlan->push_back(new MSPerson::MSPersonStage_Waiting(*from, -1, myVehicleParameter->depart));
            }
        }
        const std::string toID = attrs.getStringReporting(SUMO_ATTR_TO, "ride", pid.c_str(), ok);
        MSEdge *to = MSEdge::dictionary(toID);
        if (to==0) {
            throw ProcessError("The to edge '" + toID + "' within a ride of person '" + pid + "' is not known.");
        }
        const std::string desc = attrs.getStringReporting(SUMO_ATTR_LINES, "ride", pid.c_str(), ok);
        StringTokenizer st(desc);
        myActivePlan->push_back(new MSPerson::MSPersonStage_Driving(*to, st.getVector()));
        break;
    }
    case SUMO_TAG_WALK: {
        myActiveRoute.clear();
        bool ok = true;
        MSEdge::parseEdgesList(attrs.getStringReporting(SUMO_ATTR_EDGES, "walk", myVehicleParameter->id.c_str(), ok), myActiveRoute, myActiveRouteID);
        if (myActiveRoute.empty()) {
            throw ProcessError("No edges to walk for person '" + myVehicleParameter->id + "'.");
        }
        if (myActivePlan->empty() || &myActivePlan->back()->getDestination() != myActiveRoute.front()) {
            myActivePlan->push_back(new MSPerson::MSPersonStage_Waiting(*myActiveRoute.front(), -1, myVehicleParameter->depart));
        }
        const SUMOTime duration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_DURATION, "walk", 0, ok, -1);
        const SUMOReal speed = attrs.getOptSUMORealReporting(SUMO_ATTR_SPEED, "walk", 0, ok, -1);
        myActivePlan->push_back(new MSPerson::MSPersonStage_Walking(myActiveRoute, duration, speed));
        myActiveRoute.clear();
        break;
    }
    case SUMO_TAG_FLOW:
        delete myVehicleParameter;
        myVehicleParameter = SUMOVehicleParserHelper::parseFlowAttributes(attrs);
        if (attrs.hasAttribute(SUMO_ATTR_FROM) && attrs.hasAttribute(SUMO_ATTR_TO)) {
            myActiveRouteID = "!" + myVehicleParameter->id;
            bool ok = true;
            MSEdge::parseEdgesList(attrs.getStringReporting(SUMO_ATTR_FROM, "flow", myVehicleParameter->id.c_str(), ok), myActiveRoute, myActiveRouteID);
            MSEdge::parseEdgesList(attrs.getStringReporting(SUMO_ATTR_TO, "flow", myVehicleParameter->id.c_str(), ok), myActiveRoute, myActiveRouteID);
            closeRoute();
        }
        break;
    case SUMO_TAG_VTYPE:
        myCurrentVType = SUMOVehicleParserHelper::beginVTypeParsing(attrs);
        break;
    case SUMO_TAG_VTYPE_DISTRIBUTION:
        openVehicleTypeDistribution(attrs);
        break;
    case SUMO_TAG_ROUTE:
        openRoute(attrs);
        break;
    case SUMO_TAG_ROUTE_DISTRIBUTION:
        openRouteDistribution(attrs);
        break;
    case SUMO_TAG_TRIPDEF: {
        bool ok = true;
        myVehicleParameter = SUMOVehicleParserHelper::parseVehicleAttributes(attrs);
        myActiveRouteID = "!" + myVehicleParameter->id;
        if (attrs.hasAttribute(SUMO_ATTR_FROM) || !myVehicleParameter->wasSet(VEHPARS_TAZ_SET)) {
            MSEdge::parseEdgesList(attrs.getStringReporting(SUMO_ATTR_FROM, "tripdef", myVehicleParameter->id.c_str(), ok), myActiveRoute, myActiveRouteID);
            MSEdge::parseEdgesList(attrs.getStringReporting(SUMO_ATTR_TO, "tripdef", myVehicleParameter->id.c_str(), ok), myActiveRoute, myActiveRouteID);
        } else {
            const MSEdge* fromTaz = MSEdge::dictionary(myVehicleParameter->fromTaz+"-source");
            if (fromTaz == 0) {
                WRITE_ERROR("Source district '" + myVehicleParameter->fromTaz + "' not known for '" + myVehicleParameter->id + "'!");
            } else if (fromTaz->getNoFollowing() == 0) {
                WRITE_ERROR("Source district '" + myVehicleParameter->fromTaz + "' has no outgoing edges for '" + myVehicleParameter->id + "'!");
            } else {
                myActiveRoute.push_back(fromTaz->getFollower(0));
            }
        }
        closeRoute();
        closeVehicle();
    }
    break;
    default:
        break;
    }
    // parse embedded vtype information
    if (myCurrentVType!=0&&element!=SUMO_TAG_VTYPE) {
        SUMOVehicleParserHelper::parseVTypeEmbedded(*myCurrentVType, element, attrs);
        return;
    }

    if (element==SUMO_TAG_STOP) {
        bool ok = true;
        SUMOVehicleParameter::Stop stop;
        // try to parse the assigne bus stop
        stop.busstop = attrs.getOptStringReporting(SUMO_ATTR_BUS_STOP, "stop", 0, ok, "");
        if (stop.busstop!="") {
            // ok, we have obviously a bus stop
            MSBusStop *bs = MSNet::getInstance()->getBusStop(stop.busstop);
            if (bs!=0) {
                const MSLane &l = bs->getLane();
                stop.lane = l.getID();
                stop.pos = bs->getEndLanePosition();
            } else {
                MsgHandler::getErrorInstance()->inform("The bus stop '" + stop.busstop + "' is not known.");
                return;
            }
        } else {
            // no, the lane and the position should be given
            // get the lane
            stop.lane = attrs.getOptStringReporting(SUMO_ATTR_LANE, "stop", 0, ok, "");
            if (stop.lane!="") {
                if (MSLane::dictionary(stop.lane)==0) {
                    MsgHandler::getErrorInstance()->inform("The lane '" + stop.lane + "' for a stop is not known.");
                    return;
                }
            } else {
                MsgHandler::getErrorInstance()->inform("A stop must be placed on a bus stop or a lane.");
                return;
            }
            // get the position
            bool ok = true;
            stop.pos = attrs.getSUMORealReporting(SUMO_ATTR_POSITION, "stop", 0, ok);
            if (!ok) {
                return;
            }
        }

        // get the standing duration
        if (!attrs.hasAttribute(SUMO_ATTR_DURATION) && !attrs.hasAttribute(SUMO_ATTR_UNTIL)) {
            MsgHandler::getErrorInstance()->inform("The duration of a stop is not defined.");
            return;
        } else {
            bool ok = true;
            stop.duration = attrs.getOptSUMOTimeReporting(SUMO_ATTR_DURATION, "stop", 0, ok, -1);
            stop.until = attrs.getOptSUMOTimeReporting(SUMO_ATTR_UNTIL, "stop", 0, ok, -1);
            if (!ok) {
                return;
            }
            if (stop.duration<0&&stop.until<0) {
                MsgHandler::getErrorInstance()->inform("Neither the duration nor the end time is given for a stop.");
                return;
            }
        }
        if (myActiveRouteID != "") {
            myActiveRouteStops.push_back(stop);
        } else {
            myVehicleParameter->stops.push_back(stop);
        }
    }
}
Esempio n. 25
0
void Plugin::handleAdd(const std::string& name, const std::string& value)
{
    addFile(value);
    return;
    LogStream lstr(Application::instance().logger());
    lstr.information() << "Checking path" << std::endl;
    if (!hasGitDirectory()) 
    {
        lstr.error() << "This is not a git repository" << std::endl;
        return;
    }    
    File f(value);
    if (!f.exists())
    {
        lstr.error() << value << " file does not exist" << std::endl;
        // TODO: Remove this file from index
        return;
    }
    bool isGitable = true;
    if (f.isDirectory())
    {
        lstr.information() << "Can't add directory" << std::endl;
        return;
        // We need to process every that is not tracked
    }
    if (f.isDevice())
    {
        isGitable = false; 
    }
    if (f.isLink())
    {
        isGitable = false;
    }
    Poco::Pipe out, err;
    Process::Args args;
    args.push_back("status");
    args.push_back(value);
    args.push_back("-s");
    Poco::ProcessHandle* git = new Poco::ProcessHandle(Poco::Process::launch("git", args, 0, &out, &err));
    PipeInputStream str(out);
    std::string output;
    Poco::StreamCopier::copyToString(str, output);
    StringTokenizer st(output, " ");
    output = trim(output);
    for (auto it = st.begin(); it != st.end(); it++)
    {
        if ((*it).empty())
        {
            continue;
        }
        if ((*it) == "M")
        {
            std::cout << "Modified" << std::endl;
            replaceWithLink(value);
            // Check if file is already in index - we may want to to update binary file 
        }
        else if ((*it) == "??")
        {
            std::cout << "Not indexed" << std::endl;
            replaceWithLink(value);
        }
        else
        {
            std::cout << (*it).c_str() << std::endl;
        }
    }
}
Esempio n. 26
0
    DeckItem ParserItemScan(const ParserItemType * self, RawRecord& rawRecord ) {
        auto deckItem = DeckItem::make< ValueType >( self->name(), rawRecord.size() );

        if (self->sizeType() == ALL) {
            while (rawRecord.size() > 0) {
                auto token = rawRecord.pop_front();

                std::string countString;
                std::string valueString;
                if (isStarToken(token, countString, valueString)) {
                    StarToken st(token, countString, valueString);
                    ValueType value;

                    if (st.hasValue()) {
                        value = readValueToken<ValueType>(st.valueString());
                        deckItem.push_back( value , st.count());
                    } else {
                        value = self->getDefault();
                        for (size_t i=0; i < st.count(); i++)
                            deckItem.push_backDefault( value );
                    }
                } else {
                    deckItem.push_back( readValueToken<ValueType>( token ) );
                }
            }
        } else {
            if (rawRecord.size() == 0) {
                // if the record was ended prematurely,
                if (self->hasDefault()) {
                    // use the default value for the item, if there is one...
                    deckItem.push_backDefault( self->getDefault() );
                } else {
                    // ... otherwise indicate that the deck item should throw once the
                    // item's data is accessed.
                    deckItem.push_backDummyDefault();
                }
            } else {
                // The '*' should be interpreted as a repetition indicator, but it must
                // be preceeded by an integer...
                auto token = rawRecord.pop_front();
                std::string countString;
                std::string valueString;
                if (isStarToken(token, countString, valueString)) {
                    StarToken st(token, countString, valueString);

                    if (!st.hasValue()) {
                        if (self->hasDefault())
                            deckItem.push_backDefault( self->getDefault() );
                        else
                            deckItem.push_backDummyDefault();
                    } else
                        deckItem.push_back(readValueToken<ValueType>(st.valueString()));

                    const auto value_start = token.size() - valueString.size();
                    // replace the first occurence of "N*FOO" by a sequence of N-1 times
                    // "FOO". this is slightly hacky, but it makes it work if the
                    // number of defaults pass item boundaries...
                    // We can safely make a string_view of one_star because it
                    // has static storage
                    static const char* one_star = "1*";
                    string_view rep = !st.hasValue()
                                    ? string_view{ one_star }
                                    : string_view{ token.begin() + value_start, token.end() };

                    rawRecord.prepend( st.count() - 1, rep );
                } else {
                    deckItem.push_back( readValueToken<ValueType>( token ) );
                }
            }
        }

        return deckItem;
    }
static int compare(FPU_REG const *b, int tagb)
{
	int diff, exp0, expb;
	u_char st0_tag;
	FPU_REG *st0_ptr;
	FPU_REG x, y;
	u_char st0_sign, signb = getsign(b);

	st0_ptr = &st(0);
	st0_tag = FPU_gettag0();
	st0_sign = getsign(st0_ptr);

	if (tagb == TAG_Special)
		tagb = FPU_Special(b);
	if (st0_tag == TAG_Special)
		st0_tag = FPU_Special(st0_ptr);

	if (((st0_tag != TAG_Valid) && (st0_tag != TW_Denormal))
	    || ((tagb != TAG_Valid) && (tagb != TW_Denormal))) {
		if (st0_tag == TAG_Zero) {
			if (tagb == TAG_Zero)
				return COMP_A_eq_B;
			if (tagb == TAG_Valid)
				return ((signb ==
					 SIGN_POS) ? COMP_A_lt_B : COMP_A_gt_B);
			if (tagb == TW_Denormal)
				return ((signb ==
					 SIGN_POS) ? COMP_A_lt_B : COMP_A_gt_B)
				    | COMP_Denormal;
		} else if (tagb == TAG_Zero) {
			if (st0_tag == TAG_Valid)
				return ((st0_sign ==
					 SIGN_POS) ? COMP_A_gt_B : COMP_A_lt_B);
			if (st0_tag == TW_Denormal)
				return ((st0_sign ==
					 SIGN_POS) ? COMP_A_gt_B : COMP_A_lt_B)
				    | COMP_Denormal;
		}

		if (st0_tag == TW_Infinity) {
			if ((tagb == TAG_Valid) || (tagb == TAG_Zero))
				return ((st0_sign ==
					 SIGN_POS) ? COMP_A_gt_B : COMP_A_lt_B);
			else if (tagb == TW_Denormal)
				return ((st0_sign ==
					 SIGN_POS) ? COMP_A_gt_B : COMP_A_lt_B)
				    | COMP_Denormal;
			else if (tagb == TW_Infinity) {
				/*                                                   */
				return (st0_sign == signb) ? COMP_A_eq_B :
				    ((st0_sign ==
				      SIGN_POS) ? COMP_A_gt_B : COMP_A_lt_B);
			}
			/*                              */
		} else if (tagb == TW_Infinity) {
			if ((st0_tag == TAG_Valid) || (st0_tag == TAG_Zero))
				return ((signb ==
					 SIGN_POS) ? COMP_A_lt_B : COMP_A_gt_B);
			if (st0_tag == TW_Denormal)
				return ((signb ==
					 SIGN_POS) ? COMP_A_lt_B : COMP_A_gt_B)
				    | COMP_Denormal;
			/*                              */
		}

		/*                                                             
              */
		if ((st0_tag == TW_NaN) || (tagb == TW_NaN)) {
			int signalling = 0, unsupported = 0;
			if (st0_tag == TW_NaN) {
				signalling =
				    (st0_ptr->sigh & 0xc0000000) == 0x80000000;
				unsupported = !((exponent(st0_ptr) == EXP_OVER)
						&& (st0_ptr->
						    sigh & 0x80000000));
			}
			if (tagb == TW_NaN) {
				signalling |=
				    (b->sigh & 0xc0000000) == 0x80000000;
				unsupported |= !((exponent(b) == EXP_OVER)
						 && (b->sigh & 0x80000000));
			}
			if (signalling || unsupported)
				return COMP_No_Comp | COMP_SNaN | COMP_NaN;
			else
				/*                            */
				return COMP_No_Comp | COMP_NaN;
		}

		EXCEPTION(EX_Invalid);
	}

	if (st0_sign != signb) {
		return ((st0_sign == SIGN_POS) ? COMP_A_gt_B : COMP_A_lt_B)
		    | (((st0_tag == TW_Denormal) || (tagb == TW_Denormal)) ?
		       COMP_Denormal : 0);
	}

	if ((st0_tag == TW_Denormal) || (tagb == TW_Denormal)) {
		FPU_to_exp16(st0_ptr, &x);
		FPU_to_exp16(b, &y);
		st0_ptr = &x;
		b = &y;
		exp0 = exponent16(st0_ptr);
		expb = exponent16(b);
	} else {
		exp0 = exponent(st0_ptr);
		expb = exponent(b);
	}

#ifdef PARANOID
	if (!(st0_ptr->sigh & 0x80000000))
		EXCEPTION(EX_Invalid);
	if (!(b->sigh & 0x80000000))
		EXCEPTION(EX_Invalid);
#endif /*          */

	diff = exp0 - expb;
	if (diff == 0) {
		diff = st0_ptr->sigh - b->sigh;	/*                          
                   */
		if (diff == 0) {
			diff = st0_ptr->sigl > b->sigl;
			if (diff == 0)
				diff = -(st0_ptr->sigl < b->sigl);
		}
	}

	if (diff > 0) {
		return ((st0_sign == SIGN_POS) ? COMP_A_gt_B : COMP_A_lt_B)
		    | (((st0_tag == TW_Denormal) || (tagb == TW_Denormal)) ?
		       COMP_Denormal : 0);
	}
	if (diff < 0) {
		return ((st0_sign == SIGN_POS) ? COMP_A_lt_B : COMP_A_gt_B)
		    | (((st0_tag == TW_Denormal) || (tagb == TW_Denormal)) ?
		       COMP_Denormal : 0);
	}

	return COMP_A_eq_B
	    | (((st0_tag == TW_Denormal) || (tagb == TW_Denormal)) ?
	       COMP_Denormal : 0);

}
Esempio n. 28
0
#if USE_ASSEMBLER_CODE
		int argb;

		_asm {
			fld		float_cheat

			mov		esi, dword ptr [colors]
			mov		eax, offset0
			shl		eax, 4
			add		esi, eax

			fld		dword ptr [esi + 0Ch]

			mov		ecx, dword ptr [esi + 0Ch]

			fadd	st, st(1)

			rcl		ecx, 1
			sbb		eax, eax
			xor		eax, -1

			fstp	f
			xor		ecx, ecx

			mov		ebx, f
			and		ebx, eax

			test	ebx, 0000ff00h

			seta	cl
Esempio n. 29
0
void about::Populate( void )
{

    wxColor bg = GetBackgroundColour();
    wxColor fg = wxColour( 0, 0, 0 );

    // The HTML Header
    wxString aboutText =
        wxString::Format(
            _T( "<html><body bgcolor=#%02x%02x%02x><font color=#%02x%02x%02x>" ),
            bg.Red(), bg.Blue(), bg.Green(), fg.Red(), fg.Blue(), fg.Green() );

    wxFont *dFont = FontMgr::Get().GetFont( _("Dialog") );

    // Do weird font size calculation
    int points = dFont->GetPointSize();
#ifndef __WXOSX__
    ++points;
#endif
    int sizes[7];
    for ( int i = -2; i < 5; i++ ) {
        sizes[i+2] = points + i + ( i > 0 ? i : 0 );
    }
    wxString face = dFont->GetFaceName();
    pAboutHTMLCtl->SetFonts( face, face, sizes );

    if( wxFONTSTYLE_ITALIC == dFont->GetStyle() )
        aboutText.Append( _T("<i>") );

#ifdef __OCPN__ANDROID__    
    aboutText.Append( AboutText + Komodo Exercise 2016VersionAndroid  + Komodo Exercise 2016InfoAlt );
#else
    aboutText.Append( AboutText + OpenCPNVersion + OpenCPNInfo );
#endif    

    // Show where the log file is going to be placed
    wxString log_string = _T("Logfile location: ") + g_Platform->GetLogFileName();
    log_string.Replace(_T("/"), _T("/ "));      // allow line breaks, in a cheap way...
    
    aboutText.Append( log_string );

    // Show where the config file is going to be placed
    wxString config_string = _T("<br><br>Config file location: ") + g_Platform->GetConfigFileName();
    config_string.Replace(_T("/"), _T("/ "));      // allow line breaks, in a cheap way...
    aboutText.Append( config_string );
    
    if(wxFONTSTYLE_ITALIC == dFont->GetStyle())
        aboutText.Append( _T("</i>") );

    // The HTML Footer
    aboutText.Append( _T("</font></body></html>") );

    pAboutHTMLCtl->SetPage( aboutText );
    
    
    ///Authors page
    // The HTML Header
    wxString authorText =
    wxString::Format(
        _T( "<html><body bgcolor=#%02x%02x%02x><font color=#%02x%02x%02x>" ),
                     bg.Red(), bg.Blue(), bg.Green(), fg.Red(), fg.Blue(), fg.Green() );
    
    pAuthorHTMLCtl->SetFonts( face, face, sizes );
    
    
    wxString authorFixText = AuthorText;
    authorFixText.Replace(_T("\n"), _T("<br>"));
    authorText.Append( authorFixText );
    
    // The HTML Footer
    authorText.Append( _T("</font></body></html>") );

    pAuthorHTMLCtl->SetPage( authorFixText );
    

    ///License page
    // The HTML Header
    wxString licenseText =
    wxString::Format(
        _T( "<html><body bgcolor=#%02x%02x%02x><font color=#%02x%02x%02x>" ),
            bg.Red(), bg.Blue(), bg.Green(), fg.Red(), fg.Blue(), fg.Green() );
        
    pLicenseHTMLCtl->SetFonts( face, face, sizes );
 
    wxTextFile license_filea( m_DataLocn + _T("license.txt") );
    if ( license_filea.Open() ) {
        for ( wxString str = license_filea.GetFirstLine(); !license_filea.Eof() ; str = license_filea.GetNextLine() )
            licenseText.Append( str + _T("<br>") );
        license_filea.Close();
    } else {
        wxLogMessage( _T("Could not open License file: ") + m_DataLocn );
    }
    
    wxString suppLicense = g_Platform->GetSupplementalLicenseString();
    
    wxStringTokenizer st(suppLicense, _T("\n"), wxTOKEN_DEFAULT);
    while( st.HasMoreTokens() )
    {
        wxString s1 = st.GetNextToken();
        licenseText.Append( s1 + _T("<br>") );
    }
        
        // The HTML Footer
    licenseText.Append( _T("</font></body></html>") );
        
    pLicenseHTMLCtl->SetPage( licenseText );
        
        
#if 0    
    wxTextFile license_file( m_DataLocn + _T("license.txt") );
    if ( license_file.Open() ) {
        for ( wxString str = license_file.GetFirstLine(); !license_file.Eof() ; str = license_file.GetNextLine() )
            pLicenseTextCtl->AppendText( str + '\n' );
        license_file.Close();
    } else {
        wxLogMessage( _T("Could not open License file: ") + m_DataLocn );
    }
    
    wxString suppLicense = g_Platform->GetSupplementalLicenseString();
    pLicenseTextCtl->AppendText( suppLicense );
    
    pLicenseTextCtl->SetInsertionPoint( 0 );
#endif

    SetColorScheme();
}
Esempio n. 30
0
int encode_op(char *opcode, char *op_data)
{
	int rd,rs,rt,imm,funct,shaft,target;
	char tmp[256];
	const char *fi = "%s %d";
	const char *fg = "%s %%g%d";
	const char *ff = "%s %%f%d";
	const char *fl = "%s %s";
	const char *fgi = "%s %%g%d, %d";
	const char *fgl = "%s %%g%d, %s";
	const char *fgg = "%s %%g%d, %%g%d";
	const char *fggl = "%s %%g%d, %%g%d, %s";
	const char *fggi = "%s %%g%d, %%g%d, %d";
	const char *fggg = "%s %%g%d, %%g%d, %%g%d";
	const char *fff = "%s %%f%d, %%f%d";
	const char *fgf = "%s %%g%d, %%f%d";
	const char *ffg = "%s %%f%d, %%g%d";
	const char *fffl = "%s %%f%d, %%f%d, %s";
	const char *ffff = "%s %%f%d, %%f%d, %%f%d";
	const char *ffgi = "%s %%f%d, %%g%d, %d";
	const char *ffgg = "%s %%f%d, %%g%d, %%g%d";
	char lname[256];

	shaft = funct = target = 0;

	if(strcmp(opcode, "mvhi") == 0){
		if(sscanf(op_data, fgi, tmp, &rs, &imm) == 3)
		    return mvhi(rs,0,imm);
	}
	if(strcmp(opcode, "mvlo") == 0){
		if(sscanf(op_data, fgi, tmp, &rs, &imm) == 3)
		    return mvlo(rs,0,imm);
	}
	if(strcmp(opcode, "add") == 0){
		if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4)
		    return add(rs,rt,rd,0);
	}
	if(strcmp(opcode, "nor") == 0){
		if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4)
		    return nor(rs,rt,rd,0);
	}
	if(strcmp(opcode, "sub") == 0){
		if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4)
		    return sub(rs,rt,rd,0);
	}
	if(strcmp(opcode, "mul") == 0){
		if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4)
		    return mul(rs,rt,rd,0);
	}
	if(strcmp(opcode, "addi") == 0){
		if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4)
		    return addi(rs,rt,imm);
	}
	if(strcmp(opcode, "subi") == 0){
		if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4)
		    return subi(rs,rt,imm);
	}
	if(strcmp(opcode, "muli") == 0){
		if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4)
		    return muli(rs,rt,imm);
	}
	if(strcmp(opcode, "input") == 0){
		if(sscanf(op_data, fg, tmp, &rd) == 2)
		    return input(0,0,rd,0);
	}
	if(strcmp(opcode, "inputw") == 0){
		if(sscanf(op_data, fg, tmp, &rd) == 2)
		    return inputw(0,0,rd,0);
	}
	if(strcmp(opcode, "inputf") == 0){
		if(sscanf(op_data, ff, tmp, &rd) == 2)
		    return inputf(0,0,rd,0);
	}
	if(strcmp(opcode, "output") == 0){
		if(sscanf(op_data, fg, tmp, &rs) == 2)
		    return output(rs,0,0,0);
	}
	if(strcmp(opcode, "outputw") == 0){
		if(sscanf(op_data, fg, tmp, &rs) == 2)
		    return outputw(rs,0,0,0);
	}
	if(strcmp(opcode, "outputf") == 0){
		if(sscanf(op_data, ff, tmp, &rs) == 2)
		    return outputf(rs,0,0,0);
	}
	if(strcmp(opcode, "and") == 0){
		if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4)
		    return _and(rs,rt,rd,0);
	}
	if(strcmp(opcode, "or") == 0){
		if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4)
		    return _or(rs,rt,rd,0);
	}
	if(strcmp(opcode, "sll") == 0){
		if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4)
		    return sll(rs,rt,rd,0);
	}
	if(strcmp(opcode, "srl") == 0){
		if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4)
		    return srl(rs,rt,rd,0);
	}
	if(strcmp(opcode, "slli") == 0){
		if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4)
		    return slli(rs,rt,imm);
	}
	if(strcmp(opcode, "srli") == 0){
		if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4)
		    return srli(rs,rt,imm);
	}
	if(strcmp(opcode, "b") == 0){
		if(sscanf(op_data, fg, tmp, &rs) == 2)
		    return b(rs,0,0,0);
	}
	if(strcmp(opcode, "jmp") == 0){
		if(sscanf(op_data, fl, tmp, lname) == 2) {
			strcpy(label_name[label_cnt],lname);
		    return jmp(label_cnt++);
		}
	}
	if(strcmp(opcode, "jeq") == 0){
		if(sscanf(op_data, fggl, tmp, &rs, &rt, lname) == 4) {
			strcpy(label_name[label_cnt],lname);
		    return jeq(rs,rt,label_cnt++);
		}
	}
	if(strcmp(opcode, "jne") == 0){
		if(sscanf(op_data, fggl, tmp, &rs, &rt, lname) == 4) {
			strcpy(label_name[label_cnt],lname);
		    return jne(rs,rt,label_cnt++);
		}
	}
	if(strcmp(opcode, "jlt") == 0){
		if(sscanf(op_data, fggl, tmp, &rs, &rt, lname) == 4) {
			strcpy(label_name[label_cnt],lname);
		    return jlt(rs,rt,label_cnt++);
		}
	}
	if(strcmp(opcode, "jle") == 0){
		if(sscanf(op_data, fggl, tmp, &rs, &rt, lname) == 4) {
			strcpy(label_name[label_cnt],lname);
		    return jle(rs,rt,label_cnt++);
		}
	}
	if(strcmp(opcode, "call") == 0){
		if(sscanf(op_data, fl, tmp, lname) == 2)  {
			strcpy(label_name[label_cnt],lname);
		    return call(label_cnt++);
		}
	}
	if(strcmp(opcode, "callR") == 0){
		if(sscanf(op_data, fg, tmp, &rs) == 2)
		    return callr(rs,0,0,0);
	}
	if(strcmp(opcode, "return") == 0){
		    return _return(0);
	}
	if(strcmp(opcode, "ld") == 0){
		if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4)
		    return ld(rs,rt,rd,0);
	}
	if(strcmp(opcode, "ldi") == 0){
		if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4)
		    return ldi(rs,rt,imm);
	}
	if(strcmp(opcode, "ldlr") == 0){
		if(sscanf(op_data, fgi, tmp, &rs, &imm) == 3)
		    return ldlr(rs,0,imm);
	}
	if(strcmp(opcode, "fld") == 0){
		if(sscanf(op_data, ffgg, tmp, &rd, &rs,&rt) == 4)
		    return fld(rs,rt,rd,0);
	}
	if(strcmp(opcode, "st") == 0){
		if(sscanf(op_data, fggg, tmp, &rd, &rs,&rt) == 4)
		    return st(rs,rt,rd,0);
	}
	if(strcmp(opcode, "sti") == 0){
		if(sscanf(op_data, fggi, tmp, &rt, &rs, &imm) == 4)
		    return sti(rs,rt,imm);
	}
	if(strcmp(opcode, "stlr") == 0){
		if(sscanf(op_data, fgi, tmp, &rs, &imm) == 3)
		    return stlr(rs,0,imm);
	}
	if(strcmp(opcode, "fst") == 0){
		if(sscanf(op_data, ffgg, tmp, &rd, &rs,&rt) == 4)
		    return fst(rs,rt,rd,0);
	}
	if(strcmp(opcode, "fadd") == 0){
		if(sscanf(op_data, ffff, tmp, &rd, &rs, &rt) == 4)
		    return fadd(rs,rt,rd,0);
	}
	if(strcmp(opcode, "fsub") == 0){
		if(sscanf(op_data, ffff, tmp, &rd, &rs, &rt) == 4)
		    return fsub(rs,rt,rd,0);
	}
	if(strcmp(opcode, "fmul") == 0){
		if(sscanf(op_data, ffff, tmp, &rd, &rs, &rt) == 4)
		    return fmul(rs,rt,rd,0);
	}
	if(strcmp(opcode, "fdiv") == 0){
		if(sscanf(op_data, ffff, tmp, &rd, &rs, &rt) == 4)
		    return fdiv(rs,rt,rd,0);
	}
	if(strcmp(opcode, "fsqrt") == 0){
		if(sscanf(op_data, fff, tmp, &rd, &rs) == 3)
		    return fsqrt(rs,0,rd,0);
	}
	if(strcmp(opcode, "fabs") == 0){
		if(sscanf(op_data, fff, tmp, &rd, &rs) == 3)
		    return _fabs(rs,0,rd,0);
	}
	if(strcmp(opcode, "fmov") == 0){
		if(sscanf(op_data, fff, tmp, &rd, &rs) == 3)
		    return fmov(rs,0,rd,0);
	}
	if(strcmp(opcode, "fneg") == 0){
		if(sscanf(op_data, fff, tmp, &rd, &rs) == 3)
		    return fneg(rs,0,rd,0);
	}
	if(strcmp(opcode, "fldi") == 0){
		if(sscanf(op_data, ffgi, tmp, &rt, &rs, &imm) == 4)
		    return fldi(rs,rt,imm);
	}
	if(strcmp(opcode, "fsti") == 0){
		if(sscanf(op_data, ffgi, tmp, &rt, &rs, &imm) == 4)
		    return fsti(rs,rt,imm);
	}
	if(strcmp(opcode, "fjeq") == 0){
		if(sscanf(op_data, fffl, tmp, &rs, &rt, lname) == 4) {
			strcpy(label_name[label_cnt],lname);
		    return fjeq(rs,rt,label_cnt++);
		}
	}
	if(strcmp(opcode, "fjlt") == 0){
		if(sscanf(op_data, fffl, tmp, &rs, &rt, lname) == 4) {
			strcpy(label_name[label_cnt],lname);
		    return fjlt(rs,rt,label_cnt++);
		}
	}
	if(strcmp(opcode, "halt") == 0){
		    return halt(0,0,0,0);
	}
	if(strcmp(opcode, "setL") == 0){
		if(sscanf(op_data, fgl, tmp, &rd, lname) == 3) {
			strcpy(label_name[label_cnt],lname);
		    return setl(0,rd,label_cnt++);
		}
	}
	if(strcmp(opcode, "padd") == 0){
		if(sscanf(op_data, fgi, tmp, &rt, &imm) == 3) {
		    return padd(0,rt,imm);
		}
	}
	if(strcmp(opcode, "link") == 0){
		if(sscanf(op_data, fi, tmp, &imm) == 2) {
		    return link(0,0,imm);
		}
	}
	if(strcmp(opcode, "movlr") == 0){
		return movlr(0,0,0,0);
	}
	if(strcmp(opcode, "btmplr") == 0){
		return btmplr(0,0,0,0);
	}
	/*
	if(strcmp(opcode, "padd") == 0){
		if(sscanf(op_data, fgg, tmp, &rd, &rt) == 3) {
		    return padd(0,rt,d,0);
		}
	}
	*/

	return -1;
}