CN105677438A - Method for automatically calculating calculation formula in file through compiler - Google Patents

Method for automatically calculating calculation formula in file through compiler Download PDF

Info

Publication number
CN105677438A
CN105677438A CN201610008596.9A CN201610008596A CN105677438A CN 105677438 A CN105677438 A CN 105677438A CN 201610008596 A CN201610008596 A CN 201610008596A CN 105677438 A CN105677438 A CN 105677438A
Authority
CN
China
Prior art keywords
file
judged
internal memory
computing formula
compiler
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610008596.9A
Other languages
Chinese (zh)
Inventor
王子元
王�琦
祁元超
林嘉炜
张卫丰
周国强
张迎周
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Post and Telecommunication University
Nanjing University of Posts and Telecommunications
Original Assignee
Nanjing Post and Telecommunication University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Post and Telecommunication University filed Critical Nanjing Post and Telecommunication University
Priority to CN201610008596.9A priority Critical patent/CN105677438A/en
Publication of CN105677438A publication Critical patent/CN105677438A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

The invention discloses a method for automatically calculating a calculation formula in a file through a compiler. By means of the method, the calculation formula can be conveniently read from the file and compiled by developers, and the difficulty in compiling the calculation formula in the file is lowered for the developers. The calculation formula in the file is read and stored in an internal storage, the calculation formula is reduced into return statements through a program, and the calculation formula is automatically calculated through the compiler carried by a Visual Studio. The method helps the program developers, the formula calculating task is handed over to the compiler of the program to be executed, workloads on the developers are reduced, and the work efficiency is greatly improved.

Description

