Exemplo n.º 1
0
bool OR( expression * ep, std::string header, std::string tuple )
{
  bool lhs = false;
  bool rhs = false;

  if ( ep->values[0].ep->func == OP_AND )
    lhs = AND ( ep->values[0].ep, header, tuple );
  else if ( ep->values[0].ep->func == OP_OR )
    lhs = OR ( ep->values[0].ep, header, tuple );
  else
    lhs = comparison ( ep->values[0].ep, header, tuple );

  if ( ep->values[1].ep->func == OP_AND )
    rhs = AND ( ep->values[1].ep, header, tuple );
  else if ( ep->values[1].ep->func == OP_OR )
    rhs = OR ( ep->values[1].ep, header, tuple );
  else
    rhs = comparison ( ep->values[1].ep, header, tuple );

  return lhs || rhs;
}
Exemplo n.º 2
0
void
vec4_gs_visitor::gs_end_primitive()
{
    /* We can only do EndPrimitive() functionality when the control data
     * consists of cut bits.  Fortunately, the only time it isn't is when the
     * output type is points, in which case EndPrimitive() is a no-op.
     */
    if (gs_prog_data->control_data_format !=
            GEN7_GS_CONTROL_DATA_FORMAT_GSCTL_CUT) {
        return;
    }

    if (c->control_data_header_size_bits == 0)
        return;

    /* Cut bits use one bit per vertex. */
    assert(c->control_data_bits_per_vertex == 1);

    /* Cut bit n should be set to 1 if EndPrimitive() was called after emitting
     * vertex n, 0 otherwise.  So all we need to do here is mark bit
     * (vertex_count - 1) % 32 in the cut_bits register to indicate that
     * EndPrimitive() was called after emitting vertex (vertex_count - 1);
     * vec4_gs_visitor::emit_control_data_bits() will take care of the rest.
     *
     * Note that if EndPrimitve() is called before emitting any vertices, this
     * will cause us to set bit 31 of the control_data_bits register to 1.
     * That's fine because:
     *
     * - If max_vertices < 32, then vertex number 31 (zero-based) will never be
     *   output, so the hardware will ignore cut bit 31.
     *
     * - If max_vertices == 32, then vertex number 31 is guaranteed to be the
     *   last vertex, so setting cut bit 31 has no effect (since the primitive
     *   is automatically ended when the GS terminates).
     *
     * - If max_vertices > 32, then the ir_emit_vertex visitor will reset the
     *   control_data_bits register to 0 when the first vertex is emitted.
     */

    /* control_data_bits |= 1 << ((vertex_count - 1) % 32) */
    src_reg one(this, glsl_type::uint_type);
    emit(MOV(dst_reg(one), brw_imm_ud(1u)));
    src_reg prev_count(this, glsl_type::uint_type);
    emit(ADD(dst_reg(prev_count), this->vertex_count, brw_imm_ud(0xffffffffu)));
    src_reg mask(this, glsl_type::uint_type);
    /* Note: we're relying on the fact that the GEN SHL instruction only pays
     * attention to the lower 5 bits of its second source argument, so on this
     * architecture, 1 << (vertex_count - 1) is equivalent to 1 <<
     * ((vertex_count - 1) % 32).
     */
    emit(SHL(dst_reg(mask), one, prev_count));
    emit(OR(dst_reg(this->control_data_bits), this->control_data_bits, mask));
}
Exemplo n.º 3
0
// In: RAX: s64 _Value
// Clobbers RDX
void DSPEmitter::Update_SR_Register(Gen::X64Reg val)
{
	OpArg sr_reg;
	gpr.GetReg(DSP_REG_SR, sr_reg);
	//	// 0x04
	//	if (_Value == 0) g_dsp.r[DSP_REG_SR] |= SR_ARITH_ZERO;
	TEST(64, R(val), R(val));
	FixupBranch notZero = J_CC(CC_NZ);
	OR(16, sr_reg, Imm16(SR_ARITH_ZERO | SR_TOP2BITS));
	FixupBranch end = J();
	SetJumpTarget(notZero);

	//	// 0x08
	//	if (_Value < 0) g_dsp.r[DSP_REG_SR] |= SR_SIGN;
	FixupBranch greaterThanEqual = J_CC(CC_GE);
	OR(16, sr_reg, Imm16(SR_SIGN));
	SetJumpTarget(greaterThanEqual);

	//	// 0x10
	//	if (_Value != (s32)_Value) g_dsp.r[DSP_REG_SR] |= SR_OVER_S32;
	MOVSX(64, 32, RDX, R(val));
	CMP(64, R(RDX), R(val));
	FixupBranch noOverS32 = J_CC(CC_E);
	OR(16, sr_reg, Imm16(SR_OVER_S32));
	SetJumpTarget(noOverS32);

	//	// 0x20 - Checks if top bits of m are equal
	//	if (((_Value & 0xc0000000) == 0) || ((_Value & 0xc0000000) == 0xc0000000))
	MOV(32, R(RDX), Imm32(0xc0000000));
	AND(32, R(val), R(RDX));
	FixupBranch zeroC = J_CC(CC_Z);
	CMP(32, R(val), R(RDX));
	FixupBranch cC = J_CC(CC_NE);
	SetJumpTarget(zeroC);
	//		g_dsp.r[DSP_REG_SR] |= SR_TOP2BITS;
	OR(16, sr_reg, Imm16(SR_TOP2BITS));
	SetJumpTarget(cC);
	SetJumpTarget(end);
	gpr.PutReg(DSP_REG_SR);
}
Exemplo n.º 4
0
void ui_can_KEventProc (Widget w, struct Ui_DisplayType *displayPtr, XEvent *event)

