//--------------------------------------------------------------------------------------- LUnits GmoBox::get_content_left() { ImoStyle* pStyle = get_style(); if (pStyle) return get_left() + pStyle->margin_left() + pStyle->border_width_left() + pStyle->padding_left(); else return get_left(); }
/** * \brief Progress in the state scome_back. */ void ptb::gorilla::progress_come_back(bear::universe::time_type elapsed_time) { get_rendering_attributes().mirror(get_left() >= m_origin_position.x ); if ( scan(get_rendering_attributes().is_mirrored(), m_scan_distance) ) choose_angry_action(); else if ( std::abs(get_left() - m_origin_position.x) < 10 ) start_model_action("idle"); else if ( has_right_contact() || has_left_contact() ) start_model_action("idle"); else if ( get_rendering_attributes().is_mirrored() ) add_internal_force( bear::universe::force_type(-70000, 0) ); else add_internal_force( bear::universe::force_type(70000, 0) ); } // gorilla::progress_come_back()
/* * Find a node by ID. Returned value is the node address, or ADDR_NULL if * the node is not found. * * If addr_link is not NULL, then '*addr_link' is set to the address of the * last followed link. If the found node is the root, or if the tree is * empty, then '*addr_link' is set to ADDR_NULL. */ static uint32_t find_node(br_ssl_session_cache_lru *cc, const unsigned char *id, uint32_t *addr_link) { uint32_t x, y; x = cc->root; y = ADDR_NULL; while (x != ADDR_NULL) { int r; r = memcmp(id, cc->store + x + SESSION_ID_OFF, SESSION_ID_LEN); if (r < 0) { y = x + TREE_LEFT_OFF; x = get_left(cc, x); } else if (r == 0) { if (addr_link != NULL) { *addr_link = y; } return x; } else { y = x + TREE_RIGHT_OFF; x = get_right(cc, x); } } if (addr_link != NULL) { *addr_link = y; } return ADDR_NULL; }
static void pretty_print_return(lexeme tree) { lexeme next = get_left(tree); lexeme_destroy(tree); printf("return("); pretty_print(next); printf(")"); }
/** * Returns the position within the parent window. */ gcc_pure const RECT get_position() const { RECT rc; #ifdef ENABLE_SDL rc.left = get_left(); rc.top = get_top(); rc.right = get_width(); rc.bottom = get_height(); #else rc = get_screen_position(); HWND parent = ::GetParent(hWnd); if (parent != NULL) { POINT pt; pt.x = rc.left; pt.y = rc.top; ::ScreenToClient(parent, &pt); rc.left = pt.x; rc.top = pt.y; pt.x = rc.right; pt.y = rc.bottom; ::ScreenToClient(parent, &pt); rc.right = pt.x; rc.bottom = pt.y; } #endif return rc; }
void max_heapify(Data& data, Index idx) { auto max = idx; for (;;) { auto left = get_left(idx); if (left < data.size() && data[left] > data[max]) { max = left; } auto right = get_right(idx); if (right < data.size() && data[right] > data[max]) { max = right; } if (max != idx) { std::swap(data[max], data[idx]); idx = max; } else { break; } } }
/* * Iterators */ static inline struct bstree_node *get_first(struct bstree_node *node) { struct bstree_node *left; while ((left = get_left(node))) node = left; return node; }
struct bstree_node *bstree_prev(const struct bstree_node *node) { struct bstree_node *left = get_left(node); if (left) return get_last(left); return get_prev(node); }
int fill_tree(t_shell *shell, char *command_line) { t_tree *up; char **commands; int i; if ((commands = my_str_to_wordtab(command_line, " \t")) == NULL) return (nothing_more(shell)); i = -1; while (commands != NULL && commands[++i] != NULL) { if ((is_token(shell->tokens, commands[i]) >= 0) && ((shell->tree->right = malloc(sizeof(t_tree))) != NULL)) { shell->tree->token = is_token(shell->tokens, commands[i]); if ((shell->tree->left = get_left(commands, i)) == NULL) return (-1); up = shell->tree; shell->tree = shell->tree->right; shell->tree->up = up; return (fill_tree(shell, new_command(commands, i))); } } return (last_command(shell, commands, i)); }
/** * \brief Align the other item of the collision on the bottom of \a this. * \param info Some informations about the collision. * \param pos The bottom left position to put the other item at. * \param policy The description of how to align the items. */ bool bear::universe::physical_item::collision_align_bottom ( const collision_info& info, const position_type& pos, const collision_align_policy& policy ) { bool result(false); if ( collision_align_at(info.other_item(), pos) ) { result = true; physical_item& that = info.other_item(); switch ( policy.get_contact_mode() ) { case contact_mode::full_contact: that.set_top_contact(); set_bottom_contact(); break; case contact_mode::range_contact: that.set_top_contact( get_left(), get_right() ); set_bottom_contact( that.get_left(), that.get_right() ); break; case contact_mode::no_contact: // nothing to do break; } info.get_collision_repair().set_contact_normal (info.other_item(), vector_type(0, -1)); } return result; } // physical_item::collision_align_bottom()
// Checks the cache size and prunes if its over the limit. void Bootcache::prune () { if (size() <= Tuning::bootcacheSize) return; // Calculate the amount to remove auto count ((size() * Tuning::bootcachePrunePercent) / 100); decltype(count) pruned (0); // Work backwards because bimap doesn't handle // erasing using a reverse iterator very well. // for (auto iter (m_map.right.end()); count-- > 0 && iter != m_map.right.begin(); ++pruned) { --iter; beast::IP::Endpoint const& endpoint (iter->get_left()); Entry const& entry (iter->get_right()); JLOG(m_journal.trace()) << beast::leftw (18) << "Bootcache pruned" << endpoint << " at valence " << entry.valence(); iter = m_map.right.erase (iter); } JLOG(m_journal.debug()) << beast::leftw (18) << "Bootcache pruned " << pruned << " entries total"; }
TITANIUM_PROPERTY_GETTER(Animation, left) { auto left = get_left(); if (left) { return get_context().CreateNumber(*left); } return get_context().CreateUndefined(); }
/* * Function: int main(int argc, char args[]) * Description: process main function * Input: argc: parameter number * args: parameter value array * Output: none * Return: function exit status * Others: none */ int main( ) { int depth = 0; Bt * bt = create_bt( ); char a[10][10] = { "2", "8", "1", "3", "9", "4", "7", "5", "6", "0" }; char *b[10]; int i; Bt_Entry* entry; for( i = 0; i < 10; i++ ) { b[i] = a[i]; } init_bt( bt, b, 10, strcmp ); printf("pre order for this bt\n"); pre_order(bt->root,show_string); printf("in order for this bt\n"); in_order( bt->root, show_string ); printf("post order for this bt\n"); post_order(bt->root,show_string); printf("level order for this bt\n"); level_order(bt->root,show_string); special_level_order(bt->root,2,show_string); depth = calc_tree_depth( bt->root ); printf( "depth is %d\n", depth ); entry = get_entry( bt->root, "3", strcmp ); if( entry ) { printf( "entry item is %s\n", entry->item ); } else { printf( "entry is NULL\n" ); } set_entry( bt->root, "3", "33", strcmp ); in_order( bt->root, show_string ); entry = get_parent( bt->root, "33", strcmp ); printf( "parent item is %s\n", entry->item ); entry = get_right( bt->root, "5", strcmp ); if( entry ) { printf( "right item is %s\n", entry->item ); } entry = get_left( bt->root, "8", strcmp ); if( entry ) { printf( "left item is %s\n", entry->item ); } destroy_bt( bt, NULL ); }
static void pretty_print_call(lexeme tree) { lexeme caller = get_left(tree); lexeme argList = get_right(tree); lexeme_destroy(tree); pretty_print(caller); printf("("); pretty_print(argList); printf(")"); }
void get_round(Location cur, Location buf[]) { get_left(cur, &buf[0]); get_leftUp(cur, &buf[1]); get_rightUp(cur, &buf[2]); get_right(cur, &buf[3]); get_rightDown(cur, &buf[4]); get_leftDown(cur, &buf[5]); }
/* * Function: Bt_Entry* get_left( Bt_Entry* root, void* item, compare_item cmp ) * Description: get the left entry of the entry with item value * Input: root: bt root entry * item: search the entry by the item value * cmp: item value comparing function * Output: none * Return: Bt_Entry*: the left entry * Others: none */ Bt_Entry* get_left( Bt_Entry* root, void* item, compare_item cmp ) { Bt_Entry* entry; void *right_item; if( NULL == root ) { return NULL; } entry = root->right; if( NULL == entry ) { entry = get_left( root->left, item, cmp ); if( entry ) { return entry; } } if( entry ) { right_item = entry->item; if( 0 == cmp( right_item, item ) ) { return root->left; } else { entry = get_left( root->right, item, cmp ); if( entry ) { return entry; } entry = get_left( root->left, item, cmp ); if( entry ) { return entry; } } } return NULL; }
int t_line_follow() { printf("%d , %d , %d\n" , get_left() , get_middle() , get_right()); if (get_left() < THRESH && get_middle() < THRESH && get_right() < THRESH) // 0 , 0 , 0 // spin in place { mav(lego.left.port , LOW); mav(lego.right.port , -LOW); msleep(10); return 0; } if (get_left() > THRESH && get_middle() < THRESH && get_right() < THRESH) // 1 , 0 , 0 // { mav(lego.left.port , LOW); mav(lego.right.port , HIGH); msleep(10); return 0; } if (get_left() < THRESH && get_middle() > THRESH && get_right() < THRESH) // 0 , 1 , 0 { mav(lego.left.port , HIGH); mav(lego.right.port , HIGH); msleep(10); return 0; } if (get_left() < THRESH && get_middle() < THRESH && get_right() > THRESH) // 0 , 0 , 1 { mav(lego.left.port , HIGH); mav(lego.right.port , LOW); msleep(10); return 0; } if (get_left() > THRESH && get_middle() > THRESH && get_right() < THRESH) // 1 , 1 , 0 { mav(lego.left.port , HIGH); mav(lego.right.port , LOW); msleep(10); return 0; } if (get_left() < THRESH && get_middle() > THRESH && get_right() > THRESH) // 0 , 1 , 1 { mav(lego.left.port , HIGH); mav(lego.right.port , LOW); msleep(10); return 0; } if (get_left() > THRESH && get_middle() > THRESH && get_right() > THRESH) // 1 , 1 , 1 { mav(lego.left.port , LOW); mav(lego.right.port , -LOW); msleep(10); return 0; } return 0; }
int main() { while (b_button_clicked() == 0); while (a_button() == 0) { t_line_follow(); printf("%d , %d , %d\n" , get_left() , get_middle() , get_right()); } return 0; }
static int last_command(t_shell *shell, char **commands, const int i) { shell->tree->token = 7; shell->tree->left = get_left(commands, i); shell->tree->right = NULL; while (shell->tree->up != NULL) shell->tree = shell->tree->up; free_args(commands); return (0); }
static void pretty_print_bind(lexeme tree) { lexeme idPart = get_left(tree); lexeme bodyPart = get_right(tree); lexeme_destroy(tree); printf("bind("); pretty_print(idPart); printf(", "); pretty_print(bodyPart); printf(")"); }
static void pretty_print_lambda(lexeme tree) { lexeme paramList = get_left(tree); lexeme body = get_right(tree); lexeme_destroy(tree); printf("lambda(("); pretty_print(paramList); printf("), "); pretty_print(body); printf(")"); }
static void pretty_print_arglist(lexeme tree) { lexeme currentArg = get_left(tree); lexeme next = get_right(tree); lexeme_destroy(tree); pretty_print(currentArg); if (next != NULL) { printf(", "); pretty_print(next); } }
/** * \brief Get a given offensive coefficient on the state "come_back". * \param index The index of the attack. * \param other The other monster. * \param side The side of this through which the attack is done. */ unsigned int ptb::gorilla::get_offensive_coefficient_come_back ( unsigned int index, const monster& other, bear::universe::zone::position side ) const { // The gorilla attacks forward in come_back state. unsigned int result = super::get_offensive_coefficient(index, other, side); if ( ( index == indefensible_attack ) || ( index == normal_attack ) ) { if ( side == bear::universe::zone::middle_zone ) { if ( m_is_injured ) result = 0; else { const base_item* item = dynamic_cast<const base_item*>(&other); if ( ( item != NULL ) && get_rendering_attributes().is_mirrored() ) { if ( item->get_left() >= get_left() ) result = 0; } else if ( item->get_right() <= get_right() ) result = 0; } } else { const base_item* item = dynamic_cast<const base_item*>(&other); if ( ( item != NULL ) && get_rendering_attributes().is_mirrored() ) { if ( item->get_left() >= get_left() ) result = 0; } else if ( item->get_right() <= get_right() ) result = 0; } } return result; } // gorilla::get_offensive_coefficient_come_back()
void bc_perspective_camera::get_extend_points(extend& p_points) const { auto l_fov_tan = 2 * std::tanf(m_field_of_view / 2); auto l_near_clip_height = l_fov_tan * get_near_clip(); auto l_near_clip_width = l_near_clip_height * m_aspect_ratio; auto l_far_clip_height = l_fov_tan * get_far_clip(); auto l_far_clip_width = l_far_clip_height * m_aspect_ratio; auto l_near_clip_center = get_position() + get_forward() * get_near_clip(); auto l_far_clip_center = get_position() + get_forward() * get_far_clip(); p_points[0] = l_near_clip_center + get_left() * (l_near_clip_width / 2) + get_down() * (l_near_clip_height / 2); p_points[1] = l_near_clip_center + get_left() * (l_near_clip_width / 2) + get_up() * (l_near_clip_height / 2); p_points[2] = l_near_clip_center + get_right() * (l_near_clip_width / 2) + get_up() * (l_near_clip_height / 2); p_points[3] = l_near_clip_center + get_right() * (l_near_clip_width / 2) + get_down() * (l_near_clip_height / 2); p_points[4] = l_far_clip_center + get_left() * (l_far_clip_width / 2) + get_down() * (l_far_clip_height / 2); p_points[5] = l_far_clip_center + get_left() * (l_far_clip_width / 2) + get_up() * (l_far_clip_height / 2); p_points[6] = l_far_clip_center + get_right() * (l_far_clip_width / 2) + get_up() * (l_far_clip_height / 2); p_points[7] = l_far_clip_center + get_right() * (l_far_clip_width / 2) + get_down() * (l_far_clip_height / 2); }
static void pretty_print_unitlist(lexeme tree) { lexeme current = get_left(tree); lexeme next = get_right(tree); lexeme_destroy(tree); pretty_print(current); printf(";\n"); if (lexeme_get_type(next) != NIL) { printtabs(); pretty_print(next); } }
void Bootcache::onWrite (beast::PropertyStream::Map& map) { beast::PropertyStream::Set entries ("entries", map); for (auto iter = m_map.right.begin(); iter != m_map.right.end(); ++iter) { beast::PropertyStream::Map entry (entries); entry["endpoint"] = iter->get_left().to_string(); entry["valence"] = std::int32_t (iter->get_right().valence()); } }
static inline void rotate_left(struct splaytree_node *node) { struct splaytree_node *right = get_right(node); /* can't be NULL */ struct splaytree_node *l = get_left(right); if (l) set_right(l, node); else set_next(right, node); set_left(node, right); }
static inline void rotate_right(struct splaytree_node *node) { struct splaytree_node *left = get_left(node); /* can't be NULL */ struct splaytree_node *r = get_right(left); if (r) set_left(r, node); else set_prev(left, node); set_right(node, left); }
void WndForm::ReinitialiseLayout() { if (main_window.get_width() < get_width() || main_window.get_height() < get_height()) { // close dialog, it's creator may want to create a new layout mModalResult = mrChangeLayout; } else { // reposition dialog to fit into TopWindow int left = get_left(); int top = get_top(); if (get_right() > (int) main_window.get_width()) left = main_window.get_width() - get_width(); if (get_bottom() > (int) main_window.get_height()) top = main_window.get_height() - get_height(); if (left != get_left() || top != get_top()) move(left, top); } }
/** * \brief Check if a given item on bridge must be erase. * \param it Iterator on item to consider. * \param previous_pos Position of previous item. * \param next_pos Position of next item. */ bool bear::bridge::check_erase_item (items_list_iterator it, const universe::position_type& previous_pos, const universe::position_type& next_pos) const { return check_item ( it->get_reference_item()->get_center_of_mass(), previous_pos, next_pos, 0 ) || ( it->get_item().get() == NULL ) || ( it->get_item()->get_bottom() > get_top() ) || ( it->get_item()->get_horizontal_middle() < get_left() )|| ( it->get_item()->get_horizontal_middle() > get_right() ); } // bridge::check_erase_item()