A kind of method utilizing compiler that computing formula in file is carried out automatization's calculating
Technical field
The present invention relates to a kind of method utilizing compiler that computing formula in file is carried out automatization's calculating, belong to field of computer technology.
Background technology
MicrosoftVisualStudio (abbreviation VS) is the development kit series of products of MS. VS is a basic complete developing instrument collection, and it includes most of instrument required in whole software life-cycle, such as UML instrument, code administration tool, IDE (IDE) etc. The object code write is applicable to all platforms that Microsoft supports, including MicrosoftWindows, WindowsMobile, WindowsCE .NETFramework .NETCompactFramework and MicrosoftSilverlight and WindowsPhone. VisualStudio is the IDE of current most popular windows platform application.
1997, Microsoft issued VisualStudio97. Include towards the VisualBasic5.0 of Windows application, visual c++ 5.0, VisualJ++ towards Java exploitation and the VisualFoxPro towards database development, also includes the VisualInterDev created required for DHTML (DynamicHTML). Wherein, VisualBasic and VisualFoxPro uses independent development environment, and other development language uses unified development environment.
Visual c++ VisualStudio and the VisualStudio.Net2002 that we know just, in 2003, the C++ compiler of band, is developed by Microsoft Corporation. In VisualStudio6.0, the conservative criticism because compiler has too many place can not match with the C++ standard occurred later. The compatibility of standardization C++ is only had 83.43% by VC++6.0, but it is as joining of C++ compiler great master StanleyLippman and many C++ community intelligents, visual c++ compiler has had become as a highly developed reliable C++ compiler, the evaluation and test of Dr.Dobb ' sJournal shows that the visual c++ 7.1 compatibility to standard C++ is up to 98.22%, compiler compatible best before once becoming CBX.
C++ is a kind of Object-Oriented Programming Language of exploitation on the basis of C language, is widely used. C++ supports multiple programming paradigm--OOP, generic programming and proceduring programming.Up-to-date official standard C++ announced on August 18th, 2014. Its programming field is many wide, is usually used in the applications such as system development, engine exploitation, is one of the most powerful programming language of being benefited from by numerous programmers up to now, support class: the characteristics such as class, encapsulation, heavy duty.
The method of computing formula in existing extraction calculation document, it is intended to the relative importance value according to formula, the program that the factor design such as associativity is complicated, computing formula is split, progressively solves, finally obtain result, its design difficulty is relatively big, and work efficiency is not high. And the present invention can solve problem above well.
Summary of the invention
It is an object of the invention to solve the defect of above-mentioned prior art, provide a kind of method of computing formula in automatic compiling file, the method is by reading the computing formula in file, store it in internal memory, after computing formula being reverted to return statement by program, finally utilize the VisualStudio compiler carried that computing formula is carried out automatization's calculating.
This invention address that its technical problem is adopted the technical scheme that: a kind of method utilizing compiler that computing formula in file is carried out automatization's calculating, the method comprises the steps:
Step 1: analyze file destination;
Step 1-1: progressive scan file destination;
Step 1-2: judge whether current line has the target computing formula of setting;
Step 1-2-1: be judged as YES, writes another file one by one by each element of this computing formula, and inserts newline in the end;
Step 1-2-2: be judged as NO, skips this row, the next effectively row of scanning;
Step 1-3: judge whether to have arrived the ending of file destination;
Step 1-3-1: be judged as YES, carries out next step and reads in work;
Step 1-3-2: be judged as NO, jumps to step 1-1, continues to analyze;
Step 2: computing formula is read in internal memory;
Step 2-1: first write a marker character in internal memory;
Step 2-2: the file that progressive scan step 1 generates;
Step 2-3: each element of each row formula is read in the middle of internal memory one by one;
Step 2-4: after reading in each formula, again writes marker character in internal memory;
Step 2-5: judge whether to have arrived the end of file;
Step 2-5-1: be judged as YES, then stop reading in, carry out next step evaluation work;
Step 2-5-2: be judged as NO, jumps to step 2-2, continues executing with;
Step 3: the internal memory in step 2 is calculated;
Step 3-1: start to read internal memory from specifying position;
Step 3-2: judge whether current first character is marker character;
Step 3-2-1: be judged as YES, skips this character, then branches to step 3-2;
Step 3-2-2 is judged as NO, and reads this character;
Step 3-3: after adding the byte of reading to return statement in order;
Step 3-4: repeat the above steps, until after adding all characters of next marker character to return statement;
Step 3-5: perform return statement, by result record in another file, inserts newline, empties the content after return statement;
Step 3-6: judge whether to arrive the end of this region of memory;
Step 3-6-1: be judged as YES, shuts down procedure;
Step 3-6-2: be judged as NO, jumps to step 3-2;
Beneficial effect:
1, the compiler that exploitation environment of the present invention carries goes the computing formula in calculation document, saves the calculating time.
2, the present invention utilizes Automatic Program to perform substantial amounts of computing formula that may be present in file, instead of traditional manual calculations, improves work efficiency.
3, the present invention can save the time of a large amount of computing formula in programmer's manual calculations file, effectively alleviate the operating pressure of application developer, by identifying the computing formula in file, automatization is calculated processing, instead of traditional manual calculations, be greatly improved the work efficiency of application developer.
Accompanying drawing explanation
Fig. 1 is that the present invention reads the method flow diagram of formula in file.
Fig. 2 is the method flow diagram that formula is read in internal memory by the present invention.
Fig. 3 is the method flow diagram that the present invention processes computing formula.
Detailed description of the invention
Below in conjunction with Figure of description, the invention is described in further detail.
Embodiment one
The invention provides a kind of method utilizing compiler that computing formula in file is carried out automatization's calculating, the method utilizes the method that the compiler that VisualStudio development environment carries goes substantial amounts of computing formula potential in automatization's calculation document, by the computing formula existed in Study document, read in internal memory, after utilizing program that computing formula is reverted to return statement, compiler is allowed to go to perform calculating task, thus improve the work efficiency of developer, alleviating their workload, its step is for including:
Step 1: obtain the computing formula of file destination, as it is shown in figure 1, concrete technical scheme is as follows:
Step 1-1: progressive scan file destination;
Step 1-2: judge whether current line has the target computing formula of setting;
Step 1-2-1: be judged as YES, writes another file one by one by each element of this computing formula, and inserts newline in the end;
Step 1-2-2: be judged as NO, skips this row, the next effectively row of scanning.
Step 1-3: judge whether to have arrived the ending of file destination;
Step 1-3-1: be judged as YES, carries out next step and reads in work;
Step 1-3-2: be judged as NO, jumps to step 1-1, continues to analyze;
Step 2: computing formula is read in internal memory, as in figure 2 it is shown, concrete technical scheme is as follows:
Step 2-1: first write a marker character in internal memory;
Step 2-2: the file that progressive scan step 1 generates;
Step 2-3: each element of each row formula is read in the middle of internal memory one by one;
Step 2-3-1: numerical value element directly reads in the middle of internal memory;
Step 2-3-2: symbol element utilizes program to be converted into the discernible symbol of program, is read in the middle of internal memory according still further to former sequence;
Step 2-4: after reading in each formula, again writes marker character in internal memory;
Step 2-5: judge whether to have arrived the end of file;
Step 2-5-1: be judged as YES, then stop reading in, carry out next step evaluation work;
Step 2-5-2: be judged as NO, jumps to step 2-2, continues executing with;
Step 3: the internal memory in step 2 is calculated, as it is shown on figure 3, concrete technical scheme is as follows:
Step 3-1: start to read internal memory from specifying position;
Step 3-2: judge whether current first character is marker character;
Step 3-2-1: be judged as YES, skips this character, then branches to step 3-2;
Step 3-2-2 is judged as NO, and reads this character;
Step 3-3: after adding the byte of reading to return statement in order;
Step 3-4: repeat the above steps, until after adding all characters of next marker character to return statement;
Step 3-5: perform return statement, by result record in another file, inserts newline, empties the content after return statement;
Step 3-6: judge whether to arrive the end of this region of memory;
Step 3-6-1: be judged as YES, shuts down procedure;
Step 3-6-2: be judged as NO, jumps to step 3-2;
Embodiment two
Concrete application scenarios: the present invention considers in the middle of some files, there may be many computing formula to exist, these formula need people manually to go to calculate its value, if the enormous amount of formula, that manual calculations would become impractical, and extremely inefficient, this situation brings great trouble to developer. The present invention is exactly in this case, uses the compiler that VisualStudio development environment carries that the formula in file is carried out automatization's calculating. First, computing formula in file being concentrated extracts in the middle of another file, then, by in the middle of the computing formula read-in programme internal memory that extracts, then, formula is progressively reverted to after return statement, finally, utilize the VisualStudio compiler carried that the computing formula after return statement is calculated. So, eliminate a large amount of manual operation, alleviate the work load of application developer, improve work efficiency.

