static inline void sca_rx(card_t *card, port_t *port, pkt_desc *desc, u16 rxin) { struct net_device *dev = port_to_dev(port); struct net_device_stats *stats = hdlc_stats(dev); struct sk_buff *skb; u16 len; u32 buff; #ifndef ALL_PAGES_ALWAYS_MAPPED u32 maxlen; u8 page; #endif len = readw(&desc->len); skb = dev_alloc_skb(len); if (!skb) { stats->rx_dropped++; return; } buff = buffer_offset(port, rxin, 0); #ifndef ALL_PAGES_ALWAYS_MAPPED page = buff / winsize(card); buff = buff % winsize(card); maxlen = winsize(card) - buff; openwin(card, page); if (len > maxlen) { memcpy_fromio(skb->data, winbase(card) + buff, maxlen); openwin(card, page + 1); memcpy_fromio(skb->data + maxlen, winbase(card), len - maxlen); } else #endif memcpy_fromio(skb->data, winbase(card) + buff, len); #if !defined(PAGE0_ALWAYS_MAPPED) && !defined(ALL_PAGES_ALWAYS_MAPPED) /* select pkt_desc table page back */ openwin(card, 0); #endif skb_put(skb, len); #ifdef DEBUG_PKT printk(KERN_DEBUG "%s RX(%i):", dev->name, skb->len); debug_frame(skb); #endif stats->rx_packets++; stats->rx_bytes += skb->len; skb->mac.raw = skb->data; skb->dev = dev; skb->dev->last_rx = jiffies; skb->protocol = hdlc_type_trans(skb, dev); netif_rx(skb); }
int ft_act(t_list **list, t_list **beg, t_coor *cr, char *r_ch) { int ret; ret = 0; signal(SIGWINCH, knowresize); signal(SIGTSTP, interrupt); signal(SIGINT, ctrlc); signal(SIGQUIT, ctrlc); while (*(unsigned int *)r_ch != ESC && !ret) { ft_bzero(r_ch, 5); read(0, r_ch, 4); if (*(unsigned int *)r_ch == RETURN) ret++; else if ((*(unsigned int *)r_ch == DEL || *(unsigned int *)r_ch == DEL2) && *list == (*list)->next) *(unsigned int *)r_ch = ESC; else { ft_moov((char *)r_ch, list, beg, cr); winsize(cr); ft_print_list(*list, *beg, cr); } } return (ret); }
static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u16 rxin) { struct net_device *dev = port_to_dev(port); struct sk_buff *skb; u16 len; u32 buff; u32 maxlen; u8 page; len = readw(&desc->len); skb = dev_alloc_skb(len); if (!skb) { dev->stats.rx_dropped++; return; } buff = buffer_offset(port, rxin, 0); page = buff / winsize(card); buff = buff % winsize(card); maxlen = winsize(card) - buff; openwin(card, page); if (len > maxlen) { memcpy_fromio(skb->data, winbase(card) + buff, maxlen); openwin(card, page + 1); memcpy_fromio(skb->data + maxlen, winbase(card), len - maxlen); } else memcpy_fromio(skb->data, winbase(card) + buff, len); #ifndef PAGE0_ALWAYS_MAPPED openwin(card, 0); #endif skb_put(skb, len); #ifdef DEBUG_PKT printk(KERN_DEBUG "%s RX(%i):", dev->name, skb->len); debug_frame(skb); #endif dev->stats.rx_packets++; dev->stats.rx_bytes += skb->len; skb->protocol = hdlc_type_trans(skb, dev); netif_rx(skb); }
// virtual redefinie void GUIG::Progress::init(unsigned int x, unsigned int y) { wx = x; wy = y; Ogre::Vector2 winsize(wx, wy); bg = this->addOverlayImage(winsize, Ogre::Vector2(1920, 1080), Ogre::Vector2(0, 0), "Progress_bg", "background.jpg", true); bg->changeZOrder(0); pourcent = this->addOverlayText(winsize, Ogre::Vector2(400, 20), Ogre::Vector2(900, 900), "Progress_pourcent", "empty.png", "0", true); pourcent->setVisible(false); }
void GUIG::Progress::infoMember(const std::string &pseudo, Race::Race r, unsigned int team) { int previousSize = users.size(); Ogre::Vector2 winsize(wx, wy); users[pseudo].race = r; users[pseudo].team = team; users[pseudo].endLoading = false; if (previousSize != users.size()) { this->addOverlayText(winsize, Ogre::Vector2(400, 20), Ogre::Vector2(0, 0), "Progress_pseudo_" + pseudo, "empty.png", pseudo, true)->setVisible(false); } draw(); }
inline void processActions(const nv_math::vec2i &window, const nv_math::vec2f &mouse, int mouseButtonFlags, int wheel) { int changed = m_lastButtonFlags ^ mouseButtonFlags; m_lastButtonFlags = mouseButtonFlags; int panFlag = m_sceneOrtho ? 1<<0 : 1<<2; int zoomFlag = 1<<1; int rotFlag = m_sceneOrtho ? 1<<2 : 1<<0; m_panning = !!(mouseButtonFlags & panFlag); m_zooming = !!(mouseButtonFlags & zoomFlag); m_rotating = !!(mouseButtonFlags & rotFlag); m_zoomingWheel = wheel != m_lastWheel; m_startZoomWheel = m_lastWheel; m_lastWheel = wheel; if (m_rotating){ m_panning = false; m_zooming = false; } if (m_panning && (changed & panFlag)){ // pan m_startPan = mouse; m_startMatrix = m_viewMatrix; } if (m_zooming && (changed & zoomFlag)){ // zoom m_startMatrix = m_viewMatrix; m_startZoom = mouse; m_startZoomOrtho = m_sceneOrthoZoom; } if (m_rotating && (changed & rotFlag)){ // rotate m_startRotate = mouse; m_startMatrix = m_viewMatrix; } if (m_zooming || m_zoomingWheel){ float dist = m_zooming ? -(nv_math::dot( mouse - m_startZoom ,nv_math::vec2f(-1,1)) * m_sceneDimension * m_senseZoom) : (float(wheel - m_startZoomWheel) * m_sceneDimension * m_senseWheelZoom); if (m_zoomingWheel){ m_startMatrix = m_viewMatrix; } if (m_sceneOrtho){ m_sceneOrthoZoom = std::max(0.0001f,m_startZoomOrtho - (dist)); } else{ nv_math::mat4f delta = nv_math::translation_mat4(nv_math::vec3f(0,0,dist * 2.0f)); m_viewMatrix = delta * m_startMatrix; } } if (m_panning){ float aspect = float(window.x)/float(window.y); nv_math::vec3f winsize(window.x, window.y, 1.0f); nv_math::vec3f ortho(m_sceneOrthoZoom * aspect, m_sceneOrthoZoom, 1.0f); nv_math::vec3f sub( mouse - m_startPan, 0.0f); sub /= winsize; sub *= ortho; sub.y *= -1.0; if (!m_sceneOrtho){ sub *= m_sensePan * m_sceneDimension; } nv_math::mat4f delta; delta.as_translation(sub); m_viewMatrix = delta * m_startMatrix; } if (m_rotating){ float aspect = float(window.x)/float(window.y); nv_math::vec2f angles = (mouse - m_startRotate) * m_senseRotate; nv_math::vec3f center = nv_math::vec3f(m_startMatrix * nv_math::vec4f(m_sceneOrbit,1.0f)); nv_math::mat4f rot = nv_math::rotation_yaw_pitch_roll(angles.x, angles.y, 0.0f); nv_math::mat4f delta = nv_math::translation_mat4(center) * rot * nv_math::translation_mat4(-center); m_viewMatrix = delta * m_startMatrix; } }
void GUI::Tooltip::init(unsigned int winX, unsigned int winY) { Ogre::Vector2 winsize(winX, winY); // INIT scene }
{ struct winsize w; if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) == -1) return std::make_pair(0,0); return std::make_pair(w.ws_row, w.ws_col); } template <typename CharT, typename Traits> typename std::basic_ostream<CharT, Traits> & eline(std::basic_ostream<CharT, Traits> &out, size_t pos, size_t n = 0) { out << "\r\E[" << pos << 'C'; if (n == 0) return out << ELINE; n = std::min(n, winsize().second - pos); for(size_t i = 0; i < n; ++i) out.put(' '); return out << "\r\E[" << pos << 'C'; } } namespace dwatch { using show_type = void(std::ostream &, int64_t, bool); using range_type = std::pair<size_t, size_t>; std::function<bool(char c)> heuristic; std::function<show_type> show_function;