Пример #1
0
int Node_Delete (root_t* tree, tree_t* node)
{
    TREE_CHECK (tree);
    NODE_CHECK (node);

    if (node->left)
    {
        TEC (Node_Delete (tree, node->left), node->left);
    }

    if (node->right)
    {
        TEC (Node_Delete (tree, node->right), node->right);
    }

    if (node->parent->left == node) node->parent->left = NULL;
    if (node->parent->right == node) node->parent->right = NULL;

    Tree_Update_Sizes (tree, node->parent, -1);

    TEC (Node_Destruct (node), node);

    TREE_CHECK (tree);

    return TREE_OK;
}
Пример #2
0
int Tree_Destruct (root_t* tree)
{
    TREE_CHECK (tree);

    if (tree->root->left)  TEC (Node_Delete (tree, tree->root->left),  tree);
    if (tree->root->right) TEC (Node_Delete (tree, tree->root->right), tree);

    ISERR (Node_Destruct (tree->root), tree);

    tree->size = Poison;

    free (tree);

    return TREE_OK;
}
Пример #3
0
int Node_Add_Right (root_t* tree, tree_t* node, tree_t* child)
{
    TREE_CHECK (tree);
    NODE_CHECK (node);
    NODE_CHECK (child);

    if (node->right == NULL)
    {
        node->right = child;
        node->right->parent = node;

        TEC (Tree_Update_Sizes (tree, node, child->size), node);
    }

    TREE_CHECK (tree);
    NODE_CHECK (node);

    return TREE_OK;
}
Пример #4
0
//---------------------------------------------------------------------------
// RealArray Ionosphere::Correction()
// This function is used to calculate Ionosphere correction
// Return values:
//    . Range correction (unit: m)
//    . Angle correction (unit: radian)
//    . Time correction  (unit: s)
//---------------------------------------------------------------------------
RealArray Ionosphere::Correction()
{
   Real freq = GmatPhysicalConstants::SPEED_OF_LIGHT_VACUUM / waveLength;
   Real tec = TEC();                  // Equation 6.70 of MONTENBRUCK and GILL
   Real drho = 40.3*tec/(freq*freq);  // Equation 6.69 of MONTENBRUCK and GILL		// unit: meter
   Real dphi = 0;                     //BendingAngle()*180/GmatConstants::PI;
                                      // It has not been defined yet
   Real dtime = drho/GmatPhysicalConstants::SPEED_OF_LIGHT_VACUUM;				// unit: s
   
   //MessageInterface::ShowMessage
   //   ("Ionosphere::Correction: freq = %.12lf MHz,  tec = %.12lfe16,  "
   //    "drho = %.12lfm, dphi = %f, dtime = %.12lfs\n", freq/1.0e6,
   //    tec/1.0e16, drho, dphi*3600, dtime);
   RealArray ra;
   ra.push_back(drho);
   ra.push_back(dphi);
   ra.push_back(dtime);
   
   return ra;
}
Пример #5
0
int Node_Add_Left (root_t* tree, tree_t* node, tree_t* child)
{
    TREE_CHECK (tree);
    NODE_CHECK (node);
    NODE_CHECK (child);

    if (node->left == NULL)
    {
        node->left = child;
        node->left->parent = node;

        TEC (Tree_Update_Sizes (tree, node, child->size), node);
    }

    Tree_Dump (stdout, tree);

    TREE_CHECK (tree);
    NODE_CHECK (node);

    return TREE_OK;
}
Пример #6
0
gboolean parse_options(int *argc, char ***argv)
{
    GError *error = NULL;
    GOptionContext *context = NULL;

    GOptionEntry entries[] =
    {
        {
            "fullscreen", 0, 0, G_OPTION_ARG_NONE,
            &(settings.fullscreen), N_("Start the program in full screen"), NULL
        },
        {
            "version", 'v', 0, G_OPTION_ARG_NONE,
            &(settings.show_version), N_("Show program version and revision"), NULL
        },
        {
            "quit", 'q', 0, G_OPTION_ARG_NONE,
            &(settings.quit), N_("Quits the running gmpc"), NULL
        },
        {
            "disable-plugins", 0, 0, G_OPTION_ARG_NONE,
            &(settings.disable_plugins), N_("Don't load the plugins"), NULL
        },
        {
            "config", 0, 0, G_OPTION_ARG_FILENAME,
            &(settings.config_path), N_("Load alternative config file"), "Path"
        },
        {
            "debug-level", 'd', 0, G_OPTION_ARG_INT,
            &(settings.debug_level), N_("Set the debug level"), "level"
        },
        {
            "start-hidden", 'h', 0, G_OPTION_ARG_NONE,
            &(settings.start_hidden), N_("Start gmpc hidden to tray"), NULL
        },
        {
            "clean-cover-db", 0, 0, G_OPTION_ARG_NONE,
            &(settings.clean_config), N_("Remove all failed hits from metadata cache"), NULL
        },
        {
            "bug-information", 'b', 0, G_OPTION_ARG_NONE,
            &(settings.show_bug_information), N_("Show bug information"), NULL
        },
        {
            "log-filter", 'f', 0, G_OPTION_ARG_CALLBACK,
            log_add_filter, N_("Shows all output from a certain log domain"), "<Log domain>"
        },
        {
            "profile", 'p', 0, G_OPTION_ARG_STRING,
            &(settings.profile_name), N_("Select a profile"), "<Profile Name>"
        },
        {
            "icon-theme", 'i', 0, G_OPTION_ARG_STRING,
            &(settings.icon_theme), N_("Run GMPC with a different icon theme"), "<icon theme name>"
        },

        {NULL}
    };
	INIT_TIC_TAC();
    context = g_option_context_new(_("Gnome Music Player Client"));
	TEC("context new")
    g_option_context_add_main_entries(context, entries, "gmpc");
	TEC(" add main context")
    g_option_context_add_group(context, gtk_get_option_group(TRUE));
	TEC("Add gtk option group")
    g_option_context_add_group(context, egg_sm_client_get_option_group());
	TEC("Add egg sm option group")
    g_option_context_parse(context, argc, argv, &error);
	TEC("Parse option group")
    g_option_context_free(context);
    if (error)
    {
        g_log(NULL, G_LOG_LEVEL_ERROR, "Failed to parse commandline options: %s", error->message);
        g_error_free(error);
        return FALSE;
    }
    return TRUE;
}