Claims (2)

1. one kind utilizes the method that computing formula in file is carried out automatization's calculating by compiler, it is characterised in that described method comprises the steps of:
Step 1: analyze file destination;
Step 1-1: progressive scan file destination;
Step 1-2: judge whether current line has the target computing formula of setting;
Step 1-2-1: be judged as YES, writes another file one by one by each element of this computing formula, and inserts newline in the end;
Step 1-2-2: be judged as NO, skips this row, the next effectively row of scanning;
Step 1-3: judge whether to have arrived the ending of file destination;
Step 1-3-1: be judged as YES, carries out next step and reads in work;
Step 1-3-2: be judged as NO, jumps to step 1-1, continues to analyze;
Step 2: computing formula is read in internal memory;
Step 2-1: first write a marker character in internal memory;
Step 2-2: the file that progressive scan step 1 generates;
Step 2-3: each element of each row formula is read in the middle of internal memory one by one;
Step 2-3-1: numerical value element directly reads in the middle of internal memory;
Step 2-3-2: symbol element utilizes program to be converted into the discernible symbol of program, is read in the middle of internal memory according still further to former sequence;
Step 2-4: after reading in each formula, again writes marker character in internal memory;
Step 2-5: judge whether to have arrived the end of file;
Step 2-5-1: be judged as YES, then stop reading in, carry out next step evaluation work;
Step 2-5-2: be judged as NO, jumps to step 2-2, continues executing with;
Step 3: the internal memory in step 2 is calculated;
Step 3-1: start to read internal memory from specifying position;
Step 3-2: judge whether current first character is marker character;
Step 3-2-1: be judged as YES, skips this character, then branches to step 3-2;
Step 3-2-2 is judged as NO, and reads this character;
Step 3-3: after adding the byte of reading to return statement in order;
Step 3-4: repeat the above steps, until after adding all characters of next marker character to return statement;
Step 3-5: perform return statement, by result record in another file, inserts newline, empties the content after return statement;
Step 3-6: judge whether to arrive the end of this region of memory;
Step 3-6-1: be judged as YES, shuts down procedure;
Step 3-6-2: be judged as NO, jumps to step 3-2.
2. a kind of method utilizing compiler that computing formula in file is carried out automatization's calculating according to claim 1, it is characterized in that, described method is by reading the computing formula in file, store it in internal memory, after computing formula being reverted to return statement by program, finally utilize the VisualStudio compiler carried that computing formula is carried out automatization's calculating.
CN201610008596.9A 2016-01-07 2016-01-07 Method for automatically calculating calculation formula in file through compiler Pending CN105677438A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610008596.9A CN105677438A (en) 2016-01-07 2016-01-07 Method for automatically calculating calculation formula in file through compiler

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610008596.9A CN105677438A (en) 2016-01-07 2016-01-07 Method for automatically calculating calculation formula in file through compiler

