Source code viewer for Linux/Unix

Source code viewer for Linux/Unix

Post by Yu Lianqi » Tue, 22 Apr 2003 12:14:56



I am a windows programmer just switched to linux and have been
familiar with the main dev tools such as vi, gcc, make, etc. However,
I find it very difficult to navigate the source code of a large
project which consists of hundreds of classes/variables/functions.
Searching for a word in Windows IDE is trivial and I don't think it
painful to do the same thing in UNIX. Do Unix programmers have better
memory than the Windows counterparts. If not, how can I do it? in
terminal and X? Thanks!
 
 
 

Source code viewer for Linux/Unix

Post by Russell Sha » Tue, 22 Apr 2003 12:32:45



> I am a windows programmer just switched to linux and have been
> familiar with the main dev tools such as vi, gcc, make, etc. However,
> I find it very difficult to navigate the source code of a large
> project which consists of hundreds of classes/variables/functions.
> Searching for a word in Windows IDE is trivial and I don't think it
> painful to do the same thing in UNIX. Do Unix programmers have better
> memory than the Windows counterparts. If not, how can I do it? in
> terminal and X? Thanks!

Get on the vim/gvim users list for a while. :/<regexp>/ will find the word
you want. * will find the words matching what the cursor is on. gd, gD
will take you to the definition of the symbol under the cursor.
:ta <function_name> will take you to the place in another file
where it's defined. There's dozens of other search commands.
man ctags.

 
 
 

Source code viewer for Linux/Unix

Post by Johannes Krol » Tue, 22 Apr 2003 17:41:54


On 20 Apr 2003 20:14:56 -0700


> I am a windows programmer just switched to linux and have been
> familiar with the main dev tools such as vi, gcc, make, etc. However,
> I find it very difficult to navigate the source code of a large
> project which consists of hundreds of classes/variables/functions.
> Searching for a word in Windows IDE is trivial and I don't think it
> painful to do the same thing in UNIX. Do Unix programmers have better
> memory than the Windows counterparts. If not, how can I do it? in
> terminal and X? Thanks!

Try using a different editor. I'm using Zed, it can be configured to
use any key for about everything.

--
Replace junk-mailbox with j-kroll to reply

 
 
 

Source code viewer for Linux/Unix

Post by Alexander Popo » Tue, 22 Apr 2003 18:22:57


If need an IDE - try KDevelop. I use vim and I'm pretty happy with it, but for a Win programer it
won't be a very friendly editor...


Quote:> I am a windows programmer just switched to linux and have been
> familiar with the main dev tools such as vi, gcc, make, etc. However,
> I find it very difficult to navigate the source code of a large
> project which consists of hundreds of classes/variables/functions.
> Searching for a word in Windows IDE is trivial and I don't think it
> painful to do the same thing in UNIX. Do Unix programmers have better
> memory than the Windows counterparts. If not, how can I do it? in
> terminal and X? Thanks!

Regards,
--
Alexander Popov                  ProSyst Bulgaria Inc.
Team Leader                      48 Vladajska Str.
Dept: Real Time OS and Java VM   Sofia 1606, Bulgaria
Phone:  +359 2 952 35 81/203     http://www.prosyst.com
Mobile: +359 87 663 193          OSGi Technology Leaders                                    
 
 
 

Source code viewer for Linux/Unix

Post by Sybren Stuve » Tue, 22 Apr 2003 18:17:27


Yu Lianqing enlightened us with:

Quote:> However, I find it very difficult to navigate the source code of a
> large project which consists of hundreds of
> classes/variables/functions.

You can run 'vimtutor' to become familiar with vim - it's a very, very
powerful editor, and since I started using it, I won't use any other
editor.

Quote:> Searching for a word in Windows IDE is trivial and I don't think it
> painful to do the same thing in UNIX.

/regexp [enter]

Search and replace:

:s/regexp/replacement/

Quote:> Do Unix programmers have better memory than the Windows counterparts.

Yes

Quote:> If not, how can I do it? in terminal and X?

In terminal: learn vim. In X: you might want to take a look at Kate -
it's a very nice editor as well.

