List of all functions in a C files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Uday

    List of all functions in a C files

    Hi All,

    Is there way to list all functions in a C files? I've to rename all the
    functions.

    thanks,
    Uday
  • Martijn

    #2
    Re: List of all functions in a C files

    > Is there way to list all functions in a C files? I've to rename all[color=blue]
    > the functions.[/color]

    I don't know what you are trying to do, but you may want to rethink your
    strategy.

    --
    Martijn



    Comment

    • Anonymous 7843

      #3
      Re: List of all functions in a C files

      In article <EowDe.22$vC4.2 21@news.oracle. com>, Uday <l0ll1@yahoo.co m> wrote:[color=blue]
      > Hi All,
      >
      > Is there way to list all functions in a C files? I've to rename all the
      > functions.[/color]

      UNIX-ish answer: compile it and run elfdump or nm with the appropriate
      options.

      Windows answer: your "visual" thingy has a mode that lists function names

      Or just read the files yourself and write down a list. if there is a
      large number of functions to deal with (100+) then such a change should
      probably planned with great care, far beyond simply renaming. Sounds
      like someone gave you some busy-work.
      --
      7842++

      Comment

      • CBFalconer

        #4
        Re: List of all functions in a C files

        Uday wrote:[color=blue]
        >
        > Is there way to list all functions in a C files? I've to rename
        > all the functions.[/color]

        Many. nm, cscope, xref all come to mind. However you have to make
        corresponding changes in many files, including the .h ones. Once
        you have a list id2id will come in handy. See:

        <http://cbfalconer.home .att.net/download/id2id-20.zip>

        --
        Chuck F (cbfalconer@yah oo.com) (cbfalconer@wor ldnet.att.net)
        Available for consulting/temporary embedded and systems.
        <http://cbfalconer.home .att.net> USE worldnet address!


        Comment

        • Robert Gamble

          #5
          Re: List of all functions in a C files

          CBFalconer wrote:[color=blue]
          > Uday wrote:[color=green]
          > >
          > > Is there way to list all functions in a C files? I've to rename
          > > all the functions.[/color]
          >
          > Many. nm, cscope, xref all come to mind.[/color]

          What exactly would be the prescribed procedure for obtaining a list of
          all functions in a source file using cscope?

          Robert Gamble

          Comment

          • Kenny McCormack

            #6
            Re: List of all functions in a C files

            In article <1121892234.747 607.284800@o13g 2000cwo.googleg roups.com>,
            Robert Gamble <rgamble99@gmai l.com> wrote:
            ....[color=blue]
            >What exactly would be the prescribed procedure for obtaining a list of
            >all functions in a source file using cscope?[/color]

            Probably start by reading the manual. After that, it's easy.

            Comment

            • Jaspreet

              #7
              Re: List of all functions in a C files

              Kenny McCormack wrote:[color=blue]
              > In article <1121892234.747 607.284800@o13g 2000cwo.googleg roups.com>,
              > Robert Gamble <rgamble99@gmai l.com> wrote:
              > ...[color=green]
              > >What exactly would be the prescribed procedure for obtaining a list of
              > >all functions in a source file using cscope?[/color]
              >
              > Probably start by reading the manual. After that, it's easy.[/color]

              I thought cscope pnly had the following options:

              Find this C symbol:
              Find this global definition:
              Find functions called by this function:
              Find functions calling this function:
              Find this text string:
              Change this text string:
              Find this egrep pattern:
              Find this file:
              Find files #including this file:

              Not sure how can I get a list of functions in a file.

              Comment

              • Uday

                #8
                Re: List of all functions in a C files

                CBFalconer wrote:
                [color=blue]
                >Uday wrote:
                >
                >[color=green]
                >>Is there way to list all functions in a C files? I've to rename
                >>all the functions.
                >>
                >>[/color]
                >
                >Many. nm, cscope, xref all come to mind. However you have to make
                >correspondin g changes in many files, including the .h ones. Once
                >you have a list id2id will come in handy. See:
                >
                > <http://cbfalconer.home .att.net/download/id2id-20.zip>
                >
                >
                >[/color]
                Thanks a lot Chuck. I used *nm *to get the function names and then used
                *id2id*.

                But not sure how cscope helps here. I use cscope daily. It doesn't have
                an option to list all function names in a C file. Let me know if I
                missed something.


                rgds,
                Uday

                Comment

                • Robert Gamble

                  #9
                  Re: List of all functions in a C files

                  Jaspreet wrote:[color=blue]
                  > Kenny McCormack wrote:[color=green]
                  > > In article <1121892234.747 607.284800@o13g 2000cwo.googleg roups.com>,
                  > > Robert Gamble <rgamble99@gmai l.com> wrote:
                  > > ...[color=darkred]
                  > > >What exactly would be the prescribed procedure for obtaining a list of
                  > > >all functions in a source file using cscope?[/color]
                  > >
                  > > Probably start by reading the manual. After that, it's easy.[/color]
                  >
                  > I thought cscope pnly had the following options:
                  >
                  > Find this C symbol:
                  > Find this global definition:
                  > Find functions called by this function:
                  > Find functions calling this function:
                  > Find this text string:
                  > Change this text string:
                  > Find this egrep pattern:
                  > Find this file:
                  > Find files #including this file:
                  >
                  > Not sure how can I get a list of functions in a file.[/color]

                  Apparently Kenny has a copy of the manual that contains information not
                  found at http://cscope.sourceforge.net/cscope_man_page.html. Maybe he
                  will be kind enough to enlighten us with the knowledge of where to
                  obtain said manual.

                  Robert Gamble

                  Comment

                  • CBFalconer

                    #10
                    Re: List of all functions in a C files

                    Robert Gamble wrote:[color=blue]
                    > CBFalconer wrote:[color=green]
                    >> Uday wrote:[color=darkred]
                    >>>
                    >>> Is there way to list all functions in a C files? I've to rename
                    >>> all the functions.[/color]
                    >>
                    >> Many. nm, cscope, xref all come to mind.[/color]
                    >
                    > What exactly would be the prescribed procedure for obtaining a
                    > list of all functions in a source file using cscope?[/color]

                    Cscope does seem to be a problem. It also has some funny ideas
                    about what constitutes a function.

                    However the xref I include in the hashlib package (DOS executable
                    only, source is lost) marks all function names with a terminal ().
                    So you can easily pick out the list with simple things such as
                    "grep () <xrefoutput.xrf >". However it won't discriminate between
                    static declarations in different files. It considers functional
                    macros to be functions and has similar failings to cscope. To
                    illustrate:

                    #include <iso646.h>

                    int main(void) {
                    while (not(something) ) continue;
                    ....

                    and cscope and xref both think not is a function.

                    --
                    Chuck F (cbfalconer@yah oo.com) (cbfalconer@wor ldnet.att.net)
                    Available for consulting/temporary embedded and systems.
                    <http://cbfalconer.home .att.net> USE worldnet address!


                    Comment

                    • CBFalconer

                      #11
                      Re: List of all functions in a C files

                      Uday wrote:[color=blue]
                      >
                      > Part 1.1 Type: Plain Text (text/plain)
                      > Encoding: 7bit[/color]

                      Security risk html/mime ignored and destroyed. Usenet is a pure
                      text medium.

                      --
                      Chuck F (cbfalconer@yah oo.com) (cbfalconer@wor ldnet.att.net)
                      Available for consulting/temporary embedded and systems.
                      <http://cbfalconer.home .att.net> USE worldnet address!


                      Comment

                      • Eric Sosman

                        #12
                        Re: List of all functions in a C files



                        CBFalconer wrote:[color=blue]
                        > Uday wrote:
                        >[color=green]
                        >> Part 1.1 Type: Plain Text (text/plain)
                        >> Encoding: 7bit[/color]
                        >
                        >
                        > Security risk html/mime ignored and destroyed. Usenet is a pure
                        > text medium.[/color]

                        "Usenet is a pure text medium?" Surely you're
                        joking, Mr. Fey-- er, Falconer.



                        --
                        Eric.Sosman@sun .com

                        Comment

                        • LucasRescue

                          #13
                          Re: List of all functions in a C files

                          Hi if you are try to rename all functions in a c files, you take the
                          risk of your project not run in other operationals system...

                          Comment

                          • Giorgos Keramidas

                            #14
                            Re: List of all functions in a C files

                            On 2005-07-22 05:27, LucasRescue wrote:[color=blue]
                            > Hi if you are try to rename all functions in a c files, you take the
                            > risk of your project not run in other operationals system...[/color]

                            Not necessarily.

                            Comment

                            • Kenny McCormack

                              #15
                              Re: List of all functions in a C files

                              In article <20050724194328 .U39760@gothmog >,
                              Giorgos Keramidas <keramida@ceid. upatras.gr> wrote:[color=blue]
                              >On 2005-07-22 05:27, LucasRescue wrote:[color=green]
                              >> Hi if you are try to rename all functions in a c files, you take the
                              >> risk of your project not run in other operationals system...[/color]
                              >
                              >Not necessarily.
                              >[/color]

                              Please go to m-w.com and lookup the word "risk".

                              Comment

                              Working...