Solution for Automatically Generating corresponding files using Python scripts

Source: Internet
Author: User

The following article describes how to use a python script to automatically generate the corresponding implementation file. In the initial framework, I personally think it is more convenient to write the class implementation into the class, you can also put the program on google code to facilitate your operations.

The Python script can automatically generate the corresponding implementation file.

After the conversion, the above is the simplest example, which is also applicable to classes and template classes.

-A indicates that the above def function will be automatically converted, and python3.1. h if you do not have the-a option, you need to indicate which functions are to be transferred to the implementation file. The method is as follows to add a redundant one. the H file changes, so. h To. h. bak.

  • Syntax of Python Data Types in common collections
  • Knowledge about python open-source technology development
  • Analysis of specific problems in Python array practice
  • How to configure the Python socket Service
  • Python logs require constant learning.

In addition, if-t is enabled, it indicates processing the template class. That is, the following information will be added to. h's namesapce method after termination, the implementation of template functions can be directly implemented in. in the H file, I now only support separation, which is clearer.

Well, let's take a look at the instance. I originally implemented all the functions of the template class in. the h class definition is easy to write, but it looks uncomfortable. I hope to separate the implementation part. cc.

Call python3.1 h2cc. py-a-t huff_tr

 
 
  1.  int def() ;  
  2.  
  3. {  
  4.  
  5. int x = 3;   
  6.  
  7. }  
  8.  

Ee. h generates appropriate huff_tree.cc and modifies huff_tree.h as appropriate. Therefore, all work is automatically completed by h2cc. py. Verify the conversion and use the compilation link.

Of course, there may be unknown bugs in some cases, so you can refer to the copy file. h. bak of the header file for correction.

Original header file

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.