Sybren
--
| Somebody ought to cross ball point pens with coat hangers so that |
| the pens will multiply instead of disappear.                      |
\-------------------------------------------------------------------/
If you have to use Outlook, fix it: http://jump.to/oe-quotefix

 
 
 

Source code viewer for Linux/Unix

Post by Bryan Bulte » Tue, 22 Apr 2003 18:41:36



> I am a windows programmer just switched to linux and have been
> familiar with the main dev tools such as vi, gcc, make, etc.

In addition to the vim tips that others mentioned, I would also recommend
trying out Exuberant Ctags (etags).

vim has integration with etags, to allow easy navigation between
declarations and implementations in header/source files.

A helpful tip in vim, is to use Ctrl+P and Ctrl+N in edit mode to perform
auto-completion of the current word.

Another GUI tool that helps with navigating through sources is Source
Navigator (from Red Hat, open source.)  Navigator even goes as far as
creating source structure diagrams.

Happy coding.

--
Bryan Bulten
http://opendev.ods.org/
http://wxnet.sourceforge.net/

 
 
 

Source code viewer for Linux/Unix

Post by Noah Robert » Wed, 23 Apr 2003 01:08:28



> I am a windows programmer just switched to linux and have been
> familiar with the main dev tools such as vi, gcc, make, etc. However,
> I find it very difficult to navigate the source code of a large
> project which consists of hundreds of classes/variables/functions.
> Searching for a word in Windows IDE is trivial and I don't think it
> painful to do the same thing in UNIX. Do Unix programmers have better
> memory than the Windows counterparts. If not, how can I do it? in
> terminal and X? Thanks!

You can continue using vi and use the tips given to you so far, or you
can make the switch to emacs or xemacs (I prefer the later).  Emacs does
everything vi does and a LOT more, of course because it does a lot more
there may be a steaper learning curve.

Besides that, grep is your friend.  'grep -n "Whatiamlookingfor" *' will
give you the file names and line numbers of every occurance of what you
are looking for.  Grep is also capable of searching based on regular
expressions so you can do more complicated searches.  If you are using
emacs you can run this command from right inside the editor and have the
results displayed in a new buffer.  Grep is the answer you are looking for.

You may also find emacs speedbar of some help.  If you use X and xemacs
it is a little window that has a navigatable tree.  If you have eieio
installed then it will use speedbar to display a tree similar to what
you would find in MSVC.

NR

 
 
 

Source code viewer for Linux/Unix

Post by Yu Lianqi » Wed, 23 Apr 2003 01:28:06



> Yu Lianqing enlightened us with:
> > However, I find it very difficult to navigate the source code of a
> > large project which consists of hundreds of
> > classes/variables/functions.

> You can run 'vimtutor' to become familiar with vim - it's a very, very
> powerful editor, and since I started using it, I won't use any other
> editor.

> > Searching for a word in Windows IDE is trivial and I don't think it
> > painful to do the same thing in UNIX.

> /regexp [enter]

> Search and replace:

> :s/regexp/replacement/

> > Do Unix programmers have better memory than the Windows counterparts.

> Yes

> > If not, how can I do it? in terminal and X?

> In terminal: learn vim. In X: you might want to take a look at Kate -
> it's a very nice editor as well.

> Sybren

Thank you for your advice. I've tried the search command and the word
is highlighted in brown everytime I launch vi. How can I cancel this
effect?
 
 
 

Source code viewer for Linux/Unix

Post by Sybren Stuve » Wed, 23 Apr 2003 02:13:01


Yu Lianqing enlightened us with:

Quote:> I've tried the search command and the word is highlighted in brown
> everytime I launch vi. How can I cancel this effect?

Give it the 'no highlighting' command:

:noh [enter]

Sybren
--
| Somebody ought to cross ball point pens with coat hangers so that |
| the pens will multiply instead of disappear.                      |
\-------------------------------------------------------------------/
If you have to use Outlook, fix it: http://jump.to/oe-quotefix

 
 
 

Source code viewer for Linux/Unix

Post by phil hu » Wed, 23 Apr 2003 02:10:09



