コード例 #1
0
ファイル: dbgbrk.c プロジェクト: groessler/open-watcom-v2
OVL_EXTERN brkp *TypePoint( memory_expr def_seg )
{
    mad_type_handle     th;

    th = ScanType( MAS_MEMORY | MTK_ALL, NULL );
    if( th == MAD_NIL_TYPE_HANDLE ) {
        BadPoint( def_seg );
    }
    return( SetPoint( def_seg, th ) );
}
コード例 #2
0
void ProcModify( void )
{
    const char          *startpos;
    mad_type_handle     mth;
    mad_type_kind       tk;

    if( !AdvMachState( ACTION_MODIFY_MEMORY ) ) {
        FlushEOC();
        return;
    }
    startpos = ScanPos();
    if( CurrToken != T_DIV ) {
        MemMod( GetMADTypeHandleDefaultAt( NilAddr, MTK_BASIC ), MAS_MEMORY );
    } else {
        Scan();
        mth = ScanType( MAS_ALL | MTK_ALL, &tk );
        if( mth == MAD_NIL_TYPE_HANDLE ) {
            Error( ERR_LOC, LIT_ENG( ERR_BAD_OPTION ), GetCmdName( CMD_MODIFY ) );
        }
        MemMod( mth, tk );
    }
    RecordCommand( startpos, CMD_MODIFY );
}
コード例 #3
0
ファイル: DateTime.cpp プロジェクト: cloudflare/pngoptimizer
//////////////////////////////////////////////////////////////////////
// Gets date as YYYY-MM-DD hh:mm:ss
// Works if last parts are missing, for instance : YYYY-MM
// Returns the number of read members
int32 DateTime::Scan(const String& strDate)
{
	//int count = strDate.Scan("%?-%?-%? %?:%?:%?", m_year, m_month, m_day, m_hour, m_minute, m_second);
	
	const wchar* psz = strDate.GetBuffer();
	int32 advance = 0;
	
	FixArray<bool, 12> abParseStatus;

	abParseStatus[0] = ScanType(psz, advance, L' ', &m_year);
	abParseStatus[1] = psz[advance] == L'-';
	advance++;
	
	abParseStatus[2] = ScanType(psz, advance, L' ', &m_month);
	abParseStatus[3] = psz[advance] == L'-';
	advance++;

	abParseStatus[4] = ScanType(psz, advance, L' ', &m_day);
	abParseStatus[5] = psz[advance] == L' ';
	advance++;

	abParseStatus[6] = ScanType(psz, advance, L' ', &m_hour);
	abParseStatus[7] = psz[advance] == L':';
	advance++;

	abParseStatus[8] = ScanType(psz, advance, L' ', &m_minute);
	abParseStatus[9] = psz[advance] == L':';
	advance++;

	abParseStatus[10] = ScanType(psz, advance, L' ', &m_second);
	abParseStatus[11] = true;
	
	int count = 0;
	for(int i = 0; i < abParseStatus.GetSize(); i += 2)
	{
		if( !abParseStatus[i] )
			break;

		count++;
	}

	/////////////////////////////////////////////////////////////////
	// Check fields integrity
	if( count >= 6 && !( m_second <= 59) )
	{
		count = 5;
	}
	if( count >= 5 && !( m_minute <= 59) )
	{
		count = 4;
	}
	if( count >= 4 && !( m_hour <= 23) )
	{
		// Just take the year, the month and the day as the hour is invalid
		count = 3;
	}
	if( count >= 3 && !( 1 <= m_day && m_day <= 31) )
	{
		// Just take the year and the month as the day is invalid
		count = 2;
	}
	if( count >= 2 && !( 1 <= m_month && m_month <= 12) )
	{
		// Just take the year as the month is invalid
		count = 1;
	}
	/////////////////////////////////////////////////////////////////

	uint8* const apn[] = {null, &m_month, &m_day, &m_hour, &m_minute, &m_second };
	int32 iClear = count;

	for(; iClear < 3; ++iClear)
	{
		apn[iClear][0] = 1;
	}

	for(; iClear < 6; ++iClear)
	{
		apn[iClear][0] = 0;
	}

	UpdateStampFromFields();

	return count;
}