Search code examples
rwindowsfunctioninternals

How to find out which .c file contains the .c functions of R internals, on Windows?


I want to view the source code of R's match.call function. As it is an internal function, I downloaded the R source code, went to ./src/main/names.c and looked for match.call there.

Thus, I found out that the corresponding .c function is called do_matchcall. Ok, but how can I find out which of the dozens of .c files in ./src/main/ contains the function do_matchcall?

Btw I'm using a Windows machine, in case that makes a difference.


Solution

  • As a Windows user, here are a couple of options. The first one is preferable, but the second one is OK for occasional use:

    • Download grepwin, which will allow you to search Windows directories using the powerful grep command that both Joshua and Gavin have mentioned. It (or some equivalent) is indispensable if you'll be doing much poking around in program source directories.

    • Use the search bar at this site to search the R source directory for the definition of do_matchcall. Clicking on the result it returns will tell you that do_matchcall is "[defined] at line 1193 of file unique.c", and will provide a hyperlink to the code in unique.c.

    Like I said, though, you'll ultimately be much happier if you equip your Windows box with some implementation of grep.