コード例 #1
0
ファイル: uri.c プロジェクト: jamesyan84/zbase
/************************************************************************
*	Function :	is_unreserved
*
*	Parameters :
*		char in ;	character to be matched for UNRESERVED characters
*
*	Description : Returns a 1 if a char is an unreserved char as defined in 
*		http://www.ietf.org/rfc/rfc2396.txt (RFC explaining URIs)	
*
*	Return : int ;
*
*	Note :
************************************************************************/
int
is_unreserved( char in )
{
    if( isalnum( in ) || ( is_mark( in ) ) )
        return 1;
    else
        return 0;
}
コード例 #2
0
ファイル: uri.c プロジェクト: heenbo/libupnp-ctrlpoint
/*!
 * \brief Returns a 1 if a char is an UNRESERVED char as defined in
 * http://www.ietf.org/rfc/rfc2396.txt (RFC explaining URIs).
 *
 * \return 1 if char is a UNRESERVED char.
 */
int is_unreserved(
	/*! [in] Char to be matched for UNRESERVED characters. */
	char in)
{
	if (isalnum(in) || is_mark(in)) {
		return 1;
	} else {
		return 0;
	}
}
コード例 #3
0
ファイル: object.cpp プロジェクト: AdamSpitz/klein
fint MemObj::total_size_in_oops() {
  if (is_activation()) {
    return ((ActivationObj*)this)->total_size_in_oops();
  } else if (is_byteVector()) {
    return ((ByteVectorObj*)this)->total_size_in_oops();
  } else {
    oop_t* start = (oop_t*)this;
    oop_t*   end = start;
    while ( !is_mark(*++end) ) {}
    return end - start;
  }
}
コード例 #4
0
ファイル: prims.cpp プロジェクト: AdamSpitz/klein
oop_t primitive_fail ( oop_t selfStringForPrimitive, oop_t rcvr_for_fail, oop_t error_result, oop_t failBlock, oop_t current_activation, oop_t* activation) {
    assert(is_mark(error_result));
    oop_t error_string = change_tag(error_result, mem_tag);
    oop_t argsp[2] = {error_string, selfStringForPrimitive};

    oop_t selfStringForMessage;

    if (failBlock == badOop) {
        selfStringForMessage = StringObj::intern("primitiveFailedError:Name:");
        *activation = ActivationObj::clone_for_failure(rcvr_for_fail, selfStringForMessage, (oop_t*) argsp, 2, current_activation);
    }
    else {
        rcvr_for_fail = failBlock;
        selfStringForMessage = StringObj::intern("value:With:");
        *activation = ActivationObj::clone_for_failure(rcvr_for_fail, selfStringForMessage, (oop_t*) argsp, 2, current_activation);
    }

    return error_result;
}
コード例 #5
0
ファイル: activation.cpp プロジェクト: AdamSpitz/klein
oop_t ActivationObj::send(bool isImplicitSelf, oop_t sel, bool isUndirected, oop_t delegatee, fint arg_count, oop_t this_act) {
  DECLARE_STACK;
  sp_limit; // unused
  sp -= arg_count;
  smi args_offset = sp;
  oop_t* argsp = oop_addr(io + args_offset);
  oop_t  rcvr = isImplicitSelf  ?  get_self_quickly(io)  :  pop();
  put_sp_quickly(io, sp);

  // todo optimize time slow? -- dmu 1/06
  for (smi i = 0;  i < arg_count;  ++i )
    read_barrier(io + args_offset + i);
  
  oop_t new_act = NULL;

  StringObj* sel_addr = StringObj::from(sel);
  
  // I use this printf so often that I'd like to leave it here (commented out). -- Adam, 5/06
  // printf("sending "); sel_addr->string_print(); printf("\n");
  
  if (sel_addr->bytes()[0] == '_')  {
 
    oop_t result = primitive_send(sel, rcvr, argsp, arg_count, this_act, &new_act);
    // todo optimize time mightHaveScavengedTheActivation:
    // Use a boolean flag to tell if the activation has moved?
    // Look for other places tagged mightHaveScavengedTheActivation. -- Adam, 5/06
    if (!is_mark(result)) {
      ActivationObj* possibly_moved_act_addr = ActivationObj::from(this_act);
      possibly_moved_act_addr->remote_push(result);
    }
  }
  else {
    non_primitive_send(rcvr, argsp, arg_count, isImplicitSelf, sel, isUndirected, delegatee, this_act, &new_act);
  }
  return new_act ? new_act : this_act;
}
コード例 #6
0
ファイル: uric.c プロジェクト: ClearwaterCore/libre-upstream
static bool is_unreserved(char c)
{
	return isalnum(c) || is_mark(c);
}
コード例 #7
0
ファイル: Text_Console.cpp プロジェクト: 2asoft/xray
void CTextConsole::DrawLog( HDC hDC, RECT* pRect )
{
	TEXTMETRIC tm;
	GetTextMetrics(hDC, &tm);

	RECT wRC = *pRect;
	GetClientRect(m_hLogWnd, &wRC);
	FillRect(hDC, &wRC, m_hBackGroundBrush);

	int Width = wRC.right - wRC.left;
	int Height = wRC.bottom - wRC.top;
	wRC = *pRect;
	int y_top_max = (int)(0.32f * Height);

	//---------------------------------------------------------------------------------
	LPCSTR s_edt = ec().str_edit();
	LPCSTR s_cur = ec().str_before_cursor();

	u32 cur_len = xr_strlen( s_cur ) + xr_strlen( ch_cursor ) + 1;
	PSTR buf = (PSTR)_alloca( cur_len * sizeof(char) );
	strcpy_s( buf, cur_len, s_cur );
	strcat_s( buf, cur_len, ch_cursor );
	buf[cur_len-1] = 0;

	u32 cur0_len = xr_strlen( s_cur );

	int xb = 25;
	
	SetTextColor( hDC, RGB(255, 255, 255) );
	TextOut( hDC, xb, Height-tm.tmHeight-1, buf, cur_len-1 );
	buf[ cur0_len ] = 0;
	
	SetTextColor(hDC, RGB(0, 0, 0));
	TextOut( hDC, xb, Height-tm.tmHeight-1, buf, cur0_len );


	SetTextColor( hDC, RGB(255, 255, 255) );
	TextOut( hDC, 0, Height-tm.tmHeight-3, ioc_prompt, xr_strlen(ioc_prompt) ); // ">>> "

	SetTextColor( hDC, (COLORREF)bgr2rgb(get_mark_color( mark11 )) );
	TextOut( hDC, xb, Height-tm.tmHeight-3, s_edt, xr_strlen(s_edt) );

	SetTextColor( hDC, RGB(205, 205, 225) );
	u32 log_line = LogFile->size()-1;
	string16 q, q2;
	itoa( log_line, q, 10 );
	strcpy_s( q2, sizeof(q2), "[" );
	strcat_s( q2, sizeof(q2), q );
	strcat_s( q2, sizeof(q2), "]" );
	u32 qn = xr_strlen( q2 );

	TextOut( hDC, Width - 8 * qn, Height-tm.tmHeight-tm.tmHeight, q2, qn );

	int ypos = Height - tm.tmHeight - tm.tmHeight;
	for( int i = LogFile->size()-1-scroll_delta; i >= 0; --i ) 
	{
		ypos -= tm.tmHeight;
		if ( ypos < y_top_max )
		{
			break;
		}
		LPCSTR ls = ((*LogFile)[i]).c_str();

		if ( !ls )
		{
			continue;
		}
		Console_mark cm = (Console_mark)ls[0];
		COLORREF     c2 = (COLORREF)bgr2rgb( get_mark_color( cm ) );
		SetTextColor( hDC, c2 );
		u8 b = (is_mark( cm ))? 2 : 0;
		LPCSTR pOut = ls + b;

		BOOL res = TextOut( hDC, 10, ypos, pOut, xr_strlen(pOut) );
		if ( !res )
		{
			R_ASSERT2( 0, "TextOut(..) return NULL" );
		}
	}

	if ( g_pGameLevel && ( Device.dwTimeGlobal - m_last_time > 500 ) )
	{
		m_last_time = Device.dwTimeGlobal;

		m_server_info.ResetData();
		g_pGameLevel->GetLevelInfo( &m_server_info );
	}

	ypos = 5;
	for ( u32 i = 0; i < m_server_info.Size(); ++i )
	{
		SetTextColor( hDC, m_server_info[i].color );
		TextOut( hDC, 10, ypos, m_server_info[i].name, xr_strlen(m_server_info[i].name) );

		ypos += tm.tmHeight;
		if ( ypos > y_top_max )
		{
			break;
		}
	}
}