[comp.sys.next] ObjC

lane@sumex-aim.stanford.edu (Christopher Lane) (02/14/90)

Below are some additions/augmentations for the /usr/lib/vgrindefs file.  One
addition allows 'vgrind' to properly format and index Objective-C code--the
others replace existing definitions.  Do a 'man vgrind' for more details.

The replacement 'C|c' definition adds the missing ANSI keywords 'const',
'signed' and 'volatile' and the NeXT keyword '#import'.  It also defines
'//' as an alternate comment delimiter.

The new 'Objc|objc' definition is a superset of the 'C|c' definition and adds
the Objective-C '@*' (eg: @interface) keywords as well as 'id', 'self' and
'super'.  It also defines how to identify the name of a method for indexing
and display.  Unfortunately, the vgrindefs syntax doesn't allow for functions
names intermixed with their arguments so this only really works correctly for
methods with one or no arguments--which tends to be the majority of the cases
(it is reasonable for most other cases as well).

The replacement 'CSH|csh' definition adds several missing keywords
(eg. 'eval', 'popd', etc.) based on the 'csh' man page.

To install these, you can add them to the /usr/lib/vgrindefs file (either
replace what's there or add them to the top so you still have the original
definitions around), or keep them in a separate file and use the -d option
to vgrind.  To use the non-C entries you'll have to use the -l switch to
vgrind, eg: 'vgrind -lobjc -d /usr/local/lib/vgrindefs myfile.[hm]'

I'd be interested in any tweaks to these or other vgrind definitions,

- Christopher


C|c:\
	:pb=^\d?*?\d?\p\d?\(\a?\)(\d|{):\
	:bb={:be=}:cb=/*:ce=*/:ab=//:ae=$:sb=":se=\e":lb=':le=\e':tl:\
	:kw=asm auto break case char const continue default do double else\
	enum extern float for fortran goto if int long register return\
	short signed sizeof static struct switch typedef union unsigned\
	void volatile while\
	#define #else #endif #if #ifdef #ifndef #import #include #undef #\
	define else endif\ if ifdef ifndef import include undef:
ObjC|objc:\
	:pb=(^\d?*?\d?\p\d?\(\a?\)(\d|{))|(^\d?(+|-)\d?(\(\a\))?\d?\p\d|;|\:):\
	:bb={:be=}:cb=/*:ce=*/:ab=//:ae=$:sb=":se=\e":lb=':le=\e':tl:\
	:kw=asm auto break case char const continue default do double else\
	enum extern float for fortran goto if int long register return\
	short signed sizeof static struct switch typedef union unsigned\
	void volatile while\
	#define #else #endif #if #ifdef #ifndef #import #include #undef #\
	define else endif if ifdef ifndef import include undef\
	@defs @encode @end @implementation @interface @public @selector @\
	defs encode end implementation interface public selector\
	id self super:
CSH|csh:\
	:bb={:be=}:cb=#:ce=$:sb=":se=\e":lb=':le=\e':tl:\
	:kw=alias alloc bg break breaksw case cd chdir continue default\
	dirs echo else end endif endsw eval exec exit fg foreach glob\
	goto hashstat history if jobs kill limit login logout nice nohup\
	notify onintr popd pushd rehash repeat set setenv setpath shift\
	source stop suspend switch then time umask unalias unhash unlimit\
	unset unsetenv wait while @ env\
	argv autologout cdpath child cwd edithist filec histchars home\
	ignoreeof mail noclobber noglob nomatch nonomatch path prompt\
	savehist shell status term user verbose:
-------