A code processing method, device, equipment and medium
By identifying and displaying the execution logic lines and their nodes of the code, supporting multiple operations, the problem of inefficient acquisition of code information in the prior art is solved, and more efficient code processing and writing is achieved.
Patent Information
- Application Number
- CN202111627611.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2041-12-28
AI Technical Summary
In the prior art, how to obtain effective and key information from the code more effectively and efficiently is an important issue that needs to be solved urgently.
By determining the execution logic line of the code, identifying the root node and its nodes at all levels, and displaying these nodes according to the operation data, it supports users to display, selecting, searching, editing, annotating, combining, deleting, adding, adding connections, sharing or saving, and exporting the nodes, forming and testing the code.
It improves the determination effect and efficiency of effective code information and key information, reduces the difficulty of code writing, improves the functional diversity and flexibility of code processing, enhances the efficiency of code writing, and improves the usability of forming codes.
Smart Images

Figure CN114296709B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a code processing method, apparatus, device, and medium. Background Art
[0002] In the prior art, after obtaining the code, how to obtain the effective information and key information from the code is an important topic.
[0003] In view of this, a more effective and efficient code processing solution is needed. Summary of the Invention
[0004] Embodiments of this specification provide a code processing method, apparatus, device, and medium, which are used to solve the technical problem of how to perform code processing more effectively and efficiently.
[0005] To solve the above technical problem, the embodiments of this specification provide the following technical solutions:
[0006] Embodiments of this specification provide a code processing method, including:
[0007] Obtain the target code, and determine the execution logic line of the target code;
[0008] For any execution logic line, determine the root node of the execution logic line and the nodes at all levels subordinate to the root node; wherein, the root node or the nodes at all levels subordinate to the root node are used to represent the functions used in the target code;
[0009] Display the root node or the nodes subordinate to the root node according to the operation data.
[0010] Optionally, for any execution logic line, the root node of the execution logic line is used as the first-level node of the execution logic line;
[0011] Starting from the second-level node of the execution logic line, the function represented by any level node of the execution logic line is the nested function of the function represented by the upper-level node of this level node.
[0012] Optionally, displaying the root node or the nodes subordinate to the root node according to the operation data includes:
[0013] If a display instruction for any root node is obtained, then display the root node;
[0014] If a display instruction for any level node subordinate to the root node is obtained, then display the level node subordinate to the root node.
[0015] Optionally, the method further includes: if a selection instruction for any node is obtained, then display the function represented by the node;
[0016] Or,
[0017] The method further includes: if an editing instruction for any node is obtained, an editing page of the node is displayed to edit the function represented by the node;
[0018] Or,
[0019] The method further includes: if a commenting instruction for any node is obtained, a commenting page of the node is displayed to comment on the function corresponding to the node;
[0020] Or, the method further includes: if a search instruction for a function is obtained, the node corresponding to the searched function is displayed.
[0021] Optionally, the method further includes: setting permissions for operating on nodes at all levels.
[0022] Optionally, the method further includes:
[0023] If it is determined that one or more nodes are selected and a combination instruction for the selected node is obtained, code is formed based on the functions represented by the selected nodes.
[0024] Optionally, the method further includes:
[0025] Testing the code formed based on the functions represented by the selected nodes;
[0026] Or, voting on the codes formed based on the functions represented by the selected nodes, and determining the optimal code from the codes formed based on the functions represented by the selected nodes.
[0027] An embodiment of this specification provides a code processing apparatus, including:
[0028] An extraction module, configured to obtain target code and determine the execution logic line of the target code;
[0029] A characterization module, configured to, for any execution logic line, determine the root node of the execution logic line and the nodes at all levels subordinate to the root node; wherein, the root node or the nodes at all levels subordinate to the root node are used to characterize the functions used in the target code;
[0030] A display module, configured to display the root node or the nodes subordinate to the root node according to operation data.
[0031] An embodiment of this specification provides a code processing device, including:
[0032] At least one processor;
[0033] And,
[0034] A memory communicatively connected to the at least one processor;
[0035] Wherein,
[0036] the memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the above code processing method.
[0037] An embodiment of this specification provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the above code processing method.
[0038] At least one of the technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects:
[0039] The above technical solution determines the execution logic line of the code, and then represents the relationship between functions under each execution logic line through nodes and displays each node, so as to effectively extract the effective information and key information in the code, improve the determination effect and efficiency of the effective information and key information of the code, and improve the code processing effect and efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] To more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the following will briefly introduce the drawings required for the description of the embodiments of this specification or the prior art. Obviously, the drawings introduced below are only some of the drawings that may be involved in the embodiments described in this specification. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.
[0041] Figure 1 It is a schematic diagram of the execution subject of the code processing method in the first embodiment of this specification.
[0042] Figure 2 It is a schematic flowchart of the code processing method in the first embodiment of this specification.
[0043] Figure 3 It is a schematic diagram of program execution in the first embodiment of this specification.
[0044] Figure 4 It is a schematic diagram of a node display in the first embodiment of this specification.
[0045] Figure 5 It is another schematic diagram of a node display in the first embodiment of this specification.
[0046] Figure 6 It is another schematic diagram of a node display in the first embodiment of this specification.
[0047] Figure 7 It is a schematic structural diagram of the code processing device in the second embodiment of this specification. Detailed implementation manners
[0048] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of this specification. Obviously, the embodiments described in this specification are only partial embodiments of this application, rather than all embodiments. Based on the embodiments of this specification, all other embodiments obtained by those of ordinary skill in the art without making creative efforts shall fall within the scope of protection of this application.
[0049] In the prior art, after obtaining the code, how to obtain effective information and key information from the code is an important issue.
[0050] The first embodiment of this specification (hereinafter referred to as "Embodiment 1") provides a code processing method. The execution subject of Embodiment 1 can be a terminal (including but not limited to mobile phones, computers, pads, TVs) or a server or an operating system or an application or a code processing platform or a code processing system, etc. That is, the execution subject can be various and can be set, used or transformed according to needs. In addition, a third-party application can assist the execution subject to execute Embodiment 1. For example Figure 1 As shown, the code processing method in Embodiment 1 can be executed by a server, and a corresponding application can be installed on the terminal (held by the user). Data can be transmitted between the terminal or the application and the server, and data can be collected or input or output or page or information processing (to the user) through the terminal or the application, so as to assist the server to execute the code processing method in Embodiment 1.
[0051] As Figure 2 shown, the code processing method provided by Embodiment 1 includes:
[0052] S101: The execution subject obtains the target code and determines the execution logic line of the target code;
[0053] The execution subject of Embodiment 1 can obtain the source code. For example, obtain the source code publicly available on the network (open source code), and use the obtained source code as the target code.
[0054] The execution process of the program forms a structural data with a stack structure as the basis, where stack frames carry functions in a last-in, first-out manner. The entry class of a program defines related functions (i.e., the operations that the code wants to execute). When a request comes in and is implemented in the code, a stack is created, and the methods are abstracted into stack frames. When it comes to calling functions in other classes, the stack frames abstracted from the functions are directly pushed onto the top of the stack. When the stack frames in the stack are executed and popped out, it finally reaches the request exit. For example Figure 3 as shown
[0055] The running of the program is accompanied by the operations of pushing and popping the stack. For each class, each class contains method functions (hereinafter referred to as "functions"), and each function involves an execution logic, and functions can be nested again in the execution logic. At the same time, there are polymorphic distinctions in classes, so the entire processing logic of the code will form a divergent state with a tree-like structure, which also shows that the entire processing logic of the code is composed of a main line and branch lines. Among them, the main line can be called the execution logic line, and a single execution logic line can represent the processing flow of the target code for a single event.
[0056] As can be seen from the above, after obtaining the target code, the execution entity of the first embodiment can determine the execution logic line of the target code.
[0057] S103: (The execution entity) For any execution logic line, determine the root node of the execution logic line and the nodes at all levels subordinate to the root node; wherein, the root node or the nodes at all levels subordinate to the root node are used to represent the functions used in the target code;
[0058] Of course, the execution entity of the first embodiment can determine one or more execution logic lines of the target code.
[0059] For any execution logic line (of the target code), the execution entity of the first embodiment can determine the root node of the execution logic line and the nodes at all levels subordinate to the root node. Among them, the root node or the nodes at all levels subordinate to the root node are used to represent the functions used in the target code. Specifically, the root node (which can be used as the first-level node) or the nodes at all levels subordinate to the root node are used to represent the functions used in the execution logic line. For any node, the node is the node corresponding to the function it represents. For example, the functions used in the target code can be determined through keywords, and then the functions used in the target code are represented by nodes at all levels.
[0060] In the first embodiment, for any execution logic line, the root node of the execution logic line represents the topmost function used by the execution logic line, and the root node can be used as the first-level node; the function represented by the second-level node (i.e., the second-level node of the execution logic line) subordinate to the first-level node is the next-level nested function of the function represented by the first-level node; the function represented by the third-level node (i.e., the third-level node of the execution logic line) subordinate to the second-level node is the next-level nested function of the function represented by the second-level node; and so on. That is to say, starting from the second-level node of the execution logic line, the function represented by any level node of the execution logic line is the (next-level) nested function of the function represented by the upper-level node of this level node. Among them, the second-level node of the execution logic line and the nodes at all levels below the second-level node are the nodes at all levels subordinate to the root node of the execution logic line.
[0061] S105: (The execution entity) displays the root node or the nodes subordinate to the root node according to the operation data;
[0062] The execution entity in the first embodiment can obtain the (user's) operation data and display the root node or the (various levels of) nodes subordinate to the root node of (any execution logic line) according to the operation data.
[0063] Among them, displaying the root node or the (various levels of) nodes subordinate to the root node of (any execution logic line) according to the operation data may include: if a display instruction for any root node is obtained, then display the root node; if a display instruction for any level node subordinate to the root node (i.e., the subordinate node of the root node) is obtained, then display the level node subordinate to the root node.
[0064] For example, for any execution logic line, after determining the root node of the execution logic line and the nodes at all levels subordinate to the root node, the execution entity in the first embodiment can provide node display options, and the user can select which root node or the subordinate node of the root node of (any execution logic line) to display through the node display options. If the user selects a certain root node, then the execution entity in the first embodiment obtains a display instruction for the root node and displays the root node; if the user selects a certain level node subordinate to a certain root node, then the execution entity in the first embodiment obtains a display instruction for the level node subordinate to the root node and displays the level node (generally, the execution entity in the first embodiment will display all the upper-level nodes of this level node together, that is, display from the root node to this level node).
[0065] For any execution logic line, when displaying the first-level nodes or multi-level nodes of the execution logic, for two adjacent levels of nodes, if the function represented by a certain node at the lower level is the next-level nested function of the function represented by a certain node at the upper level, then these two nodes are connected by a line. For example, if the function represented by a certain node B at the (n + 1)-th (n ≥ 1) level is the next-level nested function of the function represented by a certain node A at the n-th level, then a line is connected between node A and node B. If the functions represented by multiple nodes at the (n + 1)-th (n ≥ 1) level are all the next-level nested functions of the function represented by a certain node at the n-th level, then this node at the n-th level is respectively connected by lines to these multiple nodes at the (n + 1)-th level. In this way, the execution entity in the first embodiment can display the nodes at all levels of the execution logic through a tree structure. For example Figure 4 as shown Figure 4 the target code in the example is recorded as an instance.
[0066] In the first embodiment, if the execution entity in the first embodiment obtains a selection instruction for any node, it can display the function represented by this node (equivalent to viewing details, and the function represented by this node is equivalent to the description of this node). For example, after displaying any node, the user can select this node by clicking the mouse or pressing the keyboard keys or touch screen operation, so that the execution entity in the first embodiment obtains the selection instruction for this node and displays the function represented by this node. Specifically, the framework code can be rendered through front-end technology to form a step of obtaining a specific function through a selection event, so that after the user selects a node, the function represented by the selected node is displayed. In addition, when the user selects a node, the execution entity in the first embodiment can display the lower-level nodes of the selected node for expanded display of the nodes.
[0067] In the first embodiment, if the execution entity in the first embodiment obtains a search instruction for a function, it can display the node corresponding to the searched function. For example, the execution entity in the first embodiment can provide search options, and the user can select the function to be searched through the search options, so that the execution entity in the first embodiment obtains the search instruction for the function to be searched and displays the node corresponding to the searched function. Among them, if a certain node is used to represent the function to be searched, the execution entity in the first embodiment can display the nodes at all levels of the execution logic line where this node is located, including but not limited to displaying the nodes at all levels of the execution logic line where this node is located through a tree structure or a list.
[0068] A specific example can be:
[0069] com.raydata.service.project.ProjectService#moveProject, which is the full path of a certain execution logic line from the root node to a certain level of node (such as the path of a tree structure, the same below). When the user searches for moveProject (even if it is a fuzzy search), the above full path will be searched and displayed in a list or tree structure (corresponding to "displaying the nodes at all levels of the execution logic line where the node is located"). Then, by clicking on each node of the full path, the function represented by the selected node can be displayed, so as to obtain the chain distribution as
[0070] com.raydata.controller.project.ProjectController#moveProject → com.raydata.service.project.ProjectService#moveProject → com.baomidou.mybatisplus.core.mapper.BaseMapper#update, which represents the execution process of this stack frame: ProjectService#moveProject in the controller ProjectController#moveProject calls ProjectService#moveProject in the business processing layer. After the business operation is completed, the relevant database BaseMapper#update is called to update the database. When I click on ProjectService#moveProject or its corresponding node, details, that is, description information, will pop up. The description information is (business data is updated by verifying the parameters entered in the data, then accumulating relevant partial data processing, and finally storing the result of the data processing in the database).
[0071] In the first embodiment, if the execution entity of the first embodiment obtains an editing instruction for any node, it may display the editing page of the node so that the function represented by the node can be edited (by the user). For example, the execution entity of the first embodiment may provide editing options, and the user can select the node to be edited through the editing options. Thus, the execution entity of the first embodiment obtains the editing instruction for the node to be edited and displays the editing page of the node to be edited. Alternatively, in the first embodiment, if the execution entity of the first embodiment obtains a note instruction for any node, it may display the note page of the node so that the function represented by the node can be noted (by the user). For example, the execution entity of the first embodiment may provide note options, and the user can select the node to be noted through the note options. Thus, the execution entity of the first embodiment obtains the note instruction for the node to be noted and displays the note page of the node to be noted. For any node, after the user notes the function represented by the node, if the user selects the node, the execution entity of the first embodiment may display the function represented by the node and the note for the function represented by the node.
[0072] In the first embodiment, if the execution entity of the first embodiment determines that one or more nodes are selected (by the user) and obtains a combination instruction for the selected nodes, the execution entity of the first embodiment forms code based on the functions represented by the selected nodes. For example, the execution entity of the first embodiment may provide combination options. After the user selects the nodes, the user can combine the selected nodes through the combination options. Thus, the execution entity of the first embodiment obtains the combination instruction for the selected nodes and forms code based on the functions represented by the selected nodes, including but not limited to splicing the functions represented by the selected nodes into code. If the selected nodes have a hierarchical order, for example, the selected nodes include a higher-level node and a lower-level node, the functions represented by the selected nodes can be spliced into code according to the rule that the higher the node level, the more forward the function represented by the node.
[0073] In the first embodiment, the usability of the code formed based on the functions represented by the selected nodes can be determined by testing the code through the execution entity of the first embodiment; or, voting can be conducted on various codes formed based on the functions represented by the selected nodes, and the optimal code can be determined from various codes formed based on the functions represented by the selected nodes.
[0074] The user can also perform a deletion operation on the node through the deletion option provided by the execution entity of the first embodiment, add a node through the addition option provided by the execution entity of the first embodiment, or add a connection between any two nodes through the connection addition option provided by the execution entity of the first embodiment.
[0075] Users can also save and export nodes at all levels through the execution entity of Embodiment 1, and can export them as a path diagram or a guide diagram (such as a tree structure diagram) of the nodes by means of rendering.
[0076] Users can also perform other operations through the execution entity of Embodiment 1, which is not limited in Embodiment 1.
[0077] The execution entity of Embodiment 1 can share the data corresponding to nodes at all levels to other devices, so that other devices can perform one or more of the operations of displaying, selecting, searching, editing, annotating, combining, deleting or adding new ones, adding connection lines, sharing or saving, and exporting on the nodes.
[0078] Users can perform one or more of the operations of displaying, selecting, searching, editing, annotating, combining, deleting or adding new ones, adding connection lines, sharing or saving, and exporting on the nodes through the execution entity of Embodiment 1, or can also send one or more of the display instruction, selection instruction, search instruction, editing instruction, annotation instruction, combination instruction, deletion instruction or addition instruction, adding connection line instruction, sharing instruction or saving instruction, export instruction to the execution entity of Embodiment 1 through other devices, so that the execution entity of Embodiment 1 can perform one or more of the corresponding display, selection, search, editing, annotation, combination, deletion or addition, adding connection line, sharing or saving, and exporting operations on the nodes.
[0079] In Embodiment 1, one or more of the operations of displaying, selecting, searching, editing, annotating, combining, deleting or adding new ones, adding connection lines, sharing or saving, and exporting on the nodes can be performed after the nodes are displayed, that is, after the nodes are displayed, users are allowed to perform one or more of the operations of displaying, selecting, searching, editing, annotating, combining, deleting or adding new ones, adding connection lines, sharing or saving, and exporting on the nodes. For example, after the nodes are displayed, search options, editing options, annotation options, combination options, deletion options or adding connection line options are provided or users are allowed to select nodes (and combine nodes).
[0080] Users can set the permissions for operating on nodes or functions at all levels through the execution entity of Embodiment 1, such as one or more of the display permission, selection right, search permission, editing permission, annotation permission, combination permission, deletion or addition permission, adding connection line permission, sharing permission or saving permission, export permission. Users with corresponding permissions can perform one or more of the corresponding display, selection, search, editing, annotation, combination, deletion or addition, adding connection line, sharing or saving, and exporting operations.
[0081] A specific embodiment of Embodiment 1 can be as follows: Taking spring as an example, the source code of each version of spring can be obtained, such as the code of the 5.1.x version of spring, as the target code. In Embodiment 1, the main body determines the full paths of each execution logic line from the root node to subordinate nodes at all levels, such as org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization;
[0082] Package: org.springframework.beans.factory.config;
[0083] Class name: BeanPostProcessor;
[0084] Method node name: postProcessBeforeInitialization;
[0085] When searching for BeanPostProcessor, the full path with the class name BeanPostProcessor within the version is displayed, and then it can be clicked and selected to be added to the system class list; alternatively, one or more of the following operations can be performed on each node of the full path: display, select, search, edit, annotate, combine, delete or add, add connections, share or save, export. For example Figure 5 or Figure 6 as shown, where Figure 5 and Figure 6 the stack frame nodes in represent the nodes of the execution logic line, org...Initialization also represents the nodes of the execution logic line, and "This is... some processing" represents an annotation. Figure 6 It can represent the search and spread of nodes, where the spread can be from three nodes to four nodes, and connections can be (manually) added between nodes, for example, establishing connections between nodes through arrows.
[0086] Another specific example could be: For the spring initialization process: org.springframework.context.support.AbstractApplicationContext#refresh, here is a business function that involves the execution of 11 stack frames. Each stack frame represents a method for handling related business, that is, it contains multiple sub-processes (sub-processes are equivalent to execution logic lines). By performing one or more of the following operations on nodes at all levels from the root node to subordinate nodes: display, selection, search, editing, annotation, combination, deletion or addition, adding connections, sharing or saving, and exporting, for example, depicting what each stack frame of each node needs to handle through graphs and arrows, the initial process of spring can be shown, facilitating the understanding of information such as functions or steps involved in the spring initialization process (the path from the root node to subordinate nodes at all levels is equivalent to the execution steps of code functions).
[0087] In addition, new nodes can be added via the mouse, keyboard, or touch. By searching and adding the entry class of the process to be studied in the target code, the corresponding description of the original source code, relevant additional information (global variables, static variables), and the description methods of classes, etc. will be popped up. According to the test process of the program, the process nodes involved (i.e., nodes at all levels) are managed.
[0088] In addition, select the node to be viewed, and display the information of the selected node (i.e., the function represented by the node), as well as the full path where the selected node is located, improving the flexibility of viewing the path and preventing interference from other paths.
[0089] In the first embodiment, by determining the execution logic lines of the code and then representing the relationships between functions under each execution logic line through nodes, the effective information and key information in the code can be effectively extracted (the effective information and key information include but are not limited to the code represented by each node), improving the determination effect and efficiency of the effective information and key information in the code, and being able to display the execution process of the effective information and key information in the code (the order of nodes at the node level represents the function nesting order and also represents the function execution order, so the display of the full path of the node is equivalent to displaying the execution process of the effective information and key information in the code), thereby improving the code processing effect and efficiency.
[0090] In the first embodiment, the user is allowed to perform multiple operations on the nodes, such as one or more of the operations of display, selection, search, editing, annotation, combination, deletion or addition, adding connections, sharing or saving, and exporting, thereby improving the functional diversity and flexibility of code processing.
[0091] In the first embodiment, code can be formed based on the function represented by the selected node, reducing the difficulty of code writing and improving the code writing efficiency.
[0092] In the first embodiment, testing or voting on the code formed based on the function represented by the selected node improves the usability of the formed code.
[0093] As Figure 7 shown, the second embodiment of this specification provides a code processing apparatus corresponding to the code processing method described in the first embodiment, including:
[0094] An extraction module 202, configured to obtain target code and determine the execution logic line of the target code;
[0095] A characterization module 204, configured to, for any execution logic line, determine the root node of the execution logic line and the nodes at all levels subordinate to the root node; wherein, the root node or the nodes at all levels subordinate to the root node are used to represent the functions used in the target code;
[0096] A display module 206, configured to display the root node or the nodes subordinate to the root node according to operation data.
[0097] Optionally, for any execution logic line, the root node of the execution logic line serves as the first-level node of the execution logic line;
[0098] Starting from the second-level node of the execution logic line, the function represented by any level node of the execution logic line is a nested function of the function represented by the upper-level node of this level node.
[0099] Optionally, displaying the root node or the nodes subordinate to the root node according to operation data includes:
[0100] If a display instruction for any root node is obtained, display the root node;
[0101] If a display instruction for any level node subordinate to the root node is obtained, display the level node subordinate to the root node.
[0102] Optionally, the display module 206 is configured to, if a selection instruction for any node is obtained, display the function represented by the node;
[0103] Or, the apparatus further includes: an editing module, configured to, if an editing instruction for any node is obtained, display an editing page of the node so as to edit the function represented by the node;
[0104] Or, the apparatus further includes: a note module, configured to, if a note instruction for any node is obtained, display a note page of the node so as to note the function corresponding to the node;
[0105] Or, the apparatus further includes: a search module, configured to, if a search instruction for a function is obtained, display the node corresponding to the searched function.
[0106] Optionally, the device further comprises: a permission module, configured to set permissions for operating on nodes at all levels.
[0107] Optionally, the device further comprises: a combination module, configured to, if it is determined that one or more nodes are selected and a combination instruction for the selected nodes is obtained, form code based on the functions represented by the selected nodes.
[0108] Optionally, the device further comprises: an evaluation module, configured to test the code formed based on the functions represented by the selected nodes;
[0109] or, vote on the codes formed based on the functions represented by the selected nodes of various types, and determine the optimal code from the codes formed based on the functions represented by the selected nodes of various types.
[0110] The third embodiment of this specification provides a code processing device, comprising:
[0111] At least one processor;
[0112] And,
[0113] A memory communicatively connected to the at least one processor;
[0114] Wherein,
[0115] The memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the code processing method described in the first embodiment.
[0116] The fourth embodiment of this specification provides a computer-readable storage medium, which stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the code processing method described in the first embodiment is implemented.
[0117] The above embodiments can be combined for use, and modules with the same name between different embodiments or within the same embodiment can be the same or different modules.
[0118] The above specifically describes certain embodiments of this specification, and other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily have to be performed in the specific order or continuous order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0119] Each embodiment in this specification is described in a progressive manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the apparatus, device, and non-volatile computer-readable storage medium, since they are basically similar to the method embodiments, the description is relatively simple, and for the relevant parts, reference can be made to the partial description of the method embodiments.
[0120] The apparatus, device, and non-volatile computer-readable storage medium provided in the embodiments of this specification correspond to the method. Therefore, the apparatus, device, and non-volatile computer storage medium also have beneficial technical effects similar to those of the corresponding method. Since the beneficial technical effects of the method have been described in detail above, the beneficial technical effects of the corresponding apparatus, device, and non-volatile computer storage medium will not be elaborated here.
[0121] In the 1990s, improvements to a technology could be clearly distinguished as either hardware improvements (e.g., improvements to the circuit structures of diodes, transistors, switches, etc.) or software improvements (improvements to method flows). However, with the development of technology, many method flow improvements today can be regarded as direct improvements to hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement to a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (e.g., a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user programming the device. Designers can program themselves to "integrate" a digital system onto a single PLD, without having to ask a chip manufacturer to design and fabricate a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly implemented using "logic compiler" software, which is similar to the software compiler used in program development and writing. The original code before compilation also has to be written in a specific programming language, which is called a hardware description language (HDL), and there is not just one type of HDL, but many types, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones currently are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also be aware that by simply performing a little logical programming on the method flow using the above-mentioned several hardware description languages and programming it into an integrated circuit, it is easy to obtain the hardware circuit that implements the logical method flow.
[0122] The controller can be implemented in any suitable manner. For example, the controller can take the form of, for example, a microprocessor or a processor and a computer-readable medium storing computer-readable program code (such as software or firmware) executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of the controller include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program code, it is entirely possible to logically program the method steps to enable the controller to be implemented in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, and embedded microcontrollers, etc., to achieve the same function. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be regarded as the structures within the hardware component. Or even, the devices for implementing various functions can be regarded as either software modules for implementing the method or the structures within the hardware component.
[0123] The systems, devices, modules, or units illustrated in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.
[0124] For the convenience of description, when describing the above devices, they are described separately as various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in one or more software and / or hardware.
[0125] Those skilled in the art should understand that the embodiments of this specification can be provided as a method, a system, or a computer program product. Therefore, the embodiments of this specification can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program code.
[0126] This specification is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the specification. It should be understood that each flow and / or block in the flowchart and / or block diagram, and combinations of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, such that the instructions executed by the processor of the computer or other programmable data processing device generate means for implementing the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or means for implementing the functions specified in one or more of the blocks.
[0127] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including instruction means that implement the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or means for implementing the functions specified in one or more of the blocks.
[0128] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more of the flows Figure 1 one or more of the flows and / or blocks Figure 1 or means for implementing the functions specified in one or more of the blocks.
[0129] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.
[0130] The memory may include non-permanent memory in the form of computer-readable media, random access memory (RAM), and / or non-volatile memory such as read-only memory (ROM) or flash memory (flash RAM). The memory is an example of computer-readable media.
[0131] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0132] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0133] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0134] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0135] The above description is only for the embodiments of this specification and is not intended to limit this application. For those skilled in the art, various changes and modifications can be made to this application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included within the scope of the claims of this application.
Claims
1. A code processing method, comprising: Obtaining a target code and determining an execution logic line of the target code; For any execution logic line, determining a root node of the execution logic line and each level of nodes subordinate to the root node; wherein, the root node or each level of nodes subordinate to the root node is used to represent a function used in the target code; Displaying the root node or the nodes subordinate to the root node according to operation data; If it is determined that multiple nodes are selected and a combination instruction for the selected nodes is obtained, splicing the functions represented by the selected nodes into code, where the combination instruction is generated by combining the selected nodes based on combination options provided by an execution subject, and the higher the level of the node in the level order, the earlier the function represented by the node in the code; Voting on the codes formed by the functions represented by the selected nodes, and determining an optimal code from the codes formed by the functions represented by the selected nodes.
2. The method according to claim 1, for any execution logic line, the root node of the execution logic line serves as the first-level node of the execution logic line; Starting from the second-level node of the execution logic line, the function represented by any level of node of the execution logic line is a nested function of the function represented by the upper-level node of this level of node.
3. The method according to claim 1, displaying the root node or the nodes subordinate to the root node according to operation data includes: If a display instruction for any root node is obtained, displaying the root node; If a display instruction for any level of node subordinate to the root node is obtained, displaying the level of node subordinate to the root node.
4. The method according to claim 1, the method further comprising: If a selection instruction for any node is obtained, displaying the function represented by the node; Or, The method further includes: if an edit instruction for any node is obtained, displaying an edit page of the node to edit the function represented by the node; Or, The method further includes: if a comment instruction for any node is obtained, displaying a comment page of the node to comment on the function corresponding to the node; Or, The method further includes: if a search instruction for a function is obtained, displaying the node corresponding to the searched function.
5. The method according to claim 1, wherein the method further comprises: Setting permissions for operating on each level of nodes.
6. The method according to claim 1, the method further includes: Testing the code formed by the functions represented by the selected nodes.
7. A code processing device, comprising: An extraction module for obtaining a target code and determining an execution logic line of the target code; A characterization module for, for any execution logic line, determining a root node of the execution logic line and each level of nodes subordinate to the root node; wherein, the root node or each level of nodes subordinate to the root node is used to represent a function used in the target code; A display module for displaying the root node or the nodes subordinate to the root node according to operation data; A combination module, which is configured to, if it is determined that multiple nodes are selected and a combination instruction for the selected nodes is obtained, splice the functions represented by the selected nodes into code. The combination instruction is generated by combining the selected nodes based on combination options provided by an execution entity. The higher the level of a node in the level order, the earlier the function represented by the node appears in the code. An evaluation module, which is configured to vote on various codes formed by the functions represented by the selected nodes, and determine an optimal code from the various codes formed by the functions represented by the selected nodes.
8. The apparatus according to claim 7, for any execution logic line, the root node of the execution logic line serves as the first-level node of the execution logic line; Starting from the second-level node of the execution logic line, the function represented by any level node of the execution logic line is a nested function of the function represented by the previous-level node of this level node.
9. The apparatus according to claim 7, displaying the root node or a node subordinate to the root node according to operation data includes: If a display instruction for any root node is obtained, display the root node; If a display instruction for any level node subordinate to the root node is obtained, display the level node subordinate to the root node.
10. The apparatus according to claim 7, the display module is configured to: if a selection instruction for any node is obtained, display the function represented by the node; Or, The apparatus further includes: an editing module, which is configured to, if an editing instruction for any node is obtained, display an editing page of the node to facilitate editing of the function represented by the node; Or, The apparatus further includes: a note module, which is configured to, if a note instruction for any node is obtained, display a note page of the node to facilitate adding a note to the function corresponding to the node; Or, The apparatus further includes: a search module, which is configured to, if a search instruction for a function is obtained, display the node corresponding to the searched function.
11. The device according to claim 7, wherein the device further comprises: A permission module, which is configured to set permissions for operating on nodes at all levels.
12. The apparatus according to claim 7, the evaluation module is alternatively configured to: test the code formed by the functions represented by the selected nodes.
13. A code processing device, comprising: At least one processor; And, A memory communicatively connected to the at least one processor; Wherein, The memory stores instructions executable by the at least one processor. The instructions are executed by the at least one processor, enabling the at least one processor to execute the code processing method according to any one of claims 1 to 6.
14. A computer-readable storage medium, the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the code processing method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Graph for navigating application code
CN105229617A
Script program edition device and realization method thereof
CN105739983A
Method and apparatus for processing code
CN108874382A
Code generation method and device, electronic equipment and storage medium
CN113138796A