{
    char            string[50];
    struct PosType  eventPixPos;
    KeySym          key;
    static int      loc_mode_switch = 0;

    if (displayPtr->frozen) return; /* don't accept this event here */
    
    if (event->type != KeyPress)
	return;
    
    XLookupString((XKeyEvent *) event, string, 1, &key, NULL);

    if( (key == XK_Control_L) OR (key == XK_Control_R))
	return;


    /* Process window popup requests */
    if( key == XK_Mode_switch){
	loc_mode_switch = 1;
	return;
    }
    if( loc_mode_switch == 1){
	loc_mode_switch = 0;
	ui_key_control(w,1,event);
	return;
    }


    if ((string[0] < '3') OR ((string[0] > '3') AND (string[0] < 'a')) 
      OR (string[0] > 'z'))
	return;

    eventPixPos.x     = (int) event->xkey.x;
    eventPixPos.y     = (int) event->xkey.y;
   
    ui_key_automata(displayPtr, eventPixPos, string[0]);
}
Exemplo n.º 5
0
void Jit64::GenerateConstantOverflow(bool overflow)
{
	if (overflow)
	{
		//XER[OV/SO] = 1
		OR(32, M(&PowerPC::ppcState.spr[SPR_XER]), Imm32(XER_SO_MASK | XER_OV_MASK));
	}
	else
	{
		//XER[OV] = 0
		AND(32, M(&PowerPC::ppcState.spr[SPR_XER]), Imm32(~XER_OV_MASK));
	}
}
Exemplo n.º 6
0
	static
	void
