CN102323891A - Programming method - Google Patents

Programming method Download PDF

Info

Publication number
CN102323891A
CN102323891A CN201110338428A CN201110338428A CN102323891A CN 102323891 A CN102323891 A CN 102323891A CN 201110338428 A CN201110338428 A CN 201110338428A CN 201110338428 A CN201110338428 A CN 201110338428A CN 102323891 A CN102323891 A CN 102323891A
Authority
CN
China
Prior art keywords
function
expanded mode
information
member function
basic mould
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.)
Granted
Application number
CN201110338428A
Other languages
Chinese (zh)
Other versions
CN102323891B (en
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN 201110338428 priority Critical patent/CN102323891B/en
Publication of CN102323891A publication Critical patent/CN102323891A/en
Application granted granted Critical
Publication of CN102323891B publication Critical patent/CN102323891B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a programming method, which comprises the following steps of: a, before the initialization of a system, pre-combining the interface function target code information of an interface function through an instruction of a central processing unit (CPU) instruction system, and defining a basic model of the system; b, loading the basic model of the system into a dictionary, and initializing the system; c, loading words, which has the same data structure as the basic model of the system and serves as an expansion model, in a program source code into the dictionary by using a dictionary generator, establishing an information index for the expansion model in the dictionary, and generating the index information of the expansion model; d, translating the information of the program source code by using a translator according to the expansion model which is loaded in the dictionary; e, traversing the dictionary by using an assembler, and assembling data; and f, after the data is assembled, calling an instruction access address by using a modifier according to the actual position of a function target code.

Description

A kind of programmed method
Technical field
The present invention relates to a kind of programmed method in the computer realm.
Background technology
A variety of programming languages and the programmed method that adopts this language are arranged in the prior art, and like the C language, C++ etc. all have the characteristics of himself; Yet publication number is the computer system that discloses a kind of Chinese programming monolithic processor in the one Chinese patent application of CN1100543, and wherein single-chip microcomputer Chinese programming system has a Chinese dictionary unit, and the explanation of system is accomplished in this Chinese dictionary unit, compiling and operation; Contain the driving of the due equipment of operating system in the dictionary unit, equipment control, file management, order management, explanation, compiling, editor, trace debug etc.; The dictionary identify unit of Chinese neologisms can be multiplied according to the legal inlet flow of text of user's input in this Chinese dictionary unit, and this dictionary identify unit also can be multiplied the new compound word that to comprise this function in read write memory module; That this system adopts is soft-and hard; Integrated design is connected the component address of a readable memory bank and a read-write memory bank overlapping on hardware; Whether reading through bus arbiter decision of the data of two memory banks, this bus arbiter utilize the address on system's " solid speech->" unit pointer to judge in two memory banks of selection; Can the dictionary in the read-write memory bank partly be transferred in the only readable memory bank in the application system, simultaneously bus arbiter can select to read and write one of two memory banks according to new mode with " Gu speech->".The disclosed programmed method of above-mentioned computer system can't be implemented in the equipment with different CPU and use, and therefore can't realize striding hardware platform, causes the application of this programmed method extensive inadequately.In addition, adopting the programmed method of C and CC++ is at first to compile, and translates into machine code at last, because different CPU has different translation criterias, can't unify, and therefore adopts C and C Plus Plus can't be implemented in the equipment with different CPU and programmes.
Summary of the invention
For this reason, the technical matters that the present invention will solve is to propose a kind of can in having the equipment of different CPU, the use, can realize striding the programmed method of hardware platform.
A kind of programmed method may further comprise the steps:
A. before system initialization, synthesize the interface function object code information of interface function earlier in advance through the instruction of cpu instruction system, the more basic mould of define system;
B. set up dictionary,, and system carried out initialization the basic mould of the said system dictionary of packing into;
C. the dictionary generator with have in the program source code with the speech of said system basic mould same data structure as the expanded mode said dictionary of packing into, in said dictionary, set up information index then, and generate the expanded mode index information to this expanded mode;
D. translater is translated program source code information according to the expanded mode of the said dictionary of packing into;
E. assembler travels through said dictionary, the line data of going forward side by side assembling;
F. after the data assembling, the physical location of pressing the function object code is revised machine call instruction reference address.
Above-mentioned programmed method; Said interface function object code information comprises the interface function index information; With the interface function machine code information that becomes mapping relations with said interface function index information, the data structure of the basic mould of said system is for comprising the basic mould title of system, the basic mould input parameter of basic mould attribute of system and system; The data structure of said interface function index information is interface function object code entry address, interface function attribute, interface function input parameter and the interface function status indicator that comprises the interface function name, is used to represent said interface function object code information space position; The basic mould of said system has the basic mould member function of system; The basic mould member function of said system has system's basic mould member function index information, and the data structure of this index information is to comprise system's basic mould member function name, system basic mould member function object code entry address, system's basic mould member function attribute and the basic mould member function of system's basic mould member function input parameter and the system status indicator that becomes mapping relations respectively with said interface function name, said program function object code entry address, said interface function attribute, said interface function input parameter and said interface function status indicator.
Above-mentioned programmed method; Among the said step b system is carried out the information index that initialized step is specially the member function of in dictionary, setting up the basic mould of said system; And the corresponding system of the interface function index information basic mould member function index information described in generation and the step a, more said program function object code entry address is stored in the relevant position of information index.
Above-mentioned programmed method; Said expanded mode comprises expanded mode member object and expanded mode member function, and the data structure of the member function of said expanded mode is for comprising and system basic mould member function name, system basic mould member function object code entry address, system's basic mould member function attribute, the basic mould member function of system's basic mould member function input parameter and system status indicator corresponding expanded mode member function name, expanded mode member function object code entry address, expanded mode member function attribute, expanded mode member function input parameter and expanded mode member function status indicator respectively; Said expanded mode member function comprises operational symbol and/or generic function; The data structure of said expanded mode member object is expanded mode member object data entry address, expanded mode member object attribute and the expanded mode member object status indicator that comprises expanded mode member object name, is used to store the expanded mode member object.
Above-mentioned programmed method; The translation steps of translater is specially: translater is according to expanded mode member function entity text position address information in the said dictionary; From the program source code text, transfer the entity text, said entity text is the said contamination in the said dictionary of packing into; And said entity text translation become the code information of expanded mode member function target machine; The interim storage space of in computing machine, opening up simultaneously, and be that base unit deposits said interim storage space in the program file with the code information of said expanded mode member function target machine; Said interim storage space has interim storage space entry address information, makes said interim storage space entry address information become mapping relations with said expanded mode member function object code entry address information;
Wherein, translater scans in translation process and detects said entity text:
When scanning detects operational symbol character string information or generic function character string information, search in the dictionary and have the function name basic mould member function index information of the same name with it, or expanded mode member function index information:
I. said translater is set to state to be used according to the status indicator of basic mould member function of corresponding said system in the index information dictionary that finds or said expanded mode member function;
The said translater of ii adds corresponding call instruction and points to basic mould member function index information or the jump location of expanded mode member function index information inlet in said interim storage space;
When scanning detected expanded mode member object character string information, said translater expanded mode member object status indicator was set to status indicator to be used.
Above-mentioned programmed method; Said data assembling is specially: when the said member function attitude of said basic mould member function index information that is detected or said expanded mode member function index information is designated status indicator to be used; In the object code district of said assembler, perhaps said assembler copies to the said interim storage space of expanded mode member function target machine code information from steps d the object code district of assembler said assembler with said basic mould member function object code information reproduction.
Above-mentioned programmed method, the modification machine call instruction reference address of above-mentioned steps f is the function object code information entry position of living in the object code district of assembler according to detected index information with the function information index entry address modification of basic mould member function of corresponding said system or said expanded mode member function in the dictionary.
Above-mentioned programmed method, the data structure of wherein said interface function index information also comprise interface function object code information size attribute; The data structure of the member function of said expanded mode also comprises said expanded mode member function target machine code information size attribute; Above-mentioned steps a is included in also in advance that the size of docking port function object code information is recorded in the said interface function object code information size attribute after the interface function object code information of synthetic interface function; And the size with the code information of said expanded mode member function target machine translater described in the translation process adds corresponding call instruction in said interim storage space after is recorded in the said expanded mode member function target machine code information size attribute; And be stored in continuously in the said object code district of said assembler according to the size of said interface function object code information and the said basic mould member function object code information of big young pathbreaker and the code information of expanded mode member function target machine of said expanded mode member function target machine code information.
The invention has the advantages that:
1. this programmed method is before system initialization; Synthesize the interface function object code information of interface function earlier through the instruction of cpu instruction system in advance, dock with the different CPU machine instruction, both can under different CPU, realize programming with the interface function form; Shortened the language environment construction cycle under the different CPU again; Reduce the development difficulty of environment, realize striding hardware platform, made things convenient for programmed method promoting the use of at equipment with different CPU.
2. from the foundation of dictionary,,, be main index fully with the dictionary to the assembling of object code to the translation of function, relative C language, C++, the more succinctly structuring more of its compilation process of JAVA.
3. said basic mould member function object code information and the code information of expanded mode member function target machine are continuously storage in the said object code district of said assembler; Can guarantee the seamless combination of object code; Application program is difficult for being destroyed, and has improved the security of executable code.
Description of drawings
For content of the present invention is more clearly understood, below according to a particular embodiment of the invention and combine accompanying drawing, the present invention is done further detailed explanation.
The process flow diagram of Fig. 1 programmed method;
Embodiment
Embodiment 1
Programmed method as shown in Figure 1 may further comprise the steps:
A. before system initialization, synthesize the interface function object code information of interface function earlier in advance through the instruction of cpu instruction system, the more basic mould of define system;
B. set up dictionary,, and system carried out initialization the basic mould of the said system said dictionary of packing into;
C. the dictionary generator with have in the program source code with the speech of said system basic mould same data structure as the expanded mode said dictionary of packing into, in said dictionary, set up information index then, and generate the expanded mode index information to this expanded mode;
D. translater is translated program source code information according to the expanded mode of the said dictionary of packing into;
E. assembler travels through said dictionary, the line data of going forward side by side assembling;
F. after the data assembling, the physical location of pressing the function object code is revised machine call instruction reference address.
Wherein, Said interface function object code information is preferably and comprises the interface function index information; With the interface function machine code information that becomes mapping relations with said interface function index information, the data structure of the basic mould of said system is for comprising the basic mould title of system, the basic mould input parameter of basic mould attribute of system and system; The data structure of said interface function index information is interface function object code entry address, interface function attribute, interface function input parameter and the interface function status indicator that comprises the interface function name, is used to represent said interface function object code information space position; The basic mould of said system has the basic mould member function of system; The basic mould member function of said system has system's basic mould member function index information, and the data structure of this index information is to comprise system's basic mould member function name, system basic mould member function object code entry address, system's basic mould member function attribute and the basic mould member function of system's basic mould member function input parameter and the system status indicator that becomes mapping relations respectively with said interface function name, said program function object code entry address, said interface function attribute, said interface function input parameter and said interface function status indicator;
Among the said step b system is carried out the information index that initialized step specifically is preferably the member function of in dictionary, setting up the basic mould of said system; And the corresponding system of the interface function index information basic mould member function index information described in generation and the step a, more said program function object code entry address is stored in the relevant position of information index.
Said expanded mode is preferably and comprises expanded mode member object and expanded mode member function, and the data structure of the member function of said expanded mode is for comprising and system basic mould member function name, system basic mould member function object code entry address, system's basic mould member function attribute, the basic mould member function of system's basic mould member function input parameter and system status indicator corresponding expanded mode member function name, expanded mode member function object code entry address, expanded mode member function attribute, expanded mode member function input parameter and expanded mode member function status indicator respectively; Said expanded mode member function comprises operational symbol and/or generic function; The data structure of said expanded mode member object is expanded mode member object data entry address, expanded mode member object attribute and the expanded mode member object status indicator that comprises expanded mode member object name, is used to store the expanded mode member object.
The translation steps of translater specifically is preferably: translater is according to expanded mode member function entity text position address information in the said dictionary; From the program source code text, transfer the entity text, said entity text is the said contamination in the said dictionary of packing into; And said entity text translation become the code information of expanded mode member function target machine; The interim storage space of in computing machine, opening up simultaneously, and be that base unit deposits said interim storage space in the program file with the code information of said expanded mode member function target machine; Said interim storage space has interim storage space entry address information, makes said interim storage space entry address information become mapping relations with said expanded mode member function object code entry address information;
Wherein, translater scans in translation process and detects said entity text:
When scanning detects operational symbol character string information or generic function character string information, search in the dictionary and have the function name basic mould member function index information of the same name with it, or expanded mode member function index information:
I. said translater is set to state to be used according to the status indicator of basic mould member function of corresponding said system in the index information dictionary that finds or said expanded mode member function;
The said translater of ii adds corresponding call instruction and points to basic mould member function index information or the jump location of expanded mode member function index information inlet in said interim storage space;
When scanning detected expanded mode member object character string information, said translater expanded mode member object status indicator was set to status indicator to be used.
Said data assembling process specifically is preferably: when the said member function attitude of said basic mould member function index information that is detected or said expanded mode member function index information is designated status indicator to be used; In the object code district of said assembler, perhaps said assembler copies to the said interim storage space of expanded mode member function target machine code information from steps d the object code district of assembler said assembler with said basic mould member function object code information reproduction.Preferred in the said object code district of said assembler of said basic mould member function object code information and/or the code information of expanded mode member function target machine be to store continuously.
It is the function object code information entry position of living in the object code district of assembler with the function information index entry address modification of basic mould member function of corresponding said system or said expanded mode member function in the dictionary that above-mentioned modification machine call instruction reference address is preferably according to detected index information.
Programmed method of the present invention can be optimized for further:
The data structure of said interface function index information also comprises interface function object code information size attribute; The data structure of the member function of said expanded mode also comprises said expanded mode member function target machine code information size attribute;
Above-mentioned steps a is included in also in advance that the size of docking port function object code information is recorded in the said interface function object code information size attribute after the interface function object code information of synthetic interface function;
And the size with the code information of said expanded mode member function target machine translater described in the translation process adds corresponding call instruction in said interim storage space after is recorded in the said expanded mode member function target machine code information size attribute;
And be stored in continuously in the said object code district of said assembler according to the size of said interface function object code information and the said basic mould member function object code information of big young pathbreaker and the code information of expanded mode member function target machine of said expanded mode member function target machine code information.
Obviously, the foregoing description only be for explanation clearly done for example, and be not qualification to embodiment.For the those of ordinary skill in affiliated field, on the basis of above-mentioned explanation, can also make other multi-form variation or change according to varying in size of equipment.Here need not also can't give exhaustive to all embodiments.And conspicuous variation of being extended out thus or change still are among the protection domain of the invention.

Claims (8)

1. programmed method, its characteristic may further comprise the steps:
A. before system initialization, synthesize the interface function object code information of interface function earlier in advance through the instruction of cpu instruction system, the more basic mould of define system;
B. set up dictionary,, and system carried out initialization the basic mould of the said system said dictionary of packing into;
C. the dictionary generator with have in the program source code with the speech of said system basic mould same data structure as the expanded mode said dictionary of packing into, in said dictionary, set up information index then, and generate the expanded mode index information to this expanded mode;
D. translater is translated program source code information according to the expanded mode of the said dictionary of packing into;
E. assembler travels through said dictionary, the line data of going forward side by side assembling;
F. after the data assembling, the physical location of pressing the function object code is revised machine call instruction reference address.
2. programmed method according to claim 1 is characterized in that:
Said interface function object code information comprises the interface function index information; With the interface function machine code information that becomes mapping relations with said interface function index information, the data structure of the basic mould of said system is for comprising the basic mould title of system, the basic mould input parameter of basic mould attribute of system and system;
The data structure of said interface function index information is interface function object code entry address, interface function attribute, interface function input parameter and the interface function status indicator that comprises the interface function name, is used to represent said interface function object code information space position;
The basic mould of said system has the basic mould member function of system; The basic mould member function of said system has system's basic mould member function index information, and the data structure of this index information is to comprise system's basic mould member function name, system basic mould member function object code entry address, system's basic mould member function attribute and the basic mould member function of system's basic mould member function input parameter and the system status indicator that becomes mapping relations respectively with said interface function name, said program function object code entry address, said interface function attribute, said interface function input parameter and said interface function status indicator.
3. programmed method according to claim 1 and 2 is characterized in that:
Among the said step b system is carried out the information index that initialized step is specially the member function of in dictionary, setting up the basic mould of said system; And the corresponding system of the interface function index information basic mould member function index information described in generation and the step a, more said program function object code entry address is stored in the relevant position of information index.
4. programmed method according to claim 3 is characterized in that:
Said expanded mode comprises expanded mode member object and expanded mode member function, and the data structure of said expanded mode member function is for comprising and system basic mould member function name, system basic mould member function object code entry address, system's basic mould member function attribute, the basic mould member function of system's basic mould member function input parameter and system status indicator corresponding expanded mode member function name, expanded mode member function object code entry address, expanded mode member function attribute, expanded mode member function input parameter and expanded mode member function status indicator respectively; Said expanded mode member function comprises operational symbol and/or generic function; The data structure of said expanded mode member object is expanded mode member object data entry address, expanded mode member object attribute and the expanded mode member object status indicator that comprises expanded mode member object name, is used to store the expanded mode member object.
5. programmed method according to claim 4 is characterized in that:
The translation steps of translater is specially: translater is transferred the entity text according to expanded mode member function entity text position address information in the said dictionary from the program source code text, and said entity text is the said contamination in the said dictionary of packing into; And said entity text translation become the code information of expanded mode member function target machine; The interim storage space of in computing machine, opening up simultaneously, and be that base unit deposits said interim storage space in the program file with the code information of said expanded mode member function target machine; Said interim storage space has interim storage space entry address information, makes said interim storage space entry address information become mapping relations with said expanded mode member function object code entry address information;
Wherein, translater scans in translation process and detects said entity text:
When scanning detects operational symbol character string information or generic function character string information, search in the dictionary and have the function name basic mould member function index information of the same name with it, or expanded mode member function index information:
I. said translater is set to state to be used according to the status indicator of basic mould member function of corresponding said system in the index information dictionary that finds or said expanded mode member function;
The said translater of ii adds corresponding call instruction and points to the jump location inlet of said basic mould member function index information or said expanded mode member function index information in said interim storage space;
When scanning detected expanded mode member object character string information, said translater expanded mode member object status indicator was set to status indicator to be used.
6. programmed method according to claim 5 is characterized in that:
Said data assembling is specially: when the said member function attitude of said basic mould member function index information that is detected or said expanded mode member function index information is designated status indicator to be used; In the object code district of said assembler, perhaps said assembler copies to the said interim storage space of expanded mode member function target machine code information from steps d the object code district of assembler said assembler with said basic mould member function object code information reproduction.
7. programmed method according to claim 6 is characterized in that:
Revising machine call instruction reference address is the function object code information entry position of living in the object code district of assembler according to detected index information with the function information index entry address modification of basic mould member function of corresponding said system or said expanded mode member function in the dictionary.
8. according to claim 6 or 7 described programmed methods, it is characterized in that:
The data structure of said interface function index information also comprises interface function object code information size attribute; The data structure of the member function of said expanded mode also comprises said expanded mode member function target machine code information size attribute;
Above-mentioned steps a is included in also in advance that the size of docking port function object code information is recorded in the said interface function object code information size attribute after the interface function object code information of synthetic interface function;
And the size with the code information of said expanded mode member function target machine translater described in the translation process adds corresponding call instruction in said interim storage space after is recorded in the said expanded mode member function target machine code information size attribute;
And be stored in continuously in the said object code district of said assembler according to the size of said interface function object code information and the said basic mould member function object code information of big young pathbreaker and the code information of expanded mode member function target machine of said expanded mode member function target machine code information.
CN 201110338428 2011-10-31 2011-10-31 Programming method Active CN102323891B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110338428 CN102323891B (en) 2011-10-31 2011-10-31 Programming method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110338428 CN102323891B (en) 2011-10-31 2011-10-31 Programming method

Publications (2)

Publication Number Publication Date
CN102323891A true CN102323891A (en) 2012-01-18
CN102323891B CN102323891B (en) 2013-10-30

Family

ID=45451636

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110338428 Active CN102323891B (en) 2011-10-31 2011-10-31 Programming method

Country Status (1)

Country Link
CN (1) CN102323891B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7367019B2 (en) * 2004-09-16 2008-04-29 International Business Machines Corporation Parameter management using compiler directives
US7752596B2 (en) * 2006-03-17 2010-07-06 Microsoft Corporation Connecting alternative development environment to interpretive runtime engine
CN102063324A (en) * 2010-12-31 2011-05-18 杭州依赛通信有限公司 Method and system for implementing automatic programming

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7367019B2 (en) * 2004-09-16 2008-04-29 International Business Machines Corporation Parameter management using compiler directives
US7752596B2 (en) * 2006-03-17 2010-07-06 Microsoft Corporation Connecting alternative development environment to interpretive runtime engine
CN102063324A (en) * 2010-12-31 2011-05-18 杭州依赛通信有限公司 Method and system for implementing automatic programming

Also Published As

Publication number Publication date
CN102323891B (en) 2013-10-30

Similar Documents

Publication Publication Date Title
Lindén et al. Hfst—framework for compiling and applying morphologies
US8533690B2 (en) C-to-java programming language translator
US8549502B2 (en) Compiler with user-defined type inference rules
US10409559B2 (en) Single-source-base compilation for multiple target environments
CN102696012A (en) Creating inferred symbols from code usage
CN108139891A (en) Include suggesting for the missing of external file
CN106471476A (en) For to optimized code edit and continue and enhanced optimized debugging technology
US20120284688A1 (en) System and method for blurring instructions and data via binary obfuscation
US8266416B2 (en) Dynamic reconfiguration supporting method, dynamic reconfiguration supporting apparatus, and dynamic reconfiguration system
JP2006107338A (en) Program processor
CN102236573A (en) Name binding extensibility for typed programming language
JP5048949B2 (en) Software tools including asynchronous program flow modeling
CN101000557B (en) Virtual machine
CN111475150A (en) Cross-language binding method, device, equipment and storage medium
Feiler A language-oriented interactive programming environment based on compilation technology
CN102323891B (en) Programming method
Jakobsson et al. Fast as a shadow, expressive as a tree: hybrid memory monitoring for C
Monnier et al. Evolution of emacs lisp
CN105843661B (en) A kind of code method for relocating and its system towards host system
Lidin Expert. Net 2.0 il assembler
KR100846203B1 (en) Method for generating mobile application and record media recorded program for realizing the same
Dillig et al. SAIL: Static analysis intermediate language with a two-level representation
Mailund Pointers in C Programming
Moore Stateman: using metafunctions to manage large terms representing machine states
Clair Learning Objective-C 2.0: A hands-on guide to Objective-C for Mac and iOS developers

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant