Over the years, I have developed a habit. Before developing a new function, I try to know if anyone in the industry has done similar work. If software already provides similar functions, I will try to read its user manual to see how others do it. If you encounter a common function, you will first find several source code search websites and use several typical keywords, such as the API function name or the most likely function name to implement a function, first, search for a channel. If something you want to develop happens to have been done by someone, And the source code is ready-made, it will of course be excited, because it will save you a lot of time for development, whether it is for reference, porting, or copying restoration samples.
This article first introduces several well-known source code search websites, and then describes how to integrate the code search function into the free C/C ++ integrated development environment vcsmith or a professional white box testing tool vctester, this makes daily commissioning easier.
Common source code search websites include:
1. koders, A http://www.koders.com/
It is easy to use and has rich source code libraries. It supports many source code languages and supports searching and filtering projects and authorization protocols.
2. Google codes, http://www.google.com/codesearch
Search is a simple and practical style of Google. The search capability is strong. You can use regular expressions to search for a language, file, or package. You can also search by license protocol.
3. krugle, http://www.krugle.com/
Supports comprehensive source code languages. You can specify search scopes, such as comments, documents, function definitions, and class definitions. You can also search for technical documents and open-source projects.
4. oreilly code, http://labs.oreilly.com/code/
If you read oreilly books frequently, this search will be very useful to you. You can search more than 700 sample codes in nearly 123,000 oreilly books, the sample code in books is actually more standard and efficient, and it is one of the good ways to learn programming.
5. gotapi, http://start.gotapi.com/
It focuses on source code search for Internet programming, including HTML, CSS, css2, JavaScript, actionscript, Google Code, XML, XSL, XPath, XSD, PHP, Ruby, Python, Perl, as, ColdFusion, C, C ++, MySQL, PostgreSQL, Oracle, Java, and many other programming languages.
6. codase, http://www.codase.com/
It is suitable for searching open source code of C/C ++. You can search by function name or class name.
Vcsmithand vctesterboth use csewin.exe as their user interface. The method for integrating the code search function into vcsmith is exactly the same as that for integrating the code search function into vctester. After integrating the code search function, you can easily check it at any time. For example, if you search for "xmlencode" on the koders website, the following page is displayed:
We want to select a piece of code on the integration interface of vcsmith, and press a shortcut key (such as Shift + F3) to immediately pop up the above window. The commands to be integrated are as follows:
% Ieappfile % http://www.koders.com/default.aspx? S = "% csecurrtext %"
"% Ieappfile %" is the system variable of CSE, indicating the IE browser application. "% csecurrtext %" is the selected text in the current editing area. Add an extension command such:
You can also add the following command to bring up a dialog box for each search. You can manually adjust the search words and run the following command:
% Ieappfile % http://www.koders.com/default.aspx? S = "%? + Csecurrtext %"
"%? + Csecurrtext indicates that the value of "% csecurrtext %" is changed in the dialog box before each command is executed.
After vcsmith v3.1.3 and later versions, When you import project configurations from PDB, the preceding two koders code search commands are automatically integrated, the default shortcut keys are SHIFT + F3 and SHIFT + F4 ".
Similarly, you can use the following two commands to integrate Google Code Search:
% Ieappfile % http://www.google.com/codesearch? Q = "% csecurrtext %"
% Ieappfile % http://www.google.com/codesearch? Q = "%? + Csecurrtext %"
The following command integrates the krugle code for search:
% Ieappfile % http://www.krugle.org/kse/files? Query = "% csecurrtext %"
% Ieappfile % http://www.krugle.org/kse/files? Query = "%? + Csecurrtext %"
Other source code searches can be integrated with vcsmith. This article will not go into detail.