void postProcessingDate(LPFIELDSRESULTS lpFieldsResults){ char *resultsStr = lpFieldsResults->result; int i; int iStart, iStop; // char Date[20]; resultTmp[0] = 0; cand2Tmp[0] = 0; // test every line i = 0; while(1){ if(getLine(resultsStr, i, &iStart, &iStop) < 0) break; if(matchDayMega(resultsStr, iStart, iStop) == 1){ copyLine(lpFieldsResults, iStart, iStop); cleanDateMega(); addLineToTmp(); break; } if(matchDayPower(resultsStr, iStart, iStop) == 1){ copyLine(lpFieldsResults, iStart, iStop); cleanDatePower(); addLineToTmp(); break; } i++; } // strlen(resultTmp); copyResultsBack(lpFieldsResults); return; }
//Bu fonksiyon copyLine fonksiyonu kullanarak 2 boyoutlu matris içinde bir satır ekliyor. //Son satır itibaren her satır için sonraki stır'a kopylanıyor. sonra yeni satır kendi yerinde kopylanıyor. //Böylece bizim ekleyeceğğimiz satır döğru yerinde olacak void insertLine (char destination[MAX_ROWS][MAX_COLUMNS][MAX_CHARS], int index, char line[MAX_COLUMNS][MAX_CHARS]){ int i; for(i=Height;i>index;i--){ copyLine(destination+i-1,destination+i); } copyLine(line,destination+index); }
void Surface::vgaCreateDialog(bool blackFlag) { byte *pSrc = int_dialog_frame->data(); byte *pDest = _data->data(); uint16 xCenter = _width - VGA_DIALOG_EDGE_WIDTH * 2; uint16 yCenter = _height - VGA_DIALOG_EDGE_WIDTH * 2; int y; // Dialog top for (y = 0; y < 9; ++y) { copyLine(pSrc, pDest, VGA_DIALOG_EDGE_WIDTH - 2, xCenter + 2, VGA_DIALOG_EDGE_WIDTH); pSrc += (VGA_DIALOG_EDGE_WIDTH - 2) + 1 + VGA_DIALOG_EDGE_WIDTH; pDest += _width; } // Dialog sides - note that the same source data gets used for all side lines for (y = 0; y < yCenter; ++y) { copyLine(pSrc, pDest, VGA_DIALOG_EDGE_WIDTH, xCenter, VGA_DIALOG_EDGE_WIDTH); pDest += _width; } pSrc += VGA_DIALOG_EDGE_WIDTH * 2 + 1; // Dialog bottom for (y = 0; y < 9; ++y) { copyLine(pSrc, pDest, VGA_DIALOG_EDGE_WIDTH, xCenter + 1, VGA_DIALOG_EDGE_WIDTH - 1); pSrc += VGA_DIALOG_EDGE_WIDTH + 1 + (VGA_DIALOG_EDGE_WIDTH - 1); pDest += _width; } // Final processing - if black flag set, clear dialog inside area if (blackFlag) { Common::Rect r = Common::Rect(VGA_DIALOG_EDGE_WIDTH, VGA_DIALOG_EDGE_WIDTH, _width - VGA_DIALOG_EDGE_WIDTH, _height-VGA_DIALOG_EDGE_WIDTH); fillRect(r, 0); } }
int postProcessingDateA(LPFIELDSRESULTS lpFieldsResults){ char *resultsStr = lpFieldsResults->result; int i; int iStart, iStop; int line; int ccM, ccP, ccMmax, ccPmax; int lineMmax, linePmax; // char Date[20]; resultTmp[0] = 0; cand2Tmp[0] = 0; // test every line i = 0; line = -1; ccMmax= 0; ccPmax = 0; lineMmax = -1; linePmax = -1; while(1){ if(getLine(resultsStr, i, &iStart, &iStop) < 0) break; ccM = matchDayMegaA(resultsStr, iStart, iStop); if(ccMmax < ccM) {ccMmax = ccM;lineMmax = i;} ccP = matchDayPowerA(resultsStr, iStart, iStop); if(ccPmax < ccP) {ccPmax = ccP;linePmax = i;} //printLine(resultsStr, iStart, iStop); //printf("-------ccM= %d, ccP= %d\n", ccM, ccP); i++; } if(ccMmax > ccPmax) { if(getLine(resultsStr, lineMmax, &iStart, &iStop) >= 0) { //printLine(resultsStr, iStart, iStop); //printf("-------Mega= \n"); // printLine(resultsStr, iStart, iStop); copyLine(lpFieldsResults, iStart, iStop); cleanDateMega(); addLineToTmp(); line = lineMmax; } } if(ccMmax < ccPmax) { if(getLine(resultsStr, linePmax, &iStart, &iStop) >= 0) { //printf("-------Power= \n"); //printLine(resultsStr, iStart, iStop); copyLine(lpFieldsResults, iStart, iStop); cleanDatePower(); addLineToTmp(); line = linePmax; } } // i++; // } // strlen(resultTmp); // copyResultsBack(lpFieldsResults); lpFieldsResults->name[strlen(lpFieldsResults->name)-1] = 0; return line; }
void test_tokenizer(char *inputstr) { int inputstrlen = strlen(inputstr); char *ptr = inputstr; int ptrlen = inputstrlen; char outbuff[1024]; int outbufflen = 1024; int bytesRead = 0; int linenumber = 1; do { int nchars = copyLine(ptr, ptrlen, (unsigned char *)outbuff, outbufflen, &bytesRead); ptr += bytesRead; ptrlen -= bytesRead; outbuff[nchars] = 0; // tokenize the line AsmLine lineinfo; tokenizeAsmLine(&lineinfo, outbuff, nchars, linenumber); printAsmLine(&lineinfo); linenumber++; } while (bytesRead > 0); }
int postProcessingDateD(LPFIELDSRESULTS lpFieldsResults){ char *resultsStr = lpFieldsResults->result; int i; int iStart, iStop; int line; int ccY, ccYmax; int lineYmax; resultTmp[0] = 0; cand2Tmp[0] = 0; // test every line i = 0; line = -1; ccYmax= 0; lineYmax = -1; while(1){ if(getLine(resultsStr, i, &iStart, &iStop) < 0) break; ccY = matchToStringEnd(resultsStr, iStart, iStop, "201"); if(ccYmax < ccY) {ccYmax = ccY;lineYmax = i;} i++; } if(ccYmax > 1) { if(getLine(resultsStr, lineYmax, &iStart, &iStop) >= 0) { copyLine(lpFieldsResults, iStart, iStop); cleanDateMega(); addLineToTmp(); line = lineYmax; } } // lpFieldsResults->name[strlen(lpFieldsResults->name)-1] = 0; return line; }
/*--------------------------------------------------------------------------*/ void pasteClipBoard(void) { HGLOBAL hGMem = NULL; LPSTR lpMem; /* Ptr on clipboard */ int typeClipboard = CF_TEXT; OpenClipboard(NULL); hGMem = GetClipboardData (typeClipboard); if (hGMem) { char *CurrentLine = getCurrentLine(); lpMem = (LPSTR)GlobalLock( hGMem ); if (lpMem) { char *newline = (char*)MALLOC(sizeof(char) * (strlen(CurrentLine) + strlen(lpMem) + 1)); memset(newline, 0x00, strlen(CurrentLine) + strlen(lpMem) + 1); strncpy(newline, CurrentLine, cur_pos); strcat(newline, lpMem); clearCurrentLine(); copyLine(newline); FREE(newline); } GlobalUnlock (hGMem); FREE(CurrentLine); } CloseClipboard (); }
/*--------------------------------------------------------------------------*/ void putLineSearchedHistory(void) { char *line = NULL; char *token = getCurrentLine(); if (token) { if ( (int)strlen(token) > 1 ) { setSearchedTokenInScilabHistory(&token[1]); line = getNextLineInScilabHistory(); } FREE(token); token = NULL; } clearCurrentLine(); if (line) { copyLine(line); FREE(line); line = NULL; } }
void VCardLineTest::shouldCopyValue() { KContacts::VCardLine line; const QString identifier(QStringLiteral("foo")); const QString group(QStringLiteral("bla")); line.setIdentifier(identifier); line.setGroup(group); QMap<QString, QString> map; for (int i = 0; i < 5; ++i) { map.insert(QStringLiteral("foo%1").arg(i), QStringLiteral("bla%1").arg(i)); line.addParameter(QStringLiteral("foo%1").arg(i), QStringLiteral("bla%1").arg(i)); } const QVariant valueVariant = QVariant(QStringLiteral("a")); line.setValue(valueVariant); QVERIFY(!line.parameterList().isEmpty()); QCOMPARE(line.parameterList(), QStringList() << map.keys()); QCOMPARE(line.identifier(), identifier); QCOMPARE(line.group(), group); QCOMPARE(line.value(), valueVariant); KContacts::VCardLine copyLine(line); QVERIFY(!copyLine.parameterList().isEmpty()); QCOMPARE(copyLine.parameterList(), QStringList() << map.keys()); QCOMPARE(copyLine.identifier(), identifier); QCOMPARE(copyLine.group(), group); QCOMPARE(copyLine.value(), valueVariant); }
static void blitNormal(SkBitmap* bm, const SavedImage* frame, const ColorMapObject* cmap, int transparent) { int width = bm->width(); int height = bm->height(); const unsigned char* src = (unsigned char*)frame->RasterBits; uint32_t* dst = bm->getAddr32(frame->ImageDesc.Left, frame->ImageDesc.Top); GifWord copyWidth = frame->ImageDesc.Width; if (frame->ImageDesc.Left + copyWidth > width) { copyWidth = width - frame->ImageDesc.Left; } GifWord copyHeight = frame->ImageDesc.Height; if (frame->ImageDesc.Top + copyHeight > height) { copyHeight = height - frame->ImageDesc.Top; } int srcPad, dstPad; dstPad = width - copyWidth; srcPad = frame->ImageDesc.Width - copyWidth; for (; copyHeight > 0; copyHeight--) { copyLine(dst, src, cmap, transparent, copyWidth); src += frame->ImageDesc.Width; dst += width; } }
/*--------------------------------------------------------------------------*/ void redrawLine(void) { int i =0; char *line = getCurrentLine(); displayPrompt(); for (i = max_pos; i > cur_pos; i--) backSpace (); if (line) { copyLine(line); FREE(line); line = NULL; } }
static void copyInterlaceGroup(SkBitmap* bm, const unsigned char*& src, const ColorMapObject* cmap, int transparent, int copyWidth, int copyHeight, const GifImageDesc& imageDesc, int rowStep, int startRow) { int row; // every 'rowStep'th row, starting with row 'startRow' for (row = startRow; row < copyHeight; row += rowStep) { uint32_t* dst = bm->getAddr32(imageDesc.Left, imageDesc.Top + row); copyLine(dst, src, cmap, transparent, copyWidth); src += imageDesc.Width; } // pad for rest height src += imageDesc.Width * ((imageDesc.Height - row + rowStep - 1) / rowStep); }
void test_streamer() { char * str = "The quick\r\nbrown fox\r\njumped over\r\nthe lazy dogs\r\nback"; char * ptr = str; int ptrlen = strlen(ptr); unsigned char outbuff[1024]; int outbufflen = 1024; int bytesRead = 0; while (int nchars = copyLine(ptr, ptrlen, outbuff, outbufflen, &bytesRead)){ ptr += bytesRead; ptrlen -= bytesRead; outbuff[nchars] = 0; printf("LINE: %s\n", (char *)outbuff); } }
int main (){ char line[MAXLENGTH], largestLine[MAXLENGTH]; int length; int maxFound = 0; while ((length = getLine (line, MAXLENGTH)) > 0){ printf("Line length = %d, content : %s\n", length, line); if (length > maxFound){ maxFound = length; copyLine (largestLine, line); } } if (maxFound > 0) /* print out only if there was a line type in*/ printf("Your longest line was : %s\n", largestLine); reverseLine(line, largestLine); printf("In reverse it becomes : %s\n", line); return 0; }
/*--------------------------------------------------------------------------*/ void moveForwardHistory(void) { char *newline = NULL; reallocLineBuffer(); cur_line[max_pos + 1] = '\0'; if (cur_line[0] == '\0') { resetSearchedTokenInScilabHistory(); setSearchedTokenInScilabHistory(NULL); } newline = getNextLineInScilabHistory(); if (newline) { clearCurrentLine(); copyLine(newline); FREE(newline); newline = NULL; } }
static void blitNormal(Bitmap* bm, const SavedImage* frame, const ColorMapObject* cmap, int transparent) { GifWord width = bm->m_width; GifWord height = bm->m_hight; const unsigned char* src = (unsigned char*)frame->RasterBits; Rgba* dst = bm->getAddr(frame->ImageDesc.Left, frame->ImageDesc.Top); GifWord copyWidth = frame->ImageDesc.Width; if (frame->ImageDesc.Left + copyWidth > width) { copyWidth = width - frame->ImageDesc.Left; } GifWord copyHeight = frame->ImageDesc.Height; if (frame->ImageDesc.Top + copyHeight > height) { copyHeight = height - frame->ImageDesc.Top; } for (; copyHeight > 0; copyHeight--) { copyLine(dst, src, cmap, transparent, copyWidth); src += frame->ImageDesc.Width; dst += width; } }
bool ZLWin32ImageManager::gifConvert(const std::string &stringData, ZLWin32ImageData &data, bool &result) const { result = false; GifReader reader(stringData); GifFileType *gif = DGifOpen(&reader, GifReader::inputFunction); if (gif == 0) { return false; } if (DGifSlurp(gif) != GIF_OK) { DGifCloseFile(gif); return false; } ColorMapObject* colormap = gif->SColorMap; if ((colormap == 0) || (gif->ImageCount < 1) || (colormap->ColorCount != (1 << colormap->BitsPerPixel))) { DGifCloseFile(gif); return false; } SavedImage* gif_image = gif->SavedImages; const int width = gif->SWidth; const int height = gif->SHeight; int transparent = -1; for (int i = 0; i < gif_image->ExtensionBlockCount; ++i) { ExtensionBlock* eb = gif_image->ExtensionBlocks + i; if (eb->Function == 0xF9 && eb->ByteCount == 4) { if ((eb->Bytes[0] & 1) == 1) { transparent = (unsigned char)eb->Bytes[3]; } } } data.init(width, height, (transparent != -1), 0); byte *ptr = gif_image->RasterBits; if (gif->Image.Interlace) { for (int i = 0; i < height; i += 8) { data.setPosition(0, i); copyLine(*colormap, ptr, data, width, transparent); } for (int i = 4; i < height; i += 8) { data.setPosition(0, i); copyLine(*colormap, ptr, data, width, transparent); } for (int i = 2; i < height; i += 4) { data.setPosition(0, i); copyLine(*colormap, ptr, data, width, transparent); } for (int i = 1; i < height; i += 2) { data.setPosition(0, i); copyLine(*colormap, ptr, data, width, transparent); } } else { for (int i = 0; i < height; ++i) { data.setPosition(0, i); copyLine(*colormap, ptr, data, width, transparent); } } DGifCloseFile(gif); result = true; return true; }
void LiteEditor::createActions() { LiteApi::IActionContext *actionContext = m_liteApp->actionManager()->getActionContext(this,"Editor"); m_undoAct = new QAction(QIcon("icon:liteeditor/images/undo.png"),tr("Undo"),this); actionContext->regAction(m_undoAct,"Undo",QKeySequence::Undo); m_redoAct = new QAction(QIcon("icon:liteeditor/images/redo.png"),tr("Redo"),this); actionContext->regAction(m_redoAct,"Redo","Ctrl+Shift+Z; Ctrl+Y"); m_cutAct = new QAction(QIcon("icon:liteeditor/images/cut.png"),tr("Cut"),this); actionContext->regAction(m_cutAct,"Cut",QKeySequence::Cut); m_copyAct = new QAction(QIcon("icon:liteeditor/images/copy.png"),tr("Copy"),this); actionContext->regAction(m_copyAct,"Copy",QKeySequence::Copy); m_pasteAct = new QAction(QIcon("icon:liteeditor/images/paste.png"),tr("Paste"),this); actionContext->regAction(m_pasteAct,"Paste",QKeySequence::Paste); m_selectAllAct = new QAction(tr("Select All"),this); actionContext->regAction(m_selectAllAct,"SelectAll",QKeySequence::SelectAll); m_exportHtmlAct = new QAction(QIcon("icon:liteeditor/images/exporthtml.png"),tr("Export HTML..."),this); #ifndef QT_NO_PRINTER m_exportPdfAct = new QAction(QIcon("icon:liteeditor/images/exportpdf.png"),tr("Export PDF..."),this); m_filePrintAct = new QAction(QIcon("icon:liteeditor/images/fileprint.png"),tr("Print..."),this); m_filePrintPreviewAct = new QAction(QIcon("icon:liteeditor/images/fileprintpreview.png"),tr("Print Preview..."),this); #endif m_gotoPrevBlockAct = new QAction(tr("Go To Previous Block"),this); actionContext->regAction(m_gotoPrevBlockAct,"GotoPreviousBlock","Ctrl+["); m_gotoNextBlockAct = new QAction(tr("Go To Next Block"),this); actionContext->regAction(m_gotoNextBlockAct,"GotoNextBlock","Ctrl+]"); m_selectBlockAct = new QAction(tr("Select Block"),this); actionContext->regAction(m_selectBlockAct,"SelectBlock","Ctrl+U"); m_gotoMatchBraceAct = new QAction(tr("Go To Matching Brace"),this); actionContext->regAction(m_gotoMatchBraceAct,"GotoMatchBrace","Ctrl+E"); m_foldAct = new QAction(tr("Fold"),this); actionContext->regAction(m_foldAct,"Fold","Ctrl+<"); m_unfoldAct = new QAction(tr("Unfold"),this); actionContext->regAction(m_unfoldAct,"Unfold","Ctrl+>"); m_foldAllAct = new QAction(tr("Fold All"),this); actionContext->regAction(m_foldAllAct,"FoldAll",""); m_unfoldAllAct = new QAction(tr("Unfold All"),this); actionContext->regAction(m_unfoldAllAct,"UnfoldAll",""); connect(m_foldAct,SIGNAL(triggered()),m_editorWidget,SLOT(fold())); connect(m_unfoldAct,SIGNAL(triggered()),m_editorWidget,SLOT(unfold())); connect(m_foldAllAct,SIGNAL(triggered()),m_editorWidget,SLOT(foldAll())); connect(m_unfoldAllAct,SIGNAL(triggered()),m_editorWidget,SLOT(unfoldAll())); m_gotoLineAct = new QAction(tr("Go To Line"),this); actionContext->regAction(m_gotoLineAct,"GotoLine","Ctrl+L"); m_lockAct = new QAction(QIcon("icon:liteeditor/images/lock.png"),tr("Locked"),this); m_lockAct->setEnabled(false); m_duplicateAct = new QAction(tr("Duplicate"),this); actionContext->regAction(m_duplicateAct,"Duplicate","Ctrl+Shift+D"); connect(m_duplicateAct,SIGNAL(triggered()),m_editorWidget,SLOT(duplicate())); m_deleteLineAct = new QAction(tr("Delete Line"),this); actionContext->regAction(m_deleteLineAct,"DeleteLine","Ctrl+Shift+K"); connect(m_deleteLineAct,SIGNAL(triggered()),m_editorWidget,SLOT(deleteLine())); m_copyLineAct = new QAction(tr("Copy Line"),this); actionContext->regAction(m_copyLineAct,"CopyLine","Ctrl+Ins"); connect(m_copyLineAct,SIGNAL(triggered()),m_editorWidget,SLOT(copyLine())); m_cutLineAct = new QAction(tr("Cut Line"),this); actionContext->regAction(m_cutLineAct,"CutLine","Shift+Del"); connect(m_cutLineAct,SIGNAL(triggered()),m_editorWidget,SLOT(cutLine())); m_insertLineBeforeAct = new QAction(tr("Insert Line Before"),this); actionContext->regAction(m_insertLineBeforeAct,"InsertLineBefore","Ctrl+Shift+Return"); connect(m_insertLineBeforeAct,SIGNAL(triggered()),m_editorWidget,SLOT(insertLineBefore())); m_insertLineAfterAct = new QAction(tr("Insert Line After"),this); actionContext->regAction(m_insertLineAfterAct,"InsertLineAfter","Ctrl+Return"); connect(m_insertLineAfterAct,SIGNAL(triggered()),m_editorWidget,SLOT(insertLineAfter())); m_increaseFontSizeAct = new QAction(tr("Increase Font Size"),this); actionContext->regAction(m_increaseFontSizeAct,"IncreaseFontSize","Ctrl++"); m_decreaseFontSizeAct = new QAction(tr("Decrease Font Size"),this); actionContext->regAction(m_decreaseFontSizeAct,"DecreaseFontSize","Ctrl+-"); m_resetFontSizeAct = new QAction(tr("Reset Font Size"),this); actionContext->regAction(m_resetFontSizeAct,"ResetFontSize","Ctrl+0"); m_cleanWhitespaceAct = new QAction(tr("Clean Whitespace"),this); actionContext->regAction(m_cleanWhitespaceAct,"CleanWhitespace",""); m_wordWrapAct = new QAction(tr("Word Wrap (MimeType)"),this); m_wordWrapAct->setCheckable(true); actionContext->regAction(m_wordWrapAct,"WordWrap",""); m_codeCompleteAct = new QAction(tr("Code Complete"),this); #ifdef Q_OS_MAC actionContext->regAction(m_codeCompleteAct,"CodeComplete","Meta+Space"); #else actionContext->regAction(m_codeCompleteAct,"CodeComplete","Ctrl+Space"); #endif m_commentAct = new QAction(tr("Toggle Comment"),this); actionContext->regAction(m_commentAct,"Comment","Ctrl+/"); m_blockCommentAct = new QAction(tr("Toggle Block Commnet"),this); actionContext->regAction(m_blockCommentAct,"BlockComment","Ctrl+Shift+/"); m_autoIndentAct = new QAction(tr("Auto-indent Selection"),this); actionContext->regAction(m_autoIndentAct,"AutoIndent","Ctrl+I"); m_autoIndentAct->setVisible(false); m_tabToSpacesAct = new QAction(tr("Tab To Spaces (MimeType)"),this); actionContext->regAction(m_tabToSpacesAct,"TabToSpaces",""); m_tabToSpacesAct->setCheckable(true); m_lineEndingWindowAct = new QAction(tr("Line End Windows (\\r\\n)"),this); actionContext->regAction(m_lineEndingWindowAct,"LineEndingWindow",""); m_lineEndingWindowAct->setCheckable(true); m_lineEndingUnixAct = new QAction(tr("Line End Unix (\\n)"),this); actionContext->regAction(m_lineEndingUnixAct,"LineEndingUnix",""); m_lineEndingUnixAct->setCheckable(true); m_visualizeWhitespaceAct = new QAction(tr("Visualize Whitespace (Global)"),this); actionContext->regAction(m_visualizeWhitespaceAct,"VisualizeWhitespace",""); m_visualizeWhitespaceAct->setCheckable(true); m_commentAct->setVisible(false); m_blockCommentAct->setVisible(false); m_moveLineUpAction = new QAction(tr("Move Line Up"),this); actionContext->regAction(m_moveLineUpAction,"MoveLineUp","Ctrl+Shift+Up"); m_moveLineDownAction = new QAction(tr("Move Line Down"),this); actionContext->regAction(m_moveLineDownAction,"MoveLineDown","Ctrl+Shift+Down"); m_copyLineUpAction = new QAction(tr("Copy Line Up"),this); actionContext->regAction(m_copyLineUpAction,"CopyLineUp","Ctrl+Alt+Up"); m_copyLineDownAction = new QAction(tr("Copy Line Down"),this); actionContext->regAction(m_copyLineDownAction,"CopyLineDown","Ctrl+Alt+Down"); m_joinLinesAction = new QAction(tr("Join Lines"),this); actionContext->regAction(m_joinLinesAction,"JoinLines","Ctrl+J"); connect(m_codeCompleteAct,SIGNAL(triggered()),m_editorWidget,SLOT(codeCompleter())); // m_widget->addAction(m_foldAct); // m_widget->addAction(m_unfoldAct); // m_widget->addAction(m_gotoLineAct); // m_widget->addAction(m_gotoPrevBlockAct); // m_widget->addAction(m_gotoNextBlockAct); // m_widget->addAction(m_selectBlockAct); // m_widget->addAction(m_gotoMatchBraceAct); connect(m_editorWidget,SIGNAL(undoAvailable(bool)),m_undoAct,SLOT(setEnabled(bool))); connect(m_editorWidget,SIGNAL(redoAvailable(bool)),m_redoAct,SLOT(setEnabled(bool))); connect(m_editorWidget,SIGNAL(copyAvailable(bool)),m_cutAct,SLOT(setEnabled(bool))); connect(m_editorWidget,SIGNAL(copyAvailable(bool)),m_copyAct,SLOT(setEnabled(bool))); connect(m_editorWidget,SIGNAL(wordWrapChanged(bool)),m_wordWrapAct,SLOT(setChecked(bool))); connect(m_undoAct,SIGNAL(triggered()),m_editorWidget,SLOT(undo())); connect(m_redoAct,SIGNAL(triggered()),m_editorWidget,SLOT(redo())); connect(m_cutAct,SIGNAL(triggered()),m_editorWidget,SLOT(cut())); connect(m_copyAct,SIGNAL(triggered()),m_editorWidget,SLOT(copy())); connect(m_pasteAct,SIGNAL(triggered()),m_editorWidget,SLOT(paste())); connect(m_selectAllAct,SIGNAL(triggered()),m_editorWidget,SLOT(selectAll())); connect(m_selectBlockAct,SIGNAL(triggered()),m_editorWidget,SLOT(selectBlock())); connect(m_exportHtmlAct,SIGNAL(triggered()),this,SLOT(exportHtml())); #ifndef QT_NO_PRINTER connect(m_exportPdfAct,SIGNAL(triggered()),this,SLOT(exportPdf())); connect(m_filePrintAct,SIGNAL(triggered()),this,SLOT(filePrint())); connect(m_filePrintPreviewAct,SIGNAL(triggered()),this,SLOT(filePrintPreview())); #endif connect(m_gotoPrevBlockAct,SIGNAL(triggered()),m_editorWidget,SLOT(gotoPrevBlock())); connect(m_gotoNextBlockAct,SIGNAL(triggered()),m_editorWidget,SLOT(gotoNextBlock())); connect(m_gotoMatchBraceAct,SIGNAL(triggered()),m_editorWidget,SLOT(gotoMatchBrace())); connect(m_gotoLineAct,SIGNAL(triggered()),this,SLOT(gotoLine())); connect(m_increaseFontSizeAct,SIGNAL(triggered()),this,SLOT(increaseFontSize())); connect(m_decreaseFontSizeAct,SIGNAL(triggered()),this,SLOT(decreaseFontSize())); connect(m_resetFontSizeAct,SIGNAL(triggered()),this,SLOT(resetFontSize())); connect(m_cleanWhitespaceAct,SIGNAL(triggered()),m_editorWidget,SLOT(cleanWhitespace())); connect(m_wordWrapAct,SIGNAL(triggered(bool)),m_editorWidget,SLOT(setWordWrapOverride(bool))); connect(m_commentAct,SIGNAL(triggered()),this,SLOT(comment())); connect(m_blockCommentAct,SIGNAL(triggered()),this,SLOT(blockComment())); connect(m_autoIndentAct,SIGNAL(triggered()),this,SLOT(autoIndent())); connect(m_tabToSpacesAct,SIGNAL(toggled(bool)),this,SLOT(tabToSpacesToggled(bool))); connect(m_visualizeWhitespaceAct,SIGNAL(toggled(bool)),this,SLOT(toggledVisualizeWhitespace(bool))); connect(m_moveLineUpAction,SIGNAL(triggered()),m_editorWidget,SLOT(moveLineUp())); connect(m_moveLineDownAction,SIGNAL(triggered()),m_editorWidget,SLOT(moveLineDown())); connect(m_copyLineUpAction,SIGNAL(triggered()),m_editorWidget,SLOT(copyLineUp())); connect(m_copyLineDownAction,SIGNAL(triggered()),m_editorWidget,SLOT(copyLineDown())); connect(m_joinLinesAction,SIGNAL(triggered()),m_editorWidget,SLOT(joinLines())); //connect(m_lineEndingWindowAct,SIGNAL(triggered()),this,SLOT(lineEndingWindow())); //connect(m_lineEndingUnixAct,SIGNAL(triggered()),this,SLOT(lineEndingUnixAct())); QActionGroup *group = new QActionGroup(this); group->addAction(m_lineEndingWindowAct); group->addAction(m_lineEndingUnixAct); connect(group,SIGNAL(triggered(QAction*)),this,SLOT(triggeredLineEnding(QAction*))); #ifdef Q_OS_WIN QClipboard *clipboard = QApplication::clipboard(); connect(clipboard,SIGNAL(dataChanged()),this,SLOT(clipbordDataChanged())); clipbordDataChanged(); #endif }
/*--------------------------------------------------------------------------*/ static void TermCompletionOnFiles(char **dictionaryFiles, int sizedictionaryFiles, char *lineBeforeCaret, char *lineAfterCaret, char *filePattern, char *defaultPattern) { if (dictionaryFiles) { if (sizedictionaryFiles == 1) { char *newline = completeLine(lineBeforeCaret, dictionaryFiles[0], filePattern, defaultPattern, TRUE, lineAfterCaret); if (newline) { clearCurrentLine(); copyLine(newline); FREE(newline); return; } } else { char *common = getCommonPart(dictionaryFiles, sizedictionaryFiles); displayCompletionDictionary(dictionaryFiles, sizedictionaryFiles, gettext("File or Directory")); displayPrompt(); newLine(); if (defaultPattern[0] == 0) { int lennewline = (int)strlen(lineBeforeCaret) + (int)strlen(lineAfterCaret); char *newline = (char*)MALLOC(sizeof(char) * (lennewline + 1)); clearCurrentLine(); if (newline) { strcpy(newline, lineBeforeCaret); strcat(newline, lineAfterCaret); copyLine(newline); FREE(newline); newline = NULL; } } else if (common) { char *newline = completeLine(lineBeforeCaret, common, filePattern, defaultPattern, TRUE, lineAfterCaret); if (newline) { clearCurrentLine(); copyLine(newline); FREE(newline); return; } else { int lennewline = (int)strlen(lineBeforeCaret) + (int)strlen(lineAfterCaret); newline = (char*)MALLOC(sizeof(char) * (lennewline + 1)); clearCurrentLine(); if (newline) { strcpy(newline, lineBeforeCaret); strcat(newline, lineAfterCaret); copyLine(newline); FREE(newline); newline = NULL; } } FREE(common); common = NULL; } } } }
static RImage* rotateImage(RImage *image, float angle) { RImage *img; int nwidth, nheight; int x1, y1; int x2, y2; int dx, dy; int xi, yi; int xx, yy; unsigned char *src, *dst; int dpr, dpru, p; /* only 180o for now */ if (angle > 180.0) angle -= 180.0; angle = (angle * PI) / 180.0; nwidth = ceil(abs(cos(angle) * image->width)) + ceil(abs(cos(PI/2 - angle) * image->width)); nheight = ceil(abs(sin(angle) * image->height)) + ceil(abs(cos(PI/2 - angle) * image->height)); img = RCreateImage(nwidth, nheight, True); if (!img) return NULL; src = image->data; dst = img->data; x1 = floor(abs(cos(PI/2 - angle)*image->width)); y1 = 0; x2 = 0; y2 = floor(abs(sin(PI/2 - angle)*image->width)); xx = floor(abs(cos(angle)*image->height)) - 1; yy = nheight - 1; printf("%ix%i, %i %i %i %i %i\n", nwidth, nheight, x1, y1, x2, y2, (int)((angle*180.0)/PI)); dx = abs(x2 - x1); dy = abs(y2 - y1); if (x1 > x2) xi = -1; else xi = 1; if (y1 > y2) yi = -1; else yi = 1; if (dx >= dy) { dpr = dy << 1; dpru = dpr - (dx << 1); p = dpr - dx; while (dx-- >= 0) { copyLine(x1, y1, xx, yy, nwidth, image->format, dst, &src); /* calc next step */ if (p > 0) { x1 += xi; y1 += yi; xx += xi; yy += yi; p += dpru; } else { x1 += xi; xx += xi; p += dpr; } } } else { puts("NOT IMPLEMTENED"); return img; dpr = dx << 1; dpru = dpr - (dy << 1); p = dpr - dy; while (dy-- >= 0) { xx = abs(x1*sin(angle*PI/180.0)); yy = abs(y1*cos(angle*PI/180.0)); copyLine(x1, y1, xx, yy, nwidth, image->format, dst, &src); /* calc next step*/ if (p > 0) { x1 += xi; y1 += yi; p += dpru; } else { y1 += yi; p += dpr; } } } return img; }
/*--------------------------------------------------------------------------*/ static void TermCompletionOnAll(char *lineBeforeCaret, char *lineAfterCaret, char *defaultPattern) { if (defaultPattern) { int numberWordFound = 0; char **completionDictionaryFunctions = NULL; int sizecompletionDictionaryFunctions = 0; char **completionDictionaryCommandWords = NULL; int sizecompletionDictionaryCommandWords = 0; char **completionDictionaryMacros = NULL; int sizecompletionDictionaryMacros = 0; char **completionDictionaryVariables = NULL; int sizecompletionDictionaryVariables = 0; char **completionDictionaryHandleGraphicsProperties = NULL; int sizecompletionDictionaryHandleGraphicsProperties = 0; char **completionDictionaryFields = NULL; int sizecompletionDictionaryFields = 0; completionDictionaryFields = completionOnFields(lineBeforeCaret, defaultPattern, &sizecompletionDictionaryFields); if ((completionDictionaryFields == NULL) && strcmp(defaultPattern, "")) { completionDictionaryFunctions = completionOnFunctions(defaultPattern, &sizecompletionDictionaryFunctions); completionDictionaryCommandWords = completionOnCommandWords(defaultPattern, &sizecompletionDictionaryCommandWords); completionDictionaryMacros = completionOnMacros(defaultPattern, &sizecompletionDictionaryMacros); completionDictionaryVariables = completionOnVariablesWithoutMacros(defaultPattern, &sizecompletionDictionaryVariables); completionDictionaryHandleGraphicsProperties = completionOnHandleGraphicsProperties(defaultPattern, &sizecompletionDictionaryHandleGraphicsProperties); } numberWordFound = sizecompletionDictionaryFunctions + sizecompletionDictionaryCommandWords + sizecompletionDictionaryMacros + sizecompletionDictionaryVariables + sizecompletionDictionaryHandleGraphicsProperties + sizecompletionDictionaryFields; if (numberWordFound > 0) { if (numberWordFound == 1) { char **completionDictionary = NULL; char *new_line = NULL; if (completionDictionaryFields) { completionDictionary = completionDictionaryFields; } if (completionDictionaryFunctions) { completionDictionary = completionDictionaryFunctions; } if (completionDictionaryCommandWords) { completionDictionary = completionDictionaryCommandWords; } if (completionDictionaryMacros) { completionDictionary = completionDictionaryMacros; } if (completionDictionaryVariables) { completionDictionary = completionDictionaryVariables; } if (completionDictionaryHandleGraphicsProperties) { completionDictionary = completionDictionaryHandleGraphicsProperties; } new_line = completeLine(lineBeforeCaret, completionDictionary[0], NULL, defaultPattern, FALSE, lineAfterCaret); if (new_line) { clearCurrentLine(); copyLine(new_line); FREE(new_line); } } else { char *commonAll = NULL; if (completionDictionaryFields) { commonAll = getCommonPart(completionDictionaryFields, sizecompletionDictionaryFields); displayCompletionDictionary(completionDictionaryFields, sizecompletionDictionaryFields, (char *)_("Scilab Fields")); freeArrayOfString(completionDictionaryFields, sizecompletionDictionaryFields); } else { char *commonFunctions = getCommonPart(completionDictionaryFunctions, sizecompletionDictionaryFunctions); char *commonCommandWords = getCommonPart(completionDictionaryCommandWords, sizecompletionDictionaryCommandWords); char *commonMacros = getCommonPart(completionDictionaryMacros, sizecompletionDictionaryMacros); char *commonVariables = getCommonPart(completionDictionaryVariables, sizecompletionDictionaryVariables); char *commonHandleGraphicsProperties = getCommonPart(completionDictionaryHandleGraphicsProperties, sizecompletionDictionaryHandleGraphicsProperties); int sizecommonsDictionary = 0; char **commonsDictionary = concatenateStrings(&sizecommonsDictionary, commonFunctions, commonMacros, commonCommandWords, commonVariables, commonHandleGraphicsProperties); if (sizecommonsDictionary > 0) { if (sizecommonsDictionary == 1) { commonAll = strdup(commonsDictionary[0]); } else { commonAll = getCommonPart(commonsDictionary, sizecommonsDictionary); } freeArrayOfString(commonsDictionary, sizecommonsDictionary); } displayCompletionDictionary(completionDictionaryFunctions, sizecompletionDictionaryFunctions, (char *)_("Scilab Function")); displayCompletionDictionary(completionDictionaryCommandWords, sizecompletionDictionaryCommandWords, (char *)_("Scilab Command")); displayCompletionDictionary(completionDictionaryMacros, sizecompletionDictionaryMacros, (char *)_("Scilab Macro")); displayCompletionDictionary(completionDictionaryVariables, sizecompletionDictionaryVariables, (char *)_("Scilab Variable")); displayCompletionDictionary(completionDictionaryHandleGraphicsProperties, sizecompletionDictionaryHandleGraphicsProperties, (char *)_("Graphics handle field")); freeArrayOfString(completionDictionaryFunctions, sizecompletionDictionaryFunctions); freeArrayOfString(completionDictionaryCommandWords, sizecompletionDictionaryCommandWords); freeArrayOfString(completionDictionaryMacros, sizecompletionDictionaryMacros); freeArrayOfString(completionDictionaryVariables, sizecompletionDictionaryVariables); freeArrayOfString(completionDictionaryHandleGraphicsProperties, sizecompletionDictionaryHandleGraphicsProperties); } displayPrompt(); newLine(); if (commonAll) { char *newline = NULL; newline = completeLine(lineBeforeCaret, commonAll, NULL, defaultPattern, FALSE, lineAfterCaret); if (newline) { clearCurrentLine(); copyLine(newline); FREE(newline); } FREE(commonAll); commonAll = NULL; } } } } }
void cleanTicketNumbers(LPFIELDSRESULTS lpFieldsResults) { char *resultsStr = lpFieldsResults->result; int numGr, i, k; int iStart, iStop; char strT[10]; int ret; int numLines = 0; int thGroups = 5; int numChars; int beginCut = 0; resultTmp[0] = 0; cand2Tmp[0] = 0; // test every line //printf("\n\n"); //printf(resultsStr); //printf("\n\n"); // get number of lines i = 0; while(1){ if(getLine(resultsStr, i, &iStart, &iStop) < 0) break; numLines++; i++; } // test last lines // printf("--- numLines= %d\n",numLines); k = numLines-1; while(k>0){ if(getLine(resultsStr, k, &iStart, &iStop) < 0) break; if(testLineConf(lpFieldsResults, iStart, iStop) < 0) numLines--; else break; k--; } i = 0; k = 0; while(i < numLines){ if(getLine(resultsStr, i, &iStart, &iStop) < 0) break; testLeftSideForLine(resultsStr, &iStart, iStop); //printLine(resultsStr, iStart, iStop); numGr = getNumberOfGroups(resultsStr, iStart, iStop); beginCut = 0; // printf("--- line i= %d; numGr= %d, iStart= %d, iStop= %d\n",i, numGr, iStart, iStop); numChars = getNumChars(resultsStr, iStart, iStop); //printf("--- line i= %d; numGr= %d, numChars= %d\n",i, numGr, numChars); if(numGr == thGroups){ beginCut = testBeginCut(lpFieldsResults, iStart, iStop); if(beginCut > 0) numGr++; } // printLine(resultsStr, iStart, iStop); // printf("--- line i= %d; numGr= %d, numChars= %d\n",i, numGr, numChars); if(numGr > thGroups && strlen(resultsStr) > 15 && numChars < 20){ copyLine(lpFieldsResults, iStart, iStop); // printLine(resultsStr, iStart, iStop); // printfQuad(); // printf("--- line i= %d; %s\n",i, result); if(beginCut > 0){ // printf("--- line i= %d; beginCut= %d\n",i, beginCut); strT[0] = 'A'+k; strT[1] = 32; strT[2] = 0; replaceChars(0, -1, strT); }else{ getFirstCharFromNumLine(&iStart, &iStop); // printfQuad(); // printf("--- getFirstCharFromNumLine i= %d; iStart= %d, iStop= %d\n",i, iStart, iStop); if(numGr < 8 && iStart == 0 && iStop == 0 && result[1] != 32) { strT[0] = 'A'+k; strT[1] = 32; strT[2] = 0; replaceChars(0, -1, strT); }else{ // printf("--- numGr= %d; iStart= %d, iStop= %d, result[1]= %d\n",numGr, iStart, iStop, result[1]); strT[0] = 'A'+k; strT[1] = 0; replaceChars(iStart, iStop, strT); } } iStop = -1; ret = getFirstQPFromNumLine(&iStart, &iStop); if(ret >= 0) { replaceChars(iStart, iStop, "QP"); } if( ret > 0 || numGr >6) { if(getSecondQPFromNumLine(&iStart, &iStop) >=0){ replaceChars(iStart, iStop, "QP"); } } addLineToTmp(); k++; //printTmp(); } i++; } copyResultsBack(lpFieldsResults); }
void postProcessingDateNew(LPTICKETRESULTS ticketResults){ LPFIELDSRESULTS lpFieldsResults; // char *resultsStr = lpFieldsResults->result; char *resultsStr; int i, k, iA, line, len, sh; int iStart, iStop, idxY, flgCut; // char Date[20]; iA = -1; line = -1; for(i=0;i<NUMFIELDS_RESULTS;i++){ if(ticketResults->fieldsResults[i].name[0] != 0){ if(strcmp(ticketResults->fieldsResults[i].name, "DATEA") == 0) { line = postProcessingDateA(&ticketResults->fieldsResults[i]); iA = i; break; } } } // printf("-------resultTmp = %s, line= %d \n", resultTmp, line); for(i=0;i<NUMFIELDS_RESULTS;i++){ if(ticketResults->fieldsResults[i].name[0] != 0){ if(strcmp(ticketResults->fieldsResults[i].name, "DATEN") == 0) { if(line >=0 && iA >= 0) { lpFieldsResults = &ticketResults->fieldsResults[i]; resultsStr = lpFieldsResults->result; line = adjustLine(resultsStr, line); getLine(resultsStr, line, &iStart, &iStop); resultTmp[7] = 0; cand2Tmp[7] = 0; // printf("-------resultTmp = %s \n", resultTmp); copyLine(&ticketResults->fieldsResults[i], iStart, iStop); len = strlen(result); if(result[len-1] < 32) result[len-1] = 0; len = strlen(result); sh = 3; if(result[len-2] == 32) sh = 5; idxY = matchToStringEndOneLineIdx(result, "201", sh); flgCut = 0; if(sh == 5 && len - idxY > 4) flgCut = 1; //printLine(resultsStr, iStart, iStop); //printf("-------results = %s \n", result); //printf("-------idxY = %d, len - idxY = %d \n", idxY, len - idxY); idxY -= 3; if(idxY <= 0 || idxY >= (iStop - iStart)) idxY = 7; k = iStart+idxY; // printf("-------resultsStr[k] = %s \n", &resultsStr[k]); if(k<iStop) { copyLine(&ticketResults->fieldsResults[i], k, iStop); len = strlen(result); if(result[len-1] < 32) result[len-1] = 0; len = strlen(result); if(flgCut == 1 && result[len-2] == 32) result[len-2] = 0; // printf("-------result = %s \n", result); addLineToTmp(); // printf("-------resultTmp = %s \n", resultTmp); } copyResultsBack(&ticketResults->fieldsResults[iA]); } else{ line = postProcessingDateD(&ticketResults->fieldsResults[i]); if(line >=0 && iA >= 0) { lpFieldsResults = &ticketResults->fieldsResults[iA]; resultsStr = lpFieldsResults->result; line = adjustLineA(resultsStr, line); getLine(resultsStr, line, &iStart, &iStop); idxY = matchToStringEndOneLineIdx(resultTmp, "201", 3); idxY -= 3; if(idxY <= 0 || idxY >= strlen(resultTmp)) idxY = 7; // printf("-------idxY = %d \n", idxY); replaceFirstCharsTmp(lpFieldsResults, iStart, iStop, idxY); copyResultsBack(&ticketResults->fieldsResults[iA]); }else if(iA >= 0) ticketResults->fieldsResults[iA].result[0] = 0; } break; } } } cleanYear(ticketResults); cleanDateField(ticketResults); return; }
//Bu fonksiyon verildiği satır indexi siliyor copyLine fonksiyonu kullanarak. //Silinecek satır itibaren her satır aşağıdaki satırı alıyor ve kendi yerinde oluyor //boylece son satıra kadar void removeLine(char table[MAX_ROWS][MAX_COLUMNS][MAX_CHARS], int index){ int i; for(i=index;i<Height;i++){ copyLine(table+i+1,table+i); } }
void AttributeContainer::compact(std::vector<unsigned int>& mapOldNew) { mapOldNew.clear(); mapOldNew.resize(realEnd(),0xffffffff); //VERSION THAT PRESERVE ORDER OF ELEMENTS ? // unsigned int down = 0; // for (unsigned int occup = realBegin(); occup != realEnd(); next(occup)) // { // mapOldNew[occup] = down; // copyLine(down,occup); // // copy ref counter // setNbRefs(down,getNbRefs(occup)); // down++; // } // fill the holes with data & create the map Old->New unsigned int up = realRBegin(); unsigned int down = 0; while (down < up) { if (!used(down)) { mapOldNew[up] = down; // copy data copyLine(down,up); // copy ref counter setNbRefs(down,getNbRefs(up)); // set next element to catch for hole filling realRNext(up); } down++; } // end of table = nb elements m_maxSize = m_size; // no more blocks empty m_tableBlocksEmpty.clear(); // only the last block has free indices m_tableBlocksWithFree.clear(); // compute nb block full unsigned int nbb = m_size / _BLOCKSIZE_; // update holeblock for (unsigned int i=0; i<nbb; ++i) m_holesBlocks[i]->compressFull(_BLOCKSIZE_); //update last holeblock unsigned int nbe = m_size % _BLOCKSIZE_; if (nbe != 0) { m_holesBlocks[nbb]->compressFull(nbe); m_tableBlocksWithFree.push_back(nbb); nbb++; } // free memory and resize for (int i = m_holesBlocks.size() - 1; i > int(nbb); --i) delete m_holesBlocks[i]; m_holesBlocks.resize(nbb); // release unused data memory for(unsigned int j = 0; j < m_tableAttribs.size(); ++j) { if (m_tableAttribs[j] != NULL) m_tableAttribs[j]->setNbBlocks(m_holesBlocks.size()); } }