Implementation methods of graphical programming

Through graphical programming, users can define function graphs and connection instructions in a canvas to generate program logic, solving the problem of poor code readability in complex software and achieving efficient program framework construction and code security.

CN115098091BActive Publication Date: 2026-08-04HAINAN TELECOM PLANNING & DESIGN INST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HAINAN TELECOM PLANNING & DESIGN INST CO LTD
Filing Date
2022-06-23
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

In existing technologies, the programming process of complex software suffers from poor code readability, leading to low efficiency for developers in understanding and extending functions, especially in secondary development where it is difficult to quickly clarify function call relationships.

Method used

This invention provides a graphical programming method that displays function graphs and composite function graphs from a graphical asset library. Users define function content and connection instructions on the canvas to generate program logic. It also supports multi-threaded programming, reference type variables, and encryption of program code, thereby improving the readability of program logic and development efficiency.

Benefits of technology

The graphical programming approach improves the readability of program logic, enables rapid construction of program frameworks, supports complex software design, and ensures code security through encryption technology.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115098091B_ABST
    Figure CN115098091B_ABST
Patent Text Reader

Abstract

This invention provides a method for implementing graphical programming, comprising the following steps: when a user creates a new graphical programming project, displaying selectable materials from a graphical material library; displaying the user-selected selectable materials on the canvas of the graphical programming project; obtaining the user's definition of the function content corresponding to the function graph, and adjusting the display of the function graph's entry and exit nodes according to the definition; obtaining the user's connection instructions between the function graph's exit node and other function graph's entry nodes, generating a connection line between the two function graphs according to the connection instructions, and generating the program logic for function calls; generating the corresponding program code file based on the program logic of the graphical programming project. This invention uses graphics to express the process of function definition, program logic, function composition, and multithreading in high-level programming languages, enabling complex software design, improving the readability of program logic, and helping users quickly build program frameworks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of graphical programming technology, and more particularly to a method for implementing graphical programming. Background Technology

[0002] Programming is the process of editing programs to make computers execute them. A computer program is a set of instructions that tells the computer how to perform specific tasks. The more complex the software, the more complex and less readable the underlying computer program code becomes. This can pose considerable difficulties for developers, especially for software that has undergone secondary development, functional expansion, and has reached a certain scale. Developers who join midway through the process need to spend a lot of time understanding the software architecture and clarifying the calling relationships between different functions. If programming can be implemented graphically, representing the calls between different functions and the passing of parameters through different graphics, it will help improve the readability of computer programs, help developers quickly understand the program logic and architecture, and improve development efficiency. Summary of the Invention

[0003] Therefore, the purpose of this invention is to provide a graphical programming implementation method to overcome or at least partially solve the above-mentioned problems existing in the prior art.

[0004] To achieve the above-mentioned objectives, this invention provides a method for implementing graphical programming, comprising the following steps:

[0005] S101. When a user creates a new graphical programming project, selectable materials from the graphical material library are displayed. The selectable materials include function graphs and composite function graphs. The function graph is a composite block diagram, and the composite function graph is a flowchart containing multiple function graphs.

[0006] S102. Display the user-selected optional materials on the canvas of the graphical programming project;

[0007] S103. Obtain the user's definition of the function content corresponding to the function graph, and adjust the display of the entry node and exit node of the function graph according to the definition. The entry node represents the entry point of the function corresponding to the function graph, and the exit node represents the return value of the function corresponding to the function graph.

[0008] S104. Obtain the user's connection instructions between the function graph exit node and other function graph entry nodes, generate connection lines between the two function graphs according to the connection instructions, and generate the program logic for function calls.

[0009] S105. Generate the corresponding program code file based on the program logic of the graphical programming project.

[0010] Furthermore, the entry node and exit node of the function graph are located on opposite sides of the combined block diagram. A function graph has one entry node and zero or more exit nodes, with different exits representing different program branches.

[0011] Furthermore, the combined function graph is a flowchart containing multiple function graphs, and its thumbnail is a combined block diagram. Double-clicking the combined function graph will expand to a new page, where you can edit the flowchart containing multiple function graphs.

[0012] Furthermore, the exit nodes of the composite function graph can be dynamically defined. In the composite function graph editing page, dragging an exit graph from the resource library defines one exit node for the composite function; dragging multiple exit graphs allows you to define multiple exit nodes for the composite function.

[0013] Furthermore, the graphical programming implementation method supports multithreaded programming, which is achieved through the following steps:

[0014] S201. Define local and global variables through configuration files. Local variables have scope within a single execution thread, while global variables have scope across all execution threads.

[0015] S202. Configure the number of threads for the program to run through the configuration file. Each thread starts executing the program according to the first function in the flowchart, and then continues to execute the next function connected to the function's return point, and so on. Each thread can obtain its thread number through a system variable to distinguish it from other threads.

[0016] S203. Thread safety is achieved through "atomic lock function graphs". Locks are acquired before the execution of a function and unlocked after the function is completed.

[0017] S204. Dynamically start a new thread using the "Start Thread Function Graph". The successful exit of the "Start Thread Function Graph" is connected to a composite function graph, which represents the flowchart of the new thread. Double-clicking the composite function graph allows you to edit the thread's program logic flowchart on a new page.

[0018] S205. Messages are passed between threads using a "message function graph". Messages are stored in user-defined variables.

[0019] Furthermore, the implementation method of graphical programming supports reference type variables. In addition to basic type variables such as strings, integers, floating-point numbers, and booleans, reference type variables can also be defined. Through reference type variables, arrays, sets, hash tables, and even custom class objects can be used in graphical programming, which is essential for writing complex programs. The following steps are used to program complex variables:

[0020] S301. Reference type variables support collection types, and multiple variables can be referenced using the KEY-VALUE method. Each variable can be a variable of a different type.

[0021] S302. Reference type variables support referencing strings, integers, floating-point numbers, booleans, smart pointers, and references to reference types. Smart pointers can reference user-defined structure variables and can dynamically destroy variables and reclaim memory. References to reference types can define multi-level structured data types.

[0022] S303. Define reference variables through configuration files.

[0023] S304. Users write custom dynamic function library (SO) or DLL functions, or write custom functions using the provided function library. The functions use reference variable parameters to pass user-defined structure variables back to the flowchart.

[0024] S305, The implementation method of graphical programming provides a set of system functions that can perform operations such as assignment, deletion, and copying of reference variables in the flowchart.

[0025] Furthermore, in step S105, during the process of compiling the program logic of the graphical programming project to generate the corresponding program code file, it is determined whether the exit node of the function graph meets the semantic requirements of the entry node of the connected function graph. If it does not meet the requirements, the entry node of the connected function graph is adjusted to the first color and / or the first shape; if it meets the requirements, the entry node of the connected function graph is adjusted to the second color and / or the second shape.

[0026] Furthermore, after generating the corresponding program code file based on the program logic of the graphical programming project, the program code file is encrypted. The encryption specifically includes the following steps:

[0027] S401. Capture the canvas image of the graphical programming project and extract the color, shape, and spatial features of the canvas image;

[0028] S402. Perform hash operations on the color features, shape features, and spatial features of the canvas image respectively to obtain three corresponding hash values;

[0029] S403. Take the integer parts of the three hash values ​​and use them as integers in the modulo operation to obtain the corresponding remainder values;

[0030] S404. The remainder value is used as input to generate a key through a key algorithm, and the program code file is encrypted based on the key.

[0031] Compared with the prior art, the beneficial effects of the present invention are:

[0032] This invention provides a graphical programming implementation method. When a user creates a new graphical programming project, they select suitable optional materials from a graphical material library and add them to the canvas of the graphical programming project. The user can define the content of function graphs on the canvas and input connection instructions between different function graphs, thereby generating the program logic of function calls. After completing the program logic settings for the entire project, the corresponding program code file can be generated and output. This method uses graphics to express function definitions, program logic, composite functions, and complex structure variable definitions in high-level programming languages. It supports multi-threaded programming, can complete complex software designs, improves the readability of program logic, and quickly completes the construction of the program framework. Attached Figure Description

[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only preferred embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0034] Figure 1 This is a schematic diagram of the overall process of a graphical programming implementation method provided by an embodiment of the present invention.

[0035] Figure 2 This is a schematic diagram of a function graph provided in an embodiment of the present invention.

[0036] Figure 3 This is a graphical programming diagram of a simple program provided in an embodiment of the present invention.

[0037] Figure 4 This is a graphical schematic diagram of a combinatorial function provided in an embodiment of the present invention.

[0038] Figure 5 This is a graphical diagram of the combination of thread startup functions provided in an embodiment of the present invention.

[0039] Figure 6 This is a schematic diagram of the program code file encryption process provided in an embodiment of the present invention. Detailed Implementation

[0040] The principles and features of the present invention are described below with reference to the accompanying drawings. The listed embodiments are only used to explain the present invention and are not intended to limit the scope of the present invention.

[0041] Reference Figure 1 This embodiment provides a method for implementing graphical programming, which specifically includes the following steps:

[0042] S101. When a user creates a new graphical programming project, selectable materials from the graphical material library are displayed. The selectable materials include function graphs and composite function graphs. The function graphs are composite block diagrams, and the composite function graphs are flowcharts containing multiple function graphs.

[0043] S102. Display the user-selected optional materials on the canvas of the graphical programming project. After the user creates a graphical programming project, a blank canvas for graphical programming is displayed in the system's visual human-computer interaction interface. The user can select the required graphic materials from the graphic material library and place them on the canvas. Graphic materials are part of the program logic and are used to represent functions in the computer program.

[0044] S103. Obtain the user's definition of the function content corresponding to the function graph. Adjust the display of the entry and exit nodes of the function graph according to the definition. The entry node represents the entry point of the function corresponding to the function graph, and the exit node represents the return value of the function corresponding to the function graph. The return value is an integer, and the next program execution branch is determined based on the return value. The function content includes name, formal parameter definition, function body statements, return value expression, etc. The user can select a function graph on the canvas to customize its function content. When the user modifies the formal parameters, return value expression, etc. of the function, the number of entry and exit nodes of the function graph will also change.

[0045] S104. Obtain the user's connection instructions for the exit node of a function graph and the entry node of other function graphs. Generate a connection line between the two function graphs according to the connection instructions, and generate the program logic for function calls. The user can connect the exit node of a function graph to the entry node of other function graphs in the canvas, thereby representing the program logic for function calls, such as sequence, branching, looping, etc.

[0046] S105. Generate the corresponding program code file based on the program logic of the graphical programming project. After the user completes the design of the program logic for the entire graphical programming project, they can input conversion commands to convert the program logic represented by the graphic materials in the canvas and the connection relationships between the various graphic materials into the corresponding program code file.

[0047] For example, the entry and exit nodes of a function graph are located on opposite sides of the composite block diagram. For instance, when the entry node is on the top side of the composite block diagram, the exit node should be on the bottom side to avoid confusion and difficulty in identification when connecting different composite block diagrams. A function graph has one entry node and zero or more exit nodes, with different exits representing different program branches.

[0048] As a preferred example, the combined function graph is a flowchart containing multiple function graphs. Its thumbnail is a combined block diagram, which also has entry nodes and exit nodes. Double-clicking the combined function graph can expand a new page, on which the flowchart containing multiple function graphs can be edited.

[0049] As a preferred example, the exit nodes of a combinatorial function graph can be dynamically defined. In the editing page of the combinatorial function graph, dragging an exit graph from the resource library defines one exit node for the combinatorial function; dragging multiple exit graphs defines multiple exit nodes for the combinatorial function.

[0050] As a preferred example, composite function graphs can be used to program asynchronous subprocesses, which, like threads in Java, can execute programs in parallel. Multithreaded programming can be achieved through the following steps:

[0051] S201. Define local and global variables through configuration files. Local variables have scope within a single execution thread, while global variables have scope across all execution threads.

[0052] S202. Configure the number of threads for the program to run through the configuration file. Each thread starts executing the program according to the first function in the flowchart, and then continues to execute the next function connected to the function's return point, and so on. Each thread can obtain its thread number through a system variable to distinguish it from other threads.

[0053] S203. Thread safety is achieved through "atomic lock function graphs". Locks are acquired before the execution of a function and unlocked after the function is completed.

[0054] S204. Dynamically start a new thread using the "Start Thread Function Graph". The successful exit of the "Start Thread Function Graph" is connected to a composite function graph, which represents the flowchart of the new thread. Double-clicking the composite function graph allows you to edit the thread's program logic flowchart on a new page.

[0055] S205. Messages are passed between threads using a "message function graph". Messages are stored in user-defined variables.

[0056] As a preferred example, one implementation of graphical programming supports reference type variables. In addition to basic type variables such as strings, integers, floating-point numbers, and booleans, reference type variables can also be defined. Reference type variables enable the use of arrays, sets, hash tables, and even custom class objects in graphical programming, which is essential for writing complex programs. The following steps demonstrate how to program complex variables:

[0057] S301. Reference type variables support collection types, and multiple variables can be referenced using the KEY-VALUE method. Each variable can be a variable of a different type.

[0058] S302. Reference type variables support referencing strings, integers, floating-point numbers, booleans, smart pointers, and references to reference types. Smart pointers can reference user-defined structure variables and can dynamically destroy variables and reclaim memory. References to reference types can define multi-level structured data types.

[0059] S303. Define reference variables through configuration files.

[0060] S304. Users write custom dynamic function library (SO) or DLL functions, or write custom functions using the provided function library. The functions use reference variable parameters to pass user-defined structure variables back to the flowchart.

[0061] S305, Graphical programming provides a set of system functions that can perform operations such as assigning, deleting, and copying reference variables in the flowchart.

[0062] As a preferred example, in step S105, during the process of compiling the program logic of the graphical programming project to generate the corresponding program code file, it is determined whether the function graph conforms to the syntactic and semantic requirements. If it does not conform, the entry node of the function graph is adjusted to the first color and / or the first shape; if it conforms, the entry node of the connected function graphs is adjusted to the second color and / or the second shape. For example, if function A requires a Boolean parameter, and the requirement of function A is not met, the entry node of function A's function graph is adjusted to red to make it easier for the user to find and adjust. When the parameter type is correct, the entry node of function A's function graph is adjusted to green.

[0063] As a preferred example, refer to Figure 6 After generating the corresponding program code file based on the program logic of the graphical programming project, the program code file is encrypted. The encryption specifically includes the following steps:

[0064] S401. Capture the canvas image of the graphical programming project. The canvas image contains all function graphs and connecting lines. Extract the color features, shape features, and spatial features of the canvas image. The color features can be represented using color moments; the shape features are the contour features of the canvas image, which can be represented by the moments of the canvas area occupied by the outer contours of the graphs formed by all function graphs and connecting lines in the canvas; the spatial features are the relative spatial positions or directional relationships between all function graphs in the canvas. This can be achieved by establishing coordinate axes to obtain the coordinate position of each function graph in the canvas, and calculating the relative positional relationships of the function graphs based on their coordinate positions.

[0065] S402. Perform hash operations on the color features, shape features, and spatial features of the canvas image respectively to obtain three corresponding hash values.

[0066] S403. Take the integer parts of the three hash values ​​and use them as integers in the modulo operation to obtain the corresponding remainder values. For example, when the modulo operation is defined as (a+b)%P, it means the remainder when the arithmetic sum of a and b is divided by P. The three hash values ​​can be substituted into a, b and P respectively to obtain the remainder. The specific formula for the modulo operation can be adjusted according to actual needs.

[0067] S404. Using the remainder value as input, a key is generated through a key algorithm. The program code file is then encrypted using this key. Since the graphics of each graphical programming project are generally different, generating a key based on the color, shape, and spatial characteristics of the overall graphics of the graphical programming project is unique and difficult to crack. Encrypting the program code file corresponding to the graphical programming project using this key can effectively improve the security of the program code file and prevent the leakage of confidential code.

[0068] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A method for implementing graphical programming, characterized in that, The method includes the following steps: S101. When a user creates a new graphical programming project, selectable materials from the graphical material library are displayed. The selectable materials include function graphs and composite function graphs. The function graph is a composite block diagram, and the composite function graph is a flowchart containing multiple function graphs. S102. Display the user-selected optional materials on the canvas of the graphical programming project; S103. Obtain the user's definition of the function content corresponding to the function graph, and adjust the display of the entry node and exit node of the function graph according to the definition. The entry node represents the entry point of the function corresponding to the function graph, and the exit node represents the program branch after the execution of the function corresponding to the function graph returns. S104. Obtain the user's connection instructions for the function graph exit node and other function graph entry nodes, generate connection lines between the two function graph entry and exit nodes according to the connection instructions, and generate the program logic for function calls. S105. Generate the corresponding program code file based on the program logic of the graphical programming project; After generating the corresponding program code file based on the program logic of the graphical programming project, the program code file is encrypted. The encryption specifically includes the following steps: S401. Capture the canvas image of the graphical programming project and extract the color, shape, and spatial features of the canvas image; S402. Perform hash operations on the color features, shape features, and spatial features of the canvas image respectively to obtain three corresponding hash values; S403. Take the integer parts of the three hash values ​​and use them as integers in the modulo operation to obtain the corresponding remainder values; S404. The remainder value is used as input to generate a key through a key algorithm, and the program code file is encrypted based on the key.

2. The graphical programming implementation method according to claim 1, characterized in that, The entry node and exit node of the function graph are located on opposite sides of the combined block diagram. A function graph has one entry node and an unlimited number of exit nodes. Different exits represent different program branches.

3. The graphical programming implementation method according to claim 1, characterized in that, A combined function graph is a flowchart containing multiple function graphs. Its thumbnail is a combined block diagram. Double-clicking a combined function graph will expand to a new page, where you can edit the flowchart containing multiple function graphs.

4. The graphical programming implementation method according to claim 1, characterized in that, The composite function graph is used to dynamically define the exit node of the composite function graph. In the composite function graph editing page, dragging an exit graph from the material library can define an exit node of the composite function. Dragging multiple exit graphs can define multiple exit nodes of the composite function.

5. The graphical programming implementation method according to claim 1, characterized in that, Multithreaded programming is supported. The following steps are used to implement multithreaded programming: S201. Define local and global variables through configuration files. Local variables are valid within a single execution thread, while global variables are valid across all execution threads. S202. Configure the number of threads running the program through the configuration file. Each thread starts executing the program according to the first function in the flowchart. Then, according to the function return exit, it continues to execute the next function connected to the exit, and so on. Each thread can obtain the thread number through the system variable to distinguish it from other threads. S203. Thread safety is achieved through "atomic lock function graphs". Locking is performed before the execution of a function process begins and unlocking is performed after the process ends. S204. Dynamically start a new thread by using the "Start Thread Function Graph". The successful exit of the "Start Thread Function Graph" is connected to a composite function graph. The composite function graph represents the flowchart of the new thread. After double-clicking the composite function graph, you can edit the program logic flowchart of the thread on a new page. S205. Messages are passed between threads through "message function graphs", and the messages are stored in custom variables.

6. The method for implementing graphical programming according to claim 1, characterized in that, It supports reference type variables, including basic type variables and user-defined reference type variables. Through reference type variables, arrays, sets, hash tables, and even user-defined class objects can be used in graphical programming. Complex variable programming can be achieved through the following steps: S301. Reference type variables support collection types, and multiple variables can be referenced in the KEY-VALUE manner. Each variable can be a variable of a different type. S302. Reference type variables support referencing strings, integers, floating-point numbers, booleans, smart pointers, and references of reference types. Smart pointers can reference user-defined structure variables and can also dynamically destroy variables and reclaim memory. References of reference types can define multi-level structured data types. S303. Define reference variables through configuration files; S304. Users write custom dynamic function library (SO) or DLL functions, or write custom functions through the provided function library. The functions use reference variable parameters to pass user-defined structure variables back to the flowchart. S305, Graphical programming provides a set of system functions that can assign, delete, and copy reference variables in the flowchart.

7. The method for implementing graphical programming according to claim 1, characterized in that, In step S105, during the process of compiling the program logic of the graphical programming project to generate the corresponding program code file, it is determined whether the exit node of the function graph meets the semantic requirements of the entry node of the connected function graph. If it does not meet the requirements, the entry node of the connected function graph is adjusted to the first color and / or the first shape; if it meets the requirements, the entry node of the connected function graph is adjusted to the second color and / or the second shape.