Re: [Cgdb-devel] Mac OS X 10.5 cgdb Patches
Brought to you by:
bobbybrasko,
crouchingturbo
From: Kyle M. <ma...@gm...> - 2009-07-23 00:58:45
|
On Jul 21, 2009, at 18:36, Bob Rossi wrote: > On Mon, Jun 15, 2009 at 04:18:51PM -0700, Kyle McKay wrote: >> cgdb-0.6.4 has difficulties building for Mac OS X 10.5. It needs to >> have HAVE_OPENPTY defined. >> >> You can either do: >> >> CFLAGS=-DHAVE_OPENPTY ./configure >> >> Or apply a patch to configure.init. The patches are attached to cgdb >> bug 2806868 here: >> >> https://sourceforge.net/tracker/?func=detail&aid=2806854&group_id=72581&atid=534974 > > OK, I've applied this patch, please try this test release, > http://brasko.net:81/bob/cgdb-20090721.tar.gz > and let me know how it works out. If it works for you, I'll put it > in the next release. It configured, built and ran on both Mac OS X 10.4.11 and Mac OS X 10.5.7. See attached gzipped script output. (Note that I had already separately installed a compatible version of readline first as the native Mac OS X readline (4.2) is too old -- that installation is not included in the script output.) >> Additionally, Mac OS X commonly uses files with >> extensions .cp, .m, .mm and .M. These files are not currently >> colorized by the cgdb tokenizer. The C tokenizer does a very good >> job >> with these (.cp = C++, .m = Objective-C, .mm/.M = Objective-C++). A >> simple patch to tokenizer.c allows the C tokenizer to colorize these. >> The patch is attached to cgdb bug 2806868 here: >> >> https://sourceforge.net/tracker/?func=detail&aid=2806868&group_id=72581&atid=534974 What about the ".cp" extension? That's a normal C++ file? Please add the .cp extension to the list of extensions handled by the existing lexer -- ".cp" is a commonly used C++ extension in a variety of open source file projects. > I'd prefer not to do a solution like this. However, if you want to > write > the entire scanner for the Objective-C++ language, I'll accept it. I will be happy to do that. Since the Objective-C language has exactly the same tokenizer as the C language it likely wouldn't require much effort to create an Objective-C/Objective-C++ highlighter from the existing C/C++ one already in cgdb. FYI here is some valid C: #define doubleit * 2 typedef int id; id array[20]; id value = 7; id x = array[value doubleit]; /* index integer array */ Here is some valid Objective-C: #include <objc/objc.h> id value = nil; /* id and nil are defined in objc.h */ id x = [value doubleit]; /* send doubleit message to value object */ Objective-C provides minor extensions to the C grammar. Objective-C is a very thin layer on top of C, and moreover is a strict superset of C. Objective-C treats token sequences between '[' and ']' specially when the '[' ... ']' sequence appears in certain grammar contexts. Objective-C does introduce some special two-token keywords that start with '@' such as '@class', '@interface', '@implementation', '@end', etc. and if the first token after the '[' of a special '[' ... ']' sequence is the identifier 'self' or 'super' it is treated specially. Finally Objective-C adds the '#import' directive that's identical to '#include' except it's guaranteed to only include files once. Objective-C++ is identical to Objective-C except that the extensions are provided to the C++ grammar rather than the C grammer. > I can show you what to do if you want. It's mostly just a flex scanner > under the hood. All you really need to do is enumerate all the > keywords. Sure, I'll be happy to create a flex scanner since it will be basically a copy of the C/C++ one that's already there plus recognition of the few special Objective-C keywords/types that are added and '#import'. The existing C/C++ scanner already does 99% of what it needs to do for Objective-C/Objective-C++ sources. Just point me to the code. Thanks, Kyle > Thanks, > Bob Rossi > > ------------------------------------------------------------------------------ > _______________________________________________ > Cgdb-devel mailing list > Cgd...@li... > https://lists.sourceforge.net/lists/listinfo/cgdb-devel |