Exemplo n.º 1
0
bool CClipboard::SetStringUTF8(
//Copies the given string into the system clipboard
//Returns: true on success, false otherwise.
//
//Params:
	const char *szClip)  //(in)
{
	string sClip = szClip;

	if (!display && !Init())
	{
		//Failed to load X, but at least we can have local clipboard
		sClipBuf = sClip;
		return false;
	}

	FixNewlines(sClip);

	LockDisplay();
	Dyn::XChangeProperty(display, DefaultRootWindow(display), xa.clipboard,
		xa.utf8_string, 8, PropModeReplace, (unsigned char *)sClip.c_str(), sClip.length());
	if (LostScrap())
		Dyn::XSetSelectionOwner(display, xa.clipboard, window, CurrentTime);
	UnlockDisplay();
	UTF8ToAscii(sClip.c_str(), sClip.length(), sClipBuf);
	return true;
}
Exemplo n.º 2
0
// scans the Input into a symbol list
bool opScanner::Scan(FileReadStream& ifs, ScanMode mode, opNode* root) {
    Tokens.Clear();

    ScanError = false;
    CurrentLine = 1;
    ScanComplete = false;
    scanMode = mode;
    Root = root;

    inputtype Input;
    ifs.ReadToContainer(Input);

    FixNewlines(Input);

    int it = 0;

    ScanTokens(Input);

    if (opError::HasErrors()) return false;

    // post scanning stuff
    Preprocessor();
    FixStrings();
    Keyword();

    if (scanMode != SM_DialectMode) {
        BasicType();
        UserDefined();
    }

    ContinueLines();
    Decimals();
    WideStrings();
    FixNumbers();

    if (scanMode == SM_NormalMode) CPlusPlus();

    ScanComplete = true;

    return true;
}