draw_bb_grid (

int		x0,
int		y0,
int		x1,
int		y1
)
{
int		nt;

	nt = grid.nt;
	if ((x0 < 0) OR (x0 >= nt)) {
		fatal ("draw_bb_grid: Bug 1.");
	}
	if ((y0 < 0) OR (y0 >= nt)) {
		fatal ("draw_bb_grid: Bug 2.");
	}
	if ((x1 < 0) OR (x1 >= nt)) {
		fatal ("draw_bb_grid: Bug 3.");
	}
	if ((y1 < 0) OR (y1 >= nt)) {
		fatal ("draw_bb_grid: Bug 4.");
	}

	/* Assume RFSTs are left-most topologies.  Plot corner	*/
	/* segments so that the vertical segment is to the left	*/
	/* of the horizontal segment.				*/

	if (x0 < x1) {
		draw_bb_grid_vertical (x0, y0, y1);
		draw_bb_grid_horizontal (x1, y1, x0);
	}
	else {
		draw_bb_grid_vertical (x1, y1, y0);
		draw_bb_grid_horizontal (x0, y0, x1);
	}
}
Exemplo n.º 7
0
// In: (val): s64 _Value
// In: (carry_ovfl): 1 = carry, 2 = overflow
// Clobbers RDX
void DSPEmitter::Update_SR_Register64_Carry(X64Reg val, X64Reg carry_ovfl, bool carry_eq)
{
	OpArg sr_reg;
	gpr.GetReg(DSP_REG_SR, sr_reg);
	//	g_dsp.r[DSP_REG_SR] &= ~SR_CMP_MASK;
	AND(16, sr_reg, Imm16(~SR_CMP_MASK));

	CMP(64, R(carry_ovfl), R(val));

	// 0x01
	//	g_dsp.r[DSP_REG_SR] |= SR_CARRY;
	// Carry = (acc>res)
	// Carry2 = (acc>=res)
	FixupBranch noCarry = J_CC(carry_eq ? CC_B : CC_BE);
	OR(16, sr_reg, Imm16(SR_CARRY));
	SetJumpTarget(noCarry);

	// 0x02 and 0x80
	//	g_dsp.r[DSP_REG_SR] |= SR_OVERFLOW;
	//	g_dsp.r[DSP_REG_SR] |= SR_OVERFLOW_STICKY;
	// Overflow = ((acc ^ res) & (ax ^ res)) < 0
	XOR(64, R(carry_ovfl), R(val));
	XOR(64, R(RDX), R(val));
	TEST(64, R(carry_ovfl), R(RDX));
	FixupBranch noOverflow = J_CC(CC_GE);
	OR(16, sr_reg, Imm16(SR_OVERFLOW | SR_OVERFLOW_STICKY));
	SetJumpTarget(noOverflow);

	gpr.PutReg(DSP_REG_SR);
	if (carry_eq)
	{
		Update_SR_Register();
	}
	else
	{
		Update_SR_Register(val);
	}
}
Exemplo n.º 8
0
static void			st_finish_begin(t_pos *pos, int cs, t_env *env, int i)
{
	if (OR(cs) == O)
	{
		pos->y = pos->y + i > HEIGHT - 1 ? ((pos->y + i) - (HEIGHT - 1)) - 1
			: pos->y + i;
		pos->x = pos->x - i < 0 ? WIDTH - i : pos->x - i;
		while (pos->y > HEIGHT - 1)
			pos->y = (pos->y - (HEIGHT - 1)) - 1;
		while (pos->x < 0)
			pos->x = WIDTH - abs(pos->x);
	}
	else if (OR(cs) == E)
	{
		pos->y = pos->y - i < 0 ? HEIGHT - i : pos->y - i;
		pos->x = pos->x + i > WIDTH - 1 ? ((pos->x + i) - (WIDTH - 1)) - 1
			: pos->x + i;
		while (pos->y < 0)
			pos->y = HEIGHT - abs(pos->y);
		while (pos->x > WIDTH - 1)
			pos->x = (pos->x - (WIDTH - 1)) - 1;
	}
}
Exemplo n.º 9
0
int main(){
	int i,j;
	for(i=0;i<2;i++){
		for(j=0;j<2;j++){
			printf("%d AND %d = %d\n",i,j,AND(i,j));
		}
	}
	printf("\n");

	for(i=0;i<2;i++){
		for(j=0;j<2;j++){
			printf("%d OR %d = %d\n",i,j,OR(i,j));
		}
	}
	printf("\n");

	for(i=0;i<2;i++){
			printf("%d NOT = %d\n",i,NOT(i));
	}
	printf("\n");

	for(i=0;i<2;i++){
		for(j=0;j<2;j++){
			printf("%d NAND %d = %d\n",i,j,NAND(i,j));
		}
	}
	printf("\n");

	for(i=0;i<2;i++){
		for(j=0;j<2;j++){
			printf("%d NOR %d = %d\n",i,j,NOR(i,j));
		}
	}
	printf("\n");

	for(i=0;i<2;i++){
		for(j=0;j<2;j++){
			printf("%d XOR %d = %d\n",i,j,XOR(i,j));
		}
	}
	printf("\n");

	for(i=0;i<2;i++){
		for(j=0;j<2;j++){
			printf("%d XNOR %d = %d\n",i,j,XNOR(i,j));
		}
	}
	printf("\n");
    return 0;
}
Exemplo n.º 10
0
void
gen6_gs_visitor::visit(ir_end_primitive *)
{
   this->current_annotation = "gen6 end primitive";
   /* Calling EndPrimitive() is optional for point output. In this case we set
    * the PrimEnd flag when we process EmitVertex().
    */
   if (c->gp->program.OutputType == GL_POINTS)
      return;

   /* Otherwise we know that the last vertex we have processed was the last
    * vertex in the primitive and we need to set its PrimEnd flag, so do this
    * unless we haven't emitted that vertex at all (vertex_count != 0).
    *
    * Notice that we have already incremented vertex_count when we processed
    * the last emit_vertex, so we need to take that into account in the
    * comparison below (hence the num_output_vertices + 1 in the comparison
    * below).
    */
   unsigned num_output_vertices = c->gp->program.VerticesOut;
   emit(CMP(dst_null_d(), this->vertex_count, src_reg(num_output_vertices + 1),
            BRW_CONDITIONAL_L));
   vec4_instruction *inst = emit(CMP(dst_null_d(),
                                     this->vertex_count, 0u,
                                     BRW_CONDITIONAL_NEQ));
   inst->predicate = BRW_PREDICATE_NORMAL;
   emit(IF(BRW_PREDICATE_NORMAL));
   {
      /* vertex_output_offset is already pointing at the first entry of the
       * next vertex. So subtract 1 to modify the flags for the previous
       * vertex.
       */
      src_reg offset(this, glsl_type::uint_type);
      emit(ADD(dst_reg(offset), this->vertex_output_offset, src_reg(-1)));

      src_reg dst(this->vertex_output);
      dst.reladdr = ralloc(mem_ctx, src_reg);
      memcpy(dst.reladdr, &offset, sizeof(src_reg));

      emit(OR(dst_reg(dst), dst, URB_WRITE_PRIM_END));
      emit(ADD(dst_reg(this->prim_count), this->prim_count, 1u));

      /* Set the first vertex flag to indicate that the next vertex will start
       * a primitive.
       */
      emit(MOV(dst_reg(this->first_vertex), URB_WRITE_PRIM_START));
   }
   emit(BRW_OPCODE_ENDIF);
}
Exemplo n.º 11
0
void UndoCommand::pushCommand( UndoCommand* a_pUndoCommand )
{
    o_assert(a_pUndoCommand->m_pParent == nullptr AND (
        (getUndoStack() == nullptr) OR (m_eRedoChildExecutionPolicy < e_ChildExecutionPolicy_ForwardBeforeParent))
        );
    a_pUndoCommand->m_uiIndex = m_ChildCommands.size();
    m_ChildCommands.push_back(a_pUndoCommand);
    a_pUndoCommand->m_pParent = this;
    if(m_pUndoStack)
    {
        a_pUndoCommand->setUndoStack(m_pUndoStack);
    }

    o_emit childCommandAdded(a_pUndoCommand);
}
Exemplo n.º 12
0
void print_nc_line_number()
{
    char text[256];
    int k;
    int m;

    rs274ngc_line_text(text, 256);
    for (k SET_TO 0;
        ((k < 256) AND
        ((text[k] IS '\t') OR (text[k] IS ' ') OR (text[k] IS '/')));
        k++);
    if ((k < 256) AND ((text[k] IS 'n') OR (text[k] IS 'N')))
    {
        fputc('N', _outfile);
        for (k++, m SET_TO 0;
            ((k < 256) AND (text[k] >= '0') AND (text[k] <= '9'));
            k++, m++)
        fputc(text[k], _outfile);
        for (; m < 6; m++)
            fputc(' ', _outfile);
    }
    else if (k < 256)
        fprintf(_outfile, "N..... ");
}
Exemplo n.º 13
0
/**
 * g_unichar_isspace:
 * @c: a Unicode character
 * 
 * Determines whether a character is a space, tab, or line separator
 * (newline, carriage return, etc.).  Given some UTF-8 text, obtain a
 * character value with g_utf8_get_char().
 *
 * (Note: don't use this to do word breaking; you have to use
 * Pango or equivalent to get word breaking right, the algorithm
 * is fairly complex.)
 *  
 * Return value: %TRUE if @c is a space character
 **/
