コード例 #1
0
void CppInliner::inlineCode(const vector<string>& cppFilePaths, const string& outputFilePath) const {
    const string concatStage{pathConcat(temporaryDirectory, "concat.cpp")};
    const string inlinedStage{pathConcat(temporaryDirectory, "inlined.cpp")};

    concatFiles(cppFilePaths, concatStage);

    internal::Inliner inliner{clangCompilationOptions};
    std::string inlinedCode{inliner.doInline(concatStage)};
    removePragmaOnce(inlinedCode, inlinedStage);

    internal::Optimizer optimizer{clangCompilationOptions, macrosToKeep};
    std::string onlyReachableCode{optimizer.doOptimize(inlinedStage)};
    removeEmptyLines(onlyReachableCode, maxConsequentEmptyLines, outputFilePath);
}
コード例 #2
0
/*
 *parseAnalyzeMdfFile function
 *
 *file : a pointer to file MDF file descriptor
 *
 *this function will take a MDF file descriptor and return
 *a pointer to a MDF struct represinting the information in the file
 */
struct MDF *parseAnalyzeMdfFile(FILE *file)
{
  int max_nol;
  char **arr;
  char **arr2;
  char **arr3;
  struct MDF *res;

  max_nol = numberOfLines(file);
  rewind(file);
  arr = getArrayOfLines(file, max_nol, 1000);
  fclose(file);

  arr2 = removeComments(arr, max_nol, 1000);
  freeCharArray(arr, max_nol);
  arr3 = removeEmptyLines(arr2, max_nol, 1000);
  freeCharArray(arr2, max_nol);

  res = createMDF(arr3);
  freeCharArray(arr3, max_nol);