Quote:>I am a windows programmer just switched to linux and have been
>familiar with the main dev tools such as vi, gcc, make, etc. However,
>I find it very difficult to navigate the source code of a large
>project which consists of hundreds of classes/variables/functions.
>Searching for a word in Windows IDE is trivial and I don't think it
>painful to do the same thing in UNIX. Do Unix programmers have better
>memory than the Windows counterparts. If not, how can I do it? in
>terminal and X? Thanks!

I use nedit for text editing, and grep to find occurances of a word.

KDevelop is reputed to be good, but I've not used it myself.

--

Interested in adventure holidays in Spain?
Look at: <http://www.cabalamat.org/advcon/>

 
 
 

Source code viewer for Linux/Unix

Post by Christopher Brown » Wed, 23 Apr 2003 10:53:42



> I am a windows programmer just switched to linux and have been
> familiar with the main dev tools such as vi, gcc, make, etc. However,
> I find it very difficult to navigate the source code of a large
> project which consists of hundreds of classes/variables/functions.
> Searching for a word in Windows IDE is trivial and I don't think it
> painful to do the same thing in UNIX. Do Unix programmers have better
> memory than the Windows counterparts. If not, how can I do it? in
> terminal and X? Thanks!

There are programs called "ctags" and "etags" (one being at least
_originally_ associated with Emacs; guess which one?) that will parse
source code in C and possibly other languages and generate TAGS files
containing lists of the hundreds of variables/functions/objects/....

Some text editors, notably vi and Emacs, are able to parse those files
and use them to look up the original "bit of code."

"man ctags" or "man etags" for more details.

Note that the version distributed as etags knows how to cope with
additional languages such as C++, Java, Objective C, Fortran (perhaps
they mean FORTRAN), Ada, several flavors of Lisp, Perl, Python,
Prolog, and even macro assemblers.
--

http://www3.sympatico.ca/cbbrowne/unix.html
The IQ of the group is the lowest IQ of  a member of the group divided
by the number of people in the group.

 
 
 

Source code viewer for Linux/Unix

Post by Yu Lianqi » Thu, 24 Apr 2003 01:15:06




> > I am a windows programmer just switched to linux and have been
> > familiar with the main dev tools such as vi, gcc, make, etc. However,
> > I find it very difficult to navigate the source code of a large
> > project which consists of hundreds of classes/variables/functions.
> > Searching for a word in Windows IDE is trivial and I don't think it
> > painful to do the same thing in UNIX. Do Unix programmers have better
> > memory than the Windows counterparts. If not, how can I do it? in
> > terminal and X? Thanks!

> There are programs called "ctags" and "etags" (one being at least
> _originally_ associated with Emacs; guess which one?) that will parse
> source code in C and possibly other languages and generate TAGS files
> containing lists of the hundreds of variables/functions/objects/....

> Some text editors, notably vi and Emacs, are able to parse those files
> and use them to look up the original "bit of code."

> "man ctags" or "man etags" for more details.

> Note that the version distributed as etags knows how to cope with
> additional languages such as C++, Java, Objective C, Fortran (perhaps
> they mean FORTRAN), Ada, several flavors of Lisp, Perl, Python,
> Prolog, and even macro assemblers.

I've read the man pages of etags but they give no examples. Therefore
I still can't use it efficiently in the project, esp. let it cooperate
with vi. Could you please recommend some tutorials or books that give
more illustrations? It would be better if they can be downloaded from
the web or read online.
Regards!
 
 
 

Source code viewer for Linux/Unix

Post by Eric Enrigh » Thu, 24 Apr 2003 04:43:09



> I've read the man pages of etags but they give no examples. Therefore
> I still can't use it efficiently in the project, esp. let it cooperate
> with vi. Could you please recommend some tutorials or books that give
> more illustrations? It would be better if they can be downloaded from
> the web or read online.
> Regards!

In the source directory, do something like `ctags *', or maybe
`ctags *.c *.h' then fire up vim.  While coding, if you want to
see the definition for something, put the cursor over it and
press CTRL-].  If the appropriate tag is found (ie, a struct
defininition), the file containing it is loaded into a buffer
with the cursor at the definition.

As for some tutorials, just search Google - thats how I learned
it.

--
Eric Enright                       /"\
sauronAtiptsoftDcom                \ /    ASCII Ribbon Campaign
                                    X      Against HTML E-Mail
Public Key: 0xBEDF636F             / \

 
 
 

