Beispiel #1
0
const variable operator +(const variable &left_value, 
						  const variable &right_value)
{
	if (_STYLE(left_value.type) != _STYLE(right_value.type))
		throw VARIABLE_OPERATION_ERROR;

	if (OBJ == left_value.type)
		throw VARIABLE_OPERATION_ERROR;

	type_ type;
	
	if (STR == _EVT(left_value.type))
		type = left_value.type;
	else
		type = _LEN(left_value.type) >= _LEN(right_value.type) 
			? left_value.type : right_value.type;

	try
	{
		switch (_EVT(type))
		{
		case B_1:
			return variable(((b_1)left_value)	+ ((b_1)right_value));
		case UB_1:
			return variable(((ub_1)left_value)	+ ((ub_1)right_value));
		case B_2:
			return variable(((b_2)left_value)	+ ((b_2)right_value));
		case UB_2:
			return variable(((ub_2)left_value)	+ ((ub_2)right_value));
		case B_4:
			return variable(((b_4)left_value)	+ ((b_4)right_value));
		case UB_4:
			return variable(((ub_4)left_value)	+ ((ub_4)right_value));
		case B_8:
			return variable(((b_8)left_value)	+ ((b_8)right_value));
		case UB_8:
			return variable(((ub_8)left_value)	+ ((ub_8)right_value));
		case FB_4:
			return variable(((fb_4)left_value)	+ ((fb_4)right_value));
		case FB_8:
			return variable(((fb_8)left_value)	+ ((fb_8)right_value));
		case STR:
			{
				string str((const ch_1 *)left_value);

				str += (const ch_1 *)right_value;

				return variable(str);
			}
		default:
			throw VARIABLE_OPERATION_ERROR;
		}
	}
	catch (...)
	{
		throw;
	}
}
Beispiel #2
0
const b_4 operator <(const variable &left_value, const variable &right_value)
{
	if (_STYLE(left_value.type) != _STYLE(right_value.type))
		throw VARIABLE_OPERATION_ERROR;

	if (OBJ == left_value.type)
		throw VARIABLE_OPERATION_ERROR;

	type_ type;
	
	if (STR == _EVT(left_value.type))
		type = left_value.type;
	else
		type = _LEN(left_value.type) >= _LEN(right_value.type) 
			? left_value.type : right_value.type;

	try
	{
		switch (_EVT(type))
		{
		case B_1:
			return ((b_1)left_value)	< ((b_1)right_value);
		case UB_1:
			return ((ub_1)left_value)	< ((ub_1)right_value);
		case B_2:
			return ((b_2)left_value)	< ((b_2)right_value);
		case UB_2:
			return ((ub_2)left_value)	< ((ub_2)right_value);
		case B_4:
			return ((b_4)left_value)	< ((b_4)right_value);
		case UB_4:
			return ((ub_4)left_value)	< ((ub_4)right_value);
		case B_8:
			return ((b_8)left_value)	< ((b_8)right_value);
		case UB_8:
			return ((ub_8)left_value)	< ((ub_8)right_value);
		case FB_4:
			return ((fb_4)left_value)	< ((fb_4)right_value);
		case FB_8:
			return ((fb_8)left_value)	< ((fb_8)right_value);
		case STR:
			return strcmp((const ch_1 *)left_value,
						  (const ch_1 *)right_value) < 0;
		default:
			throw VARIABLE_OPERATION_ERROR;
		}
	}
	catch (...)
	{
		throw;
	}
}
Beispiel #3
0
const variable operator -(const variable &left_value, 
						  const variable &right_value)
{
	if (_STYLE(left_value.type) != _STYLE(right_value.type))
		throw VARIABLE_OPERATION_ERROR;

	if (OBJ == left_value.type || STR == _EVT(left_value.type))
		throw VARIABLE_OPERATION_ERROR;

	type_ type = _LEN(left_value.type) >= _LEN(right_value.type) 
		? left_value.type : right_value.type;

	try
	{
		switch (_EVT(type))
		{
		case B_1:
			return variable(((b_1)left_value)	- ((b_1)right_value));
		case UB_1:
			return variable(((ub_1)left_value)	- ((ub_1)right_value));
		case B_2:
			return variable(((b_2)left_value)	- ((b_2)right_value));
		case UB_2:
			return variable(((ub_2)left_value)	- ((ub_2)right_value));
		case B_4:
			return variable(((b_4)left_value)	- ((b_4)right_value));
		case UB_4:
			return variable(((ub_4)left_value)	- ((ub_4)right_value));
		case B_8:
			return variable(((b_8)left_value)	- ((b_8)right_value));
		case UB_8:
			return variable(((ub_8)left_value)	- ((ub_8)right_value));
		case FB_4:
			return variable(((fb_4)left_value)	- ((fb_4)right_value));
		case FB_8:
			return variable(((fb_8)left_value)	- ((fb_8)right_value));
		default:
			throw VARIABLE_OPERATION_ERROR;
		}
	}
	catch (...)
	{
		throw;
	}
}
Beispiel #4
0
const variable operator ^(const variable &left_value, const variable &right_value)
{
	if (NORMAL_STYLE != _STYLE(left_value.type) ||
		NORMAL_STYLE != _STYLE(right_value.type))
	{
		throw VARIABLE_OPERATION_ERROR;
	}

	type_ type = _LEN(left_value.type) >= _LEN(right_value.type) 
		? left_value.type : right_value.type;

	try
	{
		switch (_EVT(type))
		{
		case B_1:
			return variable(((b_1)left_value)	^ ((b_1)right_value));
		case UB_1:	
			return variable(((ub_1)left_value)	^ ((ub_1)right_value));
		case B_2:
			return variable(((b_2)left_value)	^ ((b_2)right_value));
		case UB_2:	
			return variable(((ub_2)left_value)	^ ((ub_2)right_value));
		case B_4:	
			return variable(((b_4)left_value)	^ ((b_4)right_value));
		case UB_4:
			return variable(((ub_4)left_value)	^ ((ub_4)right_value));
		case B_8:
			return variable(((b_8)left_value)	^ ((b_8)right_value));
		case UB_8:
			return variable(((ub_8)left_value)	^ ((ub_8)right_value));
		default:
			throw VARIABLE_OPERATION_ERROR;
		}
	}
	catch (...)
	{
		throw;
	}
}
Beispiel #5
0
void FB_STC::LoadSettings ( ) {
    FB_Config    * Prefs  = m_Ide->GetConfig();
    Style_STC_FB * Style  = &Prefs->Style_FB;

    // Clear all styles there might be defined
    StyleClearAll(  );
    SetLexer( 0 );
    
    // Tab and indenting
    SetTabWidth             ( Prefs->TabSize );
    SetUseTabs              ( false );
    SetTabIndents           ( true );
    SetBackSpaceUnIndents   ( true );
    SetIndent               ( Prefs->TabSize );
    SetIndentationGuides    ( Prefs->IndentGuide );
    
    // Right margin
    SetEdgeMode   ( Prefs->RightMargin ? wxSTC_EDGE_LINE: wxSTC_EDGE_NONE );
    SetEdgeColumn ( Prefs->EdgeColumn );
    
    // Line and line ending
    SetEOLMode ( 0 );
    SetViewEOL ( Prefs->DisplayEOL );
    SetViewWhiteSpace ( Prefs->WhiteSpace ? wxSTC_WS_VISIBLEALWAYS: wxSTC_WS_INVISIBLE );
    
    // Misc
    CmdKeyClear (wxSTC_KEY_TAB, 0);
    #define _STYLE(nr) Style->Style[nr]
        wxFont font ( _STYLE(0).Size, wxMODERN, wxNORMAL, wxNORMAL, false, _STYLE(0).Font );

        StyleSetForeground (wxSTC_STYLE_DEFAULT,    Prefs->GetClr(_STYLE(0).Face));
        StyleSetBackground (wxSTC_STYLE_DEFAULT,    Prefs->GetClr(_STYLE(0).Back));
        StyleSetFont( wxSTC_STYLE_DEFAULT, font );

        StyleSetForeground (0,    Prefs->GetClr(_STYLE(0).Face));
        StyleSetBackground (0,    Prefs->GetClr(_STYLE(0).Back));
        StyleSetFont( 0, font );
        
        StyleSetForeground (wxSTC_STYLE_LINENUMBER, Prefs->GetClr(Style->LineNumberFace));
        StyleSetBackground (wxSTC_STYLE_LINENUMBER, Prefs->GetClr(Style->LineNumberBack));
        StyleSetFont( wxSTC_STYLE_LINENUMBER, font );
                    
        SetCaretForeground (Prefs->GetClr(Style->CaretFace));
        SetSelForeground(true, Prefs->GetClr(Style->SelectFace));
        SetSelBackground(true, Prefs->GetClr(Style->SelectBack));
    #undef STYLE

    int LineNrMargin = TextWidth(wxSTC_STYLE_LINENUMBER, _T("0001"));
    SetMarginWidth (0, Prefs->LineNumber ? LineNrMargin : 0);
    SetMarginWidth (1,0);

    if ( Prefs->CurrentLine )
    {
        SetCaretLineVisible( true );
        SetCaretLineBack( Prefs->GetClr( Style->CaretLine ) );
    }

}
Beispiel #6
0
void FB_Config::LoadFBTheme ( wxString file ) 
{
    
    wxFileInputStream input( file );
    wxFileConfig Theme( input );
    
	wxString StyleTypes[]={	"default", 	    "comment", 	   "number",
                            "keyword",      "string",      "preprocessor",
							"operator", 	"identifier",  "date",
                            "stringeol",    "keyword2",    "keyword3",
                            "keyword4",     "constant",    "asm" };

    #define _STYLE(nr) Style_FB.Style[nr]
        Theme.SetPath("/default");
        _STYLE(0).Face          = Theme.Read("foreground",  0L);
        _STYLE(0).Back          = Theme.Read("background",  0xffffff);
        _STYLE(0).Case          = Theme.Read("capital",     0L);
        _STYLE(0).Size          = Theme.Read("fontsize",    10L);
        _STYLE(0).Style         = Theme.Read("fontstyle",   0L);
        _STYLE(0).Font          = Theme.Read("font",        "" );
    
        Theme.SetPath("/caret");
        Style_FB.CaretFace      = Theme.Read("caret",       _STYLE(0).Face);
        Style_FB.CaretLine      = Theme.Read("caretline",   _STYLE(0).Back);
       
    	//Line number
        Theme.SetPath("/linenumber");
        Style_FB.LineNumberFace = Theme.Read("foreground",  0xffffff);
        Style_FB.LineNumberBack = Theme.Read("background",  0xc0c0c0);
    	
        Theme.SetPath("/select");
        Style_FB.SelectFace     = Theme.Read("foreground",  0xffffff);
        Style_FB.SelectBack     = Theme.Read("background",  0xc0c0c0);
        
        Theme.SetPath("/brace");
        Style_FB.BraceFace      = Theme.Read("foreground",  _STYLE(0).Back);
        Style_FB.BraceBack      = Theme.Read("background",  _STYLE(0).Face);
        Style_FB.BraceStyle     = Theme.Read("fontstyle",   0L);
        
        Theme.SetPath("/badbrace");
        Style_FB.BadBraceFace   = Theme.Read("foreground",  _STYLE(0).Back);
        Style_FB.BadBraceBack   = Theme.Read("background",  _STYLE(0).Face);
        Style_FB.BadBraceStyle  = Theme.Read("fonstyle",    0L);
        
        for (int i=1; i<15;i++) {
            Theme.SetPath("/" + StyleTypes[i]);
            _STYLE(i).Face          = Theme.Read("foreground",  _STYLE(0).Face);
            _STYLE(i).Back          = Theme.Read("background",  _STYLE(0).Back);
            _STYLE(i).Case          = Theme.Read("capital",     _STYLE(0).Case);
            _STYLE(i).Size          = Theme.Read("fontsize",    _STYLE(0).Size);
            _STYLE(i).Style         = Theme.Read("fontstyle",   _STYLE(0).Style);
            _STYLE(i).Font          = Theme.Read("font",        _STYLE(0).Font);
        }
    #undef _STYLE
}