예제 #1
0
static void
cfg_blocks_add (basic_block bb)
{
    gcc_assert (bb != ENTRY_BLOCK_PTR && bb != EXIT_BLOCK_PTR);
    gcc_assert (!TEST_BIT (bb_in_list, bb->index));

    if (cfg_blocks_empty_p ())
    {
        cfg_blocks_tail = cfg_blocks_head = 0;
        cfg_blocks_num = 1;
    }
    else
    {
        cfg_blocks_num++;
        if (cfg_blocks_num > VARRAY_SIZE (cfg_blocks))
        {
            /* We have to grow the array now.  Adjust to queue to occupy the
               full space of the original array.  */
            cfg_blocks_tail = VARRAY_SIZE (cfg_blocks);
            cfg_blocks_head = 0;
            VARRAY_GROW (cfg_blocks, 2 * VARRAY_SIZE (cfg_blocks));
        }
        else
            cfg_blocks_tail = (cfg_blocks_tail + 1) % VARRAY_SIZE (cfg_blocks);
    }

    VARRAY_BB (cfg_blocks, cfg_blocks_tail) = bb;
    SET_BIT (bb_in_list, bb->index);
}
/** Local callback function to enumerate child windows (for various reasons).
VLPARAM is a pointer to a VWLC_ENUM_PARAM struct. This function is internal
to VWindow. The public interface is much cleaner, using functions such as
FindChildWindowByClass(), EnableChildren(), and ShowChildren().*/
static VBOOL CALLBACK vwindow_EnumChildWndProc(	HWND	hWnd,
												VLPARAM	lParam)
{
	VWCL_ENUM_PARAM* pEnumParam = (VWCL_ENUM_PARAM*)lParam;
	VASSERT(pEnumParam)

	/* Determine what we need to do.*/
	switch ( pEnumParam->nMessageOrID )
	{
		case vwindow_ENUM_FIND_CHILD_BY_CLASS:
		{
			/* pEnumParam->pInData is a string.*/
			VSTRING_CONST pszFind = (VSTRING_CONST)pEnumParam->pInData;
			VASSERT(VSTRLEN_CHECK(pszFind))

			/* Get the class of this window.*/
			VTCHAR szClass[50];
			GetClassName(hWnd, szClass, VARRAY_SIZE(szClass));

			/* Did we find a hit?*/
			if ( VSTRCMP_NOCASE(szClass, pszFind) == 0 )
			{
				/* Set the hWnd into the pEnumParam->pOutData
				field and quit.*/
				pEnumParam->pOutData = hWnd;
				return VFALSE;
			}

			break;
		}

		case vwindow_ENUM_ENABLE_CHILD_WINDOWS:
		{
			/* pEnumParam->pInData is a VBOOL, which tells us
			to enable or disable.*/
			EnableWindow(hWnd, (VBOOL)pEnumParam->pInData);
			break;
		}

		case vwindow_ENUM_SHOW_CHILD_WINDOWS:
		{
			/* pEnumParam->pInData is a VBOOL, which tells us
			to show or hide.*/
			ShowWindow(	hWnd,
						(pEnumParam->pInData)
						? SW_SHOWNORMAL
						: SW_HIDE);
			break;
		}
	}

	return VTRUE;
}
예제 #3
0
static basic_block
cfg_blocks_get (void)
{
    basic_block bb;

    bb = VARRAY_BB (cfg_blocks, cfg_blocks_head);

    gcc_assert (!cfg_blocks_empty_p ());
    gcc_assert (bb);

    cfg_blocks_head = (cfg_blocks_head + 1) % VARRAY_SIZE (cfg_blocks);
    --cfg_blocks_num;
    RESET_BIT (bb_in_list, bb->index);

    return bb;
}
	/** Given a string, return VTRUE if it is considered true. The strings
	True, Yes, On and 1 are considered VTRUE, while everything else is
	considered VFALSE, as is NULL.*/
	static VBOOL		IsStringTrue(VSTRING_CONST pszString)
	{
		if ( pszString )
		{
			VSTRING_CONST TRUE_STRINGS[] =
				{
					VTEXT("TRUE"),
					VTEXT("YES"),
					VTEXT("ON"),
					VTEXT("1")
				};

			for ( VUINT i = 0; i < VARRAY_SIZE(TRUE_STRINGS); i++ )
			{
				if ( VSTRCMP_NOCASE(pszString, TRUE_STRINGS[i]) == 0 )
					return VTRUE;
			}
		}

		return VFALSE;
	}
/** Pseudonymns for the above enumeration.*/
enum	{	VHTML_A =			VHTML_ADDRESS,
			VHTML_P =			VHTML_PARAGRAPH,
			VHTML_BR =			VHTML_BREAK,
			VHTML_B =			VHTML_BOLD,
			VHTML_TABLE_CELL =	VHTML_TABLE_DATA,
			VHTML_IMAGE =		VHTML_IMG,
		};

/** Macro to return strings from the VHTML_STRINGS array. In debug builds
these are functions that perform bounds checking. In release builds, they
simply return the string at a given index.*/
#ifdef VWCL_DEBUG
	VSTRING_CONST VHTML_STRING(VUINT nIndex)
	{
		VASSERT(nIndex < VARRAY_SIZE(VHTML_STRINGS))
		return VHTML_STRINGS[nIndex];
	}
#else
	#define	VHTML_STRING(nIndex)	VHTML_STRINGS[nIndex]
#endif

/** Base class for serialization of an HTML stream. This base class sends
all output to the OnStream() virtual function, which sends the output to
VWebServerRequest::SendContent(), if a call has been made to
WebServerRequest(), which sets a pointer to this object. Otherwise, output
will go to stdout. VHTMLStreamBlock can be used to send output a VString
object, which essentially caches the content and then sends it in bulk to
an output device. This can be very important for web werver applications, so
please see VHTMLStreamBlock for more information.*/
class VHTMLStream