Source code viewer for Linux/Unix

Post by Christopher Brown » Thu, 24 Apr 2003 05:53:13





>> > I am a windows programmer just switched to linux and have been
>> > familiar with the main dev tools such as vi, gcc, make, etc. However,
>> > I find it very difficult to navigate the source code of a large
>> > project which consists of hundreds of classes/variables/functions.
>> > Searching for a word in Windows IDE is trivial and I don't think it
>> > painful to do the same thing in UNIX. Do Unix programmers have better
>> > memory than the Windows counterparts. If not, how can I do it? in
>> > terminal and X? Thanks!

>> There are programs called "ctags" and "etags" (one being at least
>> _originally_ associated with Emacs; guess which one?) that will parse
>> source code in C and possibly other languages and generate TAGS files
>> containing lists of the hundreds of variables/functions/objects/....

>> Some text editors, notably vi and Emacs, are able to parse those files
>> and use them to look up the original "bit of code."

>> "man ctags" or "man etags" for more details.

>> Note that the version distributed as etags knows how to cope with
>> additional languages such as C++, Java, Objective C, Fortran (perhaps
>> they mean FORTRAN), Ada, several flavors of Lisp, Perl, Python,
>> Prolog, and even macro assemblers.

> I've read the man pages of etags but they give no examples. Therefore
> I still can't use it efficiently in the project, esp. let it cooperate
> with vi. Could you please recommend some tutorials or books that give
> more illustrations? It would be better if they can be downloaded from
> the web or read online.

I mostly use emacs, so have little call for vi documentation.

Presumably, the documentation you seek might be found in the
documentation set for your favorite flavour of vi.
--

http://www3.sympatico.ca/cbbrowne/linux.html
"Wow! You read  advocacy groups once in a  while, thinking you'll find
the occasional gem, but when you  unearth the Taj Mahal you still have

 
 
 

Source code viewer for Linux/Unix

Post by Russell Sha » Thu, 24 Apr 2003 11:32:13




>>I've read the man pages of etags but they give no examples. Therefore
>>I still can't use it efficiently in the project, esp. let it cooperate
>>with vi. Could you please recommend some tutorials or books that give
>>more illustrations? It would be better if they can be downloaded from
>>the web or read online.
>>Regards!

> In the source directory, do something like `ctags *', or maybe
> `ctags *.c *.h' then fire up vim.  While coding, if you want to
> see the definition for something, put the cursor over it and
> press CTRL-].  If the appropriate tag is found (ie, a struct
> defininition), the file containing it is loaded into a buffer
> with the cursor at the definition.

> As for some tutorials, just search Google - thats how I learned
> it.

It's useful to put ctags into the makefile too.
Some cheetsheets for vim/vi:

  http://www.google.com.au/search?q=vi++quick+reference&ie=UTF-8&oe=UTF...
  http://www.google.com.au/search?q=vim+quick+reference&ie=UTF-8&oe=UTF...

 
 
 

1. Curses file viewer source code wanted

From inside a C program I'd like to be able to use a function which
"shows a file to a user".  It should be curses based, and allow the
user the ability to move around the file (lines up/down, page up/down,
horizantal scroll, etc.).

Does something come to mind?  The horizantal scroll sounds quite
difficult, but is extremely important to this application (I'm
planning on displaying tables wider than 80 cols, and it'll be
ridiculous having a emacs/vi type wrap).

Is it sensible to open up one of the few dozen PD editors and hack
at it to do the above?  Alternatively one could reprogram the editor
(if it's programmable) to disable all the text-modification features.

Any help will be much appreciated,

        -ans.
--

2. setting up router

3. File-viewer C source code wanted

4. LVD/Ultra 2 Adaptec 19160 ?

5. learning unix programming by studying unix source code ?

6. Quantum Prodrive ELS Spins Down By Itself

7. need source code for pipe system call for linux or unix or xinu.

8. Slackware Bug Re: Mail

9. I need to get hold of a simple Unix Shell source code

10. Unix network programming; compiling source code problem

11. How to #define multiple text lines in Unix c source code

12. W: Source Code for "UNIX System V Network Programming, Stephen A. Rago

13. Source code for BSD Unix commands