earleh@eleazar.dartmouth.edu (Earle R. Horton) (10/13/88)
I just found out about ctags a while ago. I got the source, put it on my Mac, made an MPW Tool out of it, created a tags file from the contents of {CIncludes}, trained an editor to use it, and WOW! Question: Why isn't this built into every source code editor which runs on the Mac? I would like to be able to use MPW Stdio to access disk files. I don't want the console emulator, and I don't think I need the system drivers. I just want to be able to "fprintf()" to disk files. It would be fine with me if stderr, stdin, and stdout were byte buckets such that reads and writes produced either nop or error. Does anyone know how to do this? This is from a Macintosh application which does its own windowing and device handling, so the console emulator is redundant, as are the system drivers (I think). Earle R. Horton. 23 Fletcher Circle, Hanover, NH 03755 (603) 643-4109 Sorry, no fancy stuff, since this program limits my .signature to three
earleh@eleazar.dartmouth.edu (Earle R. Horton) (10/13/88)
In article <10389@dartvax.Dartmouth.EDU> I write: > > I just found out about ctags a while ago. I got the source, put it on >my Mac, made an MPW Tool out of it, created a tags file from the contents >of {CIncludes}, trained an editor to use it, and WOW! Question: Why isn't >this built into every source code editor which runs on the Mac? > Judging from my mail this morning, I should have included more information. This article was targeted towards people who write and distribute source code editors, but I suppose all sorts of people would want to know about it. It sort of helps if you have an editor with source code. Assuming you have source code to an editor which runs on the Mac, and which can open a file and do forward regular expression search, then adding the capability to use ctags takes about 1 page of code. Ctags is a simple program which can be obtained via anonymous ftp to j.cc.purdue.edu. It is in /news/comp/sources/unix/volume3/ctags.Z, a compressed shar file (smallish). If you have a C compiler, then compiling the program and creating a tags file with tags for all your development system header files and personal source files is straightforward. The only snag might be if you want to use it with LightSpeedC or something which doesn't give you the ability to specify wild cards on a program command line. A clever person can get around this. The tags file contains three fields, separated by tabs. The first field is an identifier found by ctags in one of your header or source files. The second field is the name of the file where this identifier is declared. (Identifiers consist of functions, macros, and optionally typedefs.) The third field, in the case of functions and macros, is a regular expression specification telling how to find the identifier in the file. In the case of typedefs, the third field is the line number. When the editor you are using is configured to use tags, you simply position the cursor over an identifier in your C source you want information on, and press some key which is bound to the function for looking up tags. The editor then looks in the tags file, finds the tag for the identifier, opens the file, and positions itself at the identifier definition. This provides a mechanism for looking up definitions in header files, and also for moving between source code of your own in an extremely efficient manner. Currently, MacJove supports tags, as does also a vi clone which I have been playing with. This is such a handy thing that I am amazed all Mac editors do not support it. The ctags program also can index Pascal, Fortran, Lisp, Lex, and Yacc tags, and perhaps more. One could conceivably write an MPW Shell script to use tag files, too. Earle R. Horton. 23 Fletcher Circle, Hanover, NH 03755 (603) 643-4109 Sorry, no fancy stuff, since this program limits my .signature to three
oster@dewey.soe.berkeley.edu (David Phillip Oster) (10/14/88)
Most of what ctags does for you is already done by LightSpeed C. If you command-double click on an identifer in LightSpeed C, it opens the file where the identifier is defined and searches for it. + for ctags: o. ctags starts searching at the line given in the tags file, so it is more likely to find the correct occurence of the identifier, for it actually to be the definition. o. ctags will find definitions of macros, not just of procedures and variables. - for ctags o. you must use an editor that supports tag files. o. you must periodically run a separate application program to update your tag file. Just as LightSpeed C automatically does a good portion of "make", but the unix make has more power and takes more work, so LightSpeed C automatically does a good portion of the work of ctags, but the unix version has more power and takes more work. --- David Phillip Oster --When you asked me to live in sin with you Arpa: oster@dewey.soe.berkeley.edu --I didn't know you meant sloth. Uucp: {uwvax,decvax,ihnp4}!ucbvax!oster%dewey.soe.berkeley.edu
mce@tc.fluke.COM (Brian McElhinney) (10/18/88)
In article <26431@ucbvax.BERKELEY.EDU> oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) writes: > >Just as LightSpeed C automatically does a good portion of "make", but the >unix make has more power and takes more work, so LightSpeed C >automatically does a good portion of the work of ctags, but the unix >version has more power and takes more work. But Lightspeed could implement tags even better than UNIX, with very little overhead. Add a data structure to the project that identifies each routine with a line number. Update when you compile. More powerful in that you don't have to run a separate program, and it never goes to the wrong place. Tags are so incredibly *productive* when I'm programming that I'm amazed at the half-useful approach in LSC. Personally, my code almost always references a routine before it's actual definition, so LSC "tags" goes to the wrong place 9 times out of 10. So close, yet so far away. Brian McElhinney mce@tc.fluke.com