Specific embodiment
In being described below, in order to illustrate rather than in order to limit, it is proposed that such as tool of particular system structure, technology etc
Body details, to understand thoroughly the embodiment of the present invention.However, it will be clear to one skilled in the art that there is no these specifically
The present invention can also be realized in the other embodiments of details.In other situations, it omits to well-known system, device, electricity
Road and the detailed description of method, in case unnecessary details interferes description of the invention.
It it should be appreciated that ought be special described by the instruction of term " comprising " use in this specification and in the appended claims
Sign, entirety, step, operation, the presence of element and/or component, but be not precluded one or more of the other feature, entirety, step,
Operation, element, component and/or its presence or addition gathered.
It is also understood that the term used in this description of the invention is merely for the sake of the mesh for describing specific embodiment
And be not intended to limit the present invention.As description of the invention and it is used in the attached claims, unless on
Other situations are hereafter clearly indicated, otherwise " one " of singulative, "one" and "the" are intended to include plural form.
It will be further appreciated that the term "and/or" used in description of the invention and the appended claims is
Refer to any combinations and all possible combinations of one or more of the associated item listed, and including these combinations.
As used in this specification and in the appended claims, term " if " can be according to context quilt
Be construed to " when ... " or " once " or " in response to determining " or " in response to detecting ".Similarly, phrase " if it is determined that " or
" if detecting [described condition or event] " can be interpreted to mean according to context " once it is determined that " or " in response to true
It is fixed " or " once detecting [described condition or event] " or " in response to detecting [described condition or event] ".
In order to illustrate technical solutions according to the invention, illustrated below by specific embodiment.
Fig. 1 is the realization flow diagram of the amending method of program code provided in an embodiment of the present invention, as shown in the figure, institute
The method of stating may comprise steps of:
Step S101 obtains code file to be modified.
Wherein, the code file to be modified includes:
Code text, annotation text;
The annotation text is used to describe the initial value of the code text, the type of code of the code text, first
The type of visualization interface, the coordinate of the first visualization interface, the first visualization interface control value.
Step S102 generates the first visualization interface according to the code file to be modified.
In practical applications, the first visualization interface can be UI interfaces or gui interface.
Optionally, it is described that first visualization interface is generated according to the code file to be modified, including:
Morphology parsing is carried out to the code text and the annotation text, is obtained in code node and the annotation text
Description information corresponding with the code node;
First visualization interface is generated according to the code node and the description information.
In practical applications, the code text in code file can be C/C++ language codes texts, in code file
It can be JSON language notation texts to annotate text.Initial value, code are carried out to code text by JSON language notations text
The description of type, and describe the type of the gui interface of generation, coordinate, control value etc..
Morphology parsing is carried out to the code text and the annotation text, is obtained in code node and the annotation text
Description information corresponding with the code node.In practical applications, it needs using morphology resolver to code text and annotation
Text carries out morphology parsing.Since annotation text is JSON language formats, so an embedded JSON in morphology resolver
Text resolver, for being parsed in itself to JSON language.
Illustratively, if first code node corresponds to " user option ", second code node corresponds to " voltage parameter ", with
The corresponding description information of first code node is optional user 1, user 2 in user option, corresponding with second code node to retouch
It is 10V, 20V that state information, which be voltage parameter selectable value,.The gui interface generated according to the code node and the description information
In, four tick boxes can be shown according to corresponding position of the coordinate of the gui interface in description information in gui interface, each
Corresponding " user 1 ", " user 2 ", " 10V ", " 20V " printed words, user can perform on gui interface and choose respectively for tick boxes back
Operation.
Preferably, annotating description information corresponding with code node in text can also include:First visualization interface member
The behavioural information of element.The behavioural information of first visualization interface can be corresponding interior for limiting the first visualization interface element
Related information between appearance,
Illustratively, it is assumed that the behavioural information of the first visualization interface element is:" user 1 " and " user 2 " corresponding hook
It selects frame that can select 1 with 2,2 can also select 2;" 10V " and " 20V " corresponding tick boxes 2 can only select 1.So when " user 1 " is corresponding
When tick boxes are checked, " user 2 " corresponding tick boxes are still in the state that can be checked.When " 10V " corresponding tick boxes quilt
When choosing, " 20V " corresponding tick boxes are graying, and expression can not be checked.It should be noted that this is the first visualization interface
One example of the behavioural information of element does not make the behavioural information of specific first visualization interface element specific limit.
Step S103 obtains modification instruction of the user on first visualization interface.
In practical applications, the element presented on gui interface includes tick boxes, check box, fillable region.User can be with
It is performed on gui interface and chooses operation, addition word/numerical operation.As long as user performs operation, i.e. table on gui interface
Show that user sends out modification instruction by gui interface.
Step S104 modifies to obtain modified generation according to the modification instruction to the code file to be modified
Code file.
Optionally, it is described to be modified according to the modification instruction to the code file to be modified, including:
The description information is correspondingly changed according to the modification instruction;
Morphology synthesis is carried out to the code node and modified description information, obtains modified code file.
In practical applications, modification instruction is the modification to description information, be according to the corresponding modification of modification instruction generation
Code file afterwards, need using morphology synthesizer to code node and modified description information corresponding with code node into
Row morphology synthesizes, and obtains modified code file.Wherein, the effect of Code synthesis device and the effect of code parser on the contrary,
Code parser is that code file is resolved to code node and description information, and Code synthesis device is to believe code node and description
Breath synthesizes code file;In other words, the processing procedure of code parser and Code synthesis device is reciprocal.
Optionally, in order to technical staff and non-technical personnel is made to give full play to the advantage in respective field, meets technical staff
With the needs of the interactive modifying of non-technical personnel, after code file to be modified is obtained, further include:
Modification mode is obtained to instruct;
If the modification mode is instructed to change mode using visualization interface, according to the code file to be modified
Generate the first visualization interface;
If the modification mode is instructed as using manual modification mode, the code is shown by the second visualization interface
Code text in file, second visualization interface are used to indicate user and manual modification are carried out to the code text.
Wherein, the second visualization interface can be program editor interface, and technical staff can be at program editor interface
On to program code carry out directly by hand modification.
Illustratively, it after obtaining code file to be modified, obtains modification mode and instructs, if modification mode is instructed to adopt
Mode is changed with visualization interface, then the first visualization interface is generated, and continue to execute according to the code file to be modified
Step S103-S104;If modification mode is instructed as using manual modification mode, by program editor interface by code text
It is shown to technical staff.In this way, when non-technical personnel needs to modify to program code, even if being ignorant of program
Language can also use visualization interface to change mode, be modified by performing operation on gui interface to code;When
When technical staff needs to modify to program code, manual modification mode may be used, directly to generation in program editor
Code is modified.
The present embodiment is by obtaining code file to be modified;It is visual according to the code file generation first to be modified
Change interface;Obtain modification instruction of the user on first visualization interface;According to the modification instruction to described to be modified
Code file modify to obtain modified code file;The complexity of program code modification is effectively reduced, and
Greatly reduce the workload of program code modification.
It should be understood that the size of the serial number of each step is not meant to the priority of execution sequence, each process in above-described embodiment
Execution sequence should determine that the implementation process without coping with the embodiment of the present invention forms any limit with its function and internal logic
It is fixed.
Fig. 2 is the schematic diagram of the modification device of program code provided in an embodiment of the present invention, for convenience of description, is only shown
With the relevant part of the embodiment of the present invention.
The modification device 2 of said program code includes:
First acquisition unit 21, for obtaining code file to be modified.
Generation unit 22, for generating the first visualization interface according to the code file to be modified.
Second acquisition unit 23, for obtaining modification instruction of the user on first visualization interface.
Unit 24 is changed, is changed for being modified according to the modification instruction to the code file to be modified
Code file afterwards.
Wherein, the code file to be modified includes:
Code text, annotation text;
The annotation text is used to describe the initial value of the code text, the type of code of the code text, first
The type of visualization interface, the coordinate of the first visualization interface, the first visualization interface control value.
Optionally, the generation unit 22 includes:
Parsing module, for the code text and it is described annotation text carry out morphology parsing, obtain code node and
Description information corresponding with the code node in the annotation text.
Generation module, for generating the first visualization interface according to the code node and the description information.
Optionally, the modification unit 24 includes:
The description information is correspondingly changed according to the modification instruction.
Morphology synthesis is carried out to the code node and modified description information, obtains modified code file.
Optionally, described device 2 further includes:
Third acquiring unit 25 instructs for after code file to be modified is obtained, obtaining modification mode.
Generation unit 22 is instructed if being additionally operable to the modification mode to change mode using visualization interface, according to institute
It states code file to be modified and generates the first visualization interface.
Display unit 26, if being instructed for the modification mode using manual modification mode, to pass through the second visualization
Code text in code file described in interface display, second visualization interface are used to indicate user to the code text
Carry out manual modification.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each work(
Can unit, module division progress for example, in practical application, can be as needed and by above-mentioned function distribution by different
Functional unit, module are completed, i.e., the internal structure of described device are divided into different functional units or module, more than completion
The all or part of function of description.Each functional unit, module in embodiment can be integrated in a processing unit, also may be used
To be that each unit is individually physically present, can also two or more units integrate in a unit, it is above-mentioned integrated
The form that hardware had both may be used in unit is realized, can also be realized in the form of SFU software functional unit.In addition, each function list
Member, the specific name of module are not limited to the protection domain of the application also only to facilitate mutually distinguish.Above system
The specific work process of middle unit, module can refer to the corresponding process in preceding method embodiment, and details are not described herein.
Fig. 3 is the schematic diagram of terminal device provided in an embodiment of the present invention.As shown in figure 3, the terminal device 3 of the embodiment
Including:Processor 30, memory 31 and it is stored in the calculating that can be run in the memory 31 and on the processor 30
Machine program 32.The processor 30 realizes that the amending method of above-mentioned each program code is implemented when performing the computer program 32
Step in example, such as step S101 to S104 shown in FIG. 1.Alternatively, the processor 30 performs the computer program 32
The function of each module/unit in the above-mentioned each device embodiments of Shi Shixian, such as the function of module 21 to 26 shown in Fig. 2.
Illustratively, the computer program 32 can be divided into one or more module/units, it is one or
Multiple module/units are stored in the memory 31, and are performed by the processor 30, to complete the present invention.Described one
A or multiple module/units can be the series of computation machine program instruction section that can complete specific function, which is used for
Implementation procedure of the computer program 32 in the terminal device 3 is described.For example, the computer program 32 can be divided
First acquisition unit, the first generation unit, second acquisition unit, modification unit are cut into, each unit concrete function is as follows:
First acquisition unit, for obtaining code file to be modified;
Generation unit, for generating the first visualization interface according to the code file to be modified;
Second acquisition unit, for obtaining modification instruction of the user on first visualization interface;
Unit is changed, for being modified after obtaining modification to the code file to be modified according to the modification instruction
Code file.
Wherein, the code file to be modified includes:
Code text, annotation text;
The annotation text is used to describe the initial value of the code text, the type of code of the code text, first
The type of visualization interface, the coordinate of the first visualization interface, the first visualization interface control value.
Optionally, the generation unit includes:
Parsing module, for the code text and it is described annotation text carry out morphology parsing, obtain code node and
Description information corresponding with the code node in the annotation text;
Generation module, for generating the first visualization interface according to the code node and the description information.
Optionally, the modification unit includes:
The description information is correspondingly changed according to the modification instruction;
Morphology synthesis is carried out to the code node and modified description information, obtains modified code file.
Optionally, described device further includes:
Third acquiring unit instructs for after code file to be modified is obtained, obtaining modification mode;
Generation unit is instructed if being additionally operable to the modification mode to change mode using visualization interface, according to
Code file to be modified generates the first visualization interface;
Display unit, if being instructed for the modification mode using manual modification mode, to pass through the second visualization circle
Face shows the code text in the code file, second visualization interface be used to indicate user to the code text into
Row modification by hand.
The terminal device 3 can be that the calculating such as desktop PC, notebook, palm PC and cloud server are set
It is standby.The terminal device may include, but be not limited only to, processor 30, memory 31.It will be understood by those skilled in the art that Fig. 3
The only example of terminal device 3 does not form the restriction to terminal device 3, can include than illustrating more or fewer portions
Part either combines certain components or different components, such as the terminal device can also include input-output equipment, net
Network access device, bus etc..
Alleged processor 30 can be central processing unit (Central Processing Unit, CPU), can also be
Other general processors, digital signal processor (Digital Signal Processor, DSP), application-specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor can also be any conventional processor
Deng.
The memory 31 can be the internal storage unit of the terminal device 3, such as the hard disk of terminal device 3 or interior
It deposits.The memory 31 can also be the External memory equipment of the terminal device 3, such as be equipped on the terminal device 3
Plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card dodge
Deposit card (Flash Card) etc..Further, the memory 31 can also both include the storage inside list of the terminal device 3
Member also includes External memory equipment.The memory 31 is used to store needed for the computer program and the terminal device
Other programs and data.The memory 31 can be also used for temporarily storing the data that has exported or will export.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in detail or remembers in some embodiment
The part of load may refer to the associated description of other embodiments.
Those of ordinary skill in the art may realize that each exemplary lists described with reference to the embodiments described herein
Member and algorithm steps can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions are actually
It is performed with hardware or software mode, specific application and design constraint depending on technical solution.Professional technician
Described function can be realized using distinct methods to each specific application, but this realization is it is not considered that exceed
The scope of the present invention.
In embodiment provided by the present invention, it should be understood that disclosed device/terminal device and method, it can be with
It realizes by another way.For example, device described above/terminal device embodiment is only schematical, for example, institute
The division of module or unit is stated, only a kind of division of logic function can have other dividing mode in actual implementation, such as
Multiple units or component may be combined or can be integrated into another system or some features can be ignored or does not perform.Separately
A bit, shown or discussed mutual coupling or direct-coupling or communication connection can be by some interfaces, device
Or the INDIRECT COUPLING of unit or communication connection, can be electrical, machinery or other forms.
The unit illustrated as separating component may or may not be physically separate, be shown as unit
The component shown may or may not be physical unit, you can be located at a place or can also be distributed to multiple
In network element.Some or all of unit therein can be selected according to the actual needs to realize the mesh of this embodiment scheme
's.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also
That each unit is individually physically present, can also two or more units integrate in a unit.Above-mentioned integrated list
The form that hardware had both may be used in member is realized, can also be realized in the form of SFU software functional unit.
If the integrated module/unit realized in the form of SFU software functional unit and be independent product sale or
In use, it can be stored in a computer read/write memory medium.Based on such understanding, the present invention realizes above-mentioned implementation
All or part of flow in example method, can also instruct relevant hardware to complete, the meter by computer program
Calculation machine program can be stored in a computer readable storage medium, the computer program when being executed by processor, it can be achieved that on
The step of stating each embodiment of the method.Wherein, the computer program includes computer program code, the computer program generation
Code can be source code form, object identification code form, executable file or certain intermediate forms etc..The computer-readable medium
It can include:Any entity of the computer program code or device, recording medium, USB flash disk, mobile hard disk, magnetic can be carried
Dish, CD, computer storage, read-only memory (ROM, Read-Only Memory), random access memory (RAM,
Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium etc..It is it should be noted that described
The content that computer-readable medium includes can carry out appropriate increasing according to legislation in jurisdiction and the requirement of patent practice
Subtract, such as in certain jurisdictions, according to legislation and patent practice, computer-readable medium do not include be electric carrier signal and
Telecommunication signal.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although with reference to aforementioned reality
Example is applied the present invention is described in detail, it will be understood by those of ordinary skill in the art that:It still can be to aforementioned each
Technical solution recorded in embodiment modifies or carries out equivalent replacement to which part technical characteristic;And these are changed
Or replace, the spirit and scope for various embodiments of the present invention technical solution that it does not separate the essence of the corresponding technical solution should all
It is included within protection scope of the present invention.