From: Benno Schulenberg Date: Mon, 24 Mar 2014 20:35:17 +0000 (+0000) Subject: Printing menu numbers for debugging in hex. X-Git-Tag: v2.3.3~255 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=18c252d5e770833054aad5c6bb1297cbfe9b5e38;p=nano.git Printing menu numbers for debugging in hex. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4675 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index f24b1a91..2ef3170b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,8 @@ before trying the legacy ways. Patch by Mike Frysinger. * configure.ac - Add a configure flag to disable the use of the fattening libmagic. Patch by Mike Frysinger. + * src/{global,rcfile,winio}.c - Print menu numbers for debugging + in hex, and tweak a few of those debugging messages. 2014-03-23 Benno Schulenberg * src/rcfile.c (parse_keybinding, parse_unbinding) - Improve a diff --git a/src/global.c b/src/global.c index e5fdc679..37384f74 100644 --- a/src/global.c +++ b/src/global.c @@ -354,7 +354,7 @@ const sc *first_sc_for(int menu, void (*func)(void)) return rawsc; #ifdef DEBUG - fprintf(stderr, "Whoops, returning null given func %ld in menu %d\n", (long) func, menu); + fprintf(stderr, "Whoops, returning null given func %ld in menu %x\n", (long) func, menu); #endif /* Otherwise... */ return NULL; @@ -395,8 +395,7 @@ void add_to_sclist(int menu, const char *scstring, void (*func)(void), int toggl assign_keyinfo(s); #ifdef DEBUG - fprintf(stderr, "list val = %d\n", (int) s->menu); - fprintf(stderr, "Hey, set sequence to %d for shortcut \"%s\"\n", s->seq, scstring); + fprintf(stderr, "Setting sequence to %d for shortcut \"%s\" in menu %x\n", s->seq, scstring, (int) s->menu); #endif } @@ -490,7 +489,7 @@ void print_sclist(void) for (s = sclist; s->next != NULL; s = s->next) { f = sctofunc(s); if (f) - fprintf(stderr, "Shortcut \"%s\", function: %s, menus %d\n", s->keystr, f->desc, f->menus); + fprintf(stderr, "Shortcut \"%s\", function: %s, menus %x\n", s->keystr, f->desc, f->menus); else fprintf(stderr, "Hmm, didnt find a func for \"%s\"\n", s->keystr); } diff --git a/src/rcfile.c b/src/rcfile.c index c1cdcfdc..e1001676 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -521,7 +521,7 @@ void parse_keybinding(char *ptr) } #ifdef DEBUG - fprintf(stderr, "newsc now address %d, menu func assigned = %d, menu = %d\n", + fprintf(stderr, "newsc now address %d, func assigned = %d, menu = %x\n", &newsc, newsc->scfunc, menu); #endif @@ -544,10 +544,10 @@ void parse_keybinding(char *ptr) we found for the same menu, then make this the new beginning. */ for (s = sclist; s != NULL; s = s->next) { if (((s->menu & newsc->menu)) && s->seq == newsc->seq) { - s->menu &= ~newsc->menu; #ifdef DEBUG - fprintf(stderr, "replaced menu entry %d\n", s->menu); + fprintf(stderr, "replacing entry in menu %x\n", s->menu); #endif + s->menu &= ~newsc->menu; } } newsc->next = sclist; @@ -602,16 +602,16 @@ void parse_unbinding(char *ptr) } #ifdef DEBUG - fprintf(stderr, "unbinding \"%s\" from menu = %d\n", keycopy, menu); + fprintf(stderr, "unbinding \"%s\" from menu %x\n", keycopy, menu); #endif /* Now find the appropriate entries in the menu to delete. */ for (s = sclist; s != NULL; s = s->next) { if (((s->menu & menu)) && !strcmp(s->keystr,keycopy)) { - s->menu &= ~menu; #ifdef DEBUG - fprintf(stderr, "deleted menu entry %d\n", s->menu); + fprintf(stderr, "deleting entry from menu %x\n", s->menu); #endif + s->menu &= ~menu; } } } diff --git a/src/winio.c b/src/winio.c index 00a384fe..900b7180 100644 --- a/src/winio.c +++ b/src/winio.c @@ -1786,13 +1786,13 @@ const sc *get_shortcut(int menu, int *kbinput, bool && ((s->type == META && *meta_key == TRUE && *kbinput == s->seq) || (s->type != META && *kbinput == s->seq))) { #ifdef DEBUG - fprintf (stderr, "matched seq \"%s\" and btw meta was %d (menus %d = %d)\n", s->keystr, *meta_key, menu, s->menu); + fprintf (stderr, "matched seq \"%s\", and btw meta was %d (menus %x = %x)\n", s->keystr, *meta_key, menu, s->menu); #endif return s; } } #ifdef DEBUG - fprintf (stderr, "matched nothing btw meta was %d\n", *meta_key); + fprintf (stderr, "matched nothing, btw meta was %d\n", *meta_key); #endif return NULL; @@ -2387,7 +2387,7 @@ void bottombars(int menu) continue; #ifdef DEBUG - fprintf(stderr, "found one! f->menus = %d, desc = \"%s\"\n", f->menus, f->desc); + fprintf(stderr, "found one! f->menus = %x, desc = \"%s\"\n", f->menus, f->desc); #endif s = first_sc_for(menu, f->scfunc); if (s == NULL) {