gboolean
g_unichar_isspace (gunichar c)
{
  switch (c)
    {
      /* special-case these since Unicode thinks they are not spaces */
    case '\t':
    case '\n':
    case '\r':
    case '\f':
      return TRUE;
      break;
      
    default:
      {
	return IS (TYPE(c),
	           OR (G_UNICODE_SPACE_SEPARATOR,
	           OR (G_UNICODE_LINE_SEPARATOR,
                   OR (G_UNICODE_PARAGRAPH_SEPARATOR,
		  0)))) ? TRUE : FALSE;
      }
      break;
    }
}
Exemplo n.º 14
0
bool SamplerJitCache::Jit_TransformClutIndex(const SamplerID &id, int bitsPerIndex) {
	GEPaletteFormat fmt = (GEPaletteFormat)id.clutfmt;
	if (!id.hasClutShift && !id.hasClutMask && !id.hasClutOffset) {
		// This is simple - just mask if necessary.
		if (bitsPerIndex > 8) {
			AND(32, R(resultReg), Imm32(0x000000FF));
		}
		return true;
	}

	MOV(PTRBITS, R(tempReg1), ImmPtr(&gstate.clutformat));
	MOV(32, R(tempReg1), MatR(tempReg1));

	// Shift = (clutformat >> 2) & 0x1F
	if (id.hasClutShift) {
		MOV(32, R(RCX), R(tempReg1));
		SHR(32, R(RCX), Imm8(2));
		AND(32, R(RCX), Imm8(0x1F));
		SHR(32, R(resultReg), R(RCX));
	}

	// Mask = (clutformat >> 8) & 0xFF
	if (id.hasClutMask) {
		MOV(32, R(tempReg2), R(tempReg1));
		SHR(32, R(tempReg2), Imm8(8));
		AND(32, R(resultReg), R(tempReg2));
	}

	// We need to wrap any entries beyond the first 1024 bytes.
	u32 offsetMask = fmt == GE_CMODE_32BIT_ABGR8888 ? 0x00FF : 0x01FF;

	// We must mask to 0xFF before ORing 0x100 in 16 bit CMODEs.
	// But skip if we'll mask 0xFF after offset anyway.
	if (bitsPerIndex > 8 && (!id.hasClutOffset || offsetMask != 0x00FF)) {
		AND(32, R(resultReg), Imm32(0x000000FF));
	}

	// Offset = (clutformat >> 12) & 0x01F0
	if (id.hasClutOffset) {
		SHR(32, R(tempReg1), Imm8(16));
		SHL(32, R(tempReg1), Imm8(4));
		OR(32, R(resultReg), R(tempReg1));
		AND(32, R(resultReg), Imm32(offsetMask));
	}
	return true;
}
Exemplo n.º 15
0
void Jit::CompFPComp(int lhs, int rhs, u8 compare, bool allowNaN)
{
	gpr.MapReg(MIPS_REG_FPCOND, false, true);
	MOVSS(XMM0, fpr.R(lhs));
	CMPSS(XMM0, fpr.R(rhs), compare);
	MOVD_xmm(gpr.R(MIPS_REG_FPCOND), XMM0);

	// This means that NaN also means true, e.g. !<> or !>, etc.
	if (allowNaN)
	{
		MOVSS(XMM0, fpr.R(lhs));
		CMPUNORDSS(XMM0, fpr.R(rhs));

		MOVD_xmm(R(EAX), XMM0);
		OR(32, gpr.R(MIPS_REG_FPCOND), R(EAX));
	}
}
Exemplo n.º 16
0
void Jit::CompFPComp(int lhs, int rhs, u8 compare, bool allowNaN)
{
	MOVSS(XMM0, fpr.R(lhs));
	CMPSS(XMM0, fpr.R(rhs), compare);
	MOVSS(M(&currentMIPS->fpcond), XMM0);

	// This means that NaN also means true, e.g. !<> or !>, etc.
	if (allowNaN)
	{
		MOVSS(XMM0, fpr.R(lhs));
		CMPUNORDSS(XMM0, fpr.R(rhs));
		MOVSS(M(&ssCompareTemp), XMM0);

		MOV(32, R(EAX), M(&ssCompareTemp));
		OR(32, M(&currentMIPS->fpcond), R(EAX));
	}
}
Exemplo n.º 17
0
/**
 * g_unichar_isgraph:
 * @c: a Unicode character
 * 
 * Determines whether a character is printable and not a space
 * (returns %FALSE for control characters, format characters, and
 * spaces). g_unichar_isprint() is similar, but returns %TRUE for
 * spaces. Given some UTF-8 text, obtain a character value with
 * g_utf8_get_char().
 * 
 * Return value: %TRUE if @c is printable unless it's a space
 **/
