C + + parser--cint

Source: Internet
Author: User

CINT is an interpreter using the C + + syntax, CINT compatible with 95% ANSI C code and 85% ANSI C + + code. This basically means that if your code doesn't use the too-specialized c/+ + syntax, CINT can parse correctly, such as classes, virtual functions, operator overloading, inheritance, pointers, arrays, and so on. CINT even supports templates. The CINT-C + + language features that are not supported are listed in Limitions.

First, the composition

CINT has been ported to a variety of platforms, the current version is 5.18.00, under the Windows platform, CINT consists of the following four parts:

Interpreter Cint.exe

It accepts the source code of C + + with the extension. C,. cpp,. cxx, and interprets it for execution.

Library Files Libcint.dll

It provides a runtime environment for the CInt.

Lib compiler Makecint.exe

It compiles the specified C + + library into an extension library that can be used by CINT, although the CINT itself is not compiled, but it creates a makefile for using the C + + compiler.

System Library/include

A header file that provides standard C + + libraries such as stdio.h, Iostream.h, time.h, and so on.

Second, installation

First download a new installation package to the CINT website, the installation package is usually divided into two, one is already compiled binary files, one is not compiled source code, my recommendation is that both packages are downloaded, because the system library is not included in the binary package. For the resulting source code, first determine the compiler used, find your compiler in the platform subdirectory of the installation package directory, if not found, hehe. In the corresponding directory of your own compiler, there is usually a Setup.bat file that you use to set up related variables and compile them. The CINT runtime must have a system variable of cintsysdir, which should be set to contain a directory of the above CINT, and it is a good choice to add Cintsysdir to the PATH of the system for ease of use.

Third, the function

3.1, support K&r-c, Ansi-c, ansi-c++

Cint covers the 80-90% k&r-c, ansi-c, and C + + language features. Includes multiple inheritance, virtual function overloading, operator overloading, default parameters, templates (this is hard), and so on. The goal of CInt is not to be a processor for the 100% compatible ansi/isoc++ language, but a portable scripting environment that resolves most of the standard C + +.

3.2, can handle large-scale C + + source code

CInt can handle large-scale C/s + + source code, which is not what all C + + interpreters can do. CInt can quickly load into source files and parse more than 60,000 lines of code.

3.3. Can be mixed with compiled code

Based on the need for speed and interactivity, you can mix the compiled code with the scripting code. The Makecint tool embeds any C + + object as a precompiled library into a script, and the precompiled library can be configured as a dynamic-link library. Script code and precompiled code can be called seamlessly in both directions.

3.4. Dynamic C + +

The CInt is dynamic. It can handle C + + declarations from the command line, dynamically define/remove declarations of classes and functions, load/unload source files and dynamic libraries, and an extended rtti mechanism that will allow you to emit incredible C + + usage.

3.5. Built-in debugger and class Browser

The CInt has a built-in debugger that can be used to debug complex C + + execution processes. Text-based class browser is part of the debugger feature

Iv. Source Code Compilation

4.1, install MinGW and Msys, and add it to the path of the environment, such as:

Mingw_home = C:\MinGW

Path= $PATH:;%mingw_home%;%mingw_home%\bin;%mingw_home%\msys\1.0;%mingw_home%\msys\1.0\bin;

4.2, set Msys fstab (c:/mingw/msys/1.0/etc/), add the following statement at the end of the file, note that the Dos8.3 naming rules are used here. You can refer to the following statement implementation:

Char *tmp_sdk = "C:\\Program Files\\microsoftsdks";

TCHAR strlongpathname[256];

MultiByteToWideChar (CP_ACP, 0, TMP_SDK,-1, strlongpathname,256);

TCHAR Szshortpathname[max_path] = {0};

Getshortpathnamew (Strlongpathname,szshortpathname, MAX_PATH);

Fstab

C:/mingw/mingw

C:/activestate/perl/perl

C:/workspace/interpreter/cint-5.18.00/cint

C:/progra~1/mid05a~1/msvc8

C:/progra~1/mi2578~1/windows/v7.0a/psdk

4.3, the preparation of CInt configure file

4.3.1, C:\cint\configure a line in the function config_msvc7

Cflags= "-G5-MD-NOLOGO-WD4996-GX"

Revision changed to

Cflags= "-G5-MT-NOLOGO-WD4996-GX"

4.3.2, manglepaths= "cygpath-m" comment, add # to the front

4.4. Run Vcvarsall.bat settings from the VS2005 console:

Setting environment for using Microsoft Visual Studio 2005 X86tools.

Then enter Msys.bat in the vs2005 command window to run Msys.

4.5 Set the variable in Msys:

Export Path=/msvc8/vc/bin:/msvc8/common7/ide: $PATH

Export Include=/psdk/include:/msvc8/vc/include

Export Lib=/psdk/lib:/msvc8/vc/lib

Then the CD to the CInt source path, and then enter:./configure, last input: Make–j4 can generate CInt dynamic library

C + + parser--cint

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.