The document familiarizes developers with VivaCore library giving general information about the library, the scope of use, license agreements. It describes also the process of the library's deployment and an example of how to use it.
VivaCore is an open library to work with C/C++ code. VivaCore is built on the basis of OpenC++ library (OpenCxx). It is intended for realizing refactoring systems, systems of static and dynamic analysis, systems of code transformation and optimization, language extensions, subsystems of syntax highlight, systems of building documentation on the code and other similar tools on its basis. To learn more about scopes of use of VivaCore library and its working principles see article "The essence of the VivaCore code analysis library ".
VivaCore library is developed by Program Verification Systems company.
The license on VivaCore library allows you to use, copy, distribute and modify it in binary form or as the original code both for commercial and non-commercial use without any payments to the authors of the library. You should only list the authors of the original libraries (OpenC++ and VivaCore).
VivaCore library is the result of developed OpenC++ (OpenCxx) library (OpenCxx) and has the following advantages over it:
The library is the complete project that may be easily built in Visual Studio 2005/2008 environment both in 32-bit and 64-bit versions. No additional settings are required to build the project.
VivaCore library is adapted to Microsoft Visual C++ compiler from the viewpoint of specificity of its syntax and set of key words.
Classic C language is supported, not only C++.
Calculation of literal constants' values is realized.
A lot of errors and defects of the basic OpenC++ library are corrected.
Mechanism of initial preprocessing of the original text is created which allows you to realize some specific code modifications.
Mechanism of skipping the parse of the code of functions which are not of interest for the analysis is created.
You may download VivaCore library in two versions. Besides VivaCore the full version contains Boost library with already built *.lib files. The shortened version contains only original VivaCore library's files.
In case you downloaded the full VivaCore library's distribution kit, immediately after the archive is unpacked you will get the project you may build and examine. No other actions are required.
If you downloaded the shortened version of VivaCore or would like to use more recent version of Boost, library you'll have to change some settings of the project. Firstly, you'll have to point the path to header files of boost library (Configuration Properties -> C/C++ -> General -> Additional Include Directories) in the project's settings. Secondly, you'll have to point the path to compiled lib files (Configuration Properties -> Linker -> General -> Additional Library Directories). It is the shortened version that we advise you to use, i.e. without Boost, because in this case you can always build Boost according to the configuration you need.
VivaCore library's project is also an example demonstrating how to use it. That's why VivaCore contains 3 additional files: PreprocessorRulesTableDemo.h, VivaCoreDemo.cpp, VivaWalkerDemo.h.
In these files the simplest code analyzer is realized that carries the following operations:
Reads "VivaCoreDemo.i" file.
Carries its preprocessing according to the rules stated in PreprocessorRulesTableDemo.h file.
Splits the program text into lexemes.
Builds the parse tree.
Traverses the parse tree using VivaWalker class described in VivaWalkerDemo.h file. As an example, three functions of processing the tree knots which indicate what is being processed at the moment are realized in this class. See functions: TranslateAssign, TranslateVariable, TranslateSizeof.
We understand that you may have a lot of questions concerning the use and the mechanism of VivaCore library. But good news is that our team is always ready to communicate and we would be glad to discuss appearing questions and give you recommendations on the use of VivaCore. Write us!
As a PVS-Studio's developer, I am often asked to implement various new diagnostics in our tool. Many of these requests are based on users' experience of working with dynamic code analyzers, for example Valgrind. Unfortunately, it is usually impossible or hardly possible for us to implement such diagnostics. In this article, I'm going to explain briefly why static code analyzers ...