Publications (1)

Publication Number Publication Date
CN105677438A true CN105677438A (en) 2016-06-15

Family

ID=56299231

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610008596.9A Pending CN105677438A (en) 2016-01-07 2016-01-07 Method for automatically calculating calculation formula in file through compiler

Country Status (1)

Country Link
CN (1) CN105677438A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108614680A (en) * 2016-12-14 2018-10-02 中国航空工业集团公司西安航空计算技术研究所 A kind of automatic generation method and system of information inquiring command program

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060059214A1 (en) * 2004-09-15 2006-03-16 Sargent Murray Iii Systems and methods for automated equation buildup
CN102033752A (en) * 2010-12-27 2011-04-27 畅捷通软件有限公司 Method and device for automatically calculating numerical value
CN103093043A (en) * 2013-01-09 2013-05-08 中国电力科学研究院 Design method for formula computing tools in power information system and design system thereof
CN104881288A (en) * 2015-06-01 2015-09-02 厦门美图移动科技有限公司 Automatic computing method and system in text mode

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060059214A1 (en) * 2004-09-15 2006-03-16 Sargent Murray Iii Systems and methods for automated equation buildup
CN102033752A (en) * 2010-12-27 2011-04-27 畅捷通软件有限公司 Method and device for automatically calculating numerical value
CN103093043A (en) * 2013-01-09 2013-05-08 中国电力科学研究院 Design method for formula computing tools in power information system and design system thereof
CN104881288A (en) * 2015-06-01 2015-09-02 厦门美图移动科技有限公司 Automatic computing method and system in text mode

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
FEITIAN: "php中处理字符串格式的计算公式eval()", 《BLOG.163.COM/FEITIAN_COM/BLOG/STATIC/19527338201431411203696》 *
PER热热: "在C语言中,文件中存储了公式,现在要读出公式再利用公式进行计算,求大神指点该怎么操作", 《HTTPS://ZHIDAO.BAIDU.COM/QUESTION/1860456476784632467.HTML》 *
魏振钢等: "一种提高大数据量数据计算时效性的方法研究", 《软件导刊》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108614680A (en) * 2016-12-14 2018-10-02 中国航空工业集团公司西安航空计算技术研究所 A kind of automatic generation method and system of information inquiring command program

Similar Documents

Publication Publication Date Title
CN105224370B (en) A kind of method and apparatus of loading ELF document
US9134966B2 (en) Management of mixed programming languages for a simulation environment
KR101098718B1 (en) System and method for creating, managing and using code segments
CN111124550B (en) Program dynamic loading method and device and storage medium
JP6418696B2 (en) Instruction set simulator and method for generating the simulator
US10466988B2 (en) Systems and methods for automatic computer code parallelization
CN105224309B (en) A kind of method and apparatus for transferring function
CN108021370B (en) Byte code optimization method and device, storage medium, processor and terminal
US20050071809A1 (en) System and method for serializing objects in a compiled programming language
WO2023016480A1 (en) Code processing method under hardware memory order architecture, and corresponding apparatus
CN105677438A (en) Method for automatically calculating calculation formula in file through compiler
CN102662847B (en) System and method for program debugging of embedded system based on flash memory application
CN102831334B (en) Positioning method and positioning system for target address
CN111158665B (en) Code generation method and device, electronic equipment and storage medium
CN113138755A (en) JSON serialization and deserialization optimization method and system
US20180253287A1 (en) Method for translation of assembler computer language to validated object-oriented programming language
CN112685041A (en) Front-end modular grammar conversion method, system and storage medium
GB2503590A (en) Interoperability bridge unit for dynamic linking of executable library functions to an application using platform invoke
CN103106356A (en) Method for generating code in safe environment and improving software protection intensity
CN116662161A (en) Function debugging method, device, equipment and storage medium
CN116663489A (en) RTL module resetting method and device, electronic equipment and storage medium
US20080147696A1 (en) Method for reducing memory size allocated by a string class using unicode
CN102819435B (en) A kind of position independent code generation method of Java Virtual Machine
Ceccato et al. Data model reverse engineering in migrating a legacy system to Java
CN112487438B (en) Heap object Use-After-Free vulnerability detection method based on identifier consistency

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20160615