gboolean
g_unichar_isgraph (gunichar c)
{
  return !IS (TYPE(c),
	      OR (G_UNICODE_CONTROL,
	      OR (G_UNICODE_FORMAT,
	      OR (G_UNICODE_UNASSIGNED,
	      OR (G_UNICODE_PRIVATE_USE,
	      OR (G_UNICODE_SURROGATE,
	      OR (G_UNICODE_SPACE_SEPARATOR,
	     0)))))));
}
Exemplo n.º 18
0
void execute_program(char** instructions, int n_instructions, var** vars) {
	int i;
	char instruction[16];
	char argument[128];
	for (i = 2; i < n_instructions; i++) {
		sscanf(instructions[i], "%s %[^\n]\n", instruction, argument);
		if (strcmp(instruction, "AND") == 0) {
			vars[(int) argument[4]] -> value = AND(vars[(int)argument[0]], vars[(int)argument[2]]);
		} else if (strcmp(instruction, "OR") == 0) {
			vars[(int) argument[4]] -> value = OR(vars[(int) argument[0]], vars[(int) argument[2]]);
		} else if (strcmp(instruction, "MULTIPLEXER") == 0) {
			int num_inputs;
			sscanf(argument, "%d ", &num_inputs);
			int num_selectors = (int) ceil(log2(num_inputs));
			var* inputs[num_inputs];
			var* selectors[num_selectors];
			int g;
			for (g = 0; g < num_inputs; g++) {
				inputs[g] = vars[(int) argument[g*2+2]];
			}
			for (g = 0; g < num_selectors; g++) {
				selectors[g] = vars[(int) argument[(2 * num_inputs + 2) + g * 2]];
			}
			var* output = vars[(int) argument[num_inputs*2 + num_selectors*2 + 2]];
			MULTIPLEXER(num_inputs, inputs, selectors, output);
		} else if (strcmp(instruction, "DECODER") == 0) {
			int num_inputs;
			sscanf(argument, "%d ", &num_inputs);
			int num_outputs = pow(num_inputs, 2);
			var* inputs[num_inputs];
			var* outputs[num_outputs];
			int g;
			for (g = 0; g < num_inputs; g++) {
				inputs[g] = vars[(int) argument[g*2 + 2]];
			}

			for (g = 0; g < num_outputs; g++) {
				outputs[g] = vars[(int) argument[(2 * num_inputs + 2) + g * 2]];
			}
			DECODER(num_inputs, inputs, outputs);
		}
	}

}
Exemplo n.º 19
0
bool MString::IsVowel(int at)
{
        
        if((at < 0) OR (at >= length))
                return false;

        char it = GetAt(at);

        if((it == 'A') OR (it == 'E') OR (it == 'I') OR (it == 'O') OR (it == 'U') OR (it == 'Y') )
                return true;

        return false;
}
Exemplo n.º 20
0
void   GLUI_EditText::clear_substring( int start, int end )
{
  int i;

  /*
  printf( "clearing: %d-%d   '", start,end);
  for(i=start;i<end;i++ )
  putchar(text[i]);
  printf( "'\n" ); flushout;
  */
  /*** See if we're deleting a period in a float data-type box ***/
  if (( data_type == GLUI_EDITTEXT_FLOAT ) OR ( data_type == GLUI_EDITTEXT_DOUBLE ) ){
    for( i=start; i<end; i++ )
      if ( text[i] == '.' )
        num_periods = 0;
  }

  text.erase(start,end-start);
}
Exemplo n.º 21
0
int    GLUI_Main::add_control( GLUI_Node *parent, GLUI_Control *control )
{
  GLUI_Control *parent_control;

  /*** Collapsible nodes have to be handled differently, b/c the first and 
    last children are swapped in and out  ***/
  parent_control = ((GLUI_Control*)parent);
  if ( parent_control->collapsible == true ) {
    if ( NOT parent_control->is_open ) {
      /** Swap in the original first and last children **/
      parent_control->child_head  = parent_control->collapsed_node.child_head;
      parent_control->child_tail  = parent_control->collapsed_node.child_tail;

      /*** Link this control ***/
      control->link_this_to_parent_last( parent );

      /** Swap the children back out ***/
      parent_control->collapsed_node.child_head = parent_control->child_head;
      parent_control->collapsed_node.child_tail = parent_control->child_tail;
      parent_control->child_head = NULL;
      parent_control->child_tail = NULL;
    }
    else {
      control->link_this_to_parent_last( parent );
    }
  }
  else {
    control->link_this_to_parent_last( parent );
  }
  control->glui = (GLUI*) this;
  control->update_size();
  control->enabled = ((GLUI_Control*) parent)->enabled;
  control->glui->refresh();

  /** Now set the 'hidden' var based on the parent **/
  if ( parent_control->hidden OR 
       (parent_control->collapsible AND NOT parent_control->is_open ) )
  {
    control->hidden = true;
  }

  return true;
}
Exemplo n.º 22
0
// In: RAX: s64 _Value
// Clobbers RCX
void DSPEmitter::Update_SR_Register16_OverS32(Gen::X64Reg val)
{
	OpArg sr_reg;
	gpr.GetReg(DSP_REG_SR, sr_reg);
	AND(16, sr_reg, Imm16(~SR_CMP_MASK));

	//	// 0x10
	//	if (_Value != (s32)_Value) g_dsp.r[DSP_REG_SR] |= SR_OVER_S32;
	MOVSX(64, 32, RCX, R(val));
	CMP(64, R(RCX), R(val));
	FixupBranch noOverS32 = J_CC(CC_E);
	OR(16, sr_reg, Imm16(SR_OVER_S32));
	SetJumpTarget(noOverS32);

	gpr.PutReg(DSP_REG_SR);
	//	// 0x20 - Checks if top bits of m are equal
	//	if ((((u16)_Value >> 14) == 0) || (((u16)_Value >> 14) == 3))
	// AND(32, R(val), Imm32(0xc0000000));
	Update_SR_Register16(val);
}
Exemplo n.º 23
0
void
gen8_vec4_generator::generate_gs_thread_end(vec4_instruction *ir)
{
   struct brw_reg src = brw_vec8_grf(GEN7_MRF_HACK_START + ir->base_mrf, 0);
   gen8_instruction *inst;

   /* Enable Channel Masks in the URB_WRITE_HWORD message header */
   default_state.access_mode = BRW_ALIGN_1;
   inst = OR(retype(brw_vec1_grf(GEN7_MRF_HACK_START + ir->base_mrf, 5),
                    BRW_REGISTER_TYPE_UD),
             retype(brw_vec1_grf(0, 5), BRW_REGISTER_TYPE_UD),
             brw_imm_ud(0xff00)); /* could be 0x1100 but shouldn't matter */
   gen8_set_mask_control(inst, BRW_MASK_DISABLE);
   default_state.access_mode = BRW_ALIGN_16;

   /* mlen = 2: g0 header + vertex count */
   inst = next_inst(BRW_OPCODE_SEND);
   gen8_set_urb_message(brw, inst, BRW_URB_WRITE_EOT, 2, 0, 0, true);
   gen8_set_dst(brw, inst, brw_null_reg());
   gen8_set_src0(brw, inst, src);
}
Exemplo n.º 24
0
void SetBuf(TCHAR * szBuffer, int bufSize, TCHAR * szFormat, signed short uLevel, WORD *wLevel) {
	if ( (uLevel < 1) OR (uLevel > 100) ) {
		if (uLevel IS 0) {
		 	// empty
			*wLevel = 0;
			LoadString(hInstance, IDS_EMPTY, szBuffer, bufSize);
		}		
		else if (uLevel IS -3) {
			// not empty
			*wLevel = 50;
			LoadString(hInstance, IDS_NOT_EMPTY, szBuffer, bufSize);
		}
		else {
			*wLevel = 0;
			LoadString(hInstance, IDS_UNKNOWN_LEVEL, szBuffer, bufSize);
		}
	}
	else { // uLevel > 0 AND <= 100 
	 	*wLevel = uLevel;
		wsprintf(szBuffer, szFormat, uLevel);
	}
}
Exemplo n.º 25
0
int TestOR2(){
  START_TEST_CASE;
 
  w = (DNODE *)malloc(sizeof(DNODE));
  w->data = addDocNode(0,55);
 
  char key[]="a";

  DocumentNode *d;
  d = addDocNode(0,1);

  d = OR(d,key);
  
  SHOULD_BE( d->next == NULL );
  SHOULD_BE( d->document_id == 0 );
  SHOULD_BE( d->page_word_frequency == 56 );
  
  free((DocumentNode *)w->data);
  free(w);
  freeDocNodeList(d);
  END_TEST_CASE;
}
Exemplo n.º 26
0
int main(int argc, char **argv)
{
	trueState = **(argv+1);
	falseState = **(argv+2);

	if (argc <= 2)
	{
		printf("\nNot enough arguments defined. You must define two arguments.\n");
	}
	else if (argc > 3)
	{
		printf("\nToo many arguments defined. You must define two arguments.\n");
	}
	else
	{
		printf("\nNOT %c: %c\n",trueState,NOT(trueState));
		printf("NOT %c: %c\n",falseState,NOT(falseState));

		printf("\n%c AND %c: %c\n",trueState, trueState, AND(trueState,trueState));
		printf("%c AND %c: %c\n",trueState, falseState, AND(trueState,falseState));
		printf("%c AND %c: %c\n",falseState, trueState, AND(falseState,trueState));
		printf("%c AND %c: %c\n",falseState, falseState, AND(falseState,falseState));

		printf("\n%c OR %c: %c\n",trueState, trueState, OR(trueState,trueState));
		printf("%c OR %c: %c\n",trueState, falseState, OR(trueState,falseState));
		printf("%c OR %c: %c\n",falseState, trueState, OR(falseState,trueState));
		printf("%c OR %c: %c\n",falseState, falseState, OR(falseState,falseState));

		printf("\n%c XOR %c: %c\n",trueState, trueState, OR(AND(trueState,NOT(trueState)),AND(NOT(trueState),trueState)));
		printf("%c XOR %c: %c\n",trueState, falseState, OR(AND(trueState,NOT(falseState)),AND(NOT(trueState),falseState)));
		printf("%c XOR %c: %c\n",falseState, trueState, OR(AND(falseState,NOT(trueState)),AND(NOT(falseState),trueState)));
		printf("%c XOR %c: %c\n",falseState, falseState, OR(AND(falseState,NOT(falseState)),AND(NOT(falseState),falseState)));
	}

	return 0;
}
Exemplo n.º 27
0
void
vec4_gs_visitor::set_stream_control_data_bits(unsigned stream_id)
{
   /* control_data_bits |= stream_id << ((2 * (vertex_count - 1)) % 32) */

   /* Note: we are calling this *before* increasing vertex_count, so
    * this->vertex_count == vertex_count - 1 in the formula above.
    */

   /* Stream mode uses 2 bits per vertex */
   assert(c->control_data_bits_per_vertex == 2);

   /* Must be a valid stream */
   assert(stream_id >= 0 && stream_id < MAX_VERTEX_STREAMS);

   /* Control data bits are initialized to 0 so we don't have to set any
    * bits when sending vertices to stream 0.
    */
   if (stream_id == 0)
      return;

   /* reg::sid = stream_id */
   src_reg sid(this, glsl_type::uint_type);
   emit(MOV(dst_reg(sid), stream_id));

   /* reg:shift_count = 2 * (vertex_count - 1) */
   src_reg shift_count(this, glsl_type::uint_type);
   emit(SHL(dst_reg(shift_count), this->vertex_count, 1u));

   /* Note: we're relying on the fact that the GEN SHL instruction only pays
    * attention to the lower 5 bits of its second source argument, so on this
    * architecture, stream_id << 2 * (vertex_count - 1) is equivalent to
    * stream_id << ((2 * (vertex_count - 1)) % 32).
    */
   src_reg mask(this, glsl_type::uint_type);
   emit(SHL(dst_reg(mask), sid, shift_count));
   emit(OR(dst_reg(this->control_data_bits), this->control_data_bits, mask));
}
Exemplo n.º 28
0
int TestOR1(){
  START_TEST_CASE;
  
  

  w = NULL;
  char key[]="a";

  DocumentNode *d,*dReturn;
  d = addDocNode(0,1);
  
  dReturn = OR(d,key);
  
  SHOULD_BE( dReturn->document_id == 0 );
  SHOULD_BE( dReturn->page_word_frequency == 1 );
  SHOULD_BE( dReturn->next == NULL );
  SHOULD_BE( dReturn == d );

  
  freeDocNodeList(d);
  free(w);
  END_TEST_CASE;
}
Exemplo n.º 29
0
static MRESULT APIENTRY SetRuler ( HWND Window, MESG, MPARAM1 mp1, MPARAM2 ) {

  /**************************************************************************
   * Find the instance data.                                                *
   **************************************************************************/

   PDATA Data = PDATA ( Sys_GetWindowData ( Window ) ) ;

  /**************************************************************************
   * If ruler parameters have changed, save them and invalidate the window. *
   **************************************************************************/

   PHORZRULER_SETPARMS Parms = PHORZRULER_SETPARMS ( PVOIDFROMMP ( mp1 ) ) ;

   if ( ( Data->Metric      != Parms->Metric      )
      OR ( Data->fxZoom      != Parms->fxZoom      )
      OR ( Data->TopLeft     != Parms->TopLeft     )
      OR ( Data->PageWidth   != Parms->PageWidth   )
      OR ( Data->LeftMargin  != Parms->LeftMargin  )
      OR ( Data->RightMargin != Parms->RightMargin )
      OR ( Data->TabCount    != Parms->TabCount    )
      OR memcmp ( Data->Tabs, Parms->Tabs, sizeof(Data->Tabs) ) ) {

      #ifdef DEBUG
         Log ( "HRuler::SetRuler: Setting Margins to %i, %i.", Parms->LeftMargin, Parms->RightMargin ) ;
      #endif
      Data->Metric      = Parms->Metric ;
      Data->fxZoom      = Parms->fxZoom ;
      Data->TopLeft     = Parms->TopLeft ;
      Data->PageWidth   = Parms->PageWidth ;
      Data->LeftMargin  = Parms->LeftMargin ;
      Data->RightMargin = Parms->RightMargin ;
      Data->TabCount    = Parms->TabCount ;
      memcpy ( Data->Tabs, Parms->Tabs, sizeof(Data->Tabs) ) ;
      Sys_InvalidateWindow ( Window ) ;

   } /* endif */

  /********************************h*****************************************
   * We're done.                                                            *
   **************************************************************************/

   return ( MRFROMSHORT ( 0 ) ) ;
}
Exemplo n.º 30
0
COMPARE_RESULT EstLogProp::compareEstLogProp (const EstLogPropSharedPtr &other) const
{
  
  if (this == other.get())
    return SAME;

  // First thing that we may want to compare is the CANodeSets of the EstLogProp
  // if these are NOT NULL

  // This would work if Query Analizer created nodeSet_ for this and other
  if ((nodeSet_ != NULL) && (other->nodeSet_ != NULL))
  {
    if ((*nodeSet_) == (*(other->nodeSet_)))
      return SAME;
    else
      return INCOMPATIBLE;
  }

  // This is the old logic after removing heuristic returning SAME for close 
  // EstLogProp like resultCardinality_/other->resultCardinality in [0.8,1.2]
  // That heuristics was incompatible with Cascades assumption that in the case
  // when pruning is on we cannot have 2 different context for optimization 
  // if their comparison returns SAME.
  if ( resultCardinality_ == other->resultCardinality_  AND
       ( // Check for the case where we have two "empty" input logical properties.
         ( columnStats_.entries() == 0 AND other->columnStats_.entries() == 0) 
         OR
         ( columnStats_       == other->columnStats_ AND
	   unresolvedPreds_   == other->unresolvedPreds_ AND
	   inputForSemiTSJ_   == other->inputForSemiTSJ_ )
       )
     )
    return SAME;

  return INCOMPATIBLE;
}