  return res;
}
コード例 #3
0
ファイル: appeditmenu.cpp プロジェクト: rovshan-b/oraexp
void AppEditMenu::createEditAdvancedMenu(QToolBar *toolbar)
{
    editAdvancedMenu = new QMenu(tr("Advanced"));

    editCommentAction=editAdvancedMenu->addAction(IconUtil::getIcon("comment"), tr("Co&mment/Uncomment"), this, SLOT(comment()), QKeySequence("Ctrl+/"));
    editCommentAction->setStatusTip(tr("Comment/Uncomment line(s)"));
    toolbar->addAction(editCommentAction);

    editMoveUpAction=editAdvancedMenu->addAction(IconUtil::getIcon("move_up"), tr("Move &up"), this, SLOT(moveUp()), QKeySequence("Ctrl+Up"));
    editMoveUpAction->setStatusTip(tr("Move lines(s) up"));
    toolbar->addAction(editMoveUpAction);

    editMoveDownAction=editAdvancedMenu->addAction(IconUtil::getIcon("move_down"), tr("Move &down"), this, SLOT(moveDown()), QKeySequence("Ctrl+Down"));
    editMoveDownAction->setStatusTip(tr("Move lines(s) down"));
    toolbar->addAction(editMoveDownAction);

    editSelectBlockAction=editAdvancedMenu->addAction(tr("Select current block"), this, SLOT(selectBlock()), QKeySequence("Ctrl+B"));
    editSelectBlockAction->setStatusTip(tr("Select current block"));

    editToUpperCaseAction=editAdvancedMenu->addAction(tr("To upper case"), this, SLOT(toUpperCase()), QKeySequence("Ctrl+U"));
    editToUpperCaseAction->setStatusTip(tr("Change selection or current word text to upper case"));

    editToLowerCaseAction=editAdvancedMenu->addAction(tr("To lower case"), this, SLOT(toLowerCase()), QKeySequence("Ctrl+L"));
    editToLowerCaseAction->setStatusTip(tr("Change selection or current word text to lower case"));

    editCreateDuplicateAction=editAdvancedMenu->addAction(tr("Make duplicate"), this, SLOT(makeDuplicate()), QKeySequence("Ctrl+D"));
    editCreateDuplicateAction->setStatusTip(tr("Create duplicate of current line or selection"));

    editRemoveEmptyLinesAction=editAdvancedMenu->addAction(tr("Remove empty lines"), this, SLOT(removeEmptyLines()), QKeySequence("Ctrl+R"));
    editRemoveEmptyLinesAction->setStatusTip(tr("Remove empty lines"));

    editApplyCaseFoldingAction=editAdvancedMenu->addAction(tr("Apply case folding"), this, SLOT(applyCaseFolding()), QKeySequence("Ctrl+Shift+U"));
    editApplyCaseFoldingAction->setStatusTip(tr("Apply automatic case folding rules to selection"));

    editFormatCodeAction=editAdvancedMenu->addAction(tr("Format"), this, SLOT(formatCode()), QKeySequence("Ctrl+Shift+F"));
    editFormatCodeAction->setStatusTip(tr("Auto format code to make it more readable"));
}
コード例 #4
0
ファイル: Compare.cpp プロジェクト: tititiou36/Compare-plugin
extern "C" __declspec(dllexport) void beNotified(SCNotification *notifyCode)
{
    long start, end;

    switch (notifyCode->nmhdr.code) 
    {
    case SCN_PAINTED:
        if(active) 
        {            
            start = SendMessage(nppData._scintillaMainHandle, SCI_GETFIRSTVISIBLELINE, 0, 0);
            end   = SendMessage(nppData._scintillaMainHandle, SCI_LINESONSCREEN, 0, 0) + start;

            if((start_old != start) && (NavDlg.ReadyToDraw == TRUE))
            {
                NavDlg.DrawView(start, end);
                start_old = start;
            }
        }
        break;

    case NPPN_TBMODIFICATION:
        {         
            tbNext.hToolbarBmp = (HBITMAP)::LoadImage((HINSTANCE)g_hModule, MAKEINTRESOURCE(IDB_NEXT), IMAGE_BITMAP, 0, 0, (LR_LOADTRANSPARENT | LR_DEFAULTSIZE | LR_LOADMAP3DCOLORS));
            tbPrev.hToolbarBmp = (HBITMAP)::LoadImage((HINSTANCE)g_hModule, MAKEINTRESOURCE(IDB_PREV), IMAGE_BITMAP, 0, 0, (LR_LOADTRANSPARENT | LR_DEFAULTSIZE | LR_LOADMAP3DCOLORS));
            tbFirst.hToolbarBmp = (HBITMAP)::LoadImage((HINSTANCE)g_hModule, MAKEINTRESOURCE(IDB_FIRST), IMAGE_BITMAP, 0, 0, (LR_LOADTRANSPARENT | LR_DEFAULTSIZE | LR_LOADMAP3DCOLORS));
            tbLast.hToolbarBmp = (HBITMAP)::LoadImage((HINSTANCE)g_hModule, MAKEINTRESOURCE(IDB_LAST), IMAGE_BITMAP, 0, 0, (LR_LOADTRANSPARENT | LR_DEFAULTSIZE | LR_LOADMAP3DCOLORS));

			::SendMessage(nppData._nppHandle, NPPM_ADDTOOLBARICON, (WPARAM)funcItem[CMD_FIRST]._cmdID, (LPARAM)&tbFirst);
            ::SendMessage(nppData._nppHandle, NPPM_ADDTOOLBARICON, (WPARAM)funcItem[CMD_PREV]._cmdID, (LPARAM)&tbPrev);
            ::SendMessage(nppData._nppHandle, NPPM_ADDTOOLBARICON, (WPARAM)funcItem[CMD_NEXT]._cmdID, (LPARAM)&tbNext);
            ::SendMessage(nppData._nppHandle, NPPM_ADDTOOLBARICON, (WPARAM)funcItem[CMD_LAST]._cmdID, (LPARAM)&tbLast);

            ::SendMessage(nppData._nppHandle, NPPM_SETMENUITEMCHECK, funcItem[CMD_ALIGN_MATCHES]._cmdID, (LPARAM)Settings.AddLine);
            ::SendMessage(nppData._nppHandle, NPPM_SETMENUITEMCHECK, funcItem[CMD_IGNORE_SPACING]._cmdID, (LPARAM)Settings.IncludeSpace);
            ::SendMessage(nppData._nppHandle, NPPM_SETMENUITEMCHECK, funcItem[CMD_DETECT_MOVES]._cmdID, (LPARAM)Settings.DetectMove);
            ::SendMessage(nppData._nppHandle, NPPM_SETMENUITEMCHECK, funcItem[CMD_USE_NAV_BAR]._cmdID, (LPARAM)Settings.UseNavBar);

            break;
        }

    case NPPN_FILEBEFORECLOSE:
    case NPPN_FILECLOSED:
    case NPPN_FILEBEFOREOPEN:
    case NPPN_FILEOPENED:
        {
        notepadVersionOk = true;
        break;
        }

    case NPPN_FILEBEFORESAVE:
        {
            notepadVersionOk = true;

            SendMessage(nppData._nppHandle, NPPM_GETFULLCURRENTPATH, 0, (LPARAM)emptyLinesDoc);

            HWND window = getCurrentWindow();						
            int win = SendMessageA(window, SCI_GETDOCPOINTER, 0,0);

            if(getCompare(win)!=-1)
            {				
                topLine = SendMessageA(window,SCI_GETFIRSTVISIBLELINE,0,0);
                lastEmptyLines = removeEmptyLines(window,true);
            }
            else
            {
                lastEmptyLines=NULL;
            }

            break;
        }

    case NPPN_FILESAVED:
        {
            notepadVersionOk = true;
            TCHAR name[MAX_PATH];
            SendMessage(nppData._nppHandle,NPPM_GETFULLCURRENTPATH,0,(LPARAM)name);

            if(lastEmptyLines != NULL && lstrcmp(name, emptyLinesDoc) == 0)
            {
                HWND window = getCurrentWindow();
                ::addBlankLines(window,lastEmptyLines);
                int linesOnScreen = SendMessageA(window,SCI_LINESONSCREEN,0,0);
                int curPosBeg = ::SendMessageA(window, SCI_GETSELECTIONSTART, 0, 0);
                int curPosEnd = ::SendMessageA(window, SCI_GETSELECTIONEND, 0, 0);
                SendMessageA(window,SCI_GOTOLINE,topLine,0);
                SendMessageA(window,SCI_GOTOLINE,topLine+linesOnScreen-1,0);
                SendMessageA(window, SCI_SETSEL, curPosBeg, curPosEnd);
                cleanEmptyLines(lastEmptyLines);
                delete lastEmptyLines;
                lastEmptyLines = NULL;
                emptyLinesDoc[0] = 0;
            }
        }
        break;
	case NPPN_SHUTDOWN:
		{
			// Always close it, else N++'s plugin manager would call 'ViewNavigationBar'
			// on startup, when N++ has been shut down before with opened navigation bar
			if (NavDlg.isVisible())
				NavDlg.doDialog(false);
			break;
		}
    }
}