* [PATCH] skip_quoted (updated)
@ 2002-11-18 7:20 Adam Fedor
2002-11-18 9:14 ` Klee Dienes
0 siblings, 1 reply; 5+ messages in thread
From: Adam Fedor @ 2002-11-18 7:20 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 163 bytes --]
This is an updated patch that adds a new function, skip_quoted_chars,
similar to skip_quoted. This will be used to skip past Objective-C
symbols in linespec.c
[-- Attachment #2: newskip.patch --]
[-- Type: text/plain, Size: 1403 bytes --]
2002-11-18 Adam Fedor <fedor@gnu.org>
* completer.c (skip_quoted_chars): New function.
* completer.h: Declare it.
Index: completer.c
===================================================================
RCS file: /cvs/src/src/gdb/completer.c,v
retrieving revision 1.11
diff -r1.11 completer.c
715a716,750
> /* Skip over a possibly quoted word (as defined by the standard quote
> characters and the specified word-break characters). Returns pointer
> to the location after the "word". */
>
> char *
> skip_quoted_chars (char *str, char *breakchars)
> {
> char quote_char = '\0';
> char *scan;
>
> for (scan = str; *scan != '\0'; scan++)
> {
> if (quote_char != '\0')
> {
> /* Ignore everything until the matching close quote char */
> if (*scan == quote_char)
> {
> /* Found matching close quote. */
> scan++;
> break;
> }
> }
> else if (strchr (gdb_completer_quote_characters, *scan))
> {
> /* Found start of a quoted string. */
> quote_char = *scan;
> }
> else if (strchr (breakchars, *scan))
> {
> break;
> }
> }
> return (scan);
> }
>
Index: completer.h
===================================================================
RCS file: /cvs/src/src/gdb/completer.h,v
retrieving revision 1.6
diff -r1.6 completer.h
43a44,45
> extern char *skip_quoted_chars (char *str, char *breakchars);
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] skip_quoted (updated) 2002-11-18 7:20 [PATCH] skip_quoted (updated) Adam Fedor @ 2002-11-18 9:14 ` Klee Dienes 2002-11-18 18:39 ` Jim Blandy 0 siblings, 1 reply; 5+ messages in thread From: Klee Dienes @ 2002-11-18 9:14 UTC (permalink / raw) To: Adam Fedor; +Cc: gdb-patches [-- Attachment #1: Type: text/plain, Size: 222 bytes --] It must be a good name for the function, because we picked the same one at Apple. You might also consider using our patch, which has the advantage of not replicating the code between skip_quoted and skip_quoted_chars: [-- Attachment #2: skip-quoted.txt --] [-- Type: text/plain, Size: 1439 bytes --] --- /Volumes/Storage/Users/kdienes/source/cygnus.cygnus/src/gdb/completer.c Sat Nov 16 12:52:18 2002 +++ completer.c Thu Nov 14 14:53:54 2002 @@ -683,11 +687,17 @@ location after the "word". */ char * -skip_quoted (char *str) +skip_quoted_chars (char *str, char *quotechars, char *breakchars) { char quote_char = '\0'; char *scan; + if (quotechars == NULL) + quotechars = gdb_completer_quote_characters; + + if (breakchars == NULL) + breakchars = gdb_completer_word_break_characters; + for (scan = str; *scan != '\0'; scan++) { if (quote_char != '\0') @@ -700,16 +710,23 @@ break; } } - else if (strchr (gdb_completer_quote_characters, *scan)) + else if (strchr (quotechars, *scan)) { /* Found start of a quoted string. */ quote_char = *scan; } - else if (strchr (gdb_completer_word_break_characters, *scan)) + else if (strchr (breakchars, *scan)) { break; } } + return (scan); +} + +char * +skip_quoted (char *str) +{ + return skip_quoted_chars (str, NULL, NULL); } --- /Volumes/Storage/Users/kdienes/source/cygnus.cygnus/src/gdb/completer.h Sat Nov 16 12:52:18 2002 +++ completer.h Thu Nov 14 14:53:54 2002 @@ -37,7 +37,8 @@ /* Exported to linespec.c */ -extern char *skip_quoted (char *str); +extern char *skip_quoted_chars (char *, char *, char *); +extern char *skip_quoted (char *); #endif /* defined (COMPLETER_H) */ [-- Attachment #3: Type: text/plain, Size: 1 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] skip_quoted (updated) 2002-11-18 9:14 ` Klee Dienes @ 2002-11-18 18:39 ` Jim Blandy 2002-11-18 19:03 ` Adam Fedor 2002-11-20 1:12 ` Klee Dienes 0 siblings, 2 replies; 5+ messages in thread From: Jim Blandy @ 2002-11-18 18:39 UTC (permalink / raw) To: Klee Dienes; +Cc: Adam Fedor, gdb-patches Klee, your patch looks good. Adam, does it do what you need? If it does, Klee can go ahead and commit it. (With a ChangeLog entry, and a comment atop the function, of course.) Klee Dienes <klee@apple.com> writes: > It must be a good name for the function, because we picked the same > one at Apple. > > You might also consider using our patch, which has the advantage of > not replicating the code between skip_quoted and skip_quoted_chars: ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] skip_quoted (updated) 2002-11-18 18:39 ` Jim Blandy @ 2002-11-18 19:03 ` Adam Fedor 2002-11-20 1:12 ` Klee Dienes 1 sibling, 0 replies; 5+ messages in thread From: Adam Fedor @ 2002-11-18 19:03 UTC (permalink / raw) To: Jim Blandy; +Cc: Klee Dienes, gdb-patches Yes. I like it. On Monday, November 18, 2002, at 07:22 PM, Jim Blandy wrote: > > Klee, your patch looks good. Adam, does it do what you need? If it > does, Klee can go ahead and commit it. (With a ChangeLog entry, and a > comment atop the function, of course.) > > Klee Dienes <klee@apple.com> writes: > >> It must be a good name for the function, because we picked the same >> one at Apple. >> >> You might also consider using our patch, which has the advantage of >> not replicating the code between skip_quoted and skip_quoted_chars: ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] skip_quoted (updated) 2002-11-18 18:39 ` Jim Blandy 2002-11-18 19:03 ` Adam Fedor @ 2002-11-20 1:12 ` Klee Dienes 1 sibling, 0 replies; 5+ messages in thread From: Klee Dienes @ 2002-11-20 1:12 UTC (permalink / raw) To: Jim Blandy; +Cc: Adam Fedor, gdb-patches [-- Attachment #1: Type: text/plain, Size: 20 bytes --] Committed; thanks. [-- Attachment #2: skip-quoted.txt --] [-- Type: text/plain, Size: 2868 bytes --] 2002-11-19 Klee Dienes <kdienes@apple.com> Adam Fedor <fedor@gnu.org> * completer.c (skip_quoted_chars): Renamed from skip_chars. Add the ability to explicitly specify the quote characters and word break characters; if NULL is specified for either, use the old behavior of using the characters used by the completer. (skip_chars): New function. Convenience wrapper around skip_quoted_chars to provide the original skip_chars behavior. * completer.h (skip_quoted_chars): Add prototype. Index: completer.c =================================================================== RCS file: /cvs/src/src/gdb/completer.c,v retrieving revision 1.11 diff -u -r1.11 completer.c --- completer.c 24 Mar 2002 00:40:35 -0000 1.11 +++ completer.c 20 Nov 2002 08:52:45 -0000 @@ -678,16 +678,25 @@ return (output); } -/* Skip over a possibly quoted word (as defined by the quote characters - and word break characters the completer uses). Returns pointer to the - location after the "word". */ + +/* Skip over the possibly quoted word STR (as defined by the quote + characters QUOTECHARS and the the word break characters + BREAKCHARS). Returns pointer to the location after the "word". If + either QUOTECHARS or BREAKCHARS is NULL, use the same values used + by the completer. */ char * -skip_quoted (char *str) +skip_quoted_chars (char *str, char *quotechars, char *breakchars) { char quote_char = '\0'; char *scan; + if (quotechars == NULL) + quotechars = gdb_completer_quote_characters; + + if (breakchars == NULL) + breakchars = gdb_completer_word_break_characters; + for (scan = str; *scan != '\0'; scan++) { if (quote_char != '\0') @@ -700,16 +709,26 @@ break; } } - else if (strchr (gdb_completer_quote_characters, *scan)) + else if (strchr (quotechars, *scan)) { /* Found start of a quoted string. */ quote_char = *scan; } - else if (strchr (gdb_completer_word_break_characters, *scan)) + else if (strchr (breakchars, *scan)) { break; } } + return (scan); } +/* Skip over the possibly quoted word STR (as defined by the quote + characters and word break characters used by the completer). + Returns pointer to the location after the "word". */ + +char * +skip_quoted (char *str) +{ + return skip_quoted_chars (str, NULL, NULL); +} Index: completer.h =================================================================== RCS file: /cvs/src/src/gdb/completer.h,v retrieving revision 1.6 diff -u -r1.6 completer.h --- completer.h 18 Feb 2002 01:12:38 -0000 1.6 +++ completer.h 20 Nov 2002 08:52:45 -0000 @@ -39,6 +39,8 @@ /* Exported to linespec.c */ -extern char *skip_quoted (char *str); +extern char *skip_quoted_chars (char *, char *, char *); + +extern char *skip_quoted (char *); #endif /* defined (COMPLETER_H) */ [-- Attachment #3: Type: text/plain, Size: 529 bytes --] On Monday, November 18, 2002, at 09:22 PM, Jim Blandy wrote: > > Klee, your patch looks good. Adam, does it do what you need? If it > does, Klee can go ahead and commit it. (With a ChangeLog entry, and a > comment atop the function, of course.) > > Klee Dienes <klee@apple.com> writes: > >> It must be a good name for the function, because we picked the same >> one at Apple. >> >> You might also consider using our patch, which has the advantage of >> not replicating the code between skip_quoted and skip_quoted_chars: > ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-11-20 9:12 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2002-11-18 7:20 [PATCH] skip_quoted (updated) Adam Fedor 2002-11-18 9:14 ` Klee Dienes 2002-11-18 18:39 ` Jim Blandy 2002-11-18 19:03 ` Adam Fedor 2002-11-20 1:12 ` Klee Dienes
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox