Function processing method and device, electronic equipment and storage medium
By repeatedly reading and executing functions in the node graph, the problem of function call stack overflow in the visual programming environment is solved, the safety of the function call stack is achieved, and program crashes are avoided.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2026-03-13
AI Technical Summary
In a visual programming environment, function calls in a node graph can lead to a function call stack overflow, causing the program to crash.
By iteratively reading functions from the node graph, executing those functions, and pushing their calls onto the stack until the stack is empty, the recursive process of depth-first traversal is simulated, thus avoiding stack overflow.
It solves the problem of function call stack overflow, while retaining the loop-forming function in visual programming to prevent program crashes.
Smart Images

Figure CN121658766A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to computer technology, and more particularly to a function processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] In a visual programming environment, the logical flow of a program can be represented using a node graph. A node graph can include multiple nodes, which can be connected by edges. Nodes represent functions or operations, while edges represent data flow or control flow.
[0003] When nodes in the control flow form a loop, the control flow may get stuck in an infinite loop due to recursive execution. For example, executing in the order of node A, node B, node C, and back to node A, with each node calling the next, can lead to a loop. In this process, when one function calls another, the latter's execution occupies a new position on the function call stack. As recursive functions are continuously added to the function call stack, it can cause the stack to overflow. Summary of the Invention
[0004] This disclosure provides a function processing method, apparatus, electronic device, and storage medium that can solve the problem of function call stack overflow during node graph execution in a visual programming environment.
[0005] In a first aspect, embodiments of this disclosure provide a function processing method, including:
[0006] The first function is retrieved from the first stack and executed.
[0007] During the execution of the first function, the second function to be executed called by the first function is determined. The first function and the second function are functions corresponding to different nodes in the node graph. The node graph is a graph composed of multiple nodes obtained by programming through a visual programming method.
[0008] Write the second function onto the first stack;
[0009] After the first function has been executed, the second function is retrieved from the first stack;
[0010] The second function is used as the first function, and execution of the first function continues until the first stack is empty.
[0011] Secondly, embodiments of this disclosure also provide a function processing apparatus, including:
[0012] The execution module is used to retrieve and execute the first function from the first stack;
[0013] The determination module is used to determine the second function to be executed called by the first function during the execution of the first function. The first function and the second function are functions corresponding to different nodes in the node graph, and the node graph is a graph composed of multiple nodes obtained by programming through a visual programming method.
[0014] The writing module is used to write the second function into the first stack;
[0015] The acquisition module is used to acquire the second function from the first stack after the first function has been executed;
[0016] The execution module is returned to use the second function as the first function, and then returns to continue executing the first function until the first stack is empty.
[0017] Thirdly, embodiments of this disclosure also provide an electronic device, the electronic device comprising:
[0018] One or more processing devices;
[0019] Storage device for storing one or more programs.
[0020] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the function processing method provided in the embodiments of this disclosure.
[0021] Fourthly, embodiments of this disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the function processing method provided in embodiments of this disclosure.
[0022] The technical solution of this disclosure, when executing functions in a node graph, involves cyclically reading from a first stack. Each time a function is read, it is executed, and any functions called by that function are pushed onto the stack. After executing a function, new functions are read from the first stack for execution, continuing until the stack is empty. By cyclically reading and executing functions in the first stack, with each function's call being pushed onto the stack and then executed, and by continuously performing push and pop operations until the stack is empty, the problem of function call stack overflow during node graph execution in a visual programming environment can be solved. Attached Figure Description
[0023] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0024] Figure 1 This is a flowchart illustrating a function processing method provided in an embodiment of this disclosure;
[0025] Figure 2 This is a flowchart illustrating another function processing method provided in an embodiment of this disclosure;
[0026] Figure 3 This is a schematic diagram of a node diagram for visual programming provided in an embodiment of this disclosure;
[0027] Figure 4 This is a schematic diagram simulating the push and pop operations of a node graph processed by a function processing method according to an embodiment of this disclosure;
[0028] Figure 5 This is a schematic diagram of an infinite loop detection provided in an embodiment of this disclosure;
[0029] Figure 6 This is a schematic diagram of the structure of a function processing device provided in an embodiment of this disclosure;
[0030] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0031] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0032] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0033] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0034] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0035] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0036] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0037] Before describing the method flow of the embodiments of this disclosure, the visual programming and node graphs involved in the embodiments of this disclosure will be described first:
[0038] Visual programming can be understood as a programming paradigm that allows programs to be created through graphical interfaces and drag-and-drop operations. Visual programming can be applied in various scenarios, such as controlling objects in game scenes to achieve interaction in game development, designing special effects packages to meet specific needs in software development, and analyzing data and visualizing the results in data analysis. A special effects package can be a collection of special effects resources, such as a set of visual elements and effects specifically designed for video production, game development, and multimedia design.
[0039] In practical applications, node graphs can be generated through visual programming. A node graph is a graphical representation of program logic and flow. A node graph can include multiple nodes, which may have different types and purposes. Each node represents a function, operation, or processing step that performs a specific function. Different nodes in a node graph can be connected by lines or edges, which represent the transfer of data and the direction of control flow. Control flow can be the flow that guides the program's execution order, allowing the program to execute according to a predetermined logical sequence.
[0040] For example, a node graph can be generated through dragging and dropping nodes and connecting different nodes in the graphical interface of a visual programming tool. The node graph can be converted into an executable script, which is executed in the order indicated by the control flow in the node graph. The visual programming tool can be any tool used to implement visual programming, and is not limited here.
[0041] Figure 1This is a flowchart illustrating a function processing method provided in an embodiment of this disclosure. This embodiment is applicable to node graph execution in a visual programming environment. The method can be executed by a function processing device, which can be implemented in software and / or hardware and integrated into an electronic device. Optionally, the electronic device can be a mobile terminal or a PC, etc. Figure 1 As shown, the method includes:
[0042] S110. Retrieve and execute the first function from the first stack.
[0043] The first stack can be the stack used during the execution of the node graph according to the control flow. The first stack can be used to store functions to be executed. The first function can be the function corresponding to a node in the node graph, such as the function corresponding to the starting node of the control flow, that is, the node where the control flow begins to execute. The role of the first function is not limited.
[0044] In this embodiment, the execution of the control flow in the node graph can be understood as a recursive process performing a depth-first traversal. The push and pop process of the first stack can be used to simulate the depth-first traversal process, changing the recursive process into a loop execution process. The function corresponding to the starting node of the control flow, i.e., the first function, is first written into the first stack. The first stack is then read in a loop, and the top element of the first stack, i.e., the first function, is obtained and executed.
[0045] S120. During the execution of the first function, determine the second function to be executed called by the first function. The first function and the second function are functions corresponding to different nodes in the node graph. The node graph is a graph composed of multiple nodes obtained by programming through visual programming.
[0046] The second function can be a function to be executed called by the first function. There can be one or more second functions, which is not limited here. In the node graph, the first function and the second function correspond to different nodes, and when there are multiple second functions, different second functions correspond to different nodes.
[0047] During the execution of the first function, the second function called by the first function can be determined by the nodes in the node graph that are connected to the node corresponding to the first function. For example, if the control flow instruction flows from the node corresponding to the first function into a certain node, then the function corresponding to the node into which the control flow flows is the second function, indicating that the second function needs to be called by the first function.
[0048] It should be noted that when there are multiple second functions, different calls to the second functions can be executed through different queues within the node corresponding to the first function. The order in which the different second functions are called is determined by the order in which the queues are executed. For example, queue 1 corresponds to calling second function 1, and queue 2 corresponds to calling second function 2. Queue 1 is executed first, followed by queue 2; that is, second function 1 is called first, followed by second function 2.
[0049] S130. Write the second function into the first stack.
[0050] During the execution of the first function, if it is determined that the second function to be executed is called by the first function, the second function needs to be written onto the first stack so that the second function is not executed during the execution of the first function, and the execution of the second function is implemented later.
[0051] If there is only one second function, it can be directly written into the first stack. At this time, the written second function is in the first stack and awaits subsequent execution.
[0052] When there are at least two second functions, multiple second functions can be written into the first stack in reverse order of the order in which they were called by the first function. That is, the second function called later is pushed onto the stack first, so that the second function called by the first function first is at the top of the first stack and awaits subsequent execution.
[0053] S140. After the first function has been executed, retrieve the second function from the first stack.
[0054] In this step, after executing the first function, it is necessary to execute the second function, which can be done by obtaining the second function located at the top of the first stack.
[0055] It should be noted that when there are multiple second functions, we only need to get the second function at the top of the first stack. The second functions in the first stack other than the one at the top can be retained and executed later according to the execution order of the control flow.
[0056] S150. Use the second function as the first function, and return to continue executing the first function until the first stack is empty.
[0057] In this step, the second function obtained in S140 is used as the new first function, and execution of the first function continues until the first stack is empty. This achieves a loop reading of the first stack. Each time the first function is executed, the second function to be executed called by the first function is determined, and the second function is written into the first stack. After the first function is executed, the second function is retrieved from the first stack and used as the new first function to continue execution until the first stack is empty, at which point the control flow in the node graph is complete.
[0058] The technical solution of this disclosure, when executing functions in a node graph, involves cyclically reading from a first stack. Each time a function is read, it is executed, and any functions called by that function are pushed onto the stack. After executing a function, new functions are read from the first stack for execution, continuing until the stack is empty. By cyclically reading and executing functions in the first stack, with each function's call being pushed onto the stack and then executed, and by continuously performing push and pop operations until the stack is empty, the problem of function call stack overflow during node graph execution in a visual programming environment can be solved.
[0059] Based on the above embodiments, modified embodiments of the above embodiments are proposed. It should be noted that, in order to keep the description brief, only the differences from the above embodiments are described in the modified embodiments.
[0060] Figure 2 This is a flowchart illustrating another function processing method provided in this embodiment. This embodiment refines the execution of the first function and the writing of the second function into the first stack, based on the above embodiments. Figure 2 As shown, the method includes:
[0061] S210. Obtain the first function from the first stack.
[0062] S220. Determine whether the input edge of the node corresponding to the first function is in an infinite loop; if so, determine whether the execution condition is met; if the execution condition is met, execute the first function.
[0063] In this context, the input edge of the node corresponding to the first function can be understood as the edge that inputs to the node corresponding to the first function, i.e., the line in the node graph that connects to the input port of the node corresponding to the first function. In an infinite loop, the input edge can be understood as being executed repeatedly without automatically exiting the loop.
[0064] In this step, the connection relationships between the nodes in the node graph can be used to determine whether the input edge of the node corresponding to the first function is in an infinite loop. For example, if the connection relationships indicate that the input edge of the node corresponding to the first function forms a closed loop with other edges in the node graph, it means that the input edge of the node corresponding to the first function is in an infinite loop. The connection relationships between the nodes in the node graph can indicate how the nodes are connected.
[0065] If the input edge of the node corresponding to the first function is in an infinite loop, then determine whether the execution condition is met. If the execution condition is met, execute the first function; otherwise, exit the loop. The execution condition can be any condition that allows the first function to be executed.
[0066] In one embodiment, the execution condition includes the current loop count being less than a set threshold.
[0067] The current loop count can be the number of times the input edges of the node corresponding to the current first function have been traversed. The threshold can be set according to actual needs, such as the upper limit of the number of times the input edges of the node corresponding to the first function have been traversed, which is not limited here.
[0068] In one embodiment, determining whether the input edge of the node corresponding to the first function is in an infinite loop includes:
[0069] Obtain the indication information associated with the first function in the first stack;
[0070] The indication information is used to determine whether the input edge of the node corresponding to the first function is in an infinite loop.
[0071] The indication information associated with the first function can be information related to the node corresponding to the first function. This may include, but is not limited to, an identifier that uniquely corresponds to the input edge of the node corresponding to the first function; information indicating which node the second function to be called by the first function corresponds to; and information indicating whether the input edge of the node corresponding to the first function is in an infinite loop, such as using a value of 1 to indicate that the input edge is in an infinite loop, and using a value of 0 to indicate that the input edge is not in an infinite loop.
[0072] In this embodiment of the disclosure, when the first function is written to the first stack, the indication information associated with the first function can also be written to the first stack. Subsequently, the indication information associated with the first function in the first stack can be obtained, and the input edge of the node corresponding to the first function can be determined through the obtained indication information to determine whether it is in an infinite loop.
[0073] S230. During the execution of the first function, determine the second function to be executed that is called by the first function.
[0074] S240. When there are at least two second functions, write each second function into the first stack in reverse order of the order in which it was called by the first function.
[0075] In this step, multiple second functions are written into the first stack in reverse order of their call order to the first function. That is, the second function called later is pushed onto the stack first, so that the second function called first by the first function is at the top of the first stack and awaits subsequent execution.
[0076] In one embodiment, when there are at least two second functions, writing each of the second functions into the first stack in reverse order of the order in which they were called by the first functions includes:
[0077] When there are at least two second functions, each second function is written into the second stack in the order it was called by the first function.
[0078] Write the functions in the second stack into the first stack in order from top to bottom.
[0079] Due to the Last-In-First-Out (LIFO) property of stacks, an additional stack, the second stack, is needed to achieve a First-In-First-Out (FIFO) order. Multiple second functions are written to the second stack in the order they were called by the first functions. The order of these second functions from bottom to top in the second stack represents the order in which they were called by the first functions. Conversely, functions from the second stack are written to the first stack in the order from top to bottom. The order of these second functions from top to bottom in the first stack also represents the order in which they were called by the first functions.
[0080] S250. After the first function has been executed, the second function is retrieved from the first stack.
[0081] S260. The second function is used as the first function, and the execution of the first function continues until the first stack is empty.
[0082] The technical solution of this disclosure simulates a depth-first traversal recursive process by using the push and pop processes of a first stack, combined with the assistance of a second stack. It optimizes the script export logic of the node graph by replacing recursion with a loop. After switching to loop execution, loop connections may become infinite loops, but the process will not crash. By executing the first function when the execution condition is met and exiting the loop when it is not, the situation of continuous execution without response can be avoided. That is, this solution solves the problem of function call stack overflow while retaining the functionality of connecting lines into loops in visual programming.
[0083] In one embodiment, writing the second function into the first stack includes:
[0084] By analyzing the connection relationships between the nodes in the node graph, it can be determined whether the input edge of the node corresponding to the second function is in an infinite loop.
[0085] If so, the second function and the indication information are written to the first stack, wherein the indication information indicates that the input edge of the node corresponding to the second function is in an infinite loop.
[0086] By analyzing the connections between nodes in the node graph, it is determined whether the input edge of the node corresponding to the second function is in an infinite loop. If the connections indicate that the input edge of the node corresponding to the second function forms a closed loop with other edges in the node graph, it indicates that the input edge of the node corresponding to the second function is in an infinite loop. If the input edge of the node corresponding to the second function is in an infinite loop, the second function and the indication information indicating that the input edge of the node corresponding to the second function is in an infinite loop are written into the first stack, so that the input edge of the node corresponding to the second function can be determined to be in an infinite loop based on the indication information later.
[0087] The following is an exemplary description of embodiments of this disclosure:
[0088] Figure 3 This is a schematic diagram of a node diagram for visual programming provided in an embodiment of this disclosure. For example... Figure 3 As shown, the execution flow of its control flow is a depth-first recursive process, and its execution order should be: node A → node B → node C → node E → node F → node G → node D → node G.
[0089] Figure 4 This is a schematic diagram simulating the push and pop operations of a node graph using a function processing method provided in an embodiment of this disclosure. Figure 4 This can be understood as the function processing method provided in the embodiments of this disclosure processing... Figure 3 The node diagram shown is a schematic representation of the push and pop operations in the first stack. Green represents nodes previously pushed onto the first stack and retained there, while orange represents nodes newly added to the first stack during function execution. The specific steps include the following:
[0090] (1) Get and execute the first function from the top of the first stack. At this time, the first function can be the function corresponding to node A. During the execution of the first function, determine the second function to be executed called by the first function. At this time, the second function can be the function corresponding to node B. Write the second function into the first stack. After the first function is executed, get the second function from the top of the first stack.
[0091] (2) Treat the second function as the first function and return to continue executing the first function. At this time, the first function can be the function corresponding to node B. During the execution of the first function, determine the second function, namely the function corresponding to node C and the function corresponding to node D. Write each second function into the first stack in reverse order of the order in which it was called by the first function, namely the function corresponding to node D and the function corresponding to node C. After the first function is executed, retrieve the second function from the top of the first stack, namely the function corresponding to node C.
[0092] (3) Treat the second function as the first function and return to continue executing the first function. At this time, the first function can be the function corresponding to node C. During the execution of the first function, determine the second function, namely the function corresponding to node E and the function corresponding to node F. Write each second function into the first stack in reverse order of the order in which it was called by the first function, namely the function corresponding to node F and the function corresponding to node E. After the first function is executed, retrieve the second function from the top of the first stack, namely the function corresponding to node E.
[0093] (4) Take the second function as the first function and return to continue executing the first function. At this time, the first function can be the function corresponding to node E. During the execution of the first function, determine the second function, that is, the function corresponding to node F. After the first function is executed, retrieve the second function from the top of the first stack, that is, the function corresponding to node F.
[0094] (5) Take the second function as the first function and return to continue executing the first function. At this time, the first function can be the function corresponding to node F. During the execution of the first function, determine the second function, that is, the function corresponding to node G. Write the second function into the first stack. After the first function is executed, retrieve the second function from the top of the first stack.
[0095] (6) Take the second function as the first function and return to continue executing the first function. At this time, the first function can be the function corresponding to node G. During the execution of the first function, determine the second function, that is, the function corresponding to node D. After the first function is executed, retrieve the second function from the top of the first stack, that is, the function corresponding to node D.
[0096] (7) Take the second function as the first function and return to continue executing the first function. At this time, the first function can be the function corresponding to node D. During the execution of the first function, determine the second function, that is, the function corresponding to node G. Write the second function into the first stack. After the first function is executed, retrieve the second function from the top of the first stack.
[0097] (8) Treat the second function as the first function and return to continue executing the first function. At this time, the first function can be the function corresponding to node G. During the execution of the first function, if it is determined that there is no second function corresponding to the first function, it is not pushed onto the stack. After the first function is executed, if it is determined that the first stack is empty, the process ends.
[0098] Since a stack is inherently Last-In-First-Out (LIFO), an additional stack, namely a second stack, is needed to achieve FIFO. For example, in step (2) above, each second function is written into the first stack in reverse order of being called by the first function, i.e., the function corresponding to node D and the function corresponding to node C. Specifically, this can be achieved by writing each second function into the second stack in the order of being called by the first function, i.e., the function corresponding to node C and the function corresponding to node D; and writing the functions in the second stack into the first stack in order from top to bottom.
[0099] During the stack push and pop simulation in the first stack described above, a dead loop check can be performed before each execution of the first function. Figure 5 This is a schematic diagram of an infinite loop detection provided in an embodiment of this disclosure, as shown below. Figure 5 As shown, it includes the following steps:
[0100] The first function is retrieved from the first stack; it is then checked whether the number of times the input edges have been traversed exceeds the upper limit, i.e., whether the current loop count of the input edges corresponding to the node of the first function exceeds the set threshold. If so, the loop is exited; otherwise, the first function is executed. This infinite loop detection limits the number of loops and prevents the loop from running indefinitely without responding.
[0101] Figure 6 This is a schematic diagram of the structure of a function processing device provided in an embodiment of this disclosure, as shown below. Figure 6 As shown, the device includes: an execution module 610, a determination module 620, a writing module 630, an acquisition module 640, and a return execution module 650.
[0102] Execution module 610 is used to retrieve and execute the first function from the first stack;
[0103] The determination module 620 is used to determine the second function to be executed called by the first function during the execution of the first function. The first function and the second function are functions corresponding to different nodes in the node graph, and the node graph is a graph composed of multiple nodes obtained by programming through a visual programming method.
[0104] The writing module 630 is used to write the second function into the first stack;
[0105] The acquisition module 640 is used to acquire the second function from the first stack after the first function has been executed;
[0106] Return to execution module 650, which is used to take the second function as the first function and return to continue executing the first function until the first stack is empty.
[0107] The technical solution provided in this disclosure involves an execution module retrieving and executing a first function from a first stack; a determination module determining a second function to be executed called by the first function during its execution, wherein the first and second functions are functions corresponding to different nodes in a node graph, which is a graph composed of multiple nodes obtained through visual programming; a writing module writing the second function into the first stack; an acquisition module retrieving the second function from the first stack after the first function has been executed; and a return execution module using the second function as the first function and returning to continue executing the first function until the first stack is empty. By repeatedly reading and executing functions in the first stack, with each function called by a read function placed in the first stack for later reading and execution, and continuously performing push and pop operations until the stack is empty, the problem of function call stack overflow during node graph execution in a visual programming environment can be solved.
[0108] In one embodiment, the writing module 630 is specifically used for:
[0109] When there are at least two second functions, each second function is written into the first stack in reverse order of the order in which it was called by the first function.
[0110] In one embodiment, the writing module 630 is specifically used for:
[0111] When there are at least two second functions, each second function is written into the second stack in the order it was called by the first function.
[0112] Write the functions in the second stack into the first stack in order from top to bottom.
[0113] In one embodiment, the execution module 610 is specifically used for:
[0114] Determine whether the input edge of the node corresponding to the first function is in an infinite loop;
[0115] If so, determine whether the execution conditions are met;
[0116] If the execution conditions are met, the first function will be executed.
[0117] In one embodiment, the execution condition includes the current loop count being less than a set threshold.
[0118] In one embodiment, the execution module 610 is specifically used for:
[0119] Obtain the indication information associated with the first function in the first stack;
[0120] The indication information is used to determine whether the input edge of the node corresponding to the first function is in an infinite loop.
[0121] In one embodiment, the writing module 630 is specifically used for:
[0122] By analyzing the connection relationships between the nodes in the node graph, it can be determined whether the input edge of the node corresponding to the second function is in an infinite loop.
[0123] If so, the second function and the indication information are written to the first stack, wherein the indication information indicates that the input edge of the node corresponding to the second function is in an infinite loop.
[0124] The function processing apparatus provided in this disclosure can execute the function processing method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0125] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this disclosure.
[0126] Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Refer to the following... Figure 7 It illustrates an electronic device suitable for implementing embodiments of the present disclosure (e.g., Figure 7 A structural diagram of the terminal device or server in the 500.
[0127] An electronic device provided in this disclosure includes:
[0128] One or more processing devices;
[0129] Storage device for storing one or more programs.
[0130] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the function processing methods provided in any embodiment of this disclosure.
[0131] The terminal devices in this disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), and in-vehicle terminals (such as in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 7 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0132] like Figure 7 As shown, electronic device 500 may include a processing unit (e.g., central processing unit, graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 502 or a program loaded from storage device 508 into random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. An edit / output (I / O) interface 505 is also connected to bus 504.
[0133] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 7 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0134] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.
[0135] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0136] The electronic device provided in this embodiment and the function processing method provided in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0137] This disclosure provides a computer storage medium storing a computer program that, when executed by a processor, implements the function processing method provided in the above embodiments.
[0138] It should be noted that the computer-readable medium described above in this disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination thereof.
[0139] The computer storage medium may be a storage medium for computer-executable instructions, which, when executed by a computer processor, are used to perform the methods provided in this disclosure.
[0140] Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0141] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0142] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0143] The aforementioned computer-readable medium carries one or more programs. When the electronic device executes the aforementioned one or more programs, the electronic device causes the following: it retrieves and executes a first function from a first stack; during the execution of the first function, it determines a second function to be executed that is called by the first function, wherein the first function and the second function are functions corresponding to different nodes in a node graph, and the node graph is a graph composed of multiple nodes obtained through visual programming; it writes the second function into the first stack; after the first function has been executed, it retrieves the second function from the first stack; it uses the second function as the first function and returns to continue executing the first function until the first stack is empty.
[0144] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0145] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0146] The modules or units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the modules or units do not necessarily limit the specific unit itself.
[0147] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0148] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0149] According to one or more embodiments of this disclosure, Example 1 provides a function processing method, including:
[0150] The first function is retrieved from the first stack and executed.
[0151] During the execution of the first function, the second function to be executed called by the first function is determined. The first function and the second function are functions corresponding to different nodes in the node graph. The node graph is a graph composed of multiple nodes obtained by programming through a visual programming method.
[0152] Write the second function onto the first stack;
[0153] After the first function has been executed, the second function is retrieved from the first stack;
[0154] The second function is used as the first function, and execution of the first function continues until the first stack is empty.
[0155] According to one or more embodiments of this disclosure, Example 2 describes the method described in Example 1.
[0156] The step of writing the second function into the first stack includes:
[0157] When there are at least two second functions, each second function is written into the first stack in reverse order of the order in which it was called by the first function.
[0158] According to one or more embodiments of this disclosure, Example 3 describes the method described in Example 2.
[0159] When there are at least two second functions, writing each second function into the first stack in reverse order of its call order to the first function includes:
[0160] When there are at least two second functions, each second function is written into the second stack in the order it was called by the first function.
[0161] Write the functions in the second stack into the first stack in order from top to bottom.
[0162] According to one or more embodiments of this disclosure, Example 4 describes the method described in Example 1.
[0163] The execution of the first function includes:
[0164] Determine whether the input edge of the node corresponding to the first function is in an infinite loop;
[0165] If so, determine whether the execution conditions are met;
[0166] If the execution conditions are met, the first function will be executed.
[0167] According to one or more embodiments of this disclosure, Example 5 describes the method described in Example 4.
[0168] The execution conditions include the current loop count being less than a set threshold.
[0169] According to one or more embodiments of this disclosure, Example 6 describes the method described in Example 4.
[0170] Determining whether the input edge of the node corresponding to the first function is in an infinite loop includes:
[0171] Obtain the indication information associated with the first function in the first stack;
[0172] The indication information is used to determine whether the input edge of the node corresponding to the first function is in an infinite loop.
[0173] According to one or more embodiments of this disclosure, Example 7 describes the method described in Example 1.
[0174] The step of writing the second function into the first stack includes:
[0175] By analyzing the connection relationships between the nodes in the node graph, it can be determined whether the input edge of the node corresponding to the second function is in an infinite loop.
[0176] If so, the second function and the indication information are written to the first stack, wherein the indication information indicates that the input edge of the node corresponding to the second function is in an infinite loop.
[0177] According to one or more embodiments of this disclosure, Example 8 provides a function processing apparatus, including:
[0178] The execution module is used to retrieve and execute the first function from the first stack;
[0179] The determination module is used to determine the second function to be executed called by the first function during the execution of the first function. The first function and the second function are functions corresponding to different nodes in the node graph, and the node graph is a graph composed of multiple nodes obtained by programming through a visual programming method.
[0180] The writing module is used to write the second function into the first stack;
[0181] The acquisition module is used to acquire the second function from the first stack after the first function has been executed;
[0182] The execution module is returned to use the second function as the first function, and then returns to continue executing the first function until the first stack is empty.
[0183] According to one or more embodiments of this disclosure, Example 9 provides an electronic device, the electronic device comprising:
[0184] One or more processing devices;
[0185] Storage device for storing one or more programs.
[0186] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the function processing method as described in any of Examples 1-7.
[0187] According to one or more embodiments of the present disclosure, Example 10 provides a storage medium containing computer-executable instructions that, when executed by a computer processor, are used to perform a function processing method as described in any of Examples 1-7.
[0188] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0189] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0190] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A function processing method, characterized in that, include: The first function is retrieved from the first stack and executed. During the execution of the first function, the second function to be executed called by the first function is determined. The first function and the second function are functions corresponding to different nodes in the node graph. The node graph is a graph composed of multiple nodes obtained by programming through a visual programming method. Write the second function onto the first stack; After the first function has been executed, the second function is retrieved from the first stack; The second function is used as the first function, and execution of the first function continues until the first stack is empty.
2. The method according to claim 1, characterized in that, The step of writing the second function into the first stack includes: When there are at least two second functions, each second function is written into the first stack in reverse order of the order in which it was called by the first function.
3. The method according to claim 2, characterized in that, When there are at least two second functions, writing each second function into the first stack in reverse order of its call order to the first function includes: When there are at least two second functions, each second function is written into the second stack in the order it was called by the first function. Write the functions in the second stack into the first stack in order from top to bottom.
4. The method according to claim 1, characterized in that, The execution of the first function includes: Determine whether the input edge of the node corresponding to the first function is in an infinite loop; If so, determine whether the execution conditions are met; If the execution conditions are met, the first function will be executed.
5. The method according to claim 4, characterized in that, The execution conditions include the current loop count being less than a set threshold.
6. The method according to claim 4, characterized in that, Determining whether the input edge of the node corresponding to the first function is in an infinite loop includes: Obtain the indication information associated with the first function in the first stack; The indication information is used to determine whether the input edge of the node corresponding to the first function is in an infinite loop.
7. The method according to claim 1, characterized in that, The step of writing the second function into the first stack includes: By analyzing the connection relationships between the nodes in the node graph, it can be determined whether the input edge of the node corresponding to the second function is in an infinite loop. If so, the second function and the indication information are written to the first stack, wherein the indication information indicates that the input edge of the node corresponding to the second function is in an infinite loop.
8. A function processing device, characterized in that, include: The execution module is used to retrieve and execute the first function from the first stack; The determination module is used to determine the second function to be executed called by the first function during the execution of the first function. The first function and the second function are functions corresponding to different nodes in the node graph, and the node graph is a graph composed of multiple nodes obtained by programming through a visual programming method. The writing module is used to write the second function into the first stack; The acquisition module is used to acquire the second function from the first stack after the first function has been executed; The execution module is returned to use the second function as the first function, and then returns to continue executing the first function until the first stack is empty.
9. An electronic device, characterized in that, The electronic device includes: One or more processing devices; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the function processing method as described in any one of claims 1-7.
10. A storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the function processing method as described in any one of claims 1-7.