~ubuntu-branches/debian/sid/genius/sid

« back to all changes in this revision

Viewing changes to src/calc.c

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler
  • Date: 2014-04-07 15:43:04 UTC
  • mfrom: (1.2.6)
  • Revision ID: package-import@ubuntu.com-20140407154304-21r03zdnfc571kz0
Tags: 1.0.17-1
* Take over package from pkg-gnome
* New upstream release. Closes: #716731
* Bump standards version.
* Update Vcs fields to Git.
* Move to single-debian-patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* GENIUS Calculator
2
 
 * Copyright (C) 1997-2009 Jiri (George) Lebl
 
2
 * Copyright (C) 1997-2012 Jiri (George) Lebl
3
3
 *
4
4
 * Author: Jiri (George) Lebl
5
5
 *
163
163
 * not really needed to be done fast, but during startup it is done many times
164
164
 */
165
165
static GelHelp *get_help_cache = NULL;
166
 
static const char *get_help_func_cache = NULL;
167
166
 
168
167
GelHelp *
169
168
gel_get_help (const char *func, gboolean insert)
171
170
        GelHelp *help;
172
171
 
173
172
        if (get_help_cache != NULL &&
174
 
            /* just checking pointers is not safe, but it is fast,
175
 
             * if pointers are same it is likely the string will be the same */
176
 
            get_help_func_cache == func &&
177
173
            strcmp (get_help_cache->func, func) == 0)
178
174
                return get_help_cache;
179
175
 
189
185
        }
190
186
 
191
187
        if (help != NULL) {
192
 
                get_help_func_cache = func;
193
188
                get_help_cache = help;
194
189
        }
195
190
 
1993
1988
 
1994
1989
        while ( ! break_on_next && fgets (buf, buf_size, fp) != NULL) {
1995
1990
                char *p;
1996
 
                char *b2;
 
1991
                char *b2 = NULL;
1997
1992
                GelToken *tok, *symbolic_tok = NULL;
1998
1993
                int size, nargs, vararg, propagate_mod, no_mod_all_args;
1999
1994
                int local_all, never_on_subst_list, built_subst_dict;
2589
2584
 
2590
2585
        if (strcmp (cmd, "load") == 0) {
2591
2586
                gel_output_full_string (gel_main_out,
2592
 
                                        _("Load a file into the interpretor"));
 
2587
                                        _("Load a file into the interpreter"));
2593
2588
        } else if (strcmp (cmd, "plugin") == 0) {
2594
2589
                gel_output_full_string (gel_main_out,
2595
2590
                                        _("Load a plugin"));
2726
2721
                                   NULL /* help_html */ };
2727
2722
        GelEFunc *f;
2728
2723
        int i;
 
2724
        gboolean documented_or_func_or_param = TRUE;
2729
2725
 
2730
2726
        gel_output_push_nonotify (gel_main_out);
2731
2727
 
2762
2758
                return;
2763
2759
        }
2764
2760
 
2765
 
        do_cyan ();
2766
2761
 
2767
2762
        f = d_lookup_global (d_intern (text));
2768
2763
 
 
2764
        if (f == NULL &&
 
2765
            help == &not_documented &&
 
2766
            ! d_intern (text)->parameter) {
 
2767
                documented_or_func_or_param = FALSE;
 
2768
        }
 
2769
 
 
2770
        if (documented_or_func_or_param)
 
2771
                do_cyan ();
 
2772
 
2769
2773
        if (d_intern (text)->parameter) {
2770
2774
                gel_output_printf_full (gel_main_out, FALSE, "%s%s\n",
2771
2775
                                        _("Parameter: "), text);
2773
2777
                   || (f->type == GEL_BUILTIN_FUNC &&
2774
2778
                       f->named_args == NULL &&
2775
2779
                       ! f->vararg)) {
2776
 
                gel_output_printf_full (gel_main_out, FALSE, "%s\n", text);
 
2780
                if (documented_or_func_or_param)
 
2781
                        gel_output_printf_full (gel_main_out, FALSE, "%s\n", text);
2777
2782
        } else {
2778
2783
                GSList *li;
2779
2784
                gel_output_printf_full (gel_main_out, FALSE, "%s (", text);
2789
2794
                        gel_output_full_string (gel_main_out, "...");
2790
2795
                gel_output_full_string (gel_main_out, ")\n");
2791
2796
        }
2792
 
        do_green ();
 
2797
        if (documented_or_func_or_param)
 
2798
                do_green ();
2793
2799
 
2794
2800
        if (help->aliases != NULL) {
2795
2801
                GSList *li;
2803
2809
                g_string_free (gs, TRUE);
2804
2810
        }
2805
2811
 
2806
 
        if (help->description != NULL) {
 
2812
        if (documented_or_func_or_param && help->description != NULL) {
2807
2813
                gel_output_printf_full (gel_main_out, FALSE,
2808
2814
                                        _("Description: %s\n"),
2809
2815
                                        _(help->description));