void interpret(Interpreter interp, char* line){ // for(int i=0; i<1000000000; ){i=hoge(i,1);} /* for(int i=0; i<1000000*100; i++){ if(!pool) fill_pool(); obj rr=pool; pool = cdr(pool); rr->refcount = 1; rr->type = INT; if(rr->type == tNull) continue; rr->refcount--; cdr(rr) = pool; pool = rr; }//*/ /* for(int i=0; i<1000000*100; i++){ obj rr=alloc(); rr->type = INT; release(rr); }//*/ /* obj u=Int(1); obj e=Int(10000000); obj x=Int(0); //while(vrInt(compare('<', x, e))){ while(vrInt(LT(x, e))){ obj r = add(x, u); release(x); x=r; } //*/ curr_interp = interp; env = nil; obj stat = parseString(&line); obj rr = nil; // int t = TickCount(); if(stat) { rr = eval(stat); release(stat); } // myPrintf(" %f sec.", (TickCount()-t)/60.); if(rr){ myPrintf(">> "); print(rr); release(rr); scroll(); } }
/* GNOME bugzilla bug 111500. Expand a row and immediately scroll * to its first child. Make sure that expansion happens in currently * invisible area. */ static void test_bug111500 (ScrollFixture *fixture, gconstpointer test_data) { int i, len; GtkTreeStore *store; GtkTreeIter parent; GtkTreePath *path; g_test_bug ("111500"); gtk_widget_show_all (fixture->window); /* Make sure all events have been processed and the window * is visible. */ while (gtk_events_pending ()) gtk_main_iteration (); /* Further prepare model */ store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (fixture->tree_view))); for (i = 0; i < 15; i++) { GtkTreeIter iter; gtk_tree_store_append (store, &iter, NULL); gtk_tree_store_set (store, &iter, 0, "Other node", -1); } len = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (store), NULL); gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (store), &parent, NULL, len - 1); for (i = 0; i < 5; i++) { GtkTreeIter iter; gtk_tree_store_append (store, &iter, &parent); gtk_tree_store_set (store, &iter, 0, "Row", -1); } path = gtk_tree_path_new_from_indices (len - 1, -1); gtk_tree_view_expand_row (GTK_TREE_VIEW (fixture->tree_view), path, FALSE); gtk_tree_path_down (path); scroll (fixture, path, FALSE, 0.5); gtk_tree_path_free (path); }
void printk(const char *message, ...) { char *vid = lark_console.vid; unsigned char attr = lark_console.attr; unsigned int row = lark_console.row; unsigned int col = lark_console.col; va_list args; char *buf = &logbuf[0]; int i; va_start(args, message); i = vsprintf(logbuf, message, args); va_end(args); /* it's important to keep in mind that col is in bytes but for * each character we have 2 bytes. One for the character, and * one for its attributes */ while(*buf != 0) { /* FIXME: add tab support */ if(*buf == '\n') { row++; col = 0; *buf++; } else if(*buf == '\r') { col = 0; *buf++; } else { vid[row*LINE_SIZE + col] = *buf; *buf++; col++; vid[row*LINE_SIZE + col] = attr; col++; } if(col >= lark_console.width){ row++; col = 0; } if(row >= lark_console.height){ scroll(); row--; } } lark_console.row = row; lark_console.col = col; }
int main (void) { int x = 40, zufall, c = 0 , i; srand(79); initscr(); keypad(stdscr, TRUE); noecho(); scrollok(stdscr, TRUE); scroll(stdscr); while (c != QUIT) { scrl(1); for (i = 0; i < 5; ++i) { zufall = rand() % 79; mvaddch(20, zufall, '*'); mvprintw(0, 0, "'q' druecken fuer Quit | " "Taste fuer Start | " "<- nach links -> nach rechts"); mvprintw(1,0, "Position Raumschiff %d", x); } c = getch(); halfdelay(3); switch (c) { case LEFT: if (x < 1) x = 79; else --x; break; case RIGHT: if (x > 79) x = 1; else ++x; break; default: break; } print_raumschiff(x); } endwin(); return 0; }
void newline(void) { nbacklines--; if(y >= yscrmax) { y = yscrmax; if(pagemode && olines >= yscrmax) { blocked = 1; return; } scroll(yscrmin+1, yscrmax+1, yscrmin, yscrmax); } else y++; olines++; }
void LCDST7565::menuDown() { buty++; bool atBottom = false; do { if ((_current_line < N_LINES-2) & (_current_line < _n_items-1)) _current_line++; else scroll(1); // We're at the bottom line, scroll down if possible if (_item_index < _n_items-1) { _item_index++; } else atBottom = true; } while( _menu_items[_item_index].type == MENU_ITEM_TYPE_LINE && ! atBottom); update(); }
void Camera::followCinematic(Character& character, float dt) { const float camX = _view.getCenter().x; const float camY = _view.getCenter().y; //lerp : V(t) = A + (B-A) * t //Linear Interpolation from Camera's center to Character's center const sf::Vector2f pos = character.getPosition(); int x, y; x = (int)( camX + (pos.x - camX) * _speed.x*dt ); y = (int)( camY + (pos.y - camY) * _speed.y*dt ); scroll(x, y, x, y); _view.setCenter(x, y); }
void VGA_Text_Buffer::put(char c) { if (c == '\n') { col = -1; // The column get incremented at the end, need to counteract that ++row; } else if (c == '\t') { col = col - (col % tab_width) + tab_width - 1; } else { at(row,col) = make_entry(c); } if (++col >= cols) { ++row; col = 0; } if (row >= rows) scroll(); }
void moverowdown(void) /* Moves down one row */ { displaycell(curcol, currow, NOHIGHLIGHT, NOUPDATE); if (currow < bottomrow) currow++; else if (bottomrow < (MAXROWS - 1)) { scroll(UP, 1, LEFTMARGIN + 1, 3, 80, SCREENROWS + 2, WHITE); toprow++; currow++; setbottomrow(); displayrow(bottomrow, NOUPDATE); } } /* moverowdown */
void ExampleView::dragExampleView(QMouseEvent* ev) { QPoint d = ev->pos() - _matrix.map(startMove).toPoint(); int dx = d.x(); if (dx == 0) return; constraintCanvas(&dx); // Perform the actual scrolling _matrix.setMatrix(_matrix.m11(), _matrix.m12(), _matrix.m13(), _matrix.m21(), _matrix.m22(), _matrix.m23(), _matrix.dx()+dx, _matrix.dy(), _matrix.m33()); imatrix = _matrix.inverted(); scroll(dx, 0); }
bool WebPage::performDefaultBehaviorForKeyEvent(const WebKeyboardEvent& keyboardEvent) { if (keyboardEvent.type() != WebEvent::KeyDown && keyboardEvent.type() != WebEvent::RawKeyDown) return false; switch (keyboardEvent.windowsVirtualKeyCode()) { case VK_LEFT: scroll(m_page.get(), ScrollLeft, ScrollByLine); break; case VK_RIGHT: scroll(m_page.get(), ScrollRight, ScrollByLine); break; case VK_UP: scroll(m_page.get(), ScrollUp, ScrollByLine); break; case VK_DOWN: scroll(m_page.get(), ScrollDown, ScrollByLine); break; case VK_HOME: logicalScroll(m_page.get(), ScrollBlockDirectionBackward, ScrollByDocument); break; case VK_END: logicalScroll(m_page.get(), ScrollBlockDirectionForward, ScrollByDocument); break; case VK_PRIOR: logicalScroll(m_page.get(), ScrollBlockDirectionBackward, ScrollByPage); break; case VK_NEXT: logicalScroll(m_page.get(), ScrollBlockDirectionForward, ScrollByPage); break; default: return false; } return true; }
void BrowCtx::center_object( GlowArrayElem *object, double factor) { double ll_x, ll_y, ur_x, ur_y; int new_offset_y; int y_pix; ((GlowNode *)object)->measure( &ll_x, &ll_y, &ur_x, &ur_y); new_offset_y = int(ll_y * mw.zoom_factor_y - factor * mw.window_height); if ( new_offset_y <= 0) y_pix = mw.offset_y; else y_pix = - (new_offset_y - mw.offset_y); scroll( 0, y_pix); change_scrollbar(); }
void CNOutBarCtrl::OnTimer(UINT nIDEvent) { if (nIDEvent == IDT_SCROLL) { if (HITOBJ(pressedHit) == HT_SCROLL) scroll(HITINDEX(pressedHit)); } else if (nIDEvent == IDT_DBLCLK) { KillTimer(IDT_DBLCLK); if (listener && lastHit == MAKEHIT(HT_ITEM, clickedItem)) listener->itemClicked(clickedItem); clickedItem = -1; } else CWnd::OnTimer(nIDEvent); }
// Prints raw text void kprint_raw(const char text[]) { int i; for(i = 0; text[i] != '\0'; i++) { if(column >= 80) { row++; column = 0; if(row > TERM_ROWS) scroll(); } if(text[i] == '\n') { row++; column = 0; if(row > TERM_ROWS) scroll(); } else { kprintc(text[i], 0x07, column, row); column++; } } }
void cputc(char c) { static unsigned short scan_x,x,y; LIN_ADDR v = (LIN_ADDR)(0xB8000 + active_page*(2*PAGE_SIZE)); x = bios_x; y = bios_y; switch (c) { case '\t' : x += 8; if (x >= 80) { x = 0; if (y == 24) scroll(); else y++; } else { scan_x = 0; while ((scan_x+8) < x) scan_x += 8; x = scan_x; } break; case '\n' : x = 0; if (y == 24) scroll(); else y++; break; case '\b' : x--; lmempokeb((LIN_ADDR)(v + 2*(x + y*80)),' '); x++; break; default : lmempokeb((LIN_ADDR)(v + 2*(x + y*80)),c); x++; if (x > 80) { x = 0; if (y == 24) scroll(); else y++; } } place(x,y); }
void print_string(const unsigned char *str) { unsigned char c; if (console_needs_init) init_console(); while((c = *str++)) switch(c) { case '\n': cursor_x = 0; cursor_y++; if(cursor_y == size_y) { scroll(); cursor_y = size_y - 1; } break; default: print_char(cursor_x, cursor_y, c); cursor_x++; if(cursor_x == size_x) { cursor_x = 0; cursor_y++; if(cursor_y == size_y) { scroll(); cursor_y = size_y - 1; } } break; } }
void showfont() { puts32("Text fontmap in use: "); uint16_t c = 0; while (c < 0x100) { video32[curpos32] = (VGA_ATTRIBUTE<<8) | c++; setcurpos32(curpos32+1); if (curpos32 >= (80 * VGA_LINES)) { scroll(1); } } putchar32('\n'); }
// display a char, handle special chars '\n','\r','\b' int putc(char c) { int pos, w, offset; if (c=='\n'){ row++; if (row>=25){ row = 24; scroll(); } pos = 2*(row*80 + column); offset = (org + pos) & vid_mask; set_VDC(CURSOR, offset >> 1); return; }
void mputc( short n, char c ) { if (!OPEN) return; // if (keyd_pressed[KEY_BACKSP]) // mono_int_3(); switch (c) { case 8: if (CCOL > 0) CCOL--; break; case 9: CHAR( CROW, CCOL ) = ' '; ATTR( CROW, CCOL ) = XATTR( CROW, CCOL ); XCHAR( CROW, CCOL ) = ' '; CCOL++; while (CCOL % 4) { CHAR( CROW, CCOL ) = ' '; ATTR( CROW, CCOL ) = XATTR( CROW, CCOL ); XCHAR( CROW, CCOL ) = ' '; CCOL++; } break; case 10: case 13: CCOL = 0; CROW++; break; default: CHAR( CROW, CCOL ) = c; ATTR( CROW, CCOL ) = XATTR( CROW, CCOL ); XCHAR( CROW, CCOL ) = c; CCOL++; } if ( CCOL >= WIDTH ) { CCOL = 0; CROW++; } if ( CROW >= HEIGHT ) { CROW--; scroll(n); } msetcursor( ROW+CROW, COL+CCOL ); }
void LineInput(char *buf, int len) { int pos=0; int ch; while(1) { wrefresh(Bottom); ch=wgetch(Bottom); switch(ch) { case 10:; case 13:; buf[pos]=0; scroll(Bottom); wmove(Bottom, 11, 0); OutputPos = 0; return; case 8:; case 127:; if(pos>0) { int y,x; getyx(Bottom,y,x); x--; if(x==-1) { x=79; y--; } mvwaddch(Bottom,y,x,' '); wmove(Bottom,y,x); wrefresh(Bottom); pos--; } break; default: if(pos >= len) break; if(ch>=' '&&ch<=126) { buf[pos++]=ch; waddch(Bottom,(char)ch); wrefresh(Bottom); } break; } } }
void LinesWidget::updateArea( const QRect &rect, int dy ) { if ( dy ) { scroll( 0, dy ); } else { update( 0, rect.y(), width(), rect.height() ); } /* if ( rect.contains( viewport()->rect() ) ) { updateLineNumberAreaWidth(0); }*/ }
void LLFloaterMediaFilter::updateLists(LLMediaFilter::EMediaList list_type) { bool white(list_type == LLMediaFilter::WHITELIST); const LLMediaFilter& inst(LLMediaFilter::instance()); const LLMediaFilter::string_list_t& list = white ? inst.getWhiteList() : inst.getBlackList(); LLScrollListCtrl* scroll(white ? mWhitelist : mBlacklist); scroll->clearRows(); for (const auto& value : list) { LLSD element; element["columns"][0]["column"] = "list"; element["columns"][0]["value"] = value; scroll->addElement(element); } enableButton(getChildView(white ? "remove_whitelist" : "remove_blacklist"), scroll); }
BOOL CNOutBarCtrl::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { int dir; int delta = zDelta / WHEEL_DELTA; if (delta > 0) dir = SCROLL_DIR_UP; else { dir = SCROLL_DIR_DOWN; delta = -delta; } if (canScroll(dir)) scroll(dir, delta); return CWnd::OnMouseWheel(nFlags, zDelta, pt); }
void LCDST7565::menuUp() { buty--; bool onTop = false; do { // Only move once until button release or MAX_HOLD_COUNT reached if (_current_line > 0) _current_line--; else scroll(-1); // We're at the top line, scroll up if possible if (_item_index > 0) { _item_index--; } else onTop = true; } while( _menu_items[_item_index].type == MENU_ITEM_TYPE_LINE && ! onTop); update(); }
void comboWnd::ensureVisible(int iIndex) { if( m_pOwner->getCurSel() < 0 ) return; m_pLayout->findSelectable(m_pOwner->getCurSel(), false); RECT rcItem = m_pLayout->getItemAt(iIndex)->getPosition(); RECT rcList = m_pLayout->getPosition(); scrollBarUC* pHorizontalScrollBar = m_pLayout->getHorizontalScrollBar(); if( pHorizontalScrollBar && pHorizontalScrollBar->isVisible() ) rcList.bottom -= pHorizontalScrollBar->getFixedHeight(); int iPos = m_pLayout->getScrollPos().cy; if( rcItem.top >= rcList.top && rcItem.bottom < rcList.bottom ) return; int dx = 0; if( rcItem.top < rcList.top ) dx = rcItem.top - rcList.top; if( rcItem.bottom > rcList.bottom ) dx = rcItem.bottom - rcList.bottom; dx += rectHeight(rcList) - rectHeight(rcItem); // 确保显示行在最上显示 scroll(0, dx); }
static void doCRNL(int cr, int nl) { if (nl) { if (++row == maxRow) { scroll(); /* Scroll the screen now */ row = maxRow - 1; } nLines++; } if (cr) column = 0; /* Move cursor on the next location */ if (cr || nl) wr_cursor(row * maxCol + column, ioCrtBaseAddr); }
void kputc(char c) { short val; switch(c) { case '\0': // umm, what? we can't print this! return; case '\n': cur_c->c_col = 0; cur_c->c_row++; break; case '\t': kputs(" "); return; case '\r': cur_c->c_row = 0; break; case '\b': if (cur_c->c_col == 0) { if (cur_c->c_row == 0) return; cur_c->c_row--; cur_c->c_col = CON_COLUMNS - 1; } else { cur_c->c_col--; } default: val = (cur_c->c_back << 4); val |= (cur_c->c_fore & 0x0F) << 8; if (c == '\b') val |= ' ' & 0xFF; else val |= c & 0xFF; cur_c->buffer[(cur_c->c_row * CON_COLUMNS) + cur_c->c_col] = val; if (c == '\b') break; cur_c->c_col++; } if (cur_c->c_col >= CON_COLUMNS) { cur_c->c_col = 0; cur_c->c_row++; } while (cur_c->c_row >= CON_ROWS) { scroll(); cur_c->c_row--; } update_cursor(cur_c->c_row, cur_c->c_col); }
void QtBasicGraph::addPoint(const QPointF &value) { QPointF oldval; if (!m_values.isEmpty()) oldval = m_values.last(); if (!oldval.isNull() && value.x() < oldval.x()) { qWarning("QtBasicGraph::addPoint(): the new point's x value is less than the last point's x value."); return; } m_values << value; if (!oldval.isNull()) { qreal deltaf = width() * ((value.x() - oldval.x()) / m_xrange); int delta = (int) deltaf; m_scroll_error += (deltaf - qreal(delta)); if (m_scroll_error > qreal(1.0)) { m_scroll_error--; delta++; } if (delta < width()) { scroll(-delta, 0); update(width() - delta - 3, 0, delta + 3, height()); } else { m_scroll_error = 0; update(); } // purge old data qreal left = value.x() - m_xrange; int i; for (i = 0; i < m_values.size(); ++i) { if (m_values[i].x() > left) break; } i--; if (i > 0 && i < (m_values.size() - 1)) m_values.erase(m_values.begin(), m_values.begin() + i); } }
/* Puts a single character on the screen */ void putch(char c) { unsigned short *where; unsigned att = attrib << 8; /* Handle a backspace, by moving the cursor back one space */ if(c == 0x08) { if(csr_x != 0) csr_x--; where = textmemptr + (csr_y * 80 + csr_x); *where = ' ' | att; /* clear last ch */ } /* Handles a tab by incrementing the cursor's x, but only * to a point that will make it divisible by 8 */ else if(c == 0x09) { csr_x = (csr_x + 8) & ~(8 - 1); } /* Handles a 'Carriage Return', which simply brings the * cursor back to the margin */ else if(c == '\r') { csr_x = 0; } /* We handle our newlines the way DOS and the BIOS do: we * treat it as if a 'CR' was also there, so we bring the * cursor to the margin and we increment the 'y' value */ else if(c == '\n') { csr_x = 0; csr_y++; } /* Any character greater than and including a space, is a * printable character. The equation for finding the index * in a linear chunk of memory can be represented by: * index = [(y * width) + x] */ else if(c >= ' ') { where = textmemptr + (csr_y * 80 + csr_x); *where = c | att; /* Character AND attributes: color */ csr_x++; } /* If the cursor has reached the edge of the screen's width, we * insert a new line in there */ if(csr_x >= 80){ csr_x = 0; csr_y++; } scroll(); move_csr(); }
void putch(char c) /// Output a single charecter to the screen { unsigned short *where; unsigned att = attrib << 8; if(c == 0x08) // Handle a Backspace as a control charecter { if(csr_x != 0) { csr_x--; // Move it back one space where = textmemptr + (csr_y * 80 + csr_x); // Find where we are *where = ' ' | att; // Make it blank. } } else if(c == 0x09) // Handle a Tab { csr_x = (csr_x + 8) & ~(8 - 1); // Move the cursor forward modulus 8 } else if(c == '\r') // Carriage return { csr_x = 0; // Return the cursor to the beginning of the screen } else if(c == '\n') // Newline! { csr_x = 0; // Carriage return is included in the newline csr_y++; // Next line on the screen } else if(c >= ' ') // Any ASCII non-Controll code: { where = textmemptr + (csr_y * 80 + csr_x); *where = c | att; // Character AND attributes: color csr_x++; } if(csr_x >= 80) // Check to see if we overflowed into next line { csr_x = 0; // Adjust the line appropriately csr_y++; // Increment line pointer } scroll(); // Check to see if we need to scroll the screen move_csr(); // Move the cursor to it's new home. }